/gecko_api/include/nsIRequest.h
C++ Header | 349 lines | 131 code | 51 blank | 167 comment | 0 complexity | de9ed8fb79a0f480deb31f57dc0063af MD5 | raw file
1/* 2 * DO NOT EDIT. THIS FILE IS GENERATED FROM /builds/tinderbox/XR-Trunk/Darwin_8.8.4_Depend/mozilla/netwerk/base/public/nsIRequest.idl 3 */ 4 5#ifndef __gen_nsIRequest_h__ 6#define __gen_nsIRequest_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 17class nsILoadGroup; /* forward declaration */ 18 19typedef PRUint32 nsLoadFlags; 20 21 22/* starting interface: nsIRequest */ 23#define NS_IREQUEST_IID_STR "ef6bfbd2-fd46-48d8-96b7-9f8f0fd387fe" 24 25#define NS_IREQUEST_IID \ 26 {0xef6bfbd2, 0xfd46, 0x48d8, \ 27 { 0x96, 0xb7, 0x9f, 0x8f, 0x0f, 0xd3, 0x87, 0xfe }} 28 29/** 30 * nsIRequest 31 * 32 * @status FROZEN 33 */ 34class NS_NO_VTABLE NS_SCRIPTABLE nsIRequest : public nsISupports { 35 public: 36 37 NS_DECLARE_STATIC_IID_ACCESSOR(NS_IREQUEST_IID) 38 39 /** 40 * The name of the request. Often this is the URI of the request. 41 */ 42 /* readonly attribute AUTF8String name; */ 43 NS_SCRIPTABLE NS_IMETHOD GetName(nsACString & aName) = 0; 44 45 /** 46 * Indicates whether the request is pending. nsIRequest::isPending is 47 * true when there is an outstanding asynchronous event that will make 48 * the request no longer be pending. Requests do not necessarily start 49 * out pending; in some cases, requests have to be explicitly initiated 50 * (e.g. nsIChannel implementations are only pending once asyncOpen 51 * returns successfully). 52 * 53 * Requests can become pending multiple times during their lifetime. 54 * 55 * @return TRUE if the request has yet to reach completion. 56 * @return FALSE if the request has reached completion (e.g., after 57 * OnStopRequest has fired). 58 * @note Suspended requests are still considered pending. 59 */ 60 /* boolean isPending (); */ 61 NS_SCRIPTABLE NS_IMETHOD IsPending(PRBool *_retval) = 0; 62 63 /** 64 * The error status associated with the request. 65 */ 66 /* readonly attribute nsresult status; */ 67 NS_SCRIPTABLE NS_IMETHOD GetStatus(nsresult *aStatus) = 0; 68 69 /** 70 * Cancels the current request. This will close any open input or 71 * output streams and terminate any async requests. Users should 72 * normally pass NS_BINDING_ABORTED, although other errors may also 73 * be passed. The error passed in will become the value of the 74 * status attribute. 75 * 76 * Implementations must not send any notifications (e.g. via 77 * nsIRequestObserver) synchronously from this function. Similarly, 78 * removal from the load group (if any) must also happen asynchronously. 79 * 80 * Requests that use nsIStreamListener must not call onDataAvailable 81 * anymore after cancel has been called. 82 * 83 * @param aStatus the reason for canceling this request. 84 * 85 * NOTE: most nsIRequest implementations expect aStatus to be a 86 * failure code; however, some implementations may allow aStatus to 87 * be a success code such as NS_OK. In general, aStatus should be 88 * a failure code. 89 */ 90 /* void cancel (in nsresult aStatus); */ 91 NS_SCRIPTABLE NS_IMETHOD Cancel(nsresult aStatus) = 0; 92 93 /** 94 * Suspends the current request. This may have the effect of closing 95 * any underlying transport (in order to free up resources), although 96 * any open streams remain logically opened and will continue delivering 97 * data when the transport is resumed. 98 * 99 * Calling cancel() on a suspended request must not send any 100 * notifications (such as onstopRequest) until the request is resumed. 101 * 102 * NOTE: some implementations are unable to immediately suspend, and 103 * may continue to deliver events already posted to an event queue. In 104 * general, callers should be capable of handling events even after 105 * suspending a request. 106 */ 107 /* void suspend (); */ 108 NS_SCRIPTABLE NS_IMETHOD Suspend(void) = 0; 109 110 /** 111 * Resumes the current request. This may have the effect of re-opening 112 * any underlying transport and will resume the delivery of data to 113 * any open streams. 114 */ 115 /* void resume (); */ 116 NS_SCRIPTABLE NS_IMETHOD Resume(void) = 0; 117 118 /** 119 * The load group of this request. While pending, the request is a 120 * member of the load group. It is the responsibility of the request 121 * to implement this policy. 122 */ 123 /* attribute nsILoadGroup loadGroup; */ 124 NS_SCRIPTABLE NS_IMETHOD GetLoadGroup(nsILoadGroup * *aLoadGroup) = 0; 125 NS_SCRIPTABLE NS_IMETHOD SetLoadGroup(nsILoadGroup * aLoadGroup) = 0; 126 127 /** 128 * The load flags of this request. Bits 0-15 are reserved. 129 * 130 * When added to a load group, this request's load flags are merged with 131 * the load flags of the load group. 132 */ 133 /* attribute nsLoadFlags loadFlags; */ 134 NS_SCRIPTABLE NS_IMETHOD GetLoadFlags(nsLoadFlags *aLoadFlags) = 0; 135 NS_SCRIPTABLE NS_IMETHOD SetLoadFlags(nsLoadFlags aLoadFlags) = 0; 136 137 /************************************************************************** 138 * Listed below are the various load flags which may be or'd together. 139 */ 140/** 141 * No special load flags: 142 */ 143 enum { LOAD_NORMAL = 0U }; 144 145 /** 146 * Don't deliver status notifications to the nsIProgressEventSink, or keep 147 * this load from completing the nsILoadGroup it may belong to. 148 */ 149 enum { LOAD_BACKGROUND = 1U }; 150 151 /************************************************************************** 152 * The following flags control the flow of data into the cache. 153 */ 154/** 155 * This flag prevents caching of any kind. It does not, however, prevent 156 * cached content from being used to satisfy this request. 157 */ 158 enum { INHIBIT_CACHING = 128U }; 159 160 /** 161 * This flag prevents caching on disk (or other persistent media), which 162 * may be needed to preserve privacy. For HTTPS, this flag is set auto- 163 * matically. 164 */ 165 enum { INHIBIT_PERSISTENT_CACHING = 256U }; 166 167 /************************************************************************** 168 * The following flags control what happens when the cache contains data 169 * that could perhaps satisfy this request. They are listed in descending 170 * order of precidence. 171 */ 172/** 173 * Force an end-to-end download of content data from the origin server. 174 * This flag is used for a shift-reload. 175 */ 176 enum { LOAD_BYPASS_CACHE = 512U }; 177 178 /** 179 * Load from the cache, bypassing protocol specific validation logic. This 180 * flag is used when browsing via history. It is not recommended for normal 181 * browsing as it may likely violate reasonable assumptions made by the 182 * server and confuse users. 183 */ 184 enum { LOAD_FROM_CACHE = 1024U }; 185 186 /** 187 * The following flags control the frequency of cached content validation 188 * when neither LOAD_BYPASS_CACHE or LOAD_FROM_CACHE are set. By default, 189 * cached content is automatically validated if necessary before reuse. 190 * 191 * VALIDATE_ALWAYS forces validation of any cached content independent of 192 * its expiration time. 193 * 194 * VALIDATE_NEVER disables validation of expired content. 195 * 196 * VALIDATE_ONCE_PER_SESSION disables validation of expired content, 197 * provided it has already been validated (at least once) since the start 198 * of this session. 199 * 200 * NOTE TO IMPLEMENTORS: 201 * These flags are intended for normal browsing, and they should therefore 202 * not apply to content that must be validated before each use. Consider, 203 * for example, a HTTP response with a "Cache-control: no-cache" header. 204 * According to RFC2616, this response must be validated before it can 205 * be taken from a cache. Breaking this requirement could result in 206 * incorrect and potentially undesirable side-effects. 207 */ 208 enum { VALIDATE_ALWAYS = 2048U }; 209 210 enum { VALIDATE_NEVER = 4096U }; 211 212 enum { VALIDATE_ONCE_PER_SESSION = 8192U }; 213 214}; 215 216 NS_DEFINE_STATIC_IID_ACCESSOR(nsIRequest, NS_IREQUEST_IID) 217 218/* Use this macro when declaring classes that implement this interface. */ 219#define NS_DECL_NSIREQUEST \ 220 NS_SCRIPTABLE NS_IMETHOD GetName(nsACString & aName); \ 221 NS_SCRIPTABLE NS_IMETHOD IsPending(PRBool *_retval); \ 222 NS_SCRIPTABLE NS_IMETHOD GetStatus(nsresult *aStatus); \ 223 NS_SCRIPTABLE NS_IMETHOD Cancel(nsresult aStatus); \ 224 NS_SCRIPTABLE NS_IMETHOD Suspend(void); \ 225 NS_SCRIPTABLE NS_IMETHOD Resume(void); \ 226 NS_SCRIPTABLE NS_IMETHOD GetLoadGroup(nsILoadGroup * *aLoadGroup); \ 227 NS_SCRIPTABLE NS_IMETHOD SetLoadGroup(nsILoadGroup * aLoadGroup); \ 228 NS_SCRIPTABLE NS_IMETHOD GetLoadFlags(nsLoadFlags *aLoadFlags); \ 229 NS_SCRIPTABLE NS_IMETHOD SetLoadFlags(nsLoadFlags aLoadFlags); \ 230 231/* Use this macro to declare functions that forward the behavior of this interface to another object. */ 232#define NS_FORWARD_NSIREQUEST(_to) \ 233 NS_SCRIPTABLE NS_IMETHOD GetName(nsACString & aName) { return _to GetName(aName); } \ 234 NS_SCRIPTABLE NS_IMETHOD IsPending(PRBool *_retval) { return _to IsPending(_retval); } \ 235 NS_SCRIPTABLE NS_IMETHOD GetStatus(nsresult *aStatus) { return _to GetStatus(aStatus); } \ 236 NS_SCRIPTABLE NS_IMETHOD Cancel(nsresult aStatus) { return _to Cancel(aStatus); } \ 237 NS_SCRIPTABLE NS_IMETHOD Suspend(void) { return _to Suspend(); } \ 238 NS_SCRIPTABLE NS_IMETHOD Resume(void) { return _to Resume(); } \ 239 NS_SCRIPTABLE NS_IMETHOD GetLoadGroup(nsILoadGroup * *aLoadGroup) { return _to GetLoadGroup(aLoadGroup); } \ 240 NS_SCRIPTABLE NS_IMETHOD SetLoadGroup(nsILoadGroup * aLoadGroup) { return _to SetLoadGroup(aLoadGroup); } \ 241 NS_SCRIPTABLE NS_IMETHOD GetLoadFlags(nsLoadFlags *aLoadFlags) { return _to GetLoadFlags(aLoadFlags); } \ 242 NS_SCRIPTABLE NS_IMETHOD SetLoadFlags(nsLoadFlags aLoadFlags) { return _to SetLoadFlags(aLoadFlags); } \ 243 244/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */ 245#define NS_FORWARD_SAFE_NSIREQUEST(_to) \ 246 NS_SCRIPTABLE NS_IMETHOD GetName(nsACString & aName) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetName(aName); } \ 247 NS_SCRIPTABLE NS_IMETHOD IsPending(PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->IsPending(_retval); } \ 248 NS_SCRIPTABLE NS_IMETHOD GetStatus(nsresult *aStatus) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetStatus(aStatus); } \ 249 NS_SCRIPTABLE NS_IMETHOD Cancel(nsresult aStatus) { return !_to ? NS_ERROR_NULL_POINTER : _to->Cancel(aStatus); } \ 250 NS_SCRIPTABLE NS_IMETHOD Suspend(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->Suspend(); } \ 251 NS_SCRIPTABLE NS_IMETHOD Resume(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->Resume(); } \ 252 NS_SCRIPTABLE NS_IMETHOD GetLoadGroup(nsILoadGroup * *aLoadGroup) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetLoadGroup(aLoadGroup); } \ 253 NS_SCRIPTABLE NS_IMETHOD SetLoadGroup(nsILoadGroup * aLoadGroup) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetLoadGroup(aLoadGroup); } \ 254 NS_SCRIPTABLE NS_IMETHOD GetLoadFlags(nsLoadFlags *aLoadFlags) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetLoadFlags(aLoadFlags); } \ 255 NS_SCRIPTABLE NS_IMETHOD SetLoadFlags(nsLoadFlags aLoadFlags) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetLoadFlags(aLoadFlags); } \ 256 257#if 0 258/* Use the code below as a template for the implementation class for this interface. */ 259 260/* Header file */ 261class nsRequest : public nsIRequest 262{ 263public: 264 NS_DECL_ISUPPORTS 265 NS_DECL_NSIREQUEST 266 267 nsRequest(); 268 269private: 270 ~nsRequest(); 271 272protected: 273 /* additional members */ 274}; 275 276/* Implementation file */ 277NS_IMPL_ISUPPORTS1(nsRequest, nsIRequest) 278 279nsRequest::nsRequest() 280{ 281 /* member initializers and constructor code */ 282} 283 284nsRequest::~nsRequest() 285{ 286 /* destructor code */ 287} 288 289/* readonly attribute AUTF8String name; */ 290NS_IMETHODIMP nsRequest::GetName(nsACString & aName) 291{ 292 return NS_ERROR_NOT_IMPLEMENTED; 293} 294 295/* boolean isPending (); */ 296NS_IMETHODIMP nsRequest::IsPending(PRBool *_retval) 297{ 298 return NS_ERROR_NOT_IMPLEMENTED; 299} 300 301/* readonly attribute nsresult status; */ 302NS_IMETHODIMP nsRequest::GetStatus(nsresult *aStatus) 303{ 304 return NS_ERROR_NOT_IMPLEMENTED; 305} 306 307/* void cancel (in nsresult aStatus); */ 308NS_IMETHODIMP nsRequest::Cancel(nsresult aStatus) 309{ 310 return NS_ERROR_NOT_IMPLEMENTED; 311} 312 313/* void suspend (); */ 314NS_IMETHODIMP nsRequest::Suspend() 315{ 316 return NS_ERROR_NOT_IMPLEMENTED; 317} 318 319/* void resume (); */ 320NS_IMETHODIMP nsRequest::Resume() 321{ 322 return NS_ERROR_NOT_IMPLEMENTED; 323} 324 325/* attribute nsILoadGroup loadGroup; */ 326NS_IMETHODIMP nsRequest::GetLoadGroup(nsILoadGroup * *aLoadGroup) 327{ 328 return NS_ERROR_NOT_IMPLEMENTED; 329} 330NS_IMETHODIMP nsRequest::SetLoadGroup(nsILoadGroup * aLoadGroup) 331{ 332 return NS_ERROR_NOT_IMPLEMENTED; 333} 334 335/* attribute nsLoadFlags loadFlags; */ 336NS_IMETHODIMP nsRequest::GetLoadFlags(nsLoadFlags *aLoadFlags) 337{ 338 return NS_ERROR_NOT_IMPLEMENTED; 339} 340NS_IMETHODIMP nsRequest::SetLoadFlags(nsLoadFlags aLoadFlags) 341{ 342 return NS_ERROR_NOT_IMPLEMENTED; 343} 344 345/* End of implementation class template. */ 346#endif 347 348 349#endif /* __gen_nsIRequest_h__ */