/*
**  apapi.h -- Apache 1.3 API prototypes
**
**  THIS IS A COMPLETE LIST OF PROTOTYPES
**  FOR ALL PUBLIC API FUNCTIONS
*/

#ifndef APAPI_H
#define APAPI_H

extern char                 ap_server_root[MAX_STRING_LEN];
extern const char           ap_day_snames[7][4];
extern const char           ap_month_snames[12][4];
extern void                 ap_MD5Final(unsigned char digest[16], AP_MD5_CTX * context);
extern void                 ap_MD5Init(AP_MD5_CTX * context);
extern void                 ap_MD5Update(AP_MD5_CTX * context, const unsigned char *input, unsigned int inputLen);
extern void                 ap_add_cgi_vars(request_rec *r);
extern void                 ap_add_common_vars(request_rec *r);
extern void                 ap_add_module(module *m);
extern int                  ap_add_named_module(const char *name);
extern int                  ap_allow_options (request_rec *);
extern int                  ap_allow_overrides (request_rec *);
extern array_header *       ap_append_arrays(pool *, const array_header *, const array_header *);
extern void                 ap_array_cat(array_header *dst, const array_header *src);
extern char *               ap_auth_name (request_rec *);
extern char *               ap_auth_type (request_rec *);
extern void                 ap_basic_http_header(request_rec *r);
extern int                  ap_bclose(BUFF *fb);
extern BUFF *               ap_bcreate(pool *p, int flags);
extern int                  ap_bfilbuf(BUFF *fb);
extern int                  ap_bfileno(BUFF *fb, int direction);
extern int                  ap_bflsbuf(int c, BUFF *fb);
extern int                  ap_bflush(BUFF *fb);
extern int                  ap_bgetopt(BUFF *fb, int optname, void *optval);
extern int                  ap_bgets(char *s, int n, BUFF *fb);
extern void                 ap_bhalfduplex(BUFF *fb);
extern void                 ap_block_alarms(void);
extern int                  ap_blookc(char *buff, BUFF *fb);
extern int                  ap_bnonblock(BUFF *fb, int direction);
extern void                 ap_bonerror(BUFF *fb, void (*error) (BUFF *, int, void *), void *data);
extern void                 ap_bpushfd(BUFF *fb, int fd_in, int fd_out);
extern int                  ap_bputs(const char *x, BUFF *fb);
extern int                  ap_bprintf(BUFF *fb, const char *fmt,...) __attribute__((format(printf,2,3)));
extern int                  ap_bread(BUFF *fb, void *buf, int nbyte);
extern int                  ap_bsetflag(BUFF *fb, int flag, int value);
extern int                  ap_bsetopt(BUFF *fb, int optname, const void *optval);
extern int                  ap_bskiplf(BUFF *fb);
extern int                  ap_bvputs(BUFF *fb,...);
extern int                  ap_bwrite(BUFF *fb, const void *buf, int nbyte);
extern long                 ap_bytes_in_free_blocks(void);
extern long                 ap_bytes_in_pool(pool *p);
extern int                  ap_call_exec(request_rec *r, char *argv0, char **env, int shellcmd);
extern int                  ap_can_exec(const struct stat *);
extern int                  ap_cfg_closefile(configfile_t *fp);
extern int                  ap_cfg_getc(configfile_t *cfp);
extern int                  ap_cfg_getline(char *buf, size_t bufsize, configfile_t *cfp);
extern void                 ap_chdir_file(const char *file);
extern int                  ap_check_alarm(void);
extern const char *         ap_check_cmd_context(cmd_parms *cmd, unsigned forbidden);
extern int                  ap_checkmask(const char *data, const char *mask);
extern void                 ap_child_terminate(request_rec *r);
extern void                 ap_cleanup_for_exec(void);
extern void                 ap_clear_module_list(void);
extern void                 ap_clear_pool(struct pool *);
extern void                 ap_clear_table(table *);
extern void                 ap_close_piped_log (piped_log *);
extern char *               ap_construct_server(pool *p, const char *hostname, unsigned port, const request_rec *r);
extern char *               ap_construct_url(pool *p, const char *uri, const request_rec *r);
extern array_header *       ap_copy_array(pool *p, const array_header *src);
extern array_header *       ap_copy_array_hdr(pool *p, const array_header *src);
extern table *              ap_copy_table(pool *p, const table *);
extern int                  ap_count_dirs(const char *path);
extern char **              ap_create_environment(pool *p, table *t);
extern unsigned short       ap_default_port_for_request(const request_rec *r);
extern unsigned short       ap_default_port_for_scheme(const char *scheme_str);
extern char *               ap_default_type (request_rec *);
extern void                 ap_destroy_pool(pool *);
extern void                 ap_destroy_sub_req(request_rec *r);
extern int                  ap_discard_request_body(request_rec *r);
extern char *               ap_document_root (request_rec *);
extern int                  ap_each_byterange(request_rec *r, long *offset, long *length);
extern void                 ap_error_log2stderr (server_rec *);
extern char *               ap_escape_html(pool *p, const char *s);
extern char *               ap_escape_path_segment(pool *p, const char *s);
extern char *               ap_escape_shell_cmd(pool *p, const char *s);
extern int                  ap_exists_scoreboard_image(void);
extern int                  ap_find_last_token(pool *p, const char *line, const char *tok);
extern module *             ap_find_linked_module(const char *name);
extern const char *         ap_find_module_name(module *m);
extern int                  ap_find_path_info(const char *uri, const char *path_info);
extern pool *               ap_find_pool(const void *ts);
extern int                  ap_find_token(pool *p, const char *line, const char *tok);
extern int                  ap_fnmatch(const char *, const char *, int);
extern int                  ap_get_basic_auth_pw(request_rec *r, char **pw);
extern long                 ap_get_client_block(request_rec *r, char *buffer, int bufsiz);
extern struct tm *          ap_get_gmtoff(int *tz);
extern void *               ap_get_module_config(void *conf_vector, module *m);
extern const char *         ap_get_remote_host(conn_rec *conn, void *dir_config, int type);
extern const char *         ap_get_remote_logname(request_rec *r);
extern const char *         ap_get_server_name(const request_rec *r);
extern unsigned             ap_get_server_port(const request_rec *r);
extern char *               ap_get_time(void);
extern char *               ap_get_token(pool *p, char **accept_line, int accept_white);
extern void                 ap_getparents(char *name);
extern char *               ap_getword(pool *p, const char **line, char stop);
extern char *               ap_getword_conf(pool *p, const char **line);
extern char *               ap_getword_conf_nc(pool *p, char **line);
extern char *               ap_getword_nc(pool *p, char **line, char stop);
extern char *               ap_getword_nulls(pool *p, const char **line, char stop);
extern char *               ap_getword_nulls_nc(pool *p, char **line, char stop);
extern char *               ap_getword_white(pool *p, const char **line);
extern char *               ap_getword_white_nc(pool *p, char **line);
extern char *               ap_gm_timestr_822(pool *p, time_t t);
extern gid_t                ap_gname2id(const char *name);
extern void                 ap_hard_timeout(char *, request_rec *);
extern char *               ap_ht_time(pool *p, time_t t, const char *fmt, int gmt);
extern int                  ap_ind(const char *, char);
extern int                  ap_index_of_response(int status);
extern void                 ap_internal_redirect(const char *new_uri, request_rec *);
extern void                 ap_internal_redirect_handler(const char *new_uri, request_rec *);
extern int                  ap_is_directory(const char *name);
extern int                  ap_is_fnmatch(const char *);
extern int                  ap_is_initial_req(request_rec *r);
extern int                  ap_is_matchexp(const char *str);
extern int                  ap_is_url(const char *u);
extern void                 ap_kill_cleanup(pool *p, void *data, void (*plain_cleanup) (void *));
extern void                 ap_kill_cleanups_for_fd(pool *p, int fd);
extern void                 ap_kill_cleanups_for_socket(pool *p, int sock);
extern void                 ap_kill_timeout(request_rec *);
extern void                 ap_log_assert(const char *szExp, const char *szFile, int nLine) __attribute__((noreturn));
extern void                 ap_log_printf(const server_rec *s, const char *fmt, ...) __attribute__((format(printf,2,3)));
extern void                 ap_log_reason(const char *reason, const char *fname, request_rec *r);
extern void                 ap_log_unixerr(const char *routine, const char *file, const char *msg, server_rec *s);
extern array_header *       ap_make_array(pool *p, int nelts, int elt_size);
extern char *               ap_make_dirstr(pool *a, const char *s, int n);
extern char *               ap_make_dirstr_parent(pool *p, const char *s);
extern char *               ap_make_dirstr_prefix(char *d, const char *s, int n);
extern char *               ap_make_full_path(pool *a, const char *dir, const char *f);
extern pool *               ap_make_sub_pool(pool *);
extern table *              ap_make_table(pool *p, int nelts);
extern int                  ap_matches_request_vhost(request_rec *r, const char *host, unsigned port);
extern int                  ap_meets_conditions(request_rec *r);
extern void                 ap_no2slash(char *name);
extern void                 ap_note_auth_failure(request_rec *r);
extern void                 ap_note_basic_auth_failure(request_rec *r);
extern void                 ap_note_cleanups_for_fd(pool *, int);
extern void                 ap_note_cleanups_for_file(pool *, FILE *);
extern void                 ap_note_cleanups_for_socket(pool *, int);
extern void                 ap_note_digest_auth_failure(request_rec *r);
extern void                 ap_note_subprocess(pool *a, int pid, enum kill_conditions how);
extern void                 ap_null_cleanup(void *data);
extern piped_log *          ap_open_piped_log (pool *p, const char *program);
extern table *              ap_overlay_tables(pool *p, const table *overlay, const table *base);
extern void *               ap_palloc(struct pool *, int nbytes);
extern time_t               ap_parseHTTPdate(const char *date);
extern void                 ap_parse_uri(request_rec *r, const char *uri);
extern int                  ap_parse_uri_components(pool *p, const char *uri, uri_components *uptr);
extern int                  ap_parse_hostinfo_components(pool *p, const char *hostinfo, uri_components *uptr);
extern void *               ap_pcalloc(struct pool *, int nbytes);
extern configfile_t *       ap_pcfg_open_custom(pool *p, const char *descr, void *param, int(*getc_func)(void*), void *(*gets_func) (void *buf, size_t bufsiz, void *param), int(*close_func)(void*));
extern configfile_t *       ap_pcfg_openfile(pool *p, const char *name);
extern void                 ap_pclosedir(pool *p, DIR * d);
extern int                  ap_pclosef(struct pool *, int fd);
extern int                  ap_pclosesocket(pool *a, int sock);
extern struct hostent *     ap_pduphostent(pool *p, struct hostent *hp);
extern int                  ap_pfclose(struct pool *, FILE *);
extern FILE *               ap_pfdopen(struct pool *, int fd, const char *fmode);
extern FILE *               ap_pfopen(struct pool *, const char *name, const char *fmode);
extern struct hostent *     ap_pgethostbyname(pool *p, const char *hostname);
extern int                  ap_pool_is_ancestor(pool *a, pool *b);
extern void                 ap_pool_join(pool *p, pool *sub);
extern DIR *                ap_popendir(pool *p, const char *name);
extern int                  ap_popenf(struct pool *, const char *name, int flg, int mode);
extern regex_t *            ap_pregcomp(pool *p, const char *pattern, int cflags);
extern void                 ap_pregfree(pool *p, regex_t * reg);
extern char *               ap_pregsub(pool *p, const char *input, const char *source, size_t nmatch, regmatch_t pmatch[]);
extern const char *         ap_psignature(const char *prefix, request_rec *r);
extern int                  ap_psocket(pool *p, int, int, int);
extern char *               ap_pstrcat(struct pool *,...);
extern char *               ap_pstrdup(struct pool *, const char *s);
extern char *               ap_pstrndup(struct pool *, const char *s, int n);
extern char *               ap_psprintf(struct pool *, const char *fmt, ...) __attribute__((format(printf,2,3)));
extern char *               ap_pvsprintf(struct pool *, const char *fmt, va_list);
extern void *               ap_push_array(array_header *);
extern time_t               ap_rationalize_mtime(request_rec *r, time_t mtime);
extern void                 ap_register_cleanup(pool *p, void *data, void (*plain_cleanup) (void *), void (*child_cleanup) (void *));
extern void                 ap_register_other_child(int pid, void (*maintenance) (int reason, void *data, int status), void *data, int write_fd);
extern void                 ap_remove_module(module *m);
extern array_header *       ap_requires (request_rec *);
extern void                 ap_reset_timeout(request_rec *);
extern int                  ap_rflush(request_rec *r);
extern int                  ap_rind(const char *, char);
extern int                  ap_rprintf(request_rec *r, const char *fmt,...) __attribute__((format(printf,2,3)));
extern int                  ap_rputc(int c, request_rec *r);
extern int                  ap_rputs(const char *str, request_rec *r);
extern void                 ap_run_cleanup(pool *p, void *data, void (*cleanup) (void *));
extern int                  ap_run_sub_req(request_rec *r);
extern int                  ap_rvputs(request_rec *r,...);
extern int                  ap_rwrite(const void *buf, int nbyte, request_rec *r);
extern int                  ap_satisfies (request_rec *r);
extern int                  ap_scan_script_header_err(request_rec *r, FILE *f, char *buffer);
extern int                  ap_scan_script_header_err_buff(request_rec *r, BUFF *f, char *buffer);
extern long                 ap_send_fb(BUFF *f, request_rec *r);
extern long                 ap_send_fb_length(BUFF *f, request_rec *r, long length);
extern long                 ap_send_fd(FILE *f, request_rec *r);
extern long                 ap_send_fd_length(FILE *f, request_rec *r, long length);
extern int                  ap_send_header_field(request_rec *r, const char *fieldname, const char *fieldval);
extern void                 ap_send_http_header(request_rec *l);
extern size_t               ap_send_mmap(void *mm, request_rec *r, size_t offset, size_t length);
extern void                 ap_send_size(size_t size, request_rec *r);
extern char *               ap_server_root_relative(pool *p, char *fname);
extern int                  ap_set_byterange(request_rec *r);
extern int                  ap_set_content_length(request_rec *r, long length);
extern void                 ap_set_etag(request_rec *r);
extern const char *         ap_set_file_slot(cmd_parms *, char *, char *);
extern const char *         ap_set_flag_slot(cmd_parms *, char *, int);
extern int                  ap_set_keepalive(request_rec *r);
extern void                 ap_set_last_modified(request_rec *r);
extern void                 ap_set_module_config(void *conf_vector, module *m, void *val);
extern const char *         ap_set_string_slot(cmd_parms *, char *, char *);
extern const char *         ap_set_string_slot_lower(cmd_parms *, char *, char *);
extern int                  ap_setup_client_block(request_rec *r, int read_policy);
extern int                  ap_should_client_block(request_rec *r);
extern void                 ap_soft_timeout(char *, request_rec *);
extern int                  ap_some_auth_required(request_rec *r);
extern int                  ap_spawn_child_err(pool *, int (*)(void *), void *, enum kill_conditions, FILE **pipe_in, FILE **pipe_out, FILE **pipe_err);
extern int                  ap_spawn_child_err_buff(pool *, int (*)(void *), void *, enum kill_conditions, BUFF **pipe_in, BUFF **pipe_out, BUFF **pipe_err);
extern const char *         ap_srm_command_loop(cmd_parms *parms, void *config);
extern void                 ap_str_tolower(char *);
extern int                  ap_strcasecmp_match(const char *str, const char *exp);
extern int                  ap_strcmp_match(const char *str, const char *exp);
extern request_rec *        ap_sub_req_lookup_file(const char *new_file, const request_rec *r);
extern request_rec *        ap_sub_req_lookup_uri(const char *new_file, const request_rec *r);
extern void                 ap_sync_scoreboard_image(void);
extern void                 ap_table_add(table *, const char *name, const char *val);
extern void                 ap_table_addn(table *, const char *name, const char *val);
extern void                 ap_table_do(int (*comp) (void *, const char *, const char *), void *rec, const table *t,...);
extern char *               ap_table_get(const table *, const char *);
extern void                 ap_table_merge(table *, const char *name, const char *more_val);
extern void                 ap_table_mergen(table *, const char *name, const char *more_val);
extern void                 ap_table_set(table *, const char *name, const char *val);
extern void                 ap_table_setn(table *, const char *name, const char *val);
extern void                 ap_table_unset(table *, const char *key);
extern time_t               ap_tm2sec(const struct tm *t);
extern uid_t                ap_uname2id(const char *name);
extern void                 ap_unblock_alarms(void);
extern int                  ap_unescape_url(char *url);
extern char *               ap_unparse_uri_components(pool *p, const uri_components *uptr, unsigned flags);
extern void                 ap_unregister_other_child(void *data);
extern time_t               ap_update_mtime(request_rec *r, time_t dependency_mtime);
extern char *               ap_uudecode(pool *, const char *);
extern int                  ap_vbprintf(BUFF *fb, const char *fmt, va_list vlist);
extern const char *         ap_get_server_built(void);
extern const char *         ap_get_server_version(void);
extern void                 ap_log_error(const char *file, int line, int level, const server_rec *s, const char *fmt, ...) __attribute__((format(printf,5,6)));
extern void                 ap_log_error_old(const char *err, server_rec *s);
extern char *               ap_escape_path(pool *p, const char *path, int partial);

#endif /* APAPI_H */
