⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stdsoap2.c

📁 linux下简单对象应用协议的开发库
💻 C
📖 第 1 页 / 共 5 页
字号:
/*stdsoap2.c[pp] 2.7.9lgSOAP runtimegSOAP XML Web services toolsCopyright (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 theLicense. You may obtain a copy of the License athttp://www.cs.fsu.edu/~engelen/soaplicense.htmlSoftware distributed under the License is distributed on an "AS IS" basis,WITHOUT WARRANTY OF ANY KIND, either express or implied. See the Licensefor 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.This program is free software; you can redistribute it and/or modify it underthe terms of the GNU General Public License as published by the Free SoftwareFoundation; either version 2 of the License, or (at your option) any laterversion.This program is distributed in the hope that it will be useful, but WITHOUT ANYWARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR APARTICULAR PURPOSE. See the GNU General Public License for more details.You should have received a copy of the GNU General Public License along withthis program; if not, write to the Free Software Foundation, Inc., 59 TemplePlace, Suite 330, Boston, MA 02111-1307 USAAuthor 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"wsock32.lib" to the "Object/library modules" entryOn 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 stackwhen locally allocated data exceeds 64K.*/#ifdef AS400# pragma convert(819)	/* EBCDIC to ASCII */#endif#include "stdsoap2.h"#ifdef __BORLANDC__# pragma warn -8060#else# ifdef WIN32#  ifdef UNDER_CE#   pragma comment(lib, "winsock.lib")#  else#   pragma comment(lib, "wsock32.lib")#  endif#  pragma warning(disable : 4996) // disable deprecation warnings# endif#endif#ifdef __cplusplusSOAP_SOURCE_STAMP("@(#) stdsoap2.cpp ver 2.7.9l 2007-09-26 00:00:00 GMT")extern "C" {#elseSOAP_SOURCE_STAMP("@(#) stdsoap2.c ver 2.7.9l 2007-09-26 00: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_LT (soap_wchar)(-2) /* XML character '<' */#define SOAP_TT (soap_wchar)(-3) /* XML character '</' */#define SOAP_GT (soap_wchar)(-4) /* XML character '>' */#define SOAP_QT (soap_wchar)(-5) /* XML character '"' */#define SOAP_AP (soap_wchar)(-6) /* XML character ''' */#define soap_blank(c)		((c) >= 0 && (c) <= 32)#define soap_notblank(c)	((c) > 32)#if defined(WIN32) && !defined(UNDER_CE)#define soap_hash_ptr(p)	((PtrToUlong(p) >> 3) & (SOAP_PTRHASH - 1))#else#define soap_hash_ptr(p)	((size_t)(((unsigned long)(p) >> 3) & (SOAP_PTRHASH-1)))#endif#ifdef SOAP_DEBUGstatic 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_DEBUGstatic 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_2static 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*);static int soap_getattrval(struct soap*, char*, size_t, soap_wchar);#endif#ifndef PALM_1static soap_wchar soap_char(struct soap*);static soap_wchar soap_get_pi(struct soap*);static int soap_isxdigit(int);static void *fplugin(struct soap*, const char*);#ifndef WITH_NOIDREFstatic 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_LEANstatic 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);static void soap_pop_ns(struct soap *soap);static void soap_utilize_ns(struct soap *soap, const char *tag, size_t n);#endif#ifndef WITH_LEANER#ifndef PALM_1static struct soap_multipart *soap_new_multipart(struct soap*, struct soap_multipart**, struct soap_multipart**, char*, size_t);static int soap_putdimefield(struct soap*, const char*, size_t);static char *soap_getdimefield(struct soap*, size_t);static void soap_select_mime_boundary(struct soap*);static int soap_valid_mime_boundary(struct soap*);static void soap_resolve_attachment(struct soap*, struct soap_multipart*);#endif#endif#ifdef WITH_GZIPstatic int soap_getgziphdr(struct soap*);#endif#ifdef WITH_OPENSSLstatic 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 deletedstatic DH *ssl_tmp_dh(SSL*, int, int);*/#endif#if !defined(WITH_NOHTTP) || !defined(WITH_LEANER)#ifndef PALM_1static const char *soap_decode(char*, size_t, const char*, const char*);#endif#endif#ifndef WITH_NOHTTP#ifndef PALM_1static soap_wchar soap_getchunkchar(struct soap*);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_get(struct soap*);static int http_send_header(struct soap*, const char*);static int http_post_header(struct soap*, const char*, const char*);static int http_response(struct soap*, int, size_t);static int http_parse(struct soap*);static int http_parse_header(struct soap*, const char*, const char*);#endif#endif#ifndef WITH_NOIO#ifndef PALM_1static int fsend(struct soap*, const char*, size_t);static size_t frecv(struct soap*, char*, size_t);static int tcp_init(struct soap*);static const char *tcp_error(struct soap*);#ifndef WITH_LEANstatic size_t frecv_stop(struct soap*, char*, size_t);#endif#ifndef WITH_IPV6static int tcp_gethost(struct soap*, const char *addr, struct in_addr *inaddr);#endifstatic SOAP_SOCKET tcp_connect(struct soap*, const char *endpoint, const char *host, int port);static SOAP_SOCKET tcp_accept(struct soap*, SOAP_SOCKET, struct sockaddr*, int*);static int tcp_disconnect(struct soap*);static int tcp_closesocket(struct soap*, SOAP_SOCKET);static int tcp_shutdownsocket(struct soap*, SOAP_SOCKET, int);static const char *soap_strerror(struct soap*);#endif#endif#if defined(PALM) && !defined(PALM_2)unsigned short errno;#endif#ifndef PALM_1static const char soap_env1[42] = "http://schemas.xmlsoap.org/soap/envelope/";static const char soap_enc1[42] = "http://schemas.xmlsoap.org/soap/encoding/";static const char soap_env2[40] = "http://www.w3.org/2003/05/soap-envelope";static const char soap_enc2[40] = "http://www.w3.org/2003/05/soap-encoding";static const char soap_rpc[35] = "http://www.w3.org/2003/05/soap-rpc";#endif#ifndef PALM_1const struct soap_double_nan soap_double_nan = {0xFFFFFFFF, 0xFFFFFFFF};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_LEANstatic const char soap_indent[11] = "\n\t\t\t\t\t\t\t\t\t";/* Alternative indentation form for SOAP_XML_INDENT:static const char soap_indent[21] = "\n                   ";*/#endif#ifndef SOAP_CANARY# define SOAP_CANARY (0xC0DE)#endifstatic const char soap_padding[4] = "\0\0\0";#define SOAP_STR_PADDING (soap_padding)#define SOAP_STR_EOS (soap_padding)#define SOAP_NON_NULL (soap_padding)#ifndef WITH_LEANstatic const struct soap_code_map html_entity_codes[] = /* entities for XHTML parsing */{ { 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_LEANstatic 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_LEANstatic 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_OPENSSLstatic const struct soap_code_map h_ssl_error_codes[] ={#define _SSL_ERROR(e) { e, #e }  _SSL_ERROR(SSL_ERROR_SSL),  _SSL_ERROR(SSL_ERROR_ZERO_RETURN),  _SSL_ERROR(SSL_ERROR_WANT_READ),  _SSL_ERROR(SSL_ERROR_WANT_WRITE),  _SSL_ERROR(SSL_ERROR_WANT_CONNECT),  _SSL_ERROR(SSL_ERROR_WANT_X509_LOOKUP),  _SSL_ERROR(SSL_ERROR_SYSCALL),  { 0, NULL }};#endif#ifndef WITH_LEANERstatic 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 }};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -