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/transportchannelimpl.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 DtlsTransportInternal() {} | |
Taylor Brandstetter
2017/01/03 23:21:59
nit: I was wrong about the destructor earlier, but
Zhi Huang
2017/01/10 18:30:51
It doesn't compile without it.
I think the macro
Taylor Brandstetter
2017/01/10 19:43:47
Does using "RTC_DISALLOW_IMPLICIT_CONSTRUCTORS" in
Zhi Huang
2017/01/12 20:04:12
This macro will declare the default constructor to
| |
32 virtual ~DtlsTransportInternal() {} | |
33 | |
34 virtual DtlsTransportState dtls_state() const = 0; | |
35 | |
36 virtual const std::string& transport_name() const = 0; | |
37 | |
38 virtual int component() const = 0; | |
39 | |
40 virtual bool IsDtlsActive() const = 0; | |
41 | |
42 virtual bool GetSslRole(rtc::SSLRole* role) const = 0; | |
43 | |
44 virtual bool SetSslRole(rtc::SSLRole role) = 0; | |
45 | |
46 // Sets up the ciphers to use for DTLS-SRTP. | |
47 virtual bool SetSrtpCryptoSuites(const std::vector<int>& ciphers) = 0; | |
48 | |
49 // Keep the original one for backward compatibility until all dependencies | |
50 // move away. TODO(zhihuang): Remove this function. | |
51 virtual bool SetSrtpCiphers(const std::vector<std::string>& ciphers) = 0; | |
52 | |
53 // Finds out which DTLS-SRTP cipher was negotiated. | |
54 // TODO(zhihuang): Remove this once all dependencies implement this. | |
55 virtual bool GetSrtpCryptoSuite(int* cipher) = 0; | |
56 | |
57 // Finds out which DTLS cipher was negotiated. | |
58 // TODO(zhihuang): Remove this once all dependencies implement this. | |
59 virtual bool GetSslCipherSuite(int* cipher) = 0; | |
60 | |
61 // Gets the local RTCCertificate used for DTLS. | |
62 virtual rtc::scoped_refptr<rtc::RTCCertificate> GetLocalCertificate() | |
63 const = 0; | |
64 | |
65 virtual bool SetLocalCertificate( | |
66 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) = 0; | |
67 | |
68 // Gets a copy of the remote side's SSL certificate. | |
69 virtual std::unique_ptr<rtc::SSLCertificate> GetRemoteSSLCertificate() | |
70 const = 0; | |
71 | |
72 // Allows key material to be extracted for external encryption. | |
73 virtual bool ExportKeyingMaterial(const std::string& label, | |
74 const uint8_t* context, | |
75 size_t context_len, | |
76 bool use_context, | |
77 uint8_t* result, | |
78 size_t result_len) = 0; | |
79 | |
80 // Set DTLS remote fingerprint. Must be after local identity set. | |
81 virtual bool SetRemoteFingerprint(const std::string& digest_alg, | |
82 const uint8_t* digest, | |
83 size_t digest_len) = 0; | |
84 | |
85 // Expose the underneath IceTransport. | |
86 virtual TransportChannelImpl* ice_transport() = 0; | |
87 | |
88 sigslot::signal2<DtlsTransportInternal*, DtlsTransportState> SignalDtlsState; | |
89 | |
90 // Emitted whenever the Dtls handshake failed on some transport channel. | |
91 sigslot::signal1<rtc::SSLHandshakeError> SignalDtlsHandshakeError; | |
92 | |
93 // Debugging description of this transport. | |
94 std::string const debug_name() const override { | |
95 return transport_name() + " " + std::to_string(component()); | |
96 } | |
97 | |
98 private: | |
99 RTC_DISALLOW_COPY_AND_ASSIGN(DtlsTransportInternal); | |
100 }; | |
101 | |
102 } // namespace cricket | |
103 | |
104 #endif // WEBRTC_P2P_BASE_DTLSTRANSPORTINTERNAL_H_ | |
OLD | NEW |