summaryrefslogtreecommitdiffstats
path: root/dom/presentation/interfaces/nsIPresentationSessionTransport.idl
blob: a0b5617d7d3965440c0fe31932030e74bb76fbf8 (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
/* 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 nsIDOMBlob;
interface nsIInputStream;
interface nsINetAddr;

%{C++
#define PRESENTATION_TCP_SESSION_TRANSPORT_CONTRACTID \
  "@mozilla.org/presentation/presentationtcpsessiontransport;1"
%}

/*
 * The callback for session transport events.
 */
[scriptable, uuid(9f158786-41a6-4a10-b29b-9497f25d4b67)]
interface nsIPresentationSessionTransportCallback : nsISupports
{
  void notifyTransportReady();
  void notifyTransportClosed(in nsresult reason);
  void notifyData(in ACString data, in boolean isBinary);
};

/*
 * App-to-App transport channel for the presentation session.
 */
[scriptable, uuid(670b7e1b-65be-42b6-a596-be571907fa18)]
interface nsIPresentationSessionTransport : nsISupports
{
  // Should be set once the underlying session transport is built
  attribute nsIPresentationSessionTransportCallback callback;

  // valid for TCP session transport
  readonly attribute nsINetAddr selfAddress;

  /*
   * Enable the notification for incoming data. |notifyData| of
   * |nsIPresentationSessionTransportCallback| can start getting invoked.
   * Should set callback before |enableDataNotification| is called.
   */
  void enableDataNotification();

  /*
   * Send message to the remote endpoint.
   * @param data The message to send.
   */
  void send(in DOMString data);

  /*
   * Send the binary message to the remote endpoint.
   * @param data: the message being sent out.
   */
  void sendBinaryMsg(in ACString data);

  /*
   * Send the blob to the remote endpoint.
   * @param blob: The input blob to be sent.
   */
  void sendBlob(in nsIDOMBlob blob);

  /*
   * Close this session transport.
   * @param reason The reason for closing this session transport.
   */
  void close(in nsresult reason);
};