From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- dom/media/webrtc/jsep/JsepTransport.h | 102 ++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 dom/media/webrtc/jsep/JsepTransport.h (limited to 'dom/media/webrtc/jsep/JsepTransport.h') diff --git a/dom/media/webrtc/jsep/JsepTransport.h b/dom/media/webrtc/jsep/JsepTransport.h new file mode 100644 index 0000000000..67690b1fd4 --- /dev/null +++ b/dom/media/webrtc/jsep/JsepTransport.h @@ -0,0 +1,102 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef _JSEPTRANSPORT_H_ +#define _JSEPTRANSPORT_H_ + +#include +#include + +#include +#include +#include "nsISupportsImpl.h" + +#include "sdp/SdpAttribute.h" + +namespace mozilla { + +class JsepDtlsTransport { + public: + JsepDtlsTransport() : mRole(kJsepDtlsInvalidRole) {} + + virtual ~JsepDtlsTransport() {} + + enum Role { kJsepDtlsClient, kJsepDtlsServer, kJsepDtlsInvalidRole }; + + virtual const SdpFingerprintAttributeList& GetFingerprints() const { + return mFingerprints; + } + + virtual Role GetRole() const { return mRole; } + + private: + friend class JsepSessionImpl; + + SdpFingerprintAttributeList mFingerprints; + Role mRole; +}; + +class JsepIceTransport { + public: + JsepIceTransport() {} + + virtual ~JsepIceTransport() {} + + const std::string& GetUfrag() const { return mUfrag; } + const std::string& GetPassword() const { return mPwd; } + const std::vector& GetCandidates() const { return mCandidates; } + + private: + friend class JsepSessionImpl; + + std::string mUfrag; + std::string mPwd; + std::vector mCandidates; +}; + +class JsepTransport { + public: + JsepTransport() : mComponents(0) {} + + JsepTransport(const JsepTransport& orig) { *this = orig; } + + ~JsepTransport() {} + + JsepTransport& operator=(const JsepTransport& orig) { + if (this != &orig) { + mIce.reset(orig.mIce ? new JsepIceTransport(*orig.mIce) : nullptr); + mDtls.reset(orig.mDtls ? new JsepDtlsTransport(*orig.mDtls) : nullptr); + mTransportId = orig.mTransportId; + mComponents = orig.mComponents; + mLocalUfrag = orig.mLocalUfrag; + mLocalPwd = orig.mLocalPwd; + } + return *this; + } + + void Close() { + mComponents = 0; + mTransportId.clear(); + mIce.reset(); + mDtls.reset(); + mLocalUfrag.clear(); + mLocalPwd.clear(); + } + + // Unique identifier for this transport within this call. Group? + std::string mTransportId; + + // ICE stuff. + UniquePtr mIce; + UniquePtr mDtls; + + // Number of required components. + size_t mComponents; + std::string mLocalUfrag; + std::string mLocalPwd; +}; + +} // namespace mozilla + +#endif -- cgit v1.2.3