|
1 /* -*- Mode: C++; tab-width: 4; 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/. */ |
|
5 |
|
6 #include "nsISupports.idl" |
|
7 |
|
8 interface nsIProxyInfo; |
|
9 [ptr] native PRFileDescStar(struct PRFileDesc); |
|
10 |
|
11 /** |
|
12 * nsISocketProvider |
|
13 */ |
|
14 [scriptable, uuid(508d5469-9e1e-4a08-b5b0-7cfebba1e51a)] |
|
15 interface nsISocketProvider : nsISupports |
|
16 { |
|
17 /** |
|
18 * newSocket |
|
19 * |
|
20 * @param aFamily |
|
21 * The address family for this socket (PR_AF_INET or PR_AF_INET6). |
|
22 * @param aHost |
|
23 * The hostname for this connection. |
|
24 * @param aPort |
|
25 * The port for this connection. |
|
26 * @param aProxyHost |
|
27 * If non-null, the proxy hostname for this connection. |
|
28 * @param aProxyPort |
|
29 * The proxy port for this connection. |
|
30 * @param aFlags |
|
31 * Control flags that govern this connection (see below.) |
|
32 * @param aFileDesc |
|
33 * The resulting PRFileDesc. |
|
34 * @param aSecurityInfo |
|
35 * Any security info that should be associated with aFileDesc. This |
|
36 * object typically implements nsITransportSecurityInfo. |
|
37 */ |
|
38 [noscript] |
|
39 void newSocket(in long aFamily, |
|
40 in string aHost, |
|
41 in long aPort, |
|
42 in nsIProxyInfo aProxy, |
|
43 in unsigned long aFlags, |
|
44 out PRFileDescStar aFileDesc, |
|
45 out nsISupports aSecurityInfo); |
|
46 |
|
47 /** |
|
48 * addToSocket |
|
49 * |
|
50 * This function is called to allow the socket provider to layer a |
|
51 * PRFileDesc on top of another PRFileDesc. For example, SSL via a SOCKS |
|
52 * proxy. |
|
53 * |
|
54 * Parameters are the same as newSocket with the exception of aFileDesc, |
|
55 * which is an in-param instead. |
|
56 */ |
|
57 [noscript] |
|
58 void addToSocket(in long aFamily, |
|
59 in string aHost, |
|
60 in long aPort, |
|
61 in nsIProxyInfo aProxy, |
|
62 in unsigned long aFlags, |
|
63 in PRFileDescStar aFileDesc, |
|
64 out nsISupports aSecurityInfo); |
|
65 |
|
66 /** |
|
67 * PROXY_RESOLVES_HOST |
|
68 * |
|
69 * This flag is set if the proxy is to perform hostname resolution instead |
|
70 * of the client. When set, the hostname parameter passed when in this |
|
71 * interface will be used instead of the address structure passed for a |
|
72 * later connect et al. request. |
|
73 */ |
|
74 const long PROXY_RESOLVES_HOST = 1 << 0; |
|
75 |
|
76 /** |
|
77 * When setting this flag, the socket will not apply any |
|
78 * credentials when establishing a connection. For example, |
|
79 * an SSL connection would not send any client-certificates |
|
80 * if this flag is set. |
|
81 */ |
|
82 const long ANONYMOUS_CONNECT = 1 << 1; |
|
83 |
|
84 /** |
|
85 * If set, indicates that the connection was initiated from a source |
|
86 * defined as being private in the sense of Private Browsing. Generally, |
|
87 * there should be no state shared between connections that are private |
|
88 * and those that are not; it is OK for multiple private connections |
|
89 * to share state with each other, and it is OK for multiple non-private |
|
90 * connections to share state with each other. |
|
91 */ |
|
92 const unsigned long NO_PERMANENT_STORAGE = 1 << 2; |
|
93 }; |
|
94 |
|
95 %{C++ |
|
96 /** |
|
97 * nsISocketProvider implementations should be registered with XPCOM under a |
|
98 * contract ID of the form: "@mozilla.org/network/socket;2?type=foo" |
|
99 */ |
|
100 #define NS_NETWORK_SOCKET_CONTRACTID_PREFIX \ |
|
101 "@mozilla.org/network/socket;2?type=" |
|
102 %} |