OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2012 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 // Create a TURN port using the shared UDP socket, |socket|. | 45 // Create a TURN port using the shared UDP socket, |socket|. |
46 static TurnPort* Create(rtc::Thread* thread, | 46 static TurnPort* Create(rtc::Thread* thread, |
47 rtc::PacketSocketFactory* factory, | 47 rtc::PacketSocketFactory* factory, |
48 rtc::Network* network, | 48 rtc::Network* network, |
49 rtc::AsyncPacketSocket* socket, | 49 rtc::AsyncPacketSocket* socket, |
50 const std::string& username, // ice username. | 50 const std::string& username, // ice username. |
51 const std::string& password, // ice password. | 51 const std::string& password, // ice password. |
52 const ProtocolAddress& server_address, | 52 const ProtocolAddress& server_address, |
53 const RelayCredentials& credentials, | 53 const RelayCredentials& credentials, |
54 int server_priority, | 54 int server_priority, |
55 const std::string& origin) { | 55 const std::string& origin, |
| 56 webrtc::RtcEventLog* event_log) { |
56 return new TurnPort(thread, factory, network, socket, username, password, | 57 return new TurnPort(thread, factory, network, socket, username, password, |
57 server_address, credentials, server_priority, origin); | 58 server_address, credentials, server_priority, origin, |
| 59 event_log); |
58 } | 60 } |
59 | 61 |
60 // Create a TURN port that will use a new socket, bound to |network| and | 62 // Create a TURN port that will use a new socket, bound to |network| and |
61 // using a port in the range between |min_port| and |max_port|. | 63 // using a port in the range between |min_port| and |max_port|. |
62 static TurnPort* Create(rtc::Thread* thread, | 64 static TurnPort* Create(rtc::Thread* thread, |
63 rtc::PacketSocketFactory* factory, | 65 rtc::PacketSocketFactory* factory, |
64 rtc::Network* network, | 66 rtc::Network* network, |
65 uint16_t min_port, | 67 uint16_t min_port, |
66 uint16_t max_port, | 68 uint16_t max_port, |
67 const std::string& username, // ice username. | 69 const std::string& username, // ice username. |
68 const std::string& password, // ice password. | 70 const std::string& password, // ice password. |
69 const ProtocolAddress& server_address, | 71 const ProtocolAddress& server_address, |
70 const RelayCredentials& credentials, | 72 const RelayCredentials& credentials, |
71 int server_priority, | 73 int server_priority, |
72 const std::string& origin) { | 74 const std::string& origin, |
| 75 webrtc::RtcEventLog* event_log) { |
73 return new TurnPort(thread, factory, network, min_port, max_port, username, | 76 return new TurnPort(thread, factory, network, min_port, max_port, username, |
74 password, server_address, credentials, server_priority, | 77 password, server_address, credentials, server_priority, |
75 origin); | 78 origin, event_log); |
76 } | 79 } |
77 | 80 |
78 virtual ~TurnPort(); | 81 virtual ~TurnPort(); |
79 | 82 |
80 const ProtocolAddress& server_address() const { return server_address_; } | 83 const ProtocolAddress& server_address() const { return server_address_; } |
81 // Returns an empty address if the local address has not been assigned. | 84 // Returns an empty address if the local address has not been assigned. |
82 rtc::SocketAddress GetLocalAddress() const; | 85 rtc::SocketAddress GetLocalAddress() const; |
83 | 86 |
84 bool ready() const { return state_ == STATE_READY; } | 87 bool ready() const { return state_ == STATE_READY; } |
85 bool connected() const { | 88 bool connected() const { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 protected: | 170 protected: |
168 TurnPort(rtc::Thread* thread, | 171 TurnPort(rtc::Thread* thread, |
169 rtc::PacketSocketFactory* factory, | 172 rtc::PacketSocketFactory* factory, |
170 rtc::Network* network, | 173 rtc::Network* network, |
171 rtc::AsyncPacketSocket* socket, | 174 rtc::AsyncPacketSocket* socket, |
172 const std::string& username, | 175 const std::string& username, |
173 const std::string& password, | 176 const std::string& password, |
174 const ProtocolAddress& server_address, | 177 const ProtocolAddress& server_address, |
175 const RelayCredentials& credentials, | 178 const RelayCredentials& credentials, |
176 int server_priority, | 179 int server_priority, |
177 const std::string& origin); | 180 const std::string& origin, |
| 181 webrtc::RtcEventLog* event_log); |
178 | 182 |
179 TurnPort(rtc::Thread* thread, | 183 TurnPort(rtc::Thread* thread, |
180 rtc::PacketSocketFactory* factory, | 184 rtc::PacketSocketFactory* factory, |
181 rtc::Network* network, | 185 rtc::Network* network, |
182 uint16_t min_port, | 186 uint16_t min_port, |
183 uint16_t max_port, | 187 uint16_t max_port, |
184 const std::string& username, | 188 const std::string& username, |
185 const std::string& password, | 189 const std::string& password, |
186 const ProtocolAddress& server_address, | 190 const ProtocolAddress& server_address, |
187 const RelayCredentials& credentials, | 191 const RelayCredentials& credentials, |
188 int server_priority, | 192 int server_priority, |
189 const std::string& origin); | 193 const std::string& origin, |
| 194 webrtc::RtcEventLog* event_log); |
190 | 195 |
191 private: | 196 private: |
192 enum { | 197 enum { |
193 MSG_ALLOCATE_ERROR = MSG_FIRST_AVAILABLE, | 198 MSG_ALLOCATE_ERROR = MSG_FIRST_AVAILABLE, |
194 MSG_ALLOCATE_MISMATCH, | 199 MSG_ALLOCATE_MISMATCH, |
195 MSG_TRY_ALTERNATE_SERVER, | 200 MSG_TRY_ALTERNATE_SERVER, |
196 MSG_REFRESH_ERROR | 201 MSG_REFRESH_ERROR |
197 }; | 202 }; |
198 | 203 |
199 typedef std::list<TurnEntry*> EntryList; | 204 typedef std::list<TurnEntry*> EntryList; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 EntryList entries_; | 288 EntryList entries_; |
284 | 289 |
285 PortState state_; | 290 PortState state_; |
286 // By default the value will be set to 0. This value will be used in | 291 // By default the value will be set to 0. This value will be used in |
287 // calculating the candidate priority. | 292 // calculating the candidate priority. |
288 int server_priority_; | 293 int server_priority_; |
289 | 294 |
290 // The number of retries made due to allocate mismatch error. | 295 // The number of retries made due to allocate mismatch error. |
291 size_t allocate_mismatch_retries_; | 296 size_t allocate_mismatch_retries_; |
292 | 297 |
| 298 webrtc::RtcEventLog* event_log_; |
| 299 |
293 rtc::AsyncInvoker invoker_; | 300 rtc::AsyncInvoker invoker_; |
294 | 301 |
295 friend class TurnEntry; | 302 friend class TurnEntry; |
296 friend class TurnAllocateRequest; | 303 friend class TurnAllocateRequest; |
297 friend class TurnRefreshRequest; | 304 friend class TurnRefreshRequest; |
298 friend class TurnCreatePermissionRequest; | 305 friend class TurnCreatePermissionRequest; |
299 friend class TurnChannelBindRequest; | 306 friend class TurnChannelBindRequest; |
300 }; | 307 }; |
301 | 308 |
302 } // namespace cricket | 309 } // namespace cricket |
303 | 310 |
304 #endif // WEBRTC_P2P_BASE_TURNPORT_H_ | 311 #endif // WEBRTC_P2P_BASE_TURNPORT_H_ |
OLD | NEW |