nsIRequest.h 11 KB

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