223 lines
7.4 KiB
C++
223 lines
7.4 KiB
C++
|
/********
|
||
|
*
|
||
|
* Copyright (c) 1995 Process Software Corporation
|
||
|
*
|
||
|
* Copyright (c) 1995-1996 Microsoft Corporation
|
||
|
*
|
||
|
*
|
||
|
* Module Name : HttpExt.h
|
||
|
*
|
||
|
* Abstract :
|
||
|
*
|
||
|
* This module contains the structure definitions and prototypes for the
|
||
|
* version 2.0 HTTP Server Extension interface.
|
||
|
*
|
||
|
******************/
|
||
|
|
||
|
#ifndef _HTTPEXT_H_
|
||
|
#define _HTTPEXT_H_
|
||
|
|
||
|
#include <windows.h>
|
||
|
|
||
|
#ifdef __cplusplus
|
||
|
extern "C" {
|
||
|
#endif
|
||
|
|
||
|
#define HSE_VERSION_MAJOR 2 // major version of this spec
|
||
|
#define HSE_VERSION_MINOR 0 // minor version of this spec
|
||
|
#define HSE_LOG_BUFFER_LEN 80
|
||
|
#define HSE_MAX_EXT_DLL_NAME_LEN 256
|
||
|
|
||
|
typedef LPVOID HCONN;
|
||
|
|
||
|
// the following are the status codes returned by the Extension DLL
|
||
|
|
||
|
#define HSE_STATUS_SUCCESS 1
|
||
|
#define HSE_STATUS_SUCCESS_AND_KEEP_CONN 2
|
||
|
#define HSE_STATUS_PENDING 3
|
||
|
#define HSE_STATUS_ERROR 4
|
||
|
|
||
|
// The following are the values to request services with the ServerSupportFunction.
|
||
|
// Values from 0 to 1000 are reserved for future versions of the interface
|
||
|
|
||
|
#define HSE_REQ_BASE 0
|
||
|
#define HSE_REQ_SEND_URL_REDIRECT_RESP ( HSE_REQ_BASE + 1 )
|
||
|
#define HSE_REQ_SEND_URL ( HSE_REQ_BASE + 2 )
|
||
|
#define HSE_REQ_SEND_RESPONSE_HEADER ( HSE_REQ_BASE + 3 )
|
||
|
#define HSE_REQ_DONE_WITH_SESSION ( HSE_REQ_BASE + 4 )
|
||
|
#define HSE_REQ_END_RESERVED 1000
|
||
|
|
||
|
//
|
||
|
// These are Microsoft specific extensions
|
||
|
//
|
||
|
|
||
|
#define HSE_REQ_MAP_URL_TO_PATH (HSE_REQ_END_RESERVED+1)
|
||
|
#define HSE_REQ_GET_SSPI_INFO (HSE_REQ_END_RESERVED+2)
|
||
|
#define HSE_APPEND_LOG_PARAMETER (HSE_REQ_END_RESERVED+3)
|
||
|
#define HSE_REQ_SEND_URL_EX (HSE_REQ_END_RESERVED+4)
|
||
|
#define HSE_REQ_IO_COMPLETION (HSE_REQ_END_RESERVED+5)
|
||
|
#define HSE_REQ_TRANSMIT_FILE (HSE_REQ_END_RESERVED+6)
|
||
|
#define HSE_REQ_REFRESH_ISAPI_ACL (HSE_REQ_END_RESERVED+7)
|
||
|
|
||
|
//
|
||
|
// Bit Flags for TerminateExtension
|
||
|
//
|
||
|
// HSE_TERM_ADVISORY_UNLOAD - Server wants to unload the extension,
|
||
|
// extension can return TRUE if OK, FALSE if the server should not
|
||
|
// unload the extension
|
||
|
//
|
||
|
// HSE_TERM_MUST_UNLOAD - Server indicating the extension is about to be
|
||
|
// unloaded, the extension cannot refuse.
|
||
|
//
|
||
|
|
||
|
#define HSE_TERM_ADVISORY_UNLOAD 0x00000001
|
||
|
#define HSE_TERM_MUST_UNLOAD 0x00000002
|
||
|
|
||
|
|
||
|
//
|
||
|
// Flags for IO Functions, supported for IO Funcs.
|
||
|
// TF means ServerSupportFunction( HSE_REQ_TRANSMIT_FILE)
|
||
|
//
|
||
|
|
||
|
# define HSE_IO_SYNC 0x00000001 // for WriteClient
|
||
|
# define HSE_IO_ASYNC 0x00000002 // for WriteClient/TF
|
||
|
# define HSE_IO_DISCONNECT_AFTER_SEND 0x00000004 // for TF
|
||
|
# define HSE_IO_SEND_HEADERS 0x00000008 // for TF
|
||
|
|
||
|
|
||
|
|
||
|
//
|
||
|
// passed to GetExtensionVersion
|
||
|
//
|
||
|
|
||
|
typedef struct _HSE_VERSION_INFO {
|
||
|
|
||
|
DWORD dwExtensionVersion;
|
||
|
CHAR lpszExtensionDesc[HSE_MAX_EXT_DLL_NAME_LEN];
|
||
|
|
||
|
} HSE_VERSION_INFO, *LPHSE_VERSION_INFO;
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
//
|
||
|
// passed to extension procedure on a new request
|
||
|
//
|
||
|
typedef struct _EXTENSION_CONTROL_BLOCK {
|
||
|
|
||
|
DWORD cbSize; // size of this struct.
|
||
|
DWORD dwVersion; // version info of this spec
|
||
|
HCONN ConnID; // Context number not to be modified!
|
||
|
DWORD dwHttpStatusCode; // HTTP Status code
|
||
|
CHAR lpszLogData[HSE_LOG_BUFFER_LEN];// null terminated log info specific to this Extension DLL
|
||
|
|
||
|
LPSTR lpszMethod; // REQUEST_METHOD
|
||
|
LPSTR lpszQueryString; // QUERY_STRING
|
||
|
LPSTR lpszPathInfo; // PATH_INFO
|
||
|
LPSTR lpszPathTranslated; // PATH_TRANSLATED
|
||
|
|
||
|
DWORD cbTotalBytes; // Total bytes indicated from client
|
||
|
DWORD cbAvailable; // Available number of bytes
|
||
|
LPBYTE lpbData; // pointer to cbAvailable bytes
|
||
|
|
||
|
LPSTR lpszContentType; // Content type of client data
|
||
|
|
||
|
BOOL (WINAPI * GetServerVariable) ( HCONN hConn,
|
||
|
LPSTR lpszVariableName,
|
||
|
LPVOID lpvBuffer,
|
||
|
LPDWORD lpdwSize );
|
||
|
|
||
|
BOOL (WINAPI * WriteClient) ( HCONN ConnID,
|
||
|
LPVOID Buffer,
|
||
|
LPDWORD lpdwBytes,
|
||
|
DWORD dwReserved );
|
||
|
|
||
|
BOOL (WINAPI * ReadClient) ( HCONN ConnID,
|
||
|
LPVOID lpvBuffer,
|
||
|
LPDWORD lpdwSize );
|
||
|
|
||
|
BOOL (WINAPI * ServerSupportFunction)( HCONN hConn,
|
||
|
DWORD dwHSERRequest,
|
||
|
LPVOID lpvBuffer,
|
||
|
LPDWORD lpdwSize,
|
||
|
LPDWORD lpdwDataType );
|
||
|
|
||
|
} EXTENSION_CONTROL_BLOCK, *LPEXTENSION_CONTROL_BLOCK;
|
||
|
|
||
|
//
|
||
|
// these are the prototypes that must be exported from the extension DLL
|
||
|
//
|
||
|
|
||
|
BOOL WINAPI GetExtensionVersion( HSE_VERSION_INFO *pVer );
|
||
|
DWORD WINAPI HttpExtensionProc( EXTENSION_CONTROL_BLOCK *pECB );
|
||
|
BOOL WINAPI TerminateExtension( DWORD dwFlags );
|
||
|
|
||
|
// the following type declarations is for the server side
|
||
|
|
||
|
typedef BOOL (WINAPI * PFN_GETEXTENSIONVERSION)( HSE_VERSION_INFO *pVer );
|
||
|
typedef DWORD (WINAPI * PFN_HTTPEXTENSIONPROC )( EXTENSION_CONTROL_BLOCK *pECB );
|
||
|
typedef BOOL (WINAPI * PFN_TERMINATEEXTENSION )( DWORD dwFlags );
|
||
|
|
||
|
typedef VOID
|
||
|
(WINAPI * PFN_HSE_IO_COMPLETION)(
|
||
|
IN EXTENSION_CONTROL_BLOCK * pECB,
|
||
|
IN PVOID pContext,
|
||
|
IN DWORD cbIO,
|
||
|
IN DWORD dwError
|
||
|
);
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
//
|
||
|
// HSE_TF_INFO defines the type for HTTP SERVER EXTENSION support for
|
||
|
// ISAPI applications to send files using TransmitFile.
|
||
|
// A pointer to this object should be used with ServerSupportFunction()
|
||
|
// for HSE_REQ_TRANSMIT_FILE.
|
||
|
//
|
||
|
|
||
|
typedef struct _HSE_TF_INFO {
|
||
|
|
||
|
//
|
||
|
// callback and context information
|
||
|
// the callback function will be called when IO is completed.
|
||
|
// the context specified will be used during such callback.
|
||
|
//
|
||
|
// These values (if non-NULL) will override the one set by calling
|
||
|
// ServerSupportFunction() with HSE_REQ_IO_COMPLETION
|
||
|
//
|
||
|
PFN_HSE_IO_COMPLETION pfnHseIO;
|
||
|
PVOID pContext;
|
||
|
|
||
|
// file should have been opened with FILE_FLAG_SEQUENTIAL_SCAN
|
||
|
HANDLE hFile;
|
||
|
|
||
|
//
|
||
|
// HTTP header and status code
|
||
|
// These fields are used only if HSE_IO_SEND_HEADERS is present in dwFlags
|
||
|
//
|
||
|
|
||
|
LPCSTR pszStatusCode; // HTTP Status Code eg: "200 OK"
|
||
|
|
||
|
DWORD BytesToWrite; // special value of "0" means write entire file.
|
||
|
DWORD Offset; // offset value within the file to start from
|
||
|
|
||
|
PVOID pHead; // Head buffer to be sent before file data
|
||
|
DWORD HeadLength; // header length
|
||
|
PVOID pTail; // Tail buffer to be sent after file data
|
||
|
DWORD TailLength; // tail length
|
||
|
|
||
|
DWORD dwFlags; // includes HSE_IO_DISCONNECT_AFTER_SEND, ...
|
||
|
|
||
|
} HSE_TF_INFO, * LPHSE_TF_INFO;
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
#ifdef __cplusplus
|
||
|
}
|
||
|
#endif
|
||
|
|
||
|
#endif // end definition _HTTPEXT_H_
|