#include "pc/srtp_transport.h"
#include <string.h>
#include <string>
#include <utility>
#include <vector>
#include "absl/strings/match.h"
#include "media/base/rtp_utils.h"
#include "modules/rtp_rtcp/source/rtp_util.h"
#include "pc/rtp_transport.h"
#include "pc/srtp_session.h"
#include "rtc_base/async_packet_socket.h"
#include "rtc_base/checks.h"
#include "rtc_base/copy_on_write_buffer.h"
#include "rtc_base/logging.h"
#include "rtc_base/numerics/safe_conversions.h"
#include "rtc_base/ssl_stream_adapter.h"
#include "rtc_base/third_party/base64/base64.h"
#include "rtc_base/trace_event.h"
#include "rtc_base/zero_memory.h"
namespace webrtc {
SrtpTransport::SrtpTransport(bool rtcp_mux_enabled,
const FieldTrialsView& field_trials)
: … { … }
bool SrtpTransport::SendRtpPacket(rtc::CopyOnWriteBuffer* packet,
const rtc::PacketOptions& options,
int flags) { … }
bool SrtpTransport::SendRtcpPacket(rtc::CopyOnWriteBuffer* packet,
const rtc::PacketOptions& options,
int flags) { … }
void SrtpTransport::OnRtpPacketReceived(const rtc::ReceivedPacket& packet) { … }
void SrtpTransport::OnRtcpPacketReceived(const rtc::ReceivedPacket& packet) { … }
void SrtpTransport::OnNetworkRouteChanged(
absl::optional<rtc::NetworkRoute> network_route) { … }
void SrtpTransport::OnWritableState(
rtc::PacketTransportInternal* packet_transport) { … }
bool SrtpTransport::SetRtpParams(int send_crypto_suite,
const uint8_t* send_key,
int send_key_len,
const std::vector<int>& send_extension_ids,
int recv_crypto_suite,
const uint8_t* recv_key,
int recv_key_len,
const std::vector<int>& recv_extension_ids) { … }
bool SrtpTransport::SetRtcpParams(int send_crypto_suite,
const uint8_t* send_key,
int send_key_len,
const std::vector<int>& send_extension_ids,
int recv_crypto_suite,
const uint8_t* recv_key,
int recv_key_len,
const std::vector<int>& recv_extension_ids) { … }
bool SrtpTransport::IsSrtpActive() const { … }
bool SrtpTransport::IsWritable(bool rtcp) const { … }
void SrtpTransport::ResetParams() { … }
void SrtpTransport::CreateSrtpSessions() { … }
bool SrtpTransport::ProtectRtp(void* p, int in_len, int max_len, int* out_len) { … }
bool SrtpTransport::ProtectRtp(void* p,
int in_len,
int max_len,
int* out_len,
int64_t* index) { … }
bool SrtpTransport::ProtectRtcp(void* p,
int in_len,
int max_len,
int* out_len) { … }
bool SrtpTransport::UnprotectRtp(void* p, int in_len, int* out_len) { … }
bool SrtpTransport::UnprotectRtcp(void* p, int in_len, int* out_len) { … }
bool SrtpTransport::GetRtpAuthParams(uint8_t** key,
int* key_len,
int* tag_len) { … }
bool SrtpTransport::GetSrtpOverhead(int* srtp_overhead) const { … }
void SrtpTransport::EnableExternalAuth() { … }
bool SrtpTransport::IsExternalAuthEnabled() const { … }
bool SrtpTransport::IsExternalAuthActive() const { … }
bool SrtpTransport::MaybeSetKeyParams() { … }
bool SrtpTransport::ParseKeyParams(const std::string& key_params,
uint8_t* key,
size_t len) { … }
void SrtpTransport::MaybeUpdateWritableState() { … }
bool SrtpTransport::UnregisterRtpDemuxerSink(RtpPacketSinkInterface* sink) { … }
}