OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 FifoBuffer in_buffer_; | 57 FifoBuffer in_buffer_; |
58 DISALLOW_COPY_AND_ASSIGN(ProxyBinding); | 58 DISALLOW_COPY_AND_ASSIGN(ProxyBinding); |
59 }; | 59 }; |
60 | 60 |
61 class ProxyServer : public sigslot::has_slots<> { | 61 class ProxyServer : public sigslot::has_slots<> { |
62 public: | 62 public: |
63 ProxyServer(SocketFactory* int_factory, const SocketAddress& int_addr, | 63 ProxyServer(SocketFactory* int_factory, const SocketAddress& int_addr, |
64 SocketFactory* ext_factory, const SocketAddress& ext_ip); | 64 SocketFactory* ext_factory, const SocketAddress& ext_ip); |
65 ~ProxyServer() override; | 65 ~ProxyServer() override; |
66 | 66 |
| 67 // Returns the address to which the proxy server is bound |
| 68 SocketAddress GetServerAddress(); |
| 69 |
67 protected: | 70 protected: |
68 void OnAcceptEvent(AsyncSocket* socket); | 71 void OnAcceptEvent(AsyncSocket* socket); |
69 virtual AsyncProxyServerSocket* WrapSocket(AsyncSocket* socket) = 0; | 72 virtual AsyncProxyServerSocket* WrapSocket(AsyncSocket* socket) = 0; |
70 void OnBindingDestroyed(ProxyBinding* binding); | 73 void OnBindingDestroyed(ProxyBinding* binding); |
71 | 74 |
72 private: | 75 private: |
73 typedef std::list<ProxyBinding*> BindingList; | 76 typedef std::list<ProxyBinding*> BindingList; |
74 SocketFactory* ext_factory_; | 77 SocketFactory* ext_factory_; |
75 SocketAddress ext_ip_; | 78 SocketAddress ext_ip_; |
76 scoped_ptr<AsyncSocket> server_socket_; | 79 scoped_ptr<AsyncSocket> server_socket_; |
77 BindingList bindings_; | 80 BindingList bindings_; |
78 DISALLOW_COPY_AND_ASSIGN(ProxyServer); | 81 DISALLOW_COPY_AND_ASSIGN(ProxyServer); |
79 }; | 82 }; |
80 | 83 |
81 // SocksProxyServer is a simple extension of ProxyServer to implement SOCKS. | 84 // SocksProxyServer is a simple extension of ProxyServer to implement SOCKS. |
82 class SocksProxyServer : public ProxyServer { | 85 class SocksProxyServer : public ProxyServer { |
83 public: | 86 public: |
84 SocksProxyServer(SocketFactory* int_factory, const SocketAddress& int_addr, | 87 SocksProxyServer(SocketFactory* int_factory, const SocketAddress& int_addr, |
85 SocketFactory* ext_factory, const SocketAddress& ext_ip) | 88 SocketFactory* ext_factory, const SocketAddress& ext_ip) |
86 : ProxyServer(int_factory, int_addr, ext_factory, ext_ip) { | 89 : ProxyServer(int_factory, int_addr, ext_factory, ext_ip) { |
87 } | 90 } |
88 protected: | 91 protected: |
89 AsyncProxyServerSocket* WrapSocket(AsyncSocket* socket) override; | 92 AsyncProxyServerSocket* WrapSocket(AsyncSocket* socket) override; |
90 DISALLOW_COPY_AND_ASSIGN(SocksProxyServer); | 93 DISALLOW_COPY_AND_ASSIGN(SocksProxyServer); |
91 }; | 94 }; |
92 | 95 |
93 } // namespace rtc | 96 } // namespace rtc |
94 | 97 |
95 #endif // WEBRTC_BASE_PROXYSERVER_H_ | 98 #endif // WEBRTC_BASE_PROXYSERVER_H_ |
OLD | NEW |