Year 2007.
[metaproxy-moved-to-github.git] / src / origin.hpp
1 /* $Id: origin.hpp,v 1.3 2007-01-25 14:05:54 adam Exp $
2    Copyright (c) 2005-2007, Index Data.
3
4    See the LICENSE file for details
5  */
6
7 #ifndef YP2_ORIGIN_HPP
8 #define YP2_ORIGIN_HPP
9
10 #include <iosfwd>
11 #include <string>
12
13 namespace metaproxy_1 {
14     class Origin;
15 }
16
17 namespace std {
18     std::ostream& operator<<(std::ostream& os, metaproxy_1::Origin& o);
19 }
20
21 namespace metaproxy_1 {
22     
23     class Origin {
24     public:
25         Origin(std::string listen_host = "", unsigned int listen_port = 0);
26         
27         /// get function - right val in assignment
28         std::string listen_host() const;
29
30         /// set function - left val in assignment
31         std::string & listen_host();
32  
33         /// get function - right val in assignment
34         unsigned int listen_port() const;
35         
36         /// set function - left val in assignment
37         unsigned int & listen_port();
38  
39         /// set client IP info - left val in assignment
40         void set_tcpip_address(std::string addr, unsigned long id);
41
42     private:
43         friend std::ostream& 
44         std::operator<<(std::ostream& os,  metaproxy_1::Origin& o);
45         
46         enum origin_t {
47             API,
48             UNIX,
49             TCPIP
50         } m_type;
51         std::string m_address; // UNIX+TCPIP
52         unsigned int m_origin_id;
53         std::string m_listen_host;
54         unsigned int m_listen_port;
55     };
56
57 }
58
59
60
61 #endif
62 /*
63  * Local variables:
64  * c-basic-offset: 4
65  * indent-tabs-mode: nil
66  * c-file-style: "stroustrup"
67  * End:
68  * vim: shiftwidth=4 tabstop=8 expandtab
69  */