Updated copyright headers. Omit CVS ID.
[metaproxy-moved-to-github.git] / src / origin.hpp
1 /* This file is part of Metaproxy.
2    Copyright (C) 2005-2008 Index Data
3
4 Metaproxy is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
7 version.
8
9 Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12 for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17 */
18
19 #ifndef YP2_ORIGIN_HPP
20 #define YP2_ORIGIN_HPP
21
22 #include <iosfwd>
23 #include <string>
24
25 namespace metaproxy_1 {
26     class Origin;
27 }
28
29 namespace std {
30     std::ostream& operator<<(std::ostream& os, metaproxy_1::Origin& o);
31 }
32
33 namespace metaproxy_1 {
34     
35     class Origin {
36     public:
37         Origin(std::string listen_host = "", unsigned int listen_port = 0);
38         
39         /// get function - right val in assignment
40         std::string listen_host() const;
41
42         /// set function - left val in assignment
43         std::string & listen_host();
44  
45         /// get function - right val in assignment
46         unsigned int listen_port() const;
47         
48         /// set function - left val in assignment
49         unsigned int & listen_port();
50  
51         /// set client IP info - left val in assignment
52         void set_tcpip_address(std::string addr, unsigned long id);
53
54     private:
55         friend std::ostream& 
56         std::operator<<(std::ostream& os,  metaproxy_1::Origin& o);
57         
58         enum origin_t {
59             API,
60             UNIX,
61             TCPIP
62         } m_type;
63         std::string m_address; // UNIX+TCPIP
64         unsigned int m_origin_id;
65         std::string m_listen_host;
66         unsigned int m_listen_port;
67     };
68
69 }
70
71
72
73 #endif
74 /*
75  * Local variables:
76  * c-basic-offset: 4
77  * indent-tabs-mode: nil
78  * c-file-style: "stroustrup"
79  * End:
80  * vim: shiftwidth=4 tabstop=8 expandtab
81  */