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/jsapi/RTCSctpTransport.h | 65 +++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 dom/media/webrtc/jsapi/RTCSctpTransport.h (limited to 'dom/media/webrtc/jsapi/RTCSctpTransport.h') diff --git a/dom/media/webrtc/jsapi/RTCSctpTransport.h b/dom/media/webrtc/jsapi/RTCSctpTransport.h new file mode 100644 index 0000000000..8e21db5e73 --- /dev/null +++ b/dom/media/webrtc/jsapi/RTCSctpTransport.h @@ -0,0 +1,65 @@ +/* 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 _RTCSctpTransport_h_ +#define _RTCSctpTransport_h_ + +#include "mozilla/DOMEventTargetHelper.h" +#include "mozilla/RefPtr.h" +#include "js/RootingAPI.h" +#include "RTCDtlsTransport.h" + +class nsPIDOMWindowInner; + +namespace mozilla::dom { + +enum class RTCSctpTransportState : uint8_t; + +class RTCSctpTransport : public DOMEventTargetHelper { + public: + explicit RTCSctpTransport(nsPIDOMWindowInner* aWindow, + RTCDtlsTransport& aDtlsTransport, + double aMaxMessageSize, + const Nullable& aMaxChannels); + + // nsISupports + NS_DECL_ISUPPORTS_INHERITED + NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(RTCSctpTransport, + DOMEventTargetHelper) + + // webidl + JSObject* WrapObject(JSContext* aCx, + JS::Handle aGivenProto) override; + IMPL_EVENT_HANDLER(statechange) + + RTCDtlsTransport* Transport() const { return mDtlsTransport; } + RTCSctpTransportState State() const { return mState; } + double MaxMessageSize() const { return mMaxMessageSize; } + Nullable GetMaxChannels() const { return mMaxChannels; } + + void SetTransport(RTCDtlsTransport& aTransport) { + mDtlsTransport = &aTransport; + } + + void SetMaxMessageSize(double aMaxMessageSize) { + mMaxMessageSize = aMaxMessageSize; + } + + void SetMaxChannels(const Nullable& aMaxChannels) { + mMaxChannels = aMaxChannels; + } + + void UpdateState(RTCSctpTransportState aState); + + private: + virtual ~RTCSctpTransport() = default; + + RTCSctpTransportState mState; + RefPtr mDtlsTransport; + double mMaxMessageSize; + Nullable mMaxChannels; +}; + +} // namespace mozilla::dom +#endif // _RTCSctpTransport_h_ -- cgit v1.2.3