1 soup协议中的soap结构体
2
3
4 [cpp] view plaincopyprint?
5 struct SOAP_STD_API soap
6 { short state; /* 0 = uninitialized, 1 = initialized, 2 = copy of another soap struct */
7 short version; /* 1 = SOAP1.1 and 2 = SOAP1.2 (set automatically from namespace URI in nsmap table) */
8 soap_mode mode;
9 soap_mode imode;
10 soap_mode omode;
11 const char *float_format; /* user-definable format string for floats (<1024 chars) */
12 const char *double_format; /* user-definable format string for doubles (<1024 chars) */
13 const char *dime_id_format; /* user-definable format string for integer DIME id (<SOAP_TAGLEN chars) */
14 const char *http_version; /* HTTP version used "1.0" or "1.1" */
15 const char *http_content; /* optional custom response content type (with SOAP_FILE) */
16 const char *encodingStyle; /* default = NULL which means that SOAP encoding is used */
17 const char *actor; /* SOAP-ENV:actor or role attribute value */
18 const char *lang; /* xml:lang attribute value of SOAP-ENV:Text */
19 int recv_timeout; /* when > 0, gives socket recv timeout in seconds, < 0 in usec */
20 int send_timeout; /* when > 0, gives socket send timeout in seconds, < 0 in usec */
21 int connect_timeout; /* when > 0, gives socket connect() timeout in seconds, < 0 in usec */
22 int accept_timeout; /* when > 0, gives socket accept() timeout in seconds, < 0 in usec */
23 int socket_flags; /* socket recv() and send() flags, e.g. set to MSG_NOSIGNAL to disable sigpipe */
24 int connect_flags; /* connect() SOL_SOCKET sockopt flags, e.g. set to SO_DEBUG to debug socket */
25 int bind_flags; /* bind() SOL_SOCKET sockopt flags, e.g. set to SO_REUSEADDR to enable reuse */
26 int accept_flags; /* accept() SOL_SOCKET sockopt flags */
27 unsigned short linger_time; /* linger time for SO_LINGER option */
28 const struct Namespace *namespaces; /* Pointer to global namespace mapping table */
29 struct Namespace *local_namespaces; /* Local namespace mapping table */
30 struct soap_nlist *nlist; /* namespace stack */
31 struct soap_blist *blist; /* block allocation stack */
32 struct soap_clist *clist; /* class instance allocation list */
33 void *alist; /* memory allocation (malloc) list */
34 struct soap_ilist *iht[SOAP_IDHASH];
35 struct soap_plist *pht[SOAP_PTRHASH];
36 struct soap_pblk *pblk; /* plist block allocation */
37 short pidx; /* plist block allocation */
38 struct SOAP_ENV__Header *header;
39 struct SOAP_ENV__Fault *fault;
40 int idnum;
41 void *user; /* to pass user-defined data */
42 struct soap_plugin *plugins; /* linked list of plug-in data */
43 char *userid; /* HTTP Basic authorization userid */
44 char *passwd; /* HTTP Basic authorization passwd */
45 int (*fpost)(struct soap*, const char*, const char*, int, const char*, const char*, size_t);
46 int (*fget)(struct soap*);
47 int (*fput)(struct soap*);
48 int (*fdel)(struct soap*);
49 int (*fhead)(struct soap*);
50 int (*fform)(struct soap*);
51 int (*fposthdr)(struct soap*, const char*, const char*);
52 int (*fresponse)(struct soap*, int, size_t);
53 int (*fparse)(struct soap*);
54 int (*fparsehdr)(struct soap*, const char*, const char*);
55 int (*fheader)(struct soap*);
56 int (*fresolve)(struct soap*, const char*, struct in_addr* inaddr);
57 int (*fconnect)(struct soap*, const char*, const char*, int);
58 int (*fdisconnect)(struct soap*);
59 int (*fclosesocket)(struct soap*, SOAP_SOCKET);
60 int (*fshutdownsocket)(struct soap*, SOAP_SOCKET, int);
61 SOAP_SOCKET (*fopen)(struct soap*, const char*, const char*, int);
62 SOAP_SOCKET (*faccept)(struct soap*, SOAP_SOCKET, struct sockaddr*, int *n);
63 int (*fclose)(struct soap*);
64 int (*fsend)(struct soap*, const char*, size_t);
65 size_t (*frecv)(struct soap*, char*, size_t);
66 int (*fpoll)(struct soap*);
67 void (*fseterror)(struct soap*, const char **c, const char **s);
68 int (*fignore)(struct soap*, const char*);
69 int (*fserveloop)(struct soap*);
70 void *(*fplugin)(struct soap*, const char*);
71 void *(*fmalloc)(struct soap*, size_t);
72 #ifndef WITH_LEANER
73 int (*fprepareinit)(struct soap*);
74 int (*fpreparesend)(struct soap*, const char*, size_t);
75 int (*fpreparerecv)(struct soap*, const char*, size_t);
76 int (*fpreparefinal)(struct soap*);
77 void *(*fdimereadopen)(struct soap*, void*, const char*, const char*, const char*);
78 void *(*fdimewriteopen)(struct soap*, const char*, const char*, const char*);
79 void (*fdimereadclose)(struct soap*, void*);
80 void (*fdimewriteclose)(struct soap*, void*);
81 size_t (*fdimeread)(struct soap*, void*, char*, size_t);
82 int (*fdimewrite)(struct soap*, void*, const char*, size_t);
83 void *(*fmimereadopen)(struct soap*, void*, const char*, const char*, const char*);
84 void *(*fmimewriteopen)(struct soap*, void*, const char*, const char*, const char*, enum soap_mime_encoding);
85 void (*fmimereadclose)(struct soap*, void*);
86 void (*fmimewriteclose)(struct soap*, void*);
87 size_t (*fmimeread)(struct soap*, void*, char*, size_t);
88 int (*fmimewrite)(struct soap*, void*, const char*, size_t);
89 #endif
90 SOAP_SOCKET master;
91 SOAP_SOCKET socket;
92 #if defined(__cplusplus) && !defined(WITH_LEAN) && !defined(WITH_COMPAT)
93 std::ostream *os;
94 std::istream *is;
95 #else
96 void *os; /* preserve struct size */
97 void *is; /* preserve struct size */
98 #endif
99 #ifndef UNDER_CE
100 int sendfd;
101 int recvfd;
102 #else
103 FILE *sendfd;
104 FILE *recvfd;
105 #endif
106 size_t bufidx; /* index in soap.buf[] */
107 size_t buflen; /* length of soap.buf[] content */
108 soap_wchar ahead; /* parser lookahead */
109 short cdata; /* CDATA parser state */
110 short body; /* parsed XML element has a body or not */
111 unsigned int level; /* XML nesting level */
112 size_t count; /* message length counter */
113 size_t length; /* message length as set by HTTP header */
114 char *labbuf; /* look-aside buffer */
115 size_t lablen; /* look-aside buffer allocated length */
116 size_t labidx; /* look-aside buffer index to available part */
117 char buf[SOAP_BUFLEN];/* send and receive buffer */
118 char msgbuf[1024]; /* in/out buffer for HTTP/MIME headers >=1024 bytes */
119 char tmpbuf[1024]; /* in/out buffer for HTTP/MIME headers, simpleType values, element and attribute tag names, and DIME must be >=1024 bytes */
120 char tag[SOAP_TAGLEN];
121 char id[SOAP_TAGLEN];
122 char href[SOAP_TAGLEN];
123 char type[SOAP_TAGLEN];
124 char arrayType[SOAP_TAGLEN];
125 char arraySize[SOAP_TAGLEN];
126 char arrayOffset[SOAP_TAGLEN];
127 short other;
128 short position;
129 int positions[SOAP_MAXDIMS];
130 short root;
131 struct soap_attribute *attributes; /* attribute list */
132 short encoding; /* when set, output encodingStyle */
133 short mustUnderstand; /* a mustUnderstand element was parsed or is output */
134 short null; /* parsed XML is xsi:nil */
135 short ns; /* when not set, output full xmlns bindings */
136 short part; /* parsing state */
137 short alloced;
138 short peeked;
139 size_t chunksize;
140 size_t chunkbuflen;
141 char endpoint[SOAP_TAGLEN];
142 char path[SOAP_TAGLEN];
143 char host[SOAP_TAGLEN];
144 char *action;
145 char *authrealm; /* HTTP authentication realm */
146 char *prolog; /* XML declaration prolog */
147 unsigned long ip; /* IP number */
148 int port; /* port number */
149 short keep_alive; /* connection should be kept open */
150 short tcp_keep_alive; /* enable SO_KEEPALIVE */
151 unsigned int tcp_keep_idle; /* set TCP_KEEPIDLE */
152 unsigned int tcp_keep_intvl; /* set TCP_KEEPINTVL */
153 unsigned int tcp_keep_cnt; /* set TCP_KEEPCNT */
154 unsigned int max_keep_alive; /* maximum keep-alive session (default=100) */
155 const char *proxy_http_version;/* HTTP version of proxy "1.0" or "1.1" */
156 const char *proxy_host; /* Proxy Server host name */
157 int proxy_port; /* Proxy Server port (default = 8080) */
158 const char *proxy_userid; /* Proxy Authorization user name */
159 const char *proxy_passwd; /* Proxy Authorization password */
160 const char *proxy_from; /* X-Forwarding-For header returned by proxy */
161 int status; /* -1 when request, else error code to be returned by server */
162 int error;
163 int errmode;
164 int errnum;
165 #ifndef WITH_LEANER
166 struct soap_dom_element *dom;
167 struct soap_dime dime;
168 struct soap_mime mime;
169 struct soap_xlist *xlist;
170 #endif
171 #if !defined(WITH_LEAN) || defined(SOAP_DEBUG)
172 const char *logfile[SOAP_MAXLOGS];
173 FILE *fdebug[SOAP_MAXLOGS];
174 struct soap_mlist *mht[SOAP_PTRHASH];
175 #endif
176 #ifndef WITH_LEAN
177 const char *c14ninclude;
178 const char *c14nexclude;
179 struct soap_cookie *cookies;
180 const char *cookie_domain;
181 const char *cookie_path;
182 int cookie_max;
183 #endif
184 #ifndef WITH_NOIO
185 int ipv6_multicast_if; /* always include this to keep the soap struct size the same in v4 and v6 */
186 char* ipv4_multicast_if; /* always include this to keep the soap struct size the same in v4 and v6 */
187 int ipv4_multicast_ttl; /* multicast scope */
188 #ifdef WITH_IPV6
189 struct sockaddr_storage peer; /* IPv6: set by soap_accept and by UDP recv */
190 #else
191 struct sockaddr_in peer; /* IPv4: set by soap_connect/soap_accept and by UDP recv */
192 #endif
193 #endif
194 size_t peerlen;
195 #ifdef WITH_OPENSSL
196 int (*fsslauth)(struct soap*);
197 int (*fsslverify)(int, X509_STORE_CTX*);
198 BIO *bio;
199 SSL *ssl;
200 SSL_CTX *ctx;
201 SSL_SESSION *session;
202 #else
203 void *fsslauth; /* dummy members, to preserve struct size */
204 void *fsslverify;
205 void *bio;
206 void *ssl;
207 void *ctx;
208 void *session;
209 #endif
210 unsigned short ssl_flags;
211 const char *keyfile;
212 const char *password;
213 const char *dhfile;
214 const char *cafile;
215 const char *capath;
216 const char *crlfile;
217 const char *randfile;
218 char session_host[SOAP_TAGLEN];
219 int session_port;
220 #ifdef WITH_C_LOCALE
221 locale_t c_locale; /* set to C locale by default */
222 #else
223 void *c_locale;
224 #endif
225 #ifdef WITH_ZLIB
226 z_stream *d_stream; /* decompression stream */
227 uLong z_crc; /* internal gzip crc */
228 #else
229 void *d_stream; /* dummy members, to preserve struct size */
230 soap_int32 z_crc;
231 #endif
232 short zlib_state; /* SOAP_ZLIB_NONE, SOAP_ZLIB_DEFLATE, or SOAP_ZLIB_INFLATE */
233 short zlib_in; /* SOAP_ZLIB_NONE, SOAP_ZLIB_DEFLATE, or SOAP_ZLIB_GZIP */
234 short zlib_out; /* SOAP_ZLIB_NONE, SOAP_ZLIB_DEFLATE, or SOAP_ZLIB_GZIP */
235 char *z_buf; /* buffer */
236 size_t z_buflen;
237 unsigned short z_level; /* compression level to be used (0=none, 1=fast to 9=best) */
238 float z_ratio_in; /* detected compression ratio compressed_length/length of inbound message */
239 float z_ratio_out; /* detected compression ratio compressed_length/length of outbound message */
240 #ifdef WMW_RPM_IO
241 void *rpmreqid;
242 #endif
243 #ifdef __cplusplus
244 soap();
245 soap(soap_mode);
246 soap(soap_mode, soap_mode);
247 soap(struct soap&);
248 virtual ~soap();
249 #else
250 void (*dummy)();
251 #endif
252 };