mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-18 08:07:56 +01:00

The DtlsSrtpTransport is designed to take DTLS responsibilities from BaseChannel. DtlsSrtpTransport is responsible for exporting keys from DtlsTransport and setting up the wrapped SrtpTransport. The DtlsSrtpTransport is not hooked up to BaseChannel yet in this CL. Bug: webrtc:7013 Change-Id: I318c00dadf9b1e033ec842de6e1536e9227ab713 Reviewed-on: https://webrtc-review.googlesource.com/6700 Commit-Queue: Zhi Huang <zhihuang@webrtc.org> Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20804}
102 lines
3.1 KiB
C++
102 lines
3.1 KiB
C++
/*
|
|
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#ifndef PC_RTPTRANSPORTINTERNALADAPTER_H_
|
|
#define PC_RTPTRANSPORTINTERNALADAPTER_H_
|
|
|
|
#include <memory>
|
|
#include <utility>
|
|
|
|
#include "pc/rtptransportinternal.h"
|
|
|
|
namespace webrtc {
|
|
|
|
// This class is used by SrtpTransport and DtlsSrtpTransport in order to reduce
|
|
// the duplicated code. Using this class, different subclasses can override only
|
|
// part of RtpTransportInternal methods without implementing all the common
|
|
// methods.
|
|
class RtpTransportInternalAdapter : public RtpTransportInternal {
|
|
public:
|
|
explicit RtpTransportInternalAdapter(RtpTransportInternal* transport)
|
|
: transport_(transport) {
|
|
RTC_DCHECK(transport_);
|
|
}
|
|
|
|
void SetRtcpMuxEnabled(bool enable) override {
|
|
transport_->SetRtcpMuxEnabled(enable);
|
|
}
|
|
|
|
bool rtcp_mux_enabled() const override {
|
|
return transport_->rtcp_mux_enabled();
|
|
}
|
|
|
|
rtc::PacketTransportInternal* rtp_packet_transport() const override {
|
|
return transport_->rtp_packet_transport();
|
|
}
|
|
void SetRtpPacketTransport(rtc::PacketTransportInternal* rtp) override {
|
|
transport_->SetRtpPacketTransport(rtp);
|
|
}
|
|
|
|
rtc::PacketTransportInternal* rtcp_packet_transport() const override {
|
|
return transport_->rtcp_packet_transport();
|
|
}
|
|
void SetRtcpPacketTransport(rtc::PacketTransportInternal* rtcp) override {
|
|
transport_->SetRtcpPacketTransport(rtcp);
|
|
}
|
|
|
|
bool IsWritable(bool rtcp) const override {
|
|
return transport_->IsWritable(rtcp);
|
|
}
|
|
|
|
bool SendRtpPacket(rtc::CopyOnWriteBuffer* packet,
|
|
const rtc::PacketOptions& options,
|
|
int flags) override {
|
|
return transport_->SendRtpPacket(packet, options, flags);
|
|
}
|
|
|
|
bool SendRtcpPacket(rtc::CopyOnWriteBuffer* packet,
|
|
const rtc::PacketOptions& options,
|
|
int flags) override {
|
|
return transport_->SendRtcpPacket(packet, options, flags);
|
|
}
|
|
|
|
bool HandlesPayloadType(int payload_type) const override {
|
|
return transport_->HandlesPayloadType(payload_type);
|
|
}
|
|
|
|
void AddHandledPayloadType(int payload_type) override {
|
|
return transport_->AddHandledPayloadType(payload_type);
|
|
}
|
|
|
|
// RtpTransportInterface overrides.
|
|
PacketTransportInterface* GetRtpPacketTransport() const override {
|
|
return transport_->GetRtpPacketTransport();
|
|
}
|
|
|
|
PacketTransportInterface* GetRtcpPacketTransport() const override {
|
|
return transport_->GetRtcpPacketTransport();
|
|
}
|
|
|
|
RTCError SetParameters(const RtpTransportParameters& parameters) override {
|
|
return transport_->SetParameters(parameters);
|
|
}
|
|
|
|
RtpTransportParameters GetParameters() const override {
|
|
return transport_->GetParameters();
|
|
}
|
|
|
|
protected:
|
|
// Owned by the subclasses.
|
|
RtpTransportInternal* transport_;
|
|
};
|
|
|
|
} // namespace webrtc
|
|
|
|
#endif // PC_RTPTRANSPORTINTERNALADAPTER_H_
|