| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2011 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // | 75 // |
| 76 // - Data written to DtlsTransportChannelWrapper is passed either to | 76 // - Data written to DtlsTransportChannelWrapper is passed either to |
| 77 // downward_ or directly to channel_, depending on whether DTLS is | 77 // downward_ or directly to channel_, depending on whether DTLS is |
| 78 // negotiated and whether the flags include PF_SRTP_BYPASS | 78 // negotiated and whether the flags include PF_SRTP_BYPASS |
| 79 // | 79 // |
| 80 // - The SSLStreamAdapter writes to downward_->Write() | 80 // - The SSLStreamAdapter writes to downward_->Write() |
| 81 // which translates it into packet writes on channel_. | 81 // which translates it into packet writes on channel_. |
| 82 class DtlsTransportChannelWrapper : public TransportChannelImpl { | 82 class DtlsTransportChannelWrapper : public TransportChannelImpl { |
| 83 public: | 83 public: |
| 84 // The parameters here are: | 84 // The parameters here are: |
| 85 // transport -- the DtlsTransport that created us |
| 85 // channel -- the TransportChannel we are wrapping | 86 // channel -- the TransportChannel we are wrapping |
| 86 explicit DtlsTransportChannelWrapper(TransportChannelImpl* channel); | 87 DtlsTransportChannelWrapper(Transport* transport, |
| 88 TransportChannelImpl* channel); |
| 87 ~DtlsTransportChannelWrapper() override; | 89 ~DtlsTransportChannelWrapper() override; |
| 88 | 90 |
| 89 void SetIceRole(IceRole role) override { channel_->SetIceRole(role); } | 91 void SetIceRole(IceRole role) override { channel_->SetIceRole(role); } |
| 90 IceRole GetIceRole() const override { return channel_->GetIceRole(); } | 92 IceRole GetIceRole() const override { return channel_->GetIceRole(); } |
| 91 bool SetLocalCertificate( | 93 bool SetLocalCertificate( |
| 92 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) override; | 94 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) override; |
| 93 rtc::scoped_refptr<rtc::RTCCertificate> GetLocalCertificate() const override; | 95 rtc::scoped_refptr<rtc::RTCCertificate> GetLocalCertificate() const override; |
| 94 | 96 |
| 95 bool SetRemoteFingerprint(const std::string& digest_alg, | 97 bool SetRemoteFingerprint(const std::string& digest_alg, |
| 96 const uint8_t* digest, | 98 const uint8_t* digest, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 uint8_t* result, | 152 uint8_t* result, |
| 151 size_t result_len) override { | 153 size_t result_len) override { |
| 152 return (dtls_.get()) ? dtls_->ExportKeyingMaterial(label, context, | 154 return (dtls_.get()) ? dtls_->ExportKeyingMaterial(label, context, |
| 153 context_len, | 155 context_len, |
| 154 use_context, | 156 use_context, |
| 155 result, result_len) | 157 result, result_len) |
| 156 : false; | 158 : false; |
| 157 } | 159 } |
| 158 | 160 |
| 159 // TransportChannelImpl calls. | 161 // TransportChannelImpl calls. |
| 162 Transport* GetTransport() override { return transport_; } |
| 163 |
| 160 TransportChannelState GetState() const override { | 164 TransportChannelState GetState() const override { |
| 161 return channel_->GetState(); | 165 return channel_->GetState(); |
| 162 } | 166 } |
| 163 void SetIceTiebreaker(uint64_t tiebreaker) override { | 167 void SetIceTiebreaker(uint64_t tiebreaker) override { |
| 164 channel_->SetIceTiebreaker(tiebreaker); | 168 channel_->SetIceTiebreaker(tiebreaker); |
| 165 } | 169 } |
| 166 void SetIceCredentials(const std::string& ice_ufrag, | 170 void SetIceCredentials(const std::string& ice_ufrag, |
| 167 const std::string& ice_pwd) override { | 171 const std::string& ice_pwd) override { |
| 168 channel_->SetIceCredentials(ice_ufrag, ice_pwd); | 172 channel_->SetIceCredentials(ice_ufrag, ice_pwd); |
| 169 } | 173 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 bool SetupDtls(); | 211 bool SetupDtls(); |
| 208 bool MaybeStartDtls(); | 212 bool MaybeStartDtls(); |
| 209 bool HandleDtlsPacket(const char* data, size_t size); | 213 bool HandleDtlsPacket(const char* data, size_t size); |
| 210 void OnGatheringState(TransportChannelImpl* channel); | 214 void OnGatheringState(TransportChannelImpl* channel); |
| 211 void OnCandidateGathered(TransportChannelImpl* channel, const Candidate& c); | 215 void OnCandidateGathered(TransportChannelImpl* channel, const Candidate& c); |
| 212 void OnRoleConflict(TransportChannelImpl* channel); | 216 void OnRoleConflict(TransportChannelImpl* channel); |
| 213 void OnRouteChange(TransportChannel* channel, const Candidate& candidate); | 217 void OnRouteChange(TransportChannel* channel, const Candidate& candidate); |
| 214 void OnConnectionRemoved(TransportChannelImpl* channel); | 218 void OnConnectionRemoved(TransportChannelImpl* channel); |
| 215 void Reconnect(); | 219 void Reconnect(); |
| 216 | 220 |
| 221 Transport* transport_; // The transport_ that created us. |
| 217 rtc::Thread* worker_thread_; // Everything should occur on this thread. | 222 rtc::Thread* worker_thread_; // Everything should occur on this thread. |
| 218 // Underlying channel, not owned by this class. | 223 // Underlying channel, owned by transport_. |
| 219 TransportChannelImpl* const channel_; | 224 TransportChannelImpl* const channel_; |
| 220 rtc::scoped_ptr<rtc::SSLStreamAdapter> dtls_; // The DTLS stream | 225 rtc::scoped_ptr<rtc::SSLStreamAdapter> dtls_; // The DTLS stream |
| 221 StreamInterfaceChannel* downward_; // Wrapper for channel_, owned by dtls_. | 226 StreamInterfaceChannel* downward_; // Wrapper for channel_, owned by dtls_. |
| 222 std::vector<int> srtp_ciphers_; // SRTP ciphers to use with DTLS. | 227 std::vector<int> srtp_ciphers_; // SRTP ciphers to use with DTLS. |
| 223 bool dtls_active_ = false; | 228 bool dtls_active_ = false; |
| 224 rtc::scoped_refptr<rtc::RTCCertificate> local_certificate_; | 229 rtc::scoped_refptr<rtc::RTCCertificate> local_certificate_; |
| 225 rtc::SSLRole ssl_role_; | 230 rtc::SSLRole ssl_role_; |
| 226 rtc::SSLProtocolVersion ssl_max_version_; | 231 rtc::SSLProtocolVersion ssl_max_version_; |
| 227 rtc::Buffer remote_fingerprint_value_; | 232 rtc::Buffer remote_fingerprint_value_; |
| 228 std::string remote_fingerprint_algorithm_; | 233 std::string remote_fingerprint_algorithm_; |
| 229 | 234 |
| 230 RTC_DISALLOW_COPY_AND_ASSIGN(DtlsTransportChannelWrapper); | 235 RTC_DISALLOW_COPY_AND_ASSIGN(DtlsTransportChannelWrapper); |
| 231 }; | 236 }; |
| 232 | 237 |
| 233 } // namespace cricket | 238 } // namespace cricket |
| 234 | 239 |
| 235 #endif // WEBRTC_P2P_BASE_DTLSTRANSPORTCHANNEL_H_ | 240 #endif // WEBRTC_P2P_BASE_DTLSTRANSPORTCHANNEL_H_ |
| OLD | NEW |