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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 // P2PTransportChannel manages the candidates and connection process to keep | 49 // P2PTransportChannel manages the candidates and connection process to keep |
50 // two P2P clients connected to each other. | 50 // two P2P clients connected to each other. |
51 class P2PTransportChannel : public TransportChannelImpl, | 51 class P2PTransportChannel : public TransportChannelImpl, |
52 public rtc::MessageHandler { | 52 public rtc::MessageHandler { |
53 public: | 53 public: |
54 P2PTransportChannel(const std::string& content_name, | 54 P2PTransportChannel(const std::string& content_name, |
55 int component, | 55 int component, |
56 P2PTransport* transport, | 56 P2PTransport* transport, |
57 PortAllocator *allocator); | 57 PortAllocator *allocator); |
58 virtual ~P2PTransportChannel(); | 58 ~P2PTransportChannel() override; |
59 | 59 |
60 // From TransportChannelImpl: | 60 // From TransportChannelImpl: |
61 virtual Transport* GetTransport() { return transport_; } | 61 Transport* GetTransport() override { return transport_; } |
62 virtual TransportChannelState GetState() const; | 62 TransportChannelState GetState() const override; |
63 virtual void SetIceRole(IceRole role); | 63 void SetIceRole(IceRole role) override; |
64 virtual IceRole GetIceRole() const { return ice_role_; } | 64 IceRole GetIceRole() const override { return ice_role_; } |
65 virtual void SetIceTiebreaker(uint64 tiebreaker); | 65 void SetIceTiebreaker(uint64 tiebreaker) override; |
66 virtual void SetIceCredentials(const std::string& ice_ufrag, | 66 void SetIceCredentials(const std::string& ice_ufrag, |
67 const std::string& ice_pwd); | 67 const std::string& ice_pwd) override; |
68 virtual void SetRemoteIceCredentials(const std::string& ice_ufrag, | 68 void SetRemoteIceCredentials(const std::string& ice_ufrag, |
69 const std::string& ice_pwd); | 69 const std::string& ice_pwd) override; |
70 virtual void SetRemoteIceMode(IceMode mode); | 70 void SetRemoteIceMode(IceMode mode) override; |
71 virtual void Connect(); | 71 void Connect() override; |
72 virtual void OnSignalingReady(); | 72 void OnSignalingReady() override; |
73 virtual void OnCandidate(const Candidate& candidate); | 73 void OnCandidate(const Candidate& candidate) override; |
74 // Sets the receiving timeout in milliseconds. | 74 // Sets the receiving timeout in milliseconds. |
75 // This also sets the check_receiving_delay proportionally. | 75 // This also sets the check_receiving_delay proportionally. |
76 virtual void SetReceivingTimeout(int receiving_timeout_ms); | 76 void SetReceivingTimeout(int receiving_timeout_ms) override; |
77 | 77 |
78 // From TransportChannel: | 78 // From TransportChannel: |
79 virtual int SendPacket(const char *data, size_t len, | 79 int SendPacket(const char *data, size_t len, |
80 const rtc::PacketOptions& options, int flags); | 80 const rtc::PacketOptions& options, int flags) override; |
81 virtual int SetOption(rtc::Socket::Option opt, int value); | 81 int SetOption(rtc::Socket::Option opt, int value) override; |
82 virtual bool GetOption(rtc::Socket::Option opt, int* value); | 82 bool GetOption(rtc::Socket::Option opt, int* value) override; |
83 virtual int GetError() { return error_; } | 83 int GetError() override { return error_; } |
84 virtual bool GetStats(std::vector<ConnectionInfo>* stats); | 84 bool GetStats(std::vector<ConnectionInfo>* stats) override; |
85 | 85 |
86 const Connection* best_connection() const { return best_connection_; } | 86 const Connection* best_connection() const { return best_connection_; } |
87 void set_incoming_only(bool value) { incoming_only_ = value; } | 87 void set_incoming_only(bool value) { incoming_only_ = value; } |
88 | 88 |
89 // Note: This is only for testing purpose. | 89 // Note: This is only for testing purpose. |
90 // |ports_| should not be changed from outside. | 90 // |ports_| should not be changed from outside. |
91 const std::vector<PortInterface*>& ports() { return ports_; } | 91 const std::vector<PortInterface*>& ports() { return ports_; } |
92 | 92 |
93 IceMode remote_ice_mode() const { return remote_ice_mode_; } | 93 IceMode remote_ice_mode() const { return remote_ice_mode_; } |
94 | 94 |
95 // DTLS methods. | 95 // DTLS methods. |
96 virtual bool IsDtlsActive() const { return false; } | 96 bool IsDtlsActive() const override { return false; } |
97 | 97 |
98 // Default implementation. | 98 // Default implementation. |
99 virtual bool GetSslRole(rtc::SSLRole* role) const { | 99 bool GetSslRole(rtc::SSLRole* role) const override { |
100 return false; | 100 return false; |
101 } | 101 } |
102 | 102 |
103 virtual bool SetSslRole(rtc::SSLRole role) { | 103 bool SetSslRole(rtc::SSLRole role) override { |
104 return false; | 104 return false; |
105 } | 105 } |
106 | 106 |
107 // Set up the ciphers to use for DTLS-SRTP. | 107 // Set up the ciphers to use for DTLS-SRTP. |
108 virtual bool SetSrtpCiphers(const std::vector<std::string>& ciphers) { | 108 bool SetSrtpCiphers(const std::vector<std::string>& ciphers) override { |
109 return false; | 109 return false; |
110 } | 110 } |
111 | 111 |
112 // Find out which DTLS-SRTP cipher was negotiated. | 112 // Find out which DTLS-SRTP cipher was negotiated. |
113 virtual bool GetSrtpCipher(std::string* cipher) { | 113 bool GetSrtpCipher(std::string* cipher) override { |
114 return false; | 114 return false; |
115 } | 115 } |
116 | 116 |
117 // Find out which DTLS cipher was negotiated. | 117 // Find out which DTLS cipher was negotiated. |
118 virtual bool GetSslCipher(std::string* cipher) { | 118 bool GetSslCipher(std::string* cipher) override { |
119 return false; | 119 return false; |
120 } | 120 } |
121 | 121 |
122 // Returns false because the channel is not encrypted by default. | 122 // Returns null because the channel is not encrypted by default. |
123 virtual bool GetLocalIdentity(rtc::SSLIdentity** identity) const { | 123 rtc::scoped_refptr<rtc::RTCCertificate> GetLocalCertificate() const override { |
124 return false; | 124 return nullptr; |
125 } | 125 } |
126 | 126 |
127 virtual bool GetRemoteCertificate(rtc::SSLCertificate** cert) const { | 127 bool GetRemoteSSLCertificate(rtc::SSLCertificate** cert) const override { |
128 return false; | 128 return false; |
129 } | 129 } |
130 | 130 |
131 // Allows key material to be extracted for external encryption. | 131 // Allows key material to be extracted for external encryption. |
132 virtual bool ExportKeyingMaterial( | 132 bool ExportKeyingMaterial(const std::string& label, |
133 const std::string& label, | 133 const uint8* context, |
134 const uint8* context, | 134 size_t context_len, |
135 size_t context_len, | 135 bool use_context, |
136 bool use_context, | 136 uint8* result, |
137 uint8* result, | 137 size_t result_len) override { |
138 size_t result_len) { | |
139 return false; | 138 return false; |
140 } | 139 } |
141 | 140 |
142 virtual bool SetLocalIdentity(rtc::SSLIdentity* identity) { | 141 bool SetLocalCertificate( |
| 142 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) override { |
143 return false; | 143 return false; |
144 } | 144 } |
145 | 145 |
146 // Set DTLS Remote fingerprint. Must be after local identity set. | 146 // Set DTLS Remote fingerprint. Must be after local identity set. |
147 virtual bool SetRemoteFingerprint( | 147 bool SetRemoteFingerprint(const std::string& digest_alg, |
148 const std::string& digest_alg, | 148 const uint8* digest, |
149 const uint8* digest, | 149 size_t digest_len) override { |
150 size_t digest_len) { | |
151 return false; | 150 return false; |
152 } | 151 } |
153 | 152 |
154 int receiving_timeout() const { return receiving_timeout_; } | 153 int receiving_timeout() const { return receiving_timeout_; } |
155 int check_receiving_delay() const { return check_receiving_delay_; } | 154 int check_receiving_delay() const { return check_receiving_delay_; } |
156 | 155 |
157 // Helper method used only in unittest. | 156 // Helper method used only in unittest. |
158 rtc::DiffServCodePoint DefaultDscpValue() const; | 157 rtc::DiffServCodePoint DefaultDscpValue() const; |
159 | 158 |
160 // Public for unit tests. | 159 // Public for unit tests. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 void OnRoleConflict(PortInterface* port); | 205 void OnRoleConflict(PortInterface* port); |
207 | 206 |
208 void OnConnectionStateChange(Connection* connection); | 207 void OnConnectionStateChange(Connection* connection); |
209 void OnReadPacket(Connection *connection, const char *data, size_t len, | 208 void OnReadPacket(Connection *connection, const char *data, size_t len, |
210 const rtc::PacketTime& packet_time); | 209 const rtc::PacketTime& packet_time); |
211 void OnReadyToSend(Connection* connection); | 210 void OnReadyToSend(Connection* connection); |
212 void OnConnectionDestroyed(Connection *connection); | 211 void OnConnectionDestroyed(Connection *connection); |
213 | 212 |
214 void OnNominated(Connection* conn); | 213 void OnNominated(Connection* conn); |
215 | 214 |
216 virtual void OnMessage(rtc::Message *pmsg); | 215 void OnMessage(rtc::Message *pmsg) override; |
217 void OnSort(); | 216 void OnSort(); |
218 void OnPing(); | 217 void OnPing(); |
219 | 218 |
220 void OnCheckReceiving(); | 219 void OnCheckReceiving(); |
221 | 220 |
222 void PruneConnections(); | 221 void PruneConnections(); |
223 Connection* best_nominated_connection() const; | 222 Connection* best_nominated_connection() const; |
224 | 223 |
225 P2PTransport* transport_; | 224 P2PTransport* transport_; |
226 PortAllocator *allocator_; | 225 PortAllocator *allocator_; |
(...skipping 24 matching lines...) Expand all Loading... |
251 | 250 |
252 int check_receiving_delay_; | 251 int check_receiving_delay_; |
253 int receiving_timeout_; | 252 int receiving_timeout_; |
254 | 253 |
255 DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); | 254 DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); |
256 }; | 255 }; |
257 | 256 |
258 } // namespace cricket | 257 } // namespace cricket |
259 | 258 |
260 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ | 259 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ |
OLD | NEW |