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-client.c | 20 +---------- libcsoap/soap-server.c | 96 ++++++++++++++++++++++++-------------------------- libcsoap/soap-server.h | 3 +- libcsoap/soap-xml.c | 4 +-- 4 files changed, 51 insertions(+), 72 deletions(-) (limited to 'libcsoap') diff --git a/libcsoap/soap-client.c b/libcsoap/soap-client.c index f7c38c2..55fa6ca 100644 --- a/libcsoap/soap-client.c +++ b/libcsoap/soap-client.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: soap-client.c,v 1.21 2006/01/10 11:29:04 snowdrop Exp $ +* $Id: soap-client.c,v 1.22 2006/02/08 11:13:14 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -42,8 +42,6 @@ soap_client_get_blockmode() return _block_socket; } - - herror_t soap_client_init_args(int argc, char *argv[]) { @@ -58,22 +56,6 @@ soap_client_destroy() httpc_destroy(); } -static long -_file_get_size(const char *filename) -{ - FILE *f = fopen(filename, "r"); - long size; - - if (!f) - return -1; - - fseek(f, 0, SEEK_END); - size = ftell(f); - fclose(f); - return size; -} - - herror_t soap_client_invoke(SoapCtx * call, SoapCtx ** response, const char *url, const char *soap_action) 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; -} diff --git a/libcsoap/soap-server.h b/libcsoap/soap-server.h index 9306f1a..4e2db62 100644 --- a/libcsoap/soap-server.h +++ b/libcsoap/soap-server.h @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: soap-server.h,v 1.7 2006/01/10 11:29:04 snowdrop Exp $ + * $Id: soap-server.h,v 1.8 2006/02/08 11:13:14 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -70,6 +70,7 @@ int soap_server_register_router(SoapRouter * router, const char *context); */ herror_t soap_server_run(); +int soap_server_get_port(void); /** Frees the soap server. diff --git a/libcsoap/soap-xml.c b/libcsoap/soap-xml.c index 7b6ba87..62b0b7d 100644 --- a/libcsoap/soap-xml.c +++ b/libcsoap/soap-xml.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: soap-xml.c,v 1.8 2006/01/10 11:29:04 snowdrop Exp $ +* $Id: soap-xml.c,v 1.9 2006/02/08 11:13:14 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -23,8 +23,6 @@ ******************************************************************/ #include -static const char *soap_env_ns = "http://schemas.xmlsoap.org/soap/envelope/"; - xmlNodePtr soap_xml_get_children(xmlNodePtr param) { -- cgit v1.1-32-gdbae