Page Menu
Home
GnuPG
Search
Configure Global Search
Log In
Files
F23020670
nsIPipeTransport.idl
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Size
10 KB
Subscribers
None
nsIPipeTransport.idl
View Options
/*
*****
BEGIN
LICENSE BLOCK
*****
*
Version
:
MPL
1.1
/
GPL
2.0
/
LGPL
2.1
*
*
The contents
of
this file are subject to the Mozilla Public
*
License Version
1.1
(the
"MPL"
); you may
not
use this file
*
except in compliance with the MPL. You may obtain a copy
of
*
the MPL at http
://
www.mozilla.org
/
MPL
/
*
*
Software distributed under the MPL is distributed on an
"AS
* IS"
basis, WITHOUT WARRANTY
OF
ANY KIND, either express
or
*
implied. See the MPL
for
the specific language governing
*
rights
and
limitations under the MPL.
*
*
The Original Code is protoZilla.
*
*
The Initial Developer
of
the Original Code is Ramalingam Saravanan.
*
Portions created by Ramalingam Saravanan
<
svn@xmlterm.org
>
are
*
Copyright (C)
2000
Ramalingam Saravanan. All Rights Reserved.
*
*
Contributor(s)
:
*
Patrick Brunschwig
<
patrick@mozilla
-
enigmail.org
>
*
*
Alternatively, the contents
of
this file may be used under the terms
of
*
either the GNU General Public License Version
2
or
later (the
"GPL"
),
or
*
the GNU Lesser General Public License Version
2.1
or
later (the
"LGPL"
),
*
in which
case
the provisions
of
the GPL
or
the LGPL are applicable instead
*
of
those above.
If
you wish to allow use
of
your version
of
this file only
*
under the terms
of
either the GPL
or
the LGPL,
and
not
to allow others to
*
use your version
of
this file under the terms
of
the MPL, indicate your
*
decision by deleting the provisions above
and
replace them with the notice
*
and
other provisions required by the GPL
or
the LGPL.
If
you
do
not
delete
*
the provisions above, a recipient may use your version
of
this file under
*
the terms
of
any one
of
the MPL, the GPL
or
the LGPL.
*
*****
END
LICENSE BLOCK
*****
*/
#
include
"nsIPipeListener.idl"
#
include
"nsIProcess.idl"
interface nsIRequest;
interface nsIFile;
interface nsIInputStream;
interface nsIOutputStream;
interface nsIStreamListener;
interface nsIPipeTransportHeaders;
interface nsIPipeTransportListener;
interface nsIProcess;
%{C
++
#
include
"IPCProcess.h"
#
define NS_PIPETRANSPORT_CLASSNAME
"Pipe Transport"
#
define NS_PIPETRANSPORT_CONTRACTID
"@mozilla.org/ipc/pipe-transport;1"
#
define NS_PIPETRANSPORT_CID \
{
/*
8431e101
-
7ab1
-
11d4
-
8f02
-
a06008948af5
*/
\
0x8431e101, 0x7ab1, 0x11d4, \
{0x8f, 0x02, 0xa0, 0x60, 0x08, 0x94, 0x8a, 0xf5} }
%}
/**
*
The nsIPipeTransport interface executes a file in a new process
and
*
communicates with the process using pipes.
*
*
OWNERSHIP
AND
THREADING MODEL
for
nsPipeTransport
:
*
*
nsPipeTransport can be created in any thread with an event queue.
*
*
nsPipeTransport lives only in the thread that it was created in.
*
*
nsPipeTransport creates a helper thread object, nsStdoutPoller
and
retains
*
an owning reference to it. nsStdoutPoller also holds a strong reference
*
to a proxy interface (nsIPipeTransportListener) implemented by
*
nsPipeTransport, which is released when the polling thread terminates.
*
*
The polling thread terminates when it is
"interrupted"
by nsPipeTransport
or
*
when
EOF
/
error is encountered in reading data from the process STDOUT.
*
*
The
"terminate"
method should
*
always
*
be called to release the process
*
resources when done.
*
*
For
asynchronous reading, when nsStdoutPoller terminates
of
its own accord,
*
any stream listener is informed by invoking OnStopRequest.
*
Usually this listener will be the same as the owner
of
nsPipeTransport.
*
(
If
the owner initiates the request shutdown by first calling
"cancel"
,
*
then
the OnStopRequest method is
*
not
*
invoked, because it is assumed
*
that the listener
/
owner is already aware
of
the shutdown.)
*
*/
[scriptable, uuid(8431e100
-
7ab1
-
11d4
-
8f02
-
a06008948af5)]
interface nsIPipeTransport
:
nsIProcess
{
/**
*
Initializes PipeTransport by executing the specified file using the
*
supplied argument
list
and
environment variables.
*
It is expected that nsIPipeTransport will be embedded in a
*
full
-
featured channel, which will also act as an async stream
*
observer
/
listener
and
forward calls to the actual observer
/
listener.
*
*
@param executable executable file
*
@param cwd working directory
for
the excutable
*
@param startupFlags flags defining how the process should be created
*/
void initWithWorkDir(in nsIFile executable,
in nsIFile cwd,
in unsigned
long
startupFlags);
/**
*
Opens a PipeTransport by executing the specified file using the
*
supplied argument
list
and
environment variables.
*
It is expected that nsIPipeTransport will be embedded in a
*
full
-
featured channel, which will also act as an async stream
*
observer
/
listener
and
forward calls to the actual observer
/
listener.
*
*
@param args arguments
string
array
*
(excluding the executable path itself)
*
@param env environment (variable
=
value)
string
array
*
@param timeoutMS timeout (in milliseconds) after which the process
*
at the other
end
of
the pipe can be assumed to be
*
dead
*
(
if
==
0
, a default value, usually an hour, is used)
*
@param killString
string
to be transmitted to process before it is
*
killed (specify null
string
,
if
none)
*
@param mergeStderr merge STDERR with STDOUT
*
@param stderrConsole nsIPipeListener object to capture STDERR (required
*
if
mergeStderr is false)
*/
void openPipe([array, size_is(argCount)] in wstring args,
in unsigned
long
argCount,
[array, size_is(envCount)] in wstring env,
in unsigned
long
envCount,
in unsigned
long
timeoutMS,
in
string
killString,
in boolean mergeStderr,
in nsIPipeListener stderrConsole);
/**
*
detach process after start
*/
const
long
PROCESS_DETACHED
=
0x01;
const
long
INHERIT_PROC_ATTRIBS
=
0x02;
/**
*
Returns stderrConsole object used to capture STDERR by default
*/
readonly attribute nsIPipeListener stderrConsole;
/**
*
Returns listener object to feed data to STDIN
*
(call to OnStopRequest closes STDIN)
*/
readonly attribute nsIStreamListener listener;
/**
*
Specifies interface to handle MIME headers
read
from STDOUT
*/
attribute nsIPipeTransportHeaders headerProcessor;
/**
*
Controls console logging
of
STDOUT from process
*/
attribute boolean loggingEnabled;
/**
*
Open
an input stream on this transport.
*
*
@param offset
-
read
starting at this offset
*
@param count
-
read
this many bytes (pass PRUint32(
-
1
)
if
unlimited)
*
@param flags
-
optional transport specific flags
*/
nsIInputStream openInputStream(in unsigned
long
offset,
in unsigned
long
count,
in unsigned
long
flags);
/**
*
Open
an output stream on this transport.
*
*
@param offset
-
write starting at this offset
*
@param count
-
write no more than this many bytes (pass PRUint32(
-
1
)
if
*
unlimited)
*
@param flags
-
optional transport specific flags
*/
nsIOutputStream openOutputStream(in unsigned
long
offset,
in unsigned
long
count,
in unsigned
long
flags);
/**
*
Asynchronously
read
data from the transport.
*
*
@param listener
-
notify this listener when data is available
*
@param ctxt
-
opaque parameter passed to listener methods
*
@param offset
-
read
starting at this offset
*
@param count
-
read
this many bytes (pass PRUint32(
-
1
)
if
unlimited)
*
@param flags
-
optional transport specific flags
*/
nsIRequest asyncRead(in nsIStreamListener listener,
in nsISupports ctxt,
in unsigned
long
offset,
in unsigned
long
count,
in unsigned
long
flags);
/**
*
Joins STDOUT handling thread (blocking
until
STDOUT is closed),
*
the process still needs to be terminated to free resources.
*/
void join();
/**
*
Terminates process,
if
active, by closing stdin
/
stdout
/
stderr.
*/
void terminate();
/**
*
Writes
string
to process STDIN (synchronously)
*
(Note
:
child process may
exit
for
valid reasons even before
*
the first call to writeSync, causing an an exception to be
*
thrown because STDIN has been closed by the child.)
*/
void writeSync(in
string
inputData, in unsigned
long
inputLength);
/**
*
closes process STDIN (required even
if
no data is being transmitted)
*/
void closeStdin();
/**
*
Writes stream data to process STDIN (asynchronously),
*
and
close
inputStream
and
STDIN after writing,
if
requested
*/
void writeAsync(in nsIInputStream aFromStream,
in unsigned
long
aCount,
in boolean closeAfterWrite);
/**
*
Blocks
for
output
and
returns the first line from STDOUT
*
as a
string
, up to maxChars (
=-
1
for
unlimited)
long
.
*
NOTE
:
This method is intended
for
short output;
for
longer
*
output, reading using a stream is the better method.
*/
string
readLine(in
long
maxOutputLen);
attribute unsigned
long
bufferSegmentSize;
attribute unsigned
long
bufferMaxSize;
attribute unsigned
long
headersMaxSize;
};
/**
*
nsIPipeTransportHeaders is a helper interface to parse MIME headers as
*
specified by RFC
822
.
*/
[scriptable, uuid(8431e110
-
7ab1
-
11d4
-
8f02
-
006008948af5)]
interface nsIPipeTransportHeaders
:
nsISupports
{
/**
*
Calls channel to parse MIME headers, returning content length
*
or
-
1
for
unknown content length.
*
If
invalid MIME headers
or
no channel set, returns error.
*/
long
parseMimeHeaders(in
string
mimeHeaders, in unsigned
long
count);
};
/**
*
nsIPipeTransportListener is a helper interface
for
nsIPipeTransport.
*
It is used to start
and
stop
the listener stream
of
nsIPipeTransport.
*/
[scriptable, uuid(8431e120
-
7ab1
-
11d4
-
8f02
-
006008948af5)]
interface nsIPipeTransportListener
:
nsIPipeTransportHeaders
{
/**
*
Starts listener,
and
invokes OnStartRequest on listener,
if
any.
*
NOTE
:
Should
not
be called
if
blocked
for
synchronous
read
.
*/
void startRequest();
/**
*
Stops listener
*/
void stopRequest(in nsresult status);
};
///////////////////////////////////////////////////////////////////////////////
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Mon, May 12, 6:32 PM (1 d, 16 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
89/ac/96bbdbc2f8424c2128f599a159be
Attached To
rENIG Enigmail
Event Timeline
Log In to Comment