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 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469
|
.TH "src/apreq_env.h" 3 "30 Aug 2004" "Version 2.04-dev" "libapreq2" \" -*- nroff -*-
.ad l
.nh
.SH NAME
src/apreq_env.h \- Logging and environment (module) declarations.
.SH SYNOPSIS
.br
.PP
\fC#include 'apreq_params.h'\fP
.br
\fC#include 'apreq_cookie.h'\fP
.br
\fC#include <stdarg.h>\fP
.br
.SS "Data Structures"
.in +1c
.ti -1c
.RI "struct \fBapreq_env_t\fP"
.br
.RI "\fIVtable describing the necessary environment functions. \fP"
.in -1c
.SS "Defines"
.in +1c
.ti -1c
.RI "#define \fBAPREQ_LOG_EMERG\fP 0"
.br
.ti -1c
.RI "#define \fBAPREQ_LOG_ALERT\fP 1"
.br
.ti -1c
.RI "#define \fBAPREQ_LOG_CRIT\fP 2"
.br
.ti -1c
.RI "#define \fBAPREQ_LOG_ERR\fP 3"
.br
.ti -1c
.RI "#define \fBAPREQ_LOG_WARNING\fP 4"
.br
.ti -1c
.RI "#define \fBAPREQ_LOG_NOTICE\fP 5"
.br
.ti -1c
.RI "#define \fBAPREQ_LOG_INFO\fP 6"
.br
.ti -1c
.RI "#define \fBAPREQ_LOG_DEBUG\fP 7"
.br
.ti -1c
.RI "#define \fBAPREQ_LOG_LEVELMASK\fP 7"
.br
.ti -1c
.RI "#define \fBAPREQ_LOG_MARK\fP __FILE__ , __LINE__"
.br
.ti -1c
.RI "#define \fBAPREQ_DEBUG\fP APREQ_LOG_MARK, APREQ_LOG_DEBUG,"
.br
.ti -1c
.RI "#define \fBAPREQ_WARN\fP APREQ_LOG_MARK, APREQ_LOG_WARNING,"
.br
.ti -1c
.RI "#define \fBAPREQ_ERROR\fP APREQ_LOG_MARK, APREQ_LOG_ERR,"
.br
.ti -1c
.RI "#define \fBapreq_env_content_type\fP(env) apreq_env_header_in(env, 'Content-Type')"
.br
.ti -1c
.RI "#define \fBapreq_env_cookie\fP(env) apreq_env_header_in(env, 'Cookie')"
.br
.ti -1c
.RI "#define \fBapreq_env_cookie2\fP(env) apreq_env_header_in(env, 'Cookie2')"
.br
.ti -1c
.RI "#define \fBapreq_env_set_cookie\fP(e, s) apreq_env_header_out(e,'Set-Cookie',s)"
.br
.ti -1c
.RI "#define \fBapreq_env_set_cookie2\fP(e, s) apreq_env_header_out(e,'Set-Cookie2',s)"
.br
.ti -1c
.RI "#define \fBAPREQ_ENV_MODULE\fP(pre, name, mmn)"
.br
.ti -1c
.RI "#define \fBapreq_env_name\fP (apreq_env_module(NULL)->name)"
.br
.ti -1c
.RI "#define \fBapreq_env_magic_number\fP (apreq_env_module(NULL)->magic_number)"
.br
.in -1c
.SS "Typedefs"
.in +1c
.ti -1c
.RI "typedef \fBapreq_env_t\fP \fBapreq_env_t\fP"
.br
.RI "\fIVtable describing the necessary environment functions. \fP"
.in -1c
.SS "Functions"
.in +1c
.ti -1c
.RI "void \fBapreq_log\fP (const char *file, int line, int level, \fBapr_status_t\fP status, void *env, const char *fmt,...)"
.br
.ti -1c
.RI "\fBapr_pool_t\fP * \fBapreq_env_pool\fP (void *env)"
.br
.ti -1c
.RI "\fBapreq_jar_t\fP * \fBapreq_env_jar\fP (void *env, \fBapreq_jar_t\fP *jar)"
.br
.ti -1c
.RI "\fBapreq_request_t\fP * \fBapreq_env_request\fP (void *env, \fBapreq_request_t\fP *req)"
.br
.ti -1c
.RI "const char * \fBapreq_env_query_string\fP (void *env)"
.br
.ti -1c
.RI "const char * \fBapreq_env_header_in\fP (void *env, const char *name)"
.br
.ti -1c
.RI "\fBapr_status_t\fP \fBapreq_env_header_out\fP (void *env, const char *name, char *val)"
.br
.ti -1c
.RI "\fBapr_status_t\fP \fBapreq_env_read\fP (void *env, \fBapr_read_type_e\fP block, \fBapr_off_t\fP bytes)"
.br
.ti -1c
.RI "const char * \fBapreq_env_temp_dir\fP (void *env, const char *path)"
.br
.ti -1c
.RI "\fBapr_off_t\fP \fBapreq_env_max_body\fP (void *env, \fBapr_off_t\fP bytes)"
.br
.ti -1c
.RI "\fBapr_ssize_t\fP \fBapreq_env_max_brigade\fP (void *env, \fBapr_ssize_t\fP bytes)"
.br
.ti -1c
.RI "const \fBapreq_env_t\fP * \fBapreq_env_module\fP (const \fBapreq_env_t\fP *mod)"
.br
.in -1c
.SH "Detailed Description"
.PP
Logging and environment (module) declarations.
.SH "Define Documentation"
.PP
.SS "#define apreq_env_content_type(env) apreq_env_header_in(env, 'Content-Type')"
.PP
Fetch the environment's 'Content-Type' header.
.PP
\fBParameters:\fP
.RS 4
\fIenv\fP The current environment.
.RE
.PP
\fBReturns:\fP
.RS 4
The value of the Content-Type header, NULL if not found.
.RE
.PP
.SS "#define apreq_env_cookie(env) apreq_env_header_in(env, 'Cookie')"
.PP
Fetch the environment's 'Cookie' header.
.PP
\fBParameters:\fP
.RS 4
\fIenv\fP The current environment.
.RE
.PP
\fBReturns:\fP
.RS 4
The value of the 'Cookie' header, NULL if not found.
.RE
.PP
.SS "#define apreq_env_cookie2(env) apreq_env_header_in(env, 'Cookie2')"
.PP
Fetch the environment's 'Cookie2' header.
.PP
\fBParameters:\fP
.RS 4
\fIenv\fP The current environment.
.RE
.PP
\fBReturns:\fP
.RS 4
The value of the 'Cookie2' header, NULL if not found.
.RE
.PP
.SS "#define apreq_env_magic_number (apreq_env_module(NULL)->magic_number)"
.PP
The current environment's magic (ie. version) number.
.SS "#define APREQ_ENV_MODULE(pre, name, mmn)"
.PP
\fBValue:\fP
.PP
.nf
const apreq_env_t pre##_module = { \
name, mmn, pre##_log, pre##_pool, pre##_jar, pre##_request, \
pre##_query_string, pre##_header_in, pre##_header_out, pre##_read, \
pre##_temp_dir, pre##_max_body, pre##_max_brigade }
.fi
Convenience macro for defining an environment module by mapping a function prefix to an associated environment structure.
.PP
\fBParameters:\fP
.RS 4
\fIpre\fP Prefix to define new environment. All attributes of the \fBapreq_env_t\fP struct are defined with this as their prefix. The generated struct is named by appending '_module' to the prefix.
.br
\fIname\fP Name of this environment.
.br
\fImmn\fP Magic number (i.e. version number) of this environment.
.RE
.PP
.SS "#define apreq_env_name (apreq_env_module(NULL)->name)"
.PP
The current environment's name.
.SS "#define apreq_env_set_cookie(e, s) apreq_env_header_out(e,'Set-Cookie',s)"
.PP
Add a 'Set-Cookie' header to the outgoing response headers.
.PP
\fBParameters:\fP
.RS 4
\fIe\fP The current environment.
.br
\fIs\fP The cookie string.
.RE
.PP
\fBReturns:\fP
.RS 4
APR_SUCCESS on success, error code otherwise.
.RE
.PP
.SS "#define apreq_env_set_cookie2(e, s) apreq_env_header_out(e,'Set-Cookie2',s)"
.PP
Add a 'Set-Cookie2' header to the outgoing response headers.
.PP
\fBParameters:\fP
.RS 4
\fIe\fP The current environment.
.br
\fIs\fP The cookie string.
.RE
.PP
\fBReturns:\fP
.RS 4
APR_SUCCESS on success, error code otherwise.
.RE
.PP
.SH "Typedef Documentation"
.PP
.SS "typedef struct \fBapreq_env_t\fP \fBapreq_env_t\fP"
.PP
Vtable describing the necessary environment functions.
.PP
This must be fully defined for libapreq2 to operate properly in a given environment. Normally it is set once, with an \fBapreq_env_module()\fP call during process initialization, and should remain fixed thereafter.
.SH "Function Documentation"
.PP
.SS "const char* apreq_env_header_in (void * env, const char * name)"
.PP
Fetch the header value (joined by ', ' if there are multiple headers) for a given header name.
.PP
\fBParameters:\fP
.RS 4
\fIenv\fP The current environment.
.br
\fIname\fP The header name.
.RE
.PP
\fBReturns:\fP
.RS 4
The value of the header, NULL if not found.
.RE
.PP
.SS "\fBapr_status_t\fP apreq_env_header_out (void * env, const char * name, char * val)"
.PP
Add a header field to the environment's outgoing response headers
.PP
\fBParameters:\fP
.RS 4
\fIenv\fP The current environment.
.br
\fIname\fP The name of the outgoing header.
.br
\fIval\fP Value of the outgoing header.
.RE
.PP
\fBReturns:\fP
.RS 4
APR_SUCCESS on success, error code otherwise.
.RE
.PP
.SS "\fBapreq_jar_t\fP* apreq_env_jar (void * env, \fBapreq_jar_t\fP * jar)"
.PP
Get/set the jar currently associated to the environment.
.PP
\fBParameters:\fP
.RS 4
\fIenv\fP The current environment.
.br
\fIjar\fP New Jar to associate.
.RE
.PP
\fBReturns:\fP
.RS 4
The previous jar associated to the environment. jar == NULL gets the current jar, which will remain associated after the call.
.RE
.PP
.SS "\fBapr_off_t\fP apreq_env_max_body (void * env, \fBapr_off_t\fP bytes)"
.PP
Get/set the current max_body setting. This is the maximum amount of bytes that will be read into the environment's parser.
.PP
\fBParameters:\fP
.RS 4
\fIenv\fP The current environment.
.br
\fIbytes\fP The new max_body setting.
.RE
.PP
\fBReturns:\fP
.RS 4
The previous max_body setting. Note: a call using bytes == -1 fetches the current max_body setting without modifying it.
.RE
.PP
.SS "\fBapr_ssize_t\fP apreq_env_max_brigade (void * env, \fBapr_ssize_t\fP bytes)"
.PP
Get/set the current max_brigade setting. This is the maximum amount of heap-allocated buckets libapreq2 will use for its brigades. If additional buckets are necessary, they will be created from a temporary file.
.PP
\fBParameters:\fP
.RS 4
\fIenv\fP The current environment.
.br
\fIbytes\fP The new max_brigade setting.
.RE
.PP
\fBReturns:\fP
.RS 4
The previous max_brigade setting. Note: a call using bytes == -1 fetches the current max_brigade setting without modifying it.
.RE
.PP
.SS "const \fBapreq_env_t\fP* apreq_env_module (const \fBapreq_env_t\fP * mod)"
.PP
Get/set function for the active environment stucture. Usually this is called only once per process, to define the correct environment.
.PP
\fBParameters:\fP
.RS 4
\fImod\fP The new active environment.
.RE
.PP
\fBReturns:\fP
.RS 4
The previous active environment. Note: a call using mod == NULL fetches the current environment module without modifying it.
.RE
.PP
.SS "\fBapr_pool_t\fP* apreq_env_pool (void * env)"
.PP
Pool associated with the environment.
.PP
\fBParameters:\fP
.RS 4
\fIenv\fP The current environment
.RE
.PP
\fBReturns:\fP
.RS 4
The associated pool.
.RE
.PP
.SS "const char* apreq_env_query_string (void * env)"
.PP
Fetch the query string.
.PP
\fBParameters:\fP
.RS 4
\fIenv\fP The current environment.
.RE
.PP
\fBReturns:\fP
.RS 4
The query string.
.RE
.PP
.SS "\fBapr_status_t\fP apreq_env_read (void * env, \fBapr_read_type_e\fP block, \fBapr_off_t\fP bytes)"
.PP
Read data from the environment and into the current active parser.
.PP
\fBParameters:\fP
.RS 4
\fIenv\fP The current environment.
.br
\fIblock\fP Read type (APR_READ_BLOCK or APR_READ_NONBLOCK).
.br
\fIbytes\fP Maximum number of bytes to read.
.RE
.PP
\fBReturns:\fP
.RS 4
APR_INCOMPLETE if there's more data to read, APR_SUCCESS if everything was read & parsed successfully, error code otherwise.
.RE
.PP
.SS "\fBapreq_request_t\fP* apreq_env_request (void * env, \fBapreq_request_t\fP * req)"
.PP
Get/set the request currently associated to the environment.
.PP
\fBParameters:\fP
.RS 4
\fIenv\fP The current environment.
.br
\fIreq\fP New request to associate.
.RE
.PP
\fBReturns:\fP
.RS 4
The previous request associated to the environment. req == NULL gets the current request, which will remain associated after the call.
.RE
.PP
.SS "const char* apreq_env_temp_dir (void * env, const char * path)"
.PP
Get/set the current temporary directory.
.PP
\fBParameters:\fP
.RS 4
\fIenv\fP The current environment.
.br
\fIpath\fP The full pathname of the new directory.
.RE
.PP
\fBReturns:\fP
.RS 4
The path of the previous temporary directory. Note: a call using path==NULL fetches the current directory without resetting it to NULL.
.RE
.PP
.SS "void apreq_log (const char * file, int line, int level, \fBapr_status_t\fP status, void * env, const char * fmt, ...)"
.PP
Analog of Apache's ap_log_rerror().
.PP
\fBParameters:\fP
.RS 4
\fIfile\fP Filename to list in the log message.
.br
\fIline\fP Line number from the file.
.br
\fIlevel\fP Log level.
.br
\fIstatus\fP Status code.
.br
\fIenv\fP Current environment.
.br
\fIfmt\fP Format string for the log message.
.RE
.PP
.SH "Author"
.PP
Generated automatically by Doxygen for libapreq2 from the source code.
|