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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
/*
Server API Abstraction Layer
This set of functions is required to create a new
api interface for php. These functions map
functions that would be used in cgi to server
specific api's
Some functions are specific to php so that the main
php module may obtain information from the server
*/
#ifndef _PHP3_SAPI_H_
#define _PHP3_SAPI_H_
struct sapi_request_info{
void *scid; /* request identifier */
char *filename;
char *path_info;
char *path_translated;
char *query_string;
char *request_method;
char *script_name;
char *current_user;
int current_user_length;
unsigned int content_length;
char *content_type;
char *cookies;
int cgi, display_source_mode,preprocess,info_only,quiet_mode;
char *argv0,*ini_path;
void (*info)(void *);
void (*puts)(void * , char *);
void (*putc)(void * , char);
char *(*getenv)(void * , char *);
int (*writeclient)(void * , char *, int);
void (*flush)(void * ); /*flush writes to client*/
void (*header)(void * , char *); /*write headers to client*/
int (*readclient)(void * , char *, int , int );
void (*block)(void *); /*signal blocking*/
void (*unblock)(void *); /*signal blocking*/
void (*log)(void *, char *); /*use server error log*/
};
#if !SAPI_INTERFACE
#if !defined(COMPILE_DL)
#define PUTS(a) GLOBAL(sapi_rqst)->puts(GLOBAL(sapi_rqst)->scid,(a))
#define PUTC(a) GLOBAL(sapi_rqst)->putc(GLOBAL(sapi_rqst)->scid,(a))
#define PHPWRITE(a,n) GLOBAL(sapi_rqst)->writeclient(GLOBAL(sapi_rqst)->scid,(a),(n))
#define BLOCK_INTERRUPTIONS
#define UNBLOCK_INTERRUPTIONS
/*
#define BLOCK_INTERRUPTIONS GLOBAL(sapi_rqst)->block(GLOBAL(sapi_rqst)->scid)
#define UNBLOCK_INTERRUPTIONS GLOBAL(sapi_rqst)->unblock(GLOBAL(sapi_rqst)->scid)
*/
#endif
#endif
/*emulates puts*/
extern void sapi_puts(void * scid, char *);
/*emulates putc*/
extern void sapi_putc(void * scid, char);
/*emulates getenv*/
extern char *sapi_getenv(void * scid, char *);
/*writes a string to the client*/
extern int sapi_writeclient(void * scid, char *, int);
/*flushes any writes to the client*/
extern void sapi_flush(void * scid);
/*sends a header to the client, adds \n\r to the end*/
extern void sapi_header(void * scid, char *header);
/*reads info from the client, used to get post*/
extern int sapi_readclient(void * scid, char *buf, int size, int len);
/*signal blocking so a signal doesnt interrupt us in a bad place (used in apache) */
extern void sapi_block(void *);
extern void sapi_unblock(void *);
/*logs messages to servers error log*/
extern void sapi_log(void *scid, char *log_message);
/* this is the main function in main.c Initialization
* may be required before calling this function.
*/
extern PHPAPI int php3_sapi_main(struct sapi_request_info *sapi_info);
extern void sapi_print_info(void *);
#endif
|