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/nsIIOService.idl |
| 3 */ |
| 4 |
| 5 #ifndef __gen_nsIIOService_h__ |
| 6 #define __gen_nsIIOService_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 nsIProtocolHandler; /* forward declaration */ |
| 18 |
| 19 class nsIChannel; /* forward declaration */ |
| 20 |
| 21 class nsIURI; /* forward declaration */ |
| 22 |
| 23 class nsIFile; /* forward declaration */ |
| 24 |
| 25 |
| 26 /* starting interface: nsIIOService */ |
| 27 #define NS_IIOSERVICE_IID_STR "bddeda3f-9020-4d12-8c70-984ee9f7935e" |
| 28 |
| 29 #define NS_IIOSERVICE_IID \ |
| 30 {0xbddeda3f, 0x9020, 0x4d12, \ |
| 31 { 0x8c, 0x70, 0x98, 0x4e, 0xe9, 0xf7, 0x93, 0x5e }} |
| 32 |
| 33 /** |
| 34 * nsIIOService provides a set of network utility functions. This interface |
| 35 * duplicates many of the nsIProtocolHandler methods in a protocol handler |
| 36 * independent way (e.g., NewURI inspects the scheme in order to delegate |
| 37 * creation of the new URI to the appropriate protocol handler). nsIIOService |
| 38 * also provides a set of URL parsing utility functions. These are provided |
| 39 * as a convenience to the programmer and in some cases to improve performance |
| 40 * by eliminating intermediate data structures and interfaces. |
| 41 * |
| 42 * @status FROZEN |
| 43 */ |
| 44 class NS_NO_VTABLE nsIIOService : public nsISupports { |
| 45 public: |
| 46 |
| 47 NS_DEFINE_STATIC_IID_ACCESSOR(NS_IIOSERVICE_IID) |
| 48 |
| 49 /** |
| 50 * Returns a protocol handler for a given URI scheme. |
| 51 * |
| 52 * @param aScheme the URI scheme |
| 53 * @return reference to corresponding nsIProtocolHandler |
| 54 */ |
| 55 /* nsIProtocolHandler getProtocolHandler (in string aScheme); */ |
| 56 NS_IMETHOD GetProtocolHandler(const char *aScheme, nsIProtocolHandler **_retva
l) = 0; |
| 57 |
| 58 /** |
| 59 * Returns the protocol flags for a given scheme. |
| 60 * |
| 61 * @param aScheme the URI scheme |
| 62 * @return value of corresponding nsIProtocolHandler::protocolFlags |
| 63 */ |
| 64 /* unsigned long getProtocolFlags (in string aScheme); */ |
| 65 NS_IMETHOD GetProtocolFlags(const char *aScheme, PRUint32 *_retval) = 0; |
| 66 |
| 67 /** |
| 68 * This method constructs a new URI by determining the scheme of the |
| 69 * URI spec, and then delegating the construction of the URI to the |
| 70 * protocol handler for that scheme. QueryInterface can be used on |
| 71 * the resulting URI object to obtain a more specific type of URI. |
| 72 * |
| 73 * @see nsIProtocolHandler::newURI |
| 74 */ |
| 75 /* nsIURI newURI (in AUTF8String aSpec, in string aOriginCharset, in nsIURI aB
aseURI); */ |
| 76 NS_IMETHOD NewURI(const nsACString & aSpec, const char *aOriginCharset, nsIURI
*aBaseURI, nsIURI **_retval) = 0; |
| 77 |
| 78 /** |
| 79 * This method constructs a new URI from a nsIFile. |
| 80 * |
| 81 * @param aFile specifies the file path |
| 82 * @return reference to a new nsIURI object |
| 83 */ |
| 84 /* nsIURI newFileURI (in nsIFile aFile); */ |
| 85 NS_IMETHOD NewFileURI(nsIFile *aFile, nsIURI **_retval) = 0; |
| 86 |
| 87 /** |
| 88 * Creates a channel for a given URI. |
| 89 * |
| 90 * @param aURI nsIURI from which to make a channel |
| 91 * @return reference to the new nsIChannel object |
| 92 */ |
| 93 /* nsIChannel newChannelFromURI (in nsIURI aURI); */ |
| 94 NS_IMETHOD NewChannelFromURI(nsIURI *aURI, nsIChannel **_retval) = 0; |
| 95 |
| 96 /** |
| 97 * Equivalent to newChannelFromURI(newURI(...)) |
| 98 */ |
| 99 /* nsIChannel newChannel (in AUTF8String aSpec, in string aOriginCharset, in n
sIURI aBaseURI); */ |
| 100 NS_IMETHOD NewChannel(const nsACString & aSpec, const char *aOriginCharset, ns
IURI *aBaseURI, nsIChannel **_retval) = 0; |
| 101 |
| 102 /** |
| 103 * Returns true if networking is in "offline" mode. When in offline mode, |
| 104 * attempts to access the network will fail (although this is not |
| 105 * necessarily corrolated with whether there is actually a network |
| 106 * available -- that's hard to detect without causing the dialer to |
| 107 * come up). |
| 108 */ |
| 109 /* attribute boolean offline; */ |
| 110 NS_IMETHOD GetOffline(PRBool *aOffline) = 0; |
| 111 NS_IMETHOD SetOffline(PRBool aOffline) = 0; |
| 112 |
| 113 /** |
| 114 * Checks if a port number is banned. This involves consulting a list of |
| 115 * unsafe ports, corresponding to network services that may be easily |
| 116 * exploitable. If the given port is considered unsafe, then the protocol |
| 117 * handler (corresponding to aScheme) will be asked whether it wishes to |
| 118 * override the IO service's decision to block the port. This gives the |
| 119 * protocol handler ultimate control over its own security policy while |
| 120 * ensuring reasonable, default protection. |
| 121 * |
| 122 * @see nsIProtocolHandler::allowPort |
| 123 */ |
| 124 /* boolean allowPort (in long aPort, in string aScheme); */ |
| 125 NS_IMETHOD AllowPort(PRInt32 aPort, const char *aScheme, PRBool *_retval) = 0; |
| 126 |
| 127 /** |
| 128 * Utility to extract the scheme from a URL string, consistently and |
| 129 * according to spec (see RFC 2396). |
| 130 * |
| 131 * NOTE: Most URL parsing is done via nsIURI, and in fact the scheme |
| 132 * can also be extracted from a URL string via nsIURI. This method |
| 133 * is provided purely as an optimization. |
| 134 * |
| 135 * @param aSpec the URL string to parse |
| 136 * @return URL scheme |
| 137 * |
| 138 * @throws NS_ERROR_MALFORMED_URI if URL string is not of the right form. |
| 139 */ |
| 140 /* ACString extractScheme (in AUTF8String urlString); */ |
| 141 NS_IMETHOD ExtractScheme(const nsACString & urlString, nsACString & _retval) =
0; |
| 142 |
| 143 }; |
| 144 |
| 145 /* Use this macro when declaring classes that implement this interface. */ |
| 146 #define NS_DECL_NSIIOSERVICE \ |
| 147 NS_IMETHOD GetProtocolHandler(const char *aScheme, nsIProtocolHandler **_retva
l); \ |
| 148 NS_IMETHOD GetProtocolFlags(const char *aScheme, PRUint32 *_retval); \ |
| 149 NS_IMETHOD NewURI(const nsACString & aSpec, const char *aOriginCharset, nsIURI
*aBaseURI, nsIURI **_retval); \ |
| 150 NS_IMETHOD NewFileURI(nsIFile *aFile, nsIURI **_retval); \ |
| 151 NS_IMETHOD NewChannelFromURI(nsIURI *aURI, nsIChannel **_retval); \ |
| 152 NS_IMETHOD NewChannel(const nsACString & aSpec, const char *aOriginCharset, ns
IURI *aBaseURI, nsIChannel **_retval); \ |
| 153 NS_IMETHOD GetOffline(PRBool *aOffline); \ |
| 154 NS_IMETHOD SetOffline(PRBool aOffline); \ |
| 155 NS_IMETHOD AllowPort(PRInt32 aPort, const char *aScheme, PRBool *_retval); \ |
| 156 NS_IMETHOD ExtractScheme(const nsACString & urlString, nsACString & _retval); |
| 157 |
| 158 /* Use this macro to declare functions that forward the behavior of this interfa
ce to another object. */ |
| 159 #define NS_FORWARD_NSIIOSERVICE(_to) \ |
| 160 NS_IMETHOD GetProtocolHandler(const char *aScheme, nsIProtocolHandler **_retva
l) { return _to GetProtocolHandler(aScheme, _retval); } \ |
| 161 NS_IMETHOD GetProtocolFlags(const char *aScheme, PRUint32 *_retval) { return _
to GetProtocolFlags(aScheme, _retval); } \ |
| 162 NS_IMETHOD NewURI(const nsACString & aSpec, const char *aOriginCharset, nsIURI
*aBaseURI, nsIURI **_retval) { return _to NewURI(aSpec, aOriginCharset, aBaseUR
I, _retval); } \ |
| 163 NS_IMETHOD NewFileURI(nsIFile *aFile, nsIURI **_retval) { return _to NewFileUR
I(aFile, _retval); } \ |
| 164 NS_IMETHOD NewChannelFromURI(nsIURI *aURI, nsIChannel **_retval) { return _to
NewChannelFromURI(aURI, _retval); } \ |
| 165 NS_IMETHOD NewChannel(const nsACString & aSpec, const char *aOriginCharset, ns
IURI *aBaseURI, nsIChannel **_retval) { return _to NewChannel(aSpec, aOriginChar
set, aBaseURI, _retval); } \ |
| 166 NS_IMETHOD GetOffline(PRBool *aOffline) { return _to GetOffline(aOffline); } \ |
| 167 NS_IMETHOD SetOffline(PRBool aOffline) { return _to SetOffline(aOffline); } \ |
| 168 NS_IMETHOD AllowPort(PRInt32 aPort, const char *aScheme, PRBool *_retval) { re
turn _to AllowPort(aPort, aScheme, _retval); } \ |
| 169 NS_IMETHOD ExtractScheme(const nsACString & urlString, nsACString & _retval) {
return _to ExtractScheme(urlString, _retval); } |
| 170 |
| 171 /* Use this macro to declare functions that forward the behavior of this interfa
ce to another object in a safe way. */ |
| 172 #define NS_FORWARD_SAFE_NSIIOSERVICE(_to) \ |
| 173 NS_IMETHOD GetProtocolHandler(const char *aScheme, nsIProtocolHandler **_retva
l) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetProtocolHandler(aScheme, _ret
val); } \ |
| 174 NS_IMETHOD GetProtocolFlags(const char *aScheme, PRUint32 *_retval) { return !
_to ? NS_ERROR_NULL_POINTER : _to->GetProtocolFlags(aScheme, _retval); } \ |
| 175 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); } \ |
| 176 NS_IMETHOD NewFileURI(nsIFile *aFile, nsIURI **_retval) { return !_to ? NS_ERR
OR_NULL_POINTER : _to->NewFileURI(aFile, _retval); } \ |
| 177 NS_IMETHOD NewChannelFromURI(nsIURI *aURI, nsIChannel **_retval) { return !_to
? NS_ERROR_NULL_POINTER : _to->NewChannelFromURI(aURI, _retval); } \ |
| 178 NS_IMETHOD NewChannel(const nsACString & aSpec, const char *aOriginCharset, ns
IURI *aBaseURI, nsIChannel **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _t
o->NewChannel(aSpec, aOriginCharset, aBaseURI, _retval); } \ |
| 179 NS_IMETHOD GetOffline(PRBool *aOffline) { return !_to ? NS_ERROR_NULL_POINTER
: _to->GetOffline(aOffline); } \ |
| 180 NS_IMETHOD SetOffline(PRBool aOffline) { return !_to ? NS_ERROR_NULL_POINTER :
_to->SetOffline(aOffline); } \ |
| 181 NS_IMETHOD AllowPort(PRInt32 aPort, const char *aScheme, PRBool *_retval) { re
turn !_to ? NS_ERROR_NULL_POINTER : _to->AllowPort(aPort, aScheme, _retval); } \ |
| 182 NS_IMETHOD ExtractScheme(const nsACString & urlString, nsACString & _retval) {
return !_to ? NS_ERROR_NULL_POINTER : _to->ExtractScheme(urlString, _retval); }
|
| 183 |
| 184 #if 0 |
| 185 /* Use the code below as a template for the implementation class for this interf
ace. */ |
| 186 |
| 187 /* Header file */ |
| 188 class nsIOService : public nsIIOService |
| 189 { |
| 190 public: |
| 191 NS_DECL_ISUPPORTS |
| 192 NS_DECL_NSIIOSERVICE |
| 193 |
| 194 nsIOService(); |
| 195 |
| 196 private: |
| 197 ~nsIOService(); |
| 198 |
| 199 protected: |
| 200 /* additional members */ |
| 201 }; |
| 202 |
| 203 /* Implementation file */ |
| 204 NS_IMPL_ISUPPORTS1(nsIOService, nsIIOService) |
| 205 |
| 206 nsIOService::nsIOService() |
| 207 { |
| 208 /* member initializers and constructor code */ |
| 209 } |
| 210 |
| 211 nsIOService::~nsIOService() |
| 212 { |
| 213 /* destructor code */ |
| 214 } |
| 215 |
| 216 /* nsIProtocolHandler getProtocolHandler (in string aScheme); */ |
| 217 NS_IMETHODIMP nsIOService::GetProtocolHandler(const char *aScheme, nsIProtocolHa
ndler **_retval) |
| 218 { |
| 219 return NS_ERROR_NOT_IMPLEMENTED; |
| 220 } |
| 221 |
| 222 /* unsigned long getProtocolFlags (in string aScheme); */ |
| 223 NS_IMETHODIMP nsIOService::GetProtocolFlags(const char *aScheme, PRUint32 *_retv
al) |
| 224 { |
| 225 return NS_ERROR_NOT_IMPLEMENTED; |
| 226 } |
| 227 |
| 228 /* nsIURI newURI (in AUTF8String aSpec, in string aOriginCharset, in nsIURI aBas
eURI); */ |
| 229 NS_IMETHODIMP nsIOService::NewURI(const nsACString & aSpec, const char *aOriginC
harset, nsIURI *aBaseURI, nsIURI **_retval) |
| 230 { |
| 231 return NS_ERROR_NOT_IMPLEMENTED; |
| 232 } |
| 233 |
| 234 /* nsIURI newFileURI (in nsIFile aFile); */ |
| 235 NS_IMETHODIMP nsIOService::NewFileURI(nsIFile *aFile, nsIURI **_retval) |
| 236 { |
| 237 return NS_ERROR_NOT_IMPLEMENTED; |
| 238 } |
| 239 |
| 240 /* nsIChannel newChannelFromURI (in nsIURI aURI); */ |
| 241 NS_IMETHODIMP nsIOService::NewChannelFromURI(nsIURI *aURI, nsIChannel **_retval) |
| 242 { |
| 243 return NS_ERROR_NOT_IMPLEMENTED; |
| 244 } |
| 245 |
| 246 /* nsIChannel newChannel (in AUTF8String aSpec, in string aOriginCharset, in nsI
URI aBaseURI); */ |
| 247 NS_IMETHODIMP nsIOService::NewChannel(const nsACString & aSpec, const char *aOri
ginCharset, nsIURI *aBaseURI, nsIChannel **_retval) |
| 248 { |
| 249 return NS_ERROR_NOT_IMPLEMENTED; |
| 250 } |
| 251 |
| 252 /* attribute boolean offline; */ |
| 253 NS_IMETHODIMP nsIOService::GetOffline(PRBool *aOffline) |
| 254 { |
| 255 return NS_ERROR_NOT_IMPLEMENTED; |
| 256 } |
| 257 NS_IMETHODIMP nsIOService::SetOffline(PRBool aOffline) |
| 258 { |
| 259 return NS_ERROR_NOT_IMPLEMENTED; |
| 260 } |
| 261 |
| 262 /* boolean allowPort (in long aPort, in string aScheme); */ |
| 263 NS_IMETHODIMP nsIOService::AllowPort(PRInt32 aPort, const char *aScheme, PRBool
*_retval) |
| 264 { |
| 265 return NS_ERROR_NOT_IMPLEMENTED; |
| 266 } |
| 267 |
| 268 /* ACString extractScheme (in AUTF8String urlString); */ |
| 269 NS_IMETHODIMP nsIOService::ExtractScheme(const nsACString & urlString, nsACStrin
g & _retval) |
| 270 { |
| 271 return NS_ERROR_NOT_IMPLEMENTED; |
| 272 } |
| 273 |
| 274 /* End of implementation class template. */ |
| 275 #endif |
| 276 |
| 277 |
| 278 #endif /* __gen_nsIIOService_h__ */ |
OLD | NEW |