1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 #include
"nsITransport.idl"
40 interface nsIInterfaceRequestor
;
42 native PRNetAddr
(union PRNetAddr
);
47 * NOTE: Connection setup is triggered by opening an input or output stream,
48 * it does not start on its own. Completion of the connection setup is
49 * indicated by a STATUS_CONNECTED_TO notification to the event sink (if set).
51 * NOTE: This is a free-threaded interface, meaning that the methods on
52 * this interface may be called from any thread.
54 [scriptable
, uuid(ef3f4993
-cfbc
-4e5a
-9509-16deafe16549
)]
55 interface nsISocketTransport
: nsITransport
58 * Get the host for the underlying socket connection.
60 readonly attribute AUTF8String host
;
63 * Get the port for the underlying socket connection.
65 readonly attribute
long port
;
68 * Returns the IP address of the socket connection peer. This
69 * attribute is defined only once a connection has been established.
71 [noscript
] PRNetAddr getPeerAddr
();
74 * Returns the IP address of the initiating end. This attribute
75 * is defined only once a connection has been established.
77 [noscript
] PRNetAddr getSelfAddr
();
80 * Security info object returned from the secure socket provider. This
81 * object supports nsISSLSocketControl, nsITransportSecurityInfo, and
82 * possibly other interfaces.
84 * This attribute is only available once the socket is connected.
86 readonly attribute nsISupports securityInfo
;
89 * Security notification callbacks passed to the secure socket provider
90 * via nsISSLSocketControl at socket creation time.
92 * NOTE: this attribute cannot be changed once a stream has been opened.
94 attribute nsIInterfaceRequestor securityCallbacks
;
97 * Test if this socket transport is (still) connected.
102 * Socket timeouts in seconds. To specify no timeout, pass PR_UINT32_MAX
103 * as aValue to setTimeout. The implementation may truncate timeout values
104 * to a smaller range of values (e.g., 0 to 0xFFFF).
106 unsigned long getTimeout
(in unsigned long aType
);
107 void setTimeout
(in unsigned long aType
, in unsigned long aValue
);
110 * Values for the aType parameter passed to get/setTimeout.
112 const unsigned long TIMEOUT_CONNECT
= 0;
113 const unsigned long TIMEOUT_READ_WRITE
= 1;
116 * nsITransportEventSink status codes.
118 * Although these look like XPCOM error codes and are passed in an nsresult
119 * variable, they are *not* error codes. Note that while they *do* overlap
120 * with existing error codes in Necko, these status codes are confined
121 * within a very limited context where no error codes may appear, so there
124 * The values of these status codes must never change.
126 * The status codes appear in near-chronological order (not in numeric
127 * order). STATUS_RESOLVING may be skipped if the host does not need to be
128 * resolved. STATUS_WAITING_FOR is an optional status code, which the impl
129 * of this interface may choose not to generate.
131 const unsigned long STATUS_RESOLVING
= 0x804b0003;
132 const unsigned long STATUS_CONNECTING_TO
= 0x804b0007;
133 const unsigned long STATUS_CONNECTED_TO
= 0x804b0004;
134 const unsigned long STATUS_SENDING_TO
= 0x804b0005;
135 const unsigned long STATUS_WAITING_FOR
= 0x804b000a;
136 const unsigned long STATUS_RECEIVING_FROM
= 0x804b0006;
139 * connectionFlags is a bitmask that can be used to modify underlying
140 * behavior of the socket connection.
142 attribute
unsigned long connectionFlags
;
145 * Values for the connectionFlags
147 * When making a new connection BYPASS_CACHE will force the Necko DNS
148 * cache entry to be refreshed with a new call to NSPR if it is set before
149 * opening the new stream.
151 const unsigned long BYPASS_CACHE
= (1 << 0);
157 * #define's for compatibility
159 #define NS_NET_STATUS_RESOLVING_HOST nsISocketTransport
::STATUS_RESOLVING
160 #define NS_NET_STATUS_CONNECTED_TO nsISocketTransport
::STATUS_CONNECTED_TO
161 #define NS_NET_STATUS_SENDING_TO nsISocketTransport
::STATUS_SENDING_TO
162 #define NS_NET_STATUS_RECEIVING_FROM nsISocketTransport
::STATUS_RECEIVING_FROM
163 #define NS_NET_STATUS_CONNECTING_TO nsISocketTransport
::STATUS_CONNECTING_TO
164 #define NS_NET_STATUS_WAITING_FOR nsISocketTransport
::STATUS_WAITING_FOR