michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsIProxyInfo; michael@0: [ptr] native PRFileDescStar(struct PRFileDesc); michael@0: michael@0: /** michael@0: * nsISocketProvider michael@0: */ michael@0: [scriptable, uuid(508d5469-9e1e-4a08-b5b0-7cfebba1e51a)] michael@0: interface nsISocketProvider : nsISupports michael@0: { michael@0: /** michael@0: * newSocket michael@0: * michael@0: * @param aFamily michael@0: * The address family for this socket (PR_AF_INET or PR_AF_INET6). michael@0: * @param aHost michael@0: * The hostname for this connection. michael@0: * @param aPort michael@0: * The port for this connection. michael@0: * @param aProxyHost michael@0: * If non-null, the proxy hostname for this connection. michael@0: * @param aProxyPort michael@0: * The proxy port for this connection. michael@0: * @param aFlags michael@0: * Control flags that govern this connection (see below.) michael@0: * @param aFileDesc michael@0: * The resulting PRFileDesc. michael@0: * @param aSecurityInfo michael@0: * Any security info that should be associated with aFileDesc. This michael@0: * object typically implements nsITransportSecurityInfo. michael@0: */ michael@0: [noscript] michael@0: void newSocket(in long aFamily, michael@0: in string aHost, michael@0: in long aPort, michael@0: in nsIProxyInfo aProxy, michael@0: in unsigned long aFlags, michael@0: out PRFileDescStar aFileDesc, michael@0: out nsISupports aSecurityInfo); michael@0: michael@0: /** michael@0: * addToSocket michael@0: * michael@0: * This function is called to allow the socket provider to layer a michael@0: * PRFileDesc on top of another PRFileDesc. For example, SSL via a SOCKS michael@0: * proxy. michael@0: * michael@0: * Parameters are the same as newSocket with the exception of aFileDesc, michael@0: * which is an in-param instead. michael@0: */ michael@0: [noscript] michael@0: void addToSocket(in long aFamily, michael@0: in string aHost, michael@0: in long aPort, michael@0: in nsIProxyInfo aProxy, michael@0: in unsigned long aFlags, michael@0: in PRFileDescStar aFileDesc, michael@0: out nsISupports aSecurityInfo); michael@0: michael@0: /** michael@0: * PROXY_RESOLVES_HOST michael@0: * michael@0: * This flag is set if the proxy is to perform hostname resolution instead michael@0: * of the client. When set, the hostname parameter passed when in this michael@0: * interface will be used instead of the address structure passed for a michael@0: * later connect et al. request. michael@0: */ michael@0: const long PROXY_RESOLVES_HOST = 1 << 0; michael@0: michael@0: /** michael@0: * When setting this flag, the socket will not apply any michael@0: * credentials when establishing a connection. For example, michael@0: * an SSL connection would not send any client-certificates michael@0: * if this flag is set. michael@0: */ michael@0: const long ANONYMOUS_CONNECT = 1 << 1; michael@0: michael@0: /** michael@0: * If set, indicates that the connection was initiated from a source michael@0: * defined as being private in the sense of Private Browsing. Generally, michael@0: * there should be no state shared between connections that are private michael@0: * and those that are not; it is OK for multiple private connections michael@0: * to share state with each other, and it is OK for multiple non-private michael@0: * connections to share state with each other. michael@0: */ michael@0: const unsigned long NO_PERMANENT_STORAGE = 1 << 2; michael@0: }; michael@0: michael@0: %{C++ michael@0: /** michael@0: * nsISocketProvider implementations should be registered with XPCOM under a michael@0: * contract ID of the form: "@mozilla.org/network/socket;2?type=foo" michael@0: */ michael@0: #define NS_NETWORK_SOCKET_CONTRACTID_PREFIX \ michael@0: "@mozilla.org/network/socket;2?type=" michael@0: %}