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 |
11 #ifndef WEBRTC_BASE_NATSOCKETFACTORY_H_ | 11 #ifndef WEBRTC_BASE_NATSOCKETFACTORY_H_ |
12 #define WEBRTC_BASE_NATSOCKETFACTORY_H_ | 12 #define WEBRTC_BASE_NATSOCKETFACTORY_H_ |
13 | 13 |
14 #include <string> | 14 #include <string> |
15 #include <map> | 15 #include <map> |
| 16 #include <memory> |
16 #include <set> | 17 #include <set> |
17 | 18 |
18 #include "webrtc/base/natserver.h" | 19 #include "webrtc/base/natserver.h" |
19 #include "webrtc/base/socketaddress.h" | 20 #include "webrtc/base/socketaddress.h" |
20 #include "webrtc/base/socketserver.h" | 21 #include "webrtc/base/socketserver.h" |
21 | 22 |
22 namespace rtc { | 23 namespace rtc { |
23 | 24 |
24 const size_t kNATEncodedIPv4AddressSize = 8U; | 25 const size_t kNATEncodedIPv4AddressSize = 8U; |
25 const size_t kNATEncodedIPv6AddressSize = 20U; | 26 const size_t kNATEncodedIPv6AddressSize = 20U; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 void RemoveTranslator(const SocketAddress& ext_ip); | 110 void RemoveTranslator(const SocketAddress& ext_ip); |
110 | 111 |
111 bool AddClient(const SocketAddress& int_ip); | 112 bool AddClient(const SocketAddress& int_ip); |
112 void RemoveClient(const SocketAddress& int_ip); | 113 void RemoveClient(const SocketAddress& int_ip); |
113 | 114 |
114 // Looks for the specified client in this or a child NAT. | 115 // Looks for the specified client in this or a child NAT. |
115 Translator* FindClient(const SocketAddress& int_ip); | 116 Translator* FindClient(const SocketAddress& int_ip); |
116 | 117 |
117 private: | 118 private: |
118 NATSocketServer* server_; | 119 NATSocketServer* server_; |
119 scoped_ptr<SocketFactory> internal_factory_; | 120 std::unique_ptr<SocketFactory> internal_factory_; |
120 scoped_ptr<NATServer> nat_server_; | 121 std::unique_ptr<NATServer> nat_server_; |
121 TranslatorMap nats_; | 122 TranslatorMap nats_; |
122 std::set<SocketAddress> clients_; | 123 std::set<SocketAddress> clients_; |
123 }; | 124 }; |
124 | 125 |
125 explicit NATSocketServer(SocketServer* ss); | 126 explicit NATSocketServer(SocketServer* ss); |
126 | 127 |
127 SocketServer* socketserver() { return server_; } | 128 SocketServer* socketserver() { return server_; } |
128 MessageQueue* queue() { return msg_queue_; } | 129 MessageQueue* queue() { return msg_queue_; } |
129 | 130 |
130 Translator* GetTranslator(const SocketAddress& ext_ip); | 131 Translator* GetTranslator(const SocketAddress& ext_ip); |
(...skipping 26 matching lines...) Expand all Loading... |
157 }; | 158 }; |
158 | 159 |
159 // Free-standing NAT helper functions. | 160 // Free-standing NAT helper functions. |
160 size_t PackAddressForNAT(char* buf, size_t buf_size, | 161 size_t PackAddressForNAT(char* buf, size_t buf_size, |
161 const SocketAddress& remote_addr); | 162 const SocketAddress& remote_addr); |
162 size_t UnpackAddressFromNAT(const char* buf, size_t buf_size, | 163 size_t UnpackAddressFromNAT(const char* buf, size_t buf_size, |
163 SocketAddress* remote_addr); | 164 SocketAddress* remote_addr); |
164 } // namespace rtc | 165 } // namespace rtc |
165 | 166 |
166 #endif // WEBRTC_BASE_NATSOCKETFACTORY_H_ | 167 #endif // WEBRTC_BASE_NATSOCKETFACTORY_H_ |
OLD | NEW |