#include "pc/srtp_session.h"
#include <string.h>
#include <iomanip>
#include <string>
#include "absl/base/attributes.h"
#include "absl/base/const_init.h"
#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "api/field_trials_view.h"
#include "modules/rtp_rtcp/source/rtp_util.h"
#include "pc/external_hmac.h"
#include "rtc_base/byte_order.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/ssl_stream_adapter.h"
#include "rtc_base/string_encode.h"
#include "rtc_base/thread_annotations.h"
#include "rtc_base/time_utils.h"
#include "system_wrappers/include/metrics.h"
#include "third_party/libsrtp/include/srtp.h"
#include "third_party/libsrtp/include/srtp_priv.h"
namespace cricket {
namespace {
class LibSrtpInitializer { … };
void LibSrtpInitializer::ProhibitLibsrtpInitialization() { … }
bool LibSrtpInitializer::IncrementLibsrtpUsageCountAndMaybeInit(
srtp_event_handler_func_t* handler) { … }
void LibSrtpInitializer::DecrementLibsrtpUsageCountAndMaybeDeinit() { … }
}
ParseRtpSequenceNumber;
constexpr int kSrtpErrorCodeBoundary = …;
SrtpSession::SrtpSession() { … }
SrtpSession::SrtpSession(const webrtc::FieldTrialsView& field_trials) { … }
SrtpSession::~SrtpSession() { … }
bool SrtpSession::SetSend(int crypto_suite,
const uint8_t* key,
size_t len,
const std::vector<int>& extension_ids) { … }
bool SrtpSession::UpdateSend(int crypto_suite,
const uint8_t* key,
size_t len,
const std::vector<int>& extension_ids) { … }
bool SrtpSession::SetRecv(int crypto_suite,
const uint8_t* key,
size_t len,
const std::vector<int>& extension_ids) { … }
bool SrtpSession::UpdateRecv(int crypto_suite,
const uint8_t* key,
size_t len,
const std::vector<int>& extension_ids) { … }
bool SrtpSession::ProtectRtp(void* p, int in_len, int max_len, int* out_len) { … }
bool SrtpSession::ProtectRtp(void* p,
int in_len,
int max_len,
int* out_len,
int64_t* index) { … }
bool SrtpSession::ProtectRtcp(void* p, int in_len, int max_len, int* out_len) { … }
bool SrtpSession::UnprotectRtp(void* p, int in_len, int* out_len) { … }
bool SrtpSession::UnprotectRtcp(void* p, int in_len, int* out_len) { … }
bool SrtpSession::GetRtpAuthParams(uint8_t** key, int* key_len, int* tag_len) { … }
int SrtpSession::GetSrtpOverhead() const { … }
void SrtpSession::EnableExternalAuth() { … }
bool SrtpSession::IsExternalAuthEnabled() const { … }
bool SrtpSession::IsExternalAuthActive() const { … }
bool SrtpSession::RemoveSsrcFromSession(uint32_t ssrc) { … }
bool SrtpSession::GetSendStreamPacketIndex(void* p,
int in_len,
int64_t* index) { … }
bool SrtpSession::DoSetKey(int type,
int crypto_suite,
const uint8_t* key,
size_t len,
const std::vector<int>& extension_ids) { … }
bool SrtpSession::SetKey(int type,
int crypto_suite,
const uint8_t* key,
size_t len,
const std::vector<int>& extension_ids) { … }
bool SrtpSession::UpdateKey(int type,
int crypto_suite,
const uint8_t* key,
size_t len,
const std::vector<int>& extension_ids) { … }
void ProhibitLibsrtpInitialization() { … }
void SrtpSession::HandleEvent(const srtp_event_data_t* ev) { … }
void SrtpSession::HandleEventThunk(srtp_event_data_t* ev) { … }
void SrtpSession::DumpPacket(const void* buf, int len, bool outbound) { … }
}