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