added header file
[metaproxy-moved-to-github.git] / src / origin.hpp
1 /* $Id: origin.hpp,v 1.1 2006-09-26 13:04:07 marc Exp $
2    Copyright (c) 2005-2006, 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 server_host = "", unsigned int server_port = 0);
26         
27         /// get function - right val in assignment
28         std::string server_host() const;
29         
30         /// get function - right val in assignment
31         unsigned int server_port() const;
32         
33         /// set client IP info - left val in assignment
34         void set_tcpip_address(std::string addr, unsigned long id);
35
36     private:
37         friend std::ostream& 
38         std::operator<<(std::ostream& os,  metaproxy_1::Origin& o);
39         
40         enum origin_t {
41             API,
42             UNIX,
43             TCPIP
44         } m_type;
45         std::string m_address; // UNIX+TCPIP
46         unsigned long m_origin_id;
47         std::string m_server_host;
48         unsigned int m_server_port;
49     };
50
51 }
52
53
54
55 #endif
56 /*
57  * Local variables:
58  * c-basic-offset: 4
59  * indent-tabs-mode: nil
60  * c-file-style: "stroustrup"
61  * End:
62  * vim: shiftwidth=4 tabstop=8 expandtab
63  */