home *** CD-ROM | disk | FTP | other *** search
/ Chip 1999 September / CHIPCD_9_99.iso / software / serwery_www / sambar / _setup.1 / httpext.h < prev    next >
C/C++ Source or Header  |  1998-02-04  |  8KB  |  223 lines

  1. /********
  2. *
  3. *  Copyright (c) 1995  Process Software Corporation
  4. *
  5. *  Copyright (c) 1995-1996  Microsoft Corporation
  6. *
  7. *
  8. *  Module Name  : HttpExt.h
  9. *
  10. *  Abstract :
  11. *
  12. *     This module contains  the structure definitions and prototypes for the
  13. *     version 2.0 HTTP Server Extension interface.
  14. *
  15. ******************/
  16.  
  17. #ifndef _HTTPEXT_H_
  18. #define _HTTPEXT_H_
  19.  
  20. #include <windows.h>
  21.  
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25.  
  26. #define   HSE_VERSION_MAJOR           2      // major version of this spec
  27. #define   HSE_VERSION_MINOR           0      // minor version of this spec
  28. #define   HSE_LOG_BUFFER_LEN         80
  29. #define   HSE_MAX_EXT_DLL_NAME_LEN  256
  30.  
  31. typedef   LPVOID  HCONN;
  32.  
  33. // the following are the status codes returned by the Extension DLL
  34.  
  35. #define   HSE_STATUS_SUCCESS                       1
  36. #define   HSE_STATUS_SUCCESS_AND_KEEP_CONN         2
  37. #define   HSE_STATUS_PENDING                       3
  38. #define   HSE_STATUS_ERROR                         4
  39.  
  40. // The following are the values to request services with the ServerSupportFunction.
  41. //  Values from 0 to 1000 are reserved for future versions of the interface
  42.  
  43. #define   HSE_REQ_BASE                             0
  44. #define   HSE_REQ_SEND_URL_REDIRECT_RESP           ( HSE_REQ_BASE + 1 )
  45. #define   HSE_REQ_SEND_URL                         ( HSE_REQ_BASE + 2 )
  46. #define   HSE_REQ_SEND_RESPONSE_HEADER             ( HSE_REQ_BASE + 3 )
  47. #define   HSE_REQ_DONE_WITH_SESSION                ( HSE_REQ_BASE + 4 )
  48. #define   HSE_REQ_END_RESERVED                     1000
  49.  
  50. //
  51. //  These are Microsoft specific extensions
  52. //
  53.  
  54. #define   HSE_REQ_MAP_URL_TO_PATH                  (HSE_REQ_END_RESERVED+1)
  55. #define   HSE_REQ_GET_SSPI_INFO                    (HSE_REQ_END_RESERVED+2)
  56. #define   HSE_APPEND_LOG_PARAMETER                 (HSE_REQ_END_RESERVED+3)
  57. #define   HSE_REQ_SEND_URL_EX                      (HSE_REQ_END_RESERVED+4)
  58. #define   HSE_REQ_IO_COMPLETION                    (HSE_REQ_END_RESERVED+5)
  59. #define   HSE_REQ_TRANSMIT_FILE                    (HSE_REQ_END_RESERVED+6)
  60. #define   HSE_REQ_REFRESH_ISAPI_ACL                (HSE_REQ_END_RESERVED+7)
  61.  
  62. //
  63. //  Bit Flags for TerminateExtension
  64. //
  65. //    HSE_TERM_ADVISORY_UNLOAD - Server wants to unload the extension,
  66. //          extension can return TRUE if OK, FALSE if the server should not
  67. //          unload the extension
  68. //
  69. //    HSE_TERM_MUST_UNLOAD - Server indicating the extension is about to be
  70. //          unloaded, the extension cannot refuse.
  71. //
  72.  
  73. #define HSE_TERM_ADVISORY_UNLOAD                   0x00000001
  74. #define HSE_TERM_MUST_UNLOAD                       0x00000002
  75.  
  76.  
  77. //
  78. // Flags for IO Functions, supported for IO Funcs.
  79. //  TF means ServerSupportFunction( HSE_REQ_TRANSMIT_FILE)
  80. //
  81.  
  82. # define HSE_IO_SYNC                      0x00000001   // for WriteClient
  83. # define HSE_IO_ASYNC                     0x00000002   // for WriteClient/TF
  84. # define HSE_IO_DISCONNECT_AFTER_SEND     0x00000004   // for TF
  85. # define HSE_IO_SEND_HEADERS              0x00000008   // for TF
  86.  
  87.  
  88.  
  89. //
  90. // passed to GetExtensionVersion
  91. //
  92.  
  93. typedef struct   _HSE_VERSION_INFO {
  94.  
  95.     DWORD  dwExtensionVersion;
  96.     CHAR   lpszExtensionDesc[HSE_MAX_EXT_DLL_NAME_LEN];
  97.  
  98. } HSE_VERSION_INFO, *LPHSE_VERSION_INFO;
  99.  
  100.  
  101.  
  102.  
  103. //
  104. // passed to extension procedure on a new request
  105. //
  106. typedef struct _EXTENSION_CONTROL_BLOCK {
  107.  
  108.     DWORD     cbSize;                 // size of this struct.
  109.     DWORD     dwVersion;              // version info of this spec
  110.     HCONN     ConnID;                 // Context number not to be modified!
  111.     DWORD     dwHttpStatusCode;       // HTTP Status code
  112.     CHAR      lpszLogData[HSE_LOG_BUFFER_LEN];// null terminated log info specific to this Extension DLL
  113.  
  114.     LPSTR     lpszMethod;             // REQUEST_METHOD
  115.     LPSTR     lpszQueryString;        // QUERY_STRING
  116.     LPSTR     lpszPathInfo;           // PATH_INFO
  117.     LPSTR     lpszPathTranslated;     // PATH_TRANSLATED
  118.  
  119.     DWORD     cbTotalBytes;           // Total bytes indicated from client
  120.     DWORD     cbAvailable;            // Available number of bytes
  121.     LPBYTE    lpbData;                // pointer to cbAvailable bytes
  122.  
  123.     LPSTR     lpszContentType;        // Content type of client data
  124.  
  125.     BOOL (WINAPI * GetServerVariable) ( HCONN       hConn,
  126.                                         LPSTR       lpszVariableName,
  127.                                         LPVOID      lpvBuffer,
  128.                                         LPDWORD     lpdwSize );
  129.  
  130.     BOOL (WINAPI * WriteClient)  ( HCONN      ConnID,
  131.                                    LPVOID     Buffer,
  132.                                    LPDWORD    lpdwBytes,
  133.                                    DWORD      dwReserved );
  134.  
  135.     BOOL (WINAPI * ReadClient)  ( HCONN      ConnID,
  136.                                   LPVOID     lpvBuffer,
  137.                                   LPDWORD    lpdwSize );
  138.  
  139.     BOOL (WINAPI * ServerSupportFunction)( HCONN      hConn,
  140.                                            DWORD      dwHSERRequest,
  141.                                            LPVOID     lpvBuffer,
  142.                                            LPDWORD    lpdwSize,
  143.                                            LPDWORD    lpdwDataType );
  144.  
  145. } EXTENSION_CONTROL_BLOCK, *LPEXTENSION_CONTROL_BLOCK;
  146.  
  147. //
  148. //  these are the prototypes that must be exported from the extension DLL
  149. //
  150.  
  151. BOOL  WINAPI   GetExtensionVersion( HSE_VERSION_INFO  *pVer );
  152. DWORD WINAPI   HttpExtensionProc(  EXTENSION_CONTROL_BLOCK *pECB );
  153. BOOL  WINAPI   TerminateExtension( DWORD dwFlags );
  154.  
  155. // the following type declarations is for the server side
  156.  
  157. typedef BOOL  (WINAPI * PFN_GETEXTENSIONVERSION)( HSE_VERSION_INFO  *pVer );
  158. typedef DWORD (WINAPI * PFN_HTTPEXTENSIONPROC )( EXTENSION_CONTROL_BLOCK *pECB );
  159. typedef BOOL  (WINAPI * PFN_TERMINATEEXTENSION )( DWORD dwFlags );
  160.  
  161. typedef VOID
  162.   (WINAPI * PFN_HSE_IO_COMPLETION)(
  163.                                    IN EXTENSION_CONTROL_BLOCK * pECB,
  164.                                    IN PVOID    pContext,
  165.                                    IN DWORD    cbIO,
  166.                                    IN DWORD    dwError
  167.                                    );
  168.  
  169.  
  170.  
  171.  
  172. //
  173. // HSE_TF_INFO defines the type for HTTP SERVER EXTENSION support for
  174. //  ISAPI applications to send files using TransmitFile.
  175. // A pointer to this object should be used with ServerSupportFunction()
  176. //  for HSE_REQ_TRANSMIT_FILE.
  177. //
  178.  
  179. typedef struct _HSE_TF_INFO  {
  180.  
  181.     //
  182.     // callback and context information
  183.     // the callback function will be called when IO is completed.
  184.     // the context specified will be used during such callback.
  185.     //
  186.     // These values (if non-NULL) will override the one set by calling
  187.     //  ServerSupportFunction() with HSE_REQ_IO_COMPLETION
  188.     //
  189.     PFN_HSE_IO_COMPLETION   pfnHseIO;
  190.     PVOID  pContext;
  191.  
  192.     // file should have been opened with FILE_FLAG_SEQUENTIAL_SCAN
  193.     HANDLE hFile;
  194.  
  195.     //
  196.     // HTTP header and status code
  197.     // These fields are used only if HSE_IO_SEND_HEADERS is present in dwFlags
  198.     //
  199.  
  200.     LPCSTR pszStatusCode; // HTTP Status Code  eg: "200 OK"
  201.  
  202.     DWORD  BytesToWrite;  // special value of "0" means write entire file.
  203.     DWORD  Offset;        // offset value within the file to start from
  204.  
  205.     PVOID  pHead;         // Head buffer to be sent before file data
  206.     DWORD  HeadLength;    // header length
  207.     PVOID  pTail;         // Tail buffer to be sent after file data
  208.     DWORD  TailLength;    // tail length
  209.  
  210.     DWORD  dwFlags;       // includes HSE_IO_DISCONNECT_AFTER_SEND, ...
  211.  
  212. } HSE_TF_INFO, * LPHSE_TF_INFO;
  213.  
  214.  
  215.  
  216.  
  217.  
  218. #ifdef __cplusplus
  219. }
  220. #endif
  221.  
  222. #endif  // end definition _HTTPEXT_H_
  223.