summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar m0gg2006-11-25 17:03:20 +0000
committerGravatar m0gg2006-11-25 17:03:20 +0000
commitc8705844bd924e8e00bc79ec0f4ae92c85f7e48e (patch)
treeb76fca4152232bab3c10ae06887b705850a7aed8
parent48873b11cc7f101bd5f3eb74fedacce40e73dd91 (diff)
downloadcsoap-c8705844bd924e8e00bc79ec0f4ae92c85f7e48e.tar.gz
csoap-c8705844bd924e8e00bc79ec0f4ae92c85f7e48e.tar.bz2
Code cleanup
-rw-r--r--examples/csoap/simpleclient.c3
-rw-r--r--examples/csoap/simpleserver.c5
-rw-r--r--examples/csoap/soapclient.c35
-rw-r--r--libcsoap/soap-addressing.c3
-rw-r--r--libcsoap/soap-nudp.c3
-rw-r--r--libcsoap/soap-transport.c3
-rw-r--r--libcsoap/soap-xmlsec.c3
-rw-r--r--nanohttp/nanohttp-common.h118
-rw-r--r--nanohttp/nanohttp-logging.c12
-rw-r--r--nanohttp/nanohttp-logging.h5
10 files changed, 105 insertions, 85 deletions
diff --git a/examples/csoap/simpleclient.c b/examples/csoap/simpleclient.c
index 9add626..1af42f5 100644
--- a/examples/csoap/simpleclient.c
+++ b/examples/csoap/simpleclient.c
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: simpleclient.c,v 1.16 2006/11/25 15:06:57 m0gg Exp $
+ * $Id: simpleclient.c,v 1.17 2006/11/25 17:03:20 m0gg Exp $
*
* CSOAP Project: CSOAP examples project
* Copyright (C) 2003-2004 Ferhat Ayaz
@@ -26,7 +26,6 @@
#include <libxml/tree.h>
#include <nanohttp/nanohttp-error.h>
-#include <nanohttp/nanohttp-common.h>
#include <nanohttp/nanohttp-logging.h>
#include <libcsoap/soap-ctx.h>
diff --git a/examples/csoap/simpleserver.c b/examples/csoap/simpleserver.c
index 3d2506a..03c3c5d 100644
--- a/examples/csoap/simpleserver.c
+++ b/examples/csoap/simpleserver.c
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: simpleserver.c,v 1.24 2006/11/25 15:06:57 m0gg Exp $
+ * $Id: simpleserver.c,v 1.25 2006/11/25 17:03:20 m0gg Exp $
*
* CSOAP Project: CSOAP examples project
* Copyright (C) 2003-2004 Ferhat Ayaz
@@ -27,7 +27,6 @@
#include <libxml/xpath.h>
#include <nanohttp/nanohttp-error.h>
-#include <nanohttp/nanohttp-common.h>
#include <nanohttp/nanohttp-logging.h>
#include <libcsoap/soap-xml.h>
@@ -47,7 +46,7 @@ say_hello(struct SoapCtx *req, struct SoapCtx *res)
herror_t err;
char *name;
- log_verbose1("service request");
+ printf("service request");
xmlNodePtr method, node;
diff --git a/examples/csoap/soapclient.c b/examples/csoap/soapclient.c
index ec6374c..e39802a 100644
--- a/examples/csoap/soapclient.c
+++ b/examples/csoap/soapclient.c
@@ -1,22 +1,31 @@
-/* soapclient.c
-// compile with
-// gcc soapclient.c -o soapclient -lcsoap
-*/
-/* Author: Adrianus Warmenhoven */
-
+/******************************************************************
+ * $Id: soapclient.c,v 1.11 2006/11/25 17:03:20 m0gg Exp $
+ *
+ * CSOAP Project: CSOAP examples project
+ * Copyright (C) 2003-2006 Adrianus Warmehoven
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307USA
+ *
+ * Author: Adrianus Warmenhoven
+ ******************************************************************/
#include <stdio.h>
#include <string.h>
-#include <ctype.h>
#include <libxml/tree.h>
-#include <libxml/uri.h>
#include <nanohttp/nanohttp-error.h>
-#include <nanohttp/nanohttp-common.h>
-
-// #include <nanohttp/nanohttp-request.h>
-// #include <nanohttp/nanohttp-response.h>
-// #include <nanohttp/nanohttp-client.h>
#include <libcsoap/soap-fault.h>
#include <libcsoap/soap-env.h>
diff --git a/libcsoap/soap-addressing.c b/libcsoap/soap-addressing.c
index e6852d8..9e89f49 100644
--- a/libcsoap/soap-addressing.c
+++ b/libcsoap/soap-addressing.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-addressing.c,v 1.5 2006/11/25 15:06:57 m0gg Exp $
+* $Id: soap-addressing.c,v 1.6 2006/11/25 17:03:20 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2006 Heiko Ronsdorf
@@ -54,7 +54,6 @@
#include <libxml/uri.h>
#include <nanohttp/nanohttp-error.h>
-#include <nanohttp/nanohttp-common.h>
#include <nanohttp/nanohttp-logging.h>
#include "soap-xml.h"
diff --git a/libcsoap/soap-nudp.c b/libcsoap/soap-nudp.c
index 93357a2..61c3169 100644
--- a/libcsoap/soap-nudp.c
+++ b/libcsoap/soap-nudp.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-nudp.c,v 1.3 2006/11/25 15:06:57 m0gg Exp $
+* $Id: soap-nudp.c,v 1.4 2006/11/25 17:03:20 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -37,7 +37,6 @@
#include <libxml/uri.h>
#include <nanohttp/nanohttp-error.h>
-#include <nanohttp/nanohttp-common.h>
#include <nanohttp/nanohttp-logging.h>
#include "soap-fault.h"
diff --git a/libcsoap/soap-transport.c b/libcsoap/soap-transport.c
index 1a30ba9..6b0444b 100644
--- a/libcsoap/soap-transport.c
+++ b/libcsoap/soap-transport.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-transport.c,v 1.3 2006/11/25 15:06:57 m0gg Exp $
+* $Id: soap-transport.c,v 1.4 2006/11/25 17:03:20 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2007 Heiko Ronsdorf
@@ -37,7 +37,6 @@
#include <libxml/uri.h>
#include <nanohttp/nanohttp-error.h>
-#include <nanohttp/nanohttp-common.h>
#include <nanohttp/nanohttp-logging.h>
#include "soap-fault.h"
diff --git a/libcsoap/soap-xmlsec.c b/libcsoap/soap-xmlsec.c
index aa6e0c2..07e12fe 100644
--- a/libcsoap/soap-xmlsec.c
+++ b/libcsoap/soap-xmlsec.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-xmlsec.c,v 1.2 2006/11/25 15:06:58 m0gg Exp $
+* $Id: soap-xmlsec.c,v 1.3 2006/11/25 17:03:20 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -51,7 +51,6 @@
#include <xmlsec/errors.h>
#include <nanohttp/nanohttp-error.h>
-#include <nanohttp/nanohttp-common.h>
#include <nanohttp/nanohttp-logging.h>
#include "soap-env.h"
diff --git a/nanohttp/nanohttp-common.h b/nanohttp/nanohttp-common.h
index 272ff91..1afd7d5 100644
--- a/nanohttp/nanohttp-common.h
+++ b/nanohttp/nanohttp-common.h
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: nanohttp-common.h,v 1.36 2006/11/25 16:35:57 m0gg Exp $
+ * $Id: nanohttp-common.h,v 1.37 2006/11/25 17:03:20 m0gg Exp $
*
* CSOAP Project: A http client/server library in C
* Copyright (C) 2003-2004 Ferhat Ayaz
@@ -457,6 +457,8 @@ typedef enum _hreq_method
* since that entity is likely to include human-readable information which will
* explain the unusual status.
*
+ * @see http://www.ietf.org/rfc/rfc2616.txt
+ *
*/
#define HTTP_STATUS_100_REASON_PHRASE "Continue"
#define HTTP_STATUS_101_REASON_PHRASE "Switching Protocols"
@@ -512,6 +514,66 @@ struct hpair
hpair_t *next;
};
+/**
+ *
+ * The protocol types in enumeration format. Used in some other nanohttp objects
+ * like hurl_t.
+ *
+ * @see hurl_t
+ *
+ */
+typedef enum _hprotocol
+{
+ PROTOCOL_HTTP,
+ PROTOCOL_HTTPS,
+ PROTOCOL_FTP
+} hprotocol_t;
+
+/**
+ *
+ * The URL object. A representation of an URL like:
+ *
+ * [protocol]://[host]:[port]/[context]
+ *
+ * @see http://www.ietf.org/rfc/rfc2396.txt
+ *
+ */
+typedef struct _hurl
+{
+ /**
+ *
+ * The transfer protocol. Note that only PROTOCOL_HTTP and PROTOCOL_HTTPS are
+ * supported by nanohttp.
+ *
+ */
+ hprotocol_t protocol;
+
+ /**
+ *
+ * The port number. If no port number was given in the URL, one of the default
+ * port numbers will be selected.
+ * - URL_HTTP_DEFAULT_PORT
+ * - URL_HTTPS_DEFAULT_PORT
+ * - URL_FTP_DEFAULT_PORT
+ *
+ */
+ short port;
+
+ /**
+ *
+ * The hostname
+ *
+ */
+ char host[URL_MAX_HOST_SIZE];
+
+ /**
+ *
+ * The string after the hostname.
+ *
+ */
+ char context[URL_MAX_CONTEXT_SIZE];
+} hurl_t;
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -634,56 +696,6 @@ extern void hpairnode_dump(hpair_t * pair);
/**
*
- * The protocol types in enumeration format. Used in some other nanohttp objects
- * like hurl_t.
- *
- * @see hurl_t
- *
- */
-typedef enum _hprotocol
-{
- PROTOCOL_HTTP,
- PROTOCOL_HTTPS,
- PROTOCOL_FTP
-} hprotocol_t;
-
-
-
-/**
- *
- * The URL object. A representation of an URL like:
- *
- * [protocol]://[host]:[port]/[context]
- *
- * @see http://www.ietf.org/rfc/rfc2396.txt
- *
- */
-typedef struct _hurl
-{
- /**
- The transfer protocol.
- Note that only PROTOCOL_HTTP is supported by nanohttp.
- */
- hprotocol_t protocol;
-
- /**
- The port number. If no port number was given in the URL,
- one of the default port numbers will be selected.
- URL_HTTP_DEFAULT_PORT
- URL_HTTPS_DEFAULT_PORT
- URL_FTP_DEFAULT_PORT
- */
- int port;
-
- /** The hostname */
- char host[URL_MAX_HOST_SIZE];
-
- /** The string after the hostname. */
- char context[URL_MAX_CONTEXT_SIZE];
-} hurl_t;
-
-/**
- *
* Parses the given 'urlstr' and fills the given hurl_t object.
*
* @param obj the destination URL object to fill
@@ -726,7 +738,6 @@ typedef struct _content_type
*/
extern content_type_t *content_type_new(const char *content_type_str);
-
/**
*
* Frees the given content_type_t object
@@ -767,7 +778,8 @@ struct attachments_t
struct part_t *root_part;
};
-extern struct attachments_t *attachments_new(void); /* should be used internally */
+/* should be used internally */
+extern struct attachments_t *attachments_new(void);
/**
*
diff --git a/nanohttp/nanohttp-logging.c b/nanohttp/nanohttp-logging.c
index 7e19d2c..5e1244d 100644
--- a/nanohttp/nanohttp-logging.c
+++ b/nanohttp/nanohttp-logging.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: nanohttp-logging.c,v 1.1 2006/07/09 16:22:52 snowdrop Exp $
+* $Id: nanohttp-logging.c,v 1.2 2006/11/25 17:03:20 m0gg Exp $
*
* CSOAP Project: A http client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -81,14 +81,12 @@ hlog_set_level(log_level_t level)
return old;
}
-
log_level_t
hlog_get_level(void)
{
return loglevel;
}
-
void
hlog_set_file(const char *filename)
{
@@ -96,16 +94,20 @@ hlog_set_file(const char *filename)
strncpy(logfile, filename, 75);
else
logfile[0] = '\0';
+
+ return;
}
void
hlog_set_background(int state)
{
log_background = state;
+
+ return;
}
char *
-hlog_get_file()
+hlog_get_file(void)
{
if (logfile[0] == '\0')
return NULL;
@@ -151,6 +153,8 @@ _log_write(log_level_t level, const char *prefix,
}
}
}
+
+ return;
}
void
diff --git a/nanohttp/nanohttp-logging.h b/nanohttp/nanohttp-logging.h
index 7bc1076..16a8ddb 100644
--- a/nanohttp/nanohttp-logging.h
+++ b/nanohttp/nanohttp-logging.h
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: nanohttp-logging.h,v 1.3 2006/11/23 15:27:33 m0gg Exp $
+ * $Id: nanohttp-logging.h,v 1.4 2006/11/25 17:03:20 m0gg Exp $
*
* CSOAP Project: A http client/server library in C
* Copyright (C) 2003-2006 Ferhat Ayaz
@@ -35,7 +35,8 @@ typedef enum log_level
HLOG_INFO,
HLOG_WARN,
HLOG_ERROR,
- HLOG_FATAL
+ HLOG_FATAL,
+ HLOG_OFF
} log_level_t;