From 3c5d8b2b78a4b5ce78fefca8c33791a3c49ad720 Mon Sep 17 00:00:00 2001 From: Scott Godin Date: Thu, 8 Jan 2026 19:15:51 -0500 Subject: [PATCH] - sdpcontainer::Sdp - add get mediaLineAtIndex api - sdpcontainer::SdpMediaLine - add more crypto type definitions --- media/sdpcontainer/Sdp.cxx | 16 +++++++++++++++ media/sdpcontainer/Sdp.hxx | 2 ++ media/sdpcontainer/SdpMediaLine.cxx | 31 ++++++++++++++++++++++++++++- media/sdpcontainer/SdpMediaLine.hxx | 11 +++++++--- 4 files changed, 56 insertions(+), 4 deletions(-) diff --git a/media/sdpcontainer/Sdp.cxx b/media/sdpcontainer/Sdp.cxx index d37af0404..275c5efa8 100644 --- a/media/sdpcontainer/Sdp.cxx +++ b/media/sdpcontainer/Sdp.cxx @@ -262,6 +262,21 @@ Sdp::getMediaLines() const return mMediaLines; } +SdpMediaLine* +Sdp::getMediaLineAtIndex(int indexNumber) +{ + MediaLineList::iterator it = mMediaLines.begin(); + int mediaLineIndex = 0; + for (; it != mMediaLines.end(); it++, mediaLineIndex++) + { + if (mediaLineIndex == indexNumber) + { + return *it; + } + } + return nullptr; +} + resip::Data Sdp::getLocalFoundationId(SdpCandidate::SdpCandidateType candidateType, const char * baseAddress, @@ -383,6 +398,7 @@ sdpcontainer::operator<<( EncodeStream& strm, const Sdp& sdp) /* ==================================================================== + Copyright (c) 2026, SIP Spectrum, Inc. https://www.sipspectrum.com Copyright (c) 2007-2008, Plantronics, Inc. All rights reserved. diff --git a/media/sdpcontainer/Sdp.hxx b/media/sdpcontainer/Sdp.hxx index c359f4289..b159cae09 100644 --- a/media/sdpcontainer/Sdp.hxx +++ b/media/sdpcontainer/Sdp.hxx @@ -294,6 +294,7 @@ public: double getMaximumPacketRate() const { return mMaximumPacketRate; } const MediaLineList& getMediaLines() const; + SdpMediaLine* getMediaLineAtIndex(int indexNumber); // 0 based resip::Data getLocalFoundationId(SdpCandidate::SdpCandidateType candidateType, const char * baseAddress, const char * stunAddress=0); @@ -369,6 +370,7 @@ EncodeStream& operator<<(EncodeStream& strm, const Sdp& ); /* ==================================================================== + Copyright (c) 2026, SIP Spectrum, Inc. https://www.sipspectrum.com Copyright (c) 2007-2008, Plantronics, Inc. All rights reserved. diff --git a/media/sdpcontainer/SdpMediaLine.cxx b/media/sdpcontainer/SdpMediaLine.cxx index 5aef5bf48..b46df5d32 100644 --- a/media/sdpcontainer/SdpMediaLine.cxx +++ b/media/sdpcontainer/SdpMediaLine.cxx @@ -78,7 +78,11 @@ const char* SdpMediaLine::SdpCryptoSuiteTypeString[] = "NONE", "AES_CM_128_HMAC_SHA1_80", "AES_CM_128_HMAC_SHA1_32", - "F8_128_HMAC_SHA1_80" + "F8_128_HMAC_SHA1_80", + "AES_CM_192_HMAC_SHA1_80", + "AES_CM_192_HMAC_SHA1_32", + "AES_CM_256_HMAC_SHA1_80", + "AES_CM_256_HMAC_SHA1_32" }; const char* SdpMediaLine::SdpCryptoKeyMethodString[] = @@ -478,6 +482,30 @@ SdpMediaLine::getCryptoSuiteTypeFromString(const char * type) { return CRYPTO_SUITE_TYPE_F8_128_HMAC_SHA1_80; } + // RFC6188 places the _CM after the Master Key length for some reason - accept both + else if (resip::isEqualNoCase("AES_CM_192_HMAC_SHA1_80", dataType) || + resip::isEqualNoCase("AES_192_CM_HMAC_SHA1_80", dataType)) + { + return CRYPTO_SUITE_TYPE_AES_CM_192_HMAC_SHA1_80; + } + // RFC6188 places the _CM after the Master Key length for some reason - accept both + else if (resip::isEqualNoCase("AES_CM_192_HMAC_SHA1_32", dataType) || + resip::isEqualNoCase("AES_192_CM_HMAC_SHA1_32", dataType)) + { + return CRYPTO_SUITE_TYPE_AES_CM_192_HMAC_SHA1_32; + } + // RFC6188 places the _CM after the Master Key length for some reason - accept both + else if (resip::isEqualNoCase("AES_CM_256_HMAC_SHA1_80", dataType) || + resip::isEqualNoCase("AES_256_CM_HMAC_SHA1_80", dataType)) + { + return CRYPTO_SUITE_TYPE_AES_CM_256_HMAC_SHA1_80; + } + // RFC6188 places the _CM after the Master Key length for some reason - accept both + else if (resip::isEqualNoCase("AES_CM_256_HMAC_SHA1_32", dataType) || + resip::isEqualNoCase("AES_256_CM_HMAC_SHA1_32", dataType)) + { + return CRYPTO_SUITE_TYPE_AES_CM_256_HMAC_SHA1_32; + } else { return CRYPTO_SUITE_TYPE_NONE; @@ -830,6 +858,7 @@ sdpcontainer::operator<<( EncodeStream& strm, const SdpMediaLine& sdpMediaLine) /* ==================================================================== + Copyright (c) 2026, SIP Spectrum, Inc. https://www.sipspectrum.com Copyright (c) 2007-2008, Plantronics, Inc. All rights reserved. diff --git a/media/sdpcontainer/SdpMediaLine.hxx b/media/sdpcontainer/SdpMediaLine.hxx index 385d185a9..38b73b696 100644 --- a/media/sdpcontainer/SdpMediaLine.hxx +++ b/media/sdpcontainer/SdpMediaLine.hxx @@ -130,9 +130,13 @@ public: typedef enum { CRYPTO_SUITE_TYPE_NONE, - CRYPTO_SUITE_TYPE_AES_CM_128_HMAC_SHA1_80, // "AES_CM_128_HMAC_SHA1_80" - RFC4568 - CRYPTO_SUITE_TYPE_AES_CM_128_HMAC_SHA1_32, // "AES_CM_128_HMAC_SHA1_32" - RFC4568 - CRYPTO_SUITE_TYPE_F8_128_HMAC_SHA1_80 // "F8_128_HMAC_SHA1_80" - RFC4568 + CRYPTO_SUITE_TYPE_AES_CM_128_HMAC_SHA1_80, // RFC4568 + CRYPTO_SUITE_TYPE_AES_CM_128_HMAC_SHA1_32, // RFC4568 + CRYPTO_SUITE_TYPE_F8_128_HMAC_SHA1_80, // RFC4568 + CRYPTO_SUITE_TYPE_AES_CM_192_HMAC_SHA1_80, // RFC6188 + CRYPTO_SUITE_TYPE_AES_CM_192_HMAC_SHA1_32, // RFC6188 + CRYPTO_SUITE_TYPE_AES_CM_256_HMAC_SHA1_80, // RFC6188 + CRYPTO_SUITE_TYPE_AES_CM_256_HMAC_SHA1_32 // RFC6188 } SdpCryptoSuiteType; static const char* SdpCryptoSuiteTypeString[]; @@ -682,6 +686,7 @@ EncodeStream& operator<<(EncodeStream& strm, const SdpMediaLine& ); /* ==================================================================== + Copyright (c) 2026, SIP Spectrum, Inc. https://www.sipspectrum.com Copyright (c) 2007-2008, Plantronics, Inc. All rights reserved.