Annotation of parser3/src/targets/apache/pa_httpd.h, revision 1.10

1.1       moko        1: /** @file
                      2:        Parser: http wrapper.
                      3: 
1.10    ! moko        4:        Copyright (c) 2003-2024 Art. Lebedev Studio (http://www.artlebedev.com)
1.9       moko        5:        Authors: Konstantin Morshnev <moko@design.ru>, Alexandr Petrosian <paf@design.ru>
1.1       moko        6: */
                      7: 
                      8: #ifndef PA_HTTPD_H
                      9: #define PA_HTTPD_H
                     10: 
1.10    ! moko       11: #define IDENT_PA_HTTPD_H "$Id: pa_httpd.h,v 1.9 2023/09/26 20:49:11 moko Exp $";
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: void pa_setup_module_cells();
                     48: void pa_destroy_module_cells();
                     49: int pa_parser_handler(pa_request_rec*, Parser_module_config*);
                     50: 
                     51: // export from c to c++
                     52: 
                     53: 
                     54: // http_log.h
                     55: 
                     56: #define        PA_APLOG_EMERG  0       /* system is unusable */
                     57: #define        PA_APLOG_ALERT  1       /* action must be taken immediately */
                     58: #define        PA_APLOG_CRIT   2       /* critical conditions */
                     59: #define        PA_APLOG_ERR    3       /* error conditions */
1.3       moko       60: #define        PA_APLOG_WARNING 4      /* warning conditions */
1.1       moko       61: #define        PA_APLOG_NOTICE 5       /* normal but significant condition */
                     62: #define        PA_APLOG_INFO   6       /* informational */
                     63: #define        PA_APLOG_DEBUG  7       /* debug-level messages */
                     64: 
1.3       moko       65: #define        PA_APLOG_LEVELMASK 7    /* mask off the level value */
1.1       moko       66: 
1.3       moko       67: #define PA_APLOG_NOERRNO       (PA_APLOG_LEVELMASK + 1)
1.1       moko       68: 
                     69: #define PA_APLOG_MARK  __FILE__,__LINE__
                     70: 
                     71: void pa_ap_log_rerror(const char *file, int line, int level,
                     72:                             const pa_request_rec *s, const char *fmt, ...);
                     73: 
                     74: 
                     75: void pa_ap_log_error(const char *file, int line, int level,
                     76:                             const pa_server_rec *s, const char *fmt, ...);
                     77: 
                     78: // ap_alloc.h
                     79: 
                     80: const char * pa_ap_table_get(const pa_table *, const char *);
                     81: void pa_ap_table_addn(pa_table *, const char *name, const char *val);
                     82: 
                     83: int pa_ap_table_size(const pa_table *);
                     84: 
                     85: void pa_ap_table_do(int (*comp) (void *, const char *, const char *), 
                     86:                                     void *rec, const pa_table *t,...);
                     87: 
                     88: char * pa_ap_pstrdup(pa_pool *, const char *s);
                     89: 
                     90: // http_protocol.h
                     91: 
                     92: /* Possible values for request_rec.read_body (set by handling module):
                     93:  *    REQUEST_NO_BODY          Send 413 error if message has any body
                     94:  *    REQUEST_CHUNKED_ERROR    Send 411 error if body without Content-Length
                     95:  *    REQUEST_CHUNKED_DECHUNK  If chunked, remove the chunks for me.
                     96:  *    REQUEST_CHUNKED_PASS     Pass the chunks to me without removal.
                     97:  */
                     98: #define PA_REQUEST_NO_BODY          0
                     99: #define PA_REQUEST_CHUNKED_ERROR    1
                    100: #define PA_REQUEST_CHUNKED_DECHUNK  2
                    101: #define PA_REQUEST_CHUNKED_PASS     3
                    102: 
                    103: int pa_ap_setup_client_block(pa_request_rec *r, int read_policy);
                    104: int pa_ap_should_client_block(pa_request_rec *r);
                    105: long pa_ap_get_client_block(pa_request_rec *r, char *buffer, int bufsiz);
                    106: void pa_ap_send_http_header(pa_request_rec *l);
                    107: int pa_ap_rwrite(const void *buf, int nbyte, pa_request_rec *r);
                    108: 
                    109: 
                    110: // http_main.h
                    111: 
1.4       moko      112: void pa_ap_hard_timeout(const char *, pa_request_rec *);
1.1       moko      113: void pa_ap_reset_timeout(pa_request_rec *);
                    114: void pa_ap_kill_timeout(pa_request_rec *);
                    115: 
                    116: 
                    117: // util_script.h
                    118: 
                    119: void pa_ap_add_cgi_vars(pa_request_rec *r);
                    120: void pa_ap_add_common_vars(pa_request_rec *r);
                    121: 
                    122: // httpd.h
                    123: 
                    124: #define PA_HTTP_NOT_FOUND                     404
                    125: #define PA_OK 0                        /* Module has handled this stage. */
                    126: 
                    127: // signal.h
                    128: 
                    129: #define PA_SIGPIPE 1 /* must translate to real one */
                    130: #define PA_SIG_IGN (void (*)(int))1           /* must translate to real one */
                    131: 
                    132: void (*pa_signal (int sig, void (*disp)(int)))(int);
                    133: 
                    134: #ifdef __cplusplus
                    135: }
                    136: #endif
                    137: 
                    138: #endif

E-mail: