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 |
11 #ifndef WEBRTC_P2P_BASE_DTLSTRANSPORTCHANNEL_H_ | 11 #ifndef WEBRTC_P2P_BASE_DTLSTRANSPORTCHANNEL_H_ |
12 #define WEBRTC_P2P_BASE_DTLSTRANSPORTCHANNEL_H_ | 12 #define WEBRTC_P2P_BASE_DTLSTRANSPORTCHANNEL_H_ |
13 | 13 |
| 14 #include <memory> |
14 #include <string> | 15 #include <string> |
15 #include <vector> | 16 #include <vector> |
16 | 17 |
17 #include "webrtc/p2p/base/transportchannelimpl.h" | 18 #include "webrtc/p2p/base/transportchannelimpl.h" |
18 #include "webrtc/base/buffer.h" | 19 #include "webrtc/base/buffer.h" |
19 #include "webrtc/base/bufferqueue.h" | 20 #include "webrtc/base/bufferqueue.h" |
20 #include "webrtc/base/scoped_ptr.h" | |
21 #include "webrtc/base/sslstreamadapter.h" | 21 #include "webrtc/base/sslstreamadapter.h" |
22 #include "webrtc/base/stream.h" | 22 #include "webrtc/base/stream.h" |
23 | 23 |
24 namespace cricket { | 24 namespace cricket { |
25 | 25 |
26 // A bridge between a packet-oriented/channel-type interface on | 26 // A bridge between a packet-oriented/channel-type interface on |
27 // the bottom and a StreamInterface on the top. | 27 // the bottom and a StreamInterface on the top. |
28 class StreamInterfaceChannel : public rtc::StreamInterface { | 28 class StreamInterfaceChannel : public rtc::StreamInterface { |
29 public: | 29 public: |
30 explicit StreamInterfaceChannel(TransportChannel* channel); | 30 explicit StreamInterfaceChannel(TransportChannel* channel); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 bool GetSrtpCryptoSuite(int* cipher) override; | 130 bool GetSrtpCryptoSuite(int* cipher) override; |
131 | 131 |
132 bool GetSslRole(rtc::SSLRole* role) const override; | 132 bool GetSslRole(rtc::SSLRole* role) const override; |
133 bool SetSslRole(rtc::SSLRole role) override; | 133 bool SetSslRole(rtc::SSLRole role) override; |
134 | 134 |
135 // Find out which DTLS cipher was negotiated | 135 // Find out which DTLS cipher was negotiated |
136 bool GetSslCipherSuite(int* cipher) override; | 136 bool GetSslCipherSuite(int* cipher) override; |
137 | 137 |
138 // Once DTLS has been established, this method retrieves the certificate in | 138 // Once DTLS has been established, this method retrieves the certificate in |
139 // use by the remote peer, for use in external identity verification. | 139 // use by the remote peer, for use in external identity verification. |
140 rtc::scoped_ptr<rtc::SSLCertificate> GetRemoteSSLCertificate() const override; | 140 std::unique_ptr<rtc::SSLCertificate> GetRemoteSSLCertificate() const override; |
141 | 141 |
142 // Once DTLS has established (i.e., this channel is writable), this method | 142 // Once DTLS has established (i.e., this channel is writable), this method |
143 // extracts the keys negotiated during the DTLS handshake, for use in external | 143 // extracts the keys negotiated during the DTLS handshake, for use in external |
144 // encryption. DTLS-SRTP uses this to extract the needed SRTP keys. | 144 // encryption. DTLS-SRTP uses this to extract the needed SRTP keys. |
145 // See the SSLStreamAdapter documentation for info on the specific parameters. | 145 // See the SSLStreamAdapter documentation for info on the specific parameters. |
146 bool ExportKeyingMaterial(const std::string& label, | 146 bool ExportKeyingMaterial(const std::string& label, |
147 const uint8_t* context, | 147 const uint8_t* context, |
148 size_t context_len, | 148 size_t context_len, |
149 bool use_context, | 149 bool use_context, |
150 uint8_t* result, | 150 uint8_t* result, |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 void OnSelectedCandidatePairChanged( | 219 void OnSelectedCandidatePairChanged( |
220 TransportChannel* channel, | 220 TransportChannel* channel, |
221 CandidatePairInterface* selected_candidate_pair, | 221 CandidatePairInterface* selected_candidate_pair, |
222 int last_sent_packet_id); | 222 int last_sent_packet_id); |
223 void OnConnectionRemoved(TransportChannelImpl* channel); | 223 void OnConnectionRemoved(TransportChannelImpl* channel); |
224 void Reconnect(); | 224 void Reconnect(); |
225 | 225 |
226 rtc::Thread* worker_thread_; // Everything should occur on this thread. | 226 rtc::Thread* worker_thread_; // Everything should occur on this thread. |
227 // Underlying channel, not owned by this class. | 227 // Underlying channel, not owned by this class. |
228 TransportChannelImpl* const channel_; | 228 TransportChannelImpl* const channel_; |
229 rtc::scoped_ptr<rtc::SSLStreamAdapter> dtls_; // The DTLS stream | 229 std::unique_ptr<rtc::SSLStreamAdapter> dtls_; // The DTLS stream |
230 StreamInterfaceChannel* downward_; // Wrapper for channel_, owned by dtls_. | 230 StreamInterfaceChannel* downward_; // Wrapper for channel_, owned by dtls_. |
231 std::vector<int> srtp_ciphers_; // SRTP ciphers to use with DTLS. | 231 std::vector<int> srtp_ciphers_; // SRTP ciphers to use with DTLS. |
232 bool dtls_active_ = false; | 232 bool dtls_active_ = false; |
233 rtc::scoped_refptr<rtc::RTCCertificate> local_certificate_; | 233 rtc::scoped_refptr<rtc::RTCCertificate> local_certificate_; |
234 rtc::SSLRole ssl_role_; | 234 rtc::SSLRole ssl_role_; |
235 rtc::SSLProtocolVersion ssl_max_version_; | 235 rtc::SSLProtocolVersion ssl_max_version_; |
236 rtc::Buffer remote_fingerprint_value_; | 236 rtc::Buffer remote_fingerprint_value_; |
237 std::string remote_fingerprint_algorithm_; | 237 std::string remote_fingerprint_algorithm_; |
238 | 238 |
239 RTC_DISALLOW_COPY_AND_ASSIGN(DtlsTransportChannelWrapper); | 239 RTC_DISALLOW_COPY_AND_ASSIGN(DtlsTransportChannelWrapper); |
240 }; | 240 }; |
241 | 241 |
242 } // namespace cricket | 242 } // namespace cricket |
243 | 243 |
244 #endif // WEBRTC_P2P_BASE_DTLSTRANSPORTCHANNEL_H_ | 244 #endif // WEBRTC_P2P_BASE_DTLSTRANSPORTCHANNEL_H_ |
OLD | NEW |