2014-11-18 00:34:10 +03:00
|
|
|
/* 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"
|
|
|
|
|
2015-10-19 05:44:59 +03:00
|
|
|
interface nsIPresentationControlChannel;
|
2014-11-18 00:34:10 +03:00
|
|
|
|
2015-10-19 05:44:59 +03:00
|
|
|
%{C++
|
|
|
|
#define TCP_PRESENTATION_SERVER_CONTACT_ID \
|
|
|
|
"@mozilla.org/presentation-device/tcp-presentation-server;1"
|
|
|
|
%}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The device information required for establishing TCP control channel.
|
|
|
|
*/
|
2015-10-21 03:54:00 +03:00
|
|
|
[scriptable, uuid(296fd171-e4d0-4de0-99ff-ad8ed52ddef3)]
|
2015-10-19 05:44:59 +03:00
|
|
|
interface nsITCPDeviceInfo: nsISupports
|
|
|
|
{
|
|
|
|
readonly attribute AUTF8String id;
|
2015-10-21 03:54:00 +03:00
|
|
|
readonly attribute AUTF8String address;
|
2015-10-19 05:44:59 +03:00
|
|
|
readonly attribute uint16_t port;
|
|
|
|
};
|
|
|
|
|
2015-11-03 03:04:00 +03:00
|
|
|
[scriptable, uuid(09bddfaf-fcc2-4dc9-b33e-a509a1c2fb6d)]
|
2014-11-18 00:34:10 +03:00
|
|
|
interface nsITCPPresentationServerListener: nsISupports
|
|
|
|
{
|
|
|
|
/**
|
2015-11-03 03:04:00 +03:00
|
|
|
* Callback while the server socket changes port.
|
|
|
|
* This event won't be cached so you should get current port after setting
|
|
|
|
* this listener to make sure the value is updated.
|
|
|
|
* @param aPort
|
|
|
|
* The port of the server socket.
|
2014-11-18 00:34:10 +03:00
|
|
|
*/
|
2015-11-03 03:04:00 +03:00
|
|
|
void onPortChange(in uint16_t aPort);
|
2015-10-19 05:44:59 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback while the remote host is requesting to start a presentation session.
|
|
|
|
* @param aDeviceInfo The device information related to the remote host.
|
|
|
|
* @param aUrl The URL requested to open by remote device.
|
|
|
|
* @param aPresentationId The Id for representing this session.
|
|
|
|
* @param aControlChannel The control channel for this session.
|
|
|
|
*/
|
|
|
|
void onSessionRequest(in nsITCPDeviceInfo aDeviceInfo,
|
|
|
|
in DOMString aUrl,
|
|
|
|
in DOMString aPresentationId,
|
|
|
|
in nsIPresentationControlChannel aControlChannel);
|
2014-11-18 00:34:10 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* TCP presentation server which can be used by discovery services.
|
|
|
|
*/
|
2015-10-20 11:47:56 +03:00
|
|
|
[scriptable, uuid(55d6b605-2389-4aae-a8fe-60d4440540ea)]
|
2014-11-18 00:34:10 +03:00
|
|
|
interface nsITCPPresentationServer: nsISupports
|
|
|
|
{
|
|
|
|
/**
|
2015-10-20 11:47:56 +03:00
|
|
|
* This method initialize server socket.
|
2014-11-18 00:34:10 +03:00
|
|
|
* @param aPort
|
|
|
|
* The port of the server socket. Pass 0 or opt-out to indicate no
|
|
|
|
* preference, and a port will be selected automatically.
|
|
|
|
* @throws NS_ERROR_FAILURE if the server socket has been inited or the
|
|
|
|
* server socket can not be inited.
|
|
|
|
*/
|
2015-10-20 11:47:56 +03:00
|
|
|
void startService([optional] in uint16_t aPort);
|
2014-11-18 00:34:10 +03:00
|
|
|
|
|
|
|
/**
|
2015-10-19 05:44:59 +03:00
|
|
|
* Request session to designated remote TCP device.
|
|
|
|
* @param aDeviceInfo
|
|
|
|
* The remtoe device info for establish connection.
|
|
|
|
* @param aUrl
|
|
|
|
* The URL requested to open by remote device.
|
|
|
|
* @param aPresentationId
|
|
|
|
* The Id for representing this session.
|
|
|
|
* @returns The control channel for this session.
|
2015-10-20 11:47:56 +03:00
|
|
|
* @throws NS_ERROR_FAILURE if the Id hasn't been inited.
|
2014-11-18 00:34:10 +03:00
|
|
|
*/
|
2015-10-19 05:44:59 +03:00
|
|
|
nsIPresentationControlChannel requestSession(in nsITCPDeviceInfo aDeviceInfo,
|
|
|
|
in DOMString aUrl,
|
|
|
|
in DOMString aPresentationId);
|
2014-11-18 00:34:10 +03:00
|
|
|
|
|
|
|
/**
|
2015-10-19 05:44:59 +03:00
|
|
|
* Close server socket and call |listener.onClose(NS_OK)|
|
2014-11-18 00:34:10 +03:00
|
|
|
*/
|
2015-10-19 05:44:59 +03:00
|
|
|
void close();
|
2014-11-18 00:34:10 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the listen port of the TCP socket, valid after |init|. 0 indicates
|
|
|
|
* the server socket is not inited or closed.
|
|
|
|
*/
|
|
|
|
readonly attribute uint16_t port;
|
|
|
|
|
|
|
|
/**
|
2015-10-20 11:47:56 +03:00
|
|
|
* The id of the TCP presentation server. |requestSession| won't
|
|
|
|
* work until the |id| is set.
|
2014-11-18 00:34:10 +03:00
|
|
|
*/
|
|
|
|
attribute AUTF8String id;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* the listener for handling events of this TCP presentation server
|
|
|
|
*/
|
|
|
|
attribute nsITCPPresentationServerListener listener;
|
|
|
|
};
|