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/nsIChannel.idl |
| 3 */ |
| 4 |
| 5 #ifndef __gen_nsIChannel_h__ |
| 6 #define __gen_nsIChannel_h__ |
| 7 |
| 8 |
| 9 #ifndef __gen_nsIRequest_h__ |
| 10 #include "nsIRequest.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 nsIInterfaceRequestor; /* forward declaration */ |
| 20 |
| 21 class nsIInputStream; /* forward declaration */ |
| 22 |
| 23 class nsIStreamListener; /* forward declaration */ |
| 24 |
| 25 |
| 26 /* starting interface: nsIChannel */ |
| 27 #define NS_ICHANNEL_IID_STR "c63a055a-a676-4e71-bf3c-6cfa11082018" |
| 28 |
| 29 #define NS_ICHANNEL_IID \ |
| 30 {0xc63a055a, 0xa676, 0x4e71, \ |
| 31 { 0xbf, 0x3c, 0x6c, 0xfa, 0x11, 0x08, 0x20, 0x18 }} |
| 32 |
| 33 /** |
| 34 * The nsIChannel interface allows clients to construct "GET" requests for |
| 35 * specific protocols, and manage them in a uniform way. Once a channel is |
| 36 * created (via nsIIOService::newChannel), parameters for that request may |
| 37 * be set by using the channel attributes, or by QI'ing to a subclass of |
| 38 * nsIChannel for protocol-specific parameters. Then, the URI can be fetched |
| 39 * by calling nsIChannel::open or nsIChannel::asyncOpen. |
| 40 * |
| 41 * After a request has been completed, the channel is still valid for accessing |
| 42 * protocol-specific results. For example, QI'ing to nsIHttpChannel allows |
| 43 * response headers to be retrieved for the corresponding http transaction. |
| 44 * |
| 45 * @status FROZEN |
| 46 */ |
| 47 class NS_NO_VTABLE nsIChannel : public nsIRequest { |
| 48 public: |
| 49 |
| 50 NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICHANNEL_IID) |
| 51 |
| 52 /** |
| 53 * The original URI used to construct the channel. This is used in the case |
| 54 * of a redirect or URI "resolution" (e.g. resolving a resource: URI to a |
| 55 * file: URI) so that the original pre-redirect URI can still be obtained. |
| 56 * |
| 57 * NOTE: this is distinctly different from the http Referer (referring URI), |
| 58 * which is typically the page that contained the original URI (accessible |
| 59 * from nsIHttpChannel). |
| 60 */ |
| 61 /* attribute nsIURI originalURI; */ |
| 62 NS_IMETHOD GetOriginalURI(nsIURI * *aOriginalURI) = 0; |
| 63 NS_IMETHOD SetOriginalURI(nsIURI * aOriginalURI) = 0; |
| 64 |
| 65 /** |
| 66 * The URI corresponding to the channel. Its value is immutable. |
| 67 */ |
| 68 /* readonly attribute nsIURI URI; */ |
| 69 NS_IMETHOD GetURI(nsIURI * *aURI) = 0; |
| 70 |
| 71 /** |
| 72 * The owner, corresponding to the entity that is responsible for this |
| 73 * channel. Used by the security manager to grant or deny privileges to |
| 74 * mobile code loaded from this channel. |
| 75 * |
| 76 * NOTE: this is a strong reference to the owner, so if the owner is also |
| 77 * holding a strong reference to the channel, care must be taken to |
| 78 * explicitly drop its reference to the channel. |
| 79 */ |
| 80 /* attribute nsISupports owner; */ |
| 81 NS_IMETHOD GetOwner(nsISupports * *aOwner) = 0; |
| 82 NS_IMETHOD SetOwner(nsISupports * aOwner) = 0; |
| 83 |
| 84 /** |
| 85 * The notification callbacks for the channel. This is set by clients, who |
| 86 * wish to provide a means to receive progress, status and protocol-specific
|
| 87 * notifications. If this value is NULL, the channel implementation may use |
| 88 * the notification callbacks from its load group. The channel may also |
| 89 * query the notification callbacks from its load group if its notification |
| 90 * callbacks do not supply the requested interface. |
| 91 * |
| 92 * Interfaces commonly requested include: nsIProgressEventSink, nsIPrompt, |
| 93 * and nsIAuthPrompt. |
| 94 * |
| 95 * When the channel is done, it must not continue holding references to |
| 96 * this object. |
| 97 * |
| 98 * NOTE: A channel implementation should take care when "caching" an |
| 99 * interface pointer queried from its notification callbacks. If the |
| 100 * notification callbacks are changed, then a cached interface pointer may |
| 101 * become invalid and may therefore need to be re-queried. |
| 102 */ |
| 103 /* attribute nsIInterfaceRequestor notificationCallbacks; */ |
| 104 NS_IMETHOD GetNotificationCallbacks(nsIInterfaceRequestor * *aNotificationCall
backs) = 0; |
| 105 NS_IMETHOD SetNotificationCallbacks(nsIInterfaceRequestor * aNotificationCallb
acks) = 0; |
| 106 |
| 107 /** |
| 108 * Transport-level security information (if any) corresponding to the channe
l. |
| 109 */ |
| 110 /* readonly attribute nsISupports securityInfo; */ |
| 111 NS_IMETHOD GetSecurityInfo(nsISupports * *aSecurityInfo) = 0; |
| 112 |
| 113 /** |
| 114 * The MIME type of the channel's content if available. |
| 115 * |
| 116 * NOTE: the content type can often be wrongly specified (e.g., wrong file |
| 117 * extension, wrong MIME type, wrong document type stored on a server, etc.)
, |
| 118 * and the caller most likely wants to verify with the actual data. |
| 119 * |
| 120 * Setting contentType before the channel has been opened provides a hint |
| 121 * to the channel as to what the MIME type is. The channel may ignore this |
| 122 * hint in deciding on the actual MIME type that it will report. |
| 123 * |
| 124 * Setting contentType after onStartRequest has been fired or after open() |
| 125 * is called will override the type determined by the channel. |
| 126 * |
| 127 * Setting contentType between the time that asyncOpen() is called and the |
| 128 * time when onStartRequest is fired has undefined behavior at this time. |
| 129 * |
| 130 * The value of the contentType attribute is a lowercase string. A value |
| 131 * assigned to this attribute will be parsed and normalized as follows: |
| 132 * 1- any parameters (delimited with a ';') will be stripped. |
| 133 * 2- if a charset parameter is given, then its value will replace the |
| 134 * the contentCharset attribute of the channel. |
| 135 * 3- the stripped contentType will be lowercased. |
| 136 * Any implementation of nsIChannel must follow these rules. |
| 137 */ |
| 138 /* attribute ACString contentType; */ |
| 139 NS_IMETHOD GetContentType(nsACString & aContentType) = 0; |
| 140 NS_IMETHOD SetContentType(const nsACString & aContentType) = 0; |
| 141 |
| 142 /** |
| 143 * The character set of the channel's content if available and if applicable
. |
| 144 * This attribute only applies to textual data. |
| 145 * |
| 146 * The value of the contentCharset attribute is a mixedcase string. |
| 147 */ |
| 148 /* attribute ACString contentCharset; */ |
| 149 NS_IMETHOD GetContentCharset(nsACString & aContentCharset) = 0; |
| 150 NS_IMETHOD SetContentCharset(const nsACString & aContentCharset) = 0; |
| 151 |
| 152 /** |
| 153 * The length of the data associated with the channel if available. A value |
| 154 * of -1 indicates that the content length is unknown. |
| 155 * |
| 156 * Callers should prefer getting the "content-length" property |
| 157 * as 64-bit value by QIing the channel to nsIPropertyBag2, |
| 158 * if that interface is exposed by the channel. |
| 159 */ |
| 160 /* attribute long contentLength; */ |
| 161 NS_IMETHOD GetContentLength(PRInt32 *aContentLength) = 0; |
| 162 NS_IMETHOD SetContentLength(PRInt32 aContentLength) = 0; |
| 163 |
| 164 /** |
| 165 * Synchronously open the channel. |
| 166 * |
| 167 * @return blocking input stream to the channel's data. |
| 168 * |
| 169 * NOTE: nsIChannel implementations are not required to implement this |
| 170 * method. Moreover, since this method may block the calling thread, it |
| 171 * should not be called on a thread that processes UI events. |
| 172 */ |
| 173 /* nsIInputStream open (); */ |
| 174 NS_IMETHOD Open(nsIInputStream **_retval) = 0; |
| 175 |
| 176 /** |
| 177 * Asynchronously open this channel. Data is fed to the specified stream |
| 178 * listener as it becomes available. The stream listener's methods are |
| 179 * called on the thread that calls asyncOpen and are not called until |
| 180 * after asyncOpen returns. |
| 181 * |
| 182 * @param aListener the nsIStreamListener implementation |
| 183 * @param aContext an opaque parameter forwarded to aListener's methods |
| 184 */ |
| 185 /* void asyncOpen (in nsIStreamListener aListener, in nsISupports aContext); *
/ |
| 186 NS_IMETHOD AsyncOpen(nsIStreamListener *aListener, nsISupports *aContext) = 0; |
| 187 |
| 188 /************************************************************************** |
| 189 * Channel specific load flags: |
| 190 * |
| 191 * Bits 21-31 are reserved for future use by this interface or one of its |
| 192 * derivatives (e.g., see nsICachingChannel). |
| 193 */ |
| 194 /** |
| 195 * Set (e.g., by the docshell) to indicate whether or not the channel |
| 196 * corresponds to a document URI. |
| 197 */ |
| 198 enum { LOAD_DOCUMENT_URI = 65536U }; |
| 199 |
| 200 /** |
| 201 * If the end consumer for this load has been retargeted after discovering |
| 202 * it's content, this flag will be set: |
| 203 */ |
| 204 enum { LOAD_RETARGETED_DOCUMENT_URI = 131072U }; |
| 205 |
| 206 /** |
| 207 * This flag is set to indicate that onStopRequest may be followed by |
| 208 * another onStartRequest/onStopRequest pair. This flag is, for example, |
| 209 * used by the multipart/replace stream converter. |
| 210 */ |
| 211 enum { LOAD_REPLACE = 262144U }; |
| 212 |
| 213 /** |
| 214 * Set (e.g., by the docshell) to indicate whether or not the channel |
| 215 * corresponds to an initial document URI load (e.g., link click). |
| 216 */ |
| 217 enum { LOAD_INITIAL_DOCUMENT_URI = 524288U }; |
| 218 |
| 219 /** |
| 220 * Set (e.g., by the URILoader) to indicate whether or not the end consumer |
| 221 * for this load has been determined. |
| 222 */ |
| 223 enum { LOAD_TARGETED = 1048576U }; |
| 224 |
| 225 }; |
| 226 |
| 227 /* Use this macro when declaring classes that implement this interface. */ |
| 228 #define NS_DECL_NSICHANNEL \ |
| 229 NS_IMETHOD GetOriginalURI(nsIURI * *aOriginalURI); \ |
| 230 NS_IMETHOD SetOriginalURI(nsIURI * aOriginalURI); \ |
| 231 NS_IMETHOD GetURI(nsIURI * *aURI); \ |
| 232 NS_IMETHOD GetOwner(nsISupports * *aOwner); \ |
| 233 NS_IMETHOD SetOwner(nsISupports * aOwner); \ |
| 234 NS_IMETHOD GetNotificationCallbacks(nsIInterfaceRequestor * *aNotificationCall
backs); \ |
| 235 NS_IMETHOD SetNotificationCallbacks(nsIInterfaceRequestor * aNotificationCallb
acks); \ |
| 236 NS_IMETHOD GetSecurityInfo(nsISupports * *aSecurityInfo); \ |
| 237 NS_IMETHOD GetContentType(nsACString & aContentType); \ |
| 238 NS_IMETHOD SetContentType(const nsACString & aContentType); \ |
| 239 NS_IMETHOD GetContentCharset(nsACString & aContentCharset); \ |
| 240 NS_IMETHOD SetContentCharset(const nsACString & aContentCharset); \ |
| 241 NS_IMETHOD GetContentLength(PRInt32 *aContentLength); \ |
| 242 NS_IMETHOD SetContentLength(PRInt32 aContentLength); \ |
| 243 NS_IMETHOD Open(nsIInputStream **_retval); \ |
| 244 NS_IMETHOD AsyncOpen(nsIStreamListener *aListener, nsISupports *aContext); \ |
| 245 |
| 246 /* Use this macro to declare functions that forward the behavior of this interfa
ce to another object. */ |
| 247 #define NS_FORWARD_NSICHANNEL(_to) \ |
| 248 NS_IMETHOD GetOriginalURI(nsIURI * *aOriginalURI) { return _to GetOriginalURI(
aOriginalURI); } \ |
| 249 NS_IMETHOD SetOriginalURI(nsIURI * aOriginalURI) { return _to SetOriginalURI(a
OriginalURI); } \ |
| 250 NS_IMETHOD GetURI(nsIURI * *aURI) { return _to GetURI(aURI); } \ |
| 251 NS_IMETHOD GetOwner(nsISupports * *aOwner) { return _to GetOwner(aOwner); } \ |
| 252 NS_IMETHOD SetOwner(nsISupports * aOwner) { return _to SetOwner(aOwner); } \ |
| 253 NS_IMETHOD GetNotificationCallbacks(nsIInterfaceRequestor * *aNotificationCall
backs) { return _to GetNotificationCallbacks(aNotificationCallbacks); } \ |
| 254 NS_IMETHOD SetNotificationCallbacks(nsIInterfaceRequestor * aNotificationCallb
acks) { return _to SetNotificationCallbacks(aNotificationCallbacks); } \ |
| 255 NS_IMETHOD GetSecurityInfo(nsISupports * *aSecurityInfo) { return _to GetSecur
ityInfo(aSecurityInfo); } \ |
| 256 NS_IMETHOD GetContentType(nsACString & aContentType) { return _to GetContentTy
pe(aContentType); } \ |
| 257 NS_IMETHOD SetContentType(const nsACString & aContentType) { return _to SetCon
tentType(aContentType); } \ |
| 258 NS_IMETHOD GetContentCharset(nsACString & aContentCharset) { return _to GetCon
tentCharset(aContentCharset); } \ |
| 259 NS_IMETHOD SetContentCharset(const nsACString & aContentCharset) { return _to
SetContentCharset(aContentCharset); } \ |
| 260 NS_IMETHOD GetContentLength(PRInt32 *aContentLength) { return _to GetContentLe
ngth(aContentLength); } \ |
| 261 NS_IMETHOD SetContentLength(PRInt32 aContentLength) { return _to SetContentLen
gth(aContentLength); } \ |
| 262 NS_IMETHOD Open(nsIInputStream **_retval) { return _to Open(_retval); } \ |
| 263 NS_IMETHOD AsyncOpen(nsIStreamListener *aListener, nsISupports *aContext) { re
turn _to AsyncOpen(aListener, aContext); } \ |
| 264 |
| 265 /* Use this macro to declare functions that forward the behavior of this interfa
ce to another object in a safe way. */ |
| 266 #define NS_FORWARD_SAFE_NSICHANNEL(_to) \ |
| 267 NS_IMETHOD GetOriginalURI(nsIURI * *aOriginalURI) { return !_to ? NS_ERROR_NUL
L_POINTER : _to->GetOriginalURI(aOriginalURI); } \ |
| 268 NS_IMETHOD SetOriginalURI(nsIURI * aOriginalURI) { return !_to ? NS_ERROR_NULL
_POINTER : _to->SetOriginalURI(aOriginalURI); } \ |
| 269 NS_IMETHOD GetURI(nsIURI * *aURI) { return !_to ? NS_ERROR_NULL_POINTER : _to-
>GetURI(aURI); } \ |
| 270 NS_IMETHOD GetOwner(nsISupports * *aOwner) { return !_to ? NS_ERROR_NULL_POINT
ER : _to->GetOwner(aOwner); } \ |
| 271 NS_IMETHOD SetOwner(nsISupports * aOwner) { return !_to ? NS_ERROR_NULL_POINTE
R : _to->SetOwner(aOwner); } \ |
| 272 NS_IMETHOD GetNotificationCallbacks(nsIInterfaceRequestor * *aNotificationCall
backs) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetNotificationCallbacks(aNo
tificationCallbacks); } \ |
| 273 NS_IMETHOD SetNotificationCallbacks(nsIInterfaceRequestor * aNotificationCallb
acks) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetNotificationCallbacks(aNot
ificationCallbacks); } \ |
| 274 NS_IMETHOD GetSecurityInfo(nsISupports * *aSecurityInfo) { return !_to ? NS_ER
ROR_NULL_POINTER : _to->GetSecurityInfo(aSecurityInfo); } \ |
| 275 NS_IMETHOD GetContentType(nsACString & aContentType) { return !_to ? NS_ERROR_
NULL_POINTER : _to->GetContentType(aContentType); } \ |
| 276 NS_IMETHOD SetContentType(const nsACString & aContentType) { return !_to ? NS_
ERROR_NULL_POINTER : _to->SetContentType(aContentType); } \ |
| 277 NS_IMETHOD GetContentCharset(nsACString & aContentCharset) { return !_to ? NS_
ERROR_NULL_POINTER : _to->GetContentCharset(aContentCharset); } \ |
| 278 NS_IMETHOD SetContentCharset(const nsACString & aContentCharset) { return !_to
? NS_ERROR_NULL_POINTER : _to->SetContentCharset(aContentCharset); } \ |
| 279 NS_IMETHOD GetContentLength(PRInt32 *aContentLength) { return !_to ? NS_ERROR_
NULL_POINTER : _to->GetContentLength(aContentLength); } \ |
| 280 NS_IMETHOD SetContentLength(PRInt32 aContentLength) { return !_to ? NS_ERROR_N
ULL_POINTER : _to->SetContentLength(aContentLength); } \ |
| 281 NS_IMETHOD Open(nsIInputStream **_retval) { return !_to ? NS_ERROR_NULL_POINTE
R : _to->Open(_retval); } \ |
| 282 NS_IMETHOD AsyncOpen(nsIStreamListener *aListener, nsISupports *aContext) { re
turn !_to ? NS_ERROR_NULL_POINTER : _to->AsyncOpen(aListener, aContext); } \ |
| 283 |
| 284 #if 0 |
| 285 /* Use the code below as a template for the implementation class for this interf
ace. */ |
| 286 |
| 287 /* Header file */ |
| 288 class nsChannel : public nsIChannel |
| 289 { |
| 290 public: |
| 291 NS_DECL_ISUPPORTS |
| 292 NS_DECL_NSICHANNEL |
| 293 |
| 294 nsChannel(); |
| 295 |
| 296 private: |
| 297 ~nsChannel(); |
| 298 |
| 299 protected: |
| 300 /* additional members */ |
| 301 }; |
| 302 |
| 303 /* Implementation file */ |
| 304 NS_IMPL_ISUPPORTS1(nsChannel, nsIChannel) |
| 305 |
| 306 nsChannel::nsChannel() |
| 307 { |
| 308 /* member initializers and constructor code */ |
| 309 } |
| 310 |
| 311 nsChannel::~nsChannel() |
| 312 { |
| 313 /* destructor code */ |
| 314 } |
| 315 |
| 316 /* attribute nsIURI originalURI; */ |
| 317 NS_IMETHODIMP nsChannel::GetOriginalURI(nsIURI * *aOriginalURI) |
| 318 { |
| 319 return NS_ERROR_NOT_IMPLEMENTED; |
| 320 } |
| 321 NS_IMETHODIMP nsChannel::SetOriginalURI(nsIURI * aOriginalURI) |
| 322 { |
| 323 return NS_ERROR_NOT_IMPLEMENTED; |
| 324 } |
| 325 |
| 326 /* readonly attribute nsIURI URI; */ |
| 327 NS_IMETHODIMP nsChannel::GetURI(nsIURI * *aURI) |
| 328 { |
| 329 return NS_ERROR_NOT_IMPLEMENTED; |
| 330 } |
| 331 |
| 332 /* attribute nsISupports owner; */ |
| 333 NS_IMETHODIMP nsChannel::GetOwner(nsISupports * *aOwner) |
| 334 { |
| 335 return NS_ERROR_NOT_IMPLEMENTED; |
| 336 } |
| 337 NS_IMETHODIMP nsChannel::SetOwner(nsISupports * aOwner) |
| 338 { |
| 339 return NS_ERROR_NOT_IMPLEMENTED; |
| 340 } |
| 341 |
| 342 /* attribute nsIInterfaceRequestor notificationCallbacks; */ |
| 343 NS_IMETHODIMP nsChannel::GetNotificationCallbacks(nsIInterfaceRequestor * *aNoti
ficationCallbacks) |
| 344 { |
| 345 return NS_ERROR_NOT_IMPLEMENTED; |
| 346 } |
| 347 NS_IMETHODIMP nsChannel::SetNotificationCallbacks(nsIInterfaceRequestor * aNotif
icationCallbacks) |
| 348 { |
| 349 return NS_ERROR_NOT_IMPLEMENTED; |
| 350 } |
| 351 |
| 352 /* readonly attribute nsISupports securityInfo; */ |
| 353 NS_IMETHODIMP nsChannel::GetSecurityInfo(nsISupports * *aSecurityInfo) |
| 354 { |
| 355 return NS_ERROR_NOT_IMPLEMENTED; |
| 356 } |
| 357 |
| 358 /* attribute ACString contentType; */ |
| 359 NS_IMETHODIMP nsChannel::GetContentType(nsACString & aContentType) |
| 360 { |
| 361 return NS_ERROR_NOT_IMPLEMENTED; |
| 362 } |
| 363 NS_IMETHODIMP nsChannel::SetContentType(const nsACString & aContentType) |
| 364 { |
| 365 return NS_ERROR_NOT_IMPLEMENTED; |
| 366 } |
| 367 |
| 368 /* attribute ACString contentCharset; */ |
| 369 NS_IMETHODIMP nsChannel::GetContentCharset(nsACString & aContentCharset) |
| 370 { |
| 371 return NS_ERROR_NOT_IMPLEMENTED; |
| 372 } |
| 373 NS_IMETHODIMP nsChannel::SetContentCharset(const nsACString & aContentCharset) |
| 374 { |
| 375 return NS_ERROR_NOT_IMPLEMENTED; |
| 376 } |
| 377 |
| 378 /* attribute long contentLength; */ |
| 379 NS_IMETHODIMP nsChannel::GetContentLength(PRInt32 *aContentLength) |
| 380 { |
| 381 return NS_ERROR_NOT_IMPLEMENTED; |
| 382 } |
| 383 NS_IMETHODIMP nsChannel::SetContentLength(PRInt32 aContentLength) |
| 384 { |
| 385 return NS_ERROR_NOT_IMPLEMENTED; |
| 386 } |
| 387 |
| 388 /* nsIInputStream open (); */ |
| 389 NS_IMETHODIMP nsChannel::Open(nsIInputStream **_retval) |
| 390 { |
| 391 return NS_ERROR_NOT_IMPLEMENTED; |
| 392 } |
| 393 |
| 394 /* void asyncOpen (in nsIStreamListener aListener, in nsISupports aContext); */ |
| 395 NS_IMETHODIMP nsChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports *aC
ontext) |
| 396 { |
| 397 return NS_ERROR_NOT_IMPLEMENTED; |
| 398 } |
| 399 |
| 400 /* End of implementation class template. */ |
| 401 #endif |
| 402 |
| 403 |
| 404 #endif /* __gen_nsIChannel_h__ */ |
OLD | NEW |