RTCDtlsTransport.h (1413B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 3 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 #ifndef _RTCDtlsTransport_h_ 6 #define _RTCDtlsTransport_h_ 7 8 #include "js/RootingAPI.h" 9 #include "mozilla/DOMEventTargetHelper.h" 10 #include "mozilla/RefPtr.h" 11 #include "mozilla/dom/RTCIceTransport.h" 12 #include "transport/transportlayer.h" 13 14 class nsPIDOMWindowInner; 15 16 namespace mozilla::dom { 17 18 enum class RTCDtlsTransportState : uint8_t; 19 20 class RTCDtlsTransport : public DOMEventTargetHelper { 21 public: 22 explicit RTCDtlsTransport(nsPIDOMWindowInner* aWindow); 23 24 // nsISupports 25 NS_DECL_ISUPPORTS_INHERITED 26 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(RTCDtlsTransport, 27 DOMEventTargetHelper) 28 29 // webidl 30 JSObject* WrapObject(JSContext* aCx, 31 JS::Handle<JSObject*> aGivenProto) override; 32 IMPL_EVENT_HANDLER(statechange) 33 RTCDtlsTransportState State() const { return mState; } 34 RefPtr<RTCIceTransport> IceTransport() { return mIceTransport; } 35 36 void UpdateStateNoEvent(TransportLayer::State aState); 37 void UpdateState(TransportLayer::State aState); 38 39 private: 40 virtual ~RTCDtlsTransport() = default; 41 42 RTCDtlsTransportState mState; 43 RefPtr<RTCIceTransport> mIceTransport; 44 }; 45 46 } // namespace mozilla::dom 47 #endif // _RTCDtlsTransport_h_