Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(511)

Side by Side Diff: webrtc/p2p/base/turnport.h

Issue 2063823008: Adding IceConfig option to assume TURN/TURN candidate pairs will work. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Responding to comments. Doing "presumed writable" determination in Connection. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 const std::string& password, // ice password. 64 const std::string& password, // ice password.
65 const ProtocolAddress& server_address, 65 const ProtocolAddress& server_address,
66 const RelayCredentials& credentials, 66 const RelayCredentials& credentials,
67 int server_priority, 67 int server_priority,
68 const std::string& origin) { 68 const std::string& origin) {
69 return new TurnPort(thread, factory, network, ip, min_port, max_port, 69 return new TurnPort(thread, factory, network, ip, min_port, max_port,
70 username, password, server_address, credentials, 70 username, password, server_address, credentials,
71 server_priority, origin); 71 server_priority, origin);
72 } 72 }
73 73
74 virtual ~TurnPort(); 74 ~TurnPort() override;
75 75
76 const ProtocolAddress& server_address() const { return server_address_; } 76 const ProtocolAddress& server_address() const { return server_address_; }
77 // Returns an empty address if the local address has not been assigned. 77 // Returns an empty address if the local address has not been assigned.
78 rtc::SocketAddress GetLocalAddress() const; 78 rtc::SocketAddress GetLocalAddress() const;
79 79
80 bool ready() const { return state_ == STATE_READY; } 80 bool ready() const { return state_ == STATE_READY; }
81 bool connected() const { 81 bool connected() const {
82 return state_ == STATE_READY || state_ == STATE_CONNECTED; 82 return state_ == STATE_READY || state_ == STATE_CONNECTED;
83 } 83 }
84 const RelayCredentials& credentials() const { return credentials_; } 84 const RelayCredentials& credentials() const { return credentials_; }
85 85
86 virtual void PrepareAddress(); 86 void PrepareAddress() override;
87 virtual Connection* CreateConnection( 87 Connection* CreateConnection(const Candidate& c,
88 const Candidate& c, PortInterface::CandidateOrigin origin); 88 PortInterface::CandidateOrigin origin,
89 virtual int SendTo(const void* data, size_t size, 89 const IceConfig& config) override;
90 const rtc::SocketAddress& addr, 90 int SendTo(const void* data,
91 const rtc::PacketOptions& options, 91 size_t size,
92 bool payload); 92 const rtc::SocketAddress& addr,
93 virtual int SetOption(rtc::Socket::Option opt, int value); 93 const rtc::PacketOptions& options,
94 virtual int GetOption(rtc::Socket::Option opt, int* value); 94 bool payload) override;
95 virtual int GetError(); 95 int SetOption(rtc::Socket::Option opt, int value) override;
96 int GetOption(rtc::Socket::Option opt, int* value) override;
97 int GetError() override;
96 98
97 virtual bool HandleIncomingPacket(rtc::AsyncPacketSocket* socket, 99 bool HandleIncomingPacket(rtc::AsyncPacketSocket* socket,
98 const char* data, size_t size, 100 const char* data,
99 const rtc::SocketAddress& remote_addr, 101 size_t size,
100 const rtc::PacketTime& packet_time);
101 virtual void OnReadPacket(rtc::AsyncPacketSocket* socket,
102 const char* data, size_t size,
103 const rtc::SocketAddress& remote_addr, 102 const rtc::SocketAddress& remote_addr,
104 const rtc::PacketTime& packet_time); 103 const rtc::PacketTime& packet_time) override;
104 void OnReadPacket(rtc::AsyncPacketSocket* socket,
105 const char* data,
106 size_t size,
107 const rtc::SocketAddress& remote_addr,
108 const rtc::PacketTime& packet_time);
105 109
106 virtual void OnSentPacket(rtc::AsyncPacketSocket* socket, 110 void OnSentPacket(rtc::AsyncPacketSocket* socket,
107 const rtc::SentPacket& sent_packet); 111 const rtc::SentPacket& sent_packet) override;
108 virtual void OnReadyToSend(rtc::AsyncPacketSocket* socket); 112 void OnReadyToSend(rtc::AsyncPacketSocket* socket);
109 virtual bool SupportsProtocol(const std::string& protocol) const { 113 bool SupportsProtocol(const std::string& protocol) const override {
110 // Turn port only connects to UDP candidates. 114 // Turn port only connects to UDP candidates.
111 return protocol == UDP_PROTOCOL_NAME; 115 return protocol == UDP_PROTOCOL_NAME;
112 } 116 }
113 117
114 void OnSocketConnect(rtc::AsyncPacketSocket* socket); 118 void OnSocketConnect(rtc::AsyncPacketSocket* socket);
115 void OnSocketClose(rtc::AsyncPacketSocket* socket, int error); 119 void OnSocketClose(rtc::AsyncPacketSocket* socket, int error);
116 120
117 121
118 const std::string& hash() const { return hash_; } 122 const std::string& hash() const { return hash_; }
119 const std::string& nonce() const { return nonce_; } 123 const std::string& nonce() const { return nonce_; }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 MSG_ALLOCATE_ERROR = MSG_FIRST_AVAILABLE, 186 MSG_ALLOCATE_ERROR = MSG_FIRST_AVAILABLE,
183 MSG_ALLOCATE_MISMATCH, 187 MSG_ALLOCATE_MISMATCH,
184 MSG_TRY_ALTERNATE_SERVER, 188 MSG_TRY_ALTERNATE_SERVER,
185 MSG_REFRESH_ERROR 189 MSG_REFRESH_ERROR
186 }; 190 };
187 191
188 typedef std::list<TurnEntry*> EntryList; 192 typedef std::list<TurnEntry*> EntryList;
189 typedef std::map<rtc::Socket::Option, int> SocketOptionsMap; 193 typedef std::map<rtc::Socket::Option, int> SocketOptionsMap;
190 typedef std::set<rtc::SocketAddress> AttemptedServerSet; 194 typedef std::set<rtc::SocketAddress> AttemptedServerSet;
191 195
192 virtual void OnMessage(rtc::Message* pmsg); 196 void OnMessage(rtc::Message* pmsg) override;
193 virtual void HandleConnectionDestroyed(Connection* conn); 197 void HandleConnectionDestroyed(Connection* conn) override;
194 198
195 bool CreateTurnClientSocket(); 199 bool CreateTurnClientSocket();
196 200
197 void set_nonce(const std::string& nonce) { nonce_ = nonce; } 201 void set_nonce(const std::string& nonce) { nonce_ = nonce; }
198 void set_realm(const std::string& realm) { 202 void set_realm(const std::string& realm) {
199 if (realm != realm_) { 203 if (realm != realm_) {
200 realm_ = realm; 204 realm_ = realm;
201 UpdateHash(); 205 UpdateHash();
202 } 206 }
203 } 207 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 friend class TurnEntry; 283 friend class TurnEntry;
280 friend class TurnAllocateRequest; 284 friend class TurnAllocateRequest;
281 friend class TurnRefreshRequest; 285 friend class TurnRefreshRequest;
282 friend class TurnCreatePermissionRequest; 286 friend class TurnCreatePermissionRequest;
283 friend class TurnChannelBindRequest; 287 friend class TurnChannelBindRequest;
284 }; 288 };
285 289
286 } // namespace cricket 290 } // namespace cricket
287 291
288 #endif // WEBRTC_P2P_BASE_TURNPORT_H_ 292 #endif // WEBRTC_P2P_BASE_TURNPORT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698