summaryrefslogtreecommitdiffstats
path: root/dom/presentation/interfaces/nsIPresentationSessionTransportBuilder.idl
blob: 969f37d71391c63d45e91b6876e1ac53cf2cec83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/* 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/. */

#include "nsISupports.idl"

interface nsIPresentationChannelDescription;
interface nsISocketTransport;
interface mozIDOMWindow;
interface nsIPresentationControlChannel;
interface nsIPresentationSessionTransport;

[scriptable, uuid(673f6de1-e253-41b8-9be8-b7ff161fa8dc)]
interface nsIPresentationSessionTransportBuilderListener : nsISupports
{
  // Should set |transport.callback| in |onSessionTransport|.
  void onSessionTransport(in nsIPresentationSessionTransport transport);
  void onError(in nsresult reason);

  void sendOffer(in nsIPresentationChannelDescription offer);
  void sendAnswer(in nsIPresentationChannelDescription answer);
  void sendIceCandidate(in DOMString candidate);
  void close(in nsresult reason);
};

[scriptable, uuid(2fdbe67d-80f9-48dc-8237-5bef8fa19801)]
interface nsIPresentationSessionTransportBuilder : nsISupports
{
};

/**
 * The constructor for creating a transport builder.
 */
[scriptable, uuid(706482b2-1b51-4bed-a21d-785a9cfcfac7)]
interface nsIPresentationTransportBuilderConstructor : nsISupports
{
  nsIPresentationSessionTransportBuilder createTransportBuilder(in uint8_t type);
};

/**
 * Builder for TCP session transport
 */
[scriptable, uuid(cde36d6e-f471-4262-a70d-f932a26b21d9)]
interface nsIPresentationTCPSessionTransportBuilder : nsIPresentationSessionTransportBuilder
{
  /**
   * The following creation functions will trigger |listener.onSessionTransport|
   * if the session transport is successfully built, |listener.onError| if some
   * error occurs during building session transport.
   */
  void buildTCPSenderTransport(in nsISocketTransport aTransport,
                               in nsIPresentationSessionTransportBuilderListener aListener);

  void buildTCPReceiverTransport(in nsIPresentationChannelDescription aDescription,
                                 in nsIPresentationSessionTransportBuilderListener aListener);
};

/**
 * Builder for WebRTC data channel session transport
 */
[scriptable, uuid(8131c4e0-3a8c-4bc1-a92a-8431473d2fe8)]
interface nsIPresentationDataChannelSessionTransportBuilder : nsIPresentationSessionTransportBuilder
{
  /**
   * The following creation function will trigger |listener.onSessionTransport|
   * if the session transport is successfully built, |listener.onError| if some
   * error occurs during creating session transport. The |notifyConnected| of
   * |aControlChannel| should be called before calling
   * |buildDataChannelTransport|.
   */
  void buildDataChannelTransport(in uint8_t aRole,
                                 in mozIDOMWindow aWindow,
                                 in nsIPresentationSessionTransportBuilderListener aListener);

  // Bug 1275150 - Merge TCP builder with the following APIs
  void onOffer(in nsIPresentationChannelDescription offer);
  void onAnswer(in nsIPresentationChannelDescription answer);
  void onIceCandidate(in DOMString candidate);
  void notifyDisconnected(in nsresult reason);
};