michael@0: /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: * michael@0: * PeerConnection.js' interface to the C++ PeerConnectionImpl. michael@0: * michael@0: * Do not confuse with mozRTCPeerConnection. This interface is purely for michael@0: * communication between the PeerConnection JS DOM binding and the C++ michael@0: * implementation in SIPCC. michael@0: * michael@0: * See media/webrtc/signaling/include/PeerConnectionImpl.h michael@0: * michael@0: */ michael@0: michael@0: interface nsISupports; michael@0: michael@0: /* Must be created first. Observer events will be dispatched on the thread provided */ michael@0: [ChromeOnly, Constructor] michael@0: interface PeerConnectionImpl { michael@0: /* Must be called first. Observer events dispatched on the thread provided */ michael@0: [Throws] michael@0: void initialize(PeerConnectionObserver observer, Window window, michael@0: RTCConfiguration iceServers, michael@0: nsISupports thread); michael@0: /* JSEP calls */ michael@0: [Throws] michael@0: void createOffer(optional MediaConstraintsInternal constraints); michael@0: [Throws] michael@0: void createAnswer(optional MediaConstraintsInternal constraints); michael@0: [Throws] michael@0: void setLocalDescription(long action, DOMString sdp); michael@0: [Throws] michael@0: void setRemoteDescription(long action, DOMString sdp); michael@0: michael@0: /* Stats call, calls either |onGetStatsSuccess| or |onGetStatsError| on our michael@0: observer. (see the |PeerConnectionObserver| interface) */ michael@0: [Throws] michael@0: void getStats(MediaStreamTrack? selector); michael@0: michael@0: /* Adds the stream created by GetUserMedia */ michael@0: [Throws] michael@0: void addStream(MediaStream stream, michael@0: optional MediaConstraintsInternal constraints); michael@0: [Throws] michael@0: void removeStream(MediaStream stream); michael@0: [Throws] michael@0: void closeStreams(); michael@0: michael@0: sequence getLocalStreams(); michael@0: sequence getRemoteStreams(); michael@0: michael@0: /* As the ICE candidates roll in this one should be called each time michael@0: * in order to keep the candidate list up-to-date for the next SDP-related michael@0: * call PeerConnectionImpl does not parse ICE candidates, just sticks them michael@0: * into the SDP. michael@0: */ michael@0: [Throws] michael@0: void addIceCandidate(DOMString candidate, DOMString mid, unsigned short level); michael@0: michael@0: /* Puts the SIPCC engine back to 'kIdle', shuts down threads, deletes state */ michael@0: void close(); michael@0: michael@0: /* Attributes */ michael@0: readonly attribute DOMString fingerprint; michael@0: readonly attribute DOMString localDescription; michael@0: readonly attribute DOMString remoteDescription; michael@0: michael@0: readonly attribute PCImplIceConnectionState iceConnectionState; michael@0: readonly attribute PCImplIceGatheringState iceGatheringState; michael@0: readonly attribute PCImplReadyState readyState; michael@0: readonly attribute PCImplSignalingState signalingState; michael@0: readonly attribute PCImplSipccState sipccState; michael@0: michael@0: /* Data channels */ michael@0: [Throws] michael@0: DataChannel createDataChannel(DOMString label, DOMString protocol, michael@0: unsigned short type, boolean outOfOrderAllowed, michael@0: unsigned short maxTime, unsigned short maxNum, michael@0: boolean externalNegotiated, unsigned short stream); michael@0: [Throws] michael@0: void connectDataConnection(unsigned short localport, michael@0: unsigned short remoteport, unsigned short numstreams); michael@0: };