Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. | |
| 3 * | |
| 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 | |
| 6 * tree. An additional intellectual property rights grant can be found | |
| 7 * in the file PATENTS. All contributing project authors may | |
| 8 * be found in the AUTHORS file in the root of the source tree. | |
| 9 */ | |
| 10 | |
| 11 #ifndef WEBRTC_P2P_BASE_DTLSTRANSPORTINTERNAL_H_ | |
| 12 #define WEBRTC_P2P_BASE_DTLSTRANSPORTINTERNAL_H_ | |
| 13 | |
| 14 #include <memory> | |
| 15 #include <string> | |
| 16 #include <vector> | |
| 17 | |
| 18 #include "webrtc/base/sslstreamadapter.h" | |
| 19 #include "webrtc/p2p/base/icetransportinternal.h" | |
| 20 #include "webrtc/p2p/base/jseptransport.h" | |
| 21 #include "webrtc/p2p/base/packettransportinterface.h" | |
| 22 | |
| 23 namespace cricket { | |
| 24 | |
| 25 // DtlsTransportInternal is an internal interface that does DTLS. | |
| 26 // Once the public interface is supported, | |
| 27 // (https://www.w3.org/TR/webrtc/#rtcdtlstransport-interface) | |
| 28 // the DtlsTransportInterface will be split from this class. | |
| 29 class DtlsTransportInternal : public rtc::PacketTransportInterface { | |
| 30 public: | |
| 31 virtual ~DtlsTransportInternal() {} | |
| 32 | |
|
Taylor Brandstetter
2016/12/22 04:56:20
I think we'll still need transport_name() and comp
Zhi Huang
2016/12/27 19:33:19
Agreed and Done.
| |
| 33 virtual DtlsTransportState dtls_state() const = 0; | |
| 34 | |
| 35 virtual bool IsDtlsActive() const = 0; | |
| 36 | |
| 37 virtual bool GetSslRole(rtc::SSLRole* role) const = 0; | |
| 38 | |
| 39 virtual bool SetSslRole(rtc::SSLRole role) = 0; | |
| 40 | |
| 41 // Sets up the ciphers to use for DTLS-SRTP. | |
| 42 virtual bool SetSrtpCryptoSuites(const std::vector<int>& ciphers) = 0; | |
| 43 | |
| 44 // Keep the original one for backward compatibility until all dependencies | |
| 45 // move away. TODO(zhihuang): Remove this function. | |
|
Taylor Brandstetter
2016/12/22 04:56:20
Nice of you to take over the TODOs. :)
Zhi Huang
2016/12/27 19:33:19
Hope we can finish these TODOs soon so that it won
| |
| 46 virtual bool SetSrtpCiphers(const std::vector<std::string>& ciphers) = 0; | |
| 47 | |
| 48 // Finds out which DTLS-SRTP cipher was negotiated. | |
| 49 // TODO(zhihuang): Remove this once all dependencies implement this. | |
| 50 virtual bool GetSrtpCryptoSuite(int* cipher) = 0; | |
| 51 | |
| 52 // Finds out which DTLS cipher was negotiated. | |
| 53 // TODO(zhihuang): Remove this once all dependencies implement this. | |
| 54 virtual bool GetSslCipherSuite(int* cipher) = 0; | |
| 55 | |
| 56 // Gets the local RTCCertificate used for DTLS. | |
| 57 virtual rtc::scoped_refptr<rtc::RTCCertificate> GetLocalCertificate() | |
| 58 const = 0; | |
| 59 | |
| 60 virtual bool SetLocalCertificate( | |
| 61 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) = 0; | |
| 62 | |
| 63 // Gets a copy of the remote side's SSL certificate. | |
| 64 virtual std::unique_ptr<rtc::SSLCertificate> GetRemoteSSLCertificate() | |
| 65 const = 0; | |
| 66 | |
| 67 // Allows key material to be extracted for external encryption. | |
| 68 virtual bool ExportKeyingMaterial(const std::string& label, | |
| 69 const uint8_t* context, | |
| 70 size_t context_len, | |
| 71 bool use_context, | |
| 72 uint8_t* result, | |
| 73 size_t result_len) = 0; | |
| 74 | |
| 75 // Set DTLS remote fingerprint. Must be after local identity set. | |
| 76 virtual bool SetRemoteFingerprint(const std::string& digest_alg, | |
| 77 const uint8_t* digest, | |
| 78 size_t digest_len) = 0; | |
| 79 | |
| 80 // Expose the underneath IceTransport. | |
| 81 virtual IceTransportInternal* ice_transport() = 0; | |
| 82 | |
| 83 sigslot::signal2<DtlsTransportInternal*, DtlsTransportState> SignalDtlsState; | |
| 84 | |
| 85 // Emitted whenever the Dtls handshake failed on some transport channel. | |
| 86 sigslot::signal1<rtc::SSLHandshakeError> SignalDtlsHandshakeError; | |
| 87 | |
| 88 private: | |
| 89 RTC_DISALLOW_COPY_AND_ASSIGN(DtlsTransportInternal); | |
| 90 }; | |
| 91 | |
| 92 } // namespace cricket | |
| 93 | |
| 94 #endif // WEBRTC_P2P_BASE_DTLSTRANSPORTINTERNAL_H_ | |
| OLD | NEW |