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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // NATInternalSocketFactory implementation | 49 // NATInternalSocketFactory implementation |
50 AsyncSocket* CreateInternalSocket(int family, | 50 AsyncSocket* CreateInternalSocket(int family, |
51 int type, | 51 int type, |
52 const SocketAddress& local_addr, | 52 const SocketAddress& local_addr, |
53 SocketAddress* nat_addr) override; | 53 SocketAddress* nat_addr) override; |
54 | 54 |
55 private: | 55 private: |
56 SocketFactory* factory_; | 56 SocketFactory* factory_; |
57 SocketAddress nat_udp_addr_; | 57 SocketAddress nat_udp_addr_; |
58 SocketAddress nat_tcp_addr_; | 58 SocketAddress nat_tcp_addr_; |
59 DISALLOW_COPY_AND_ASSIGN(NATSocketFactory); | 59 RTC_DISALLOW_COPY_AND_ASSIGN(NATSocketFactory); |
60 }; | 60 }; |
61 | 61 |
62 // Creates sockets that will send traffic through a NAT depending on what | 62 // Creates sockets that will send traffic through a NAT depending on what |
63 // address they bind to. This can be used to simulate a client on a NAT sending | 63 // address they bind to. This can be used to simulate a client on a NAT sending |
64 // to a client that is not behind a NAT. | 64 // to a client that is not behind a NAT. |
65 // Note that the internal addresses of clients must be unique. This is because | 65 // Note that the internal addresses of clients must be unique. This is because |
66 // there is only one socketserver per thread, and the Bind() address is used to | 66 // there is only one socketserver per thread, and the Bind() address is used to |
67 // figure out which NAT (if any) the socket should talk to. | 67 // figure out which NAT (if any) the socket should talk to. |
68 // | 68 // |
69 // Example with 3 NATs (2 cascaded), and 3 clients. | 69 // Example with 3 NATs (2 cascaded), and 3 clients. |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 // NATInternalSocketFactory implementation | 146 // NATInternalSocketFactory implementation |
147 AsyncSocket* CreateInternalSocket(int family, | 147 AsyncSocket* CreateInternalSocket(int family, |
148 int type, | 148 int type, |
149 const SocketAddress& local_addr, | 149 const SocketAddress& local_addr, |
150 SocketAddress* nat_addr) override; | 150 SocketAddress* nat_addr) override; |
151 | 151 |
152 private: | 152 private: |
153 SocketServer* server_; | 153 SocketServer* server_; |
154 MessageQueue* msg_queue_; | 154 MessageQueue* msg_queue_; |
155 TranslatorMap nats_; | 155 TranslatorMap nats_; |
156 DISALLOW_COPY_AND_ASSIGN(NATSocketServer); | 156 RTC_DISALLOW_COPY_AND_ASSIGN(NATSocketServer); |
157 }; | 157 }; |
158 | 158 |
159 // Free-standing NAT helper functions. | 159 // Free-standing NAT helper functions. |
160 size_t PackAddressForNAT(char* buf, size_t buf_size, | 160 size_t PackAddressForNAT(char* buf, size_t buf_size, |
161 const SocketAddress& remote_addr); | 161 const SocketAddress& remote_addr); |
162 size_t UnpackAddressFromNAT(const char* buf, size_t buf_size, | 162 size_t UnpackAddressFromNAT(const char* buf, size_t buf_size, |
163 SocketAddress* remote_addr); | 163 SocketAddress* remote_addr); |
164 } // namespace rtc | 164 } // namespace rtc |
165 | 165 |
166 #endif // WEBRTC_BASE_NATSOCKETFACTORY_H_ | 166 #endif // WEBRTC_BASE_NATSOCKETFACTORY_H_ |
OLD | NEW |