Annotation of parser3/src/targets/apache/pa_httpd.h, revision 1.3
1.1 moko 1: /** @file
2: Parser: http wrapper.
3:
4: Copyright (c) 2003 ArtLebedev Group (http://www.artlebedev.com)
5: Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
6: */
7:
8: #ifndef PA_HTTPD_H
9: #define PA_HTTPD_H
10:
1.3 ! moko 11: static const char * const IDENT_HTTPD_H="$Date: 2010-11-14 22:44:23 $";
1.1 moko 12:
13: #ifdef __cplusplus
14: extern "C" {
15: #endif
16:
17: // import from c to c++
18:
19: typedef void pa_pool;
20: typedef void pa_server_rec;
21: typedef void pa_table;
22:
23: typedef struct pa_request_rec_tag {
24: void* real_request_rec;
25:
26: pa_pool* pool;
27: int header_only; /* HEAD request, as opposed to GET */
28: int* status;
29: const char *method; /* GET, HEAD, POST, etc. */
30:
31: pa_table *headers_out;
32: void* subprocess_env;
33: const char ** content_type;
34:
35: char *uri; /* the path portion of the URI */
1.2 moko 36: char *filename; /* filename if found, otherwise NULL */
1.1 moko 37: char *path_info;
38: char *args; /* QUERY_ARGS, if any */
1.3 ! moko 39: int file_not_found; /* non-zero if no such file */
1.1 moko 40: } pa_request_rec;
41:
42: /// apache parser module configuration [httpd.conf + .htaccess-es]
43: typedef struct Parser_module_config_tag {
44: const char* parser_config_filespec; ///< filespec of site's config file
45: } Parser_module_config;
46:
47: const char* pa_version();
48: void pa_setup_module_cells();
49: void pa_destroy_module_cells();
50: int pa_parser_handler(pa_request_rec*, Parser_module_config*);
51:
52: // export from c to c++
53:
54:
55: // http_log.h
56:
57: #define PA_APLOG_EMERG 0 /* system is unusable */
58: #define PA_APLOG_ALERT 1 /* action must be taken immediately */
59: #define PA_APLOG_CRIT 2 /* critical conditions */
60: #define PA_APLOG_ERR 3 /* error conditions */
1.3 ! moko 61: #define PA_APLOG_WARNING 4 /* warning conditions */
1.1 moko 62: #define PA_APLOG_NOTICE 5 /* normal but significant condition */
63: #define PA_APLOG_INFO 6 /* informational */
64: #define PA_APLOG_DEBUG 7 /* debug-level messages */
65:
1.3 ! moko 66: #define PA_APLOG_LEVELMASK 7 /* mask off the level value */
1.1 moko 67:
1.3 ! moko 68: #define PA_APLOG_NOERRNO (PA_APLOG_LEVELMASK + 1)
1.1 moko 69:
70: #define PA_APLOG_MARK __FILE__,__LINE__
71:
72: void pa_ap_log_rerror(const char *file, int line, int level,
73: const pa_request_rec *s, const char *fmt, ...);
74:
75:
76: void pa_ap_log_error(const char *file, int line, int level,
77: const pa_server_rec *s, const char *fmt, ...);
78:
79: // ap_alloc.h
80:
81: const char * pa_ap_table_get(const pa_table *, const char *);
82: void pa_ap_table_addn(pa_table *, const char *name, const char *val);
83:
84: int pa_ap_table_size(const pa_table *);
85:
86: void pa_ap_table_do(int (*comp) (void *, const char *, const char *),
87: void *rec, const pa_table *t,...);
88:
89: char * pa_ap_pstrdup(pa_pool *, const char *s);
90:
91: // http_protocol.h
92:
93: /* Possible values for request_rec.read_body (set by handling module):
94: * REQUEST_NO_BODY Send 413 error if message has any body
95: * REQUEST_CHUNKED_ERROR Send 411 error if body without Content-Length
96: * REQUEST_CHUNKED_DECHUNK If chunked, remove the chunks for me.
97: * REQUEST_CHUNKED_PASS Pass the chunks to me without removal.
98: */
99: #define PA_REQUEST_NO_BODY 0
100: #define PA_REQUEST_CHUNKED_ERROR 1
101: #define PA_REQUEST_CHUNKED_DECHUNK 2
102: #define PA_REQUEST_CHUNKED_PASS 3
103:
104: int pa_ap_setup_client_block(pa_request_rec *r, int read_policy);
105: int pa_ap_should_client_block(pa_request_rec *r);
106: long pa_ap_get_client_block(pa_request_rec *r, char *buffer, int bufsiz);
107: void pa_ap_send_http_header(pa_request_rec *l);
108: int pa_ap_rwrite(const void *buf, int nbyte, pa_request_rec *r);
109:
110:
111: // http_main.h
112:
113: void pa_ap_hard_timeout(char *, pa_request_rec *);
114: void pa_ap_reset_timeout(pa_request_rec *);
115: void pa_ap_kill_timeout(pa_request_rec *);
116:
117:
118: // util_script.h
119:
120: void pa_ap_add_cgi_vars(pa_request_rec *r);
121: void pa_ap_add_common_vars(pa_request_rec *r);
122:
123: // httpd.h
124:
125: #define PA_HTTP_NOT_FOUND 404
126: #define PA_OK 0 /* Module has handled this stage. */
127:
128: // signal.h
129:
130: #define PA_SIGPIPE 1 /* must translate to real one */
131: #define PA_SIG_IGN (void (*)(int))1 /* must translate to real one */
132:
133: void (*pa_signal (int sig, void (*disp)(int)))(int);
134:
135: // ap_md5.h
136:
137: #define PA_MD5_DIGESTSIZE 16
138: typedef void PA_MD5_CTX;
139:
140: void pa_MD5Init(PA_MD5_CTX *context);
141: void pa_MD5Update(PA_MD5_CTX *context, const unsigned char *input,
142: unsigned int inputLen);
143: void pa_MD5Final(unsigned char digest[PA_MD5_DIGESTSIZE],
144: PA_MD5_CTX *context);
145: void pa_MD5Encode(const unsigned char *password,
146: const unsigned char *salt,
147: char *result, size_t nbytes);
148: void pa_to64(char *s, unsigned long v, int n);
149:
150:
151: #ifdef __cplusplus
152: }
153: #endif
154:
155: #endif
E-mail: