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

Side by Side Diff: webrtc/pc/dtlssrtptransport.h

Issue 3012953002: Created the DtlsSrtpTransport.
Patch Set: Initial review. Created 3 years, 3 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
OLDNEW
(Empty)
1 /*
2 * Copyright 2017 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_PC_DTLSSRTPTRANSPORT_H_
12 #define WEBRTC_PC_DTLSSRTPTRANSPORT_H_
13
14 #include <memory>
15 #include <string>
16 #include <vector>
17
18 #include "webrtc/p2p/base/dtlstransportinternal.h"
19 #include "webrtc/pc/srtptransport.h"
20
21 namespace webrtc {
22
23 // This class exports the keying materials from underneath DtlsTransport and
pthatcher 2017/09/12 00:24:44 "from underneath DtlsTransport" => "from the DtlsT
Zhi Huang 2017/09/27 00:46:32 Done.
24 // sets the crypto keys for the wrapped SrtpTransport.
25 class DtlsSrtpTransport : public RtpTransportInternal {
26 public:
27 DtlsSrtpTransport(std::unique_ptr<webrtc::SrtpTransport> srtp_transport,
28 const std::string& content_name);
pthatcher 2017/09/12 00:24:44 Why is the content name needed?
Zhi Huang 2017/09/27 00:46:32 Removed.
29
30 bool SetupDtlsSrtp(bool rtcp);
pthatcher 2017/09/12 00:24:44 Note: this is the kind of place removing support f
Zhi Huang 2017/09/27 00:46:33 Acknowledged.
31
32 // Set a P2P layer DtlsTransport for DtlsSrtpTransport.
33 void SetDtlsTransport(bool rtcp,
34 cricket::DtlsTransportInternal* dtls_transport);
pthatcher 2017/09/12 00:24:44 The getters have two methods. I think the setters
Zhi Huang 2017/09/27 00:46:32 Done.
35
36 // Set the header extension ids that should be encrypted for the given source.
37 // This method doesn't immediately update the SRTP session with the new IDs,
38 // and you need to call SetupDtlsSrtp for that to happen.
39 void SetEncryptedHeaderExtensionIds(cricket::ContentSource source,
40 const std::vector<int>& extension_ids);
pthatcher 2017/09/12 00:24:44 Instead of passing in a source, I think it would b
Zhi Huang 2017/09/27 00:46:32 Agreed. The BaseChannel should take care of the Co
41
42 cricket::DtlsTransportInternal* rtp_dtls_transport() {
43 return rtp_dtls_transport_;
44 }
45
46 cricket::DtlsTransportInternal* rtcp_dtls_transport() {
47 return rtcp_dtls_transport_;
48 }
49
50 // RtpTransportInternal overrides.
51 void SetRtcpMuxEnabled(bool enable) override;
52
53 rtc::PacketTransportInternal* rtp_packet_transport() const override;
54
55 void SetRtpPacketTransport(rtc::PacketTransportInternal* rtp) override;
56
57 PacketTransportInterface* GetRtpPacketTransport() const override;
58
59 rtc::PacketTransportInternal* rtcp_packet_transport() const override;
60
61 void SetRtcpPacketTransport(rtc::PacketTransportInternal* rtcp) override;
62
63 PacketTransportInterface* GetRtcpPacketTransport() const override;
64
65 bool IsWritable(bool rtcp) const override;
66
67 bool SendRtpPacket(rtc::CopyOnWriteBuffer* packet,
68 const rtc::PacketOptions& options,
69 int flags) override;
70
71 bool SendRtcpPacket(rtc::CopyOnWriteBuffer* packet,
72 const rtc::PacketOptions& options,
73 int flags) override;
74
75 bool HandlesPayloadType(int payload_type) const override;
76
77 void AddHandledPayloadType(int payload_type) override;
78
79 bool IsActive() { return active_; }
80
81 void ResetParams();
82
83 RTCError SetParameters(const RtpTransportParameters& parameters) override;
84
85 RtpTransportParameters GetParameters() const override;
86
87 // TODO(zhihuang): Remove this when we remove RtpTransportAdapter.
88 RtpTransportAdapter* GetInternal() override { return nullptr; }
89
90 private:
91 void ConnectToSrtpTransport();
92
93 void OnPacketReceived(bool rtcp,
94 rtc::CopyOnWriteBuffer* packet,
95 const rtc::PacketTime& packet_time);
96
97 void OnReadyToSend(bool ready);
98
99 bool active_ = false;
pthatcher 2017/09/12 00:24:44 Can you leave a comment explaining when it becomes
Zhi Huang 2017/09/27 00:46:32 Done.
100 std::unique_ptr<SrtpTransport> srtp_transport_;
101 std::string content_name_;
102 // Not owned by this class.
pthatcher 2017/09/12 00:24:44 Who has the responsibility of tracking the lifetim
Zhi Huang 2017/09/27 00:46:32 The transport controller should own these.
103 cricket::DtlsTransportInternal* rtp_dtls_transport_ = nullptr;
104 cricket::DtlsTransportInternal* rtcp_dtls_transport_ = nullptr;
105 };
106
107 } // namespace webrtc
108
109 #endif // WEBRTC_PC_DTLSSRTPTRANSPORT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698