From c301152dbbdf13c4bf212c7982b948c21149468d Mon Sep 17 00:00:00 2001 From: Paul Querna Date: Sun, 24 Apr 2005 22:21:50 +0000 Subject: - move hooks to gnutls_hooks.c - use 'mgs_' as the prefix for all symbols, instead of mixed prefixes. --- include/mod_gnutls.h.in | 75 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 49 insertions(+), 26 deletions(-) (limited to 'include') diff --git a/include/mod_gnutls.h.in b/include/mod_gnutls.h.in index 61b0198..b5a84c0 100644 --- a/include/mod_gnutls.h.in +++ b/include/mod_gnutls.h.in @@ -62,17 +62,17 @@ module AP_MODULE_DECLARE_DATA gnutls_module; typedef enum { - mod_gnutls_cache_none, - mod_gnutls_cache_dbm, + mgs_cache_none, + mgs_cache_dbm, #if HAVE_APR_MEMCACHE - mod_gnutls_cache_memcache + mgs_cache_memcache #endif -} mod_gnutls_cache_e; +} mgs_cache_e; typedef struct { int client_verify_mode; -} mod_gnutls_dirconf_rec; +} mgs_dirconf_rec; typedef struct { @@ -88,21 +88,21 @@ typedef struct int compression[16]; int cert_types[16]; apr_time_t cache_timeout; - mod_gnutls_cache_e cache_type; + mgs_cache_e cache_type; const char* cache_config; const char* rsa_params_file; const char* dh_params_file; int client_verify_mode; -} mod_gnutls_srvconf_rec; +} mgs_srvconf_rec; typedef struct { int length; char *value; -} mod_gnutls_char_buffer_t; +} mgs_char_buffer_t; typedef struct { - mod_gnutls_srvconf_rec *sc; + mgs_srvconf_rec *sc; conn_rec* c; gnutls_session_t session; @@ -111,7 +111,7 @@ typedef struct apr_bucket_brigade *input_bb; apr_read_type_e input_block; ap_input_mode_t input_mode; - mod_gnutls_char_buffer_t input_cbuf; + mgs_char_buffer_t input_cbuf; char input_buffer[AP_IOBUFSIZE]; apr_status_t output_rc; @@ -123,12 +123,12 @@ typedef struct int status; int non_https; -} mod_gnutls_handle_t; +} mgs_handle_t; /** Functions in gnutls_io.c **/ /** - * mod_gnutls_filter_input will filter the input data + * mgs_filter_input will filter the input data * by decrypting it using GnuTLS and passes it cleartext. * * @param f the filter info record @@ -137,26 +137,26 @@ typedef struct * @param block a block index we shall read from? * @return result status */ -apr_status_t mod_gnutls_filter_input(ap_filter_t * f, +apr_status_t mgs_filter_input(ap_filter_t * f, apr_bucket_brigade * bb, ap_input_mode_t mode, apr_read_type_e block, apr_off_t readbytes); /** - * mod_gnutls_filter_output will filter the encrypt + * mgs_filter_output will filter the encrypt * the incoming bucket using GnuTLS and passes it onto the next filter. * * @param f the filter info record * @param bb the bucket brigade, where to store the result to * @return result status */ -apr_status_t mod_gnutls_filter_output(ap_filter_t * f, +apr_status_t mgs_filter_output(ap_filter_t * f, apr_bucket_brigade * bb); /** - * mod_gnutls_transport_read is called from GnuTLS to provide encrypted + * mgs_transport_read is called from GnuTLS to provide encrypted * data from the client. * * @param ptr pointer to the filter context @@ -164,11 +164,11 @@ apr_status_t mod_gnutls_filter_output(ap_filter_t * f, * @param len maximum size * @return size length of the data stored in buffer */ -ssize_t mod_gnutls_transport_read(gnutls_transport_ptr_t ptr, +ssize_t mgs_transport_read(gnutls_transport_ptr_t ptr, void *buffer, size_t len); /** - * mod_gnutls_transport_write is called from GnuTLS to + * mgs_transport_write is called from GnuTLS to * write data to the client. * * @param ptr pointer to the filter context @@ -176,28 +176,28 @@ ssize_t mod_gnutls_transport_read(gnutls_transport_ptr_t ptr, * @param len size of the buffer * @return size length of the data written */ -ssize_t mod_gnutls_transport_write(gnutls_transport_ptr_t ptr, +ssize_t mgs_transport_write(gnutls_transport_ptr_t ptr, const void *buffer, size_t len); -int mod_gnutls_rehandshake(mod_gnutls_handle_t * ctxt); +int mgs_rehandshake(mgs_handle_t * ctxt); /** * Init the Cache after Configuration is done */ -int mod_gnutls_cache_post_config(apr_pool_t *p, server_rec *s, - mod_gnutls_srvconf_rec *sc); +int mgs_cache_post_config(apr_pool_t *p, server_rec *s, + mgs_srvconf_rec *sc); /** * Init the Cache inside each Process */ -int mod_gnutls_cache_child_init(apr_pool_t *p, server_rec *s, - mod_gnutls_srvconf_rec *sc); +int mgs_cache_child_init(apr_pool_t *p, server_rec *s, + mgs_srvconf_rec *sc); /** * Setup the Session Caching */ -int mod_gnutls_cache_session_init(mod_gnutls_handle_t *ctxt); +int mgs_cache_session_init(mgs_handle_t *ctxt); #define GNUTLS_SESSION_ID_STRING_LEN \ ((GNUTLS_MAX_SESSION_ID + 1) * 2) @@ -209,9 +209,10 @@ int mod_gnutls_cache_session_init(mod_gnutls_handle_t *ctxt); * @param str Location to store the Hex Encoded String * @param strsize The Maximum Length that can be stored in str */ -char *mod_gnutls_session_id2sz(unsigned char *id, int idlen, +char *mgs_session_id2sz(unsigned char *id, int idlen, char *str, int strsize); + /* Configuration Functions */ const char *mgs_set_cert_file(cmd_parms * parms, void *dummy, @@ -239,4 +240,26 @@ void *mgs_config_server_create(apr_pool_t * p, server_rec * s); void *mgs_config_dir_create(apr_pool_t *p, char *dir); + +/* mod_gnutls Hooks. */ + +int mgs_hook_pre_config(apr_pool_t * pconf, + apr_pool_t * plog, apr_pool_t * ptemp); + +int mgs_hook_post_config(apr_pool_t * p, apr_pool_t * plog, + apr_pool_t * ptemp, + server_rec * base_server); + +void mgs_hook_child_init(apr_pool_t *p, server_rec *s); + +const char *mgs_hook_http_scheme(const request_rec * r); + +apr_port_t mgs_hook_default_port(const request_rec * r); + +int mgs_hook_pre_connection(conn_rec * c, void *csd); + +int mgs_hook_fixups(request_rec *r); + +int mgs_hook_authz(request_rec *r); + #endif /* __mod_gnutls_h_inc */ -- cgit