xref: /PHP-5.6/sapi/pi3web/pi3web_sapi.h (revision 240fa244)
1 #ifndef _PI3WEB_SAPI_H_
2 #define _PI3WEB_SAPI_H_
3 
4 #ifdef PHP_WIN32
5 #	include <windows.h>
6 #	ifdef PHP5PI3WEB_EXPORTS
7 #		define MODULE_API __declspec(dllexport)
8 #	else
9 #		define MODULE_API __declspec(dllimport)
10 #	endif
11 #else
12 #	if defined(__GNUC__) && __GNUC__ >= 4
13 #		define MODULE_API __attribute__ ((visibility("default")))
14 #	else
15 #		define MODULE_API
16 #	endif
17 #	define far
18 
19 	typedef int BOOL;
20 	typedef void far *LPVOID;
21 	typedef unsigned long DWORD;
22 	typedef DWORD far *LPDWORD;
23 	typedef char CHAR;
24 	typedef CHAR *LPSTR;
25 	typedef unsigned char BYTE;
26 	typedef BYTE far *LPBYTE;
27 #endif
28 
29 	typedef LPVOID HCONN;
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 #define PHP_MODE_STANDARD  1
36 #define PHP_MODE_HIGHLIGHT 2
37 #define PHP_MODE_INDENT    3
38 #define PHP_MODE_LINT	   4
39 
40 //
41 // passed to the procedure on a new request
42 //
43 typedef struct _CONTROL_BLOCK {
44     DWORD     cbSize;                 // size of this struct.
45     HCONN     ConnID;                 // Context number not to be modified!
46     DWORD     dwHttpStatusCode;       // HTTP Status code
47     CHAR      lpszLogData[80];        // null terminated log info
48 
49     LPSTR     lpszMethod;             // REQUEST_METHOD
50     LPSTR     lpszQueryString;        // QUERY_STRING
51     LPSTR     lpszPathInfo;           // PATH_INFO
52     LPSTR     lpszPathTranslated;     // PATH_TRANSLATED
53 	LPSTR     lpszFileName;           // FileName to PHP3 physical file
54 	LPSTR     lpszUri;		          // The request URI
55 	LPSTR     lpszReq;		          // The whole HTTP request line
56 	LPSTR     lpszUser;		          // The authenticated user
57 	LPSTR     lpszPassword;	          // The authenticated password
58 
59     DWORD     cbTotalBytes;           // Total bytes indicated from client
60     DWORD     cbAvailable;            // Available number of bytes
61     LPBYTE    lpbData;                // pointer to cbAvailable bytes
62 
63     LPSTR     lpszContentType;        // Content type of client data
64 	DWORD     dwBehavior;			  // PHP behavior (standard, highlight, intend
65 
66 
67     LPVOID (* GetVariableNames) (HCONN      hConn);
68 
69     BOOL (* GetServerVariable) ( HCONN       hConn,
70                                  LPSTR       lpszVariableName,
71                                  LPVOID      lpvBuffer,
72                                  LPDWORD     lpdwSize );
73 
74     BOOL (* WriteClient)  ( HCONN      hConn,
75                             LPVOID     lpvBuffer,
76                             LPDWORD    lpdwBytes,
77                             DWORD      dwReserved );
78 
79     BOOL (* ReadClient)  ( HCONN      hConn,
80                            LPVOID     lpvBuffer,
81                            LPDWORD    lpdwSize );
82 
83     BOOL (* SendHeaderFunction)( HCONN      hConn,
84                                  LPDWORD    lpdwSize,
85                                  LPDWORD    lpdwDataType );
86 
87 } CONTROL_BLOCK, *LPCONTROL_BLOCK;
88 
89 MODULE_API DWORD PHP5_wrapper(LPCONTROL_BLOCK lpCB);
90 MODULE_API BOOL PHP5_startup();
91 MODULE_API BOOL PHP5_shutdown();
92 
93 // the following type declaration is for the server side
94 typedef DWORD ( * PFN_WRAPPERFUNC )( CONTROL_BLOCK *pCB );
95 
96 
97 
98 #ifdef __cplusplus
99 }
100 #endif
101 
102 #endif  // end definition _PI3WEB_SAPI_H_
103