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

Unified Diff: webrtc/ortc/rtptransportadapter.h

Issue 2714813004: Create the SrtpTransportInterface. (Closed)
Patch Set: Use rtc::Optional for SRTP send and receive keys. Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/ortc/rtpparametersconversion.h ('k') | webrtc/ortc/rtptransportadapter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/ortc/rtptransportadapter.h
diff --git a/webrtc/ortc/rtptransportadapter.h b/webrtc/ortc/rtptransportadapter.h
index 169ae613db3385e46a8df36dfc8c2c8906fae137..59a123efae8686089729a07bda2afddc2f6dc5f9 100644
--- a/webrtc/ortc/rtptransportadapter.h
+++ b/webrtc/ortc/rtptransportadapter.h
@@ -14,7 +14,7 @@
#include <memory>
#include <vector>
-#include "webrtc/api/ortc/rtptransportinterface.h"
+#include "webrtc/api/ortc/srtptransportinterface.h"
#include "webrtc/api/rtcerror.h"
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/sigslot.h"
@@ -24,13 +24,14 @@
namespace webrtc {
-// Implementation of RtpTransportInterface to be used with RtpSenderAdapter,
-// RtpReceiverAdapter, and RtpTransportControllerAdapter classes.
+// Implementation of SrtpTransportInterface to be used with RtpSenderAdapter,
+// RtpReceiverAdapter, and RtpTransportControllerAdapter classes. This class
+// is used to implement both a secure and insecure RTP transport.
//
// TODO(deadbeef): When BaseChannel is split apart into separate
// "RtpTransport"/"RtpTransceiver"/"RtpSender"/"RtpReceiver" objects, this
// adapter object can be removed.
-class RtpTransportAdapter : public RtpTransportInterface {
+class RtpTransportAdapter : public SrtpTransportInterface {
public:
// |rtp| can't be null. |rtcp| can if RTCP muxing is used immediately (meaning
// |rtcp_parameters.mux| is also true).
@@ -39,6 +40,13 @@ class RtpTransportAdapter : public RtpTransportInterface {
PacketTransportInterface* rtp,
PacketTransportInterface* rtcp,
RtpTransportControllerAdapter* rtp_transport_controller);
+
+ static RTCErrorOr<std::unique_ptr<SrtpTransportInterface>> CreateSrtpProxied(
+ const RtcpParameters& rtcp_parameters,
+ PacketTransportInterface* rtp,
+ PacketTransportInterface* rtcp,
+ RtpTransportControllerAdapter* rtp_transport_controller);
+
~RtpTransportAdapter() override;
// RtpTransportInterface implementation.
@@ -47,6 +55,10 @@ class RtpTransportAdapter : public RtpTransportInterface {
RTCError SetRtcpParameters(const RtcpParameters& parameters) override;
RtcpParameters GetRtcpParameters() const override { return rtcp_parameters_; }
+ // SRTP specific implementation.
+ RTCError SetSrtpSendKey(const cricket::CryptoParams& params) override;
+ RTCError SetSrtpReceiveKey(const cricket::CryptoParams& params) override;
+
// Methods used internally by OrtcFactory.
RtpTransportControllerAdapter* rtp_transport_controller() {
return rtp_transport_controller_;
@@ -58,6 +70,14 @@ class RtpTransportAdapter : public RtpTransportInterface {
// returning this transport from GetTransports().
sigslot::signal1<RtpTransportAdapter*> SignalDestroyed;
+ // Used by the RtpTransportControllerAdapter to tell if an rtp sender or
+ // receiver can be created.
+ bool is_srtp_transport() { return is_srtp_transport_; }
+ // Used by the RtpTransportControllerAdapter to set keys for senders and
+ // receivers.
+ rtc::Optional<cricket::CryptoParams> send_key() { return send_key_; }
+ rtc::Optional<cricket::CryptoParams> receive_key() { return receive_key_; }
+
protected:
RtpTransportAdapter* GetInternal() override { return this; }
@@ -65,7 +85,8 @@ class RtpTransportAdapter : public RtpTransportInterface {
RtpTransportAdapter(const RtcpParameters& rtcp_parameters,
PacketTransportInterface* rtp,
PacketTransportInterface* rtcp,
- RtpTransportControllerAdapter* rtp_transport_controller);
+ RtpTransportControllerAdapter* rtp_transport_controller,
+ bool is_srtp_transport);
PacketTransportInterface* rtp_packet_transport_;
PacketTransportInterface* rtcp_packet_transport_;
@@ -75,6 +96,11 @@ class RtpTransportAdapter : public RtpTransportInterface {
owned_rtp_transport_controller_;
RtcpParameters rtcp_parameters_;
+ // SRTP specific members.
+ rtc::Optional<cricket::CryptoParams> send_key_;
+ rtc::Optional<cricket::CryptoParams> receive_key_;
+ bool is_srtp_transport_;
+
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RtpTransportAdapter);
};
« no previous file with comments | « webrtc/ortc/rtpparametersconversion.h ('k') | webrtc/ortc/rtptransportadapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698