d129e71eafece8a0af199e4a4dd1b0688c361b51
[metaproxy-moved-to-github.git] / include / metaproxy / origin.hpp
1 /* This file is part of Metaproxy.
2    Copyright (C) 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, const metaproxy_1::Origin& o);
31 }
32
33 namespace metaproxy_1 {
34
35     class Origin {
36     public:
37         Origin();
38
39         /// set client IP info - left val in assignment
40         void set_tcpip_address(std::string addr, unsigned long id);
41
42         /// set max sockets (for outgoing connections to a given target)
43         void set_max_sockets(int max_sockets);
44
45         /// set max sockets (for outgoing connections to a given target)
46         int get_max_sockets();
47
48         /// get tcpip address
49         std::string get_address();
50
51         void set_custom_session(const std::string &s);
52     private:
53         friend std::ostream&
54         std::operator<<(std::ostream& os, const metaproxy_1::Origin& o);
55
56         std::string m_address;
57         unsigned int m_origin_id;
58         int m_max_sockets;
59         std::string m_custom_session;
60         std::string get_forward_address() const;
61     };
62 }
63
64 #endif
65 /*
66  * Local variables:
67  * c-basic-offset: 4
68  * c-file-style: "Stroustrup"
69  * indent-tabs-mode: nil
70  * End:
71  * vim: shiftwidth=4 tabstop=8 expandtab
72  */
73