From 82c14810dd1c101f20052c4ab92f33c57a255cc1 Mon Sep 17 00:00:00 2001 From: m0gg Date: Sat, 25 Nov 2006 15:06:57 +0000 Subject: documentation enhancements and code cleanup --- libcsoap/soap-addressing.c | 3 ++- libcsoap/soap-admin.c | 4 +++- libcsoap/soap-client.c | 6 ++--- libcsoap/soap-ctx.c | 23 +++++++++---------- libcsoap/soap-ctx.h | 55 +++++++++++++++++++++++++++++----------------- libcsoap/soap-env.c | 7 +++--- libcsoap/soap-env.h | 4 ++-- libcsoap/soap-fault.c | 4 ++-- libcsoap/soap-nhttp.c | 12 +++++----- libcsoap/soap-nudp.c | 3 ++- libcsoap/soap-router.c | 4 ++-- libcsoap/soap-server.c | 8 +++---- libcsoap/soap-service.c | 4 ++-- libcsoap/soap-transport.c | 3 ++- libcsoap/soap-wsil.c | 3 ++- libcsoap/soap-xmlsec.c | 3 ++- 16 files changed, 81 insertions(+), 65 deletions(-) (limited to 'libcsoap') diff --git a/libcsoap/soap-addressing.c b/libcsoap/soap-addressing.c index 95c47cd..e6852d8 100644 --- a/libcsoap/soap-addressing.c +++ b/libcsoap/soap-addressing.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: soap-addressing.c,v 1.4 2006/11/24 10:54:03 m0gg Exp $ +* $Id: soap-addressing.c,v 1.5 2006/11/25 15:06:57 m0gg Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2006 Heiko Ronsdorf @@ -53,6 +53,7 @@ #include #include +#include #include #include diff --git a/libcsoap/soap-admin.c b/libcsoap/soap-admin.c index b792ae6..20b3412 100644 --- a/libcsoap/soap-admin.c +++ b/libcsoap/soap-admin.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: soap-admin.c,v 1.7 2006/11/23 15:27:33 m0gg Exp $ +* $Id: soap-admin.c,v 1.8 2006/11/25 15:06:57 m0gg Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -44,12 +44,14 @@ #include #include +#include #include #include #include #include #include "soap-env.h" +#include "soap-ctx.h" #include "soap-service.h" #include "soap-router.h" #include "soap-server.h" diff --git a/libcsoap/soap-client.c b/libcsoap/soap-client.c index a49ba2a..5d34f8f 100644 --- a/libcsoap/soap-client.c +++ b/libcsoap/soap-client.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: soap-client.c,v 1.30 2006/11/23 15:27:33 m0gg Exp $ +* $Id: soap-client.c,v 1.31 2006/11/25 15:06:57 m0gg Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -28,9 +28,7 @@ #include #include -#include -#include -#include +#include #include #include "soap-fault.h" diff --git a/libcsoap/soap-ctx.c b/libcsoap/soap-ctx.c index 25c34dd..4d595f4 100755 --- a/libcsoap/soap-ctx.c +++ b/libcsoap/soap-ctx.c @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: soap-ctx.c,v 1.13 2006/11/23 15:27:33 m0gg Exp $ + * $Id: soap-ctx.c,v 1.14 2006/11/25 15:06:57 m0gg Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003-2004 Ferhat Ayaz @@ -43,6 +43,7 @@ #include +#include #include #include @@ -67,11 +68,10 @@ soap_ctx_new(struct SoapEnv * env) /* should only be used internally */ return ctx; } - void -soap_ctx_add_files(struct SoapCtx * ctx, attachments_t * attachments) +soap_ctx_add_files(struct SoapCtx *ctx, struct attachments_t *attachments) { - part_t *part; + struct part_t *part; char href[MAX_HREF_SIZE]; if (attachments == NULL) @@ -83,8 +83,9 @@ soap_ctx_add_files(struct SoapCtx * ctx, attachments_t * attachments) soap_ctx_add_file(ctx, part->filename, part->content_type, href); part = part->next; } -} + return; +} herror_t soap_ctx_add_file(struct SoapCtx * ctx, const char *filename, @@ -92,7 +93,7 @@ soap_ctx_add_file(struct SoapCtx * ctx, const char *filename, { char cid[250]; char id[250]; - part_t *part; + struct part_t *part; static int counter = 1; FILE *test = fopen(filename, "r"); if (!test) @@ -115,13 +116,13 @@ soap_ctx_add_file(struct SoapCtx * ctx, const char *filename, return H_OK; } -part_t * +struct part_t * soap_ctx_get_file(struct SoapCtx * ctx, xmlNodePtr node) { xmlChar *prop; char href[MAX_HREF_SIZE]; char buffer[MAX_HREF_SIZE]; - part_t *part; + struct part_t *part; if (!ctx->attachments) return NULL; @@ -172,15 +173,15 @@ soap_ctx_free(struct SoapCtx * ctx) return; } - herror_t soap_ctx_new_with_method(const char *urn, const char *method, struct SoapCtx ** out) { struct SoapEnv *env; herror_t err; - err = soap_env_new_with_method(urn, method, &env); - if (err != H_OK) + + if ((err = soap_env_new_with_method(urn, method, &env)) != H_OK) return err; + *out = soap_ctx_new(env); return H_OK; diff --git a/libcsoap/soap-ctx.h b/libcsoap/soap-ctx.h index b8bfb3d..a1c041a 100755 --- a/libcsoap/soap-ctx.h +++ b/libcsoap/soap-ctx.h @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: soap-ctx.h,v 1.12 2006/11/23 15:27:33 m0gg Exp $ + * $Id: soap-ctx.h,v 1.13 2006/11/25 15:06:57 m0gg Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003-2004 Ferhat Ayaz @@ -32,40 +32,55 @@ struct SoapCtx { struct SoapEnv *env; - attachments_t *attachments; + struct attachments_t *attachments; }; #ifdef __cplusplus extern "C" { #endif -/* should only be used internally */ +/** + * + * should only be used internally + * + */ extern struct SoapCtx *soap_ctx_new(struct SoapEnv * env); /** - Creates a new soap context object. -*/ + * + * Creates a new soap context object. + * + */ extern herror_t soap_ctx_new_with_method(const char *urn, const char *method, struct SoapCtx ** out); extern void soap_ctx_free(struct SoapCtx * ctx); + /** - Returns the attached file if any found. - @param ctx the SoapCtx object which should contain the part - @param node the xml node which points to a file via the "href" xml attribute + * + * Returns the attached file if any found. + * + * @param ctx the SoapCtx object which should contain the part + * @param node the xml node which points to a file via the "href" xml attribute + * + * @returns a part_t object of attachment was found, NULL otherwise. + * + */ +extern struct part_t *soap_ctx_get_file(struct SoapCtx * ctx, xmlNodePtr node); - @returns a part_t object of attachment was found, NULL otherwise. - -*/ -extern part_t *soap_ctx_get_file(struct SoapCtx * ctx, xmlNodePtr node); +/** + * + * Size of destination dest_href should be MAX_HREF_SIZE + * + */ +extern herror_t soap_ctx_add_file(struct SoapCtx * ctx, const char *filename, const char *content_type, char *dest_href); -/* Size of destination dest_href should be MAX_HREF_SIZE */ -extern herror_t soap_ctx_add_file(struct SoapCtx * ctx, const char *filename, - const char *content_type, char *dest_href); -/* -Used internally. Will switch the deleteOnExit flag from the -given one to the added part. -*/ -extern void soap_ctx_add_files(struct SoapCtx * ctx, attachments_t * attachments); +/** + * + * Used internally. Will switch the deleteOnExit flag from the given one to the + * added part. + * + */ +extern void soap_ctx_add_files(struct SoapCtx * ctx, struct attachments_t * attachments); #ifdef __cplusplus } diff --git a/libcsoap/soap-env.c b/libcsoap/soap-env.c index 6abfb1f..04146f4 100644 --- a/libcsoap/soap-env.c +++ b/libcsoap/soap-env.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: soap-env.c,v 1.25 2006/11/24 10:54:03 m0gg Exp $ +* $Id: soap-env.c,v 1.26 2006/11/25 15:06:57 m0gg Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -53,7 +53,7 @@ #include #include -#include +#include #include #include "soap-xml.h" @@ -265,8 +265,7 @@ soap_env_new_with_response(struct SoapEnv * request, struct SoapEnv ** out) { return herror_new("soap_env_new_with_response", GENERAL_INVALID_PARAM, - "Method name '%s' not found in request", - SAVE_STR(method)); + "Method name not found in request"); } if (!(urn = soap_env_find_urn(request))) diff --git a/libcsoap/soap-env.h b/libcsoap/soap-env.h index b73bb38..95867d7 100644 --- a/libcsoap/soap-env.h +++ b/libcsoap/soap-env.h @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: soap-env.h,v 1.17 2006/11/23 15:27:33 m0gg Exp $ + * $Id: soap-env.h,v 1.18 2006/11/25 15:06:57 m0gg Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -277,7 +277,7 @@ extern void soap_env_pop_item(struct SoapEnv * env); * @param env The envelope object * */ -extern void soap_env_free(struct SoapEnv * env); +extern void soap_env_free(struct SoapEnv *env); /** * diff --git a/libcsoap/soap-fault.c b/libcsoap/soap-fault.c index 8bb3945..4d86d2b 100644 --- a/libcsoap/soap-fault.c +++ b/libcsoap/soap-fault.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: soap-fault.c,v 1.14 2006/11/24 10:54:03 m0gg Exp $ +* $Id: soap-fault.c,v 1.15 2006/11/25 15:06:57 m0gg Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -31,7 +31,7 @@ #include -#include +#include #include #include "soap-xml.h" diff --git a/libcsoap/soap-nhttp.c b/libcsoap/soap-nhttp.c index b8b0e35..0546c58 100644 --- a/libcsoap/soap-nhttp.c +++ b/libcsoap/soap-nhttp.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: soap-nhttp.c,v 1.2 2006/11/23 15:27:33 m0gg Exp $ +* $Id: soap-nhttp.c,v 1.3 2006/11/25 15:06:57 m0gg Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -40,10 +40,10 @@ #include #include +#include #include #include #include - #include #include @@ -273,7 +273,7 @@ _soap_nhttp_client_invoke(void *unused, struct SoapCtx *request, struct SoapCtx /* multipart/related start id */ char start_id[150]; static int counter = 1; - part_t *part; + struct part_t *part; /* for copy attachments */ char href[MAX_HREF_SIZE]; @@ -363,11 +363,9 @@ _soap_nhttp_client_invoke(void *unused, struct SoapCtx *request, struct SoapCtx for (part=request->attachments->parts; part; part=part->next) { - status = httpc_mime_send_file(conn, part->id, part->content_type, part->transfer_encoding, part->filename); - - if (status != H_OK) + if ((status = httpc_mime_send_file(conn, part->id, part->content_type, part->transfer_encoding, part->filename)) != H_OK) { - log_error2("Send file failed. Status: %d", status); + log_error2("httpc_mime_send_file failed (%s)", herror_message(status)); httpc_close_free(conn); xmlBufferFree(buffer); return status; diff --git a/libcsoap/soap-nudp.c b/libcsoap/soap-nudp.c index 4520631..93357a2 100644 --- a/libcsoap/soap-nudp.c +++ b/libcsoap/soap-nudp.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: soap-nudp.c,v 1.2 2006/11/23 15:27:33 m0gg Exp $ +* $Id: soap-nudp.c,v 1.3 2006/11/25 15:06:57 m0gg Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -36,6 +36,7 @@ #include #include +#include #include #include diff --git a/libcsoap/soap-router.c b/libcsoap/soap-router.c index c0891f6..cc443ca 100644 --- a/libcsoap/soap-router.c +++ b/libcsoap/soap-router.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: soap-router.c,v 1.13 2006/11/23 15:27:33 m0gg Exp $ +* $Id: soap-router.c,v 1.14 2006/11/25 15:06:57 m0gg Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -39,7 +39,7 @@ #include -#include +#include #include #include "soap-fault.h" diff --git a/libcsoap/soap-server.c b/libcsoap/soap-server.c index 78114c2..2f7a0b2 100644 --- a/libcsoap/soap-server.c +++ b/libcsoap/soap-server.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: soap-server.c,v 1.31 2006/11/24 10:54:03 m0gg Exp $ +* $Id: soap-server.c,v 1.32 2006/11/25 15:06:57 m0gg Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -40,9 +40,7 @@ #include #include -#include -#include -#include +#include #include #include "soap-fault.h" @@ -119,7 +117,7 @@ _soap_server_fillup_header(struct SoapEnv *envelope) else xmlFreeURI(uri); - if (!(uri = soap_addressing_get_from(envelope))) + if (!(uri = soap_addressing_get_from_address(envelope))) soap_addressing_set_from_string(envelope, soap_server_get_name()); else xmlFreeURI(uri); diff --git a/libcsoap/soap-service.c b/libcsoap/soap-service.c index 241eb82..e63dd22 100644 --- a/libcsoap/soap-service.c +++ b/libcsoap/soap-service.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: soap-service.c,v 1.11 2006/11/23 15:27:33 m0gg Exp $ +* $Id: soap-service.c,v 1.12 2006/11/25 15:06:57 m0gg Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -48,7 +48,7 @@ #include #include -#include +#include #include #include "soap-fault.h" diff --git a/libcsoap/soap-transport.c b/libcsoap/soap-transport.c index 1fc2c51..1a30ba9 100644 --- a/libcsoap/soap-transport.c +++ b/libcsoap/soap-transport.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: soap-transport.c,v 1.2 2006/11/23 15:27:33 m0gg Exp $ +* $Id: soap-transport.c,v 1.3 2006/11/25 15:06:57 m0gg Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2007 Heiko Ronsdorf @@ -36,6 +36,7 @@ #include #include +#include #include #include diff --git a/libcsoap/soap-wsil.c b/libcsoap/soap-wsil.c index 7e0a7f2..2a11130 100644 --- a/libcsoap/soap-wsil.c +++ b/libcsoap/soap-wsil.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: soap-wsil.c,v 1.2 2006/11/23 15:27:33 m0gg Exp $ +* $Id: soap-wsil.c,v 1.3 2006/11/25 15:06:58 m0gg Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -35,6 +35,7 @@ #include +#include #include #include #include diff --git a/libcsoap/soap-xmlsec.c b/libcsoap/soap-xmlsec.c index 66ec75b..aa6e0c2 100644 --- a/libcsoap/soap-xmlsec.c +++ b/libcsoap/soap-xmlsec.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: soap-xmlsec.c,v 1.1 2006/11/24 11:22:55 m0gg Exp $ +* $Id: soap-xmlsec.c,v 1.2 2006/11/25 15:06:58 m0gg Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -50,6 +50,7 @@ #include #include +#include #include #include -- cgit v1.1-32-gdbae