2
* The contents of this file are subject to the Mozilla Public
3
* License Version 1.1 (the "MPL"); you may not use this file
4
* except in compliance with the MPL. You may obtain a copy of
5
* the MPL at http://www.mozilla.org/MPL/
7
* Software distributed under the MPL is distributed on an "AS
8
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9
* implied. See the MPL for the specific language governing
10
* rights and limitations under the MPL.
12
* The Original Code is protoZilla.
14
* The Initial Developer of the Original Code is Ramalingam Saravanan.
15
* Portions created by Ramalingam Saravanan <svn@xmlterm.org> are
16
* Copyright (C) 2000 Ramalingam Saravanan. All Rights Reserved.
19
* Patrick Brunschwig <patrick@mozilla-enigmail.org>
21
* Alternatively, the contents of this file may be used under the
22
* terms of the GNU General Public License (the "GPL"), in which case
23
* the provisions of the GPL are applicable instead of
24
* those above. If you wish to allow use of your version of this
25
* file only under the terms of the GPL and not to allow
26
* others to use your version of this file under the MPL, indicate
27
* your decision by deleting the provisions above and replace them
28
* with the notice and other provisions required by the GPL.
29
* If you do not delete the provisions above, a recipient
30
* may use your version of this file under either the MPL or the
34
#include "nsIPipeTransport.idl"
35
#include "nsIPipeConsole.idl"
36
#include "nsIFile.idl"
40
interface nsIRequestObserver;
41
interface nsIIPCRequest;
44
#define NS_IPCSERVICE_CLASSNAME "IPCService"
45
#define NS_IPCSERVICE_CONTRACTID "@mozilla.org/process/ipc-service;1"
47
#define NS_IPCSERVICE_CID \
48
{ /* 8431e161-7ab1-11d4-8f02-006008948af5 */ \
49
0x8431e161, 0x7ab1, 0x11d4, \
50
{0x8f, 0x02, 0x00, 0x60, 0x08, 0x94, 0x8a, 0xf5} }
55
* The nsIIPCService interface provides helper services for pipe-based
58
[scriptable, uuid(8431e160-7ab1-11d4-8f02-006008948af5)]
59
interface nsIIPCService : nsISupports
62
/* NOTE: In output string values, the NUL character is escaped as follows:
65
* This allows raw binary data to be returned as NUL-delimited strings.
69
* Returns version of IPC Module
71
readonly attribute string version;
74
* Runs executable with parameters (args[]) and returns the standard output
75
* emitted by the executable as a string. No shell expansion is carried out.
76
* Unquoting (stripping quotes/backaslashes) is not done.
77
* This method blocks for the completion of the executable.
79
string run(in nsIFile executable,
80
[array, size_is(argCount)] in string args,
81
in unsigned long argCount);
84
* Runs executable with parameters (args[]) and optional data for standard input,
85
* and returns the exit code from the process. The standard output
86
* and standard error strings are returned as "out" arguments.
87
* (If outputError is null, use default console to capture error output.)
88
* PreInput may be used for passphrases etc.
89
* Unquoting the command (stripping quotes/backaslashes) is not done.
90
* This method blocks for the completion of the command.
92
long runPipe (in nsIFile executable,
93
[array, size_is(argCount)] in string args,
94
in unsigned long argCount,
97
in unsigned long inputLength,
98
[array, size_is(envCount)] in string env,
99
in unsigned long envCount,
100
[size_is(outputCount)] out string outputData,
101
out unsigned long outputCount,
102
[size_is(errorCount)] out string outputError,
103
out unsigned long errorCount);
106
* Runs executable, with parameters (args[]) and optional data for standard input,
107
* and asynchronously captures the standard output (and standard error
108
* output) in supplied console(s). This method does not block for
109
* command completion, unlike the other exec methods. The nsIIPCRequest
110
* object associated with the command execution is returned, and may
111
* be used to determine request status or cancel it.
112
* If an nsIRequestObserver object is suppled, then it is used to
113
* "observe" the standard output console, and the nsIIPCRequest object
114
* is automatically supplied as the context argument to the observer.
116
* PreInput may be used for passphrases etc.
117
* Unquoting the command (stripping quotes/backslashes) is not done.
119
nsIIPCRequest runAsync(in nsIFile executable,
120
[array, size_is(argCount)] in string args,
121
in unsigned long argCount,
124
in unsigned long inputLength,
125
[array, size_is(envCount)] in string env,
126
in unsigned long envCount,
127
in nsIPipeListener outConsole,
128
in nsIPipeListener errConsole,
129
in nsIRequestObserver requestObserver);
132
* Returns console object used to capture STDERR by default
134
readonly attribute nsIPipeConsole console;
137
* Returns secret random cookie used for security
139
readonly attribute string cookie;
142
* Creates scriptable string channel from input string data.
144
nsIChannel newStringChannel(in nsIURI uri, in AUTF8String contentType,
145
in AUTF8String contentCharset,
146
in string channelData);
149
[scriptable, uuid(8431e1A0-7ab1-11d4-8f02-006008948af5)]
150
interface nsIIPCRequest : nsISupports
152
void init(in string executable, in nsIPipeTransport pipeTransport,
153
in nsIPipeListener stdoutConsole, in nsIPipeListener stderrConsole);
156
* Returns true if the request is still pending
161
* Terminates the pipeTransport associated with the request.
162
* If CloseConsoles is true, the stdout/stderr consoles are also closed.
164
void close(in boolean closeConsoles);
166
readonly attribute string executable;
168
readonly attribute nsIPipeTransport pipeTransport;
170
readonly attribute nsIPipeListener stdoutConsole;
171
readonly attribute nsIPipeListener stderrConsole;
174
///////////////////////////////////////////////////////////////////////////////