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