Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "nsISupports.idl"
8 interface nsIFile;
9 interface nsISocketTransport;
10 interface nsIProxyInfo;
11 interface nsIRunnable;
13 %{C++
14 class nsASocketHandler;
15 struct PRFileDesc;
16 %}
18 [ptr] native PRFileDescPtr(PRFileDesc);
19 [ptr] native nsASocketHandlerPtr(nsASocketHandler);
21 [scriptable, uuid(ad56b25f-e6bb-4db3-9f7b-5b7db33fd2b1)]
22 interface nsISocketTransportService : nsISupports
23 {
24 /**
25 * Creates a transport for a specified host and port.
26 *
27 * @param aSocketTypes
28 * array of socket type strings. null if using default socket type.
29 * @param aTypeCount
30 * specifies length of aSocketTypes.
31 * @param aHost
32 * specifies the target hostname or IP address literal of the peer
33 * for this socket.
34 * @param aPort
35 * specifies the target port of the peer for this socket.
36 * @param aProxyInfo
37 * specifies the transport-layer proxy type to use. null if no
38 * proxy. used for communicating information about proxies like
39 * SOCKS (which are transparent to upper protocols).
40 *
41 * @see nsIProxiedProtocolHandler
42 * @see nsIProtocolProxyService::GetProxyInfo
43 *
44 * NOTE: this function can be called from any thread
45 */
46 nsISocketTransport createTransport([array, size_is(aTypeCount)]
47 in string aSocketTypes,
48 in unsigned long aTypeCount,
49 in AUTF8String aHost,
50 in long aPort,
51 in nsIProxyInfo aProxyInfo);
53 /**
54 * Create a transport built on a Unix domain socket, connecting to the
55 * given filename.
56 *
57 * Since Unix domain sockets are always local to the machine, they are
58 * not affected by the nsIIOService's 'offline' flag.
59 *
60 * On systems that don't support Unix domain sockets at all, this
61 * returns NS_ERROR_SOCKET_ADDRESS_NOT_SUPPORTED.
62 *
63 * The system-level socket API may impose restrictions on the length of
64 * the filename that are stricter than those of the underlying
65 * filesystem. If the file name is too long, this returns
66 * NS_ERROR_FILE_NAME_TOO_LONG.
67 *
68 * The |aPath| parameter must specify an existing directory entry.
69 * Otherwise, this returns NS_ERROR_FILE_NOT_FOUND.
70 *
71 * The program must have search permission on all components of the
72 * path prefix of |aPath|, and read and write permission on |aPath|
73 * itself. Without such permission, this returns
74 * NS_ERROR_CONNECTION_REFUSED.
75 *
76 * The |aPath| parameter must refer to a unix-domain socket. Otherwise,
77 * this returns NS_ERROR_CONNECTION_REFUSED. (POSIX specifies
78 * ECONNREFUSED when "the target address was not listening for
79 * connections", and this is what Linux returns.)
80 *
81 * @param aPath
82 * The file name of the Unix domain socket to which we should
83 * connect.
84 */
85 nsISocketTransport createUnixDomainTransport(in nsIFile aPath);
87 /**
88 * Adds a new socket to the list of controlled sockets.
89 *
90 * This will fail with the error code NS_ERROR_NOT_AVAILABLE if the maximum
91 * number of sockets is already reached.
92 * In this case, the notifyWhenCanAttachSocket method should be used.
93 *
94 * @param aFd
95 * Open file descriptor of the socket to control.
96 * @param aHandler
97 * Socket handler that will receive notifications when the socket is
98 * ready or detached.
99 *
100 * NOTE: this function may only be called from an event dispatch on the
101 * socket thread.
102 */
103 [noscript] void attachSocket(in PRFileDescPtr aFd,
104 in nsASocketHandlerPtr aHandler);
106 /**
107 * if the number of sockets reaches the limit, then consumers can be
108 * notified when the number of sockets becomes less than the limit. the
109 * notification is asynchronous, delivered via the given nsIRunnable
110 * instance on the socket transport thread.
111 *
112 * @param aEvent
113 * Event that will receive the notification when a new socket can
114 * be attached
115 *
116 * NOTE: this function may only be called from an event dispatch on the
117 * socket thread.
118 */
119 [noscript] void notifyWhenCanAttachSocket(in nsIRunnable aEvent);
120 };