summaryrefslogtreecommitdiff
path: root/main/SAPI.h
blob: feddbc3bbc6f2bdc1168eee334dc77e43fce813a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef _NEW_SAPI_H
#define _NEW_SAPI_H


#if WIN32||WINNT
#	ifdef SAPI_EXPORTS
#	define SAPI_API __declspec(dllexport) 
#	else
#	define SAPI_API __declspec(dllimport) 
#	endif
#else
#define SAPI_API
#endif


typedef struct _sapi_module_struct {
	char *name;

	int (*startup)(struct _sapi_module_struct *sapi_module);
	int (*shutdown)(struct _sapi_module_struct *sapi_module);

	int (*ub_write)(const char *str, unsigned int str_length);
} sapi_module_struct;


extern sapi_module_struct sapi_module;  /* true global */


typedef struct {
	char *path_translated;
	char *query_string;
} sapi_request_info;


typedef struct {
	void *server_context;
	sapi_request_info request_info;
} sapi_globals_struct;


SAPI_API void sapi_startup(sapi_module_struct *sf);

#ifdef ZTS
# define SLS_D	sapi_globals_struct *sapi_globals
# define SLS_DC	, SLS_D
# define SLS_C	sapi_globals
# define SLS_CC , SLS_C
# define SG(v) (sapi_globals->v)
# define SLS_FETCH()	sapi_globals_struct *sapi_globals = ts_resource(sapi_globals_id)
SAPI_API extern int sapi_globals_id;
#else
# define SLS_D
# define SLS_DC
# define SLS_C
# define SLS_CC
# define SG(v) (sapi_globals.v)
# define SLS_FETCH()
extern SAPI_API sapi_globals_struct sapi_globals;
#endif


#endif /* _NEW_SAPI_H */