stdsoap2.cpp revision db3dbd0ed7eb69f804a8921fa23a1267ea01f46e
/*
stdsoap2.c[pp] 2.7.9e
gSOAP runtime
gSOAP XML Web services tools
Copyright (C) 2000-2007, Robert van Engelen, Genivia Inc., All Rights Reserved.
This part of the software is released under one of the following licenses:
GPL, the gSOAP public license, or Genivia's license for commercial use.
--------------------------------------------------------------------------------
Contributors:
Wind River Systems Inc., for the following additions under gSOAP public license:
- vxWorks compatible (#define VXWORKS)
--------------------------------------------------------------------------------
gSOAP public license.
The contents of this file are subject to the gSOAP Public License Version 1.3
(the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the License.
The Initial Developer of the Original Code is Robert A. van Engelen.
Copyright (C) 2000-2007, Robert van Engelen, Genivia Inc., All Rights Reserved.
--------------------------------------------------------------------------------
GPL license.
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, MA 02111-1307 USA
Author contact information:
engelen@genivia.com / engelen@acm.org
--------------------------------------------------------------------------------
A commercial use license is available from Genivia, Inc., contact@genivia.com
--------------------------------------------------------------------------------
Installation note:
Win32 build needs winsock.dll (Visual C++ "wsock32.lib")
To do this in Visual C++ 6.0, go to "Project", "settings", select the "Link"
tab (the project file needs to be selected in the file view) and add
On Mac OS X with gcc (GCC) 3.1 20020420 (prerelease) you MUST compile with
-fstack_check when using -O2 because gcc 3.1 has a bug that smashes the stack
when locally allocated data exceeds 64K.
*/
#ifdef AS400
#endif
#include "stdsoap2.h"
#ifdef WIN32
#endif
#ifdef __cplusplus
SOAP_SOURCE_STAMP("@(#) stdsoap2.cpp ver 2.7.9e 2007-03-31 12:00:00 GMT")
extern "C" {
#else
SOAP_SOURCE_STAMP("@(#) stdsoap2.c ver 2.7.9e 2007-03-31 12:00:00 GMT")
#endif
/* 8bit character representing unknown/nonrepresentable character data (e.g. not supported by current locale with multibyte support enabled) */
#ifndef SOAP_UNKNOWN_CHAR
#define SOAP_UNKNOWN_CHAR (127)
#endif
/* EOF=-1 */
#define soap_blank(c) ((c) >= 0 && (c) <= 32)
#define soap_notblank(c) ((c) > 32)
#else
#endif
#ifdef SOAP_DEBUG
static void soap_init_logs(struct soap*);
static void soap_close_logfile(struct soap*, int);
static void soap_set_logfile(struct soap*, int, const char*);
#endif
#ifdef SOAP_MEM_DEBUG
static void soap_init_mht(struct soap*);
static void soap_free_mht(struct soap*);
static void soap_track_unlink(struct soap*, const void*);
#endif
#ifndef PALM_2
static int soap_set_error(struct soap*, const char*, const char*, const char*, const char*, int);
static int soap_copy_fault(struct soap*, const char*, const char*, const char*, const char*);
#endif
#ifndef PALM_1
static int soap_isxdigit(int);
#ifndef WITH_NOIDREF
static void soap_update_ptrs(struct soap*, char*, char*, char*, char*);
static int soap_has_copies(struct soap*, const char*, const char*);
static void soap_init_iht(struct soap*);
static void soap_free_iht(struct soap*);
static void soap_init_pht(struct soap*);
static void soap_free_pht(struct soap*);
#endif
#endif
#ifndef WITH_LEAN
static const char *soap_set_validation_fault(struct soap*, const char*, const char*);
static int soap_isnumeric(struct soap*, const char*);
static struct soap_nlist *soap_push_ns(struct soap *soap, const char *id, const char *ns, short utilized);
#endif
#ifndef WITH_LEANER
#ifndef PALM_1
static struct soap_multipart *soap_new_multipart(struct soap*, struct soap_multipart**, struct soap_multipart**, char*, size_t);
static void soap_select_mime_boundary(struct soap*);
static int soap_valid_mime_boundary(struct soap*);
#endif
#endif
#ifdef WITH_GZIP
static int soap_getgziphdr(struct soap*);
#endif
#ifdef WITH_OPENSSL
static int ssl_init_done = 0;
static int ssl_auth_init(struct soap*);
static int ssl_verify_callback(int, X509_STORE_CTX*);
static int ssl_password(char*, int, int, void *);
/* This callback is included for future references. It should not be deleted
static DH *ssl_tmp_dh(SSL*, int, int);
*/
#endif
#if !defined(WITH_NOHTTP) || !defined(WITH_LEANER)
#ifndef PALM_1
static const char *soap_decode(char*, size_t, const char*, const char*);
#endif
#endif
#ifndef WITH_NOHTTP
#ifndef PALM_1
static const char *http_error(struct soap*, int);
static int http_post(struct soap*, const char*, const char*, int, const char*, const char*, size_t);
static int http_send_header(struct soap*, const char*);
static int http_post_header(struct soap*, const char*, const char*);
static int http_parse(struct soap*);
static int http_parse_header(struct soap*, const char*, const char*);
#endif
#endif
#ifndef WITH_NOIO
#ifndef PALM_1
#ifndef WITH_LEAN
#endif
#ifndef WITH_IPV6
#endif
static int tcp_disconnect(struct soap*);
static const char *soap_strerror(struct soap*);
#endif
#endif
unsigned short errno;
#endif
#ifndef PALM_1
#endif
#ifndef PALM_1
static const char soap_base64o[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
static const char soap_base64i[81] = "\76XXX\77\64\65\66\67\70\71\72\73\74\75XXXXXXX\00\01\02\03\04\05\06\07\10\11\12\13\14\15\16\17\20\21\22\23\24\25\26\27\30\31XXXXXX\32\33\34\35\36\37\40\41\42\43\44\45\46\47\50\51\52\53\54\55\56\57\60\61\62\63";
#endif
#ifndef WITH_LEAN
/* Alternative indentation form for SOAP_XML_INDENT:
static const char soap_indent[21] = "\n ";
*/
#endif
#ifndef SOAP_CANARY
# define SOAP_CANARY (0xC0DE)
#endif
#define SOAP_STR_PADDING (soap_padding)
#define SOAP_STR_EOS (soap_padding)
#define SOAP_NON_NULL (soap_padding)
#ifndef WITH_LEAN
{ { 160, "nbsp" },
{ 161, "iexcl" },
{ 162, "cent" },
{ 163, "pound" },
{ 164, "curren" },
{ 165, "yen" },
{ 166, "brvbar" },
{ 167, "sect" },
{ 168, "uml" },
{ 169, "copy" },
{ 170, "ordf" },
{ 171, "laquo" },
{ 172, "not" },
{ 173, "shy" },
{ 174, "reg" },
{ 175, "macr" },
{ 176, "deg" },
{ 177, "plusmn" },
{ 178, "sup2" },
{ 179, "sup3" },
{ 180, "acute" },
{ 181, "micro" },
{ 182, "para" },
{ 183, "middot" },
{ 184, "cedil" },
{ 185, "sup1" },
{ 186, "ordm" },
{ 187, "raquo" },
{ 188, "frac14" },
{ 189, "frac12" },
{ 190, "frac34" },
{ 191, "iquest" },
{ 192, "Agrave" },
{ 193, "Aacute" },
{ 194, "Acirc" },
{ 195, "Atilde" },
{ 196, "Auml" },
{ 197, "Aring" },
{ 198, "AElig" },
{ 199, "Ccedil" },
{ 200, "Egrave" },
{ 201, "Eacute" },
{ 202, "Ecirc" },
{ 203, "Euml" },
{ 204, "Igrave" },
{ 205, "Iacute" },
{ 206, "Icirc" },
{ 207, "Iuml" },
{ 208, "ETH" },
{ 209, "Ntilde" },
{ 210, "Ograve" },
{ 211, "Oacute" },
{ 212, "Ocirc" },
{ 213, "Otilde" },
{ 214, "Ouml" },
{ 215, "times" },
{ 216, "Oslash" },
{ 217, "Ugrave" },
{ 218, "Uacute" },
{ 219, "Ucirc" },
{ 220, "Uuml" },
{ 221, "Yacute" },
{ 222, "THORN" },
{ 223, "szlig" },
{ 224, "agrave" },
{ 225, "aacute" },
{ 226, "acirc" },
{ 227, "atilde" },
{ 228, "auml" },
{ 229, "aring" },
{ 230, "aelig" },
{ 231, "ccedil" },
{ 232, "egrave" },
{ 233, "eacute" },
{ 234, "ecirc" },
{ 235, "euml" },
{ 236, "igrave" },
{ 237, "iacute" },
{ 238, "icirc" },
{ 239, "iuml" },
{ 240, "eth" },
{ 241, "ntilde" },
{ 242, "ograve" },
{ 243, "oacute" },
{ 244, "ocirc" },
{ 245, "otilde" },
{ 246, "ouml" },
{ 247, "divide" },
{ 248, "oslash" },
{ 249, "ugrave" },
{ 250, "uacute" },
{ 251, "ucirc" },
{ 252, "uuml" },
{ 253, "yacute" },
{ 254, "thorn" },
{ 255, "yuml" },
{ 0, NULL }
};
#endif
#ifndef WITH_NOIO
#ifndef WITH_LEAN
static const struct soap_code_map h_error_codes[] =
{
#ifdef HOST_NOT_FOUND
{ HOST_NOT_FOUND, "Host not found" },
#endif
#ifdef TRY_AGAIN
{ TRY_AGAIN, "Try Again" },
#endif
#ifdef NO_RECOVERY
{ NO_RECOVERY, "No Recovery" },
#endif
#ifdef NO_DATA
{ NO_DATA, "No Data" },
#endif
#ifdef NO_ADDRESS
{ NO_ADDRESS, "No Address" },
#endif
{ 0, NULL }
};
#endif
#endif
#ifndef WITH_NOHTTP
#ifndef WITH_LEAN
static const struct soap_code_map h_http_error_codes[] =
{ { 200, "OK" },
{ 201, "Created" },
{ 202, "Accepted" },
{ 203, "Non-Authoritative Information" },
{ 204, "No Content" },
{ 205, "Reset Content" },
{ 206, "Partial Content" },
{ 300, "Multiple Choices" },
{ 301, "Moved Permanently" },
{ 302, "Found" },
{ 303, "See Other" },
{ 304, "Not Modified" },
{ 305, "Use Proxy" },
{ 307, "Temporary Redirect" },
{ 400, "Bad Request" },
{ 401, "Unauthorized" },
{ 402, "Payment Required" },
{ 403, "Forbidden" },
{ 404, "Not Found" },
{ 405, "Method Not Allowed" },
{ 406, "Not Acceptable" },
{ 407, "Proxy Authentication Required" },
{ 408, "Request Time-out" },
{ 409, "Conflict" },
{ 410, "Gone" },
{ 411, "Length Required" },
{ 412, "Precondition Failed" },
{ 413, "Request Entity Too Large" },
{ 414, "Request-URI Too Large" },
{ 415, "Unsupported Media Type" },
{ 416, "Requested range not satisfiable" },
{ 417, "Expectation Failed" },
{ 500, "Internal Server Error" },
{ 501, "Not Implemented" },
{ 502, "Bad Gateway" },
{ 503, "Service Unavailable" },
{ 504, "Gateway Time-out" },
{ 505, "HTTP Version not supported" },
{ 0, NULL }
};
#endif
#endif
#ifdef WITH_OPENSSL
static const struct soap_code_map h_ssl_error_codes[] =
{
#define _SSL_ERROR(e) { e, #e }
{ 0, NULL }
};
#endif
#ifndef WITH_LEANER
static const struct soap_code_map mime_codes[] =
{ { SOAP_MIME_7BIT, "7bit" },
{ SOAP_MIME_8BIT, "8bit" },
{ SOAP_MIME_BINARY, "binary" },
{ SOAP_MIME_QUOTED_PRINTABLE, "quoted-printable" },
{ SOAP_MIME_BASE64, "base64" },
{ SOAP_MIME_IETF_TOKEN, "ietf-token" },
{ SOAP_MIME_X_TOKEN, "x-token" },
{ 0, NULL }
};
#endif
#ifdef WIN32
static int tcp_done = 0;
#endif
/******************************************************************************/
#ifndef WITH_NOIO
#ifndef PALM_1
static int
#if defined(__cplusplus) && !defined(WITH_LEAN)
return SOAP_OK;
return SOAP_EOF;
}
#endif
while (n)
{
#ifndef WITH_LEAN
if (soap->send_timeout)
if (soap->send_timeout > 0)
}
else
}
#ifndef WIN32
return SOAP_FD_EXCEEDED; /* Hint: MUST increase FD_SETSIZE */
#endif
for (;;)
{ register int r;
#ifdef WITH_OPENSSL
else
#endif
if (r > 0)
break;
if (!r)
return SOAP_EOF;
}
return SOAP_EOF;
}
}
}
#endif
#ifdef WITH_OPENSSL
else
#endif
#ifdef WITH_UDP
nwritten = sendto((SOAP_SOCKET)soap->socket, s, n, soap->socket_flags, (struct sockaddr*)&soap->peer, soap->peerlen);
else
/* retry and back-off algorithm */
/* TODO: this is not very clear from specs so verify and limit conditions under which we should loop (e.g. ENOBUFS) */
if (nwritten < 0)
int udp_repeat;
int udp_delay;
#ifndef WIN32
return SOAP_FD_EXCEEDED; /* Hint: MUST increase FD_SETSIZE */
#endif
else
do
nwritten = sendto((SOAP_SOCKET)soap->socket, s, n, soap->socket_flags, (struct sockaddr*)&soap->peer, soap->peerlen);
else
udp_delay <<= 1;
udp_delay = 500;
}
while (nwritten < 0 && --udp_repeat > 0);
}
}
else
#endif
#else
#endif
if (nwritten <= 0)
{ register int r = 0;
#ifdef WITH_OPENSSL
if (soap->ssl && (r = SSL_get_error(soap->ssl, nwritten)) != SSL_ERROR_NONE && r != SSL_ERROR_WANT_READ && r != SSL_ERROR_WANT_WRITE)
return SOAP_EOF;
#endif
{
#ifndef WITH_LEAN
if (soap->send_timeout > 0)
}
else if (soap->send_timeout < 0)
}
else
}
#ifndef WIN32
return SOAP_FD_EXCEEDED; /* Hint: MUST increase FD_SETSIZE */
#endif
#ifdef WITH_OPENSSL
else
#else
#endif
return SOAP_EOF;
}
#endif
}
return SOAP_EOF;
}
nwritten = 0; /* and call write() again */
}
}
else
{
#ifdef WITH_FASTCGI
#else
#ifdef UNDER_CE
#else
#ifdef VXWORKS
#ifdef WMW_RPM_IO
else
#endif
#else
#endif
#endif
#endif
if (nwritten <= 0)
{ err = soap_errno;
return SOAP_EOF;
}
nwritten = 0; /* and call write() again */
}
}
n -= nwritten;
s += nwritten;
}
return SOAP_OK;
}
#endif
#endif
/******************************************************************************/
#ifndef PALM_1
int
{ if (!n)
return SOAP_OK;
#ifndef WITH_LEANER
#endif
return SOAP_OK;
}
while (n >= i)
if (soap_flush(soap))
s += i;
n -= i;
i = SOAP_BUFLEN;
}
return SOAP_OK;
}
return soap_flush_raw(soap, s, n);
}
#endif
/******************************************************************************/
#ifndef PALM_1
int
if (n)
#ifdef WITH_ZLIB
#ifdef WITH_GZIP
#endif
do
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unable to deflate: %s\n", soap->d_stream.msg?soap->d_stream.msg:""));
}
}
}
else
#endif
}
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef PALM_1
int
{ register char *t;
if (!(t = (char*)soap_push_block(soap, n)))
memcpy(t, s, n);
#ifndef WITH_LEANER
if (soap->fpreparesend)
#endif
return SOAP_OK;
}
#ifndef WITH_LEANER
{ char t[16];
}
#endif
}
#endif
/******************************************************************************/
#ifndef PALM_1
int
{ if (s)
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_1
int
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_1
int
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOIO
#ifndef PALM_1
static size_t
{ register int r;
#ifdef PALM
register int timeouts = 10;
#endif
#if defined(__cplusplus) && !defined(WITH_LEAN)
return 0;
}
#endif
{ for (;;)
{
#ifdef WITH_OPENSSL
register int err = 0;
#endif
#ifndef WITH_LEAN
if (soap->recv_timeout)
if (soap->recv_timeout > 0)
}
else
}
#ifndef WIN32
return 0; /* Hint: MUST increase FD_SETSIZE */
}
#endif
for (;;)
{
#ifdef WITH_OPENSSL
else
#else
#endif
if (r > 0)
break;
if (!r)
return 0;
}
if (r != SOAP_EINTR && r != SOAP_EAGAIN)
return 0;
}
}
}
#endif
#ifdef WITH_OPENSSL
if (r > 0)
return (size_t)r;
return 0;
}
if (r > 0)
return (size_t)r;
return 0;
}
else
#endif
{
#ifdef WITH_UDP
r = recvfrom((SOAP_SOCKET)soap->socket, s, n, soap->socket_flags, (struct sockaddr*)&soap->peer, &k); /* portability note: see SOAP_SOCKLEN_T definition in stdsoap2.h */
#ifndef WITH_IPV6
#endif
}
else
#endif
#ifdef PALM
/* CycleSyncDisplay(curStatusMsg); */
#endif
if (r >= 0)
return (size_t)r;
return 0;
}
}
#ifndef WITH_LEAN
if (soap->recv_timeout > 0)
}
else if (soap->recv_timeout < 0)
}
else
}
#ifndef WIN32
return 0; /* Hint: MUST increase FD_SETSIZE */
}
#endif
#ifdef WITH_OPENSSL
else
#else
#endif
return 0;
}
if (!r && soap->recv_timeout)
return 0;
}
}
#endif
#ifdef PALM
if (r != SOAP_EINTR && timeouts-- <= 0)
return 0;
}
#endif
}
}
#ifdef WITH_FASTCGI
#else
#ifdef UNDER_CE
#else
#ifdef WMW_RPM_IO
else
#endif
if (r >= 0)
return (size_t)r;
return 0;
#endif
#endif
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEAN
#ifndef WITH_NOIO
#ifndef PALM_1
static size_t
{ return 0;
}
#endif
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOHTTP
#ifndef PALM_1
static soap_wchar
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Read %u bytes from socket %d\n", (unsigned int)soap->buflen, soap->socket));
return EOF;
}
#endif
#endif
/******************************************************************************/
#ifndef PALM_1
static int
soap_isxdigit(int c)
{ return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f');
}
#endif
/******************************************************************************/
#ifndef PALM_1
int
#ifdef WITH_ZLIB
return EOF;
{ register int r;
if (r == Z_OK || r == Z_STREAM_END)
if (r == Z_STREAM_END)
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflated %lu->%lu bytes\n", soap->d_stream.total_in, soap->d_stream.total_out));
}
if (ret)
return SOAP_OK;
}
}
else if (r != Z_BUF_ERROR)
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflate error: %s\n", soap->d_stream.msg?soap->d_stream.msg:""));
return EOF;
}
}
}
}
#endif
#ifndef WITH_NOHTTP
{
{ soap->buflen = ret = soap->frecv(soap, soap->buf, soap->chunksize > SOAP_BUFLEN ? SOAP_BUFLEN : soap->chunksize);
}
else
{ register soap_wchar c;
char *t, tmp[8];
t = tmp;
if (!soap->chunkbuflen)
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Read %u bytes (chunked) from socket %d\n", (unsigned int)ret, soap->socket));
if (!ret)
}
else
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Getting chunk size (idx=%u len=%u)\n", (unsigned int)soap->bufidx, (unsigned int)soap->buflen));
{ if ((int)c == EOF)
}
do
*t++ = (char)c;
while ((int)c != EOF && c != '\n')
c = soap_getchunkchar(soap);
if ((int)c == EOF)
*t = '\0';
{ soap->chunkbuflen = 0;
while ((int)c != EOF && c != '\n')
c = soap_getchunkchar(soap);
}
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Moving buf len to idx=%u len=%u (%s)\n", (unsigned int)soap->bufidx, (unsigned int)soap->buflen, tmp));
soap->chunkbuflen = 0;
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Passed end of buffer for chunked HTTP (%u bytes left)\n", (unsigned int)(soap->buflen - soap->bufidx)));
}
else if (soap->chunkbuflen)
if (!ret)
goto chunk_again;
}
}
else
#endif
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Read %u bytes from socket %d\n", (unsigned int)ret, soap->socket));
}
#ifndef WITH_LEANER
#endif
#ifdef WITH_ZLIB
{ register int r;
if (r == Z_OK || r == Z_STREAM_END)
if (!ret)
goto zlib_again;
if (r == Z_STREAM_END)
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflated %lu->%lu bytes\n", soap->d_stream.total_in, soap->d_stream.total_out));
}
}
else
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unable to inflate: (%d) %s\n", r, soap->d_stream.msg?soap->d_stream.msg:""));
return EOF;
}
}
#endif
return !ret;
}
#endif
/******************************************************************************/
#ifndef PALM_1
int
{
#ifndef WITH_LEANER
{ char *s;
int i;
unsigned char tmp[12];
if (soap_recv_raw(soap))
return EOF;
}
s = (char*)tmp;
for (i = 12; i > 0; i--)
if (soap_recv_raw(soap))
return EOF;
}
soap->dime.size = ((size_t)tmp[8] << 24) | ((size_t)tmp[9] << 16) | ((size_t)tmp[10] << 8) | ((size_t)tmp[11]);
}
else
}
else
}
return SOAP_OK;
}
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Get next DIME hdr for chunked DIME (%u bytes chunk)\n", (unsigned int)soap->dime.chunksize));
if (soap_recv_raw(soap))
return EOF;
}
else
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "%lu bytes remaining, count=%u\n", (unsigned long)(soap->buflen-soap->bufidx), (unsigned int)soap->count));
return SOAP_OK;
}
}
#endif
return soap_recv_raw(soap);
}
#endif
/******************************************************************************/
#ifndef PALM_1
{ register soap_wchar c;
if (c)
{ if (c != EOF)
return c;
}
}
#endif
/******************************************************************************/
#ifndef PALM_1
const struct soap_code_map*
return code_map;
code_map++;
}
}
return NULL;
}
#endif
/******************************************************************************/
#ifndef PALM_1
long
{ if (code_map)
code_map++;
}
}
return other;
}
#endif
/******************************************************************************/
#ifndef PALM_1
const char*
{ if (!code_map)
return NULL;
code_map++;
}
#endif
/******************************************************************************/
#ifndef PALM_1
long
{ register long bits = 0;
if (code_map)
{ const struct soap_code_map *p;
str += n;
str++;
break;
}
}
if (!p->string)
return 0;
}
}
return bits;
}
#endif
/******************************************************************************/
#ifndef PALM_1
const char*
if (code_map)
*t++ = ' ';
*t++ = *s++;
break;
}
code_map++;
}
}
*t = '\0';
}
#endif
/******************************************************************************/
#ifndef PALM_1
static soap_wchar
{ char tmp[8];
register int i;
register soap_wchar c;
register char *s = tmp;
for (i = 0; i < 7; i++)
if (c == ';' || (int)c == EOF)
break;
*s++ = (char)c;
}
*s = '\0';
if (*tmp == '#')
}
return '<';
return '>';
return '&';
return '"';
return '\'';
#ifndef WITH_LEAN
#else
return SOAP_UNKNOWN_CHAR; /* use this to represent unknown code */
#endif
}
#endif
/******************************************************************************/
#ifdef WITH_LEAN
#ifndef PALM_1
return EOF;
}
#endif
#endif
/******************************************************************************/
#ifdef WITH_LEAN
#ifndef PALM_1
return EOF;
}
#endif
#endif
/******************************************************************************/
#ifndef PALM_1
{ register soap_wchar c;
if (c)
{ if ((int)c != EOF)
}
else
while ((int)c != EOF)
{ if (c == ']')
if (c == ']')
if (c == '>')
}
else
return ']';
}
}
else
{ soap_revget1(soap);
return ']';
}
}
else
return c;
}
switch (c)
{ case '<':
while (soap_blank(c));
if (c == '!' || c == '?' || c == '%')
{ register int k = 1;
if (c == '!')
if (c == '[')
while ((int)c != EOF && c != '[');
if ((int)c == EOF)
break;
continue;
}
{ do
break;
} while ((int)c != EOF);
}
}
else if (c == '?')
c = soap_get_pi(soap);
while ((int)c != EOF)
{ if (c == '<')
k++;
else if (c == '>')
{ if (--k <= 0)
break;
}
}
if ((int)c == EOF)
break;
continue;
}
if (c == '/')
return SOAP_TT;
return SOAP_LT;
case '>':
return SOAP_GT;
case '"':
return SOAP_QT;
case '\'':
return SOAP_AP;
case '&':
}
break;
}
return c;
}
#endif
/******************************************************************************/
#ifndef PALM_1
static soap_wchar
{ char buf[64];
register char *s = buf;
register int i = sizeof(buf);
/* This is a quick way to parse XML PI and we could use a callback instead to
* enable applications to intercept processing instructions */
while ((int)c != EOF && c != '?')
{ if (--i > 0)
{ if (soap_blank(c))
c = ' ';
*s++ = (char)c;
}
c = soap_getchar(soap);
}
*s = '\0';
if (s && s[10])
}
}
}
}
if ((int)c != EOF)
c = soap_getchar(soap);
return c;
}
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_1
int
for (; n > 0; n--)
return SOAP_EOF;
return SOAP_OK;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_1
}
#endif
#endif
/******************************************************************************/
#ifndef PALM_1
int
{ char tmp[16];
if (c < 0x80 && c >= 0x20)
{ *tmp = (char)c;
}
#ifndef WITH_LEAN
{ register char *t = tmp;
if (c < 0x0800)
*t++ = (char)(0xC0 | ((c >> 6) & 0x1F));
else
{ if (c < 0x010000)
*t++ = (char)(0xE0 | ((c >> 12) & 0x0F));
else
{ if (c < 0x200000)
*t++ = (char)(0xF0 | ((c >> 18) & 0x07));
else
{ if (c < 0x04000000)
*t++ = (char)(0xF8 | ((c >> 24) & 0x03));
else
{ *t++ = (char)(0xFC | ((c >> 30) & 0x01));
*t++ = (char)(0x80 | ((c >> 24) & 0x3F));
}
*t++ = (char)(0x80 | ((c >> 18) & 0x3F));
}
*t++ = (char)(0x80 | ((c >> 12) & 0x3F));
}
*t++ = (char)(0x80 | ((c >> 6) & 0x3F));
}
*t++ = (char)(0x80 | (c & 0x3F));
*t = '\0';
}
else
#endif
}
#endif
/******************************************************************************/
#ifndef PALM_1
if (c > 0xFF)
return c;
}
return c;
if (c1 < 0x80)
return c;
}
c1 &= 0x3F;
if (c < 0xE0)
goto again;
if (c < 0xF0)
if (c < 0xF8)
if (c < 0xFC)
return ((soap_wchar)(c & 0x01) << 30) | (c1 << 24) | (c2 << 18) | (c3 << 12) | (c4 << 6) | (soap_wchar)(soap_get1(soap) & 0x3F);
}
#endif
/******************************************************************************/
#ifndef PALM_1
int
{ char d[2];
register int i;
#ifdef WITH_DOM
return SOAP_OK;
}
#endif
for (i = 0; i < n; i++)
{ register int m = *s++;
d[0] = (char)((m >> 4) + (m > 159 ? '7' : '0'));
m &= 0x0F;
d[1] = (char)(m + (m > 9 ? '7' : '0'));
}
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef PALM_1
unsigned char*
{
#ifdef WITH_DOM
}
#endif
#ifdef WITH_FAST
for (;;)
{ register char *s;
register int i, k;
return NULL;
for (i = 0; i < k; i++)
register soap_wchar c;
if (soap_isxdigit(c))
{ d1 = (char)c;
if (soap_isxdigit(c))
d2 = (char)c;
else
return NULL;
}
}
else
{ unsigned char *p;
soap_unget(soap, c);
if (n)
if (p)
return p;
}
}
}
#else
if (soap_new_block(soap))
return NULL;
for (;;)
{ register int i;
if (!s)
{ soap_end_block(soap);
return NULL;
}
for (i = 0; i < SOAP_BLKLEN; i++)
if (soap_isxdigit(c))
{ d1 = (char)c;
if (soap_isxdigit(c))
d2 = (char)c;
else
{ soap_end_block(soap);
return NULL;
}
}
else
{ unsigned char *p;
soap_unget(soap, c);
if (n)
*n = soap_size_block(soap, i);
return p;
}
}
}
#endif
}
#endif
/******************************************************************************/
#ifndef PALM_1
int
{ register int i;
register unsigned long m;
char d[4];
if (!s)
return SOAP_OK;
#ifdef WITH_DOM
return SOAP_OK;
}
#endif
for (; n > 2; n -= 3, s += 3)
{ m = s[0];
m = (m << 8) | s[1];
m = (m << 8) | s[2];
for (i = 4; i > 0; m >>= 6)
d[--i] = soap_base64o[m & 0x3F];
}
if (n > 0)
{ m = 0;
for (i = 0; i < n; i++)
m = (m << 8) | *s++;
for (; i < 3; i++)
m <<= 8;
for (i++; i > 0; m >>= 6)
d[--i] = soap_base64o[m & 0x3F];
for (i = 3; i > n; i--)
d[i] = '=';
}
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef PALM_1
unsigned char*
{
#ifdef WITH_DOM
}
#endif
#ifdef WITH_FAST
for (;;)
{ register int i, k;
register char *s;
return NULL;
if (!s)
return NULL;
for (i = 0; i < k - 2; i += 3)
{ register unsigned long m = 0;
register int j = 0;
do
if (c == '=' || c < 0)
{ unsigned char *p;
switch (j)
{ case 2:
*s++ = (char)((m >> 4) & 0xFF);
i++;
break;
case 3:
*s++ = (char)((m >> 10) & 0xFF);
*s++ = (char)((m >> 2) & 0xFF);
i += 2;
}
if (n)
if (p)
if (c >= 0)
;
}
soap_unget(soap, c);
return p;
}
c -= '+';
if (c >= 0 && c <= 79)
{ int b = soap_base64i[c];
if (b >= 64)
return NULL;
}
m = (m << 6) + b;
j++;
}
else if (!soap_blank(c + '+'))
return NULL;
}
} while (j < 4);
*s++ = (char)((m >> 16) & 0xFF);
*s++ = (char)((m >> 8) & 0xFF);
*s++ = (char)(m & 0xFF);
}
}
#else
if (soap_new_block(soap))
return NULL;
for (;;)
{ register int i;
if (!s)
{ soap_end_block(soap);
return NULL;
}
for (i = 0; i < SOAP_BLKLEN; i++)
{ register unsigned long m = 0;
register int j = 0;
do
if (c == '=' || c < 0)
{ unsigned char *p;
i *= 3;
switch (j)
{ case 2:
*s++ = (char)((m >> 4) & 0xFF);
i++;
break;
case 3:
*s++ = (char)((m >> 10) & 0xFF);
*s++ = (char)((m >> 2) & 0xFF);
i += 2;
}
if (n)
*n = (int)soap_size_block(soap, i);
if (c >= 0)
;
}
soap_unget(soap, c);
return p;
}
c -= '+';
if (c >= 0 && c <= 79)
{ int b = soap_base64i[c];
if (b >= 64)
return NULL;
}
m = (m << 6) + b;
j++;
}
else if (!soap_blank(c))
return NULL;
}
} while (j < 4);
*s++ = (char)((m >> 16) & 0xFF);
*s++ = (char)((m >> 8) & 0xFF);
*s++ = (char)(m & 0xFF);
}
}
#endif
}
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_1
int
soap_xop_forward(struct soap *soap, unsigned char **ptr, int *size, char **id, char **type, char **options)
{ /* Check MTOM xop:Include element (within hex/base64Binary) */
if (!soap_peek_element(soap))
}
}
return SOAP_OK;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_1
int
soap_dime_forward(struct soap *soap, unsigned char **ptr, int *size, char **id, char **type, char **options)
*size = 0;
if (!xp)
return SOAP_OK;
}
#endif
#endif
/******************************************************************************/
#ifndef PALM_1
char *
{ char *t = NULL;
strcpy(t, s);
return t;
}
#endif
/******************************************************************************/
#ifndef PALM_1
int
{ struct soap_blist *p;
return SOAP_EOM;
p->size = 0;
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef PALM_1
void*
{ char *p;
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push block of %u bytes (%u bytes total)\n", (unsigned int)n, (unsigned int)soap->blist->size + (unsigned int)n));
return NULL;
}
*(size_t*)(p + sizeof(char*)) = n;
return p + sizeof(char*) + sizeof(size_t);
}
#endif
/******************************************************************************/
#ifndef PALM_1
void
{ char *p;
return;
}
#endif
/******************************************************************************/
#ifndef WITH_NOIDREF
#ifndef PALM_1
static void
{ int i;
#ifndef WITH_LEANER
#endif
register void *p, **q;
for (i = 0; i < SOAP_IDHASH; i++)
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Update id='%s' %p -> %p\n", ip->id, ip->ptr, (char*)ip->ptr + (p1-p2)));
}
{ p = *q;
}
}
{ p = *q;
}
}
}
}
}
}
#ifndef WITH_LEANER
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Update id='%s' %p -> %p\n", xp->id?xp->id:"", xp->ptr, (char*)xp->ptr + (p1-p2)));
}
}
#endif
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOIDREF
#ifndef PALM_1
static int
{ register int i;
register const char *p;
for (i = 0; i < SOAP_IDHASH; i++)
return SOAP_ERR;
return SOAP_ERR;
}
}
return SOAP_OK;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOIDREF
#ifndef PALM_1
int
{ register int i;
short flag;
for (i = 0; i < SOAP_IDHASH; i++)
{ register void *p, **q, *r;
while (q)
{ p = *q;
*q = r;
q = (void**)p;
}
}
}
}
}
do
{ flag = 0;
for (i = 0; i < SOAP_IDHASH; i++)
do
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "... copy %p -> %p (%u bytes)\n", ip->ptr, q, (unsigned int)ip->size));
p = *q;
q = (void**)p;
} while (q);
flag = 1;
}
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Resolving forwarded data type=%d location=%p level=%u,%u id='%s'\n", ip->type, p, ip->level, fp->level, ip->id));
{ register void **q = (void**)soap_malloc(soap, sizeof(void*));
if (!q)
*q = p;
p = (void*)q;
k--;
}
else
flag = 1;
}
}
}
}
} while (flag);
#ifdef SOAP_DEBUG
for (i = 0; i < SOAP_IDHASH; i++)
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Resolution error: forwarded data for id='%s' could not be propagated, please report this problem to the developers\n", ip->id));
}
}
}
#endif
return SOAP_OK;
}
#endif
#endif
/******************************************************************************/
#ifndef PALM_1
}
}
#endif
/******************************************************************************/
#ifndef PALM_1
char*
{ char *p, *q, *r;
if (!p)
return NULL;
r = NULL;
do
{ q = *(char**)p;
*(char**)p = r;
r = p;
p = q;
} while (p);
return r + sizeof(char*) + sizeof(size_t);
}
#endif
/******************************************************************************/
#ifndef PALM_1
char*
{ char *p;
if (p)
}
return NULL;
}
#endif
/******************************************************************************/
#ifndef PALM_1
}
#endif
/******************************************************************************/
#ifndef PALM_1
void
{ struct soap_blist *bp;
char *p, *q;
if (bp)
{ q = *(char**)p;
}
}
}
#endif
/******************************************************************************/
#ifndef PALM_1
char*
{ register size_t n;
register char *q, *s;
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Save all blocks in contiguous memory space of %u bytes (%p->%p)\n", (unsigned int)soap->blist->size, soap->blist->ptr, p));
{ if (!p)
if (p)
{ n = soap_block_size(soap);
#ifndef WITH_NOIDREF
if (flag)
soap_update_ptrs(soap, q, q + n, s, q);
#endif
memcpy(s, q, n);
s += n;
}
}
else
}
return p;
}
#endif
/******************************************************************************/
#ifndef PALM_2
char *
}
#endif
/******************************************************************************/
#ifndef PALM_2
char *
}
#endif
/******************************************************************************/
#ifndef PALM_2
char *
soap_putsizesoffsets(struct soap *soap, const char *type, const int *size, const int *offset, int dim)
{ int i;
if (!type)
return NULL;
for (i = 1; i < dim; i++)
}
else
{ if (offset)
for (i = 1; i < dim; i++)
}
else
for (i = 1; i < dim; i++)
}
}
}
#endif
/******************************************************************************/
#ifndef PALM_2
char *
}
#endif
/******************************************************************************/
#ifndef PALM_2
char *
{ register int i;
for (i = 1; i < dim; i++)
return soap->arrayOffset;
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
{ register int i, n = size[0];
for (i = 1; i < dim; i++)
n *= size[i];
return n;
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
{ register int i, j = 0;
if (offset)
{ attr++;
j *= size[i];
}
else
{ attr++;
j *= size[i];
}
return j;
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
{ register int n, k;
char *s;
*j = 0;
if (!*attr1)
return -1;
if (*attr1 == '[')
attr1++;
n = 1;
for (;;)
n *= k;
if (k < 0 || n > SOAP_MAXARRAYSIZE || s == attr1)
return -1;
if (!attr1)
{ attr2++;
*j *= k;
*j += k;
if (k < 0)
return -1;
attr2 = s;
}
if (!attr1)
break;
attr1++;
}
return n - *j;
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
{ register int i, k, n;
if (!*attr)
return -1;
n = 1;
do
{ for (i = i-1; i >= 0; i--)
break;
if (k < 0 || n > SOAP_MAXARRAYSIZE)
return -1;
} while (i >= 0 && attr[i] != '[');
return n;
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
{ register int i, n;
if (!*attr)
return -1;
n = 0;
i = 1;
do
i++;
if (attr[i] == ',')
i++;
return n;
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
{ register struct soap_nlist *np;
register struct Namespace *p;
register short i = -1;
register size_t n, k;
p = soap->local_namespaces;
if (p)
{ for (i = 0; p->id; p++, i++)
{ if (p->out)
}
break;
}
if (p->out)
break;
}
else if (p->in)
break;
}
}
}
if (!p || !p->id)
i = -1;
}
if (i >= 0)
k = 0;
if (!np)
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push namespace binding (level=%u) '%s' '%s'\n", soap->level, id, ns));
if (i < 0)
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push NOT OK: no match found for '%s' in namespace mapping table (added to stack anyway)\n", ns));
}
else
}
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef PALM_2
void
{ register struct soap_nlist *np;
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Popped namespace binding (level=%u) '%s'\n", soap->level, soap->nlist->id));
}
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
if (np)
return SOAP_NAMESPACE;
return SOAP_OK;
}
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef PALM_2
const char*
{ register struct soap_nlist *np;
register const char *s;
}
else
if (!np)
}
if (np)
}
return NULL;
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
soap_tag_cmp(const char *s, const char *t)
{ for (;;)
{ register int c1 = *s;
register int c2 = *t;
break;
if (c2 != '-')
}
{ if (c2 != '*')
return 1;
c2 = *++t;
if (!c2)
return 0;
for (;;)
{ c1 = *s;
break;
return 0;
s++;
}
break;
}
}
s++;
t++;
}
if (*t == '*' && !t[1])
return 0;
return *t;
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
{ register const char *s, *t;
register int err;
return SOAP_OK;
if (t)
{ if (s)
return SOAP_TAG_MISMATCH;
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Tags '%s' and '%s' match but namespaces differ\n", tag1, tag2));
if (err == SOAP_NAMESPACE)
return SOAP_TAG_MISMATCH;
return err;
}
}
return SOAP_TAG_MISMATCH;
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Tags '%s' and '%s' match but namespaces differ\n", tag1, tag2));
if (err == SOAP_NAMESPACE)
return SOAP_TAG_MISMATCH;
return err;
}
return SOAP_OK;
}
if (s)
return SOAP_TAG_MISMATCH;
}
return SOAP_TAG_MISMATCH;
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
)
return SOAP_TAG_MISMATCH;
}
return SOAP_OK;
}
#endif
/******************************************************************************\
*
* SSL
*
\******************************************************************************/
#ifdef WITH_OPENSSL
/******************************************************************************/
#ifndef PALM_2
int
{ unsigned char buf[4];
if (!ssl_init_done)
return *(int*)buf;
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
soap_ssl_server_context(struct soap *soap, unsigned short flags, const char *keyfile, const char *password, const char *cafile, const char *capath, const char *dhfile, const char *randfile, const char *sid)
{ int err;
{ if (sid)
}
return err;
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
soap_ssl_client_context(struct soap *soap, unsigned short flags, const char *keyfile, const char *password, const char *cafile, const char *capath, const char *randfile)
}
#endif
/******************************************************************************/
#ifndef PALM_2
void
{ /* Note: for MT systems, the main program MUST call soap_ssl_init() before any threads are started */
if (!ssl_init_done)
{ ssl_init_done = 1;
#ifndef WITH_LEAN
#endif
{ char buf[1024];
while (!RAND_status())
{ int r = rand();
RAND_seed(&r, sizeof(int));
}
}
}
}
#endif
/******************************************************************************/
#ifndef PALM_1
const char *
if (msg)
else
if (ERR_peek_error())
{ unsigned long r;
while ((r = ERR_get_error()))
ERR_error_string_n(r, soap->msgbuf + strlen(soap->msgbuf), sizeof(soap->msgbuf) - strlen(soap->msgbuf));
}
else
{ switch (ret)
{ case 0:
strcpy(soap->msgbuf, "EOF was observed that violates the protocol. The client probably provided invalid authentication information.");
break;
case -1:
break;
}
}
}
#endif
/******************************************************************************/
#ifndef PALM_1
static int
return 0;
}
#endif
/******************************************************************************/
/* This callback is included for future references. It should not be deleted
#ifndef PALM_2
static DH *
ssl_tmp_dh(SSL *ssl, int is_export, int keylength)
{ static DH *dh512 = NULL;
static DH *dh1024 = NULL;
DH *dh;
switch (keylength)
{ case 512:
if (!dh512)
{ BIO *bio = BIO_new_file("dh512.pem", "r");
if (bio)
{ dh512 = PEM_read_bio_DHparams(bio, NULL, NULL, NULL);
BIO_free(bio);
return dh512;
}
}
else
return dh512;
default:
if (!dh1024)
{ BIO *bio = BIO_new_file("dh1024.pem", "r");
if (bio)
{ dh1024 = PEM_read_bio_DHparams(bio, NULL, NULL, NULL);
BIO_free(bio);
}
}
dh = dh1024;
}
return dh;
}
#endif
*/
/******************************************************************************/
#ifndef PALM_1
static int
{ long flags;
int mode;
if (!ssl_init_done)
SSL_CTX_set_mode(soap->ctx, SSL_MODE_ENABLE_PARTIAL_WRITE | SSL_MODE_AUTO_RETRY);
*/
}
}
return soap_set_receiver_error(soap, "SSL error", "Can't read CA file and directory", SOAP_SSL_ERROR);
}
return soap_set_receiver_error(soap, "SSL error", "Can't read default CA file and/or directory", SOAP_SSL_ERROR);
/* This code assumes a typical scenario, see alternative code below */
return soap_set_receiver_error(soap, "SSL error", "Can't read certificate key file", SOAP_SSL_ERROR);
}
}
/* Suggested alternative approach to check cafile first before the key file:
if (soap->password)
{ SSL_CTX_set_default_passwd_cb_userdata(soap->ctx, (void*)soap->password);
SSL_CTX_set_default_passwd_cb(soap->ctx, ssl_password);
}
if (!soap->cafile || !SSL_CTX_use_certificate_chain_file(soap->ctx, soap->cafile))
{ if (soap->keyfile)
{ if (!SSL_CTX_use_certificate_chain_file(soap->ctx, soap->keyfile))
return soap_set_receiver_error(soap, "SSL error", "Can't read certificate or key file", SOAP_SSL_ERROR);
if (!SSL_CTX_use_PrivateKey_file(soap->ctx, soap->keyfile, SSL_FILETYPE_PEM))
return soap_set_receiver_error(soap, "SSL error", "Can't read key file", SOAP_SSL_ERROR);
}
}
*/
{ if (rsa)
}
}
if (!bio)
{ if (dh)
}
}
flags |= SSL_OP_NO_TLSv1;
flags |= SSL_OP_NO_SSLv3;
else
#if (OPENSSL_VERSION_NUMBER < 0x00905100L)
#else
#endif
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef PALM_1
static int
{
#ifdef SOAP_DEBUG
if (!ok)
{ char data[256];
fprintf(stderr, "SSL verify error or warning with certificate at depth %d: %s\n", X509_STORE_CTX_get_error_depth(store), X509_verify_cert_error_string(X509_STORE_CTX_get_error(store)));
}
#endif
/* Note: return 1 to continue, but unsafe progress will be terminated by SSL */
return ok;
}
#endif
/******************************************************************************/
#ifndef PALM_1
int
int timeouts, r, s;
return soap_set_receiver_error(soap, "SSL error", "No socket in soap_ssl_accept()", SOAP_SSL_ERROR);
return SOAP_INVALID_SOCKET;
return soap_set_receiver_error(soap, "SSL error", "SSL_new() failed in soap_ssl_accept()", SOAP_SSL_ERROR);
}
else
/* Set SSL sockets to non-blocking */
#if defined(WIN32)
}
}
#else
#endif
#ifndef WIN32
return SOAP_FD_EXCEEDED; /* Hint: MUST increase FD_SETSIZE */
#endif
if (err == SSL_ERROR_WANT_READ)
else
break;
}
}
else
break;
}
if (timeouts-- <= 0)
break;
}
if (r <= 0)
{ soap_set_receiver_error(soap, soap_ssl_error(soap, r), "SSL_accept() failed in soap_ssl_accept()", SOAP_SSL_ERROR);
return SOAP_SSL_ERROR;
}
int err;
{ soap_closesock(soap);
return soap_set_sender_error(soap, X509_verify_cert_error_string(err), "SSL certificate presented by peer cannot be verified in soap_ssl_accept()", SOAP_SSL_ERROR);
}
if (!peer)
{ soap_closesock(soap);
return soap_set_sender_error(soap, "SSL error", "No SSL certificate was presented by the peer in soap_ssl_accept()", SOAP_SSL_ERROR);
}
}
return SOAP_OK;
}
#endif
/******************************************************************************/
#endif /* WITH_OPENSSL */
/******************************************************************************/
#ifndef WITH_NOIO
#ifndef PALM_1
static int
#ifdef WIN32
if (tcp_done)
return 0;
else
{ WSADATA w;
return -1;
tcp_done = 1;
}
#endif
return 0;
}
#endif
#endif
/******************************************************************************/
#ifndef PALM_1
void
{
#ifdef SOAP_DEBUG
int i;
#endif
if (soap_check_state(soap))
return;
}
#ifdef WITH_COOKIES
#endif
}
#ifndef WITH_NOHTTP
#endif
#ifndef WITH_NOIO
#ifndef WITH_IPV6
#else
#endif
#else
#endif
#ifndef WITH_LEANER
#endif
#ifdef WITH_OPENSSL
}
#endif
}
#ifdef WITH_OPENSSL
}
#endif
}
#ifdef SOAP_DEBUG
for (i = 0; i < SOAP_MAXLOGS; i++)
}
soap_close_logfile(soap, i);
}
#endif
}
#endif
/******************************************************************************/
#ifndef WITH_NOIO
#ifndef PALM_2
void
#ifdef WIN32
if (!tcp_done)
return;
tcp_done = 0;
WSACleanup();
#endif
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOIO
#ifndef PALM_1
static const char*
{ case 0:
break;
case 1:
msg = "WSAStartup failed";
break;
case 2:
{
#ifndef WITH_LEAN
if (!msg)
#endif
}
}
}
return msg;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOHTTP
#ifndef PALM_1
static const char*
{ register const char *msg = SOAP_STR_EOS;
#ifndef WITH_LEAN
if (!msg)
msg = SOAP_STR_EOS;
#endif
return msg;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_IPV6
#ifndef WITH_NOIO
#ifndef PALM_1
static int
#ifdef VXWORKS
int hostint;
/* inet_addr(), and hostGetByName() expect "char *"; addr is a "const char *". */
#else
#if defined(_AIXVERSION_431) || defined(TRU64)
struct hostent_data ht_data;
#endif
#ifdef AS400
#else
#endif
#endif
if (iadd != -1)
return SOAP_OK;
}
}
#elif defined(HAVE_GETHOSTBYNAME_R)
/* If the DNS resolver library resolvLib has been configured in the vxWorks
* image, a query for the host IP address is sent to the DNS server, if the
* name was not found in the local host table. */
}
#else
#ifdef AS400
#else
#endif
#endif
if (!host)
return SOAP_ERR;
}
#ifdef VXWORKS
#else
#endif
return SOAP_OK;
}
#endif
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOIO
#ifndef PALM_1
static int
{
#ifdef WITH_IPV6
#endif
#ifndef WITH_LEAN
int retry = 10;
int len = SOAP_BUFLEN;
int set = 1;
#endif
return SOAP_INVALID_SOCKET;
}
#ifdef WITH_IPV6
#ifdef WITH_UDP
else
#endif
if (soap->proxy_host)
else
if (err)
{ soap_set_sender_error(soap, gai_strerror(err), "getaddrinfo failed in tcp_connect()", SOAP_TCP_ERROR);
return SOAP_INVALID_SOCKET;
}
#else
#ifndef WITH_LEAN
#endif
#ifdef WITH_UDP
else
#endif
#endif
if (fd < 0)
#ifdef WITH_IPV6
#endif
return SOAP_INVALID_SOCKET;
}
#ifdef SOCKET_CLOSE_ON_EXEC
#ifdef WIN32
#ifndef UNDER_CE
#endif
#else
#endif
#endif
#ifndef WITH_LEAN
soap_set_sender_error(soap, tcp_error(soap), "setsockopt SO_LINGER failed in tcp_connect()", SOAP_TCP_ERROR);
#ifdef WITH_IPV6
#endif
return SOAP_INVALID_SOCKET;
}
}
else if (soap->connect_flags && setsockopt((SOAP_SOCKET)fd, SOL_SOCKET, soap->connect_flags, (char*)&set, sizeof(int)))
#ifdef WITH_IPV6
#endif
return SOAP_INVALID_SOCKET;
}
if (soap->keep_alive && setsockopt((SOAP_SOCKET)fd, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int)))
soap_set_sender_error(soap, tcp_error(soap), "setsockopt SO_KEEPALIVE failed in tcp_connect()", SOAP_TCP_ERROR);
#ifdef WITH_IPV6
#endif
return SOAP_INVALID_SOCKET;
}
soap_set_sender_error(soap, tcp_error(soap), "setsockopt SO_SNDBUF failed in tcp_connect()", SOAP_TCP_ERROR);
#ifdef WITH_IPV6
#endif
return SOAP_INVALID_SOCKET;
}
soap_set_sender_error(soap, tcp_error(soap), "setsockopt SO_RCVBUF failed in tcp_connect()", SOAP_TCP_ERROR);
#ifdef WITH_IPV6
#endif
return SOAP_INVALID_SOCKET;
}
#ifdef TCP_NODELAY
if (!(soap->omode & SOAP_IO_UDP) && setsockopt((SOAP_SOCKET)fd, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int)))
soap_set_sender_error(soap, tcp_error(soap), "setsockopt TCP_NODELAY failed in tcp_connect()", SOAP_TCP_ERROR);
#ifdef WITH_IPV6
#endif
return SOAP_INVALID_SOCKET;
}
#endif
#endif
#ifndef WITH_IPV6
if (soap->proxy_host)
{ soap_set_sender_error(soap, tcp_error(soap), "get proxy host by name failed in tcp_connect()", SOAP_TCP_ERROR);
#ifdef WITH_IPV6
#endif
return SOAP_INVALID_SOCKET;
}
}
else
{ soap_set_sender_error(soap, tcp_error(soap), "get host by name failed in tcp_connect()", SOAP_TCP_ERROR);
#ifdef WITH_IPV6
#endif
return SOAP_INVALID_SOCKET;
}
}
{
#ifdef WITH_IPV6
#endif
return fd;
}
#endif
#ifndef WITH_LEAN
if (soap->connect_timeout)
#if defined(WIN32)
}
}
#else
#endif
else
#if defined(WIN32)
}
}
#else
#endif
#endif
for (;;)
{
#ifdef WITH_IPV6
#else
#endif
#ifndef WITH_LEAN
if (err == SOAP_EADDRINUSE)
if (retry-- > 0)
goto again;
}
if (soap->connect_timeout > 0)
}
else
}
#ifndef WIN32
#ifdef WITH_IPV6
#endif
return SOAP_INVALID_SOCKET; /* Hint: MUST increase FD_SETSIZE */
}
#endif
for (;;)
if (r > 0)
break;
if (!r)
#ifdef WITH_IPV6
#endif
return SOAP_INVALID_SOCKET;
}
r = soap_socket_errno(fd);
if (r != SOAP_EINTR)
#ifdef WITH_IPV6
#endif
return SOAP_INVALID_SOCKET;
}
}
if (!getsockopt((SOAP_SOCKET)fd, SOL_SOCKET, SO_ERROR, (char*)&soap->errnum, &k) && !soap->errnum) /* portability note: see SOAP_SOCKLEN_T definition in stdsoap2.h */
break;
#ifdef WITH_IPV6
#endif
return SOAP_INVALID_SOCKET;
}
#endif
#ifdef WITH_IPV6
goto again;
}
#endif
#ifdef WITH_IPV6
#endif
return SOAP_INVALID_SOCKET;
}
}
else
break;
}
#ifdef WITH_IPV6
#endif
#ifndef WITH_LEAN
if (soap->connect_timeout)
#if defined(WIN32)
}
}
#else
#endif
#endif
{
#ifdef WITH_OPENSSL
int r;
if (soap->proxy_host)
if (soap_begin_send(soap)
return SOAP_INVALID_SOCKET;
}
#ifndef WITH_LEAN
if (soap->proxy_userid && soap->proxy_passwd && strlen(soap->proxy_userid) + strlen(soap->proxy_passwd) < 761)
soap_s2base64(soap, (const unsigned char*)(soap->tmpbuf + 262), soap->tmpbuf + 6, strlen(soap->tmpbuf + 262));
}
}
#endif
|| soap_flush(soap))
return SOAP_INVALID_SOCKET;
}
return SOAP_INVALID_SOCKET;
}
if (soap_begin_send(soap))
return SOAP_INVALID_SOCKET;
}
}
{ soap_set_sender_error(soap, "SSL error", "SSL authentication failed in tcp_connect(): check password, key file, and ca file.", SOAP_SSL_ERROR);
return SOAP_INVALID_SOCKET;
}
return SOAP_INVALID_SOCKET;
}
}
/* Connect timeout: set SSL sockets to non-blocking */
#ifndef WITH_LEAN
if (soap->connect_timeout)
#if defined(WIN32)
}
}
#else
#endif
#endif
/* Try connecting until success or timeout */
for (;;)
{ soap_set_sender_error(soap, soap_ssl_error(soap, r), "SSL connect failed in tcp_connect()", SOAP_SSL_ERROR);
return SOAP_INVALID_SOCKET;
}
if (soap->connect_timeout)
if (soap->connect_timeout > 0)
}
else
}
#ifndef WIN32
return SOAP_INVALID_SOCKET; /* Hint: MUST increase FD_SETSIZE */
}
#endif
for (;;)
if (r > 0)
break;
if (!r)
return SOAP_INVALID_SOCKET;
}
}
continue;
}
}
break;
}
/* Set SSL sockets to non-blocking */
#ifndef WITH_LEAN
#if defined(WIN32)
}
}
#else
#endif
#endif
/* Check server credentials when required */
{ int err;
{ soap_set_sender_error(soap, X509_verify_cert_error_string(err), "SSL certificate presented by peer cannot be verified in tcp_connect()", SOAP_SSL_ERROR);
return SOAP_INVALID_SOCKET;
}
int ext_count;
int ok = 0;
if (!peer)
{ soap_set_sender_error(soap, "SSL error", "No SSL certificate was presented by the peer in tcp_connect()", SOAP_SSL_ERROR);
return SOAP_INVALID_SOCKET;
}
if (ext_count > 0)
{ int i;
for (i = 0; i < ext_count; i++)
void *ext_data;
#if (OPENSSL_VERSION_NUMBER >= 0x0090805fL)
const unsigned char *data;
#else
unsigned char *data;
#endif
int j;
if (!meth)
break;
#if (OPENSSL_VERSION_NUMBER > 0x00907000L)
else
{ /* OpenSSL not perfectly portable at this point (?):
Some compilers appear to prefer
meth->d2i(NULL, (const unsigned char**)&data, ...
or
meth->d2i(NULL, &data, ext->value->length);
*/
}
#else
#endif
for (j = 0; j < sk_CONF_VALUE_num(val); j++)
{ ok = 1;
break;
}
}
}
if (ok)
break;
}
}
{ int i = -1;
do
{ ASN1_STRING *name;
if (i == -1)
break;
ok = 1;
else
if (tmp)
ok = 1;
}
}
} while (!ok);
}
if (!ok)
{ soap_set_sender_error(soap, "SSL error", "SSL certificate host name mismatch in tcp_connect()", SOAP_SSL_ERROR);
return SOAP_INVALID_SOCKET;
}
}
}
#else
return SOAP_INVALID_SOCKET;
#endif
}
return fd;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOIO
#ifndef PALM_1
int
{
#ifdef WITH_IPV6
int err;
#endif
#ifndef WITH_LEAN
int len = SOAP_BUFLEN;
int set = 1;
#endif
}
return SOAP_INVALID_SOCKET;
}
#ifdef WITH_IPV6
#ifdef WITH_UDP
else
#endif
if (addrinfo)
}
if (err)
{ soap_set_receiver_error(soap, gai_strerror(err), "getaddrinfo failed in soap_bind()", SOAP_TCP_ERROR);
return SOAP_INVALID_SOCKET;
}
#else
#ifdef WITH_UDP
else
#endif
#endif
return SOAP_INVALID_SOCKET;
}
#ifdef WITH_UDP
#endif
#ifdef SOCKET_CLOSE_ON_EXEC
#ifdef WIN32
#ifndef UNDER_CE
#endif
#else
#endif
#endif
#ifndef WITH_LEAN
if ( soap->bind_flags
(char*)&set,
sizeof(int))
)
{
return SOAP_INVALID_SOCKET;
}
(char*)&set,
sizeof(int))
)
{
soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_KEEPALIVE failed in soap_bind()", SOAP_TCP_ERROR);
return SOAP_INVALID_SOCKET;
}
(char*)&len,
sizeof(int)))
{
soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_SNDBUF failed in soap_bind()", SOAP_TCP_ERROR);
return SOAP_INVALID_SOCKET;
}
(char*)&len,
sizeof(int)))
{
soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_RCVBUF failed in soap_bind()", SOAP_TCP_ERROR);
return SOAP_INVALID_SOCKET;
}
#ifdef TCP_NODELAY
(char*)&set,
sizeof(int)))
{
soap_set_receiver_error(soap, tcp_error(soap), "setsockopt TCP_NODELAY failed in soap_bind()", SOAP_TCP_ERROR);
return SOAP_INVALID_SOCKET;
}
#endif
#endif
#ifdef WITH_IPV6
{
return SOAP_INVALID_SOCKET;
}
#else
if (host)
{ soap_set_receiver_error(soap, tcp_error(soap), "get host by name failed in soap_bind()", SOAP_TCP_ERROR);
return SOAP_INVALID_SOCKET;
}
}
else
return SOAP_INVALID_SOCKET;
}
#endif
return SOAP_INVALID_SOCKET;
}
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOIO
#ifndef PALM_1
int
{
#ifndef WITH_LEAN
int r;
#ifndef WIN32
return SOAP_FD_EXCEEDED; /* Hint: MUST increase FD_SETSIZE */
#endif
r = -1;
}
}
else
return SOAP_OK;
if (r > 0)
{
#ifdef WITH_OPENSSL
{
return SOAP_OK;
}
else
#endif
return SOAP_OK;
}
else if (r < 0)
if ((soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) && soap_socket_errno(soap->master) != SOAP_EINTR)
}
}
else
DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Polling: other end down on socket=%d select=%d\n", soap->socket, r));
return SOAP_EOF;
#else
return SOAP_OK;
#endif
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOIO
#ifndef PALM_1
static int
{ int fd;
fd = (int)accept((SOAP_SOCKET)s, a, (SOAP_SOCKLEN_T*)n); /* portability note: see SOAP_SOCKLEN_T definition in stdsoap2.h */
#ifdef SOCKET_CLOSE_ON_EXEC
#ifdef WIN32
#ifndef UNDER_CE
#endif
#else
#endif
#endif
return fd;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOIO
#ifndef PALM_1
int
#ifndef WITH_LEAN
int len = SOAP_BUFLEN;
int set = 1;
#endif
#ifdef WITH_UDP
#endif
soap->keep_alive = 0;
{ register int err;
for (;;)
{
#ifndef WITH_LEAN
if (soap->accept_timeout)
if (soap->accept_timeout > 0)
}
else
}
#ifndef WIN32
return SOAP_INVALID_SOCKET; /* Hint: MUST increase FD_SETSIZE */
}
#endif
for (;;)
if (r > 0)
break;
if (!r)
return SOAP_INVALID_SOCKET;
}
if (r != SOAP_EINTR)
return SOAP_INVALID_SOCKET;
}
}
#if defined(WIN32)
}
}
#else
#endif
}
else
#if defined(WIN32)
}
}
#else
#endif
#endif
{
#ifdef WITH_IPV6
/* Use soap->host to store the numeric form of the remote host */
getnameinfo((struct sockaddr*)&soap->peer, n, soap->host, sizeof(soap->host), NULL, 0, NI_NUMERICHOST | NI_NUMERICSERV);
#else
DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Accept socket %d at port %d from IP %d.%d.%d.%d\n", soap->socket, soap->port, (int)(soap->ip>>24)&0xFF, (int)(soap->ip>>16)&0xFF, (int)(soap->ip>>8)&0xFF, (int)soap->ip&0xFF));
#endif
#ifndef WITH_LEAN
if (setsockopt((SOAP_SOCKET)soap->socket, SOL_SOCKET, SO_LINGER, (char*)&linger, sizeof(struct linger)))
soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_LINGER failed in soap_accept()", SOAP_TCP_ERROR);
return SOAP_INVALID_SOCKET;
}
}
else if (soap->accept_flags && setsockopt((SOAP_SOCKET)soap->socket, SOL_SOCKET, soap->accept_flags, (char*)&set, sizeof(int)))
soap_set_receiver_error(soap, tcp_error(soap), "setsockopt failed in soap_accept()", SOAP_TCP_ERROR);
return SOAP_INVALID_SOCKET;
}
if (((soap->imode | soap->omode) & SOAP_IO_KEEPALIVE) && setsockopt((SOAP_SOCKET)soap->socket, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int)))
soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_KEEPALIVE failed in soap_accept()", SOAP_TCP_ERROR);
return SOAP_INVALID_SOCKET;
}
soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_SNDBUF failed in soap_accept()", SOAP_TCP_ERROR);
return SOAP_INVALID_SOCKET;
}
soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_RCVBUF failed in soap_accept()", SOAP_TCP_ERROR);
return SOAP_INVALID_SOCKET;
}
#ifdef TCP_NODELAY
if (!(soap->omode & SOAP_IO_UDP) && setsockopt((SOAP_SOCKET)soap->socket, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int)))
soap_set_receiver_error(soap, tcp_error(soap), "setsockopt TCP_NODELAY failed in soap_accept()", SOAP_TCP_ERROR);
return SOAP_INVALID_SOCKET;
}
#endif
#endif
if (soap->accept_timeout)
{
#if defined(WIN32)
long blocking = 0;
#else
#endif
}
}
return SOAP_INVALID_SOCKET;
}
}
}
else
soap_set_receiver_error(soap, tcp_error(soap), "no master socket in soap_accept()", SOAP_TCP_ERROR);
return SOAP_INVALID_SOCKET;
}
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOIO
#ifndef PALM_1
static int
{
#ifdef WITH_OPENSSL
{ int r, s = 0;
}
}
}
if (r == 0)
{ /*
wait up to 10 seconds for close_notify to be sent by peer (if peer not
present, this avoids calling SSL_shutdown() which has a lengthy return
timeout)
*/
#ifndef WIN32
{
#endif
ERR_remove_state(0);
return SOAP_OK;
}
#ifndef WIN32
}
#endif
}
}
}
if (r != 1)
{ s = ERR_get_error();
if (s)
}
ERR_remove_state(0);
return SOAP_SSL_ERROR;
}
}
ERR_remove_state(0);
}
#endif
}
return SOAP_OK;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOIO
#ifndef PALM_1
static int
return soap_closesocket(fd);
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOIO
#ifndef PALM_1
static int
}
#endif
#endif
/******************************************************************************/
#ifndef PALM_1
int
if (status == SOAP_EOF || status == SOAP_TCP_ERROR || status == SOAP_SSL_ERROR || !soap->keep_alive)
soap->keep_alive = 0;
}
#ifdef WITH_ZLIB
#endif
}
#endif
/******************************************************************************/
#ifndef WITH_NOIDREF
#ifndef PALM_2
soap_hash(register const char *s)
{ register size_t h = 0;
while (*s)
h = 65599*h + *s++;
return h % SOAP_IDHASH;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOIDREF
#ifndef PALM_1
static void
{ register int i;
for (i = 0; i < (int)SOAP_PTRHASH; i++)
}
#endif
#endif
/******************************************************************************/
#ifndef PALM_1
struct soap*
}
#endif
/******************************************************************************/
#ifndef PALM_1
struct soap*
soap_new()
}
#endif
/******************************************************************************/
#ifndef PALM_1
struct soap*
if (soap)
return soap;
}
#endif
/******************************************************************************/
#ifndef PALM_1
void
}
#endif
/******************************************************************************/
#ifndef PALM_1
void
}
#endif
/******************************************************************************/
#ifndef WITH_NOIDREF
#ifndef PALM_1
static void
register int i;
}
for (i = 0; i < (int)SOAP_PTRHASH; i++)
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOIDREF
#ifndef PALM_2
int
soap_embed(struct soap *soap, const void *p, const struct soap_array *a, int n, const char *tag, int type)
{ register int i;
struct soap_plist *pp;
if (a)
else
if (i)
return 0;
}
return i;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOIDREF
#ifndef PALM_2
int
{ register struct soap_plist *pp;
if (p)
}
}
}
return 0;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOIDREF
#ifndef PALM_2
int
soap_pointer_enter(struct soap *soap, const void *p, const struct soap_array *a, int n, int type, struct soap_plist **ppp)
{ register size_t h;
register struct soap_plist *pp;
if (!pb)
return 0;
}
}
if (a)
h = soap_hash_ptr(a->__ptr);
else
h = soap_hash_ptr(p);
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Pointer enter location=%p array=%p size=%d dim=%d type=%d id=%d\n", p, a?a->__ptr:NULL, a?a->__size:0, n, type, soap->idnum+1));
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOIDREF
#ifndef PALM_2
int
soap_array_pointer_lookup(struct soap *soap, const void *p, const struct soap_array *a, int n, int type, struct soap_plist **ppp)
{ register struct soap_plist *pp;
if (!p || !a->__ptr)
return 0;
{ register int i;
for (i = 0; i < n; i++)
break;
if (i == n)
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Array lookup location=%p type=%d id=%d\n", a->__ptr, type, pp->id));
}
}
}
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Array lookup location=%p type=%d: not found\n", a->__ptr, type));
return 0;
}
#endif
#endif
/******************************************************************************/
#ifndef PALM_1
int
{
#ifndef WITH_LEANER
else
#endif
#ifndef WITH_LEANER
&& !soap->fpreparesend
#endif
))
else
}
#ifdef WITH_ZLIB
else
}
#endif
#ifndef WITH_LEANER
else
#endif
soap->mustUnderstand = 0;
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Begin count phase (socket=%d mode=0x%x count=%lu)\n", soap->socket, soap->mode, (unsigned long)soap->count));
#ifndef WITH_LEANER
#endif
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef PALM_1
int
{
#ifndef WITH_LEANER
if (soap->fpreparefinal)
#endif
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef PALM_1
int
#ifdef WITH_ZLIB
else
}
#endif
#ifdef WITH_UDP
}
#endif
else
}
soap->keep_alive = 0;
#ifndef WITH_LEANER
}
else
#ifdef WIN32
#ifndef UNDER_CE
#ifndef WITH_FASTCGI
if (!soap_valid_socket(soap->socket)) /* Set win32 stdout or soap->sendfd to BINARY, e.g. to support DIME */
#ifdef __BORLANDC__
#else
#endif
#endif
#endif
#endif
#endif
}
soap->mustUnderstand = 0;
#ifdef WITH_ZLIB
{
#ifdef WITH_GZIP
if (deflateInit2(&soap->d_stream, soap->z_level, Z_DEFLATED, -MAX_WBITS, 8, Z_DEFAULT_STRATEGY) != Z_OK)
#else
#endif
}
#endif
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Begin send phase (socket=%d mode=0x%x count=%lu)\n", soap->socket, soap->mode, (unsigned long)soap->count));
#ifndef WITH_LEANER
#endif
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef WITH_NOIDREF
#ifndef PALM_2
void
{ struct soap_plist *pp;
}
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOIDREF
#ifndef PALM_2
int
{ struct soap_plist *pp;
return 1;
}
}
}
else
return 1;
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Reference %p type=%d (%d %d)\n", p, t, (int)pp->mark1, (int)pp->mark2));
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOIDREF
#ifndef PALM_2
int
{ register int i;
struct soap_plist *pp;
if (!p || !a->__ptr)
return 1;
if (i)
}
}
return 1;
else
}
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Array reference %p ptr=%p dim=%d type=%d (%d %d)\n", p, a->__ptr, n, t, (int)pp->mark1, (int)pp->mark2));
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOIDREF
#ifndef PALM_2
int
return id;
if (soap->version == 1 && soap->encodingStyle && !(soap->mode & SOAP_XML_GRAPH) && soap->part != SOAP_IN_HEADER)
{ if (id < 0)
if (id)
else
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Embedded_id multiref id=%d %p type=%d = (%d %d)\n", id, p, t, (int)pp->mark1, (int)pp->mark2));
}
return -1;
}
return id;
}
if (id < 0)
return 0;
else
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Embedded_id embedded ref id=%d %p type=%d = (%d %d)\n", id, p, t, (int)pp->mark1, (int)pp->mark2));
}
return id;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOIDREF
#ifndef PALM_2
int
{ if (!pp)
return 0;
if (soap->version == 1 && soap->encodingStyle && !(soap->mode & SOAP_XML_GRAPH) && soap->part != SOAP_IN_HEADER)
}
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOIDREF
#ifndef PALM_2
int
return 1;
if (!pp)
return 0;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOIDREF
#ifndef PALM_2
void
{ if (!pp)
return;
else
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOIDREF
#ifndef WITH_LEANER
#ifndef PALM_1
int
soap_attachment(struct soap *soap, const char *tag, int id, const void *p, const struct soap_array *a, const char *aid, const char *atype, const char *aoptions, int n, const char *type, int t)
{ struct soap_plist *pp;
int i;
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Attachment tag='%s' id='%s' (%d) type='%s'\n", tag, aid?aid:"", id, atype?atype:""));
if (!i)
if (!i)
return -1;
}
}
if (id <= 0)
id = i;
if (!aid)
}
/* Add MTOM xop:Include element when necessary */
}
{ struct soap_multipart *content;
content = soap_new_multipart(soap, &soap->mime.first, &soap->mime.last, (char*)a->__ptr, a->__size);
else
content = soap_new_multipart(soap, &soap->dime.first, &soap->dime.last, (char*)a->__ptr, a->__size);
if (!content)
return -1;
}
if (s)
{ *s = '<';
strcat(s, ">");
}
}
else
}
else
}
}
else
return -1;
}
#endif
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOIDREF
#ifndef PALM_1
static void
{ register int i;
for (i = 0; i < SOAP_IDHASH; i++)
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOIDREF
#ifndef PALM_1
static void
{ register int i;
for (i = 0; i < SOAP_IDHASH; i++)
}
}
}
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOIDREF
#ifndef PALM_2
struct soap_ilist *
return ip;
return NULL;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOIDREF
#ifndef PALM_2
struct soap_ilist *
{ register size_t h;
register struct soap_ilist *ip;
if (ip)
return ip;
}
return NULL;
}
#endif
#endif
/******************************************************************************/
#ifndef PALM_2
void*
{ register char *p;
if (!n)
return (void*)SOAP_NON_NULL;
if (!soap)
return SOAP_MALLOC(soap, n);
else
{ n += sizeof(short);
n += (-(long)n) & (sizeof(void*)-1); /* align at 4-, 8- or 16-byte boundary */
return NULL;
}
/* set the canary to detect corruption */
*(short*)(p + n - sizeof(short)) = (short)SOAP_CANARY;
/* keep chain of alloced cells for destruction */
*(size_t*)(p + n + sizeof(void*)) = n;
}
return p;
}
#endif
/******************************************************************************/
#ifdef SOAP_MEM_DEBUG
static void
{ register int i;
for (i = 0; i < (int)SOAP_PTRHASH; i++)
}
#endif
/******************************************************************************/
#ifdef SOAP_MEM_DEBUG
static void
{ register int i;
for (i = 0; i < (int)SOAP_PTRHASH; i++)
fprintf(stderr, "%s(%d): malloc() = %p not freed (memory leak or forgot to call soap_end()?)\n", mp->file, mp->line, mp->ptr);
}
}
}
#endif
/******************************************************************************/
#ifdef SOAP_MEM_DEBUG
void*
if (soap)
{ register size_t h = soap_hash_ptr(p);
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "%s(%d): malloc(%lu) = %p\n", file, line, (unsigned long)size, p));
}
return p;
}
#endif
/******************************************************************************/
#ifdef SOAP_MEM_DEBUG
void
{ register size_t h = soap_hash_ptr(p);
register struct soap_mlist *mp;
break;
if (mp)
{ free(p);
}
else
fprintf(stderr, "%s(%d): free(%p) double free of pointer malloced at %s(%d)\n", file, line, p, mp->file, mp->line);
}
else
}
#endif
/******************************************************************************/
#ifdef SOAP_MEM_DEBUG
static void
{ register size_t h = soap_hash_ptr(p);
register struct soap_mlist *mp;
break;
if (mp)
}
#endif
/******************************************************************************/
#ifndef PALM_2
void
{ if (soap_check_state(soap))
return;
if (p)
{ register char **q;
{
if (*(short*)(char*)(*q - sizeof(short)) != (short)SOAP_CANARY)
return;
}
if (p == (void*)(*q - *(size_t*)(*q + sizeof(void*))))
{ *q = **(char***)q;
return;
}
}
soap_delete(soap, p);
}
else
{ register char *q;
if (*(short*)(char*)(q - sizeof(short)) != (short)SOAP_CANARY)
return;
}
q -= *(size_t*)(q + sizeof(void*));
}
}
/* we must assume these were deallocated: */
#ifndef WITH_LEANER
#endif
}
#endif
/******************************************************************************/
#ifndef PALM_2
void
{ register struct soap_clist **cp;
if (soap_check_state(soap))
return;
if (p)
{ while (*cp)
{ register struct soap_clist *q = *cp;
if (q->fdelete(q))
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not dealloc data %p: deletion callback failed for object type %d\n", q->ptr, q->type));
#ifdef SOAP_MEM_DEBUG
fprintf(stderr, "new(object type = %d) = %p not freed: deletion callback failed\n", q->type, q->ptr);
#endif
}
return;
}
}
}
else
{ while (*cp)
{ register struct soap_clist *q = *cp;
if (q->fdelete(q))
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not dealloc data %p: deletion callback failed for object type %d\n", q->ptr, q->type));
#ifdef SOAP_MEM_DEBUG
fprintf(stderr, "new(object type = %d) = %p not freed: deletion callback failed\n", q->type, q->ptr);
#endif
}
}
}
}
#endif
/******************************************************************************/
#ifndef PALM_2
struct soap_clist *
{ register struct soap_clist *cp;
}
return cp;
}
#endif
/******************************************************************************/
#ifndef PALM_2
void
{ register char **q;
register struct soap_clist **cp;
if (!soap || !p)
return;
{ if (p == (void*)(*q - *(size_t*)(*q + sizeof(void*))))
{ *q = **(char***)q;
#ifdef SOAP_DEBUG
soap_track_unlink(soap, p);
#endif
return;
}
}
q = (char**)*cp;
return;
}
}
}
#endif
/******************************************************************************/
#ifndef WITH_NOIDREF
#ifndef PALM_2
int
{ register struct soap_ilist *ip;
if (ip)
}
}
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "lookup type id='%s' NOT FOUND! Need to get it from xsi:type\n", id));
return 0;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOIDREF
#ifndef PALM_2
void*
{ struct soap_ilist *ip;
void **q;
return p;
if (!ip)
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Forwarding first href='%s' type=%d %p (%u bytes)\n", id, t, p, (unsigned int)n));
*p = NULL;
}
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Resolved href='%s' type=%d location=%p (%u bytes)\n", id, t, ip->ptr, (unsigned int)n));
return NULL;
}
{ q = (void**)soap_malloc(soap, sizeof(void*));
if (!q)
return NULL;
*p = (void*)q;
p = q;
k--;
}
}
while (q)
{ *r = (void*)soap_malloc(soap, sizeof(void*));
s = *q;
*q = *r;
r = (void**)*r;
q = (void**)s;
}
*r = NULL;
}
*p = (void*)q;
}
else
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Forwarded href='%s' type=%d location=%p (%u bytes)\n", id, t, p, (unsigned int)n));
{ q = (void**)soap_malloc(soap, sizeof(void*));
*p = q;
p = q;
k--;
}
*p = (void*)q;
}
return p;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOIDREF
#ifndef PALM_2
void*
soap_id_forward(struct soap *soap, const char *href, void *p, size_t len, int st, int tt, size_t n, unsigned int k, void (*fcopy)(struct soap*, int, int, void*, size_t, const void*, size_t))
{ struct soap_ilist *ip;
return p;
if (!ip)
DBGLOG(TEST,SOAP_MESSAGE(fdebug, "New entry href='%s' type=%d size=%lu level=%d location=%p\n", href, st, (unsigned long)n, k, p));
}
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Type incompatibility id='%s' expect type=%d size=%lu level=%u got type=%d size=%lu\n", href, ip->type, (unsigned long)ip->size, k, st, (unsigned long)n));
return NULL;
}
{ register struct soap_flist *fp = (struct soap_flist*)SOAP_MALLOC(soap, sizeof(struct soap_flist));
if (!fp)
return NULL;
}
if (fcopy)
else
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Forwarding type=%d (target type=%d) size=%lu location=%p level=%u len=%lu href='%s'\n", st, tt, (unsigned long)n, p, k, (unsigned long)len, href));
}
else
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Forwarding copying address %p for type=%d href='%s'\n", p, st, href));
}
return p;
}
#endif
#endif
/******************************************************************************/
#ifndef PALM_2
void*
soap_id_enter(struct soap *soap, const char *id, void *p, int t, size_t n, unsigned int k, const char *type, const char *arrayType, void *(*finstantiate)(struct soap*, int, const char*, const char*, size_t*))
{
#ifndef WITH_NOIDREF
struct soap_ilist *ip;
#endif
DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Enter id='%s' type=%d loc=%p size=%lu level=%u\n", id, t, p, (unsigned long)n, k));
if (!p)
{ if (finstantiate)
else
p = soap_malloc(soap, n);
if (p)
}
#ifndef WITH_NOIDREF
#endif
return p;
#ifndef WITH_NOIDREF
if (!ip)
DBGLOG(TEST,SOAP_MESSAGE(fdebug, "New entry id='%s' type=%d size=%lu level=%u location=%p\n", id, t, (unsigned long)n, k, p));
}
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Type incompatibility id='%s' expect type=%d size=%lu level=%u got type=%d size=%lu\n", id, ip->type, (unsigned long)ip->size, k, t, (unsigned long)n));
return NULL;
}
return NULL;
}
else
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Update entry id='%s' type=%d location=%p size=%lu level=%u\n", id, t, p, (unsigned long)n, k));
}
#endif
}
#endif
/******************************************************************************/
#ifndef PALM_2
void
{ DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Copying data type=%d (target type=%d) %p -> %p (%lu bytes)\n", st, tt, q, p, (unsigned long)n));
memcpy(p, q, n);
}
#endif
/******************************************************************************/
#ifndef PALM_1
int
{
#ifndef WITH_LEANER
{ /* SOAP body referenced attachments must appear first */
}
#endif
{ if (soap_flush(soap))
#ifdef WITH_ZLIB
}
}
#else
#endif
#ifdef WITH_ZLIB
{ int r;
do
}
}
} while (r == Z_OK);
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Deflated %lu->%lu bytes\n", soap->d_stream.total_in, soap->d_stream.total_out));
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unable to end deflate: %s\n", soap->d_stream.msg?soap->d_stream.msg:""));
}
#ifdef WITH_GZIP
#endif
}
#endif
{ char *p;
#ifndef WITH_NOHTTP
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Sending buffered message of length %u\n", (unsigned int)soap->blist->size));
soap->error = soap->fpost(soap, soap->endpoint, soap->host, soap->port, soap->path, soap->action, soap->blist->size);
}
#endif
{ soap_end_block(soap);
}
}
}
#ifndef WITH_LEANER
}
#endif
}
#ifdef WITH_TCPFIN
#ifdef WITH_OPENSSL
if (!soap->ssl && soap_valid_socket(soap->socket) && !soap->keep_alive && !(soap->omode & SOAP_IO_UDP))
#else
#endif
#endif
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef PALM_1
int
#ifndef WITH_LEANER
/* Check if MIME attachments and mime-post-check flag is set, if set call soap_resolve() and return */
{
#ifndef WITH_NOIDREF
{ soap_resolve(soap);
return SOAP_OK;
}
#endif
if (soap_getmime(soap))
}
{ struct soap_multipart *content;
}
#endif
#ifdef WITH_ZLIB
#ifdef WITH_GZIP
{ soap_wchar c;
short i;
for (i = 0; i < 8; i++)
}
if (soap->z_crc != ((uLong)(unsigned char)soap->z_buf[0] | ((uLong)(unsigned char)soap->z_buf[1] << 8) | ((uLong)(unsigned char)soap->z_buf[2] << 16) | ((uLong)(unsigned char)soap->z_buf[3] << 24)))
{ DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Gzip error: crc check failed, message corrupted? (crc32=%lu)\n", (unsigned long)soap->z_crc));
}
if (soap->d_stream.total_out != ((uLong)(unsigned char)soap->z_buf[4] | ((uLong)(unsigned char)soap->z_buf[5] << 8) | ((uLong)(unsigned char)soap->z_buf[6] << 16) | ((uLong)(unsigned char)soap->z_buf[7] << 24)))
}
}
#endif
}
#endif
;
#ifndef WITH_NOIDREF
if (soap_resolve(soap))
#endif
#ifndef WITH_LEANER
}
#endif
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef PALM_1
void
}
while (soap->attributes)
}
#ifdef WITH_FAST
#endif
if (ns)
}
}
}
#ifndef WITH_LEANER
}
#endif
#ifndef WITH_NOIDREF
#endif
}
#endif
/******************************************************************************/
#ifdef SOAP_DEBUG
static void
{ int i;
for (i = 0; i < SOAP_MAXLOGS; i++)
}
}
#endif
/******************************************************************************/
#if !defined(WITH_LEAN) || defined(SOAP_DEBUG)
void
}
#endif
/******************************************************************************/
#ifdef SOAP_DEBUG
static void
}
}
#endif
/******************************************************************************/
#ifdef SOAP_DEBUG
void
{ int i;
for (i = 0; i < SOAP_MAXLOGS; i++)
soap_close_logfile(soap, i);
}
#endif
/******************************************************************************/
#ifdef SOAP_DEBUG
static void
{ const char *s;
char *t = NULL;
soap_close_logfile(soap, i);
if (s)
if (logfile)
}
#endif
/******************************************************************************/
#ifdef SOAP_DEBUG
void
}
#endif
/******************************************************************************/
#ifdef SOAP_DEBUG
void
}
#endif
/******************************************************************************/
#ifdef SOAP_DEBUG
void
}
#endif
/******************************************************************************/
#ifndef PALM_1
struct soap*
}
#endif
/******************************************************************************/
#ifndef PALM_1
struct soap*
{ if (soap_check_state(soap))
return NULL;
if (copy)
{ register struct soap_plugin *p = NULL;
#ifdef SOAP_DEBUG
#endif
#ifndef WITH_NOIDREF
#endif
#ifndef WITH_LEAN
#ifdef WITH_COOKIES
#else
#endif
#endif
#ifdef SOAP_DEBUG
#endif
{ register struct soap_plugin *q = (struct soap_plugin*)SOAP_MALLOC(copy, sizeof(struct soap_plugin));
if (!q)
return NULL;
*q = *p;
return NULL;
}
}
}
else
return copy;
}
#endif
/******************************************************************************/
#ifndef PALM_1
void
#if defined(__cplusplus) && !defined(WITH_LEAN)
#endif
#ifndef WITH_NOIO
#endif
#ifdef WITH_OPENSSL
#endif
#ifdef WITH_ZLIB
#endif
}
#endif
/******************************************************************************/
#ifndef PALM_1
void
#ifndef WITH_NOHTTP
#endif
#ifndef WITH_NOIO
#ifndef WITH_IPV6
#else
#endif
#else
#endif
#ifndef WITH_LEANER
#endif
soap->keep_alive = 0;
soap->recv_timeout = 0;
soap->send_timeout = 0;
soap->connect_timeout = 0;
soap->accept_timeout = 0;
soap->socket_flags = 0;
soap->connect_flags = 0;
soap->bind_flags = 0;
soap->accept_flags = 0;
#ifndef WITH_NONAMESPACES
#else
#endif
#ifndef WITH_LEANER
#endif
#ifndef UNDER_CE
#else
#endif
#ifdef WITH_ZLIB
#endif
#ifndef WITH_LEAN
#endif
#ifdef SOAP_DEBUG
#endif
#ifdef WMW_RPM_IO
#endif
#ifdef PALM
#endif
#ifndef WITH_NOIDREF
#endif
#ifdef SOAP_DEBUG
#endif
#ifdef WITH_OPENSSL
if (!ssl_init_done)
{ soap_ssl_init();
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Initializing OpenSSL, version=%ld\n", (long)OPENSSL_VERSION_NUMBER));
}
#endif
}
#endif
/******************************************************************************/
#ifndef PALM_1
void
}
#endif
/******************************************************************************/
#ifndef PALM_1
void
}
#endif
/******************************************************************************/
#ifndef PALM_2
void
if (!soap->keep_alive)
}
soap->mustUnderstand = 0;
#ifndef WITH_LEANER
#endif
}
#endif
/******************************************************************************/
#ifndef PALM_2
void
{ if (soap_check_state(soap))
return;
}
#ifdef SOAP_DEBUG
#endif
#ifdef PALM
#endif
}
#endif
/******************************************************************************/
#ifndef PALM_1
int
soap->namespaces = p;
/* reverse the namespace list */
if (np)
while (nq)
}
}
/* then push on new stack */
while (np)
{ register const char *s;
if (!s)
}
}
if (ns)
{ register int i;
}
}
}
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef PALM_1
void
register size_t n = 1;
n++;
n *= sizeof(struct Namespace);
if (ns2)
else
}
}
}
}
#endif
/******************************************************************************/
#ifndef WITH_LEAN
#ifndef PALM_1
const char *
const char *s = big;
while (s)
return s;
s = strchr(s, ' ');
if (s)
s++;
}
return NULL;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEAN
#ifndef PALM_1
struct soap_nlist *
{ register struct soap_nlist *np;
return np;
}
return NULL;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEAN
static struct soap_nlist *
{ register struct soap_nlist *np;
size_t n, k;
return NULL;
if (!utilized)
break;
}
if (np)
utilized = 1;
else
return NULL;
}
}
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Adding namespace binding (level=%u) '%s' '%s' utilized=%d\n", soap->level, id, ns?ns:"(null)", utilized));
if (ns)
else
k = 0;
if (!np)
return NULL;
}
if (ns)
}
else
return np;
}
#endif
/******************************************************************************/
#ifndef WITH_LEAN
static void
if (np)
}
}
}
#endif
/******************************************************************************/
#ifndef WITH_LEAN
static void
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
{
#ifdef WITH_XMLNS
register const char *s;
#endif
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Element begin tag='%s' id='%d' type='%s'\n", tag, id, type?type:""));
#ifdef WITH_DOM
if (soap->part == SOAP_BEGIN_SECURITY && (soap->mode & SOAP_XML_CANONICAL) && !(soap->mode & SOAP_DOM_ASIS))
{ register struct soap_nlist *np;
/* wsu:Id found: clear xmlns renderings, so re-emit them for exc-c14n */
}
}
{ register struct soap_dom_element *elt = (struct soap_dom_element*)soap_malloc(soap, sizeof(struct soap_dom_element));
if (!elt)
if (p)
{ while (p->next)
p = p->next;
}
else
}
}
else
{
#endif
#ifndef WITH_LEAN
}
{ if (soap->ns == 1 && soap_send_raw(soap, soap_indent, soap->level < sizeof(soap_indent) ? soap->level : sizeof(soap_indent) - 1))
}
#endif
#ifdef WITH_XMLNS
break;
}
}
}
else
#endif
#ifdef WITH_DOM
}
#endif
}
}
}
#ifndef WITH_LEAN
if (t)
}
#endif
if (id > 0)
}
#ifndef WITH_LEAN
if (t)
}
#endif
}
{ register int i;
}
if (soap->mustUnderstand)
}
soap->mustUnderstand = 0;
}
{ if (!*soap->encodingStyle)
else
}
}
}
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
{ if (*tag == '-')
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef PALM_2
#ifndef HAVE_STRRCHR
char*
soap_strrchr(const char *s, int t)
{ register char *r = NULL;
while (*s)
if (*s++ == t)
r = (char*)s - 1;
return r;
}
#endif
#endif
/******************************************************************************/
#ifndef PALM_2
#ifndef HAVE_STRTOL
long
soap_strtol(const char *s, char **t, int b)
{ register long n = 0;
register int c;
while (*s > 0 && *s <= 32)
s++;
if (b == 10)
{ short neg = 0;
if (*s == '-')
{ s++;
neg = 1;
}
else if (*s == '+')
s++;
while ((c = *s) && c >= '0' && c <= '9')
{ if (n >= 214748364 && (n > 214748364 || c >= '8'))
break;
n *= 10;
n += c - '0';
s++;
}
if (neg)
n = -n;
}
else /* b == 16 and value is always positive */
{ while ((c = *s))
{ if (c >= '0' && c <= '9')
c -= '0';
else if (c >= 'A' && c <= 'F')
c -= 'A' - 10;
else if (c >= 'a' && c <= 'f')
c -= 'a' - 10;
if (n > 0x07FFFFFF)
break;
n <<= 4;
n += c;
s++;
}
}
if (t)
*t = (char*)s;
return n;
}
#endif
#endif
/******************************************************************************/
#ifndef PALM_2
#ifndef HAVE_STRTOUL
unsigned long
soap_strtoul(const char *s, char **t, int b)
{ unsigned long n = 0;
register int c;
while (*s > 0 && *s <= 32)
s++;
if (b == 10)
{ if (*s == '+')
s++;
while ((c = *s) && c >= '0' && c <= '9')
{ if (n >= 429496729 && (n > 429496729 || c >= '6'))
break;
n *= 10;
n += c - '0';
s++;
}
}
else /* b == 16 */
{ while ((c = *s))
{ if (c >= '0' && c <= '9')
c -= '0';
else if (c >= 'A' && c <= 'F')
c -= 'A' - 10;
else if (c >= 'a' && c <= 'f')
c -= 'a' - 10;
if (n > 0x0FFFFFFF)
break;
n <<= 4;
n += c;
s++;
}
}
if (t)
*t = (char*)s;
return n;
}
#endif
#endif
/******************************************************************************/
#ifndef PALM_1
int
soap_array_begin_out(struct soap *soap, const char *tag, int id, const char *type, const char *offset)
{ const char *s;
}
}
else
}
#ifndef WITH_LEAN
if (s)
}
#endif
}
#endif
/******************************************************************************/
#ifndef PALM_1
int
{ register struct soap_attribute *tp;
#ifndef WITH_LEAN
{ struct soap_nlist *np;
if (s)
}
}
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Enabling utilized binding (level=%u) %s='%s'\n", np->level, soap->tmpbuf, np->ns));
}
}
}
#endif
#ifdef WITH_DOM
{ register struct soap_dom_attribute **att;
if (!*att)
}
}
return SOAP_OK;
}
#endif
{
#ifdef WITH_XMLNS
if (s)
s++;
else
}
else
#endif
}
}
if (tag)
{
#ifndef WITH_LEAN
return SOAP_OK;
}
#endif
return SOAP_OK;
}
}
#endif
/******************************************************************************/
#ifndef PALM_1
int
{ if (*tag == '-')
return SOAP_OK;
#ifdef WITH_DOM
return SOAP_OK;
}
#endif
#ifndef WITH_LEAN
{ if (soap_send_raw(soap, soap_indent, soap->level < sizeof(soap_indent) ? soap->level : sizeof(soap_indent) - 1))
}
}
#endif
#ifdef WITH_XMLNS
{ soap_pop_ns(soap);
tag = s + 1;
}
}
#endif
}
#endif
/******************************************************************************/
#ifndef PALM_1
int
{ register int n = 0;
const char *s = "href";
{ s = "SOAP-ENC:ref";
n = 1;
}
}
#endif
/******************************************************************************/
#ifndef PALM_1
int
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef PALM_1
int
{ struct soap_attribute *tp;
break;
}
soap->mustUnderstand = 0;
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef PALM_1
int
soap_element_id(struct soap *soap, const char *tag, int id, const void *p, const struct soap_array *a, int n, const char *type, int t)
{ if (!p || (a && !a->__ptr))
return -1;
}
#ifndef WITH_NOIDREF
return 0;
if (id < 0)
{ struct soap_plist *pp;
if (a)
else
if (id)
return -1;
}
return 0;
}
}
return id;
#else
return 0;
#endif
}
#endif
/******************************************************************************/
#ifndef PALM_1
int
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef PALM_1
void
/* should compare tag to element's QName value? */
}
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
{
#ifdef WITH_DOM
{ register struct soap_dom_attribute *a = (struct soap_dom_attribute*)soap_malloc(soap, sizeof(struct soap_dom_attribute));
return SOAP_OK;
}
#endif
#ifndef WITH_LEAN
{ /* TODO: consider using this code to handle default namespace bindings
if (!strncmp(name, "xmlns", 5) && (name[5] == ':' || name[5] == '\0'))
{ if (name[5] == ':')
soap_push_ns(soap, name + 6, value, 0);
else
soap_push_ns(soap, "", value, 0);
}
*/
}
else
#endif
if (value)
}
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
{ if (!soap_peek_element(soap))
return SOAP_OK;
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Begin element found (level=%u) '%s'='%s'\n", soap->level, soap->tag, tag?tag:"" ));
}
}
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
{ register soap_wchar c;
register char *s;
register int n = 0;
return SOAP_OK;
#ifdef WITH_DOM
/* this whitespace or mixed content is not insignificant for DOM */
}
#endif
n++;
}
do
{ if ((int)c == EOF)
if (c == SOAP_LT)
n++;
else if (c == '/')
if (c == SOAP_GT)
n--;
else
soap_unget(soap, c);
}
}
} while (n--);
{ if (--n > 0)
*s++ = (char)c;
}
*s = '\0';
if ((int)c == EOF)
while (soap_blank(c))
if (c != SOAP_GT)
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End element found (level=%u) '%s'='%s'\n", soap->level, soap->tag, tag?tag:""));
return SOAP_OK;
}
}
#endif
/******************************************************************************/
#ifndef PALM_2
const char *
{ register struct soap_attribute *tp;
break;
}
if (tp)
else
}
return NULL;
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
{ register struct soap_attribute *tp;
break;
}
if (!tp)
if (!(tp = (struct soap_attribute*)SOAP_MALLOC(soap, sizeof(struct soap_attribute) + strlen(name))))
#ifndef WITH_LEAN
break;
}
else if (!s)
break;
}
else
{ int k;
{ if (!strncmp((*tpp)->name, "xmlns:", 6) && !strncmp((*tpp)->name + 6, name, s - name) && !(*tpp)->name[6 + s - name])
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Canonicalization: prefix %s=%p (%s)\n", name, (*tpp)->ns, (*tpp)->ns));
}
}
else if (strncmp((*tpp)->name, "xmlns", 5) && (*tpp)->ns && tp->ns && ((k = strcmp((*tpp)->ns, tp->ns)) > 0 || (!k && strcmp((*tpp)->name, name) > 0)))
break;
}
}
}
else
#endif
}
}
{ return SOAP_OK;
}
}
if (value)
}
#ifndef WITH_LEAN
}
#endif
}
else
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef PALM_2
void
{ register struct soap_attribute *tp;
#ifndef WITH_LEAN
{ while (soap->attributes)
}
}
else
#endif
}
}
#endif
/******************************************************************************/
#ifndef PALM_2
static int
{ register size_t i;
for (i = 0; i < n; i++)
switch (c)
{
case SOAP_TT:
*s++ = '<';
break;
case SOAP_LT:
*s++ = '<';
break;
case SOAP_GT:
if (d == ' ')
{ soap_unget(soap, c);
*s = '\0';
return SOAP_OK;
}
*s++ = '>';
break;
case SOAP_QT:
if (c == d)
{ *s = '\0';
return SOAP_OK;
}
*s++ = '"';
break;
case SOAP_AP:
if (c == d)
{ *s = '\0';
return SOAP_OK;
}
*s++ = '\'';
break;
case '\t':
case '\n':
case '\r':
case ' ':
case '/':
if (d == ' ')
{ soap_unget(soap, c);
*s = '\0';
return SOAP_OK;
}
default:
if ((int)c == EOF)
*s++ = (char)c;
}
}
}
#endif
/******************************************************************************/
#ifdef WITH_FAST
#ifndef PALM_2
int
return soap_append_lab(soap, s, n);
}
#endif
#endif
/******************************************************************************/
#ifdef WITH_FAST
#ifndef PALM_2
int
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Enlarging look-aside buffer to append data, old size=%lu", (unsigned long)soap->lablen));
{ if (t)
}
if (t)
}
}
if (s)
}
return SOAP_OK;
}
#endif
#endif
/******************************************************************************/
#ifndef PALM_2
int
{
#ifdef WITH_DOM
#endif
register struct soap_attribute *tp;
const char *t;
register char *s;
register soap_wchar c;
register int i;
return SOAP_OK;
}
c = soap_getutf8(soap);
#ifdef WITH_DOM
/* whitespace leading to start tag is not insignificant for DOM */
if (soap_blank(c))
do
return SOAP_EOM;
while (soap_blank(c) && i--)
{ *s++ = c;
c = soap_getutf8(soap);
}
}
while (soap_blank(c));
*s = '\0';
}
#else
while (soap_blank(c))
c = soap_getutf8(soap);
#endif
if (c != SOAP_LT)
if ((int)c == EOF)
soap_unget(soap, c);
#ifdef WITH_DOM
/* whitespace leading to end tag is not insignificant for DOM */
#endif
}
while (soap_blank(c));
{ if (--i > 0)
*s++ = (char)c;
}
while (soap_blank(c))
*s = '\0';
soap->mustUnderstand = 0;
#ifdef WITH_DOM
{ register struct soap_dom_element *elt;
if (!elt)
if (p)
{ while (p->next)
p = p->next;
}
else
}
}
#endif
{ if (--i > 0)
*s++ = (char)c;
}
*s = '\0';
#ifdef WITH_DOM
/* add attribute name to dom */
if (att)
if (!*att)
}
#endif
}
t = NULL;
else
t = SOAP_STR_EOS;
}
else
t = NULL;
break;
}
if (!tp)
{ tp = (struct soap_attribute*)SOAP_MALLOC(soap, sizeof(struct soap_attribute) + strlen(soap->tmpbuf));
if (!tp)
}
while (soap_blank(c))
if (c == '=')
{ do c = soap_getutf8(soap);
while (soap_blank(c));
{ soap_unget(soap, c);
c = ' '; /* blank delimiter */
}
{
#ifdef WITH_FAST
for (;;)
}
else
break;
}
else
}
#else
size_t n;
if (soap_new_block(soap))
for (;;)
}
else
break;
}
if (!(s = (char*)SOAP_MALLOC(soap, n)))
}
#endif
}
while (soap_blank(c));
#ifdef WITH_DOM
if (att)
#endif
}
else
#ifdef WITH_DOM
if (att)
#endif
}
}
#ifdef WITH_DOM
if (att)
}
#endif
if ((int)c == EOF)
while (soap_blank(c));
#ifdef WITH_DOM
}
#endif
}
}
}
}
}
}
}
else
}
}
}
}
}
}
}
}
}
#endif
/******************************************************************************/
#ifndef PALM_2
void
}
#endif
/******************************************************************************/
#ifndef PALM_2
void
}
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
{ register const char *t;
register soap_wchar c;
#ifdef WITH_DOM
return SOAP_OK;
}
#endif
mask = 0;
t = s;
while ((c = *t++))
{ switch (c)
{
case 0x09:
if (flag)
s = t;
}
break;
case 0x0A:
s = t;
}
break;
case 0x0D:
s = t;
break;
case '&':
s = t;
break;
case '<':
s = t;
break;
case '>':
if (!flag)
s = t;
}
break;
case '"':
if (flag)
s = t;
}
break;
default:
#ifndef WITH_LEANER
#ifdef HAVE_MBTOWC
{ wchar_t wc;
if (m > 0 && wc != c)
s = t += m - 1;
continue;
}
}
#endif
#endif
if ((c & mask) || !(c & 0xFFFFFFE0UL))
s = t;
}
}
}
}
#endif
/******************************************************************************/
#ifndef PALM_2
char *
{ register char *s;
char *t = NULL;
register size_t i;
register long l = 0;
register int n = 0;
register int m = 0;
register soap_wchar c;
#if !defined(WITH_LEANER) && defined(HAVE_WCTOMB)
#else
char buf[8];
#endif
return NULL;
{ n = 1;
#ifndef WITH_LEAN
t[0] = '<';
#endif
}
}
#ifdef WITH_CDATA
if (!flag)
{ register int state = 0;
#ifdef WITH_FAST
#else
if (soap_new_block(soap))
return NULL;
#endif
for (;;)
{
#ifdef WITH_FAST
register size_t k;
return NULL;
#else
register size_t k = SOAP_BLKLEN;
if (!(s = (char*)soap_push_block(soap, k)))
return NULL;
#endif
for (i = 0; i < k; i++)
{ if (m > 0)
{ *s++ = *t++; /* copy multibyte characters */
m--;
continue;
}
c = soap_getchar(soap);
if ((int)c == EOF)
goto end;
{ soap_unget(soap, c);
c = soap_getutf8(soap);
{ c &= 0x7FFFFFFF;
t = buf;
if (c < 0x0800)
*t++ = (char)(0xC0 | ((c >> 6) & 0x1F));
else
{ if (c < 0x010000)
*t++ = (char)(0xE0 | ((c >> 12) & 0x0F));
else
{ if (c < 0x200000)
*t++ = (char)(0xF0 | ((c >> 18) & 0x07));
else
{ if (c < 0x04000000)
*t++ = (char)(0xF8 | ((c >> 24) & 0x03));
else
{ *t++ = (char)(0xFC | ((c >> 30) & 0x01));
*t++ = (char)(0x80 | ((c >> 24) & 0x3F));
}
*t++ = (char)(0x80 | ((c >> 18) & 0x3F));
}
*t++ = (char)(0x80 | ((c >> 12) & 0x3F));
}
*t++ = (char)(0x80 | ((c >> 6) & 0x3F));
}
*t++ = (char)(0x80 | (c & 0x3F));
m = (int)(t - buf) - 1;
t = buf;
*s++ = *t++;
continue;
}
}
}
switch (state)
{ case 1:
if (c == ']')
state = 4;
*s++ = c;
continue;
case 2:
if (c == '-')
state = 6;
*s++ = c;
continue;
case 3:
if (c == '?')
state = 8;
*s++ = c;
continue;
/* CDATA */
case 4:
if (c == ']')
state = 5;
else
state = 1;
*s++ = c;
continue;
case 5:
if (c == '>')
state = 0;
else
state = 1;
*s++ = c;
continue;
/* comment */
case 6:
if (c == '-')
state = 7;
else
state = 2;
*s++ = c;
continue;
case 7:
if (c == '>')
state = 0;
else
state = 2;
*s++ = c;
continue;
/* PI */
case 8:
if (c == '>')
state = 0;
else
state = 3;
*s++ = c;
continue;
}
switch (c)
{
case '/':
if (n > 0)
{ c = soap_getchar(soap);
if (c == '>')
n--;
soap_unget(soap, c);
}
*s++ = '/';
break;
case '<':
c = soap_getchar(soap);
if (c == '/')
{ if (n == 0)
{ c = SOAP_TT;
goto end;
}
n--;
}
else if (c == '!')
{ c = soap_getchar(soap);
if (c == '[')
{ do c = soap_getchar(soap);
while ((int)c != EOF && c != '[');
if ((int)c == EOF)
goto end;
t = (char*)"![CDATA[";
m = 8;
state = 1;
}
else if (c == '-')
state = 2;
t = (char*)"!-";
m = 2;
soap_unget(soap, c);
}
else
{ t = (char*)"!";
m = 1;
soap_unget(soap, c);
}
*s++ = '<';
break;
}
else if (c == '?')
state = 3;
else
n++;
soap_unget(soap, c);
*s++ = '<';
break;
case '>':
*s++ = '>';
break;
case '"':
*s++ = '"';
break;
default:
#ifndef WITH_LEANER
#ifdef HAVE_WCTOMB
if (m >= 1 && m <= (int)MB_CUR_MAX)
{ t = buf;
*s++ = *t++;
m--;
}
else
{ *s++ = SOAP_UNKNOWN_CHAR;
m = 0;
}
}
else
#endif
#endif
*s++ = (char)(c & 0xFF);
}
l++;
return NULL;
}
}
}
}
#endif
#ifdef WITH_FAST
#else
if (soap_new_block(soap))
return NULL;
#endif
for (;;)
{
#ifdef WITH_FAST
register size_t k;
return NULL;
#else
register size_t k = SOAP_BLKLEN;
if (!(s = (char*)soap_push_block(soap, k)))
return NULL;
#endif
for (i = 0; i < k; i++)
{ if (m > 0)
{ *s++ = *t++; /* copy multibyte characters */
m--;
continue;
}
{ c &= 0x7FFFFFFF;
t = buf;
if (c < 0x0800)
*t++ = (char)(0xC0 | ((c >> 6) & 0x1F));
else
{ if (c < 0x010000)
*t++ = (char)(0xE0 | ((c >> 12) & 0x0F));
else
{ if (c < 0x200000)
*t++ = (char)(0xF0 | ((c >> 18) & 0x07));
else
{ if (c < 0x04000000)
*t++ = (char)(0xF8 | ((c >> 24) & 0x03));
else
{ *t++ = (char)(0xFC | ((c >> 30) & 0x01));
*t++ = (char)(0x80 | ((c >> 24) & 0x3F));
}
*t++ = (char)(0x80 | ((c >> 18) & 0x3F));
}
*t++ = (char)(0x80 | ((c >> 12) & 0x3F));
}
*t++ = (char)(0x80 | ((c >> 6) & 0x3F));
}
*t++ = (char)(0x80 | (c & 0x3F));
m = (int)(t - buf) - 1;
t = buf;
*s++ = *t++;
continue;
}
}
else
c = soap_getutf8(soap);
switch (c)
{
case SOAP_TT:
if (n == 0)
goto end;
n--;
*s++ = '<';
t = (char*)"/";
m = 1;
break;
case SOAP_LT:
n++;
*s++ = '<';
break;
case SOAP_GT:
*s++ = '>';
break;
case SOAP_QT:
*s++ = '"';
break;
case SOAP_AP:
*s++ = '\'';
break;
case '/':
if (n > 0)
if (c == SOAP_GT)
n--;
soap_unget(soap, c);
}
*s++ = '/';
break;
case '<' | 0x80000000:
if (flag)
*s++ = '<';
else
{ *s++ = '&';
t = (char*)"lt;";
m = 3;
}
break;
case '>' | 0x80000000:
if (flag)
*s++ = '>';
else
{ *s++ = '&';
t = (char*)"gt;";
m = 3;
}
break;
case '&' | 0x80000000:
if (flag)
*s++ = '&';
else
{ *s++ = '&';
t = (char*)"amp;";
m = 4;
}
break;
case '"' | 0x80000000:
if (flag)
*s++ = '"';
else
{ *s++ = '&';
t = (char*)"quot;";
m = 5;
}
break;
case '\'' | 0x80000000:
if (flag)
*s++ = '\'';
else
{ *s++ = '&';
t = (char*)"apos;";
m = 5;
}
break;
default:
if ((int)c == EOF)
goto end;
#ifndef WITH_LEANER
#ifdef HAVE_WCTOMB
if (m >= 1 && m <= (int)MB_CUR_MAX)
{ t = buf;
*s++ = *t++;
m--;
}
else
{ *s++ = SOAP_UNKNOWN_CHAR;
m = 0;
}
}
else
#endif
#endif
*s++ = (char)(c & 0xFF);
}
l++;
return NULL;
}
}
}
end:
soap_unget(soap, c);
*s = '\0';
#ifdef WITH_FAST
#else
#endif
return NULL;
}
#ifdef WITH_DOM
{ if (flag == 3)
else
}
#endif
if (flag == 2)
if (soap_s2QName(soap, t, &t))
return NULL;
return t;
}
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_2
int
{ const char *t;
char tmp;
register soap_wchar c;
#ifdef WITH_DOM
{ wchar_t *r = (wchar_t*)s;
int n = 1;
while (*r++)
n++;
while (n--)
*r++ = *s++;
return SOAP_OK;
}
#endif
while ((c = *s++))
{ switch (c)
{
case 0x09:
if (flag)
t = "	";
else
t = "\t";
break;
case 0x0A:
t = "
";
else
t = "\n";
break;
case 0x0D:
t = "
";
break;
case '&':
t = "&";
break;
case '<':
t = "<";
break;
case '>':
if (flag)
t = ">";
else
t = ">";
break;
case '"':
if (flag)
t = """;
else
t = "\"";
break;
default:
if (c >= 0x20 && c < 0x80)
{ tmp = (char)c;
}
else if (soap_pututf8(soap, (unsigned long)c))
continue;
}
}
return SOAP_OK;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_2
wchar_t *
{ wchar_t *s;
register int i, n = 0;
register long l = 0;
register soap_wchar c;
const char *t = NULL;
return NULL;
{ n = 1;
}
}
if (soap_new_block(soap))
return NULL;
for (;;)
return NULL;
for (i = 0; i < SOAP_BLKLEN; i++)
{ if (t)
{ *s++ = (wchar_t)*t++;
if (!*t)
t = NULL;
continue;
}
c = soap_getutf8(soap);
switch (c)
{
case SOAP_TT:
if (n == 0)
goto end;
n--;
*s++ = '<';
break;
case SOAP_LT:
n++;
*s++ = '<';
break;
case SOAP_GT:
*s++ = '>';
break;
case SOAP_QT:
*s++ = '"';
break;
case SOAP_AP:
*s++ = '\'';
break;
case '/':
if (n > 0)
{ c = soap_getutf8(soap);
if (c == SOAP_GT)
n--;
soap_unget(soap, c);
}
*s++ = '/';
break;
case '<':
if (flag)
*s++ = (soap_wchar)'<';
else
{ *s++ = (soap_wchar)'&';
t = "lt;";
}
break;
case '>':
if (flag)
*s++ = (soap_wchar)'>';
else
{ *s++ = (soap_wchar)'&';
t = "gt;";
}
break;
case '"':
if (flag)
*s++ = (soap_wchar)'"';
else
{ *s++ = (soap_wchar)'&';
t = "quot;";
}
break;
default:
if ((int)c == EOF)
goto end;
*s++ = (wchar_t)c & 0x7FFFFFFF;
}
l++;
return NULL;
}
}
}
end:
soap_unget(soap, c);
*s = '\0';
return NULL;
}
#ifdef WITH_DOM
#endif
return s;
}
#endif
#endif
/******************************************************************************/
#ifndef PALM_2
const char*
{ return soap_long2s(soap, (long)n);
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
{ if (s)
{ char *r;
#ifndef WITH_NOIO
#ifndef WITH_LEAN
#endif
#endif
*p = (int)soap_strtol(s, &r, 10);
#ifndef WITH_NOIO
#ifndef WITH_LEAN
|| soap_errno == SOAP_ERANGE
#endif
#endif
)
}
}
#endif
/******************************************************************************/
#ifndef PALM_2
int *
return NULL;
#ifndef WITH_LEAN
return NULL;
}
#endif
else if (p)
return NULL;
}
return NULL;
return p;
}
#endif
/******************************************************************************/
#ifndef PALM_2
const char*
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
{ if (s)
{ char *r;
#ifndef WITH_NOIO
#ifndef WITH_LEAN
#endif
#endif
*p = soap_strtol(s, &r, 10);
#ifndef WITH_NOIO
#ifndef WITH_LEAN
|| soap_errno == SOAP_ERANGE
#endif
#endif
)
}
}
#endif
/******************************************************************************/
#ifndef PALM_2
long *
return NULL;
#ifndef WITH_LEAN
return NULL;
}
#endif
else if (p)
return NULL;
}
return NULL;
return p;
}
#endif
/******************************************************************************/
#ifndef WITH_LEAN
const char*
}
#endif
/******************************************************************************/
#ifndef WITH_LEAN
int
soap_outLONG64(struct soap *soap, const char *tag, int id, const LONG64 *p, const char *type, int n)
}
#endif
/******************************************************************************/
#ifndef WITH_LEAN
int
{ if (s)
{
#ifdef HAVE_STRTOLL
char *r;
#ifndef WITH_NOIO
#ifndef WITH_LEAN
#endif
#endif
*p = strtoll(s, &r, 10);
#ifndef WITH_NOIO
#ifndef WITH_LEAN
|| soap_errno == SOAP_ERANGE
#endif
#endif
)
#else
# ifdef HAVE_SSCANF
# endif
#endif
}
}
#endif
/******************************************************************************/
#ifndef WITH_LEAN
LONG64 *
return NULL;
#ifndef WITH_LEAN
return NULL;
}
#endif
else if (p)
return NULL;
}
return NULL;
return p;
}
#endif
/******************************************************************************/
#ifndef PALM_2
const char*
{ return soap_long2s(soap, (long)n);
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
{ if (s)
{ long n;
char *r;
n = soap_strtol(s, &r, 10);
if (s == r || *r || n < -128 || n > 127)
*p = (char)n;
}
}
#endif
/******************************************************************************/
#ifndef PALM_2
char *
return NULL;
#ifndef WITH_LEAN
return NULL;
}
#endif
else if (p)
return NULL;
}
return NULL;
return p;
}
#endif
/******************************************************************************/
#ifndef PALM_2
const char*
{ return soap_long2s(soap, (long)n);
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
{ if (s)
{ long n;
char *r;
n = soap_strtol(s, &r, 10);
if (s == r || *r || n < -32768 || n > 32767)
*p = (short)n;
}
}
#endif
/******************************************************************************/
#ifndef PALM_2
short *
return NULL;
#ifndef WITH_LEAN
return NULL;
}
#endif
else if (p)
return NULL;
}
return NULL;
return p;
}
#endif
/******************************************************************************/
#ifndef PALM_2
const char*
{ char *s, *t;
if (soap_isnan((double)n))
return "NaN";
if (soap_ispinff(n))
return "INF";
if (soap_isninff(n))
return "-INF";
if (t)
*t = '.';
return s;
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
{ if (s)
{ if (!*s)
if (!soap_tag_cmp(s, "INF"))
*p = FLT_PINFTY;
else if (!soap_tag_cmp(s, "+INF"))
*p = FLT_PINFTY;
else if (!soap_tag_cmp(s, "-INF"))
*p = FLT_NINFTY;
else if (!soap_tag_cmp(s, "NaN"))
*p = FLT_NAN;
else
{
/* On some systems, strtof appears to be broken or doesn't link: use with caution */
#if defined(HAVE_STRTOF)
char *r;
*p = strtof((char*)s, &r);
if (*r)
#elif defined(HAVE_STRTOD)
char *r;
*p = (float)strtod(s, &r);
if (*r)
#endif
#ifdef HAVE_SSCANF
#else
#endif
}
}
}
#endif
/******************************************************************************/
#ifndef WITH_LEAN
return SOAP_ERR;
}
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef PALM_2
float *
return NULL;
#ifndef WITH_LEAN
return NULL;
#endif
else if (p)
return NULL;
}
return NULL;
return p;
}
#endif
/******************************************************************************/
#ifndef PALM_2
const char*
{ char *s, *t;
if (soap_isnan(n))
return "NaN";
if (soap_ispinfd(n))
return "INF";
if (soap_isninfd(n))
return "-INF";
if (t)
*t = '.';
return s;
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
soap_outdouble(struct soap *soap, const char *tag, int id, const double *p, const char *type, int n)
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
{ if (s)
{ if (!*s)
if (!soap_tag_cmp(s, "INF"))
*p = DBL_PINFTY;
else if (!soap_tag_cmp(s, "+INF"))
*p = DBL_PINFTY;
else if (!soap_tag_cmp(s, "-INF"))
*p = DBL_NINFTY;
else if (!soap_tag_cmp(s, "NaN"))
*p = DBL_NAN;
else
{
#ifdef HAVE_STRTOD
char *r;
*p = strtod(s, &r);
if (*r)
#endif
#ifdef HAVE_SSCANF
#else
#endif
}
}
}
#endif
/******************************************************************************/
#ifndef PALM_2
double *
return NULL;
#ifndef WITH_LEAN
return NULL;
#endif
else if (p)
return NULL;
}
return NULL;
return p;
}
#endif
/******************************************************************************/
#ifndef PALM_2
const char*
{ return soap_unsignedLong2s(soap, (unsigned long)n);
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
soap_outunsignedByte(struct soap *soap, const char *tag, int id, const unsigned char *p, const char *type, int n)
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
{ if (s)
{ unsigned long n;
char *r;
n = soap_strtoul(s, &r, 10);
if (s == r || *r || n > 255)
*p = (unsigned char)n;
}
}
#endif
/******************************************************************************/
#ifndef PALM_2
unsigned char *
return NULL;
#ifndef WITH_LEAN
return NULL;
}
#endif
p = (unsigned char*)soap_id_enter(soap, soap->id, p, t, sizeof(unsigned char), 0, NULL, NULL, NULL);
else if (p)
return NULL;
}
return NULL;
return p;
}
#endif
/******************************************************************************/
#ifndef PALM_2
const char*
{ return soap_unsignedLong2s(soap, (unsigned long)n);
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
soap_outunsignedShort(struct soap *soap, const char *tag, int id, const unsigned short *p, const char *type, int n)
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
{ if (s)
{ unsigned long n;
char *r;
n = soap_strtoul(s, &r, 10);
if (s == r || *r || n > 65535)
*p = (unsigned short)n;
}
}
#endif
/******************************************************************************/
#ifndef PALM_2
unsigned short *
soap_inunsignedShort(struct soap *soap, const char *tag, unsigned short *p, const char *type, int t)
return NULL;
#ifndef WITH_LEAN
return NULL;
}
#endif
p = (unsigned short*)soap_id_enter(soap, soap->id, p, t, sizeof(unsigned short), 0, NULL, NULL, NULL);
p = (unsigned short*)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(unsigned short), 0, NULL);
else if (p)
return NULL;
}
return NULL;
return p;
}
#endif
/******************************************************************************/
#ifndef PALM_2
const char*
{ return soap_unsignedLong2s(soap, (unsigned long)n);
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
soap_outunsignedInt(struct soap *soap, const char *tag, int id, const unsigned int *p, const char *type, int n)
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
{ if (s)
{ char *r;
#ifndef WITH_NOIO
#ifndef WITH_LEAN
#endif
#endif
*p = (unsigned int)soap_strtoul(s, &r, 10);
#ifndef WITH_NOIO
#ifndef WITH_LEAN
|| soap_errno == SOAP_ERANGE
#endif
#endif
)
}
}
#endif
/******************************************************************************/
#ifndef PALM_2
unsigned int *
return NULL;
#ifndef WITH_LEAN
return NULL;
}
#endif
else if (p)
return NULL;
}
return NULL;
return p;
}
#endif
/******************************************************************************/
#ifndef PALM_2
const char*
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
soap_outunsignedLong(struct soap *soap, const char *tag, int id, const unsigned long *p, const char *type, int n)
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
{ if (s)
{ char *r;
#ifndef WITH_NOIO
#ifndef WITH_LEAN
#endif
#endif
*p = soap_strtoul(s, &r, 10);
#ifndef WITH_NOIO
#ifndef WITH_LEAN
|| soap_errno == SOAP_ERANGE
#endif
#endif
)
}
}
#endif
/******************************************************************************/
#ifndef PALM_2
unsigned long *
return NULL;
#ifndef WITH_LEAN
return NULL;
}
#endif
p = (unsigned long*)soap_id_enter(soap, soap->id, p, t, sizeof(unsigned long), 0, NULL, NULL, NULL);
else if (p)
return NULL;
}
return NULL;
return p;
}
#endif
/******************************************************************************/
#ifndef WITH_LEAN
const char*
}
#endif
/******************************************************************************/
#ifndef WITH_LEAN
int
soap_outULONG64(struct soap *soap, const char *tag, int id, const ULONG64 *p, const char *type, int n)
}
#endif
/******************************************************************************/
#ifndef WITH_LEAN
int
{ if (s)
{
#ifdef HAVE_STRTOULL
char *r;
#ifndef WITH_NOIO
#ifndef WITH_LEAN
#endif
#endif
*p = strtoull(s, &r, 10);
#ifndef WITH_NOIO
#ifndef WITH_LEAN
|| soap_errno == SOAP_ERANGE
#endif
#endif
)
#else
# ifdef HAVE_SSCANF
# endif
#endif
}
}
#endif
/******************************************************************************/
#ifndef WITH_LEAN
ULONG64 *
return NULL;
return NULL;
}
else if (p)
return NULL;
}
return NULL;
return p;
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
{ *t = NULL;
if (s)
{ if (!(*t = soap_strdup(soap, s)))
{ /* TODO: consider truncating UTF8 to ASCII for regular XML attribute strings? */
}
}
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
{ if (s)
const char *p;
/* if there is no namespace stack, or prefix is "xml" then pass string */
{ *t = soap_strdup(soap, s);
return SOAP_OK;
}
/* else we normalize the QName by replacing its prefix */
p = strchr(s, ':');
if (p)
{ register int n = p - s;
p++;
}
else
p = s;
}
if (np)
if (q)
sprintf(*t, "%s:%s", q, p);
return SOAP_OK;
}
}
return SOAP_OK;
}
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Namespace prefix of '%s' not defined (index=%d, URI=%s)\n", s, np->index, np->ns?np->ns:""));
}
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Namespace prefix of '%s' not defined, assuming empty namespace\n", s));
sprintf(*t, "\"\":%s", p);
}
else
*t = NULL;
}
#endif
/******************************************************************************/
#ifndef PALM_2
const char*
{ struct Namespace *p;
char *t;
int n;
if (!s || *s != '"')
{
#ifndef WITH_LEAN
{ t = (char*)strchr(s, ':');
if (t)
soap_utilize_ns(soap, s, t - s);
}
#endif
return s;
}
s++;
if ((p = soap->local_namespaces))
{ for (; p->id; p++)
{ if (p->ns)
if (!soap_tag_cmp(s, p->ns))
break;
if (p->in)
if (!soap_tag_cmp(s, p->in))
break;
}
if (p && p->id)
{ s = strchr(s, '"');
if (s)
strcat(t, s + 1);
return t;
}
}
}
t = (char*)strchr(s, '"');
if (t)
n = t - s;
else
n = 0;
t = soap_strdup(soap, s);
t[n] = '\0';
s = strchr(s, '"');
if (s)
strcat(t, s + 1);
}
return t;
}
#endif
/******************************************************************************/
#ifndef WITH_LEAN
int
{ wchar_t *r;
if (!s)
*t = NULL;
else
if (!r)
{ while (*s)
*r++ = (wchar_t)*s++;
}
else
{ /* Convert UTF8 to wchar */
while (*s)
c = *s++;
if (c < 0x80)
*r++ = (wchar_t)c;
else
if (c < 0xE0)
else
if (c < 0xF0)
else
if (c < 0xF8)
else
if (c < 0xFC)
else
*r++ = (wchar_t)(((soap_wchar)(c & 0x01) << 30) | (c1 << 24) | (c2 << 18) | (c3 << 12) | (c4 << 6) | (soap_wchar)(*s++ & 0x3F));
}
}
}
}
}
}
*r = L'\0';
}
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef WITH_LEAN
const char*
{ register soap_wchar c;
register char *r, *t;
const wchar_t *q = s;
size_t n = 0;
while ((c = *q++))
{ if (c > 0 && c < 0x80)
n++;
else
n += 6;
}
if (r)
{ /* Convert wchar to UTF8 */
while ((c = *s++))
{ if (c > 0 && c < 0x80)
*t++ = (char)c;
else
{ if (c < 0x0800)
*t++ = (char)(0xC0 | ((c >> 6) & 0x1F));
else
{ if (c < 0x010000)
*t++ = (char)(0xE0 | ((c >> 12) & 0x0F));
else
{ if (c < 0x200000)
*t++ = (char)(0xF0 | ((c >> 18) & 0x07));
else
{ if (c < 0x04000000)
*t++ = (char)(0xF8 | ((c >> 24) & 0x03));
else
{ *t++ = (char)(0xFC | ((c >> 30) & 0x01));
*t++ = (char)(0x80 | ((c >> 24) & 0x3F));
}
*t++ = (char)(0x80 | ((c >> 18) & 0x3F));
}
*t++ = (char)(0x80 | ((c >> 12) & 0x3F));
}
*t++ = (char)(0x80 | ((c >> 6) & 0x3F));
}
*t++ = (char)(0x80 | (c & 0x3F));
}
}
*t = '\0';
}
return r;
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
if (id < 0)
|| soap_string_out(soap, *p, 0)
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef PALM_2
char **
soap_instring(struct soap *soap, const char *tag, char **p, const char *type, int t, int flag, long minlen, long maxlen)
return NULL;
}
if (!p)
{ if (!(p = (char**)soap_malloc(soap, sizeof(char*))))
return NULL;
}
return NULL;
return NULL;
}
}
*p = NULL;
else
*p = (char*)SOAP_STR_EOS;
return NULL;
return p;
}
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_2
int
soap_outwstring(struct soap *soap, const char *tag, int id, wchar_t *const*p, const char *type, int n)
if (id < 0)
|| soap_wstring_out(soap, *p, 0)
return SOAP_OK;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_2
wchar_t **
soap_inwstring(struct soap *soap, const char *tag, wchar_t **p, const char *type, int t, long minlen, long maxlen)
return NULL;
}
if (!p)
{ if (!(p = (wchar_t**)soap_malloc(soap, sizeof(wchar_t*))))
return NULL;
}
return NULL;
return NULL;
}
}
*p = NULL;
else
*p = (wchar_t*)SOAP_STR_EOS;
return NULL;
return p;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEAN
static time_t
soap_timegm(struct tm *T)
{
#if defined(HAVE_TIMEGM)
return timegm(T);
#else
time_t t, g, z;
t = mktime(T);
if (t == -1)
return -1;
#ifdef HAVE_GMTIME_R
#else
#endif
if (g == -1)
return -1;
z = g - t;
return t - z;
#endif
}
#endif
/******************************************************************************/
#ifndef WITH_LEAN
const char*
#if defined(HAVE_GMTIME_R)
/* The following defines were added for VxWorks*/
#elif defined(HAVE_PGMTIME_R)
#elif defined(HAVE_PGMTIME)
#elif defined(HAVE_GMTIME)
#elif defined(HAVE_GETTIMEOFDAY)
# if defined(HAVE_LOCALTIME_R)
if (localtime_r(&n, pT))
sprintf(soap->tmpbuf + strlen(soap->tmpbuf), "%+03d:%02d", -tz.tz_minuteswest/60+(pT->tm_isdst!=0), abs(tz.tz_minuteswest)%60);
}
# else
sprintf(soap->tmpbuf + strlen(soap->tmpbuf), "%+03d:%02d", -tz.tz_minuteswest/60+(pT->tm_isdst!=0), abs(tz.tz_minuteswest)%60);
}
#endif
#elif defined(HAVE_FTIME)
struct timeb t;
memset((void*)&t, 0, sizeof(t));
# if defined(HAVE_LOCALTIME_R)
if (localtime_r(&n, pT))
{
#ifdef __BORLANDC__
::ftime(&t);
#else
ftime(&t);
#endif
sprintf(soap->tmpbuf + strlen(soap->tmpbuf), "%+03d:%02d", -t.timezone/60+(pT->tm_isdst!=0), abs(t.timezone)%60);
}
/* The following defines were added for VxWorks*/
# elif defined(HAVE_PLOCALTIME_R)
if (localtime_r(&n, pT))
}
# else
{
#ifdef __BORLANDC__
::ftime(&t);
#else
ftime(&t);
#endif
sprintf(soap->tmpbuf + strlen(soap->tmpbuf), "%+03d:%02d", -t.timezone/60+(pT->tm_isdst!=0), abs(t.timezone)%60);
}
# endif
#elif defined(HAVE_LOCALTIME_R)
if (localtime_r(&n, pT))
/* The following defines were added for VxWorks*/
#elif defined(HAVE_PLOCALTIME_R)
if (localtime_r(&n, pT))
#else
#endif
else
}
#endif
/******************************************************************************/
#ifndef WITH_LEAN
int
soap_outdateTime(struct soap *soap, const char *tag, int id, const time_t *p, const char *type, int n)
}
#endif
/******************************************************************************/
#ifndef WITH_LEAN
int
{ if (s)
{ struct tm T;
char zone[32];
const char *t;
memset((void*)&T, 0, sizeof(T));
if (strchr(s, '-'))
t = "%d-%d-%dT%d:%d:%d%31s";
else if (strchr(s, ':'))
t = "%4d%2d%2dT%d:%d:%d%31s";
else /* parse non-XSD-standard alternative ISO 8601 format */
t = "%4d%2d%2dT%2d%2d%2d%31s";
if (T.tm_year == 1)
T.tm_year = 70;
else
T.tm_year -= 1900;
T.tm_mon--;
if (*zone)
{ if (*zone == '.')
{ for (s = zone + 1; *s; s++)
if (*s < '0' || *s > '9')
break;
}
else
s = zone;
if (*s == '+' || *s == '-')
{ int h = 0, m = 0;
if (s[3] == ':')
{ sscanf(s, "%d:%d", &h, &m);
if (h < 0)
m = -m;
}
else
{ m = (int)atol(s);
h = m / 100;
m = m % 100;
}
T.tm_hour -= h;
T.tm_min -= m;
}
T.tm_isdst = 0;
*p = soap_timegm(&T);
}
else
{ T.tm_isdst = -1;
*p = mktime(&T); /* no time zone: suppose it is localtime? */
}
}
}
#endif
/******************************************************************************/
#ifndef WITH_LEAN
time_t *
return NULL;
return NULL;
}
else if (p)
return NULL;
}
return NULL;
return p;
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
{ int i;
const char *t = NULL;
break;
t++;
|| soap_attribute(soap, "xmlns", soap->local_namespaces[i].ns ? soap->local_namespaces[i].ns : SOAP_STR_EOS)
}
else
{ t = tag;
}
}
if (p && *p)
}
if (t)
return soap_element_end_out(soap, t);
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef PALM_2
char **
return NULL;
}
if (!p)
{ if (!(p = (char**)soap_malloc(soap, sizeof(char*))))
return NULL;
}
if (!*p)
return NULL;
return NULL;
}
}
*p = NULL;
else
*p = (char*)SOAP_STR_EOS;
return NULL;
return p;
}
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_2
int
{ int i;
const char *t = NULL;
break;
t++;
|| soap_attribute(soap, "xmlns", soap->local_namespaces[i].ns ? soap->local_namespaces[i].ns : SOAP_STR_EOS)
}
else
{ t = tag;
}
}
if (p)
{ wchar_t c;
const wchar_t *s = *p;
while ((c = *s++))
{ if (soap_pututf8(soap, (unsigned long)c))
}
}
if (t)
return soap_element_end_out(soap, t);
return SOAP_OK;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_2
wchar_t **
return NULL;
}
if (!p)
{ if (!(p = (wchar_t**)soap_malloc(soap, sizeof(wchar_t*))))
return NULL;
}
if (!*p)
return NULL;
return NULL;
}
}
*p = NULL;
else
*p = (wchar_t*)SOAP_STR_EOS;
return NULL;
return p;
}
#endif
#endif
/******************************************************************************/
#ifndef PALM_2
const char *
{ register size_t i;
register soap_wchar c = 0;
return SOAP_STR_EOS;
while (soap_blank(c));
break;
*s++ = (char)c;
}
for (s--; i > 0; i--, s--)
{ if (!soap_blank(*s))
break;
}
s[1] = '\0';
soap_unget(soap, c);
#ifdef WITH_DOM
#endif
}
#endif
/******************************************************************************/
#if !defined(WITH_LEANER) || !defined(WITH_NOHTTP)
#ifndef PALM_2
int
{ int i = len;
soap_wchar c = 0;
for (;;)
{ while (--i > 0)
{ c = soap_getchar(soap);
if (c == '\r' || c == '\n')
break;
if ((int)c == EOF)
*s++ = (char)c;
}
if (c != '\n')
if (c == '\n')
{ *s = '\0';
break;
if (c != ' ' && c != '\t') /* HTTP line continuation? */
break;
}
else if ((int)c == EOF)
}
return SOAP_OK;
}
#endif
#endif
/******************************************************************************/
#ifndef PALM_1
static size_t
{
#ifndef WITH_LEANER
register struct soap_multipart *content;
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Calculating the message size with attachments, current count=%lu\n", (unsigned long)count));
count += ((((unsigned char)content->options[2] << 8) | ((unsigned char)content->options[3]))+7)&(~3);
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Size of DIME attachment content is %lu bytes\n", (unsigned long)content->size));
}
}
{ register const char *s;
/* count \r\n--boundary\r\n */
count += 6 + n;
/* count Content-Type: ...\r\n */
/* count Content-Transfer-Encoding: ...\r\n */
if (s)
/* count Content-ID: ...\r\n */
/* count Content-Location: ...\r\n */
/* count Content-Description: ...\r\n */
if (content->description)
/* count \r\n...content */
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Size of MIME attachment content is %lu bytes\n", (unsigned long)content->size));
}
/* count \r\n--boundary-- */
count += 6 + n;
}
return count;
#else
#endif
}
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_1
static int
{ if (soap_send_raw(soap, s, n))
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_1
char *
{ size_t n;
char *s = NULL;
if (option)
if (s)
{ s[0] = optype >> 8;
s[2] = n >> 8;
s[3] = n & 0xFF;
}
}
return s;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_1
int
{ unsigned char tmp[12];
optlen = (((unsigned char)soap->dime.options[2] << 8) | ((unsigned char)soap->dime.options[3])) + 4;
return SOAP_OK;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_1
int
{ struct soap_multipart *content;
return SOAP_OK;
{ void *handle;
if (soap->fdimereadopen && ((handle = soap->fdimereadopen(soap, (void*)content->ptr, content->id, content->type, content->options)) || soap->error))
if (!handle)
}
if (!size && ((soap->mode & SOAP_ENC_XML) || (soap->mode & SOAP_IO) == SOAP_IO_CHUNK || (soap->mode & SOAP_IO) == SOAP_IO_STORE))
do
}
else
if (soap_putdimehdr(soap)
break;
}
}
else
if (soap_putdimehdr(soap))
do
else
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "fdimeread failed: insufficient data (%lu bytes remaining from %lu bytes)\n", (unsigned long)size, (unsigned long)content->size));
break;
}
break;
} while (size);
}
if (soap->fdimereadclose)
}
else
if (soap_putdimehdr(soap)
}
}
return SOAP_OK;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_1
static char *
{ register soap_wchar c;
register int i;
register char *s;
char *p = NULL;
if (n)
if (p)
{ s = p;
for (i = n; i > 0; i--)
return NULL;
}
*s++ = (char)c;
}
*s = '\0';
return NULL;
}
else
}
return p;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_1
int
{ register soap_wchar c;
register char *s;
register int i;
unsigned char tmp[12];
return SOAP_OK;
}
s = (char*)tmp;
for (i = 12; i > 0; i--)
*s++ = (char)c;
}
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "DIME size=%lu flags=0x%X\n", (unsigned long)soap->dime.size, soap->dime.flags));
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "DIME id=%s, type=%s, options=%s\n", soap->dime.id?soap->dime.id:"", soap->dime.type?soap->dime.type:"", soap->dime.options?soap->dime.options+4:""));
return SOAP_OK;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_1
int
{ if (soap_getdimehdr(soap))
}
for (;;)
{ register struct soap_multipart *content;
if (soap_getdimehdr(soap))
break;
if (soap->fdimewriteopen && ((soap->dime.ptr = (char*)soap->fdimewriteopen(soap, soap->dime.id, soap->dime.type, soap->dime.options)) || soap->error))
for (;;)
for (;;)
if (size < n)
n = size;
break;
size -= n;
if (!size)
break;
}
goto end;
}
}
break;
}
break;
if (soap_getdimehdr(soap))
break;
}
end:
if (soap->fdimewriteclose)
}
register soap_wchar c;
register char *s;
register int i;
if (soap_new_block(soap))
return SOAP_EOM;
for (;;)
if (!s)
*s++ = (char)c;
}
break;
if (soap_getdimehdr(soap))
}
}
else
content = soap_new_multipart(soap, &soap->dime.first, &soap->dime.last, soap->dime.ptr, soap->dime.size);
if (!content)
}
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_1
int
{ struct soap_multipart *content;
do
}
/* remove white space */
while (soap_blank(*s))
s--;
s[1] = '\0';
}
else
}
for (;;)
register char *val;
if (!*key)
break;
if (val)
{ *val = '\0';
do val++;
}
}
return SOAP_OK;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_1
int
;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_1
void
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_1
int
return 0;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_1
struct soap_multipart *
{ register soap_wchar c = 0;
register size_t i, m = 0;
register char *s, *t = NULL;
register struct soap_multipart *content;
register short flag = 0;
return NULL;
if (!content)
{ if (soap_getmimehdr(soap))
return NULL;
}
{ if (soap->fmimewriteopen && ((content->ptr = (char*)soap->fmimewriteopen(soap, (void*)handle, content->id, content->type, content->description, content->encoding)) || soap->error))
return NULL;
}
}
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Parsing MIME content id=%s type=%s\n", content->id?content->id:"", content->type?content->type:""));
return NULL;
}
for (;;)
return NULL;
}
{ if (m > 0)
{ *s++ = *t++;
m--;
}
else
{ if (!flag)
if ((int)c == EOF)
return NULL;
}
}
if (flag || c == '\r')
strcpy(t, "\n--");
do c = soap_getchar(soap);
while (c == *t++);
if ((int)c == EOF)
return NULL;
}
if (!*--t)
goto end;
*t = (char)c;
flag = (c == '\r');
c = '\r';
}
*s++ = (char)c;
}
}
break;
}
}
end:
*s = '\0'; /* force 0-terminated */
if (soap->fmimewriteclose)
return NULL;
}
else
}
return NULL;
}
else
c = soap_getchar(soap);
return NULL;
}
if (soap_getmimehdr(soap))
return NULL;
}
return content;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_1
int
{ register size_t n;
if (!s)
return 1;
if (!strcmp(s, t))
return 0;
s += 4;
n = strlen(t);
if (*t == '<')
{ t++;
n -= 2;
}
if (!strncmp(s, t, n) && !s[n])
return 0;
return 0;
return 1;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_1
static void
while (*xp)
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Found matching attachment %s for content id=%s\n", xq->id, content->id));
else
}
else
}
}
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_1
int
{ const char *s;
if (content->description && soap_send3(soap, "Content-Description: ", content->description, "\r\n"))
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_1
int
{ struct soap_multipart *content;
return SOAP_OK;
{ void *handle;
if (soap->fmimereadopen && ((handle = soap->fmimereadopen(soap, (void*)content->ptr, content->id, content->type, content->description)) || soap->error))
if (!handle)
}
if (!size)
{ if ((soap->mode & SOAP_ENC_XML) || (soap->mode & SOAP_IO) == SOAP_IO_CHUNK || (soap->mode & SOAP_IO) == SOAP_IO_STORE)
do
break;
} while (size);
}
else
}
}
else
{ do
else
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "fmimeread failed: insufficient data (%lu bytes remaining from %lu bytes)\n", (unsigned long)size, (unsigned long)content->size));
break;
}
break;
} while (size);
}
if (soap->fmimereadclose)
}
else
}
}
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_1
void
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_1
void
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_1
void
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_1
void
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_1
static struct soap_multipart*
soap_new_multipart(struct soap *soap, struct soap_multipart **first, struct soap_multipart **last, char *ptr, size_t size)
{ struct soap_multipart *content;
if (content)
if (!*first)
if (*last)
}
return content;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_1
int
soap_set_dime_attachment(struct soap *soap, char *ptr, size_t size, const char *type, const char *id, unsigned short optype, const char *option)
{ struct soap_multipart *content = soap_new_multipart(soap, &soap->dime.first, &soap->dime.last, ptr, size);
if (!content)
return SOAP_EOM;
return SOAP_OK;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_1
int
soap_set_mime_attachment(struct soap *soap, char *ptr, size_t size, enum soap_mime_encoding encoding, const char *type, const char *id, const char *location, const char *description)
{ struct soap_multipart *content = soap_new_multipart(soap, &soap->mime.first, &soap->mime.last, ptr, size);
if (!content)
return SOAP_EOM;
return SOAP_OK;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_1
struct soap_multipart*
{ if (content)
return NULL;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_1
static void
register size_t n = 0;
if (s)
n = strlen(s);
if (n < 16)
{ n = 64;
if (!s)
return;
}
strcpy(s, "==");
s += 2;
n -= 4;
while (n)
n--;
}
strcpy(s, "==");
}
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_LEANER
#ifndef PALM_1
static int
{ register struct soap_multipart *content;
register size_t k;
return SOAP_OK;
register size_t i;
return SOAP_ERR;
}
}
}
return SOAP_OK;
}
#endif
#endif
/******************************************************************************\
*
* HTTP cookie handling
*
\******************************************************************************/
#ifdef WITH_COOKIES
/******************************************************************************/
{ register int c;
while ((c = *s++) && --n > 0)
*t++ = c;
else if (n > 2)
{ *t++ = '%';
*t++ = (c >> 4) + (c > 159 ? '7' : '0');
c &= 0xF;
*t++ = c + (c > 9 ? '7' : '0');
n -= 2;
}
else
break;
}
*t = '\0';
return len - n;
}
/******************************************************************************/
struct soap_cookie*
{ struct soap_cookie *p;
size_t n;
if (!domain)
if (!path)
if (!path)
path = SOAP_STR_EOS;
else if (*path == '/')
path++;
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Search cookie %s domain=%s path=%s\n", name, domain?domain:"(null)", path?path:"(null)"));
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Cookie in database: %s=%s domain=%s path=%s env=%hd\n", p->name, p->value?p->value:"(null)", p->domain?p->domain:"(null)", p->path?p->path:"(null)", p->env));
&& p->domain
&& p->path
break;
}
return p;
}
/******************************************************************************/
struct soap_cookie*
soap_set_cookie(struct soap *soap, const char *name, const char *value, const char *domain, const char *path)
{ struct soap_cookie **p, *q;
int n;
if (!domain)
if (!path)
if (!path)
path = SOAP_STR_EOS;
else if (*path == '/')
path++;
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set %scookie: %s=%s domain=%s path=%s\n", q ? "" : "new ", name, value?value:"(null)", domain?domain:"(null)", path?path:"(null)"));
if (!q)
q->expire = 0;
q->maxage = -1;
q->version = 1;
q->secure = 0;
q->modified = 0;
break;
if (n)
{ q->next = *p;
*p = q;
}
else
q = NULL;
}
}
}
else
q->modified = 1;
if (q)
{ if (q->value)
}
if (q->domain)
}
if (q->path)
}
q->session = 1;
q->env = 0;
}
return q;
}
/******************************************************************************/
void
{ struct soap_cookie **p, *q;
if (!domain)
if (!domain)
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Error in clear cookie %s: cookie domain not set\n", name?name:"(null)"));
return;
}
if (!path)
if (!path)
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Error in clear cookie %s: cookie path not set\n", name?name:"(null)"));
return;
}
if (*path == '/')
path++;
{ if (!strcmp(q->name, name) && !strcmp(q->domain, domain) && !strncmp(q->path, path, strlen(q->path)))
{ if (q->value)
if (q->domain)
if (q->path)
*p = q->next;
}
else
p = &q->next;
}
}
/******************************************************************************/
char *
{ struct soap_cookie *p;
return p->value;
return NULL;
}
/******************************************************************************/
char *
{ struct soap_cookie *p;
return p->value;
return NULL;
}
/******************************************************************************/
{ struct soap_cookie *p;
return p->expire;
return -1;
}
/******************************************************************************/
int
soap_set_cookie_expire(struct soap *soap, const char *name, long expire, const char *domain, const char *path)
{ struct soap_cookie *p;
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set cookie expiration max-age %ld: %s domain=%s path=%s\n", expire, name, domain?domain:"(null)", path?path:"(null)"));
p->modified = 1;
return SOAP_OK;
}
return SOAP_ERR;
}
/******************************************************************************/
int
{ struct soap_cookie *p;
{ p->session = 1;
p->modified = 1;
return SOAP_OK;
}
return SOAP_ERR;
}
/******************************************************************************/
int
{ struct soap_cookie *p;
{ p->session = 0;
p->modified = 1;
return SOAP_OK;
}
return SOAP_ERR;
}
/******************************************************************************/
int
{ struct soap_cookie *p;
char *s, tmp[4096];
const char *t;
{
if (p->modified
#ifdef WITH_OPENSSL
#endif
)
{ s = tmp;
if (p->name)
{ *s++ = '=';
}
{ strcpy(s, ";Domain=");
}
{ strcpy(s, ";Domain=");
}
strcat(s, ";Path=/");
s += strlen(s);
if (p->path)
t = p->path;
else
t = soap->cookie_path;
if (t)
{ if (*t == '/')
t++;
{ strcpy(s, t);
s += strlen(s);
}
else
}
}
s += strlen(s);
}
s += strlen(s);
}
if (s-tmp < 4073
&& (p->secure
#ifdef WITH_OPENSSL
#endif
))
strcpy(s, ";Secure");
}
}
return SOAP_OK;
}
/******************************************************************************/
int
{ struct soap_cookie **p, *q;
unsigned int version = 0;
char *s, tmp[4096];
if (*path == '/')
path++;
while ((q = *p))
if (q->value)
if (q->domain)
if (q->path)
*p = q->next;
}
else
{ int flag;
char *t = q->domain;
size_t n = 0;
if (!t)
flag = 1;
else
{ const char *r = strchr(t, ':');
if (r)
n = r - t;
else
n = strlen(t);
}
/* domain-level cookies */
if (!flag)
if (hostent)
if (!r)
}
}
if (flag
{ s = tmp;
}
if (q->name)
{ *s++ = '=';
}
s += strlen(s);
}
}
p = &q->next;
}
}
return SOAP_OK;
}
/******************************************************************************/
void
{ struct soap_cookie *p = NULL, *q;
const char *s;
unsigned int version = 0;
if (!val)
return;
s = val;
while (*s)
{ if (p)
else
}
}
if (*tmp)
}
else
t = NULL;
if (p)
{ if (p->path)
p->path = t;
}
else
{ if (path)
path = t;
}
}
if (*tmp)
}
else
t = NULL;
if (p)
{ if (p->domain)
p->domain = t;
}
else
{ if (domain)
domain = t;
}
}
{ if (p->path)
if (*tmp)
}
else
}
{ if (p->domain)
if (*tmp)
}
else
}
}
}
{ struct tm T;
char a[3];
static const char mns[] = "anebarprayunulugepctovec";
{ memset((void*)&T, 0, sizeof(T));
a[0] = tmp[4];
a[2] = '\0';
a[0] = tmp[8];
a[0] = tmp[11];
a[0] = tmp[13];
a[0] = tmp[16];
a[0] = tmp[19];
p->expire = soap_timegm(&T);
}
}
p->secure = 1;
else
{ if (p)
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Got environment cookie %s=%s domain=%s path=%s expire=%ld secure=%d\n", p->name, p->value?p->value:"(null)", p->domain?p->domain:"(null)", p->path?p->path:"(null)", p->expire, p->secure));
q->env = 1;
}
if (p->name)
if (p->value)
if (p->domain)
if (p->path)
}
if (*tmp)
}
else
if (domain)
}
else
if (path)
}
else
}
p->expire = 0;
p->secure = 0;
}
}
}
if (p)
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Got environment cookie %s=%s domain=%s path=%s expire=%ld secure=%d\n", p->name, p->value?p->value:"(null)", p->domain?p->domain:"(null)", p->path?p->path:"(null)", p->expire, p->secure));
q->env = 1;
}
if (p->name)
if (p->value)
if (p->domain)
if (p->path)
}
if (domain)
if (path)
}
/******************************************************************************/
int
{ struct soap_cookie *p;
const char *s;
if (!(s = getenv("HTTP_COOKIE")))
return SOAP_ERR;
do
if (p)
p->env = 1;
} while (*s);
return SOAP_OK;
}
/******************************************************************************/
struct soap_cookie*
{ struct soap_cookie *p, **q, *r;
q = &r;
return r;
**q = *p;
if (p->name)
}
if (p->value)
}
if (p->domain)
}
if (p->path)
}
q = &(*q)->next;
}
*q = NULL;
return r;
}
/******************************************************************************/
void
{ struct soap_cookie *p;
if (p->value)
if (p->domain)
if (p->path)
}
}
/******************************************************************************/
#endif /* WITH_COOKIES */
/******************************************************************************/
#ifdef WITH_GZIP
#ifndef PALM_1
static int
{ int i;
soap_wchar c = 0, f = 0;
for (i = 0; i < 9; i++)
if (i == 2)
f = c;
}
if (f & 0x04) /* FEXTRA */
}
}
if (f & 0x08) /* FNAME */
{ do
while (c && (int)c != EOF);
}
{ do
while (c && (int)c != EOF);
}
}
if ((int)c == EOF)
return SOAP_OK;
}
#endif
#endif
/******************************************************************************/
#ifndef PALM_1
int
{ soap_wchar c;
#ifndef WITH_NOIDREF
#endif
if (!soap->keep_alive)
}
soap->keep_alive = 0;
#ifndef WITH_LEANER
#endif
#ifdef WIN32
#ifndef UNDER_CE
#ifndef WITH_FASTCGI
#ifdef __BORLANDC__
#else
#endif
#endif
#endif
#endif
#ifdef WITH_ZLIB
#endif
#ifndef WITH_LEANER
if (soap->fprepareinit)
#endif
c = soap_getchar(soap);
#ifdef WITH_GZIP
if (c == 0x1F)
{ if (soap_getgziphdr(soap))
/* should not chunk over plain transport, so why bother to check? */
/* if ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK) */
/* soap->z_buflen = soap->bufidx; */
/* else */
c = soap_getchar(soap);
}
#endif
#ifndef WITH_LEANER
else
#endif
{ while (soap_blank(c))
c = soap_getchar(soap);
}
if ((int)c == EOF)
soap_unget(soap, c);
#ifndef WITH_NOHTTP
}
}
#ifndef WITH_LEANER
#endif
/* Note: fparse should not use soap_unget to push back last char */
}
#ifdef WITH_ZLIB
#ifdef WITH_GZIP
if (c == 0x1F)
{ if (soap_getgziphdr(soap))
}
else
{ soap_revget1(soap);
#else
{
#endif
}
}
#endif
}
}
}
#endif
#ifndef WITH_LEANER
{ if (soap_getmimehdr(soap))
{ do
break;
break;
}
}
{ if (soap_getdimehdr(soap))
}
else
}
}
#endif
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef WITH_NOHTTP
#ifndef PALM_1
static int
{ char header[SOAP_HDRLEN], *s;
do
for (;;)
break;
}
}
if (!*header)
break;
if (s)
{ *s = '\0';
do s++;
while (*s && *s <= 32);
}
}
}
{ k = (unsigned short)soap_strtoul(s, &s, 10);
if (!soap_blank(*s))
k = 0;
}
else
k = 0;
} while (k == 100);
if (s && s[7] != '1')
soap->keep_alive = 0;
}
}
if (soap->keep_alive < 0)
if (m > n)
m = n;
if (get)
}
if (status)
}
if (k == 0 || k == 200 || (((k > 200 && k <= 299) || k == 400 || k == 500) && ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK || soap->length > 0)))
return SOAP_OK;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOHTTP
#ifndef PALM_1
static int
{
#ifdef WITH_OPENSSL
else
#endif
}
#ifndef WITH_LEANER
}
}
#endif
#ifdef WITH_ZLIB
#else
return SOAP_ZLIB_ERROR;
#endif
#ifdef WITH_GZIP
#else
return SOAP_ZLIB_ERROR;
#endif
}
#ifdef WITH_ZLIB
{
#ifdef WITH_GZIP
else
#endif
else
}
#endif
}
soap->keep_alive = 0;
}
#ifndef WITH_LEAN
{ int n;
char *s;
{ *s = '\0';
}
}
}
}
}
#endif
{ if (*val == '"')
}
}
}
#ifdef WITH_COOKIES
#endif
return SOAP_OK;
}
#endif
#endif
/******************************************************************************/
#if !defined(WITH_NOHTTP) || !defined(WITH_LEANER)
#ifndef PALM_1
const char*
{ register const char *s = line;
if (s)
{ while (*s)
{ register short flag;
if (!flag)
}
}
return NULL;
}
#endif
#endif
/******************************************************************************/
#if !defined(WITH_NOHTTP) || !defined(WITH_LEANER)
#ifndef PALM_1
const char*
}
#endif
#endif
/******************************************************************************/
#if !defined(WITH_NOHTTP) || !defined(WITH_LEANER)
#ifndef PALM_1
const char*
{ if (*val != '=')
{ *buf = '\0';
return val;
}
}
#endif
#endif
/******************************************************************************/
#if !defined(WITH_NOHTTP) || !defined(WITH_LEANER)
#ifndef PALM_1
static const char*
{ const char *s;
char *t = buf;
for (s = val; *s; s++)
break;
if (*s == '"')
{ s++;
while (*s && *s != '"' && --len)
*t++ = *s++;
}
else
{ if (*s == '%')
{ *t++ = ((s[1] >= 'A' ? (s[1] & 0x7) + 9 : s[1] - '0') << 4)
+ (s[2] >= 'A' ? (s[2] & 0x7) + 9 : s[2] - '0');
s += 3;
}
else
*t++ = *s++;
}
}
*t = '\0';
s++;
return s;
}
#endif
#endif
/******************************************************************************/
#ifndef PALM_2
int
{
#ifndef WITH_LEANER
size_t n = 0;
if ((soap->mode & SOAP_ENC_MIME) && soap->mime.boundary && soap->mime.start && strlen(soap->mime.boundary) + strlen(soap->mime.start) < sizeof(soap->tmpbuf) - 80 )
{ const char *s;
s = "application/dime";
s = "application/xop+xml; charset=utf-8; type=application/soap+xml";
else
s = "application/soap+xml; charset=utf-8";
}
else
sprintf(soap->tmpbuf, "--%s\r\nContent-Type: %s\r\nContent-Transfer-Encoding: binary\r\nContent-ID: %s\r\n\r\n", soap->mime.boundary, s, soap->mime.start);
}
{ if (soap_putdimehdr(soap))
}
#endif
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
#ifndef WITH_LEANER
if (soap->local_namespaces)
else
}
soap->count += 12 + ((strlen(soap->dime.id)+3)&(~3)) + (soap->dime.type ? ((strlen(soap->dime.type)+3)&(~3)) : 0);
}
#endif
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef PALM_1
int
{ register struct Namespace *p;
{
#ifndef WITH_LEAN
{ /* get HTML from buffer, stop receiving to avoid HTML parsing issues */
char *s;
#ifndef WITH_NOIO
#endif
#ifndef WITH_NOIO
#endif
}
#endif
}
p = soap->local_namespaces;
if (p)
if (!ns)
if (p[1].out)
}
if (p[1].out)
}
}
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef PALM_1
int
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
#ifndef WITH_LEAN
#endif
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
}
#endif
/******************************************************************************/
#ifndef PALM_1
void
{ register const char *s;
register size_t i, n;
return;
#ifdef WITH_OPENSSL
#endif
if (s && s[1] == '/' && s[2] == '/')
s += 3;
else
s = endpoint;
n = strlen(s);
#ifdef WITH_IPV6
if (s[0] == '[')
{ s++;
for (i = 0; i < n; i++)
if (s[i] == ']')
{ s++;
break;
}
}
}
else
{ for (i = 0; i < n; i++)
if (s[i] == '/' || s[i] == ':')
break;
}
}
#else
for (i = 0; i < n; i++)
if (s[i] == '/' || s[i] == ':')
break;
}
#endif
if (s[i] == ':')
for (i++; i < n; i++)
if (s[i] == '/')
break;
}
if (s[i])
}
}
#endif
/******************************************************************************/
#ifndef PALM_1
int
}
#endif
/******************************************************************************/
#ifndef PALM_1
int
int port;
#ifndef WITH_LEANER
}
else
#endif
if (!soap->keep_alive || !soap_valid_socket(soap->socket) || strcmp(soap->host, host) || soap->port != port || !soap->fpoll || soap->fpoll(soap))
DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Connect/reconnect to host='%s' path='%s' port=%d\n", soap->host, soap->path, soap->port));
#ifdef WITH_UDP
#endif
}
}
if (soap_begin_send(soap))
if (http_command != SOAP_POST)
}
#ifndef WITH_NOHTTP
if ((k & SOAP_IO) != SOAP_IO_FLUSH)
#ifndef WITH_LEANER
if ((k & SOAP_IO) == SOAP_IO_CHUNK)
{ if (soap_flush(soap))
}
#endif
}
if (http_command != SOAP_POST)
return soap_end_send(soap);
#endif
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef WITH_LEAN
char*
{ register int i;
register unsigned long m;
register char *p;
if (!t)
if (!t)
return NULL;
}
p = t;
t[0] = '\0';
if (!s)
return p;
for (; n > 2; n -= 3, s += 3)
{ m = s[0];
m = (m << 8) | s[1];
m = (m << 8) | s[2];
for (i = 4; i > 0; m >>= 6)
t[--i] = soap_base64o[m & 0x3F];
t += 4;
}
t[0] = '\0';
if (n > 0)
{ m = 0;
for (i = 0; i < n; i++)
m = (m << 8) | *s++;
for (; i < 3; i++)
m <<= 8;
for (i++; i > 0; m >>= 6)
t[--i] = soap_base64o[m & 0x3F];
for (i = 3; i > n; i--)
t[i] = '=';
t[4] = '\0';
}
return p;
}
#endif
/******************************************************************************/
#ifndef WITH_LEAN
const char*
{ register int i, j, c;
register unsigned long m;
register const char *p;
if (!s || !*s)
{ if (n)
*n = 0;
return NULL;
return SOAP_NON_NULL;
}
if (!t)
t = (char*)soap_malloc(soap, l);
}
if (!t)
return NULL;
}
p = t;
if (n)
*n = 0;
for (;;)
{ for (i = 0; i < SOAP_BLKLEN; i++)
{ m = 0;
j = 0;
while (j < 4)
{ c = *s++;
if (c == '=' || !c)
{ i *= 3;
switch (j)
{ case 2:
*t++ = (char)((m >> 4) & 0xFF);
i++;
break;
case 3:
*t++ = (char)((m >> 10) & 0xFF);
*t++ = (char)((m >> 2) & 0xFF);
i += 2;
}
if (n)
*n += i;
return p;
}
c -= '+';
if (c >= 0 && c <= 79)
{ int b = soap_base64i[c];
if (b >= 64)
return NULL;
}
m = (m << 6) + b;
j++;
}
else if (!soap_blank(c + '+'))
return NULL;
}
}
*t++ = (char)((m >> 16) & 0xFF);
*t++ = (char)((m >> 8) & 0xFF);
*t++ = (char)(m & 0xFF);
if (l < 3)
{ if (n)
*n += i;
return p;
}
l -= 3;
}
if (n)
*n += 3 * SOAP_BLKLEN;
}
}
#endif
/******************************************************************************/
#ifndef WITH_LEAN
char*
{ register char *p;
if (!t)
if (!t)
return NULL;
}
p = t;
t[0] = '\0';
if (s)
{ for (; n > 0; n--)
{ register int m = *s++;
*t++ = (char)((m >> 4) + (m > 159 ? 'a' - 10 : '0'));
m &= 0x0F;
*t++ = (char)(m + (m > 9 ? 'a' - 10 : '0'));
}
}
*t++ = '\0';
return p;
}
#endif
/******************************************************************************/
#ifndef WITH_LEAN
const char*
{ register const char *p;
if (!s || !*s)
{ if (n)
*n = 0;
return NULL;
return SOAP_NON_NULL;
}
if (!t)
{ l = strlen(s) / 2;
t = (char*)soap_malloc(soap, l);
}
if (!t)
return NULL;
}
p = t;
while (l)
d1 = *s++;
if (!d1)
break;
d2 = *s++;
if (!d2)
break;
l--;
}
if (n)
*n = t - p;
return p;
}
#endif
/******************************************************************************/
#ifndef WITH_NOHTTP
#ifndef PALM_1
int
#ifndef WITH_LEANER
register const char *r = NULL;
#endif
s = soap->http_content;
s = "application/soap+xml; charset=utf-8";
}
#ifndef WITH_LEANER
{ r = s;
s = "application/xop+xml; charset=utf-8";
}
else
s = "application/dime";
}
if ((soap->mode & SOAP_ENC_MIME) && soap->mime.boundary && strlen(soap->mime.boundary) + strlen(soap->mime.start ? soap->mime.start : SOAP_STR_EOS) < sizeof(soap->tmpbuf) - 80)
{ register const char *t = strchr(s, ';');
if (t)
else
}
if (r)
}
}
#endif
return err;
#ifdef WITH_ZLIB
{ err = soap->fposthdr(soap, "Content-Encoding", soap->zlib_out == SOAP_ZLIB_GZIP ? "gzip" : "deflate");
if (err)
return err;
}
#endif
#ifndef WITH_LEANER
else
#endif
if (s)
}
if (err)
return err;
}
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOHTTP
#ifndef PALM_1
static int
{ return SOAP_GET_METHOD;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOHTTP
#ifndef PALM_1
static int
http_post(struct soap *soap, const char *endpoint, const char *host, int port, const char *path, const char *action, size_t count)
{ register const char *s;
register int err;
s = "GET";
else
s = "POST";
#ifdef PALM
if (!endpoint || (soap_tag_cmp(endpoint, "http:*") && soap_tag_cmp(endpoint, "https:*") && strncmp(endpoint, "httpg:", 6)) && strncmp(endpoint, "_beam:", 6) && strncmp(endpoint, "_local:", 7) && strncmp(endpoint, "_btobex:", 8))
#else
if (!endpoint || (soap_tag_cmp(endpoint, "http:*") && soap_tag_cmp(endpoint, "https:*") && strncmp(endpoint, "httpg:", 6)))
#endif
return SOAP_OK;
else
return err;
if (port != 80)
else
return err;
#ifdef WITH_ZLIB
#ifdef WITH_GZIP
#else
#endif
return err;
#endif
#ifndef WITH_LEAN
soap_s2base64(soap, (const unsigned char*)(soap->tmpbuf + 262), soap->tmpbuf + 6, strlen(soap->tmpbuf + 262));
return err;
}
if (soap->proxy_userid && soap->proxy_passwd && strlen(soap->proxy_userid) + strlen(soap->proxy_passwd) < 761)
soap_s2base64(soap, (const unsigned char*)(soap->tmpbuf + 262), soap->tmpbuf + 6, strlen(soap->tmpbuf + 262));
return err;
}
#endif
#ifdef WITH_COOKIES
#ifdef WITH_OPENSSL
#else
#endif
#endif
if (soap->status != SOAP_GET && (soap->version == 1 || (action && *action && strlen(action) < sizeof(soap->tmpbuf) - 2)))
return err;
}
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOHTTP
#ifndef PALM_1
static int
{ register const char *t;
do
if (!t)
t = s + strlen(s);
if (soap_send_raw(soap, s, t - s))
s = t + 1;
} while (*t);
return SOAP_OK;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOHTTP
#ifndef PALM_1
static int
{ if (key)
}
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOHTTP
#ifndef PALM_1
static int
{ register int err;
#ifdef WMW_RPM_IO
#endif
{ const char *s;
s = "200 OK";
else
s = "202 ACCEPTED";
#ifdef WMW_RPM_IO
if (soap->rpmreqid || soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) /* RPM behaves as if standalone */
#else
if (soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) /* standalone application */
#endif
return err;
}
return err;
}
return err;
#ifndef WITH_LEAN
if (status == 401)
{ sprintf(soap->tmpbuf, "Basic realm=\"%s\"", strlen(soap->authrealm) < sizeof(soap->tmpbuf) - 14 ? soap->authrealm : "gSOAP Web Service");
return err;
}
return err;
}
#endif
}
else
{ const char *s = *soap_faultcode(soap);
s = "400 Bad Request";
else
s = "500 Internal Server Error";
#ifdef WMW_RPM_IO
if (soap->rpmreqid || soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) /* RPM behaves as if standalone */
#else
if (soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) /* standalone application */
#endif
return err;
}
return err;
}
return err;
#ifdef WITH_COOKIES
if (soap_putsetcookies(soap))
#endif
}
#endif
#endif
/******************************************************************************/
#ifndef PALM_1
int
}
if (soap_begin_send(soap))
#ifndef WITH_NOHTTP
if ((n & SOAP_IO) != SOAP_IO_FLUSH)
#ifndef WITH_LEANER
if ((n & SOAP_IO) == SOAP_IO_CHUNK)
{ if (soap_flush(soap))
}
#endif
}
#endif
return SOAP_OK;
}
#endif
/******************************************************************************/
#ifndef WITH_LEAN
static const char*
sprintf(soap->msgbuf, "Validation constraint violation: %s%s in element <%s>", s, t?t:SOAP_STR_EOS, soap->tag);
else
}
#endif
/******************************************************************************/
#ifndef PALM_1
void
{ const char **c = soap_faultcode(soap);
const char **s = soap_faultstring(soap);
if (!*c)
*c = "SOAP-ENV:Sender";
else
*c = "SOAP-ENV:Client";
}
if (*s)
return;
{
#ifndef WITH_LEAN
case SOAP_CLI_FAULT:
*s = "Client fault";
break;
case SOAP_SVR_FAULT:
*s = "Server fault";
break;
case SOAP_TAG_MISMATCH:
break;
case SOAP_TYPE:
break;
case SOAP_SYNTAX_ERROR:
*s = "Well-formedness violation";
break;
case SOAP_NO_TAG:
*s = "No XML element tag";
break;
case SOAP_MUSTUNDERSTAND:
*c = "SOAP-ENV:MustUnderstand";
sprintf(soap->msgbuf, "The data in element '%s' must be understood but cannot be handled", soap->tag);
break;
case SOAP_VERSIONMISMATCH:
*c = "SOAP-ENV:VersionMismatch";
*s = "SOAP version mismatch or invalid SOAP message";
break;
case SOAP_DATAENCODINGUNKNOWN:
*c = "SOAP-ENV:DataEncodingUnknown";
*s = "Unsupported SOAP data encoding";
break;
case SOAP_NAMESPACE:
break;
case SOAP_USER_ERROR:
*s = "User error";
break;
case SOAP_FATAL_ERROR:
*s = "Fatal error";
break;
case SOAP_NO_METHOD:
sprintf(soap->msgbuf, "Method '%s' not implemented: method name or namespace not recognized", soap->tag);
break;
case SOAP_NO_DATA:
*s = "Data required for operation";
break;
case SOAP_GET_METHOD:
*s = "HTTP GET method not implemented";
break;
case SOAP_EOM:
*s = "Out of memory";
break;
case SOAP_MOE:
*s = "Memory overflow or memory corruption error";
break;
case SOAP_IOB:
*s = "Array index out of bounds";
break;
case SOAP_NULL:
break;
case SOAP_DUPLICATE_ID:
break;
case SOAP_MISSING_ID:
break;
case SOAP_HREF:
break;
case SOAP_FAULT:
break;
#ifndef WITH_NOIO
case SOAP_UDP_ERROR:
*s = "Message too large for UDP packet";
break;
case SOAP_TCP_ERROR:
break;
#endif
case SOAP_HTTP_ERROR:
*s = "An HTTP processing error occurred";
break;
case SOAP_SSL_ERROR:
#ifdef WITH_OPENSSL
*s = "SSL error";
#else
*s = "OpenSSL not installed: recompile with -DWITH_OPENSSL";
#endif
break;
case SOAP_PLUGIN_ERROR:
*s = "Plugin registry error";
break;
case SOAP_DIME_ERROR:
*s = "DIME format error";
break;
case SOAP_DIME_HREF:
*s = "DIME href to missing attachment";
break;
case SOAP_DIME_MISMATCH:
*s = "DIME version/transmission error";
break;
case SOAP_DIME_END:
*s = "End of DIME error";
break;
case SOAP_MIME_ERROR:
*s = "MIME format error";
break;
case SOAP_MIME_HREF:
*s = "MIME href to missing attachment";
break;
case SOAP_MIME_END:
*s = "End of MIME error";
break;
case SOAP_ZLIB_ERROR:
#ifdef WITH_ZLIB
#else
#endif
break;
case SOAP_REQUIRED:
break;
case SOAP_PROHIBITED:
break;
case SOAP_OCCURS:
break;
case SOAP_LENGTH:
break;
case SOAP_FD_EXCEEDED:
*s = "Maximum number of open connections was reached";
break;
case SOAP_STOP:
*s = "Stopped: no response sent";
break;
#endif
case SOAP_EOF:
#ifndef WITH_NOIO
#ifndef WITH_LEAN
}
#endif
break;
#else
*s = "End of file or no input";
break;
#endif
default:
#ifndef WITH_NOHTTP
#ifndef WITH_LEAN
}
else
#endif
#endif
}
}
}
#endif
/******************************************************************************/
#ifndef PALM_1
int
int r = 1;
return status;
#ifndef WITH_NOIO
#ifndef WITH_LEAN
if (r > 0)
r = 0;
}
}
#endif
#endif
}
|| soap_putheader(soap)
|| soap_putfault(soap)
return soap_closesock(soap);
}
return soap_closesock(soap);
}
#endif
/******************************************************************************/
#ifndef PALM_1
int
if (soap_getfault(soap))
{ DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Error: soap_get_soapfault() failed. Is this a SOAP message at all?\n"));
}
else
{ register const char *s = *soap_faultcode(soap);
else if (!soap_match_tag(soap, s, "SOAP-ENV:Client") || !soap_match_tag(soap, s, "SOAP-ENV:Sender"))
else
status = SOAP_FAULT;
}
if (soap_body_end_in(soap)
|| soap_end_recv(soap))
return soap_closesock(soap);
}
return soap_closesock(soap);
}
#endif
/******************************************************************************/
#ifndef WITH_NOHTTP
#ifndef PALM_1
int
if ((m & SOAP_IO) == SOAP_IO_CHUNK)
}
return soap_closesock(soap);
}
return SOAP_OK;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOHTTP
#ifndef PALM_1
int
return soap_closesock(soap);
}
return SOAP_OK;
}
#endif
#endif
/******************************************************************************/
#ifndef WITH_NOIO
#ifndef PALM_1
static const char*
if (err)
{
#ifndef WIN32
#else
#ifndef UNDER_CE
len = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)soap->msgbuf, (DWORD)sizeof(soap->msgbuf), NULL);
#else
len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, err, 0, (LPTSTR)soap->msgbuf, (DWORD)(sizeof(soap->msgbuf)/sizeof(TCHAR)), NULL);
for (i = 0; i <= len; i++)
else
}
#endif
#endif
}
return "Operation interrupted or timed out";
}
#endif
#endif
/******************************************************************************/
#ifndef PALM_2
static int
soap_set_error(struct soap *soap, const char *faultcode, const char *faultsubcode, const char *faultstring, const char *faultdetail, int soaperror)
if (faultsubcode)
if (faultdetail && *faultdetail)
{ register const char **s = soap_faultdetail(soap);
if (s)
*s = faultdetail;
}
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
soap_set_sender_error(struct soap *soap, const char *faultstring, const char *faultdetail, int soaperror)
{ return soap_set_error(soap, soap->version == 2 ? "SOAP-ENV:Sender" : "SOAP-ENV:Client", NULL, faultstring, faultdetail, soaperror);
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
soap_set_receiver_error(struct soap *soap, const char *faultstring, const char *faultdetail, int soaperror)
{ return soap_set_error(soap, soap->version == 2 ? "SOAP-ENV:Receiver" : "SOAP-ENV:Server", NULL, faultstring, faultdetail, soaperror);
}
#endif
/******************************************************************************/
#ifndef PALM_2
static int
soap_copy_fault(struct soap *soap, const char *faultcode, const char *faultsubcode, const char *faultstring, const char *faultdetail)
if (faultsubcode)
if (faultstring)
if (faultdetail)
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
soap_sender_fault_subcode(struct soap *soap, const char *faultsubcode, const char *faultstring, const char *faultdetail)
{ return soap_copy_fault(soap, soap->version == 2 ? "SOAP-ENV:Sender" : "SOAP-ENV:Client", faultsubcode, faultstring, faultdetail);
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
}
#endif
/******************************************************************************/
#ifndef PALM_2
int
soap_receiver_fault_subcode(struct soap *soap, const char *faultsubcode, const char *faultstring, const char *faultdetail)
{ return soap_copy_fault(soap, soap->version == 2 ? "SOAP-ENV:Receiver" : "SOAP-ENV:Server", faultsubcode, faultstring, faultdetail);
}
#endif
/******************************************************************************/
#ifndef PALM_2
#ifndef WITH_NOSTDLIB
void
{ if (soap_check_state(soap))
{ const char *c, *v = NULL, *s, **d;
d = soap_faultcode(soap);
if (!*d)
c = *d;
v = *soap_faultsubcode(soap);
s = *soap_faultstring(soap);
d = soap_faultdetail(soap);
fprintf(fd, "%s%d fault: %s [%s]\n\"%s\"\nDetail: %s\n", soap->version ? "SOAP 1." : "Error ", soap->version ? (int)soap->version : soap->error, c, v ? v : "no subcode", s ? s : "[no reason]", d && *d ? *d : "[no detail]");
}
}
#endif
#endif
/******************************************************************************/
#ifndef PALM_1
#ifndef WITH_NOSTDLIB
void
{
#ifndef WITH_LEAN
if (i <= 0)
i = 0;
j = i + 1023;
else
}
#endif
}
#endif
#endif
/******************************************************************************/
#ifndef PALM_1
int
soap_register_plugin_arg(struct soap *soap, int (*fcreate)(struct soap*, struct soap_plugin*, void*), void *arg)
{ register struct soap_plugin *p;
register int r;
if (!r && p->fdelete)
return SOAP_OK;
}
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not register plugin '%s': plugin returned error %d (or fdelete callback not set)\n", p->id?p->id:"?", r));
return r;
}
#endif
/******************************************************************************/
#ifndef PALM_1
static void *
{ register struct soap_plugin *p;
return p->data;
return NULL;
}
#endif
/******************************************************************************/
#ifndef PALM_2
void *
}
#endif
/******************************************************************************/
#ifdef __cplusplus
}
#endif
/******************************************************************************\
*
* C++ soap struct methods
*
\******************************************************************************/
#ifdef __cplusplus
#ifndef WITH_LEAN
{ soap_init(this);
}
#endif
#endif
/******************************************************************************/
#ifdef __cplusplus
#ifndef WITH_LEAN
{ soap_init1(this, m);
}
#endif
#endif
/******************************************************************************/
#ifdef __cplusplus
#ifndef WITH_LEAN
}
#endif
#endif
/******************************************************************************/
#ifdef __cplusplus
#ifndef WITH_LEAN
{ soap_copy_context(this, &soap);
}
#endif
#endif
/******************************************************************************/
#ifdef __cplusplus
#ifndef WITH_LEAN
{ soap_destroy(this);
soap_end(this);
soap_done(this);
}
#endif
#endif
/******************************************************************************/