OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * DO NOT EDIT. THIS FILE IS GENERATED FROM c:/builds/tinderbox/XR-Mozilla1.8.0
-Release/WINNT_5.2_Depend/mozilla/netwerk/base/public/nsIProtocolHandler.idl |
| 3 */ |
| 4 |
| 5 #ifndef __gen_nsIProtocolHandler_h__ |
| 6 #define __gen_nsIProtocolHandler_h__ |
| 7 |
| 8 |
| 9 #ifndef __gen_nsISupports_h__ |
| 10 #include "nsISupports.h" |
| 11 #endif |
| 12 |
| 13 /* For IDL files that don't want to include root IDL files. */ |
| 14 #ifndef NS_NO_VTABLE |
| 15 #define NS_NO_VTABLE |
| 16 #endif |
| 17 class nsIURI; /* forward declaration */ |
| 18 |
| 19 class nsIChannel; /* forward declaration */ |
| 20 |
| 21 |
| 22 /* starting interface: nsIProtocolHandler */ |
| 23 #define NS_IPROTOCOLHANDLER_IID_STR "15fd6940-8ea7-11d3-93ad-00104ba0fd40" |
| 24 |
| 25 #define NS_IPROTOCOLHANDLER_IID \ |
| 26 {0x15fd6940, 0x8ea7, 0x11d3, \ |
| 27 { 0x93, 0xad, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40 }} |
| 28 |
| 29 /** |
| 30 * nsIProtocolHandler |
| 31 * |
| 32 * @status FROZEN |
| 33 */ |
| 34 class NS_NO_VTABLE nsIProtocolHandler : public nsISupports { |
| 35 public: |
| 36 |
| 37 NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPROTOCOLHANDLER_IID) |
| 38 |
| 39 /** |
| 40 * The scheme of this protocol (e.g., "file"). |
| 41 */ |
| 42 /* readonly attribute ACString scheme; */ |
| 43 NS_IMETHOD GetScheme(nsACString & aScheme) = 0; |
| 44 |
| 45 /** |
| 46 * The default port is the port that this protocol normally uses. |
| 47 * If a port does not make sense for the protocol (e.g., "about:") |
| 48 * then -1 will be returned. |
| 49 */ |
| 50 /* readonly attribute long defaultPort; */ |
| 51 NS_IMETHOD GetDefaultPort(PRInt32 *aDefaultPort) = 0; |
| 52 |
| 53 /** |
| 54 * Returns the protocol specific flags (see flag definitions below). |
| 55 */ |
| 56 /* readonly attribute unsigned long protocolFlags; */ |
| 57 NS_IMETHOD GetProtocolFlags(PRUint32 *aProtocolFlags) = 0; |
| 58 |
| 59 /** |
| 60 * Makes a URI object that is suitable for loading by this protocol, |
| 61 * where the URI string is given as an UTF-8 string. The caller may |
| 62 * provide the charset from which the URI string originated, so that |
| 63 * the URI string can be translated back to that charset (if necessary) |
| 64 * before communicating with, for example, the origin server of the URI |
| 65 * string. (Many servers do not support UTF-8 IRIs at the present time, |
| 66 * so we must be careful about tracking the native charset of the origin |
| 67 * server.) |
| 68 * |
| 69 * @param aSpec - the URI string in UTF-8 encoding. depending |
| 70 * on the protocol implementation, unicode character |
| 71 * sequences may or may not be %xx escaped. |
| 72 * @param aOriginCharset - the charset of the document from which this URI |
| 73 * string originated. this corresponds to the |
| 74 * charset that should be used when communicating |
| 75 * this URI to an origin server, for example. if |
| 76 * null, then UTF-8 encoding is assumed (i.e., |
| 77 * no charset transformation from aSpec). |
| 78 * @param aBaseURI - if null, aSpec must specify an absolute URI. |
| 79 * otherwise, aSpec may be resolved relative |
| 80 * to aBaseURI, depending on the protocol. |
| 81 * If the protocol has no concept of relative |
| 82 * URI aBaseURI will simply be ignored. |
| 83 */ |
| 84 /* nsIURI newURI (in AUTF8String aSpec, in string aOriginCharset, in nsIURI aB
aseURI); */ |
| 85 NS_IMETHOD NewURI(const nsACString & aSpec, const char *aOriginCharset, nsIURI
*aBaseURI, nsIURI **_retval) = 0; |
| 86 |
| 87 /** |
| 88 * Constructs a new channel from the given URI for this protocol handler. |
| 89 */ |
| 90 /* nsIChannel newChannel (in nsIURI aURI); */ |
| 91 NS_IMETHOD NewChannel(nsIURI *aURI, nsIChannel **_retval) = 0; |
| 92 |
| 93 /** |
| 94 * Allows a protocol to override blacklisted ports. |
| 95 * |
| 96 * This method will be called when there is an attempt to connect to a port |
| 97 * that is blacklisted. For example, for most protocols, port 25 (Simple Ma
il |
| 98 * Transfer) is banned. When a URI containing this "known-to-do-bad-things"
|
| 99 * port number is encountered, this function will be called to ask if the |
| 100 * protocol handler wants to override the ban. |
| 101 */ |
| 102 /* boolean allowPort (in long port, in string scheme); */ |
| 103 NS_IMETHOD AllowPort(PRInt32 port, const char *scheme, PRBool *_retval) = 0; |
| 104 |
| 105 /************************************************************************** |
| 106 * Constants for the protocol flags (the first is the default mask, the |
| 107 * others are deviations): |
| 108 * |
| 109 * NOTE: Implementation must ignore any flags they do not understand. |
| 110 */ |
| 111 /** |
| 112 * standard full URI with authority component and concept of relative |
| 113 * URIs (http, ftp, ...) |
| 114 */ |
| 115 enum { URI_STD = 0U }; |
| 116 |
| 117 /** |
| 118 * no concept of relative URIs (about, javascript, finger, ...) |
| 119 */ |
| 120 enum { URI_NORELATIVE = 1U }; |
| 121 |
| 122 /** |
| 123 * no authority component (file, ...) |
| 124 */ |
| 125 enum { URI_NOAUTH = 2U }; |
| 126 |
| 127 /** |
| 128 * This protocol handler can be proxied via a proxy (socks or http) |
| 129 * (e.g., irc, smtp, http, etc.). If the protocol supports transparent |
| 130 * proxying, the handler should implement nsIProxiedProtocolHandler. |
| 131 * |
| 132 * If it supports only HTTP proxying, then it need not support |
| 133 * nsIProxiedProtocolHandler, but should instead set the ALLOWS_PROXY_HTTP |
| 134 * flag (see below). |
| 135 * |
| 136 * @see nsIProxiedProtocolHandler |
| 137 */ |
| 138 enum { ALLOWS_PROXY = 4U }; |
| 139 |
| 140 /** |
| 141 * This protocol handler can be proxied using a http proxy (e.g., http, |
| 142 * ftp, etc.). nsIIOService::newChannelFromURI will feed URIs from this |
| 143 * protocol handler to the HTTP protocol handler instead. This flag is |
| 144 * ignored if ALLOWS_PROXY is not set. |
| 145 */ |
| 146 enum { ALLOWS_PROXY_HTTP = 8U }; |
| 147 |
| 148 }; |
| 149 |
| 150 /* Use this macro when declaring classes that implement this interface. */ |
| 151 #define NS_DECL_NSIPROTOCOLHANDLER \ |
| 152 NS_IMETHOD GetScheme(nsACString & aScheme); \ |
| 153 NS_IMETHOD GetDefaultPort(PRInt32 *aDefaultPort); \ |
| 154 NS_IMETHOD GetProtocolFlags(PRUint32 *aProtocolFlags); \ |
| 155 NS_IMETHOD NewURI(const nsACString & aSpec, const char *aOriginCharset, nsIURI
*aBaseURI, nsIURI **_retval); \ |
| 156 NS_IMETHOD NewChannel(nsIURI *aURI, nsIChannel **_retval); \ |
| 157 NS_IMETHOD AllowPort(PRInt32 port, const char *scheme, PRBool *_retval); \ |
| 158 |
| 159 /* Use this macro to declare functions that forward the behavior of this interfa
ce to another object. */ |
| 160 #define NS_FORWARD_NSIPROTOCOLHANDLER(_to) \ |
| 161 NS_IMETHOD GetScheme(nsACString & aScheme) { return _to GetScheme(aScheme); }
\ |
| 162 NS_IMETHOD GetDefaultPort(PRInt32 *aDefaultPort) { return _to GetDefaultPort(a
DefaultPort); } \ |
| 163 NS_IMETHOD GetProtocolFlags(PRUint32 *aProtocolFlags) { return _to GetProtocol
Flags(aProtocolFlags); } \ |
| 164 NS_IMETHOD NewURI(const nsACString & aSpec, const char *aOriginCharset, nsIURI
*aBaseURI, nsIURI **_retval) { return _to NewURI(aSpec, aOriginCharset, aBaseUR
I, _retval); } \ |
| 165 NS_IMETHOD NewChannel(nsIURI *aURI, nsIChannel **_retval) { return _to NewChan
nel(aURI, _retval); } \ |
| 166 NS_IMETHOD AllowPort(PRInt32 port, const char *scheme, PRBool *_retval) { retu
rn _to AllowPort(port, scheme, _retval); } \ |
| 167 |
| 168 /* Use this macro to declare functions that forward the behavior of this interfa
ce to another object in a safe way. */ |
| 169 #define NS_FORWARD_SAFE_NSIPROTOCOLHANDLER(_to) \ |
| 170 NS_IMETHOD GetScheme(nsACString & aScheme) { return !_to ? NS_ERROR_NULL_POINT
ER : _to->GetScheme(aScheme); } \ |
| 171 NS_IMETHOD GetDefaultPort(PRInt32 *aDefaultPort) { return !_to ? NS_ERROR_NULL
_POINTER : _to->GetDefaultPort(aDefaultPort); } \ |
| 172 NS_IMETHOD GetProtocolFlags(PRUint32 *aProtocolFlags) { return !_to ? NS_ERROR
_NULL_POINTER : _to->GetProtocolFlags(aProtocolFlags); } \ |
| 173 NS_IMETHOD NewURI(const nsACString & aSpec, const char *aOriginCharset, nsIURI
*aBaseURI, nsIURI **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->NewUR
I(aSpec, aOriginCharset, aBaseURI, _retval); } \ |
| 174 NS_IMETHOD NewChannel(nsIURI *aURI, nsIChannel **_retval) { return !_to ? NS_E
RROR_NULL_POINTER : _to->NewChannel(aURI, _retval); } \ |
| 175 NS_IMETHOD AllowPort(PRInt32 port, const char *scheme, PRBool *_retval) { retu
rn !_to ? NS_ERROR_NULL_POINTER : _to->AllowPort(port, scheme, _retval); } \ |
| 176 |
| 177 #if 0 |
| 178 /* Use the code below as a template for the implementation class for this interf
ace. */ |
| 179 |
| 180 /* Header file */ |
| 181 class nsProtocolHandler : public nsIProtocolHandler |
| 182 { |
| 183 public: |
| 184 NS_DECL_ISUPPORTS |
| 185 NS_DECL_NSIPROTOCOLHANDLER |
| 186 |
| 187 nsProtocolHandler(); |
| 188 |
| 189 private: |
| 190 ~nsProtocolHandler(); |
| 191 |
| 192 protected: |
| 193 /* additional members */ |
| 194 }; |
| 195 |
| 196 /* Implementation file */ |
| 197 NS_IMPL_ISUPPORTS1(nsProtocolHandler, nsIProtocolHandler) |
| 198 |
| 199 nsProtocolHandler::nsProtocolHandler() |
| 200 { |
| 201 /* member initializers and constructor code */ |
| 202 } |
| 203 |
| 204 nsProtocolHandler::~nsProtocolHandler() |
| 205 { |
| 206 /* destructor code */ |
| 207 } |
| 208 |
| 209 /* readonly attribute ACString scheme; */ |
| 210 NS_IMETHODIMP nsProtocolHandler::GetScheme(nsACString & aScheme) |
| 211 { |
| 212 return NS_ERROR_NOT_IMPLEMENTED; |
| 213 } |
| 214 |
| 215 /* readonly attribute long defaultPort; */ |
| 216 NS_IMETHODIMP nsProtocolHandler::GetDefaultPort(PRInt32 *aDefaultPort) |
| 217 { |
| 218 return NS_ERROR_NOT_IMPLEMENTED; |
| 219 } |
| 220 |
| 221 /* readonly attribute unsigned long protocolFlags; */ |
| 222 NS_IMETHODIMP nsProtocolHandler::GetProtocolFlags(PRUint32 *aProtocolFlags) |
| 223 { |
| 224 return NS_ERROR_NOT_IMPLEMENTED; |
| 225 } |
| 226 |
| 227 /* nsIURI newURI (in AUTF8String aSpec, in string aOriginCharset, in nsIURI aBas
eURI); */ |
| 228 NS_IMETHODIMP nsProtocolHandler::NewURI(const nsACString & aSpec, const char *aO
riginCharset, nsIURI *aBaseURI, nsIURI **_retval) |
| 229 { |
| 230 return NS_ERROR_NOT_IMPLEMENTED; |
| 231 } |
| 232 |
| 233 /* nsIChannel newChannel (in nsIURI aURI); */ |
| 234 NS_IMETHODIMP nsProtocolHandler::NewChannel(nsIURI *aURI, nsIChannel **_retval) |
| 235 { |
| 236 return NS_ERROR_NOT_IMPLEMENTED; |
| 237 } |
| 238 |
| 239 /* boolean allowPort (in long port, in string scheme); */ |
| 240 NS_IMETHODIMP nsProtocolHandler::AllowPort(PRInt32 port, const char *scheme, PRB
ool *_retval) |
| 241 { |
| 242 return NS_ERROR_NOT_IMPLEMENTED; |
| 243 } |
| 244 |
| 245 /* End of implementation class template. */ |
| 246 #endif |
| 247 |
| 248 /** |
| 249 * Protocol handlers are registered with XPCOM under the following CONTRACTID pr
efix: |
| 250 */ |
| 251 #define NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "@mozilla.org/network/protocol;1?n
ame=" |
| 252 /** |
| 253 * For example, "@mozilla.org/network/protocol;1?name=http" |
| 254 */ |
| 255 |
| 256 #endif /* __gen_nsIProtocolHandler_h__ */ |
OLD | NEW |