Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Side by Side Diff: webrtc/p2p/base/dtlstransportinternal.h

Issue 2597053002: Create the DtlsTransportInternal (Closed)
Patch Set: Add transport_name(), component() and debug_name() Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/p2p/BUILD.gn ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
33 virtual DtlsTransportState dtls_state() const = 0;
34
35 virtual const std::string& transport_name() const = 0;
36
37 virtual int component() const = 0;
38
39 virtual bool IsDtlsActive() const = 0;
40
41 virtual bool GetSslRole(rtc::SSLRole* role) const = 0;
42
43 virtual bool SetSslRole(rtc::SSLRole role) = 0;
44
45 // Sets up the ciphers to use for DTLS-SRTP.
46 virtual bool SetSrtpCryptoSuites(const std::vector<int>& ciphers) = 0;
47
48 // Keep the original one for backward compatibility until all dependencies
49 // move away. TODO(zhihuang): Remove this function.
50 virtual bool SetSrtpCiphers(const std::vector<std::string>& ciphers) = 0;
51
52 // Finds out which DTLS-SRTP cipher was negotiated.
53 // TODO(zhihuang): Remove this once all dependencies implement this.
54 virtual bool GetSrtpCryptoSuite(int* cipher) = 0;
55
56 // Finds out which DTLS cipher was negotiated.
57 // TODO(zhihuang): Remove this once all dependencies implement this.
58 virtual bool GetSslCipherSuite(int* cipher) = 0;
59
60 // Gets the local RTCCertificate used for DTLS.
61 virtual rtc::scoped_refptr<rtc::RTCCertificate> GetLocalCertificate()
62 const = 0;
63
64 virtual bool SetLocalCertificate(
65 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) = 0;
66
67 // Gets a copy of the remote side's SSL certificate.
68 virtual std::unique_ptr<rtc::SSLCertificate> GetRemoteSSLCertificate()
69 const = 0;
70
71 // Allows key material to be extracted for external encryption.
72 virtual bool ExportKeyingMaterial(const std::string& label,
73 const uint8_t* context,
74 size_t context_len,
75 bool use_context,
76 uint8_t* result,
77 size_t result_len) = 0;
78
79 // Set DTLS remote fingerprint. Must be after local identity set.
80 virtual bool SetRemoteFingerprint(const std::string& digest_alg,
81 const uint8_t* digest,
82 size_t digest_len) = 0;
83
84 // Expose the underneath IceTransport.
85 virtual IceTransportInternal* ice_transport() = 0;
86
87 sigslot::signal2<DtlsTransportInternal*, DtlsTransportState> SignalDtlsState;
88
89 // Emitted whenever the Dtls handshake failed on some transport channel.
90 sigslot::signal1<rtc::SSLHandshakeError> SignalDtlsHandshakeError;
91
92 // Debugging description of this transport.
93 std::string debug_name() const override {
94 return transport_name() + " " + std::to_string(component());
95 }
96
97 private:
98 RTC_DISALLOW_COPY_AND_ASSIGN(DtlsTransportInternal);
99 };
100
101 } // namespace cricket
102
103 #endif // WEBRTC_P2P_BASE_DTLSTRANSPORTINTERNAL_H_
OLDNEW
« no previous file with comments | « webrtc/p2p/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698