/* * Copyright 2019 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. */ #include "pc/media_protocol_names.h" #include <ctype.h> #include <stddef.h> #include <string> namespace cricket { // The official registry of RTP parameters is at // http://www.iana.org/assignments/rtp-parameters/rtp-parameters.xml // The UDP/DTLS and TCP/DTLS prefixes are not registered there. // There are multiple variants of the RTP protocol stack, including // UDP/TLS/RTP/SAVPF (WebRTC default), RTP/AVP, RTP/AVPF, RTP/SAVPF, // TCP/DTLS/RTP/SAVPF and so on. We accept anything that has RTP/ // embedded in it somewhere as being an RTP protocol. const char kMediaProtocolRtpPrefix[] = …; // Protocol names generated by WebRTC const char kMediaProtocolSctp[] = …; const char kMediaProtocolUdpDtlsSctp[] = …; const char kMediaProtocolDtlsSctp[] = …; const char kMediaProtocolTcpDtlsSctp[] = …; // RFC5124 const char kMediaProtocolDtlsSavpf[] = …; const char kMediaProtocolSavpf[] = …; const char kMediaProtocolAvpf[] = …; namespace { // Protocol names that we tolerate, but do not generate. // We always generate offers with "UDP/TLS/RTP/SAVPF" when using DTLS-SRTP, // but we tolerate "RTP/SAVPF" and "RTP/SAVP" and the "UDP/TLS" and "TCP/TLS" // prefixes in offers we receive, for compatibility. // RFC4585 const char kMediaProtocolSavp[] = …; const char kMediaProtocolAvp[] = …; const char kMediaProtocolTcpTlsSavpf[] = …; const char kMediaProtocolUdpTlsSavpf[] = …; const char kMediaProtocolTcpTlsSavp[] = …; const char kMediaProtocolUdpTlsSavp[] = …; } // namespace bool IsDtlsSctp(absl::string_view protocol) { … } bool IsPlainSctp(absl::string_view protocol) { … } bool IsSctpProtocol(absl::string_view protocol) { … } bool IsRtpProtocol(absl::string_view protocol) { … } // Note that the below functions support some protocol strings purely for // legacy compatibility, as required by JSEP in Section 5.1.2, Profile Names // and Interoperability. bool IsDtlsRtp(absl::string_view protocol) { … } bool IsPlainRtp(absl::string_view protocol) { … } } // namespace cricket