summaryrefslogtreecommitdiffstats
path: root/libcsoap
diff options
context:
space:
mode:
Diffstat (limited to 'libcsoap')
-rw-r--r--libcsoap/soap-admin.c48
-rw-r--r--libcsoap/soap-admin.h6
-rw-r--r--libcsoap/soap-client.c17
-rwxr-xr-xlibcsoap/soap-ctx.c14
-rwxr-xr-xlibcsoap/soap-ctx.h5
-rw-r--r--libcsoap/soap-env.c12
-rw-r--r--libcsoap/soap-router.c19
-rw-r--r--libcsoap/soap-router.h3
-rw-r--r--libcsoap/soap-server.c21
-rw-r--r--libcsoap/soap-server.h6
-rw-r--r--libcsoap/soap-service.c72
11 files changed, 160 insertions, 63 deletions
diff --git a/libcsoap/soap-admin.c b/libcsoap/soap-admin.c
index 65e07c9..7b2c9e8 100644
--- a/libcsoap/soap-admin.c
+++ b/libcsoap/soap-admin.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-admin.c,v 1.4 2006/05/15 06:45:07 m0gg Exp $
+* $Id: soap-admin.c,v 1.5 2006/11/19 09:40:14 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -25,16 +25,29 @@
#include <config.h>
#endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#include <nanohttp/nanohttp-common.h>
+#include <nanohttp/nanohttp-socket.h>
+#include <nanohttp/nanohttp-stream.h>
+#include <nanohttp/nanohttp-request.h>
#include <nanohttp/nanohttp-server.h>
+#include <nanohttp/nanohttp-admin.h>
#include "soap-router.h"
#include "soap-server.h"
#include "soap-admin.h"
-#define SOAP_ADMIN_QUERY_ROUTERS "routers"
-#define SOAP_ADMIN_QUERY_ROUTER "router"
-#define SOAP_ADMIN_QUERY_SERVICES "services"
-
static void
_soap_admin_send_title(httpd_conn_t *conn, const char *title)
{
@@ -52,6 +65,8 @@ _soap_admin_send_title(httpd_conn_t *conn, const char *title)
"</style></head><body><span class=\"logo\">csoap</span> ");
http_output_stream_write_string(conn->out, title);
http_output_stream_write_string(conn->out, "<hr />");
+
+ return;
}
@@ -66,13 +81,15 @@ _soap_admin_list_routers(httpd_conn_t *conn)
http_output_stream_write_string(conn->out, "<ul>");
for (node = soap_server_get_routers(); node; node = node->next)
{
- sprintf(buffer, "<li><a href=\"?" SOAP_ADMIN_QUERY_ROUTER "=%s\">%s</a> - <a href=\"%s\">[Service Description]</a></li>",
- node->context, node->context, node->context);
+ sprintf(buffer, "<li><a href=\"?" SOAP_ADMIN_QUERY_ROUTER "=%s\">%s</a> - <a href=\"%s\">[Service Description]</a> - <a href=\"../nhttp?" NHTTPD_ADMIN_QUERY_STATISTICS "=%s\">[Statistics]</a></li>",
+ node->context, node->context, node->context, node->context);
http_output_stream_write_string(conn->out, buffer);
}
http_output_stream_write_string(conn->out, "</ul>");
http_output_stream_write_string(conn->out, "</body></html>");
+
+ return;
}
@@ -108,6 +125,8 @@ _soap_admin_list_services(httpd_conn_t *conn, const char *routername)
http_output_stream_write_string(conn->out, "</ul>");
http_output_stream_write_string(conn->out, "</body></html>");
+
+ return;
}
@@ -128,13 +147,16 @@ _soap_admin_handle_get(httpd_conn_t * conn, hrequest_t * req)
{
_soap_admin_send_title(conn, "Welcome to the admin site");
- http_output_stream_write_string(conn->out, "<ul>");
http_output_stream_write_string(conn->out,
- "<li><a href=\"?" SOAP_ADMIN_QUERY_ROUTERS "\">Routers</a></li>");
- http_output_stream_write_string(conn->out, "</ul>");
+ "<ul>"
+ "<li><a href=\"?" SOAP_ADMIN_QUERY_ROUTERS "\">Routers</a></li>"
+ "<li><a href=\"../nhttp\">nanoHTTP</a></li>"
+ "</ul>");
http_output_stream_write_string(conn->out, "</body></html>");
}
+
+ return;
}
@@ -151,21 +173,21 @@ _soap_admin_entry(httpd_conn_t * conn, hrequest_t * req)
http_output_stream_write_string(conn->out,
"<html>"
"<head>"
- "</head>"
- "<body>"
+ "</head>"
+ "<body>"
"<h1>Sorry!</h1>"
"<hr />"
"<div>POST Service is not implemented now. Use your browser</div>"
"</body>"
"</html>");
}
+ return;
}
herror_t
soap_admin_init_args(int argc, char **argv)
{
-
int i;
for (i=0; i<argc; i++) {
diff --git a/libcsoap/soap-admin.h b/libcsoap/soap-admin.h
index 654f149..e49fbba 100644
--- a/libcsoap/soap-admin.h
+++ b/libcsoap/soap-admin.h
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: soap-admin.h,v 1.2 2006/05/15 06:45:07 m0gg Exp $
+ * $Id: soap-admin.h,v 1.3 2006/11/19 09:40:14 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -26,6 +26,10 @@
#define CSOAP_ENABLE_ADMIN "-CSOAPadmin"
+#define SOAP_ADMIN_QUERY_ROUTERS "routers"
+#define SOAP_ADMIN_QUERY_ROUTER "router"
+#define SOAP_ADMIN_QUERY_SERVICES "services"
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/libcsoap/soap-client.c b/libcsoap/soap-client.c
index 67b7681..3513d36 100644
--- a/libcsoap/soap-client.c
+++ b/libcsoap/soap-client.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-client.c,v 1.27 2006/07/09 16:24:19 snowdrop Exp $
+* $Id: soap-client.c,v 1.28 2006/11/19 09:40:14 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -25,6 +25,10 @@
#include <config.h>
#endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
#ifdef HAVE_STRING_H
#include <string.h>
#endif
@@ -33,8 +37,17 @@
#include <stdio.h>
#endif
-#include <nanohttp/nanohttp-logging.h>
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#include <nanohttp/nanohttp-common.h>
+#include <nanohttp/nanohttp-socket.h>
+#include <nanohttp/nanohttp-stream.h>
+#include <nanohttp/nanohttp-request.h>
+#include <nanohttp/nanohttp-response.h>
#include <nanohttp/nanohttp-client.h>
+#include <nanohttp/nanohttp-logging.h>
#include "soap-client.h"
diff --git a/libcsoap/soap-ctx.c b/libcsoap/soap-ctx.c
index 393dceb..28c779f 100755
--- a/libcsoap/soap-ctx.c
+++ b/libcsoap/soap-ctx.c
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: soap-ctx.c,v 1.10 2006/07/09 16:24:19 snowdrop Exp $
+ * $Id: soap-ctx.c,v 1.11 2006/11/19 09:40:14 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003-2004 Ferhat Ayaz
@@ -25,6 +25,10 @@
#include <config.h>
#endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif
@@ -37,6 +41,14 @@
#include <errno.h>
#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#include <nanohttp/nanohttp-common.h>
+#include <nanohttp/nanohttp-socket.h>
+#include <nanohttp/nanohttp-stream.h>
+#include <nanohttp/nanohttp-request.h>
#include <nanohttp/nanohttp-logging.h>
#include "soap-ctx.h"
diff --git a/libcsoap/soap-ctx.h b/libcsoap/soap-ctx.h
index d418037..a70a88f 100755
--- a/libcsoap/soap-ctx.h
+++ b/libcsoap/soap-ctx.h
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: soap-ctx.h,v 1.9 2006/03/06 13:37:38 m0gg Exp $
+ * $Id: soap-ctx.h,v 1.10 2006/11/19 09:40:14 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003-2004 Ferhat Ayaz
@@ -24,9 +24,6 @@
#ifndef cSOAP_CTX_H
#define cSOAP_CTX_H
-#include <nanohttp/nanohttp-common.h>
-#include <nanohttp/nanohttp-server.h>
-
#include <libcsoap/soap-env.h>
#define SOAP_ERROR_NO_FILE_ATTACHED 4001
diff --git a/libcsoap/soap-env.c b/libcsoap/soap-env.c
index 0536065..abff67e 100644
--- a/libcsoap/soap-env.c
+++ b/libcsoap/soap-env.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-env.c,v 1.20 2006/07/09 16:24:19 snowdrop Exp $
+* $Id: soap-env.c,v 1.21 2006/11/19 09:40:14 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -25,6 +25,10 @@
#include <config.h>
#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
#ifdef HAVE_STDARG_H
#include <stdarg.h>
#endif
@@ -41,6 +45,10 @@
#include <errno.h>
#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
#ifdef WIN32
#define USE_XMLSTRING
#endif
@@ -49,6 +57,8 @@
#include <libxml/xmlstring.h>
#endif
+#include <nanohttp/nanohttp-common.h>
+#include <nanohttp/nanohttp-socket.h>
#include <nanohttp/nanohttp-logging.h>
#include "soap-xml.h"
diff --git a/libcsoap/soap-router.c b/libcsoap/soap-router.c
index cd0cca4..9f67460 100644
--- a/libcsoap/soap-router.c
+++ b/libcsoap/soap-router.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-router.c,v 1.10 2006/07/09 16:24:19 snowdrop Exp $
+* $Id: soap-router.c,v 1.11 2006/11/19 09:40:14 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -25,14 +25,31 @@
#include <config.h>
#endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+
#ifdef HAVE_STRING_H
#include <string.h>
#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
+#include <nanohttp/nanohttp-common.h>
+#include <nanohttp/nanohttp-socket.h>
+#include <nanohttp/nanohttp-stream.h>
+#include <nanohttp/nanohttp-request.h>
+#include <nanohttp/nanohttp-server.h>
#include <nanohttp/nanohttp-logging.h>
#include "soap-router.h"
diff --git a/libcsoap/soap-router.h b/libcsoap/soap-router.h
index d75979a..3c8b6f7 100644
--- a/libcsoap/soap-router.h
+++ b/libcsoap/soap-router.h
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: soap-router.h,v 1.8 2006/05/15 06:41:34 m0gg Exp $
+ * $Id: soap-router.h,v 1.9 2006/11/19 09:40:14 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -39,7 +39,6 @@ typedef struct _SoapRouter
xmlDocPtr wsdl;
} SoapRouter;
-
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/libcsoap/soap-server.c b/libcsoap/soap-server.c
index 5448de7..e0297b3 100644
--- a/libcsoap/soap-server.c
+++ b/libcsoap/soap-server.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-server.c,v 1.26 2006/07/09 16:24:19 snowdrop Exp $
+* $Id: soap-server.c,v 1.27 2006/11/19 09:40:14 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -25,6 +25,14 @@
#include <config.h>
#endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+
#ifdef HAVE_STRING_H
#include <string.h>
#endif
@@ -33,12 +41,21 @@
#include <errno.h>
#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
#ifdef WIN32
#define snprintf(buffer, num, s1, s2) sprintf(buffer, s1,s2)
#endif
-#include <nanohttp/nanohttp-logging.h>
+#include <nanohttp/nanohttp-common.h>
+#include <nanohttp/nanohttp-socket.h>
+#include <nanohttp/nanohttp-stream.h>
+#include <nanohttp/nanohttp-request.h>
+#include <nanohttp/nanohttp-response.h>
#include <nanohttp/nanohttp-server.h>
+#include <nanohttp/nanohttp-logging.h>
#include "soap-admin.h"
#include "soap-server.h"
diff --git a/libcsoap/soap-server.h b/libcsoap/soap-server.h
index 01f3e66..738db1a 100644
--- a/libcsoap/soap-server.h
+++ b/libcsoap/soap-server.h
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: soap-server.h,v 1.10 2006/03/29 08:35:56 m0gg Exp $
+ * $Id: soap-server.h,v 1.11 2006/11/19 09:40:14 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -82,14 +82,14 @@ SoapRouterNode * soap_server_get_routers(void);
Enters the server loop and starts to listen to
http requests.
*/
-herror_t soap_server_run();
+herror_t soap_server_run(void);
int soap_server_get_port(void);
/**
Frees the soap server.
*/
-void soap_server_destroy();
+void soap_server_destroy(void);
#ifdef __cplusplus
}
diff --git a/libcsoap/soap-service.c b/libcsoap/soap-service.c
index e2a486a..dc3a2a5 100644
--- a/libcsoap/soap-service.c
+++ b/libcsoap/soap-service.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-service.c,v 1.8 2006/07/09 16:24:19 snowdrop Exp $
+* $Id: soap-service.c,v 1.9 2006/11/19 09:40:14 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -25,12 +25,27 @@
#include <config.h>
#endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+
#ifdef HAVE_STRING_H
#include <string.h>
#endif
-#include <nanohttp/nanohttp-logging.h>
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
#include <nanohttp/nanohttp-common.h>
+#include <nanohttp/nanohttp-socket.h>
+#include <nanohttp/nanohttp-stream.h>
+#include <nanohttp/nanohttp-request.h>
+#include <nanohttp/nanohttp-logging.h>
#include "soap-service.h"
@@ -39,66 +54,57 @@ soap_service_node_new(SoapService * service, SoapServiceNode * next)
{
SoapServiceNode *node;
- node = (SoapServiceNode *) malloc(sizeof(SoapServiceNode));
+ if (!(node = (SoapServiceNode *) malloc(sizeof(SoapServiceNode)))) {
+
+ log_error2("malloc failed (%s)", strerror(errno));
+ return NULL;
+ }
node->service = service;
node->next = next;
return node;
}
-
-
-
SoapService *
soap_service_new(const char *urn, const char *method, SoapServiceFunc f)
{
SoapService *service;
+ if (!(service = (SoapService *) malloc(sizeof(SoapService)))) {
+
+ log_error2("malloc failed (%s)", strerror(errno));
+ return NULL;
+ }
- service = (SoapService *) malloc(sizeof(SoapService));
service->func = f;
- if (urn != NULL)
- {
- service->urn = (char *) malloc(strlen(urn) + 1);
- strcpy(service->urn, urn);
- }
- else
- {
+ if (urn == NULL) {
+
log_warn1("urn is NULL");
- service->urn = "";
+ urn = "";
}
+ service->urn = strdup(urn);
+
+ if (method == NULL) {
- if (method != NULL)
- {
- service->method = (char *) malloc(strlen(method) + 1);
- strcpy(service->method, method);
- }
- else
- {
log_warn1("method is NULL");
- service->method = "";
+ method = "";
}
+ service->method = strdup(method);
return service;
}
-
-
void
soap_service_free(SoapService * service)
{
- log_verbose2("enter: service=%p", service);
-
if (service == NULL)
return;
- if (strcmp(service->urn, ""))
- free(service->urn);
-
- if (strcmp(service->method, ""))
- free(service->method);
+ free(service->urn);
+ free(service->method);
free(service);
- log_verbose1("leave with success");
+
+ return;
}