Working outgoing IP for {http,z3950}_client MP-575
[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         /// get tcpip address
52         std::string get_bind_address();
53
54         void set_custom_session(const std::string &s);
55     private:
56         friend std::ostream&
57         std::operator<<(std::ostream& os, const metaproxy_1::Origin& o);
58
59         std::string m_address;
60         unsigned int m_origin_id;
61         int m_max_sockets;
62         std::string m_custom_session;
63         std::string get_forward_address() const;
64     };
65 }
66
67 #endif
68 /*
69  * Local variables:
70  * c-basic-offset: 4
71  * c-file-style: "Stroustrup"
72  * indent-tabs-mode: nil
73  * End:
74  * vim: shiftwidth=4 tabstop=8 expandtab
75  */
76