From 2e1222695cd6c9b6d9a797bd5383e7618c3eea85 Mon Sep 17 00:00:00 2001 From: Paul Querna Date: Mon, 27 Sep 2004 20:00:52 +0000 Subject: rename structures. properly prefix all non-static functions with mod_gnutls_ fix build for GnuTLS 1.0.X. (redefine the changed structure names) --- src/gnutls_io.c | 10 +++---- src/mod_gnutls.c | 89 ++++++++++++++++++++++++++++++-------------------------- 2 files changed, 52 insertions(+), 47 deletions(-) (limited to 'src') diff --git a/src/gnutls_io.c b/src/gnutls_io.c index 6b0a15b..1cb14a3 100644 --- a/src/gnutls_io.c +++ b/src/gnutls_io.c @@ -28,9 +28,9 @@ apr_status_t mod_gnutls_filter_input(ap_filter_t * f, apr_read_type_e block, apr_off_t readbytes) { - apr_bucket* b; + apr_bucket *b; apr_status_t status = APR_SUCCESS; - gnutls_handle_t *ctxt = (gnutls_handle_t *) f->ctx; + mod_gnutls_handle_t *ctxt = (mod_gnutls_handle_t *) f->ctx; if (f->c->aborted) { apr_bucket *bucket = apr_bucket_eos_create(f->c->bucket_alloc); @@ -61,7 +61,7 @@ apr_status_t mod_gnutls_filter_output(ap_filter_t * f, int ret, i; const char *buf = 0; apr_size_t bytes = 0; - gnutls_handle_t *ctxt = (gnutls_handle_t *) f->ctx; + mod_gnutls_handle_t *ctxt = (mod_gnutls_handle_t *) f->ctx; apr_status_t status = APR_SUCCESS; apr_read_type_e rblock = APR_NONBLOCK_READ; @@ -256,7 +256,7 @@ static apr_status_t brigade_consume(apr_bucket_brigade * bb, ssize_t mod_gnutls_transport_read(gnutls_transport_ptr_t ptr, void *buffer, size_t len) { - gnutls_handle_t *ctxt = ptr; + mod_gnutls_handle_t *ctxt = ptr; apr_status_t rc; apr_size_t in = len; /* If Len = 0, we don't do anything. */ @@ -295,7 +295,7 @@ ssize_t mod_gnutls_transport_read(gnutls_transport_ptr_t ptr, ssize_t mod_gnutls_transport_write(gnutls_transport_ptr_t ptr, const void *buffer, size_t len) { - gnutls_handle_t *ctxt = ptr; + mod_gnutls_handle_t *ctxt = ptr; // apr_bucket *bucket = apr_bucket_transient_create(in, inl, // outctx->bb-> diff --git a/src/mod_gnutls.c b/src/mod_gnutls.c index 14bf319..c34da5a 100644 --- a/src/mod_gnutls.c +++ b/src/mod_gnutls.c @@ -21,14 +21,14 @@ GCRY_THREAD_OPTION_PTHREAD_IMPL; #endif -static apr_status_t gnutls_cleanup_pre_config(void *data) +static apr_status_t mod_gnutls_cleanup_pre_config(void *data) { gnutls_global_deinit(); return APR_SUCCESS; } -static int gnutls_hook_pre_config(apr_pool_t * pconf, - apr_pool_t * plog, apr_pool_t * ptemp) +static int mod_gnutls_hook_pre_config(apr_pool_t * pconf, + apr_pool_t * plog, apr_pool_t * ptemp) { #if APR_HAS_THREADS @@ -37,7 +37,7 @@ static int gnutls_hook_pre_config(apr_pool_t * pconf, gnutls_global_init(); - apr_pool_cleanup_register(pconf, NULL, gnutls_cleanup_pre_config, + apr_pool_cleanup_register(pconf, NULL, mod_gnutls_cleanup_pre_config, apr_pool_cleanup_null); return OK; @@ -46,11 +46,11 @@ static int gnutls_hook_pre_config(apr_pool_t * pconf, #define DH_BITS 1024 #define RSA_BITS 512 -static int gnutls_hook_post_config(apr_pool_t * p, apr_pool_t * plog, - apr_pool_t * ptemp, - server_rec * base_server) +static int mod_gnutls_hook_post_config(apr_pool_t * p, apr_pool_t * plog, + apr_pool_t * ptemp, + server_rec * base_server) { - gnutls_srvconf_rec *sc; + mod_gnutls_srvconf_rec *sc; server_rec *s; gnutls_dh_params_t dh_params; gnutls_rsa_params_t rsa_params; @@ -63,8 +63,8 @@ static int gnutls_hook_post_config(apr_pool_t * p, apr_pool_t * plog, // gnutls_rsa_params_generate2(rsa_params, RSA_BITS); for (s = base_server; s; s = s->next) { - sc = (gnutls_srvconf_rec *) ap_get_module_config(s->module_config, - &gnutls_module); + sc = (mod_gnutls_srvconf_rec *) ap_get_module_config(s->module_config, + &gnutls_module); if (sc->cert_file != NULL && sc->key_file != NULL) { gnutls_certificate_set_x509_key_file(sc->certs, sc->cert_file, sc->key_file, @@ -84,11 +84,12 @@ static int gnutls_hook_post_config(apr_pool_t * p, apr_pool_t * plog, return OK; } -static const char *gnutls_hook_http_method(const request_rec * r) +static const char *mod_gnutls_hook_http_method(const request_rec * r) { - gnutls_srvconf_rec *sc = - (gnutls_srvconf_rec *) ap_get_module_config(r->server->module_config, - &gnutls_module); + mod_gnutls_srvconf_rec *sc = + (mod_gnutls_srvconf_rec *) ap_get_module_config(r->server-> + module_config, + &gnutls_module); if (sc->enabled == GNUTLS_ENABLED_FALSE) { return NULL; @@ -97,11 +98,12 @@ static const char *gnutls_hook_http_method(const request_rec * r) return "https"; } -static apr_port_t gnutls_hook_default_port(const request_rec * r) +static apr_port_t mod_gnutls_hook_default_port(const request_rec * r) { - gnutls_srvconf_rec *sc = - (gnutls_srvconf_rec *) ap_get_module_config(r->server->module_config, - &gnutls_module); + mod_gnutls_srvconf_rec *sc = + (mod_gnutls_srvconf_rec *) ap_get_module_config(r->server-> + module_config, + &gnutls_module); if (sc->enabled == GNUTLS_ENABLED_FALSE) { return 0; @@ -110,13 +112,13 @@ static apr_port_t gnutls_hook_default_port(const request_rec * r) return 443; } -static int gnutls_hook_pre_connection(conn_rec * c, void *csd) +static int mod_gnutls_hook_pre_connection(conn_rec * c, void *csd) { - gnutls_handle_t *ctxt; - gnutls_srvconf_rec *sc = - (gnutls_srvconf_rec *) ap_get_module_config(c->base_server-> - module_config, - &gnutls_module); + mod_gnutls_handle_t *ctxt; + mod_gnutls_srvconf_rec *sc = + (mod_gnutls_srvconf_rec *) ap_get_module_config(c->base_server-> + module_config, + &gnutls_module); if (!(sc && (sc->enabled == GNUTLS_ENABLED_TRUE))) { return DECLINED; @@ -160,10 +162,10 @@ static int gnutls_hook_pre_connection(conn_rec * c, void *csd) static const char *gnutls_set_cert_file(cmd_parms * parms, void *dummy, const char *arg) { - gnutls_srvconf_rec *sc = - (gnutls_srvconf_rec *) ap_get_module_config(parms->server-> - module_config, - &gnutls_module); + mod_gnutls_srvconf_rec *sc = + (mod_gnutls_srvconf_rec *) ap_get_module_config(parms->server-> + module_config, + &gnutls_module); sc->cert_file = apr_pstrdup(parms->pool, arg); return NULL; } @@ -171,10 +173,10 @@ static const char *gnutls_set_cert_file(cmd_parms * parms, void *dummy, static const char *gnutls_set_key_file(cmd_parms * parms, void *dummy, const char *arg) { - gnutls_srvconf_rec *sc = - (gnutls_srvconf_rec *) ap_get_module_config(parms->server-> - module_config, - &gnutls_module); + mod_gnutls_srvconf_rec *sc = + (mod_gnutls_srvconf_rec *) ap_get_module_config(parms->server-> + module_config, + &gnutls_module); sc->key_file = apr_pstrdup(parms->pool, arg); return NULL; } @@ -182,10 +184,10 @@ static const char *gnutls_set_key_file(cmd_parms * parms, void *dummy, static const char *gnutls_set_enabled(cmd_parms * parms, void *dummy, const char *arg) { - gnutls_srvconf_rec *sc = - (gnutls_srvconf_rec *) ap_get_module_config(parms->server-> - module_config, - &gnutls_module); + mod_gnutls_srvconf_rec *sc = + (mod_gnutls_srvconf_rec *) ap_get_module_config(parms->server-> + module_config, + &gnutls_module); if (!strcasecmp(arg, "On")) { sc->enabled = GNUTLS_ENABLED_TRUE; } @@ -224,13 +226,16 @@ static const command_rec gnutls_cmds[] = { static void gnutls_hooks(apr_pool_t * p) { - ap_hook_pre_connection(gnutls_hook_pre_connection, NULL, NULL, + ap_hook_pre_connection(mod_gnutls_hook_pre_connection, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_post_config(gnutls_hook_post_config, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_http_method(gnutls_hook_http_method, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_default_port(gnutls_hook_default_port, NULL, NULL, + ap_hook_post_config(mod_gnutls_hook_post_config, NULL, NULL, + APR_HOOK_MIDDLE); + ap_hook_http_method(mod_gnutls_hook_http_method, NULL, NULL, + APR_HOOK_MIDDLE); + ap_hook_default_port(mod_gnutls_hook_default_port, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_pre_config(gnutls_hook_pre_config, NULL, NULL, APR_HOOK_MIDDLE); + ap_hook_pre_config(mod_gnutls_hook_pre_config, NULL, NULL, + APR_HOOK_MIDDLE); /* TODO: HTTP Upgrade Filter */ /* ap_register_output_filter ("UPGRADE_FILTER", @@ -247,7 +252,7 @@ static void gnutls_hooks(apr_pool_t * p) static void *gnutls_config_server_create(apr_pool_t * p, server_rec * s) { int i; - gnutls_srvconf_rec *sc = apr_pcalloc(p, sizeof(*sc)); + mod_gnutls_srvconf_rec *sc = apr_pcalloc(p, sizeof(*sc)); sc->enabled = GNUTLS_ENABLED_FALSE; -- cgit