From 949a8d0b46d6baa9f42c2f8c3bd5e3bdc3596cbd Mon Sep 17 00:00:00 2001 From: m0gg Date: Sun, 19 Nov 2006 09:40:14 +0000 Subject: nanohttp admin patch; code cleanup --- libcsoap/soap-admin.c | 48 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 13 deletions(-) (limited to 'libcsoap/soap-admin.c') 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 #endif +#ifdef HAVE_SYS_TIME_H +#include +#endif + +#ifdef HAVE_STDIO_H +#include +#endif + +#ifdef HAVE_NETINET_IN_H +#include +#endif + +#include +#include +#include +#include #include +#include #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) "csoap "); http_output_stream_write_string(conn->out, title); http_output_stream_write_string(conn->out, "
"); + + return; } @@ -66,13 +81,15 @@ _soap_admin_list_routers(httpd_conn_t *conn) http_output_stream_write_string(conn->out, "
    "); for (node = soap_server_get_routers(); node; node = node->next) { - sprintf(buffer, "
  • %s - [Service Description]
  • ", - node->context, node->context, node->context); + sprintf(buffer, "
  • %s - [Service Description] - [Statistics]
  • ", + node->context, node->context, node->context, node->context); http_output_stream_write_string(conn->out, buffer); } http_output_stream_write_string(conn->out, "
"); http_output_stream_write_string(conn->out, ""); + + return; } @@ -108,6 +125,8 @@ _soap_admin_list_services(httpd_conn_t *conn, const char *routername) http_output_stream_write_string(conn->out, ""); http_output_stream_write_string(conn->out, ""); + + 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, "
    "); http_output_stream_write_string(conn->out, - "
  • Routers
  • "); - http_output_stream_write_string(conn->out, "
"); + ""); http_output_stream_write_string(conn->out, ""); } + + return; } @@ -151,21 +173,21 @@ _soap_admin_entry(httpd_conn_t * conn, hrequest_t * req) http_output_stream_write_string(conn->out, "" "" - "" - "" + "" + "" "

Sorry!

" "
" "
POST Service is not implemented now. Use your browser
" "" ""); } + return; } herror_t soap_admin_init_args(int argc, char **argv) { - int i; for (i=0; i