1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is Mozilla JavaScript Shell project.
17 * The Initial Developer of the Original Code is
19 * Portions created by the Initial Developer are Copyright (C) 2003
20 * the Initial Developer. All Rights Reserved.
23 * Alex Fritze <alex@croczilla.com>
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
39 #include
"nsISupports.idl"
41 interface nsIInputStream
;
42 interface nsIOutputStream
;
45 // {A1764959-87D8-4249-A432-8005DE1372FC}
46 #define NS_JSSHSERVER_CID \
47 { 0xa1764959, 0x87d8, 0x4249, { 0xa4, 0x32, 0x80, 0x05, 0xde, 0x13, 0x72, 0xfc } }
49 #define NS_JSSHSERVER_CONTRACTID
"@mozilla.org/jssh-server;1"
52 [scriptable
, uuid(f8b2b6bc
-4f1d
-42e2
-af46
-9a2d6ca627bf
)]
53 interface nsIJSShServer
: nsISupports
55 /* start listening for jssh connections on the given port.
56 'startupURI' specifies an optional script that will be executed for
58 If 'loopbackOnly' is true, the server socket will only listen for connections on the
59 local loopback interface (localhost, 127.0.0.1). */
60 void startServerSocket
(in unsigned long port
, in AUTF8String startupURI
,
61 in boolean loopbackOnly
);
63 /* stop listening for connections */
64 void stopServerSocket
();
66 /* true if the server is currently active */
67 readonly attribute
boolean serverListening
;
69 /* Port that the server is currently listening on. Zero if the
70 * server is not active. */
71 readonly attribute
unsigned long serverPort
;
73 /* startupURI of the currently active server. Empty string if the
74 * server is not active. */
75 readonly attribute AUTF8String serverStartupURI
;
77 /* 'loopbackOnly' flag of the currently active server. false if the
78 * server is not active */
79 readonly attribute
boolean serverLoopbackOnly
;
81 /* run a jssh session with the given input and output streams.
82 * 'startupURI' specifies an optional script that will be executed
85 * if 'input' is null, this will be a non-interactive session, with
86 * no input being collected from the input stream . The idea is that
87 * the session input is taken from startupURI. Even for
88 * non-interactive sessions, output (via 'print') can still be
89 * collected with the output stream object.
91 * if 'blocking' is 'true', then the shell will block the main ui
92 * thread. Otherwise this will be an asynchronous shell (but
93 * execution of commands will still be proxied onto the main ui
96 void runShell
(in nsIInputStream input
, in nsIOutputStream output
,
97 in string startupURI
, in boolean blocking
);