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#include "nsISupports.idl"
6
7interface nsIDOMBlob;
8interface nsIInputStream;
9interface nsINetAddr;
10
11%{C++
12#define PRESENTATION_TCP_SESSION_TRANSPORT_CONTRACTID \
13  "@mozilla.org/presentation/presentationtcpsessiontransport;1"
14%}
15
16/*
17 * The callback for session transport events.
18 */
19[scriptable, uuid(9f158786-41a6-4a10-b29b-9497f25d4b67)]
20interface nsIPresentationSessionTransportCallback : nsISupports
21{
22  void notifyTransportReady();
23  void notifyTransportClosed(in nsresult reason);
24  void notifyData(in ACString data, in boolean isBinary);
25};
26
27/*
28 * App-to-App transport channel for the presentation session.
29 */
30[scriptable, uuid(670b7e1b-65be-42b6-a596-be571907fa18)]
31interface nsIPresentationSessionTransport : nsISupports
32{
33  // Should be set once the underlying session transport is built
34  attribute nsIPresentationSessionTransportCallback callback;
35
36  // valid for TCP session transport
37  readonly attribute nsINetAddr selfAddress;
38
39  /*
40   * Enable the notification for incoming data. |notifyData| of
41   * |nsIPresentationSessionTransportCallback| can start getting invoked.
42   * Should set callback before |enableDataNotification| is called.
43   */
44  void enableDataNotification();
45
46  /*
47   * Send message to the remote endpoint.
48   * @param data The message to send.
49   */
50  void send(in DOMString data);
51
52  /*
53   * Send the binary message to the remote endpoint.
54   * @param data: the message being sent out.
55   */
56  void sendBinaryMsg(in ACString data);
57
58  /*
59   * Send the blob to the remote endpoint.
60   * @param blob: The input blob to be sent.
61   */
62  void sendBlob(in nsIDOMBlob blob);
63
64  /*
65   * Close this session transport.
66   * @param reason The reason for closing this session transport.
67   */
68  void close(in nsresult reason);
69};
70