summaryrefslogtreecommitdiffstats
path: root/dom/media/webrtc/jsapi/RTCSctpTransport.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
commit0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch)
treea31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /dom/media/webrtc/jsapi/RTCSctpTransport.h
parentInitial commit. (diff)
downloadfirefox-esr-upstream/115.8.0esr.tar.xz
firefox-esr-upstream/115.8.0esr.zip
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/webrtc/jsapi/RTCSctpTransport.h')
-rw-r--r--dom/media/webrtc/jsapi/RTCSctpTransport.h65
1 files changed, 65 insertions, 0 deletions
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<uint16_t>& aMaxChannels);
+
+ // nsISupports
+ NS_DECL_ISUPPORTS_INHERITED
+ NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(RTCSctpTransport,
+ DOMEventTargetHelper)
+
+ // webidl
+ JSObject* WrapObject(JSContext* aCx,
+ JS::Handle<JSObject*> aGivenProto) override;
+ IMPL_EVENT_HANDLER(statechange)
+
+ RTCDtlsTransport* Transport() const { return mDtlsTransport; }
+ RTCSctpTransportState State() const { return mState; }
+ double MaxMessageSize() const { return mMaxMessageSize; }
+ Nullable<uint16_t> GetMaxChannels() const { return mMaxChannels; }
+
+ void SetTransport(RTCDtlsTransport& aTransport) {
+ mDtlsTransport = &aTransport;
+ }
+
+ void SetMaxMessageSize(double aMaxMessageSize) {
+ mMaxMessageSize = aMaxMessageSize;
+ }
+
+ void SetMaxChannels(const Nullable<uint16_t>& aMaxChannels) {
+ mMaxChannels = aMaxChannels;
+ }
+
+ void UpdateState(RTCSctpTransportState aState);
+
+ private:
+ virtual ~RTCSctpTransport() = default;
+
+ RTCSctpTransportState mState;
+ RefPtr<RTCDtlsTransport> mDtlsTransport;
+ double mMaxMessageSize;
+ Nullable<uint16_t> mMaxChannels;
+};
+
+} // namespace mozilla::dom
+#endif // _RTCSctpTransport_h_