PageRenderTime 60ms CodeModel.GetById 23ms RepoModel.GetById 2ms app.codeStats 0ms

/gecko_api/include/nsIIOService.h

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