nsIUploadChannel.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /*
  2. * DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/netwerk/base/public/nsIUploadChannel.idl
  3. */
  4. #ifndef __gen_nsIUploadChannel_h__
  5. #define __gen_nsIUploadChannel_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 nsIInputStream; /* forward declaration */
  14. /* starting interface: nsIUploadChannel */
  15. #define NS_IUPLOADCHANNEL_IID_STR "ddf633d8-e9a4-439d-ad88-de636fd9bb75"
  16. #define NS_IUPLOADCHANNEL_IID \
  17. {0xddf633d8, 0xe9a4, 0x439d, \
  18. { 0xad, 0x88, 0xde, 0x63, 0x6f, 0xd9, 0xbb, 0x75 }}
  19. /**
  20. * nsIUploadChannel
  21. *
  22. * A channel may optionally implement this interface if it supports the
  23. * notion of uploading a data stream. The upload stream may only be set
  24. * prior to the invocation of asyncOpen on the channel.
  25. *
  26. * @status FROZEN
  27. */
  28. class NS_NO_VTABLE nsIUploadChannel : public nsISupports {
  29. public:
  30. NS_DEFINE_STATIC_IID_ACCESSOR(NS_IUPLOADCHANNEL_IID)
  31. /**
  32. * Sets a stream to be uploaded by this channel.
  33. *
  34. * Most implementations of this interface require that the stream:
  35. * (1) implement threadsafe addRef and release
  36. * (2) implement nsIInputStream::readSegments
  37. * (3) implement nsISeekableStream::seek
  38. *
  39. * History here is that we need to support both streams that already have
  40. * headers (e.g., Content-Type and Content-Length) information prepended to
  41. * the stream (by plugins) as well as clients (composer, uploading
  42. * application) that want to upload data streams without any knowledge of
  43. * protocol specifications. For this reason, we have a special meaning
  44. * for the aContentType parameter (see below).
  45. *
  46. * @param aStream
  47. * The stream to be uploaded by this channel.
  48. * @param aContentType
  49. * If aContentType is empty, the protocol will assume that no
  50. * content headers are to be added to the uploaded stream and that
  51. * any required headers are already encoded in the stream. In the
  52. * case of HTTP, if this parameter is non-empty, then its value will
  53. * replace any existing Content-Type header on the HTTP request.
  54. * In the case of FTP and FILE, this parameter is ignored.
  55. * @param aContentLength
  56. * A value of -1 indicates that the length of the stream should be
  57. * determined by calling the stream's |available| method.
  58. */
  59. /* void setUploadStream (in nsIInputStream aStream, in ACString aContentType, in long aContentLength); */
  60. NS_IMETHOD SetUploadStream(nsIInputStream *aStream, const nsACString & aContentType, PRInt32 aContentLength) = 0;
  61. /**
  62. * Get the stream (to be) uploaded by this channel.
  63. */
  64. /* readonly attribute nsIInputStream uploadStream; */
  65. NS_IMETHOD GetUploadStream(nsIInputStream * *aUploadStream) = 0;
  66. };
  67. /* Use this macro when declaring classes that implement this interface. */
  68. #define NS_DECL_NSIUPLOADCHANNEL \
  69. NS_IMETHOD SetUploadStream(nsIInputStream *aStream, const nsACString & aContentType, PRInt32 aContentLength); \
  70. NS_IMETHOD GetUploadStream(nsIInputStream * *aUploadStream);
  71. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  72. #define NS_FORWARD_NSIUPLOADCHANNEL(_to) \
  73. NS_IMETHOD SetUploadStream(nsIInputStream *aStream, const nsACString & aContentType, PRInt32 aContentLength) { return _to SetUploadStream(aStream, aContentType, aContentLength); } \
  74. NS_IMETHOD GetUploadStream(nsIInputStream * *aUploadStream) { return _to GetUploadStream(aUploadStream); }
  75. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  76. #define NS_FORWARD_SAFE_NSIUPLOADCHANNEL(_to) \
  77. NS_IMETHOD SetUploadStream(nsIInputStream *aStream, const nsACString & aContentType, PRInt32 aContentLength) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetUploadStream(aStream, aContentType, aContentLength); } \
  78. NS_IMETHOD GetUploadStream(nsIInputStream * *aUploadStream) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetUploadStream(aUploadStream); }
  79. #if 0
  80. /* Use the code below as a template for the implementation class for this interface. */
  81. /* Header file */
  82. class nsUploadChannel : public nsIUploadChannel
  83. {
  84. public:
  85. NS_DECL_ISUPPORTS
  86. NS_DECL_NSIUPLOADCHANNEL
  87. nsUploadChannel();
  88. private:
  89. ~nsUploadChannel();
  90. protected:
  91. /* additional members */
  92. };
  93. /* Implementation file */
  94. NS_IMPL_ISUPPORTS1(nsUploadChannel, nsIUploadChannel)
  95. nsUploadChannel::nsUploadChannel()
  96. {
  97. /* member initializers and constructor code */
  98. }
  99. nsUploadChannel::~nsUploadChannel()
  100. {
  101. /* destructor code */
  102. }
  103. /* void setUploadStream (in nsIInputStream aStream, in ACString aContentType, in long aContentLength); */
  104. NS_IMETHODIMP nsUploadChannel::SetUploadStream(nsIInputStream *aStream, const nsACString & aContentType, PRInt32 aContentLength)
  105. {
  106. return NS_ERROR_NOT_IMPLEMENTED;
  107. }
  108. /* readonly attribute nsIInputStream uploadStream; */
  109. NS_IMETHODIMP nsUploadChannel::GetUploadStream(nsIInputStream * *aUploadStream)
  110. {
  111. return NS_ERROR_NOT_IMPLEMENTED;
  112. }
  113. /* End of implementation class template. */
  114. #endif
  115. #endif /* __gen_nsIUploadChannel_h__ */