diff options
author | Günther Deschner <gdeschner@redhat.com> | 2012-06-07 15:29:25 +0200 |
---|---|---|
committer | Simo Sorce <simo@redhat.com> | 2012-06-25 16:49:24 -0400 |
commit | 250bb053f1a0a24784346524280e56a69dd023c9 (patch) | |
tree | 8a4275c817f7a2b86c58ad87bcce0c8151587078 | |
parent | 9b8e141b8e5286e4323df16557763e2a0be71c9e (diff) | |
download | gss-proxy-250bb053f1a0a24784346524280e56a69dd023c9.tar.gz gss-proxy-250bb053f1a0a24784346524280e56a69dd023c9.tar.xz gss-proxy-250bb053f1a0a24784346524280e56a69dd023c9.zip |
Add two ring_buffers to gp_config struct.
Guenther
Signed-off-by: Simo Sorce <simo@redhat.com>
-rw-r--r-- | proxy/src/gp_config.c | 31 | ||||
-rw-r--r-- | proxy/src/gp_proxy.h | 5 |
2 files changed, 36 insertions, 0 deletions
diff --git a/proxy/src/gp_config.c b/proxy/src/gp_config.c index f718715..0c0ba65 100644 --- a/proxy/src/gp_config.c +++ b/proxy/src/gp_config.c @@ -30,8 +30,10 @@ #include <errno.h> #include "gp_proxy.h" #include "iniparser.h" +#include "gp_ring_buffer.h" #define GP_SOCKET_NAME "gssproxy.socket" +#define GP_RING_BUFFER_SIZE 4096 static void gp_service_free(struct gp_service *svc) { @@ -235,6 +237,7 @@ int load_config(struct gp_config *cfg) dictionary *d; char *tmpstr; int ret; + uint32_t ret_min, ret_maj; d = iniparser_load(cfg->config_file); if (!d) { @@ -266,6 +269,34 @@ int load_config(struct gp_config *cfg) cfg->num_workers = iniparser_getint(d, "gssproxy:worker threads", 0); + /* The two main ring_buffers need to be initialized before any dedicated + * ring_buffers (from services) are appended - gd */ + + cfg->num_ring_buffers = 2; + cfg->ring_buffers = calloc(cfg->num_ring_buffers, sizeof(struct gp_ring_buffer *)); + if (!cfg->ring_buffers) { + ret = ENOMEM; + goto done; + } + + ret_maj = gp_init_ring_buffer(&ret_min, + "default_trusted", + GP_RING_BUFFER_SIZE, + &cfg->ring_buffers[0]); + if (ret_maj) { + ret = ret_min; + goto done; + } + + ret_maj = gp_init_ring_buffer(&ret_min, + "default_untrusted", + GP_RING_BUFFER_SIZE, + &cfg->ring_buffers[1]); + if (ret_maj) { + ret = ret_min; + goto done; + } + ret = load_services(cfg, d); done: diff --git a/proxy/src/gp_proxy.h b/proxy/src/gp_proxy.h index bffcac1..9bbaa81 100644 --- a/proxy/src/gp_proxy.h +++ b/proxy/src/gp_proxy.h @@ -51,6 +51,8 @@ struct gp_service { struct gp_cred_krb5 krb5; }; +struct gp_ring_buffer; + struct gp_config { char *config_file; /* gssproxy configuration file */ bool daemonize; /* let gssproxy daemonize */ @@ -59,6 +61,9 @@ struct gp_config { struct gp_service **svcs; int num_svcs; + + struct gp_ring_buffer **ring_buffers; + int num_ring_buffers; }; struct gp_workers; |