From c4286ea5287279836c5ef49a06153db95429bfe6 Mon Sep 17 00:00:00 2001 From: snowdrop Date: Wed, 8 Feb 2006 11:13:13 +0000 Subject: the attached patches address the following issues: * query the port the server is listening on {soap_server,httpd}_get_port * the possibility to add a default service via httpd_register_default * remove some compiler warnings (on FreeBSD pthread_t is a pointer to a struct pthread, on Linux it is a (unsigned?) long int) tschuess, Heiko --- libcsoap/soap-server.c | 96 ++++++++++++++++++++++++-------------------------- 1 file changed, 47 insertions(+), 49 deletions(-) (limited to 'libcsoap/soap-server.c') diff --git a/libcsoap/soap-server.c b/libcsoap/soap-server.c index 4f55bf5..af1d808 100644 --- a/libcsoap/soap-server.c +++ b/libcsoap/soap-server.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: soap-server.c,v 1.15 2006/01/27 20:23:40 mrcsys Exp $ +* $Id: soap-server.c,v 1.16 2006/02/08 11:13:14 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -37,15 +37,9 @@ typedef struct _SoapRouterNode SoapRouterNode *head = NULL; SoapRouterNode *tail = NULL; -static - SoapRouterNode *router_node_new(SoapRouter * router, - const char *context, SoapRouterNode * next); - -static SoapRouter *router_find(const char *context); - +/*---------------------------------*/ static void _soap_server_send_ctx(httpd_conn_t * conn, SoapCtx * ctxres); -/*---------------------------------*/ void soap_server_entry(httpd_conn_t * conn, hrequest_t * req); static void _soap_server_send_env(http_output_stream_t * out, SoapEnv * env); static @@ -53,6 +47,46 @@ static const char *errmsg); /*---------------------------------*/ +static SoapRouterNode * +router_node_new(SoapRouter * router, + const char *context, SoapRouterNode * next) +{ + SoapRouterNode *node; + const char *noname = "/lost_found"; + + node = (SoapRouterNode *) malloc(sizeof(SoapRouterNode)); + if (context) + { + node->context = (char *) malloc(strlen(context) + 1); + strcpy(node->context, context); + } + else + { + log_warn2("context is null. Using '%s'", noname); + node->context = (char *) malloc(strlen(noname) + 1); + strcpy(node->context, noname); + } + + node->router = router; + node->next = next; + + return node; +} + +static SoapRouter * +router_find(const char *context) +{ + SoapRouterNode *node = head; + + while (node != NULL) + { + if (!strcmp(node->context, context)) + return node->router; + node = node->next; + } + + return NULL; +} herror_t soap_server_init_args(int argc, char *argv[]) @@ -90,6 +124,11 @@ soap_server_run() return httpd_run(); } +int +soap_server_get_port(void) +{ + return httpd_get_port(); +} void soap_server_destroy() @@ -390,44 +429,3 @@ _soap_server_send_fault(httpd_conn_t * conn, hpair_t * header, -static SoapRouterNode * -router_node_new(SoapRouter * router, - const char *context, SoapRouterNode * next) -{ - SoapRouterNode *node; - const char *noname = "/lost_found"; - - node = (SoapRouterNode *) malloc(sizeof(SoapRouterNode)); - if (context) - { - node->context = (char *) malloc(strlen(context) + 1); - strcpy(node->context, context); - } - else - { - log_warn2("context is null. Using '%s'", noname); - node->context = (char *) malloc(strlen(noname) + 1); - strcpy(node->context, noname); - } - - node->router = router; - node->next = next; - - return node; -} - - -static SoapRouter * -router_find(const char *context) -{ - SoapRouterNode *node = head; - - while (node != NULL) - { - if (!strcmp(node->context, context)) - return node->router; - node = node->next; - } - - return NULL; -} -- cgit v1.1-32-gdbae