Changeset 19542
- Timestamp:
- Sep 12, 2008, 3:15:59 PM (18 years ago)
- Location:
- trunk/Nebulous/nebclient/src
- Files:
-
- 10 edited
-
nebulous.h (modified) (24 diffs)
-
soapC.c (modified) (79 diffs)
-
soapClient.c (modified) (31 diffs)
-
soapClientLib.c (modified) (1 diff)
-
soapH.h (modified) (32 diffs)
-
soapServer.c (modified) (22 diffs)
-
soapServerLib.c (modified) (1 diff)
-
soapStub.h (modified) (16 diffs)
-
stdsoap2.c (modified) (523 diffs)
-
stdsoap2.h (modified) (94 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous/nebclient/src/nebulous.h
r13096 r19542 1 1 /* src/nebulous.h 2 Generated by wsdl2h 1.2.1 from nebulous.wsdl and typemap.dat3 200 7-05-01 02:53:36GMT4 Copyright (C) 2001-200 5Robert van Engelen, Genivia Inc. All Rights Reserved.2 Generated by wsdl2h 1.2.11 from nebulous.wsdl and typemap.dat 3 2008-09-13 01:14:23 GMT 4 Copyright (C) 2001-2008 Robert van Engelen, Genivia Inc. All Rights Reserved. 5 5 This part of the software is released under one of the following licenses: 6 6 GPL or Genivia's license for commercial use. … … 10 10 11 11 - Compile this file with soapcpp2 to complete the code generation process. 12 - Use wsdl2h option -l to view the software license terms. 12 - Use soapcpp2 option -I to specify paths for #import 13 To build with STL, 'stlvector.h' is imported from 'import' dir in package. 13 14 - Use wsdl2h options -c and -s to generate pure C code or C++ code without STL. 14 - To build with STL, stlvector.h from the gSOAP distribution must be in the 15 current directory. Or use soapcpp2 option -I<path> with path to stlvector.h. 16 - Use typemap.dat to control schema namespace bindings and type mappings. 15 - Use 'typemap.dat' to control namespace bindings and type mappings. 17 16 It is strongly recommended to customize the names of the namespace prefixes 18 17 generated by wsdl2h. To do so, modify the prefix bindings in the Namespaces 19 section below and add the modified lines to typemap.datto rerun wsdl2h.18 section below and add the modified lines to 'typemap.dat' to rerun wsdl2h. 20 19 - Use Doxygen (www.doxygen.org) to browse this file. 21 22 */ 20 - Use wsdl2h option -l to view the software license terms. 21 22 DO NOT include this file directly into your project. 23 Include only the soapcpp2-generated headers and source code files. 24 */ 25 26 //gsoapopt cw 23 27 24 28 /******************************************************************************\ … … 28 32 \******************************************************************************/ 29 33 30 //gsoapopt cw 34 35 /******************************************************************************\ 36 * * 37 * Import * 38 * * 39 \******************************************************************************/ 31 40 32 41 … … 58 67 59 68 60 /// Built-in attribute "SOAP-ENC:arrayType" 61 typedef char* SOAP_ENC__arrayType; 62 63 64 /// Schema urn:Nebulous/Server/SOAP:"ArrayOfString" 65 69 70 /// "urn:Nebulous/Server/SOAP":ArrayOfString is a complexType with complexContent restriction of SOAP-ENC:Array. 66 71 /// SOAP encoded array of xs:string 67 72 struct ArrayOfString 68 73 { 69 /// Pointer to a n array of char*74 /// Pointer to array of char*. 70 75 char* *__ptr ; 71 /// Size of the dynamic array 76 /// Size of the dynamic array. 72 77 int __size ; 78 /// Offset for partially transmitted arrays (uncomment only when required). 79 // int __offset ; 73 80 }; 74 81 … … 78 85 * * 79 86 \******************************************************************************/ 87 80 88 81 89 //gsoap ns1 service name: SOAP … … 111 119 - http://localhost:80/nebulous 112 120 121 Note: use wsdl2h option -N to change the service binding prefix name 122 113 123 */ 114 124 … … 136 146 - SOAP action="urn:Nebulous/Server/SOAP#create_object" 137 147 138 C stub function (defined in soapClient.c[pp]): 139 @code 140 int soap_call_ns1__create_USCOREobject(struct soap *soap, 141 NULL, // char *endpoint = NULL selects default endpoint for this operation 142 NULL, // char *action = NULL selects default action for this operation 148 C stub function (defined in soapClient.c[pp] generated by soapcpp2): 149 @code 150 int soap_call_ns1__create_USCOREobject( 151 struct soap *soap, 152 NULL, // char *endpoint = NULL selects default endpoint for this operation 153 NULL, // char *action = NULL selects default action for this operation 154 // request parameters: 155 char* key, 156 char* volume, 157 // response parameters: 158 char* *result 159 ); 160 @endcode 161 162 C server function (called from the service dispatcher defined in soapServer.c[pp]): 163 @code 164 int ns1__create_USCOREobject( 165 struct soap *soap, 143 166 // request parameters: 144 167 char* key, … … 155 178 //gsoap ns1 service method-action: create_USCOREobject urn:Nebulous/Server/SOAP#create_object 156 179 int ns1__create_USCOREobject( 157 char* key, 158 char* volume, 159 char* *result ///< response parameter180 char* key, ///< Request parameter 181 char* volume, ///< Request parameter 182 char* *result ///< Response parameter 160 183 ); 161 184 … … 176 199 - SOAP action="urn:Nebulous/Server/SOAP#create_object" 177 200 178 C stub function (defined in soapClient.c[pp]): 179 @code 180 int soap_call_ns1__rename_USCOREobject(struct soap *soap, 181 NULL, // char *endpoint = NULL selects default endpoint for this operation 182 NULL, // char *action = NULL selects default action for this operation 201 C stub function (defined in soapClient.c[pp] generated by soapcpp2): 202 @code 203 int soap_call_ns1__rename_USCOREobject( 204 struct soap *soap, 205 NULL, // char *endpoint = NULL selects default endpoint for this operation 206 NULL, // char *action = NULL selects default action for this operation 207 // request parameters: 208 char* key, 209 char* newkey, 210 // response parameters: 211 char* *result 212 ); 213 @endcode 214 215 C server function (called from the service dispatcher defined in soapServer.c[pp]): 216 @code 217 int ns1__rename_USCOREobject( 218 struct soap *soap, 183 219 // request parameters: 184 220 char* key, … … 195 231 //gsoap ns1 service method-action: rename_USCOREobject urn:Nebulous/Server/SOAP#create_object 196 232 int ns1__rename_USCOREobject( 233 char* key, ///< Request parameter 234 char* newkey, ///< Request parameter 235 char* *result ///< Response parameter 236 ); 237 238 /******************************************************************************\ 239 * * 240 * ns1__rename_USCOREobject_ * 241 * * 242 \******************************************************************************/ 243 244 245 /// Operation "ns1__rename_USCOREobject_" of service binding "SOAP" 246 247 /** 248 249 Operation details: 250 251 - SOAP RPC encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 252 - SOAP action="urn:Nebulous/Server/SOAP#rename_object" 253 254 C stub function (defined in soapClient.c[pp] generated by soapcpp2): 255 @code 256 int soap_call_ns1__rename_USCOREobject_( 257 struct soap *soap, 258 NULL, // char *endpoint = NULL selects default endpoint for this operation 259 NULL, // char *action = NULL selects default action for this operation 260 // request parameters: 197 261 char* key, 198 262 char* newkey, 199 char* *result ///< response parameter 200 ); 201 202 /******************************************************************************\ 203 * * 204 * ns1__rename_USCOREobject_ * 205 * * 206 \******************************************************************************/ 207 208 209 /// Operation "ns1__rename_USCOREobject_" of service binding "SOAP" 210 211 /** 212 213 Operation details: 214 215 - SOAP RPC encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 216 - SOAP action="urn:Nebulous/Server/SOAP#rename_object" 217 218 C stub function (defined in soapClient.c[pp]): 219 @code 220 int soap_call_ns1__rename_USCOREobject_(struct soap *soap, 221 NULL, // char *endpoint = NULL selects default endpoint for this operation 222 NULL, // char *action = NULL selects default action for this operation 263 // response parameters: 264 char* *result 265 ); 266 @endcode 267 268 C server function (called from the service dispatcher defined in soapServer.c[pp]): 269 @code 270 int ns1__rename_USCOREobject_( 271 struct soap *soap, 223 272 // request parameters: 224 273 char* key, … … 235 284 //gsoap ns1 service method-action: rename_USCOREobject_ urn:Nebulous/Server/SOAP#rename_object 236 285 int ns1__rename_USCOREobject_( 237 char* key, 238 char* newkey, 239 char* *result ///< response parameter286 char* key, ///< Request parameter 287 char* newkey, ///< Request parameter 288 char* *result ///< Response parameter 240 289 ); 241 290 … … 256 305 - SOAP action="urn:Nebulous/Server/SOAP#replicate_object" 257 306 258 C stub function (defined in soapClient.c[pp]): 259 @code 260 int soap_call_ns1__replicate_USCOREobject(struct soap *soap, 261 NULL, // char *endpoint = NULL selects default endpoint for this operation 262 NULL, // char *action = NULL selects default action for this operation 307 C stub function (defined in soapClient.c[pp] generated by soapcpp2): 308 @code 309 int soap_call_ns1__replicate_USCOREobject( 310 struct soap *soap, 311 NULL, // char *endpoint = NULL selects default endpoint for this operation 312 NULL, // char *action = NULL selects default action for this operation 313 // request parameters: 314 char* key, 315 char* volume, 316 // response parameters: 317 char* *result 318 ); 319 @endcode 320 321 C server function (called from the service dispatcher defined in soapServer.c[pp]): 322 @code 323 int ns1__replicate_USCOREobject( 324 struct soap *soap, 263 325 // request parameters: 264 326 char* key, … … 275 337 //gsoap ns1 service method-action: replicate_USCOREobject urn:Nebulous/Server/SOAP#replicate_object 276 338 int ns1__replicate_USCOREobject( 277 char* key, 278 char* volume, 279 char* *result ///< response parameter339 char* key, ///< Request parameter 340 char* volume, ///< Request parameter 341 char* *result ///< Response parameter 280 342 ); 281 343 … … 296 358 - SOAP action="urn:Nebulous/Server/SOAP#lock_object" 297 359 298 C stub function (defined in soapClient.c[pp]): 299 @code 300 int soap_call_ns1__lock_USCOREobject(struct soap *soap, 301 NULL, // char *endpoint = NULL selects default endpoint for this operation 302 NULL, // char *action = NULL selects default action for this operation 360 C stub function (defined in soapClient.c[pp] generated by soapcpp2): 361 @code 362 int soap_call_ns1__lock_USCOREobject( 363 struct soap *soap, 364 NULL, // char *endpoint = NULL selects default endpoint for this operation 365 NULL, // char *action = NULL selects default action for this operation 366 // request parameters: 367 char* key, 368 char* type, 369 // response parameters: 370 int *result 371 ); 372 @endcode 373 374 C server function (called from the service dispatcher defined in soapServer.c[pp]): 375 @code 376 int ns1__lock_USCOREobject( 377 struct soap *soap, 303 378 // request parameters: 304 379 char* key, … … 315 390 //gsoap ns1 service method-action: lock_USCOREobject urn:Nebulous/Server/SOAP#lock_object 316 391 int ns1__lock_USCOREobject( 392 char* key, ///< Request parameter 393 char* type, ///< Request parameter 394 int *result ///< Response parameter 395 ); 396 397 /******************************************************************************\ 398 * * 399 * ns1__unlock_USCOREobject * 400 * * 401 \******************************************************************************/ 402 403 404 /// Operation "ns1__unlock_USCOREobject" of service binding "SOAP" 405 406 /** 407 408 Operation details: 409 410 - SOAP RPC encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 411 - SOAP action="urn:Nebulous/Server/SOAP#unlock_object" 412 413 C stub function (defined in soapClient.c[pp] generated by soapcpp2): 414 @code 415 int soap_call_ns1__unlock_USCOREobject( 416 struct soap *soap, 417 NULL, // char *endpoint = NULL selects default endpoint for this operation 418 NULL, // char *action = NULL selects default action for this operation 419 // request parameters: 317 420 char* key, 318 421 char* type, 319 int *result ///< response parameter 320 ); 321 322 /******************************************************************************\ 323 * * 324 * ns1__unlock_USCOREobject * 325 * * 326 \******************************************************************************/ 327 328 329 /// Operation "ns1__unlock_USCOREobject" of service binding "SOAP" 330 331 /** 332 333 Operation details: 334 335 - SOAP RPC encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 336 - SOAP action="urn:Nebulous/Server/SOAP#unlock_object" 337 338 C stub function (defined in soapClient.c[pp]): 339 @code 340 int soap_call_ns1__unlock_USCOREobject(struct soap *soap, 341 NULL, // char *endpoint = NULL selects default endpoint for this operation 342 NULL, // char *action = NULL selects default action for this operation 422 // response parameters: 423 int *result 424 ); 425 @endcode 426 427 C server function (called from the service dispatcher defined in soapServer.c[pp]): 428 @code 429 int ns1__unlock_USCOREobject( 430 struct soap *soap, 343 431 // request parameters: 344 432 char* key, … … 355 443 //gsoap ns1 service method-action: unlock_USCOREobject urn:Nebulous/Server/SOAP#unlock_object 356 444 int ns1__unlock_USCOREobject( 357 char* key, 358 char* type, 359 int *result ///< response parameter445 char* key, ///< Request parameter 446 char* type, ///< Request parameter 447 int *result ///< Response parameter 360 448 ); 361 449 … … 381 469 - SOAP action="urn:Nebulous/Server/SOAP#find_objects" 382 470 383 C stub function (defined in soapClient.c[pp]): 384 @code 385 int soap_call_ns1__find_USCOREobjects(struct soap *soap, 386 NULL, // char *endpoint = NULL selects default endpoint for this operation 387 NULL, // char *action = NULL selects default action for this operation 471 C stub function (defined in soapClient.c[pp] generated by soapcpp2): 472 @code 473 int soap_call_ns1__find_USCOREobjects( 474 struct soap *soap, 475 NULL, // char *endpoint = NULL selects default endpoint for this operation 476 NULL, // char *action = NULL selects default action for this operation 477 // request parameters: 478 char* pattern, 479 // response parameters: 480 struct ns1__find_USCOREobjectsResponse* 481 ); 482 @endcode 483 484 C server function (called from the service dispatcher defined in soapServer.c[pp]): 485 @code 486 int ns1__find_USCOREobjects( 487 struct soap *soap, 388 488 // request parameters: 389 489 char* pattern, … … 399 499 //gsoap ns1 service method-action: find_USCOREobjects urn:Nebulous/Server/SOAP#find_objects 400 500 int ns1__find_USCOREobjects( 401 char* pattern, 402 struct ns1__find_USCOREobjectsResponse* ///< responseparameter501 char* pattern, ///< Request parameter 502 struct ns1__find_USCOREobjectsResponse* ///< Response struct parameter 403 503 ); 404 504 … … 424 524 - SOAP action="urn:Nebulous/Server/SOAP#find_instances" 425 525 426 C stub function (defined in soapClient.c[pp]): 427 @code 428 int soap_call_ns1__find_USCOREinstances(struct soap *soap, 429 NULL, // char *endpoint = NULL selects default endpoint for this operation 430 NULL, // char *action = NULL selects default action for this operation 526 C stub function (defined in soapClient.c[pp] generated by soapcpp2): 527 @code 528 int soap_call_ns1__find_USCOREinstances( 529 struct soap *soap, 530 NULL, // char *endpoint = NULL selects default endpoint for this operation 531 NULL, // char *action = NULL selects default action for this operation 532 // request parameters: 533 char* key, 534 char* volume, 535 // response parameters: 536 struct ns1__find_USCOREinstancesResponse* 537 ); 538 @endcode 539 540 C server function (called from the service dispatcher defined in soapServer.c[pp]): 541 @code 542 int ns1__find_USCOREinstances( 543 struct soap *soap, 431 544 // request parameters: 432 545 char* key, … … 443 556 //gsoap ns1 service method-action: find_USCOREinstances urn:Nebulous/Server/SOAP#find_instances 444 557 int ns1__find_USCOREinstances( 445 char* key, 446 char* volume, 447 struct ns1__find_USCOREinstancesResponse* ///< responseparameter558 char* key, ///< Request parameter 559 char* volume, ///< Request parameter 560 struct ns1__find_USCOREinstancesResponse* ///< Response struct parameter 448 561 ); 449 562 … … 464 577 - SOAP action="urn:Nebulous/Server/SOAP#delete_instance" 465 578 466 C stub function (defined in soapClient.c[pp]): 467 @code 468 int soap_call_ns1__delete_USCOREinstance(struct soap *soap, 469 NULL, // char *endpoint = NULL selects default endpoint for this operation 470 NULL, // char *action = NULL selects default action for this operation 579 C stub function (defined in soapClient.c[pp] generated by soapcpp2): 580 @code 581 int soap_call_ns1__delete_USCOREinstance( 582 struct soap *soap, 583 NULL, // char *endpoint = NULL selects default endpoint for this operation 584 NULL, // char *action = NULL selects default action for this operation 585 // request parameters: 586 char* uri, 587 // response parameters: 588 int *result 589 ); 590 @endcode 591 592 C server function (called from the service dispatcher defined in soapServer.c[pp]): 593 @code 594 int ns1__delete_USCOREinstance( 595 struct soap *soap, 471 596 // request parameters: 472 597 char* uri, … … 482 607 //gsoap ns1 service method-action: delete_USCOREinstance urn:Nebulous/Server/SOAP#delete_instance 483 608 int ns1__delete_USCOREinstance( 484 char* uri, 485 int *result ///< response parameter609 char* uri, ///< Request parameter 610 int *result ///< Response parameter 486 611 ); 487 612 … … 507 632 - SOAP action="urn:Nebulous/Server/SOAP#stat_object" 508 633 509 C stub function (defined in soapClient.c[pp]): 510 @code 511 int soap_call_ns1__stat_USCOREobject(struct soap *soap, 512 NULL, // char *endpoint = NULL selects default endpoint for this operation 513 NULL, // char *action = NULL selects default action for this operation 634 C stub function (defined in soapClient.c[pp] generated by soapcpp2): 635 @code 636 int soap_call_ns1__stat_USCOREobject( 637 struct soap *soap, 638 NULL, // char *endpoint = NULL selects default endpoint for this operation 639 NULL, // char *action = NULL selects default action for this operation 640 // request parameters: 641 char* key, 642 // response parameters: 643 struct ns1__stat_USCOREobjectResponse* 644 ); 645 @endcode 646 647 C server function (called from the service dispatcher defined in soapServer.c[pp]): 648 @code 649 int ns1__stat_USCOREobject( 650 struct soap *soap, 514 651 // request parameters: 515 652 char* key, … … 525 662 //gsoap ns1 service method-action: stat_USCOREobject urn:Nebulous/Server/SOAP#stat_object 526 663 int ns1__stat_USCOREobject( 527 char* key, 528 struct ns1__stat_USCOREobjectResponse* ///< responseparameter664 char* key, ///< Request parameter 665 struct ns1__stat_USCOREobjectResponse* ///< Response struct parameter 529 666 ); 530 667 -
trunk/Nebulous/nebclient/src/soapC.c
r13096 r19542 1 1 /* soapC.c 2 Generated by gSOAP 2.7. 2from src/nebulous.h3 Copyright (C) 2000-2005, Robert van Engelen, Genivia Inc. All Rights Reserved.2 Generated by gSOAP 2.7.11 from src/nebulous.h 3 Copyright(C) 2000-2008, Robert van Engelen, Genivia Inc. All Rights Reserved. 4 4 This part of the software is released under one of the following licenses: 5 5 GPL, the gSOAP public license, or Genivia's license for commercial use. 6 6 */ 7 7 8 #include "soapH.h" 9 8 10 #ifdef __cplusplus 9 11 extern "C" { 10 12 #endif 11 13 12 SOAP_BEGIN_NAMESPACE(soap) 13 14 SOAP_SOURCE_STAMP("@(#) soapC.c ver 2.7.2 2007-05-01 02:53:36 GMT") 14 SOAP_SOURCE_STAMP("@(#) soapC.c ver 2.7.11 2008-09-13 01:14:40 GMT") 15 15 16 16 … … 27 27 if (soap->header) 28 28 { soap->part = SOAP_IN_HEADER; 29 soap_out_SOAP_ENV__Header(soap, "SOAP-ENV:Header", 0, soap->header, NULL); 29 if (soap_out_SOAP_ENV__Header(soap, "SOAP-ENV:Header", 0, soap->header, NULL)) 30 return soap->error; 30 31 soap->part = SOAP_END_HEADER; 31 32 } … … 41 42 } 42 43 44 SOAP_FMAC3 void SOAP_FMAC4 soap_header(struct soap *soap) 45 { 46 if (!soap->header) 47 { soap->header = (struct SOAP_ENV__Header*)soap_malloc(soap, sizeof(struct SOAP_ENV__Header)); 48 soap_default_SOAP_ENV__Header(soap, soap->header); 49 } 50 } 51 43 52 SOAP_FMAC3 void SOAP_FMAC4 soap_fault(struct soap *soap) 44 53 { 45 54 if (!soap->fault) 46 55 { soap->fault = (struct SOAP_ENV__Fault*)soap_malloc(soap, sizeof(struct SOAP_ENV__Fault)); 56 if (!soap->fault) 57 return; 47 58 soap_default_SOAP_ENV__Fault(soap, soap->fault); 48 59 } 49 if (soap->version != 1&& !soap->fault->SOAP_ENV__Code)60 if (soap->version == 2 && !soap->fault->SOAP_ENV__Code) 50 61 { soap->fault->SOAP_ENV__Code = (struct SOAP_ENV__Code*)soap_malloc(soap, sizeof(struct SOAP_ENV__Code)); 51 62 soap_default_SOAP_ENV__Code(soap, soap->fault->SOAP_ENV__Code); 63 } 64 if (soap->version == 2 && !soap->fault->SOAP_ENV__Reason) 65 { soap->fault->SOAP_ENV__Reason = (struct SOAP_ENV__Reason*)soap_malloc(soap, sizeof(struct SOAP_ENV__Reason)); 66 soap_default_SOAP_ENV__Reason(soap, soap->fault->SOAP_ENV__Reason); 52 67 } 53 68 } … … 79 94 } 80 95 81 SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faults tring(struct soap *soap)96 SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultsubcode(struct soap *soap) 82 97 { 83 98 soap_fault(soap); 84 99 if (soap->version == 2) 85 return (const char**)&soap->fault->SOAP_ENV__Reason; 100 { if (!soap->fault->SOAP_ENV__Code->SOAP_ENV__Subcode) 101 { soap->fault->SOAP_ENV__Code->SOAP_ENV__Subcode = (struct SOAP_ENV__Code*)soap_malloc(soap, sizeof(struct SOAP_ENV__Code)); 102 soap_default_SOAP_ENV__Code(soap, soap->fault->SOAP_ENV__Code->SOAP_ENV__Subcode); 103 } 104 return (const char**)&soap->fault->SOAP_ENV__Code->SOAP_ENV__Subcode->SOAP_ENV__Value; 105 } 106 return (const char**)&soap->fault->faultcode; 107 } 108 109 SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultstring(struct soap *soap) 110 { 111 soap_fault(soap); 112 if (soap->version == 2) 113 return (const char**)&soap->fault->SOAP_ENV__Reason->SOAP_ENV__Text; 86 114 return (const char**)&soap->fault->faultstring; 87 115 } … … 187 215 case SOAP_TYPE_PointerTostring: 188 216 return soap_in_PointerTostring(soap, NULL, NULL, "xsd:string"); 189 case SOAP_TYPE_SOAP_ENC__arrayType:190 { char **s;191 s = soap_in_SOAP_ENC__arrayType(soap, NULL, NULL, "SOAP-ENC:arrayType");192 return s ? *s : NULL;193 }194 case SOAP_TYPE__QName:195 { char **s;196 s = soap_in__QName(soap, NULL, NULL, "QName");197 return s ? *s : NULL;198 }199 217 case SOAP_TYPE_string: 200 218 { char **s; … … 298 316 return soap_in_ArrayOfString(soap, NULL, NULL, NULL); 299 317 } 300 if (!soap_match_tag(soap, t, "SOAP-ENC:arrayType"))301 { char **s;302 *type = SOAP_TYPE_SOAP_ENC__arrayType;303 s = soap_in_SOAP_ENC__arrayType(soap, NULL, NULL, NULL);304 return s ? *s : NULL;305 }306 if (!soap_match_tag(soap, t, "QName"))307 { char **s;308 *type = SOAP_TYPE__QName;309 s = soap_in__QName(soap, NULL, NULL, NULL);310 return s ? *s : NULL;311 }312 318 if (!soap_match_tag(soap, t, "xsd:string")) 313 319 { char **s; … … 316 322 return s ? *s : NULL; 317 323 } 324 t = soap->tag; 325 if (!soap_match_tag(soap, t, "xsd:QName")) 326 { char **s; 327 *type = SOAP_TYPE__QName; 328 s = soap_in__QName(soap, NULL, NULL, NULL); 329 return s ? *s : NULL; 330 } 318 331 } 319 332 } … … 324 337 325 338 SOAP_FMAC3 int SOAP_FMAC4 soap_ignore_element(struct soap *soap) 326 { if (!soap_peek_element(soap)) 339 { 340 if (!soap_peek_element(soap)) 327 341 { int t; 342 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unexpected element '%s' in input (level=%u, %d)\n", soap->tag, soap->level, soap->body)); 328 343 if (soap->mustUnderstand && !soap->other) 329 344 return soap->error = SOAP_MUSTUNDERSTAND; 330 345 if (((soap->mode & SOAP_XML_STRICT) && soap->part != SOAP_IN_HEADER) || !soap_match_tag(soap, soap->tag, "SOAP-ENV:")) 346 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "REJECTING element '%s'\n", soap->tag)); 331 347 return soap->error = SOAP_TAG_MISMATCH; 348 } 332 349 if (!*soap->id || !soap_getelement(soap, &t)) 333 350 { soap->peeked = 0; 334 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unknown element '%s' (level=%u, %d)\n", soap->tag, soap->level, soap->body));335 351 if (soap->fignore) 336 352 soap->error = soap->fignore(soap, soap->tag); … … 428 444 case SOAP_TYPE_PointerTostring: 429 445 return soap_out_PointerTostring(soap, tag, id, (char **const*)ptr, "xsd:string"); 430 case SOAP_TYPE_SOAP_ENC__arrayType:431 return soap_out_string(soap, tag, id, (char**)&ptr, "SOAP-ENC:arrayType");432 446 case SOAP_TYPE__QName: 433 return soap_out_string(soap, " QName", id, (char**)&ptr, NULL);447 return soap_out_string(soap, "xsd:QName", id, (char*const*)&ptr, NULL); 434 448 case SOAP_TYPE_string: 435 return soap_out_string(soap, tag, id, (char* *)&ptr, "xsd:string");449 return soap_out_string(soap, tag, id, (char*const*)&ptr, "xsd:string"); 436 450 } 437 451 return SOAP_OK; … … 526 540 soap_serialize_PointerTostring(soap, (char **const*)ptr); 527 541 break; 528 case SOAP_TYPE_SOAP_ENC__arrayType:529 soap_serialize_string(soap, (char**)&ptr);530 break;531 542 case SOAP_TYPE__QName: 532 soap_serialize_string(soap, (char* *)&ptr);543 soap_serialize_string(soap, (char*const*)&ptr); 533 544 break; 534 545 case SOAP_TYPE_string: 535 soap_serialize_string(soap, (char* *)&ptr);546 soap_serialize_string(soap, (char*const*)&ptr); 536 547 break; 537 548 } … … 539 550 #endif 540 551 541 #ifndef WITH_LEANER542 SOAP_FMAC3 int SOAP_FMAC4 soap_resolve_attachments(struct soap *soap)543 {544 if (!(soap->mode & SOAP_ENC_DIME))545 return SOAP_OK;546 while (soap->dime.flags & SOAP_DIME_CF)547 { if (soap_getdimehdr(soap))548 return soap->error;549 if (soap_move(soap, soap->dime.size))550 return soap->error = SOAP_EOF;551 }552 if (soap_move(soap, ((soap->dime.size+3)&(~3))-soap_tell(soap)))553 return soap->error = SOAP_EOF;554 for (;;)555 { if (soap_getdime(soap))556 break;557 switch (soap_lookup_type(soap, soap->dime.id))558 {559 }560 }561 if (soap->error == SOAP_DIME_END)562 soap->error = SOAP_OK;563 return soap->error;564 }565 #endif566 567 552 SOAP_FMAC3 void SOAP_FMAC4 soap_default_byte(struct soap *soap, char *a) 568 { 569 (void)soap; /* appease -Wall -Werror */ 553 { (void)soap; /* appease -Wall -Werror */ 570 554 #ifdef SOAP_DEFAULT_byte 571 555 *a = SOAP_DEFAULT_byte; … … 591 575 { 592 576 if ((p = soap_in_byte(soap, tag, p, type))) 593 soap_getindependent(soap); 577 if (soap_getindependent(soap)) 578 return NULL; 594 579 return p; 595 580 } … … 601 586 602 587 SOAP_FMAC3 void SOAP_FMAC4 soap_default_int(struct soap *soap, int *a) 603 { 604 (void)soap; /* appease -Wall -Werror */ 588 { (void)soap; /* appease -Wall -Werror */ 605 589 #ifdef SOAP_DEFAULT_int 606 590 *a = SOAP_DEFAULT_int; … … 626 610 { 627 611 if ((p = soap_in_int(soap, tag, p, type))) 628 soap_getindependent(soap); 612 if (soap_getindependent(soap)) 613 return NULL; 629 614 return p; 630 615 } … … 636 621 637 622 #ifndef WITH_NOGLOBAL 638 639 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Fault(struct soap *soap, const struct SOAP_ENV__Fault *a)640 {641 (void)soap; (void)a; /* appease -Wall -Werror */642 soap_embedded(soap, &a->faultcode, SOAP_TYPE__QName);643 soap_serialize__QName(soap, &a->faultcode);644 soap_embedded(soap, &a->faultstring, SOAP_TYPE_string);645 soap_serialize_string(soap, &a->faultstring);646 soap_embedded(soap, &a->faultactor, SOAP_TYPE_string);647 soap_serialize_string(soap, &a->faultactor);648 soap_embedded(soap, &a->detail, SOAP_TYPE_PointerToSOAP_ENV__Detail);649 soap_serialize_PointerToSOAP_ENV__Detail(soap, &a->detail);650 soap_embedded(soap, &a->SOAP_ENV__Code, SOAP_TYPE_PointerToSOAP_ENV__Code);651 soap_serialize_PointerToSOAP_ENV__Code(soap, &a->SOAP_ENV__Code);652 soap_embedded(soap, &a->SOAP_ENV__Reason, SOAP_TYPE_string);653 soap_serialize_string(soap, &a->SOAP_ENV__Reason);654 soap_embedded(soap, &a->SOAP_ENV__Node, SOAP_TYPE_string);655 soap_serialize_string(soap, &a->SOAP_ENV__Node);656 soap_embedded(soap, &a->SOAP_ENV__Role, SOAP_TYPE_string);657 soap_serialize_string(soap, &a->SOAP_ENV__Role);658 soap_embedded(soap, &a->SOAP_ENV__Detail, SOAP_TYPE_PointerToSOAP_ENV__Detail);659 soap_serialize_PointerToSOAP_ENV__Detail(soap, &a->SOAP_ENV__Detail);660 }661 623 662 624 SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Fault(struct soap *soap, struct SOAP_ENV__Fault *a) … … 668 630 a->detail = NULL; 669 631 a->SOAP_ENV__Code = NULL; 670 soap_default_string(soap, &a->SOAP_ENV__Reason);632 a->SOAP_ENV__Reason = NULL; 671 633 soap_default_string(soap, &a->SOAP_ENV__Node); 672 634 soap_default_string(soap, &a->SOAP_ENV__Role); … … 674 636 } 675 637 638 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Fault(struct soap *soap, const struct SOAP_ENV__Fault *a) 639 { 640 (void)soap; (void)a; /* appease -Wall -Werror */ 641 soap_serialize__QName(soap, &a->faultcode); 642 soap_serialize_string(soap, &a->faultstring); 643 soap_serialize_string(soap, &a->faultactor); 644 soap_serialize_PointerToSOAP_ENV__Detail(soap, &a->detail); 645 soap_serialize_PointerToSOAP_ENV__Code(soap, &a->SOAP_ENV__Code); 646 soap_serialize_PointerToSOAP_ENV__Reason(soap, &a->SOAP_ENV__Reason); 647 soap_serialize_string(soap, &a->SOAP_ENV__Node); 648 soap_serialize_string(soap, &a->SOAP_ENV__Role); 649 soap_serialize_PointerToSOAP_ENV__Detail(soap, &a->SOAP_ENV__Detail); 650 } 651 676 652 SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Fault(struct soap *soap, const struct SOAP_ENV__Fault *a, const char *tag, const char *type) 677 653 { … … 685 661 { 686 662 const char *soap_tmp_faultcode = soap_QName2s(soap, a->faultcode); 687 soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Fault), type); 688 soap_out__QName(soap, "faultcode", -1, (char*const*)&soap_tmp_faultcode, ""); 689 soap_out_string(soap, "faultstring", -1, &a->faultstring, ""); 690 soap_out_string(soap, "faultactor", -1, &a->faultactor, ""); 691 soap_out_PointerToSOAP_ENV__Detail(soap, "detail", -1, &a->detail, ""); 692 soap_out_PointerToSOAP_ENV__Code(soap, "SOAP-ENV:Code", -1, &a->SOAP_ENV__Code, ""); 693 soap_out_string(soap, "SOAP-ENV:Reason", -1, &a->SOAP_ENV__Reason, ""); 694 soap_out_string(soap, "SOAP-ENV:Node", -1, &a->SOAP_ENV__Node, ""); 695 soap_out_string(soap, "SOAP-ENV:Role", -1, &a->SOAP_ENV__Role, ""); 696 soap_out_PointerToSOAP_ENV__Detail(soap, "SOAP-ENV:Detail", -1, &a->SOAP_ENV__Detail, ""); 697 soap_element_end_out(soap, tag); 698 return SOAP_OK; 663 if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Fault), type)) 664 return soap->error; 665 if (soap_out__QName(soap, "faultcode", -1, (char*const*)&soap_tmp_faultcode, "")) 666 return soap->error; 667 if (soap_out_string(soap, "faultstring", -1, &a->faultstring, "")) 668 return soap->error; 669 if (soap_out_string(soap, "faultactor", -1, &a->faultactor, "")) 670 return soap->error; 671 if (soap_out_PointerToSOAP_ENV__Detail(soap, "detail", -1, &a->detail, "")) 672 return soap->error; 673 if (soap_out_PointerToSOAP_ENV__Code(soap, "SOAP-ENV:Code", -1, &a->SOAP_ENV__Code, "")) 674 return soap->error; 675 if (soap_out_PointerToSOAP_ENV__Reason(soap, "SOAP-ENV:Reason", -1, &a->SOAP_ENV__Reason, "")) 676 return soap->error; 677 if (soap_out_string(soap, "SOAP-ENV:Node", -1, &a->SOAP_ENV__Node, "")) 678 return soap->error; 679 if (soap_out_string(soap, "SOAP-ENV:Role", -1, &a->SOAP_ENV__Role, "")) 680 return soap->error; 681 if (soap_out_PointerToSOAP_ENV__Detail(soap, "SOAP-ENV:Detail", -1, &a->SOAP_ENV__Detail, "")) 682 return soap->error; 683 return soap_element_end_out(soap, tag); 699 684 } 700 685 … … 702 687 { 703 688 if ((p = soap_in_SOAP_ENV__Fault(soap, tag, p, type))) 704 soap_getindependent(soap); 689 if (soap_getindependent(soap)) 690 return NULL; 705 691 return p; 706 692 } … … 708 694 SOAP_FMAC3 struct SOAP_ENV__Fault * SOAP_FMAC4 soap_in_SOAP_ENV__Fault(struct soap *soap, const char *tag, struct SOAP_ENV__Fault *a, const char *type) 709 695 { 710 short soap_flag_faultcode = 1, soap_flag_faultstring = 1, soap_flag_faultactor = 1, soap_flag_detail = 1, soap_flag_SOAP_ENV__Code = 1, soap_flag_SOAP_ENV__Reason = 1, soap_flag_SOAP_ENV__Node = 1, soap_flag_SOAP_ENV__Role = 1, soap_flag_SOAP_ENV__Detail = 1; 711 if (soap_element_begin_in(soap, tag, 0)) 712 return NULL; 713 if (*soap->type && soap_match_tag(soap, soap->type, type)) 714 { soap->error = SOAP_TYPE; 715 return NULL; 716 } 696 size_t soap_flag_faultcode = 1; 697 size_t soap_flag_faultstring = 1; 698 size_t soap_flag_faultactor = 1; 699 size_t soap_flag_detail = 1; 700 size_t soap_flag_SOAP_ENV__Code = 1; 701 size_t soap_flag_SOAP_ENV__Reason = 1; 702 size_t soap_flag_SOAP_ENV__Node = 1; 703 size_t soap_flag_SOAP_ENV__Role = 1; 704 size_t soap_flag_SOAP_ENV__Detail = 1; 705 if (soap_element_begin_in(soap, tag, 0, type)) 706 return NULL; 717 707 a = (struct SOAP_ENV__Fault *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Fault, sizeof(struct SOAP_ENV__Fault), 0, NULL, NULL, NULL); 718 708 if (!a) 719 709 return NULL; 720 if (soap->alloced) 721 soap_default_SOAP_ENV__Fault(soap, a); 710 soap_default_SOAP_ENV__Fault(soap, a); 722 711 if (soap->body && !*soap->href) 723 { for (;;) 712 { 713 for (;;) 724 714 { soap->error = SOAP_TAG_MISMATCH; 725 715 if (soap_flag_faultcode && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 726 716 if (soap_in__QName(soap, "faultcode", &a->faultcode, "")) 727 { soap_flag_faultcode = 0;717 { soap_flag_faultcode--; 728 718 continue; 729 719 } 730 720 if (soap_flag_faultstring && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 731 if (soap_in_string(soap, "faultstring", &a->faultstring, " "))732 { soap_flag_faultstring = 0;721 if (soap_in_string(soap, "faultstring", &a->faultstring, "xsd:string")) 722 { soap_flag_faultstring--; 733 723 continue; 734 724 } 735 725 if (soap_flag_faultactor && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 736 if (soap_in_string(soap, "faultactor", &a->faultactor, " "))737 { soap_flag_faultactor = 0;726 if (soap_in_string(soap, "faultactor", &a->faultactor, "xsd:string")) 727 { soap_flag_faultactor--; 738 728 continue; 739 729 } 740 730 if (soap_flag_detail && soap->error == SOAP_TAG_MISMATCH) 741 731 if (soap_in_PointerToSOAP_ENV__Detail(soap, "detail", &a->detail, "")) 742 { soap_flag_detail = 0;732 { soap_flag_detail--; 743 733 continue; 744 734 } 745 735 if (soap_flag_SOAP_ENV__Code && soap->error == SOAP_TAG_MISMATCH) 746 736 if (soap_in_PointerToSOAP_ENV__Code(soap, "SOAP-ENV:Code", &a->SOAP_ENV__Code, "")) 747 { soap_flag_SOAP_ENV__Code = 0;748 continue; 749 } 750 if (soap_flag_SOAP_ENV__Reason && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG))751 if (soap_in_ string(soap, "SOAP-ENV:Reason", &a->SOAP_ENV__Reason, ""))752 { soap_flag_SOAP_ENV__Reason = 0;737 { soap_flag_SOAP_ENV__Code--; 738 continue; 739 } 740 if (soap_flag_SOAP_ENV__Reason && soap->error == SOAP_TAG_MISMATCH) 741 if (soap_in_PointerToSOAP_ENV__Reason(soap, "SOAP-ENV:Reason", &a->SOAP_ENV__Reason, "")) 742 { soap_flag_SOAP_ENV__Reason--; 753 743 continue; 754 744 } 755 745 if (soap_flag_SOAP_ENV__Node && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 756 if (soap_in_string(soap, "SOAP-ENV:Node", &a->SOAP_ENV__Node, " "))757 { soap_flag_SOAP_ENV__Node = 0;746 if (soap_in_string(soap, "SOAP-ENV:Node", &a->SOAP_ENV__Node, "xsd:string")) 747 { soap_flag_SOAP_ENV__Node--; 758 748 continue; 759 749 } 760 750 if (soap_flag_SOAP_ENV__Role && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 761 if (soap_in_string(soap, "SOAP-ENV:Role", &a->SOAP_ENV__Role, " "))762 { soap_flag_SOAP_ENV__Role = 0;751 if (soap_in_string(soap, "SOAP-ENV:Role", &a->SOAP_ENV__Role, "xsd:string")) 752 { soap_flag_SOAP_ENV__Role--; 763 753 continue; 764 754 } 765 755 if (soap_flag_SOAP_ENV__Detail && soap->error == SOAP_TAG_MISMATCH) 766 756 if (soap_in_PointerToSOAP_ENV__Detail(soap, "SOAP-ENV:Detail", &a->SOAP_ENV__Detail, "")) 767 { soap_flag_SOAP_ENV__Detail = 0;757 { soap_flag_SOAP_ENV__Detail--; 768 758 continue; 769 759 } … … 779 769 } 780 770 else 781 { a = (struct SOAP_ENV__Fault *)soap_id_forward(soap, soap->href, (void* *)a, SOAP_TYPE_SOAP_ENV__Fault, 0, sizeof(struct SOAP_ENV__Fault), 0, NULL);771 { a = (struct SOAP_ENV__Fault *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Fault, 0, sizeof(struct SOAP_ENV__Fault), 0, NULL); 782 772 if (soap->body && soap_element_end_in(soap, tag)) 783 773 return NULL; … … 790 780 #ifndef WITH_NOGLOBAL 791 781 792 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Detail(struct soap *soap, const struct SOAP_ENV__Detail *a) 793 { 794 (void)soap; (void)a; /* appease -Wall -Werror */ 795 soap_markelement(soap, a->fault, a->__type); 796 } 797 798 SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Detail(struct soap *soap, struct SOAP_ENV__Detail *a) 799 { 800 (void)soap; (void)a; /* appease -Wall -Werror */ 801 a->__type = 0; 802 a->fault = NULL; 803 a->__any = NULL; 804 } 805 806 SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Detail(struct soap *soap, const struct SOAP_ENV__Detail *a, const char *tag, const char *type) 807 { 808 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENV__Detail); 809 if (soap_out_SOAP_ENV__Detail(soap, tag, id, a, type)) 810 return soap->error; 811 return soap_putindependent(soap); 812 } 813 814 SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Detail(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Detail *a, const char *type) 815 { 816 soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Detail), type); 817 soap_putelement(soap, a->fault, "fault", -1, a->__type); 818 soap_outliteral(soap, "-any", &a->__any); 819 soap_element_end_out(soap, tag); 820 return SOAP_OK; 821 } 822 823 SOAP_FMAC3 struct SOAP_ENV__Detail * SOAP_FMAC4 soap_get_SOAP_ENV__Detail(struct soap *soap, struct SOAP_ENV__Detail *p, const char *tag, const char *type) 824 { 825 if ((p = soap_in_SOAP_ENV__Detail(soap, tag, p, type))) 826 soap_getindependent(soap); 827 return p; 828 } 829 830 SOAP_FMAC3 struct SOAP_ENV__Detail * SOAP_FMAC4 soap_in_SOAP_ENV__Detail(struct soap *soap, const char *tag, struct SOAP_ENV__Detail *a, const char *type) 831 { 832 short soap_flag_fault = 1, soap_flag___any = 1; 833 if (soap_element_begin_in(soap, tag, 0)) 834 return NULL; 835 if (*soap->type && soap_match_tag(soap, soap->type, type)) 836 { soap->error = SOAP_TYPE; 837 return NULL; 838 } 839 a = (struct SOAP_ENV__Detail *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Detail, sizeof(struct SOAP_ENV__Detail), 0, NULL, NULL, NULL); 840 if (!a) 841 return NULL; 842 if (soap->alloced) 843 soap_default_SOAP_ENV__Detail(soap, a); 782 SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Reason(struct soap *soap, struct SOAP_ENV__Reason *a) 783 { 784 (void)soap; (void)a; /* appease -Wall -Werror */ 785 soap_default_string(soap, &a->SOAP_ENV__Text); 786 } 787 788 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Reason(struct soap *soap, const struct SOAP_ENV__Reason *a) 789 { 790 (void)soap; (void)a; /* appease -Wall -Werror */ 791 soap_serialize_string(soap, &a->SOAP_ENV__Text); 792 } 793 794 SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Reason(struct soap *soap, const struct SOAP_ENV__Reason *a, const char *tag, const char *type) 795 { 796 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENV__Reason); 797 if (soap_out_SOAP_ENV__Reason(soap, tag, id, a, type)) 798 return soap->error; 799 return soap_putindependent(soap); 800 } 801 802 SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Reason(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Reason *a, const char *type) 803 { 804 if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Reason), type)) 805 return soap->error; 806 if (soap->lang) 807 soap_set_attr(soap, "xml:lang", soap->lang); 808 if (soap_out_string(soap, "SOAP-ENV:Text", -1, &a->SOAP_ENV__Text, "")) 809 return soap->error; 810 return soap_element_end_out(soap, tag); 811 } 812 813 SOAP_FMAC3 struct SOAP_ENV__Reason * SOAP_FMAC4 soap_get_SOAP_ENV__Reason(struct soap *soap, struct SOAP_ENV__Reason *p, const char *tag, const char *type) 814 { 815 if ((p = soap_in_SOAP_ENV__Reason(soap, tag, p, type))) 816 if (soap_getindependent(soap)) 817 return NULL; 818 return p; 819 } 820 821 SOAP_FMAC3 struct SOAP_ENV__Reason * SOAP_FMAC4 soap_in_SOAP_ENV__Reason(struct soap *soap, const char *tag, struct SOAP_ENV__Reason *a, const char *type) 822 { 823 size_t soap_flag_SOAP_ENV__Text = 1; 824 if (soap_element_begin_in(soap, tag, 0, type)) 825 return NULL; 826 a = (struct SOAP_ENV__Reason *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Reason, sizeof(struct SOAP_ENV__Reason), 0, NULL, NULL, NULL); 827 if (!a) 828 return NULL; 829 soap_default_SOAP_ENV__Reason(soap, a); 844 830 if (soap->body && !*soap->href) 845 { for (;;) 831 { 832 for (;;) 846 833 { soap->error = SOAP_TAG_MISMATCH; 847 if (soap_flag_fault && soap->error == SOAP_TAG_MISMATCH) 848 if ((a->fault = soap_getelement(soap, &a->__type))) 849 { soap_flag_fault = 0; 850 continue; 851 } 852 if (soap_flag___any && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 853 if (soap_inliteral(soap, "-any", &a->__any)) 854 { soap_flag___any = 0; 834 if (soap_flag_SOAP_ENV__Text && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 835 if (soap_in_string(soap, "SOAP-ENV:Text", &a->SOAP_ENV__Text, "xsd:string")) 836 { soap_flag_SOAP_ENV__Text--; 855 837 continue; 856 838 } … … 866 848 } 867 849 else 868 { a = (struct SOAP_ENV__ Detail *)soap_id_forward(soap, soap->href, (void**)a, SOAP_TYPE_SOAP_ENV__Detail, 0, sizeof(struct SOAP_ENV__Detail), 0, NULL);850 { a = (struct SOAP_ENV__Reason *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Reason, 0, sizeof(struct SOAP_ENV__Reason), 0, NULL); 869 851 if (soap->body && soap_element_end_in(soap, tag)) 870 852 return NULL; … … 877 859 #ifndef WITH_NOGLOBAL 878 860 879 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Code(struct soap *soap, const struct SOAP_ENV__Code *a) 880 { 881 (void)soap; (void)a; /* appease -Wall -Werror */ 882 soap_embedded(soap, &a->SOAP_ENV__Value, SOAP_TYPE__QName); 883 soap_serialize__QName(soap, &a->SOAP_ENV__Value); 884 soap_embedded(soap, &a->SOAP_ENV__Subcode, SOAP_TYPE_PointerToSOAP_ENV__Code); 885 soap_serialize_PointerToSOAP_ENV__Code(soap, &a->SOAP_ENV__Subcode); 886 } 887 888 SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Code(struct soap *soap, struct SOAP_ENV__Code *a) 889 { 890 (void)soap; (void)a; /* appease -Wall -Werror */ 891 soap_default__QName(soap, &a->SOAP_ENV__Value); 892 a->SOAP_ENV__Subcode = NULL; 893 } 894 895 SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Code(struct soap *soap, const struct SOAP_ENV__Code *a, const char *tag, const char *type) 896 { 897 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENV__Code); 898 if (soap_out_SOAP_ENV__Code(soap, tag, id, a, type)) 899 return soap->error; 900 return soap_putindependent(soap); 901 } 902 903 SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Code(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Code *a, const char *type) 904 { 905 const char *soap_tmp_SOAP_ENV__Value = soap_QName2s(soap, a->SOAP_ENV__Value); 906 soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Code), type); 907 soap_out__QName(soap, "SOAP-ENV:Value", -1, (char*const*)&soap_tmp_SOAP_ENV__Value, ""); 908 soap_out_PointerToSOAP_ENV__Code(soap, "SOAP-ENV:Subcode", -1, &a->SOAP_ENV__Subcode, ""); 909 soap_element_end_out(soap, tag); 910 return SOAP_OK; 911 } 912 913 SOAP_FMAC3 struct SOAP_ENV__Code * SOAP_FMAC4 soap_get_SOAP_ENV__Code(struct soap *soap, struct SOAP_ENV__Code *p, const char *tag, const char *type) 914 { 915 if ((p = soap_in_SOAP_ENV__Code(soap, tag, p, type))) 916 soap_getindependent(soap); 917 return p; 918 } 919 920 SOAP_FMAC3 struct SOAP_ENV__Code * SOAP_FMAC4 soap_in_SOAP_ENV__Code(struct soap *soap, const char *tag, struct SOAP_ENV__Code *a, const char *type) 921 { 922 short soap_flag_SOAP_ENV__Value = 1, soap_flag_SOAP_ENV__Subcode = 1; 923 if (soap_element_begin_in(soap, tag, 0)) 924 return NULL; 925 if (*soap->type && soap_match_tag(soap, soap->type, type)) 926 { soap->error = SOAP_TYPE; 927 return NULL; 928 } 929 a = (struct SOAP_ENV__Code *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Code, sizeof(struct SOAP_ENV__Code), 0, NULL, NULL, NULL); 930 if (!a) 931 return NULL; 932 if (soap->alloced) 933 soap_default_SOAP_ENV__Code(soap, a); 861 SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Detail(struct soap *soap, struct SOAP_ENV__Detail *a) 862 { 863 (void)soap; (void)a; /* appease -Wall -Werror */ 864 a->__type = 0; 865 a->fault = NULL; 866 a->__any = NULL; 867 } 868 869 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Detail(struct soap *soap, const struct SOAP_ENV__Detail *a) 870 { 871 (void)soap; (void)a; /* appease -Wall -Werror */ 872 soap_markelement(soap, a->fault, a->__type); 873 } 874 875 SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Detail(struct soap *soap, const struct SOAP_ENV__Detail *a, const char *tag, const char *type) 876 { 877 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENV__Detail); 878 if (soap_out_SOAP_ENV__Detail(soap, tag, id, a, type)) 879 return soap->error; 880 return soap_putindependent(soap); 881 } 882 883 SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Detail(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Detail *a, const char *type) 884 { 885 if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Detail), type)) 886 return soap->error; 887 if (soap_putelement(soap, a->fault, "fault", -1, a->__type)) 888 return soap->error; 889 soap_outliteral(soap, "-any", &a->__any, NULL); 890 return soap_element_end_out(soap, tag); 891 } 892 893 SOAP_FMAC3 struct SOAP_ENV__Detail * SOAP_FMAC4 soap_get_SOAP_ENV__Detail(struct soap *soap, struct SOAP_ENV__Detail *p, const char *tag, const char *type) 894 { 895 if ((p = soap_in_SOAP_ENV__Detail(soap, tag, p, type))) 896 if (soap_getindependent(soap)) 897 return NULL; 898 return p; 899 } 900 901 SOAP_FMAC3 struct SOAP_ENV__Detail * SOAP_FMAC4 soap_in_SOAP_ENV__Detail(struct soap *soap, const char *tag, struct SOAP_ENV__Detail *a, const char *type) 902 { 903 size_t soap_flag_fault = 1; 904 size_t soap_flag___any = 1; 905 if (soap_element_begin_in(soap, tag, 0, type)) 906 return NULL; 907 a = (struct SOAP_ENV__Detail *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Detail, sizeof(struct SOAP_ENV__Detail), 0, NULL, NULL, NULL); 908 if (!a) 909 return NULL; 910 soap_default_SOAP_ENV__Detail(soap, a); 934 911 if (soap->body && !*soap->href) 935 { for (;;) 912 { 913 for (;;) 936 914 { soap->error = SOAP_TAG_MISMATCH; 937 if (soap_flag_ SOAP_ENV__Value && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG))938 if ( soap_in__QName(soap, "SOAP-ENV:Value", &a->SOAP_ENV__Value, ""))939 { soap_flag_ SOAP_ENV__Value= 0;940 continue; 941 } 942 if (soap_flag_ SOAP_ENV__Subcode && soap->error == SOAP_TAG_MISMATCH)943 if (soap_in _PointerToSOAP_ENV__Code(soap, "SOAP-ENV:Subcode", &a->SOAP_ENV__Subcode, ""))944 { soap_flag_ SOAP_ENV__Subcode = 0;915 if (soap_flag_fault && soap->error == SOAP_TAG_MISMATCH) 916 if ((a->fault = soap_getelement(soap, &a->__type))) 917 { soap_flag_fault = 0; 918 continue; 919 } 920 if (soap_flag___any && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 921 if (soap_inliteral(soap, "-any", &a->__any)) 922 { soap_flag___any--; 945 923 continue; 946 924 } … … 956 934 } 957 935 else 958 { a = (struct SOAP_ENV__ Code *)soap_id_forward(soap, soap->href, (void**)a, SOAP_TYPE_SOAP_ENV__Code, 0, sizeof(struct SOAP_ENV__Code), 0, NULL);936 { a = (struct SOAP_ENV__Detail *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Detail, 0, sizeof(struct SOAP_ENV__Detail), 0, NULL); 959 937 if (soap->body && soap_element_end_in(soap, tag)) 960 938 return NULL; … … 967 945 #ifndef WITH_NOGLOBAL 968 946 969 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Header(struct soap *soap, const struct SOAP_ENV__Header *a) 970 { 971 (void)soap; (void)a; /* appease -Wall -Werror */ 972 /* transient dummy skipped */ 973 } 974 975 SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Header(struct soap *soap, struct SOAP_ENV__Header *a) 976 { 977 (void)soap; (void)a; /* appease -Wall -Werror */ 978 /* transient dummy skipped */ 979 } 980 981 SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Header(struct soap *soap, const struct SOAP_ENV__Header *a, const char *tag, const char *type) 982 { 983 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENV__Header); 984 if (soap_out_SOAP_ENV__Header(soap, tag, id, a, type)) 985 return soap->error; 986 return soap_putindependent(soap); 987 } 988 989 SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Header(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Header *a, const char *type) 990 { 991 soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Header), type); 992 /* transient dummy skipped */ 993 soap_element_end_out(soap, tag); 994 return SOAP_OK; 995 } 996 997 SOAP_FMAC3 struct SOAP_ENV__Header * SOAP_FMAC4 soap_get_SOAP_ENV__Header(struct soap *soap, struct SOAP_ENV__Header *p, const char *tag, const char *type) 998 { 999 if ((p = soap_in_SOAP_ENV__Header(soap, tag, p, type))) 1000 soap_getindependent(soap); 1001 return p; 1002 } 1003 1004 SOAP_FMAC3 struct SOAP_ENV__Header * SOAP_FMAC4 soap_in_SOAP_ENV__Header(struct soap *soap, const char *tag, struct SOAP_ENV__Header *a, const char *type) 1005 {; 1006 if (soap_element_begin_in(soap, tag, 0)) 1007 return NULL; 1008 if (*soap->type && soap_match_tag(soap, soap->type, type)) 1009 { soap->error = SOAP_TYPE; 1010 return NULL; 1011 } 1012 a = (struct SOAP_ENV__Header *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Header, sizeof(struct SOAP_ENV__Header), 0, NULL, NULL, NULL); 1013 if (!a) 1014 return NULL; 1015 if (soap->alloced) 1016 soap_default_SOAP_ENV__Header(soap, a); 947 SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Code(struct soap *soap, struct SOAP_ENV__Code *a) 948 { 949 (void)soap; (void)a; /* appease -Wall -Werror */ 950 soap_default__QName(soap, &a->SOAP_ENV__Value); 951 a->SOAP_ENV__Subcode = NULL; 952 } 953 954 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Code(struct soap *soap, const struct SOAP_ENV__Code *a) 955 { 956 (void)soap; (void)a; /* appease -Wall -Werror */ 957 soap_serialize__QName(soap, &a->SOAP_ENV__Value); 958 soap_serialize_PointerToSOAP_ENV__Code(soap, &a->SOAP_ENV__Subcode); 959 } 960 961 SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Code(struct soap *soap, const struct SOAP_ENV__Code *a, const char *tag, const char *type) 962 { 963 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENV__Code); 964 if (soap_out_SOAP_ENV__Code(soap, tag, id, a, type)) 965 return soap->error; 966 return soap_putindependent(soap); 967 } 968 969 SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Code(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Code *a, const char *type) 970 { 971 const char *soap_tmp_SOAP_ENV__Value = soap_QName2s(soap, a->SOAP_ENV__Value); 972 if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Code), type)) 973 return soap->error; 974 if (soap_out__QName(soap, "SOAP-ENV:Value", -1, (char*const*)&soap_tmp_SOAP_ENV__Value, "")) 975 return soap->error; 976 if (soap_out_PointerToSOAP_ENV__Code(soap, "SOAP-ENV:Subcode", -1, &a->SOAP_ENV__Subcode, "")) 977 return soap->error; 978 return soap_element_end_out(soap, tag); 979 } 980 981 SOAP_FMAC3 struct SOAP_ENV__Code * SOAP_FMAC4 soap_get_SOAP_ENV__Code(struct soap *soap, struct SOAP_ENV__Code *p, const char *tag, const char *type) 982 { 983 if ((p = soap_in_SOAP_ENV__Code(soap, tag, p, type))) 984 if (soap_getindependent(soap)) 985 return NULL; 986 return p; 987 } 988 989 SOAP_FMAC3 struct SOAP_ENV__Code * SOAP_FMAC4 soap_in_SOAP_ENV__Code(struct soap *soap, const char *tag, struct SOAP_ENV__Code *a, const char *type) 990 { 991 size_t soap_flag_SOAP_ENV__Value = 1; 992 size_t soap_flag_SOAP_ENV__Subcode = 1; 993 if (soap_element_begin_in(soap, tag, 0, type)) 994 return NULL; 995 a = (struct SOAP_ENV__Code *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Code, sizeof(struct SOAP_ENV__Code), 0, NULL, NULL, NULL); 996 if (!a) 997 return NULL; 998 soap_default_SOAP_ENV__Code(soap, a); 1017 999 if (soap->body && !*soap->href) 1018 { for (;;) 1000 { 1001 for (;;) 1019 1002 { soap->error = SOAP_TAG_MISMATCH; 1020 /* transient dummy skipped */ 1003 if (soap_flag_SOAP_ENV__Value && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 1004 if (soap_in__QName(soap, "SOAP-ENV:Value", &a->SOAP_ENV__Value, "")) 1005 { soap_flag_SOAP_ENV__Value--; 1006 continue; 1007 } 1008 if (soap_flag_SOAP_ENV__Subcode && soap->error == SOAP_TAG_MISMATCH) 1009 if (soap_in_PointerToSOAP_ENV__Code(soap, "SOAP-ENV:Subcode", &a->SOAP_ENV__Subcode, "")) 1010 { soap_flag_SOAP_ENV__Subcode--; 1011 continue; 1012 } 1021 1013 if (soap->error == SOAP_TAG_MISMATCH) 1022 1014 soap->error = soap_ignore_element(soap); … … 1030 1022 } 1031 1023 else 1032 { a = (struct SOAP_ENV__ Header *)soap_id_forward(soap, soap->href, (void**)a, SOAP_TYPE_SOAP_ENV__Header, 0, sizeof(struct SOAP_ENV__Header), 0, NULL);1024 { a = (struct SOAP_ENV__Code *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Code, 0, sizeof(struct SOAP_ENV__Code), 0, NULL); 1033 1025 if (soap->body && soap_element_end_in(soap, tag)) 1034 1026 return NULL; … … 1039 1031 #endif 1040 1032 1041 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__stat_USCOREobject(struct soap *soap, const struct ns1__stat_USCOREobject *a) 1042 { 1043 (void)soap; (void)a; /* appease -Wall -Werror */ 1044 soap_embedded(soap, &a->key, SOAP_TYPE_string); 1045 soap_serialize_string(soap, &a->key); 1046 } 1047 1048 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__stat_USCOREobject(struct soap *soap, struct ns1__stat_USCOREobject *a) 1049 { 1050 (void)soap; (void)a; /* appease -Wall -Werror */ 1051 soap_default_string(soap, &a->key); 1052 } 1053 1054 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__stat_USCOREobject(struct soap *soap, const struct ns1__stat_USCOREobject *a, const char *tag, const char *type) 1055 { 1056 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__stat_USCOREobject); 1057 if (soap_out_ns1__stat_USCOREobject(soap, tag, id, a, type)) 1058 return soap->error; 1059 return soap_putindependent(soap); 1060 } 1061 1062 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__stat_USCOREobject(struct soap *soap, const char *tag, int id, const struct ns1__stat_USCOREobject *a, const char *type) 1063 { 1064 soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__stat_USCOREobject), type); 1065 soap_out_string(soap, "key", -1, &a->key, ""); 1066 soap_element_end_out(soap, tag); 1067 return SOAP_OK; 1068 } 1069 1070 SOAP_FMAC3 struct ns1__stat_USCOREobject * SOAP_FMAC4 soap_get_ns1__stat_USCOREobject(struct soap *soap, struct ns1__stat_USCOREobject *p, const char *tag, const char *type) 1071 { 1072 if ((p = soap_in_ns1__stat_USCOREobject(soap, tag, p, type))) 1073 soap_getindependent(soap); 1074 return p; 1075 } 1076 1077 SOAP_FMAC3 struct ns1__stat_USCOREobject * SOAP_FMAC4 soap_in_ns1__stat_USCOREobject(struct soap *soap, const char *tag, struct ns1__stat_USCOREobject *a, const char *type) 1078 { 1079 short soap_flag_key = 1; 1080 if (soap_element_begin_in(soap, tag, 0)) 1081 return NULL; 1082 if (*soap->type && soap_match_tag(soap, soap->type, type)) 1083 { soap->error = SOAP_TYPE; 1084 return NULL; 1085 } 1086 a = (struct ns1__stat_USCOREobject *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__stat_USCOREobject, sizeof(struct ns1__stat_USCOREobject), 0, NULL, NULL, NULL); 1087 if (!a) 1088 return NULL; 1089 if (soap->alloced) 1090 soap_default_ns1__stat_USCOREobject(soap, a); 1033 #ifndef WITH_NOGLOBAL 1034 1035 SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Header(struct soap *soap, struct SOAP_ENV__Header *a) 1036 { 1037 (void)soap; (void)a; /* appease -Wall -Werror */ 1038 } 1039 1040 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Header(struct soap *soap, const struct SOAP_ENV__Header *a) 1041 { 1042 (void)soap; (void)a; /* appease -Wall -Werror */ 1043 } 1044 1045 SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Header(struct soap *soap, const struct SOAP_ENV__Header *a, const char *tag, const char *type) 1046 { 1047 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENV__Header); 1048 if (soap_out_SOAP_ENV__Header(soap, tag, id, a, type)) 1049 return soap->error; 1050 return soap_putindependent(soap); 1051 } 1052 1053 SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Header(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Header *a, const char *type) 1054 { 1055 if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Header), type)) 1056 return soap->error; 1057 return soap_element_end_out(soap, tag); 1058 } 1059 1060 SOAP_FMAC3 struct SOAP_ENV__Header * SOAP_FMAC4 soap_get_SOAP_ENV__Header(struct soap *soap, struct SOAP_ENV__Header *p, const char *tag, const char *type) 1061 { 1062 if ((p = soap_in_SOAP_ENV__Header(soap, tag, p, type))) 1063 if (soap_getindependent(soap)) 1064 return NULL; 1065 return p; 1066 } 1067 1068 SOAP_FMAC3 struct SOAP_ENV__Header * SOAP_FMAC4 soap_in_SOAP_ENV__Header(struct soap *soap, const char *tag, struct SOAP_ENV__Header *a, const char *type) 1069 { 1070 if (soap_element_begin_in(soap, tag, 0, type)) 1071 return NULL; 1072 a = (struct SOAP_ENV__Header *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Header, sizeof(struct SOAP_ENV__Header), 0, NULL, NULL, NULL); 1073 if (!a) 1074 return NULL; 1075 soap_default_SOAP_ENV__Header(soap, a); 1091 1076 if (soap->body && !*soap->href) 1092 { for (;;) 1077 { 1078 for (;;) 1093 1079 { soap->error = SOAP_TAG_MISMATCH; 1094 if (soap_flag_key && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG))1095 if (soap_in_string(soap, "key", &a->key, ""))1096 { soap_flag_key = 0;1097 continue;1098 }1099 1080 if (soap->error == SOAP_TAG_MISMATCH) 1100 1081 soap->error = soap_ignore_element(soap); … … 1108 1089 } 1109 1090 else 1110 { a = (struct ns1__stat_USCOREobject *)soap_id_forward(soap, soap->href, (void**)a, SOAP_TYPE_ns1__stat_USCOREobject, 0, sizeof(struct ns1__stat_USCOREobject), 0, NULL); 1111 if (soap->body && soap_element_end_in(soap, tag)) 1112 return NULL; 1113 } 1114 return a; 1115 } 1116 1117 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__stat_USCOREobjectResponse(struct soap *soap, const struct ns1__stat_USCOREobjectResponse *a) 1118 { 1119 (void)soap; (void)a; /* appease -Wall -Werror */ 1120 soap_embedded(soap, &a->result, SOAP_TYPE_PointerToArrayOfString); 1121 soap_serialize_PointerToArrayOfString(soap, &a->result); 1122 } 1123 1124 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__stat_USCOREobjectResponse(struct soap *soap, struct ns1__stat_USCOREobjectResponse *a) 1125 { 1126 (void)soap; (void)a; /* appease -Wall -Werror */ 1127 a->result = NULL; 1128 } 1129 1130 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__stat_USCOREobjectResponse(struct soap *soap, const struct ns1__stat_USCOREobjectResponse *a, const char *tag, const char *type) 1131 { 1132 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__stat_USCOREobjectResponse); 1133 if (soap_out_ns1__stat_USCOREobjectResponse(soap, tag, id, a, type)) 1134 return soap->error; 1135 return soap_putindependent(soap); 1136 } 1137 1138 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__stat_USCOREobjectResponse(struct soap *soap, const char *tag, int id, const struct ns1__stat_USCOREobjectResponse *a, const char *type) 1139 { 1140 soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__stat_USCOREobjectResponse), type); 1141 if (a->result) 1142 soap_element_result(soap, "result"); 1143 soap_out_PointerToArrayOfString(soap, "result", -1, &a->result, ""); 1144 soap_element_end_out(soap, tag); 1145 return SOAP_OK; 1146 } 1147 1148 SOAP_FMAC3 struct ns1__stat_USCOREobjectResponse * SOAP_FMAC4 soap_get_ns1__stat_USCOREobjectResponse(struct soap *soap, struct ns1__stat_USCOREobjectResponse *p, const char *tag, const char *type) 1149 { 1150 if ((p = soap_in_ns1__stat_USCOREobjectResponse(soap, tag, p, type))) 1151 soap_getindependent(soap); 1152 return p; 1153 } 1154 1155 SOAP_FMAC3 struct ns1__stat_USCOREobjectResponse * SOAP_FMAC4 soap_in_ns1__stat_USCOREobjectResponse(struct soap *soap, const char *tag, struct ns1__stat_USCOREobjectResponse *a, const char *type) 1156 { 1157 short soap_flag_result = 1; 1158 if (soap_element_begin_in(soap, tag, 0)) 1159 return NULL; 1160 if (*soap->type && soap_match_tag(soap, soap->type, type)) 1161 { soap->error = SOAP_TYPE; 1162 return NULL; 1163 } 1164 a = (struct ns1__stat_USCOREobjectResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__stat_USCOREobjectResponse, sizeof(struct ns1__stat_USCOREobjectResponse), 0, NULL, NULL, NULL); 1165 if (!a) 1166 return NULL; 1167 if (soap->alloced) 1168 soap_default_ns1__stat_USCOREobjectResponse(soap, a); 1091 { a = (struct SOAP_ENV__Header *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Header, 0, sizeof(struct SOAP_ENV__Header), 0, NULL); 1092 if (soap->body && soap_element_end_in(soap, tag)) 1093 return NULL; 1094 } 1095 return a; 1096 } 1097 1098 #endif 1099 1100 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__stat_USCOREobject(struct soap *soap, struct ns1__stat_USCOREobject *a) 1101 { 1102 (void)soap; (void)a; /* appease -Wall -Werror */ 1103 soap_default_string(soap, &a->key); 1104 } 1105 1106 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__stat_USCOREobject(struct soap *soap, const struct ns1__stat_USCOREobject *a) 1107 { 1108 (void)soap; (void)a; /* appease -Wall -Werror */ 1109 soap_serialize_string(soap, &a->key); 1110 } 1111 1112 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__stat_USCOREobject(struct soap *soap, const struct ns1__stat_USCOREobject *a, const char *tag, const char *type) 1113 { 1114 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__stat_USCOREobject); 1115 if (soap_out_ns1__stat_USCOREobject(soap, tag, id, a, type)) 1116 return soap->error; 1117 return soap_putindependent(soap); 1118 } 1119 1120 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__stat_USCOREobject(struct soap *soap, const char *tag, int id, const struct ns1__stat_USCOREobject *a, const char *type) 1121 { 1122 if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__stat_USCOREobject), type)) 1123 return soap->error; 1124 if (soap_out_string(soap, "key", -1, &a->key, "")) 1125 return soap->error; 1126 return soap_element_end_out(soap, tag); 1127 } 1128 1129 SOAP_FMAC3 struct ns1__stat_USCOREobject * SOAP_FMAC4 soap_get_ns1__stat_USCOREobject(struct soap *soap, struct ns1__stat_USCOREobject *p, const char *tag, const char *type) 1130 { 1131 if ((p = soap_in_ns1__stat_USCOREobject(soap, tag, p, type))) 1132 if (soap_getindependent(soap)) 1133 return NULL; 1134 return p; 1135 } 1136 1137 SOAP_FMAC3 struct ns1__stat_USCOREobject * SOAP_FMAC4 soap_in_ns1__stat_USCOREobject(struct soap *soap, const char *tag, struct ns1__stat_USCOREobject *a, const char *type) 1138 { 1139 size_t soap_flag_key = 1; 1140 if (soap_element_begin_in(soap, tag, 0, type)) 1141 return NULL; 1142 a = (struct ns1__stat_USCOREobject *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__stat_USCOREobject, sizeof(struct ns1__stat_USCOREobject), 0, NULL, NULL, NULL); 1143 if (!a) 1144 return NULL; 1145 soap_default_ns1__stat_USCOREobject(soap, a); 1169 1146 if (soap->body && !*soap->href) 1170 { for (;;) 1147 { 1148 for (;;) 1171 1149 { soap->error = SOAP_TAG_MISMATCH; 1172 if (soap_flag_ result && soap->error == SOAP_TAG_MISMATCH)1173 if (soap_in_ PointerToArrayOfString(soap, "result", &a->result, "xsd:string"))1174 { soap_flag_ result = 0;1150 if (soap_flag_key && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 1151 if (soap_in_string(soap, "key", &a->key, "xsd:string")) 1152 { soap_flag_key--; 1175 1153 continue; 1176 1154 } … … 1186 1164 } 1187 1165 else 1188 { a = (struct ns1__stat_USCOREobjectResponse *)soap_id_forward(soap, soap->href, (void**)a, SOAP_TYPE_ns1__stat_USCOREobjectResponse, 0, sizeof(struct ns1__stat_USCOREobjectResponse), 0, NULL); 1189 if (soap->body && soap_element_end_in(soap, tag)) 1190 return NULL; 1191 } 1192 return a; 1193 } 1194 1195 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__delete_USCOREinstance(struct soap *soap, const struct ns1__delete_USCOREinstance *a) 1196 { 1197 (void)soap; (void)a; /* appease -Wall -Werror */ 1198 soap_embedded(soap, &a->uri, SOAP_TYPE_string); 1199 soap_serialize_string(soap, &a->uri); 1200 } 1201 1202 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__delete_USCOREinstance(struct soap *soap, struct ns1__delete_USCOREinstance *a) 1203 { 1204 (void)soap; (void)a; /* appease -Wall -Werror */ 1205 soap_default_string(soap, &a->uri); 1206 } 1207 1208 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__delete_USCOREinstance(struct soap *soap, const struct ns1__delete_USCOREinstance *a, const char *tag, const char *type) 1209 { 1210 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__delete_USCOREinstance); 1211 if (soap_out_ns1__delete_USCOREinstance(soap, tag, id, a, type)) 1212 return soap->error; 1213 return soap_putindependent(soap); 1214 } 1215 1216 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__delete_USCOREinstance(struct soap *soap, const char *tag, int id, const struct ns1__delete_USCOREinstance *a, const char *type) 1217 { 1218 soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__delete_USCOREinstance), type); 1219 soap_out_string(soap, "uri", -1, &a->uri, ""); 1220 soap_element_end_out(soap, tag); 1221 return SOAP_OK; 1222 } 1223 1224 SOAP_FMAC3 struct ns1__delete_USCOREinstance * SOAP_FMAC4 soap_get_ns1__delete_USCOREinstance(struct soap *soap, struct ns1__delete_USCOREinstance *p, const char *tag, const char *type) 1225 { 1226 if ((p = soap_in_ns1__delete_USCOREinstance(soap, tag, p, type))) 1227 soap_getindependent(soap); 1228 return p; 1229 } 1230 1231 SOAP_FMAC3 struct ns1__delete_USCOREinstance * SOAP_FMAC4 soap_in_ns1__delete_USCOREinstance(struct soap *soap, const char *tag, struct ns1__delete_USCOREinstance *a, const char *type) 1232 { 1233 short soap_flag_uri = 1; 1234 if (soap_element_begin_in(soap, tag, 0)) 1235 return NULL; 1236 if (*soap->type && soap_match_tag(soap, soap->type, type)) 1237 { soap->error = SOAP_TYPE; 1238 return NULL; 1239 } 1240 a = (struct ns1__delete_USCOREinstance *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__delete_USCOREinstance, sizeof(struct ns1__delete_USCOREinstance), 0, NULL, NULL, NULL); 1241 if (!a) 1242 return NULL; 1243 if (soap->alloced) 1244 soap_default_ns1__delete_USCOREinstance(soap, a); 1166 { a = (struct ns1__stat_USCOREobject *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__stat_USCOREobject, 0, sizeof(struct ns1__stat_USCOREobject), 0, NULL); 1167 if (soap->body && soap_element_end_in(soap, tag)) 1168 return NULL; 1169 } 1170 return a; 1171 } 1172 1173 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__stat_USCOREobjectResponse(struct soap *soap, struct ns1__stat_USCOREobjectResponse *a) 1174 { 1175 (void)soap; (void)a; /* appease -Wall -Werror */ 1176 a->result = NULL; 1177 } 1178 1179 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__stat_USCOREobjectResponse(struct soap *soap, const struct ns1__stat_USCOREobjectResponse *a) 1180 { 1181 (void)soap; (void)a; /* appease -Wall -Werror */ 1182 soap_serialize_PointerToArrayOfString(soap, &a->result); 1183 } 1184 1185 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__stat_USCOREobjectResponse(struct soap *soap, const struct ns1__stat_USCOREobjectResponse *a, const char *tag, const char *type) 1186 { 1187 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__stat_USCOREobjectResponse); 1188 if (soap_out_ns1__stat_USCOREobjectResponse(soap, tag, id, a, type)) 1189 return soap->error; 1190 return soap_putindependent(soap); 1191 } 1192 1193 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__stat_USCOREobjectResponse(struct soap *soap, const char *tag, int id, const struct ns1__stat_USCOREobjectResponse *a, const char *type) 1194 { 1195 if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__stat_USCOREobjectResponse), type)) 1196 return soap->error; 1197 if (soap_out_PointerToArrayOfString(soap, "result", -1, &a->result, "")) 1198 return soap->error; 1199 return soap_element_end_out(soap, tag); 1200 } 1201 1202 SOAP_FMAC3 struct ns1__stat_USCOREobjectResponse * SOAP_FMAC4 soap_get_ns1__stat_USCOREobjectResponse(struct soap *soap, struct ns1__stat_USCOREobjectResponse *p, const char *tag, const char *type) 1203 { 1204 if ((p = soap_in_ns1__stat_USCOREobjectResponse(soap, tag, p, type))) 1205 if (soap_getindependent(soap)) 1206 return NULL; 1207 return p; 1208 } 1209 1210 SOAP_FMAC3 struct ns1__stat_USCOREobjectResponse * SOAP_FMAC4 soap_in_ns1__stat_USCOREobjectResponse(struct soap *soap, const char *tag, struct ns1__stat_USCOREobjectResponse *a, const char *type) 1211 { 1212 size_t soap_flag_result = 1; 1213 if (soap_element_begin_in(soap, tag, 0, type)) 1214 return NULL; 1215 a = (struct ns1__stat_USCOREobjectResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__stat_USCOREobjectResponse, sizeof(struct ns1__stat_USCOREobjectResponse), 0, NULL, NULL, NULL); 1216 if (!a) 1217 return NULL; 1218 soap_default_ns1__stat_USCOREobjectResponse(soap, a); 1245 1219 if (soap->body && !*soap->href) 1246 { for (;;) 1220 { 1221 for (;;) 1247 1222 { soap->error = SOAP_TAG_MISMATCH; 1248 if (soap_flag_ uri && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG))1249 if (soap_in_ string(soap, "uri", &a->uri, ""))1250 { soap_flag_ uri = 0;1223 if (soap_flag_result && soap->error == SOAP_TAG_MISMATCH) 1224 if (soap_in_PointerToArrayOfString(soap, "result", &a->result, "xsd:string")) 1225 { soap_flag_result--; 1251 1226 continue; 1252 1227 } … … 1262 1237 } 1263 1238 else 1264 { a = (struct ns1__delete_USCOREinstance *)soap_id_forward(soap, soap->href, (void**)a, SOAP_TYPE_ns1__delete_USCOREinstance, 0, sizeof(struct ns1__delete_USCOREinstance), 0, NULL); 1265 if (soap->body && soap_element_end_in(soap, tag)) 1266 return NULL; 1267 } 1268 return a; 1269 } 1270 1271 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__delete_USCOREinstanceResponse(struct soap *soap, const struct ns1__delete_USCOREinstanceResponse *a) 1272 { 1273 (void)soap; (void)a; /* appease -Wall -Werror */ 1274 soap_embedded(soap, &a->result, SOAP_TYPE_PointerToint); 1275 soap_serialize_PointerToint(soap, &a->result); 1276 } 1277 1278 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__delete_USCOREinstanceResponse(struct soap *soap, struct ns1__delete_USCOREinstanceResponse *a) 1279 { 1280 (void)soap; (void)a; /* appease -Wall -Werror */ 1281 a->result = NULL; 1282 } 1283 1284 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__delete_USCOREinstanceResponse(struct soap *soap, const struct ns1__delete_USCOREinstanceResponse *a, const char *tag, const char *type) 1285 { 1286 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__delete_USCOREinstanceResponse); 1287 if (soap_out_ns1__delete_USCOREinstanceResponse(soap, tag, id, a, type)) 1288 return soap->error; 1289 return soap_putindependent(soap); 1290 } 1291 1292 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__delete_USCOREinstanceResponse(struct soap *soap, const char *tag, int id, const struct ns1__delete_USCOREinstanceResponse *a, const char *type) 1293 { 1294 soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__delete_USCOREinstanceResponse), type); 1295 if (a->result) 1296 soap_element_result(soap, "result"); 1297 soap_out_PointerToint(soap, "result", -1, &a->result, ""); 1298 soap_element_end_out(soap, tag); 1299 return SOAP_OK; 1300 } 1301 1302 SOAP_FMAC3 struct ns1__delete_USCOREinstanceResponse * SOAP_FMAC4 soap_get_ns1__delete_USCOREinstanceResponse(struct soap *soap, struct ns1__delete_USCOREinstanceResponse *p, const char *tag, const char *type) 1303 { 1304 if ((p = soap_in_ns1__delete_USCOREinstanceResponse(soap, tag, p, type))) 1305 soap_getindependent(soap); 1306 return p; 1307 } 1308 1309 SOAP_FMAC3 struct ns1__delete_USCOREinstanceResponse * SOAP_FMAC4 soap_in_ns1__delete_USCOREinstanceResponse(struct soap *soap, const char *tag, struct ns1__delete_USCOREinstanceResponse *a, const char *type) 1310 { 1311 short soap_flag_result = 1; 1312 if (soap_element_begin_in(soap, tag, 0)) 1313 return NULL; 1314 if (*soap->type && soap_match_tag(soap, soap->type, type)) 1315 { soap->error = SOAP_TYPE; 1316 return NULL; 1317 } 1318 a = (struct ns1__delete_USCOREinstanceResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__delete_USCOREinstanceResponse, sizeof(struct ns1__delete_USCOREinstanceResponse), 0, NULL, NULL, NULL); 1319 if (!a) 1320 return NULL; 1321 if (soap->alloced) 1322 soap_default_ns1__delete_USCOREinstanceResponse(soap, a); 1239 { a = (struct ns1__stat_USCOREobjectResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__stat_USCOREobjectResponse, 0, sizeof(struct ns1__stat_USCOREobjectResponse), 0, NULL); 1240 if (soap->body && soap_element_end_in(soap, tag)) 1241 return NULL; 1242 } 1243 return a; 1244 } 1245 1246 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__delete_USCOREinstance(struct soap *soap, struct ns1__delete_USCOREinstance *a) 1247 { 1248 (void)soap; (void)a; /* appease -Wall -Werror */ 1249 soap_default_string(soap, &a->uri); 1250 } 1251 1252 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__delete_USCOREinstance(struct soap *soap, const struct ns1__delete_USCOREinstance *a) 1253 { 1254 (void)soap; (void)a; /* appease -Wall -Werror */ 1255 soap_serialize_string(soap, &a->uri); 1256 } 1257 1258 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__delete_USCOREinstance(struct soap *soap, const struct ns1__delete_USCOREinstance *a, const char *tag, const char *type) 1259 { 1260 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__delete_USCOREinstance); 1261 if (soap_out_ns1__delete_USCOREinstance(soap, tag, id, a, type)) 1262 return soap->error; 1263 return soap_putindependent(soap); 1264 } 1265 1266 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__delete_USCOREinstance(struct soap *soap, const char *tag, int id, const struct ns1__delete_USCOREinstance *a, const char *type) 1267 { 1268 if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__delete_USCOREinstance), type)) 1269 return soap->error; 1270 if (soap_out_string(soap, "uri", -1, &a->uri, "")) 1271 return soap->error; 1272 return soap_element_end_out(soap, tag); 1273 } 1274 1275 SOAP_FMAC3 struct ns1__delete_USCOREinstance * SOAP_FMAC4 soap_get_ns1__delete_USCOREinstance(struct soap *soap, struct ns1__delete_USCOREinstance *p, const char *tag, const char *type) 1276 { 1277 if ((p = soap_in_ns1__delete_USCOREinstance(soap, tag, p, type))) 1278 if (soap_getindependent(soap)) 1279 return NULL; 1280 return p; 1281 } 1282 1283 SOAP_FMAC3 struct ns1__delete_USCOREinstance * SOAP_FMAC4 soap_in_ns1__delete_USCOREinstance(struct soap *soap, const char *tag, struct ns1__delete_USCOREinstance *a, const char *type) 1284 { 1285 size_t soap_flag_uri = 1; 1286 if (soap_element_begin_in(soap, tag, 0, type)) 1287 return NULL; 1288 a = (struct ns1__delete_USCOREinstance *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__delete_USCOREinstance, sizeof(struct ns1__delete_USCOREinstance), 0, NULL, NULL, NULL); 1289 if (!a) 1290 return NULL; 1291 soap_default_ns1__delete_USCOREinstance(soap, a); 1323 1292 if (soap->body && !*soap->href) 1324 { for (;;) 1293 { 1294 for (;;) 1325 1295 { soap->error = SOAP_TAG_MISMATCH; 1326 if (soap_flag_ result && soap->error == SOAP_TAG_MISMATCH)1327 if (soap_in_ PointerToint(soap, "result", &a->result, ""))1328 { soap_flag_ result = 0;1296 if (soap_flag_uri && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 1297 if (soap_in_string(soap, "uri", &a->uri, "xsd:string")) 1298 { soap_flag_uri--; 1329 1299 continue; 1330 1300 } … … 1340 1310 } 1341 1311 else 1342 { a = (struct ns1__delete_USCOREinstanceResponse *)soap_id_forward(soap, soap->href, (void**)a, SOAP_TYPE_ns1__delete_USCOREinstanceResponse, 0, sizeof(struct ns1__delete_USCOREinstanceResponse), 0, NULL); 1343 if (soap->body && soap_element_end_in(soap, tag)) 1344 return NULL; 1345 } 1346 return a; 1347 } 1348 1349 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__find_USCOREinstances(struct soap *soap, const struct ns1__find_USCOREinstances *a) 1350 { 1351 (void)soap; (void)a; /* appease -Wall -Werror */ 1352 soap_embedded(soap, &a->key, SOAP_TYPE_string); 1353 soap_serialize_string(soap, &a->key); 1354 soap_embedded(soap, &a->volume, SOAP_TYPE_string); 1355 soap_serialize_string(soap, &a->volume); 1356 } 1357 1358 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__find_USCOREinstances(struct soap *soap, struct ns1__find_USCOREinstances *a) 1359 { 1360 (void)soap; (void)a; /* appease -Wall -Werror */ 1361 soap_default_string(soap, &a->key); 1362 soap_default_string(soap, &a->volume); 1363 } 1364 1365 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__find_USCOREinstances(struct soap *soap, const struct ns1__find_USCOREinstances *a, const char *tag, const char *type) 1366 { 1367 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__find_USCOREinstances); 1368 if (soap_out_ns1__find_USCOREinstances(soap, tag, id, a, type)) 1369 return soap->error; 1370 return soap_putindependent(soap); 1371 } 1372 1373 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__find_USCOREinstances(struct soap *soap, const char *tag, int id, const struct ns1__find_USCOREinstances *a, const char *type) 1374 { 1375 soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__find_USCOREinstances), type); 1376 soap_out_string(soap, "key", -1, &a->key, ""); 1377 soap_out_string(soap, "volume", -1, &a->volume, ""); 1378 soap_element_end_out(soap, tag); 1379 return SOAP_OK; 1380 } 1381 1382 SOAP_FMAC3 struct ns1__find_USCOREinstances * SOAP_FMAC4 soap_get_ns1__find_USCOREinstances(struct soap *soap, struct ns1__find_USCOREinstances *p, const char *tag, const char *type) 1383 { 1384 if ((p = soap_in_ns1__find_USCOREinstances(soap, tag, p, type))) 1385 soap_getindependent(soap); 1386 return p; 1387 } 1388 1389 SOAP_FMAC3 struct ns1__find_USCOREinstances * SOAP_FMAC4 soap_in_ns1__find_USCOREinstances(struct soap *soap, const char *tag, struct ns1__find_USCOREinstances *a, const char *type) 1390 { 1391 short soap_flag_key = 1, soap_flag_volume = 1; 1392 if (soap_element_begin_in(soap, tag, 0)) 1393 return NULL; 1394 if (*soap->type && soap_match_tag(soap, soap->type, type)) 1395 { soap->error = SOAP_TYPE; 1396 return NULL; 1397 } 1398 a = (struct ns1__find_USCOREinstances *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__find_USCOREinstances, sizeof(struct ns1__find_USCOREinstances), 0, NULL, NULL, NULL); 1399 if (!a) 1400 return NULL; 1401 if (soap->alloced) 1402 soap_default_ns1__find_USCOREinstances(soap, a); 1312 { a = (struct ns1__delete_USCOREinstance *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__delete_USCOREinstance, 0, sizeof(struct ns1__delete_USCOREinstance), 0, NULL); 1313 if (soap->body && soap_element_end_in(soap, tag)) 1314 return NULL; 1315 } 1316 return a; 1317 } 1318 1319 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__delete_USCOREinstanceResponse(struct soap *soap, struct ns1__delete_USCOREinstanceResponse *a) 1320 { 1321 (void)soap; (void)a; /* appease -Wall -Werror */ 1322 a->result = NULL; 1323 } 1324 1325 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__delete_USCOREinstanceResponse(struct soap *soap, const struct ns1__delete_USCOREinstanceResponse *a) 1326 { 1327 (void)soap; (void)a; /* appease -Wall -Werror */ 1328 soap_serialize_PointerToint(soap, &a->result); 1329 } 1330 1331 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__delete_USCOREinstanceResponse(struct soap *soap, const struct ns1__delete_USCOREinstanceResponse *a, const char *tag, const char *type) 1332 { 1333 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__delete_USCOREinstanceResponse); 1334 if (soap_out_ns1__delete_USCOREinstanceResponse(soap, tag, id, a, type)) 1335 return soap->error; 1336 return soap_putindependent(soap); 1337 } 1338 1339 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__delete_USCOREinstanceResponse(struct soap *soap, const char *tag, int id, const struct ns1__delete_USCOREinstanceResponse *a, const char *type) 1340 { 1341 if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__delete_USCOREinstanceResponse), type)) 1342 return soap->error; 1343 if (soap_out_PointerToint(soap, "result", -1, &a->result, "")) 1344 return soap->error; 1345 return soap_element_end_out(soap, tag); 1346 } 1347 1348 SOAP_FMAC3 struct ns1__delete_USCOREinstanceResponse * SOAP_FMAC4 soap_get_ns1__delete_USCOREinstanceResponse(struct soap *soap, struct ns1__delete_USCOREinstanceResponse *p, const char *tag, const char *type) 1349 { 1350 if ((p = soap_in_ns1__delete_USCOREinstanceResponse(soap, tag, p, type))) 1351 if (soap_getindependent(soap)) 1352 return NULL; 1353 return p; 1354 } 1355 1356 SOAP_FMAC3 struct ns1__delete_USCOREinstanceResponse * SOAP_FMAC4 soap_in_ns1__delete_USCOREinstanceResponse(struct soap *soap, const char *tag, struct ns1__delete_USCOREinstanceResponse *a, const char *type) 1357 { 1358 size_t soap_flag_result = 1; 1359 if (soap_element_begin_in(soap, tag, 0, type)) 1360 return NULL; 1361 a = (struct ns1__delete_USCOREinstanceResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__delete_USCOREinstanceResponse, sizeof(struct ns1__delete_USCOREinstanceResponse), 0, NULL, NULL, NULL); 1362 if (!a) 1363 return NULL; 1364 soap_default_ns1__delete_USCOREinstanceResponse(soap, a); 1403 1365 if (soap->body && !*soap->href) 1404 { for (;;) 1366 { 1367 for (;;) 1405 1368 { soap->error = SOAP_TAG_MISMATCH; 1406 if (soap_flag_key && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 1407 if (soap_in_string(soap, "key", &a->key, "")) 1408 { soap_flag_key = 0; 1409 continue; 1410 } 1411 if (soap_flag_volume && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 1412 if (soap_in_string(soap, "volume", &a->volume, "")) 1413 { soap_flag_volume = 0; 1369 if (soap_flag_result && soap->error == SOAP_TAG_MISMATCH) 1370 if (soap_in_PointerToint(soap, "result", &a->result, "xsd:int")) 1371 { soap_flag_result--; 1414 1372 continue; 1415 1373 } … … 1425 1383 } 1426 1384 else 1427 { a = (struct ns1__find_USCOREinstances *)soap_id_forward(soap, soap->href, (void**)a, SOAP_TYPE_ns1__find_USCOREinstances, 0, sizeof(struct ns1__find_USCOREinstances), 0, NULL); 1428 if (soap->body && soap_element_end_in(soap, tag)) 1429 return NULL; 1430 } 1431 return a; 1432 } 1433 1434 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__find_USCOREinstancesResponse(struct soap *soap, const struct ns1__find_USCOREinstancesResponse *a) 1435 { 1436 (void)soap; (void)a; /* appease -Wall -Werror */ 1437 soap_embedded(soap, &a->result, SOAP_TYPE_PointerToArrayOfString); 1438 soap_serialize_PointerToArrayOfString(soap, &a->result); 1439 } 1440 1441 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__find_USCOREinstancesResponse(struct soap *soap, struct ns1__find_USCOREinstancesResponse *a) 1442 { 1443 (void)soap; (void)a; /* appease -Wall -Werror */ 1444 a->result = NULL; 1445 } 1446 1447 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__find_USCOREinstancesResponse(struct soap *soap, const struct ns1__find_USCOREinstancesResponse *a, const char *tag, const char *type) 1448 { 1449 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__find_USCOREinstancesResponse); 1450 if (soap_out_ns1__find_USCOREinstancesResponse(soap, tag, id, a, type)) 1451 return soap->error; 1452 return soap_putindependent(soap); 1453 } 1454 1455 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__find_USCOREinstancesResponse(struct soap *soap, const char *tag, int id, const struct ns1__find_USCOREinstancesResponse *a, const char *type) 1456 { 1457 soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__find_USCOREinstancesResponse), type); 1458 if (a->result) 1459 soap_element_result(soap, "result"); 1460 soap_out_PointerToArrayOfString(soap, "result", -1, &a->result, ""); 1461 soap_element_end_out(soap, tag); 1462 return SOAP_OK; 1463 } 1464 1465 SOAP_FMAC3 struct ns1__find_USCOREinstancesResponse * SOAP_FMAC4 soap_get_ns1__find_USCOREinstancesResponse(struct soap *soap, struct ns1__find_USCOREinstancesResponse *p, const char *tag, const char *type) 1466 { 1467 if ((p = soap_in_ns1__find_USCOREinstancesResponse(soap, tag, p, type))) 1468 soap_getindependent(soap); 1469 return p; 1470 } 1471 1472 SOAP_FMAC3 struct ns1__find_USCOREinstancesResponse * SOAP_FMAC4 soap_in_ns1__find_USCOREinstancesResponse(struct soap *soap, const char *tag, struct ns1__find_USCOREinstancesResponse *a, const char *type) 1473 { 1474 short soap_flag_result = 1; 1475 if (soap_element_begin_in(soap, tag, 0)) 1476 return NULL; 1477 if (*soap->type && soap_match_tag(soap, soap->type, type)) 1478 { soap->error = SOAP_TYPE; 1479 return NULL; 1480 } 1481 a = (struct ns1__find_USCOREinstancesResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__find_USCOREinstancesResponse, sizeof(struct ns1__find_USCOREinstancesResponse), 0, NULL, NULL, NULL); 1482 if (!a) 1483 return NULL; 1484 if (soap->alloced) 1485 soap_default_ns1__find_USCOREinstancesResponse(soap, a); 1385 { a = (struct ns1__delete_USCOREinstanceResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__delete_USCOREinstanceResponse, 0, sizeof(struct ns1__delete_USCOREinstanceResponse), 0, NULL); 1386 if (soap->body && soap_element_end_in(soap, tag)) 1387 return NULL; 1388 } 1389 return a; 1390 } 1391 1392 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__find_USCOREinstances(struct soap *soap, struct ns1__find_USCOREinstances *a) 1393 { 1394 (void)soap; (void)a; /* appease -Wall -Werror */ 1395 soap_default_string(soap, &a->key); 1396 soap_default_string(soap, &a->volume); 1397 } 1398 1399 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__find_USCOREinstances(struct soap *soap, const struct ns1__find_USCOREinstances *a) 1400 { 1401 (void)soap; (void)a; /* appease -Wall -Werror */ 1402 soap_serialize_string(soap, &a->key); 1403 soap_serialize_string(soap, &a->volume); 1404 } 1405 1406 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__find_USCOREinstances(struct soap *soap, const struct ns1__find_USCOREinstances *a, const char *tag, const char *type) 1407 { 1408 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__find_USCOREinstances); 1409 if (soap_out_ns1__find_USCOREinstances(soap, tag, id, a, type)) 1410 return soap->error; 1411 return soap_putindependent(soap); 1412 } 1413 1414 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__find_USCOREinstances(struct soap *soap, const char *tag, int id, const struct ns1__find_USCOREinstances *a, const char *type) 1415 { 1416 if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__find_USCOREinstances), type)) 1417 return soap->error; 1418 if (soap_out_string(soap, "key", -1, &a->key, "")) 1419 return soap->error; 1420 if (soap_out_string(soap, "volume", -1, &a->volume, "")) 1421 return soap->error; 1422 return soap_element_end_out(soap, tag); 1423 } 1424 1425 SOAP_FMAC3 struct ns1__find_USCOREinstances * SOAP_FMAC4 soap_get_ns1__find_USCOREinstances(struct soap *soap, struct ns1__find_USCOREinstances *p, const char *tag, const char *type) 1426 { 1427 if ((p = soap_in_ns1__find_USCOREinstances(soap, tag, p, type))) 1428 if (soap_getindependent(soap)) 1429 return NULL; 1430 return p; 1431 } 1432 1433 SOAP_FMAC3 struct ns1__find_USCOREinstances * SOAP_FMAC4 soap_in_ns1__find_USCOREinstances(struct soap *soap, const char *tag, struct ns1__find_USCOREinstances *a, const char *type) 1434 { 1435 size_t soap_flag_key = 1; 1436 size_t soap_flag_volume = 1; 1437 if (soap_element_begin_in(soap, tag, 0, type)) 1438 return NULL; 1439 a = (struct ns1__find_USCOREinstances *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__find_USCOREinstances, sizeof(struct ns1__find_USCOREinstances), 0, NULL, NULL, NULL); 1440 if (!a) 1441 return NULL; 1442 soap_default_ns1__find_USCOREinstances(soap, a); 1486 1443 if (soap->body && !*soap->href) 1487 { for (;;) 1444 { 1445 for (;;) 1488 1446 { soap->error = SOAP_TAG_MISMATCH; 1489 if (soap_flag_result && soap->error == SOAP_TAG_MISMATCH) 1490 if (soap_in_PointerToArrayOfString(soap, "result", &a->result, "xsd:string")) 1491 { soap_flag_result = 0; 1447 if (soap_flag_key && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 1448 if (soap_in_string(soap, "key", &a->key, "xsd:string")) 1449 { soap_flag_key--; 1450 continue; 1451 } 1452 if (soap_flag_volume && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 1453 if (soap_in_string(soap, "volume", &a->volume, "xsd:string")) 1454 { soap_flag_volume--; 1492 1455 continue; 1493 1456 } … … 1503 1466 } 1504 1467 else 1505 { a = (struct ns1__find_USCOREinstancesResponse *)soap_id_forward(soap, soap->href, (void**)a, SOAP_TYPE_ns1__find_USCOREinstancesResponse, 0, sizeof(struct ns1__find_USCOREinstancesResponse), 0, NULL); 1506 if (soap->body && soap_element_end_in(soap, tag)) 1507 return NULL; 1508 } 1509 return a; 1510 } 1511 1512 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__find_USCOREobjects(struct soap *soap, const struct ns1__find_USCOREobjects *a) 1513 { 1514 (void)soap; (void)a; /* appease -Wall -Werror */ 1515 soap_embedded(soap, &a->pattern, SOAP_TYPE_string); 1516 soap_serialize_string(soap, &a->pattern); 1517 } 1518 1519 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__find_USCOREobjects(struct soap *soap, struct ns1__find_USCOREobjects *a) 1520 { 1521 (void)soap; (void)a; /* appease -Wall -Werror */ 1522 soap_default_string(soap, &a->pattern); 1523 } 1524 1525 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__find_USCOREobjects(struct soap *soap, const struct ns1__find_USCOREobjects *a, const char *tag, const char *type) 1526 { 1527 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__find_USCOREobjects); 1528 if (soap_out_ns1__find_USCOREobjects(soap, tag, id, a, type)) 1529 return soap->error; 1530 return soap_putindependent(soap); 1531 } 1532 1533 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__find_USCOREobjects(struct soap *soap, const char *tag, int id, const struct ns1__find_USCOREobjects *a, const char *type) 1534 { 1535 soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__find_USCOREobjects), type); 1536 soap_out_string(soap, "pattern", -1, &a->pattern, ""); 1537 soap_element_end_out(soap, tag); 1538 return SOAP_OK; 1539 } 1540 1541 SOAP_FMAC3 struct ns1__find_USCOREobjects * SOAP_FMAC4 soap_get_ns1__find_USCOREobjects(struct soap *soap, struct ns1__find_USCOREobjects *p, const char *tag, const char *type) 1542 { 1543 if ((p = soap_in_ns1__find_USCOREobjects(soap, tag, p, type))) 1544 soap_getindependent(soap); 1545 return p; 1546 } 1547 1548 SOAP_FMAC3 struct ns1__find_USCOREobjects * SOAP_FMAC4 soap_in_ns1__find_USCOREobjects(struct soap *soap, const char *tag, struct ns1__find_USCOREobjects *a, const char *type) 1549 { 1550 short soap_flag_pattern = 1; 1551 if (soap_element_begin_in(soap, tag, 0)) 1552 return NULL; 1553 if (*soap->type && soap_match_tag(soap, soap->type, type)) 1554 { soap->error = SOAP_TYPE; 1555 return NULL; 1556 } 1557 a = (struct ns1__find_USCOREobjects *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__find_USCOREobjects, sizeof(struct ns1__find_USCOREobjects), 0, NULL, NULL, NULL); 1558 if (!a) 1559 return NULL; 1560 if (soap->alloced) 1561 soap_default_ns1__find_USCOREobjects(soap, a); 1468 { a = (struct ns1__find_USCOREinstances *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__find_USCOREinstances, 0, sizeof(struct ns1__find_USCOREinstances), 0, NULL); 1469 if (soap->body && soap_element_end_in(soap, tag)) 1470 return NULL; 1471 } 1472 return a; 1473 } 1474 1475 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__find_USCOREinstancesResponse(struct soap *soap, struct ns1__find_USCOREinstancesResponse *a) 1476 { 1477 (void)soap; (void)a; /* appease -Wall -Werror */ 1478 a->result = NULL; 1479 } 1480 1481 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__find_USCOREinstancesResponse(struct soap *soap, const struct ns1__find_USCOREinstancesResponse *a) 1482 { 1483 (void)soap; (void)a; /* appease -Wall -Werror */ 1484 soap_serialize_PointerToArrayOfString(soap, &a->result); 1485 } 1486 1487 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__find_USCOREinstancesResponse(struct soap *soap, const struct ns1__find_USCOREinstancesResponse *a, const char *tag, const char *type) 1488 { 1489 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__find_USCOREinstancesResponse); 1490 if (soap_out_ns1__find_USCOREinstancesResponse(soap, tag, id, a, type)) 1491 return soap->error; 1492 return soap_putindependent(soap); 1493 } 1494 1495 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__find_USCOREinstancesResponse(struct soap *soap, const char *tag, int id, const struct ns1__find_USCOREinstancesResponse *a, const char *type) 1496 { 1497 if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__find_USCOREinstancesResponse), type)) 1498 return soap->error; 1499 if (soap_out_PointerToArrayOfString(soap, "result", -1, &a->result, "")) 1500 return soap->error; 1501 return soap_element_end_out(soap, tag); 1502 } 1503 1504 SOAP_FMAC3 struct ns1__find_USCOREinstancesResponse * SOAP_FMAC4 soap_get_ns1__find_USCOREinstancesResponse(struct soap *soap, struct ns1__find_USCOREinstancesResponse *p, const char *tag, const char *type) 1505 { 1506 if ((p = soap_in_ns1__find_USCOREinstancesResponse(soap, tag, p, type))) 1507 if (soap_getindependent(soap)) 1508 return NULL; 1509 return p; 1510 } 1511 1512 SOAP_FMAC3 struct ns1__find_USCOREinstancesResponse * SOAP_FMAC4 soap_in_ns1__find_USCOREinstancesResponse(struct soap *soap, const char *tag, struct ns1__find_USCOREinstancesResponse *a, const char *type) 1513 { 1514 size_t soap_flag_result = 1; 1515 if (soap_element_begin_in(soap, tag, 0, type)) 1516 return NULL; 1517 a = (struct ns1__find_USCOREinstancesResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__find_USCOREinstancesResponse, sizeof(struct ns1__find_USCOREinstancesResponse), 0, NULL, NULL, NULL); 1518 if (!a) 1519 return NULL; 1520 soap_default_ns1__find_USCOREinstancesResponse(soap, a); 1562 1521 if (soap->body && !*soap->href) 1563 { for (;;) 1522 { 1523 for (;;) 1564 1524 { soap->error = SOAP_TAG_MISMATCH; 1565 if (soap_flag_ pattern && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG))1566 if (soap_in_ string(soap, "pattern", &a->pattern, ""))1567 { soap_flag_ pattern = 0;1525 if (soap_flag_result && soap->error == SOAP_TAG_MISMATCH) 1526 if (soap_in_PointerToArrayOfString(soap, "result", &a->result, "xsd:string")) 1527 { soap_flag_result--; 1568 1528 continue; 1569 1529 } … … 1579 1539 } 1580 1540 else 1581 { a = (struct ns1__find_USCOREobjects *)soap_id_forward(soap, soap->href, (void**)a, SOAP_TYPE_ns1__find_USCOREobjects, 0, sizeof(struct ns1__find_USCOREobjects), 0, NULL); 1582 if (soap->body && soap_element_end_in(soap, tag)) 1583 return NULL; 1584 } 1585 return a; 1586 } 1587 1588 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__find_USCOREobjectsResponse(struct soap *soap, const struct ns1__find_USCOREobjectsResponse *a) 1589 { 1590 (void)soap; (void)a; /* appease -Wall -Werror */ 1591 soap_embedded(soap, &a->result, SOAP_TYPE_PointerToArrayOfString); 1592 soap_serialize_PointerToArrayOfString(soap, &a->result); 1593 } 1594 1595 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__find_USCOREobjectsResponse(struct soap *soap, struct ns1__find_USCOREobjectsResponse *a) 1596 { 1597 (void)soap; (void)a; /* appease -Wall -Werror */ 1598 a->result = NULL; 1599 } 1600 1601 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__find_USCOREobjectsResponse(struct soap *soap, const struct ns1__find_USCOREobjectsResponse *a, const char *tag, const char *type) 1602 { 1603 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__find_USCOREobjectsResponse); 1604 if (soap_out_ns1__find_USCOREobjectsResponse(soap, tag, id, a, type)) 1605 return soap->error; 1606 return soap_putindependent(soap); 1607 } 1608 1609 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__find_USCOREobjectsResponse(struct soap *soap, const char *tag, int id, const struct ns1__find_USCOREobjectsResponse *a, const char *type) 1610 { 1611 soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__find_USCOREobjectsResponse), type); 1612 if (a->result) 1613 soap_element_result(soap, "result"); 1614 soap_out_PointerToArrayOfString(soap, "result", -1, &a->result, ""); 1615 soap_element_end_out(soap, tag); 1616 return SOAP_OK; 1617 } 1618 1619 SOAP_FMAC3 struct ns1__find_USCOREobjectsResponse * SOAP_FMAC4 soap_get_ns1__find_USCOREobjectsResponse(struct soap *soap, struct ns1__find_USCOREobjectsResponse *p, const char *tag, const char *type) 1620 { 1621 if ((p = soap_in_ns1__find_USCOREobjectsResponse(soap, tag, p, type))) 1622 soap_getindependent(soap); 1623 return p; 1624 } 1625 1626 SOAP_FMAC3 struct ns1__find_USCOREobjectsResponse * SOAP_FMAC4 soap_in_ns1__find_USCOREobjectsResponse(struct soap *soap, const char *tag, struct ns1__find_USCOREobjectsResponse *a, const char *type) 1627 { 1628 short soap_flag_result = 1; 1629 if (soap_element_begin_in(soap, tag, 0)) 1630 return NULL; 1631 if (*soap->type && soap_match_tag(soap, soap->type, type)) 1632 { soap->error = SOAP_TYPE; 1633 return NULL; 1634 } 1635 a = (struct ns1__find_USCOREobjectsResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__find_USCOREobjectsResponse, sizeof(struct ns1__find_USCOREobjectsResponse), 0, NULL, NULL, NULL); 1636 if (!a) 1637 return NULL; 1638 if (soap->alloced) 1639 soap_default_ns1__find_USCOREobjectsResponse(soap, a); 1541 { a = (struct ns1__find_USCOREinstancesResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__find_USCOREinstancesResponse, 0, sizeof(struct ns1__find_USCOREinstancesResponse), 0, NULL); 1542 if (soap->body && soap_element_end_in(soap, tag)) 1543 return NULL; 1544 } 1545 return a; 1546 } 1547 1548 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__find_USCOREobjects(struct soap *soap, struct ns1__find_USCOREobjects *a) 1549 { 1550 (void)soap; (void)a; /* appease -Wall -Werror */ 1551 soap_default_string(soap, &a->pattern); 1552 } 1553 1554 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__find_USCOREobjects(struct soap *soap, const struct ns1__find_USCOREobjects *a) 1555 { 1556 (void)soap; (void)a; /* appease -Wall -Werror */ 1557 soap_serialize_string(soap, &a->pattern); 1558 } 1559 1560 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__find_USCOREobjects(struct soap *soap, const struct ns1__find_USCOREobjects *a, const char *tag, const char *type) 1561 { 1562 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__find_USCOREobjects); 1563 if (soap_out_ns1__find_USCOREobjects(soap, tag, id, a, type)) 1564 return soap->error; 1565 return soap_putindependent(soap); 1566 } 1567 1568 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__find_USCOREobjects(struct soap *soap, const char *tag, int id, const struct ns1__find_USCOREobjects *a, const char *type) 1569 { 1570 if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__find_USCOREobjects), type)) 1571 return soap->error; 1572 if (soap_out_string(soap, "pattern", -1, &a->pattern, "")) 1573 return soap->error; 1574 return soap_element_end_out(soap, tag); 1575 } 1576 1577 SOAP_FMAC3 struct ns1__find_USCOREobjects * SOAP_FMAC4 soap_get_ns1__find_USCOREobjects(struct soap *soap, struct ns1__find_USCOREobjects *p, const char *tag, const char *type) 1578 { 1579 if ((p = soap_in_ns1__find_USCOREobjects(soap, tag, p, type))) 1580 if (soap_getindependent(soap)) 1581 return NULL; 1582 return p; 1583 } 1584 1585 SOAP_FMAC3 struct ns1__find_USCOREobjects * SOAP_FMAC4 soap_in_ns1__find_USCOREobjects(struct soap *soap, const char *tag, struct ns1__find_USCOREobjects *a, const char *type) 1586 { 1587 size_t soap_flag_pattern = 1; 1588 if (soap_element_begin_in(soap, tag, 0, type)) 1589 return NULL; 1590 a = (struct ns1__find_USCOREobjects *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__find_USCOREobjects, sizeof(struct ns1__find_USCOREobjects), 0, NULL, NULL, NULL); 1591 if (!a) 1592 return NULL; 1593 soap_default_ns1__find_USCOREobjects(soap, a); 1640 1594 if (soap->body && !*soap->href) 1641 { for (;;) 1595 { 1596 for (;;) 1642 1597 { soap->error = SOAP_TAG_MISMATCH; 1643 if (soap_flag_ result && soap->error == SOAP_TAG_MISMATCH)1644 if (soap_in_ PointerToArrayOfString(soap, "result", &a->result, "xsd:string"))1645 { soap_flag_ result = 0;1598 if (soap_flag_pattern && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 1599 if (soap_in_string(soap, "pattern", &a->pattern, "xsd:string")) 1600 { soap_flag_pattern--; 1646 1601 continue; 1647 1602 } … … 1657 1612 } 1658 1613 else 1659 { a = (struct ns1__find_USCOREobjectsResponse *)soap_id_forward(soap, soap->href, (void**)a, SOAP_TYPE_ns1__find_USCOREobjectsResponse, 0, sizeof(struct ns1__find_USCOREobjectsResponse), 0, NULL); 1660 if (soap->body && soap_element_end_in(soap, tag)) 1661 return NULL; 1662 } 1663 return a; 1664 } 1665 1666 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__unlock_USCOREobject(struct soap *soap, const struct ns1__unlock_USCOREobject *a) 1667 { 1668 (void)soap; (void)a; /* appease -Wall -Werror */ 1669 soap_embedded(soap, &a->key, SOAP_TYPE_string); 1670 soap_serialize_string(soap, &a->key); 1671 soap_embedded(soap, &a->type, SOAP_TYPE_string); 1672 soap_serialize_string(soap, &a->type); 1673 } 1674 1675 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__unlock_USCOREobject(struct soap *soap, struct ns1__unlock_USCOREobject *a) 1676 { 1677 (void)soap; (void)a; /* appease -Wall -Werror */ 1678 soap_default_string(soap, &a->key); 1679 soap_default_string(soap, &a->type); 1680 } 1681 1682 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__unlock_USCOREobject(struct soap *soap, const struct ns1__unlock_USCOREobject *a, const char *tag, const char *type) 1683 { 1684 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__unlock_USCOREobject); 1685 if (soap_out_ns1__unlock_USCOREobject(soap, tag, id, a, type)) 1686 return soap->error; 1687 return soap_putindependent(soap); 1688 } 1689 1690 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__unlock_USCOREobject(struct soap *soap, const char *tag, int id, const struct ns1__unlock_USCOREobject *a, const char *type) 1691 { 1692 soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__unlock_USCOREobject), type); 1693 soap_out_string(soap, "key", -1, &a->key, ""); 1694 soap_out_string(soap, "type", -1, &a->type, ""); 1695 soap_element_end_out(soap, tag); 1696 return SOAP_OK; 1697 } 1698 1699 SOAP_FMAC3 struct ns1__unlock_USCOREobject * SOAP_FMAC4 soap_get_ns1__unlock_USCOREobject(struct soap *soap, struct ns1__unlock_USCOREobject *p, const char *tag, const char *type) 1700 { 1701 if ((p = soap_in_ns1__unlock_USCOREobject(soap, tag, p, type))) 1702 soap_getindependent(soap); 1703 return p; 1704 } 1705 1706 SOAP_FMAC3 struct ns1__unlock_USCOREobject * SOAP_FMAC4 soap_in_ns1__unlock_USCOREobject(struct soap *soap, const char *tag, struct ns1__unlock_USCOREobject *a, const char *type) 1707 { 1708 short soap_flag_key = 1, soap_flag_type = 1; 1709 if (soap_element_begin_in(soap, tag, 0)) 1710 return NULL; 1711 if (*soap->type && soap_match_tag(soap, soap->type, type)) 1712 { soap->error = SOAP_TYPE; 1713 return NULL; 1714 } 1715 a = (struct ns1__unlock_USCOREobject *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__unlock_USCOREobject, sizeof(struct ns1__unlock_USCOREobject), 0, NULL, NULL, NULL); 1716 if (!a) 1717 return NULL; 1718 if (soap->alloced) 1719 soap_default_ns1__unlock_USCOREobject(soap, a); 1614 { a = (struct ns1__find_USCOREobjects *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__find_USCOREobjects, 0, sizeof(struct ns1__find_USCOREobjects), 0, NULL); 1615 if (soap->body && soap_element_end_in(soap, tag)) 1616 return NULL; 1617 } 1618 return a; 1619 } 1620 1621 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__find_USCOREobjectsResponse(struct soap *soap, struct ns1__find_USCOREobjectsResponse *a) 1622 { 1623 (void)soap; (void)a; /* appease -Wall -Werror */ 1624 a->result = NULL; 1625 } 1626 1627 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__find_USCOREobjectsResponse(struct soap *soap, const struct ns1__find_USCOREobjectsResponse *a) 1628 { 1629 (void)soap; (void)a; /* appease -Wall -Werror */ 1630 soap_serialize_PointerToArrayOfString(soap, &a->result); 1631 } 1632 1633 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__find_USCOREobjectsResponse(struct soap *soap, const struct ns1__find_USCOREobjectsResponse *a, const char *tag, const char *type) 1634 { 1635 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__find_USCOREobjectsResponse); 1636 if (soap_out_ns1__find_USCOREobjectsResponse(soap, tag, id, a, type)) 1637 return soap->error; 1638 return soap_putindependent(soap); 1639 } 1640 1641 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__find_USCOREobjectsResponse(struct soap *soap, const char *tag, int id, const struct ns1__find_USCOREobjectsResponse *a, const char *type) 1642 { 1643 if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__find_USCOREobjectsResponse), type)) 1644 return soap->error; 1645 if (soap_out_PointerToArrayOfString(soap, "result", -1, &a->result, "")) 1646 return soap->error; 1647 return soap_element_end_out(soap, tag); 1648 } 1649 1650 SOAP_FMAC3 struct ns1__find_USCOREobjectsResponse * SOAP_FMAC4 soap_get_ns1__find_USCOREobjectsResponse(struct soap *soap, struct ns1__find_USCOREobjectsResponse *p, const char *tag, const char *type) 1651 { 1652 if ((p = soap_in_ns1__find_USCOREobjectsResponse(soap, tag, p, type))) 1653 if (soap_getindependent(soap)) 1654 return NULL; 1655 return p; 1656 } 1657 1658 SOAP_FMAC3 struct ns1__find_USCOREobjectsResponse * SOAP_FMAC4 soap_in_ns1__find_USCOREobjectsResponse(struct soap *soap, const char *tag, struct ns1__find_USCOREobjectsResponse *a, const char *type) 1659 { 1660 size_t soap_flag_result = 1; 1661 if (soap_element_begin_in(soap, tag, 0, type)) 1662 return NULL; 1663 a = (struct ns1__find_USCOREobjectsResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__find_USCOREobjectsResponse, sizeof(struct ns1__find_USCOREobjectsResponse), 0, NULL, NULL, NULL); 1664 if (!a) 1665 return NULL; 1666 soap_default_ns1__find_USCOREobjectsResponse(soap, a); 1720 1667 if (soap->body && !*soap->href) 1721 { for (;;) 1668 { 1669 for (;;) 1722 1670 { soap->error = SOAP_TAG_MISMATCH; 1723 if (soap_flag_key && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 1724 if (soap_in_string(soap, "key", &a->key, "")) 1725 { soap_flag_key = 0; 1726 continue; 1727 } 1728 if (soap_flag_type && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 1729 if (soap_in_string(soap, "type", &a->type, "")) 1730 { soap_flag_type = 0; 1671 if (soap_flag_result && soap->error == SOAP_TAG_MISMATCH) 1672 if (soap_in_PointerToArrayOfString(soap, "result", &a->result, "xsd:string")) 1673 { soap_flag_result--; 1731 1674 continue; 1732 1675 } … … 1742 1685 } 1743 1686 else 1744 { a = (struct ns1__unlock_USCOREobject *)soap_id_forward(soap, soap->href, (void**)a, SOAP_TYPE_ns1__unlock_USCOREobject, 0, sizeof(struct ns1__unlock_USCOREobject), 0, NULL); 1745 if (soap->body && soap_element_end_in(soap, tag)) 1746 return NULL; 1747 } 1748 return a; 1749 } 1750 1751 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__unlock_USCOREobjectResponse(struct soap *soap, const struct ns1__unlock_USCOREobjectResponse *a) 1752 { 1753 (void)soap; (void)a; /* appease -Wall -Werror */ 1754 soap_embedded(soap, &a->result, SOAP_TYPE_PointerToint); 1755 soap_serialize_PointerToint(soap, &a->result); 1756 } 1757 1758 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__unlock_USCOREobjectResponse(struct soap *soap, struct ns1__unlock_USCOREobjectResponse *a) 1759 { 1760 (void)soap; (void)a; /* appease -Wall -Werror */ 1761 a->result = NULL; 1762 } 1763 1764 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__unlock_USCOREobjectResponse(struct soap *soap, const struct ns1__unlock_USCOREobjectResponse *a, const char *tag, const char *type) 1765 { 1766 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__unlock_USCOREobjectResponse); 1767 if (soap_out_ns1__unlock_USCOREobjectResponse(soap, tag, id, a, type)) 1768 return soap->error; 1769 return soap_putindependent(soap); 1770 } 1771 1772 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__unlock_USCOREobjectResponse(struct soap *soap, const char *tag, int id, const struct ns1__unlock_USCOREobjectResponse *a, const char *type) 1773 { 1774 soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__unlock_USCOREobjectResponse), type); 1775 if (a->result) 1776 soap_element_result(soap, "result"); 1777 soap_out_PointerToint(soap, "result", -1, &a->result, ""); 1778 soap_element_end_out(soap, tag); 1779 return SOAP_OK; 1780 } 1781 1782 SOAP_FMAC3 struct ns1__unlock_USCOREobjectResponse * SOAP_FMAC4 soap_get_ns1__unlock_USCOREobjectResponse(struct soap *soap, struct ns1__unlock_USCOREobjectResponse *p, const char *tag, const char *type) 1783 { 1784 if ((p = soap_in_ns1__unlock_USCOREobjectResponse(soap, tag, p, type))) 1785 soap_getindependent(soap); 1786 return p; 1787 } 1788 1789 SOAP_FMAC3 struct ns1__unlock_USCOREobjectResponse * SOAP_FMAC4 soap_in_ns1__unlock_USCOREobjectResponse(struct soap *soap, const char *tag, struct ns1__unlock_USCOREobjectResponse *a, const char *type) 1790 { 1791 short soap_flag_result = 1; 1792 if (soap_element_begin_in(soap, tag, 0)) 1793 return NULL; 1794 if (*soap->type && soap_match_tag(soap, soap->type, type)) 1795 { soap->error = SOAP_TYPE; 1796 return NULL; 1797 } 1798 a = (struct ns1__unlock_USCOREobjectResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__unlock_USCOREobjectResponse, sizeof(struct ns1__unlock_USCOREobjectResponse), 0, NULL, NULL, NULL); 1799 if (!a) 1800 return NULL; 1801 if (soap->alloced) 1802 soap_default_ns1__unlock_USCOREobjectResponse(soap, a); 1687 { a = (struct ns1__find_USCOREobjectsResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__find_USCOREobjectsResponse, 0, sizeof(struct ns1__find_USCOREobjectsResponse), 0, NULL); 1688 if (soap->body && soap_element_end_in(soap, tag)) 1689 return NULL; 1690 } 1691 return a; 1692 } 1693 1694 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__unlock_USCOREobject(struct soap *soap, struct ns1__unlock_USCOREobject *a) 1695 { 1696 (void)soap; (void)a; /* appease -Wall -Werror */ 1697 soap_default_string(soap, &a->key); 1698 soap_default_string(soap, &a->type); 1699 } 1700 1701 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__unlock_USCOREobject(struct soap *soap, const struct ns1__unlock_USCOREobject *a) 1702 { 1703 (void)soap; (void)a; /* appease -Wall -Werror */ 1704 soap_serialize_string(soap, &a->key); 1705 soap_serialize_string(soap, &a->type); 1706 } 1707 1708 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__unlock_USCOREobject(struct soap *soap, const struct ns1__unlock_USCOREobject *a, const char *tag, const char *type) 1709 { 1710 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__unlock_USCOREobject); 1711 if (soap_out_ns1__unlock_USCOREobject(soap, tag, id, a, type)) 1712 return soap->error; 1713 return soap_putindependent(soap); 1714 } 1715 1716 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__unlock_USCOREobject(struct soap *soap, const char *tag, int id, const struct ns1__unlock_USCOREobject *a, const char *type) 1717 { 1718 if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__unlock_USCOREobject), type)) 1719 return soap->error; 1720 if (soap_out_string(soap, "key", -1, &a->key, "")) 1721 return soap->error; 1722 if (soap_out_string(soap, "type", -1, &a->type, "")) 1723 return soap->error; 1724 return soap_element_end_out(soap, tag); 1725 } 1726 1727 SOAP_FMAC3 struct ns1__unlock_USCOREobject * SOAP_FMAC4 soap_get_ns1__unlock_USCOREobject(struct soap *soap, struct ns1__unlock_USCOREobject *p, const char *tag, const char *type) 1728 { 1729 if ((p = soap_in_ns1__unlock_USCOREobject(soap, tag, p, type))) 1730 if (soap_getindependent(soap)) 1731 return NULL; 1732 return p; 1733 } 1734 1735 SOAP_FMAC3 struct ns1__unlock_USCOREobject * SOAP_FMAC4 soap_in_ns1__unlock_USCOREobject(struct soap *soap, const char *tag, struct ns1__unlock_USCOREobject *a, const char *type) 1736 { 1737 size_t soap_flag_key = 1; 1738 size_t soap_flag_type = 1; 1739 if (soap_element_begin_in(soap, tag, 0, type)) 1740 return NULL; 1741 a = (struct ns1__unlock_USCOREobject *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__unlock_USCOREobject, sizeof(struct ns1__unlock_USCOREobject), 0, NULL, NULL, NULL); 1742 if (!a) 1743 return NULL; 1744 soap_default_ns1__unlock_USCOREobject(soap, a); 1803 1745 if (soap->body && !*soap->href) 1804 { for (;;) 1746 { 1747 for (;;) 1805 1748 { soap->error = SOAP_TAG_MISMATCH; 1806 if (soap_flag_result && soap->error == SOAP_TAG_MISMATCH) 1807 if (soap_in_PointerToint(soap, "result", &a->result, "")) 1808 { soap_flag_result = 0; 1749 if (soap_flag_key && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 1750 if (soap_in_string(soap, "key", &a->key, "xsd:string")) 1751 { soap_flag_key--; 1752 continue; 1753 } 1754 if (soap_flag_type && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 1755 if (soap_in_string(soap, "type", &a->type, "xsd:string")) 1756 { soap_flag_type--; 1809 1757 continue; 1810 1758 } … … 1820 1768 } 1821 1769 else 1822 { a = (struct ns1__unlock_USCOREobjectResponse *)soap_id_forward(soap, soap->href, (void**)a, SOAP_TYPE_ns1__unlock_USCOREobjectResponse, 0, sizeof(struct ns1__unlock_USCOREobjectResponse), 0, NULL); 1823 if (soap->body && soap_element_end_in(soap, tag)) 1824 return NULL; 1825 } 1826 return a; 1827 } 1828 1829 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__lock_USCOREobject(struct soap *soap, const struct ns1__lock_USCOREobject *a) 1830 { 1831 (void)soap; (void)a; /* appease -Wall -Werror */ 1832 soap_embedded(soap, &a->key, SOAP_TYPE_string); 1833 soap_serialize_string(soap, &a->key); 1834 soap_embedded(soap, &a->type, SOAP_TYPE_string); 1835 soap_serialize_string(soap, &a->type); 1836 } 1837 1838 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__lock_USCOREobject(struct soap *soap, struct ns1__lock_USCOREobject *a) 1839 { 1840 (void)soap; (void)a; /* appease -Wall -Werror */ 1841 soap_default_string(soap, &a->key); 1842 soap_default_string(soap, &a->type); 1843 } 1844 1845 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__lock_USCOREobject(struct soap *soap, const struct ns1__lock_USCOREobject *a, const char *tag, const char *type) 1846 { 1847 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__lock_USCOREobject); 1848 if (soap_out_ns1__lock_USCOREobject(soap, tag, id, a, type)) 1849 return soap->error; 1850 return soap_putindependent(soap); 1851 } 1852 1853 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__lock_USCOREobject(struct soap *soap, const char *tag, int id, const struct ns1__lock_USCOREobject *a, const char *type) 1854 { 1855 soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__lock_USCOREobject), type); 1856 soap_out_string(soap, "key", -1, &a->key, ""); 1857 soap_out_string(soap, "type", -1, &a->type, ""); 1858 soap_element_end_out(soap, tag); 1859 return SOAP_OK; 1860 } 1861 1862 SOAP_FMAC3 struct ns1__lock_USCOREobject * SOAP_FMAC4 soap_get_ns1__lock_USCOREobject(struct soap *soap, struct ns1__lock_USCOREobject *p, const char *tag, const char *type) 1863 { 1864 if ((p = soap_in_ns1__lock_USCOREobject(soap, tag, p, type))) 1865 soap_getindependent(soap); 1866 return p; 1867 } 1868 1869 SOAP_FMAC3 struct ns1__lock_USCOREobject * SOAP_FMAC4 soap_in_ns1__lock_USCOREobject(struct soap *soap, const char *tag, struct ns1__lock_USCOREobject *a, const char *type) 1870 { 1871 short soap_flag_key = 1, soap_flag_type = 1; 1872 if (soap_element_begin_in(soap, tag, 0)) 1873 return NULL; 1874 if (*soap->type && soap_match_tag(soap, soap->type, type)) 1875 { soap->error = SOAP_TYPE; 1876 return NULL; 1877 } 1878 a = (struct ns1__lock_USCOREobject *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__lock_USCOREobject, sizeof(struct ns1__lock_USCOREobject), 0, NULL, NULL, NULL); 1879 if (!a) 1880 return NULL; 1881 if (soap->alloced) 1882 soap_default_ns1__lock_USCOREobject(soap, a); 1770 { a = (struct ns1__unlock_USCOREobject *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__unlock_USCOREobject, 0, sizeof(struct ns1__unlock_USCOREobject), 0, NULL); 1771 if (soap->body && soap_element_end_in(soap, tag)) 1772 return NULL; 1773 } 1774 return a; 1775 } 1776 1777 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__unlock_USCOREobjectResponse(struct soap *soap, struct ns1__unlock_USCOREobjectResponse *a) 1778 { 1779 (void)soap; (void)a; /* appease -Wall -Werror */ 1780 a->result = NULL; 1781 } 1782 1783 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__unlock_USCOREobjectResponse(struct soap *soap, const struct ns1__unlock_USCOREobjectResponse *a) 1784 { 1785 (void)soap; (void)a; /* appease -Wall -Werror */ 1786 soap_serialize_PointerToint(soap, &a->result); 1787 } 1788 1789 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__unlock_USCOREobjectResponse(struct soap *soap, const struct ns1__unlock_USCOREobjectResponse *a, const char *tag, const char *type) 1790 { 1791 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__unlock_USCOREobjectResponse); 1792 if (soap_out_ns1__unlock_USCOREobjectResponse(soap, tag, id, a, type)) 1793 return soap->error; 1794 return soap_putindependent(soap); 1795 } 1796 1797 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__unlock_USCOREobjectResponse(struct soap *soap, const char *tag, int id, const struct ns1__unlock_USCOREobjectResponse *a, const char *type) 1798 { 1799 if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__unlock_USCOREobjectResponse), type)) 1800 return soap->error; 1801 if (soap_out_PointerToint(soap, "result", -1, &a->result, "")) 1802 return soap->error; 1803 return soap_element_end_out(soap, tag); 1804 } 1805 1806 SOAP_FMAC3 struct ns1__unlock_USCOREobjectResponse * SOAP_FMAC4 soap_get_ns1__unlock_USCOREobjectResponse(struct soap *soap, struct ns1__unlock_USCOREobjectResponse *p, const char *tag, const char *type) 1807 { 1808 if ((p = soap_in_ns1__unlock_USCOREobjectResponse(soap, tag, p, type))) 1809 if (soap_getindependent(soap)) 1810 return NULL; 1811 return p; 1812 } 1813 1814 SOAP_FMAC3 struct ns1__unlock_USCOREobjectResponse * SOAP_FMAC4 soap_in_ns1__unlock_USCOREobjectResponse(struct soap *soap, const char *tag, struct ns1__unlock_USCOREobjectResponse *a, const char *type) 1815 { 1816 size_t soap_flag_result = 1; 1817 if (soap_element_begin_in(soap, tag, 0, type)) 1818 return NULL; 1819 a = (struct ns1__unlock_USCOREobjectResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__unlock_USCOREobjectResponse, sizeof(struct ns1__unlock_USCOREobjectResponse), 0, NULL, NULL, NULL); 1820 if (!a) 1821 return NULL; 1822 soap_default_ns1__unlock_USCOREobjectResponse(soap, a); 1883 1823 if (soap->body && !*soap->href) 1884 { for (;;) 1824 { 1825 for (;;) 1885 1826 { soap->error = SOAP_TAG_MISMATCH; 1886 if (soap_flag_key && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 1887 if (soap_in_string(soap, "key", &a->key, "")) 1888 { soap_flag_key = 0; 1889 continue; 1890 } 1891 if (soap_flag_type && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 1892 if (soap_in_string(soap, "type", &a->type, "")) 1893 { soap_flag_type = 0; 1827 if (soap_flag_result && soap->error == SOAP_TAG_MISMATCH) 1828 if (soap_in_PointerToint(soap, "result", &a->result, "xsd:int")) 1829 { soap_flag_result--; 1894 1830 continue; 1895 1831 } … … 1905 1841 } 1906 1842 else 1907 { a = (struct ns1__lock_USCOREobject *)soap_id_forward(soap, soap->href, (void**)a, SOAP_TYPE_ns1__lock_USCOREobject, 0, sizeof(struct ns1__lock_USCOREobject), 0, NULL); 1908 if (soap->body && soap_element_end_in(soap, tag)) 1909 return NULL; 1910 } 1911 return a; 1912 } 1913 1914 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__lock_USCOREobjectResponse(struct soap *soap, const struct ns1__lock_USCOREobjectResponse *a) 1915 { 1916 (void)soap; (void)a; /* appease -Wall -Werror */ 1917 soap_embedded(soap, &a->result, SOAP_TYPE_PointerToint); 1918 soap_serialize_PointerToint(soap, &a->result); 1919 } 1920 1921 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__lock_USCOREobjectResponse(struct soap *soap, struct ns1__lock_USCOREobjectResponse *a) 1922 { 1923 (void)soap; (void)a; /* appease -Wall -Werror */ 1924 a->result = NULL; 1925 } 1926 1927 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__lock_USCOREobjectResponse(struct soap *soap, const struct ns1__lock_USCOREobjectResponse *a, const char *tag, const char *type) 1928 { 1929 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__lock_USCOREobjectResponse); 1930 if (soap_out_ns1__lock_USCOREobjectResponse(soap, tag, id, a, type)) 1931 return soap->error; 1932 return soap_putindependent(soap); 1933 } 1934 1935 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__lock_USCOREobjectResponse(struct soap *soap, const char *tag, int id, const struct ns1__lock_USCOREobjectResponse *a, const char *type) 1936 { 1937 soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__lock_USCOREobjectResponse), type); 1938 if (a->result) 1939 soap_element_result(soap, "result"); 1940 soap_out_PointerToint(soap, "result", -1, &a->result, ""); 1941 soap_element_end_out(soap, tag); 1942 return SOAP_OK; 1943 } 1944 1945 SOAP_FMAC3 struct ns1__lock_USCOREobjectResponse * SOAP_FMAC4 soap_get_ns1__lock_USCOREobjectResponse(struct soap *soap, struct ns1__lock_USCOREobjectResponse *p, const char *tag, const char *type) 1946 { 1947 if ((p = soap_in_ns1__lock_USCOREobjectResponse(soap, tag, p, type))) 1948 soap_getindependent(soap); 1949 return p; 1950 } 1951 1952 SOAP_FMAC3 struct ns1__lock_USCOREobjectResponse * SOAP_FMAC4 soap_in_ns1__lock_USCOREobjectResponse(struct soap *soap, const char *tag, struct ns1__lock_USCOREobjectResponse *a, const char *type) 1953 { 1954 short soap_flag_result = 1; 1955 if (soap_element_begin_in(soap, tag, 0)) 1956 return NULL; 1957 if (*soap->type && soap_match_tag(soap, soap->type, type)) 1958 { soap->error = SOAP_TYPE; 1959 return NULL; 1960 } 1961 a = (struct ns1__lock_USCOREobjectResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__lock_USCOREobjectResponse, sizeof(struct ns1__lock_USCOREobjectResponse), 0, NULL, NULL, NULL); 1962 if (!a) 1963 return NULL; 1964 if (soap->alloced) 1965 soap_default_ns1__lock_USCOREobjectResponse(soap, a); 1843 { a = (struct ns1__unlock_USCOREobjectResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__unlock_USCOREobjectResponse, 0, sizeof(struct ns1__unlock_USCOREobjectResponse), 0, NULL); 1844 if (soap->body && soap_element_end_in(soap, tag)) 1845 return NULL; 1846 } 1847 return a; 1848 } 1849 1850 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__lock_USCOREobject(struct soap *soap, struct ns1__lock_USCOREobject *a) 1851 { 1852 (void)soap; (void)a; /* appease -Wall -Werror */ 1853 soap_default_string(soap, &a->key); 1854 soap_default_string(soap, &a->type); 1855 } 1856 1857 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__lock_USCOREobject(struct soap *soap, const struct ns1__lock_USCOREobject *a) 1858 { 1859 (void)soap; (void)a; /* appease -Wall -Werror */ 1860 soap_serialize_string(soap, &a->key); 1861 soap_serialize_string(soap, &a->type); 1862 } 1863 1864 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__lock_USCOREobject(struct soap *soap, const struct ns1__lock_USCOREobject *a, const char *tag, const char *type) 1865 { 1866 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__lock_USCOREobject); 1867 if (soap_out_ns1__lock_USCOREobject(soap, tag, id, a, type)) 1868 return soap->error; 1869 return soap_putindependent(soap); 1870 } 1871 1872 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__lock_USCOREobject(struct soap *soap, const char *tag, int id, const struct ns1__lock_USCOREobject *a, const char *type) 1873 { 1874 if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__lock_USCOREobject), type)) 1875 return soap->error; 1876 if (soap_out_string(soap, "key", -1, &a->key, "")) 1877 return soap->error; 1878 if (soap_out_string(soap, "type", -1, &a->type, "")) 1879 return soap->error; 1880 return soap_element_end_out(soap, tag); 1881 } 1882 1883 SOAP_FMAC3 struct ns1__lock_USCOREobject * SOAP_FMAC4 soap_get_ns1__lock_USCOREobject(struct soap *soap, struct ns1__lock_USCOREobject *p, const char *tag, const char *type) 1884 { 1885 if ((p = soap_in_ns1__lock_USCOREobject(soap, tag, p, type))) 1886 if (soap_getindependent(soap)) 1887 return NULL; 1888 return p; 1889 } 1890 1891 SOAP_FMAC3 struct ns1__lock_USCOREobject * SOAP_FMAC4 soap_in_ns1__lock_USCOREobject(struct soap *soap, const char *tag, struct ns1__lock_USCOREobject *a, const char *type) 1892 { 1893 size_t soap_flag_key = 1; 1894 size_t soap_flag_type = 1; 1895 if (soap_element_begin_in(soap, tag, 0, type)) 1896 return NULL; 1897 a = (struct ns1__lock_USCOREobject *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__lock_USCOREobject, sizeof(struct ns1__lock_USCOREobject), 0, NULL, NULL, NULL); 1898 if (!a) 1899 return NULL; 1900 soap_default_ns1__lock_USCOREobject(soap, a); 1966 1901 if (soap->body && !*soap->href) 1967 { for (;;) 1902 { 1903 for (;;) 1968 1904 { soap->error = SOAP_TAG_MISMATCH; 1969 if (soap_flag_result && soap->error == SOAP_TAG_MISMATCH) 1970 if (soap_in_PointerToint(soap, "result", &a->result, "")) 1971 { soap_flag_result = 0; 1905 if (soap_flag_key && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 1906 if (soap_in_string(soap, "key", &a->key, "xsd:string")) 1907 { soap_flag_key--; 1908 continue; 1909 } 1910 if (soap_flag_type && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 1911 if (soap_in_string(soap, "type", &a->type, "xsd:string")) 1912 { soap_flag_type--; 1972 1913 continue; 1973 1914 } … … 1983 1924 } 1984 1925 else 1985 { a = (struct ns1__lock_USCOREobjectResponse *)soap_id_forward(soap, soap->href, (void**)a, SOAP_TYPE_ns1__lock_USCOREobjectResponse, 0, sizeof(struct ns1__lock_USCOREobjectResponse), 0, NULL); 1986 if (soap->body && soap_element_end_in(soap, tag)) 1987 return NULL; 1988 } 1989 return a; 1990 } 1991 1992 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__replicate_USCOREobject(struct soap *soap, const struct ns1__replicate_USCOREobject *a) 1993 { 1994 (void)soap; (void)a; /* appease -Wall -Werror */ 1995 soap_embedded(soap, &a->key, SOAP_TYPE_string); 1996 soap_serialize_string(soap, &a->key); 1997 soap_embedded(soap, &a->volume, SOAP_TYPE_string); 1998 soap_serialize_string(soap, &a->volume); 1999 } 2000 2001 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__replicate_USCOREobject(struct soap *soap, struct ns1__replicate_USCOREobject *a) 2002 { 2003 (void)soap; (void)a; /* appease -Wall -Werror */ 2004 soap_default_string(soap, &a->key); 2005 soap_default_string(soap, &a->volume); 2006 } 2007 2008 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__replicate_USCOREobject(struct soap *soap, const struct ns1__replicate_USCOREobject *a, const char *tag, const char *type) 2009 { 2010 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__replicate_USCOREobject); 2011 if (soap_out_ns1__replicate_USCOREobject(soap, tag, id, a, type)) 2012 return soap->error; 2013 return soap_putindependent(soap); 2014 } 2015 2016 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__replicate_USCOREobject(struct soap *soap, const char *tag, int id, const struct ns1__replicate_USCOREobject *a, const char *type) 2017 { 2018 soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__replicate_USCOREobject), type); 2019 soap_out_string(soap, "key", -1, &a->key, ""); 2020 soap_out_string(soap, "volume", -1, &a->volume, ""); 2021 soap_element_end_out(soap, tag); 2022 return SOAP_OK; 2023 } 2024 2025 SOAP_FMAC3 struct ns1__replicate_USCOREobject * SOAP_FMAC4 soap_get_ns1__replicate_USCOREobject(struct soap *soap, struct ns1__replicate_USCOREobject *p, const char *tag, const char *type) 2026 { 2027 if ((p = soap_in_ns1__replicate_USCOREobject(soap, tag, p, type))) 2028 soap_getindependent(soap); 2029 return p; 2030 } 2031 2032 SOAP_FMAC3 struct ns1__replicate_USCOREobject * SOAP_FMAC4 soap_in_ns1__replicate_USCOREobject(struct soap *soap, const char *tag, struct ns1__replicate_USCOREobject *a, const char *type) 2033 { 2034 short soap_flag_key = 1, soap_flag_volume = 1; 2035 if (soap_element_begin_in(soap, tag, 0)) 2036 return NULL; 2037 if (*soap->type && soap_match_tag(soap, soap->type, type)) 2038 { soap->error = SOAP_TYPE; 2039 return NULL; 2040 } 2041 a = (struct ns1__replicate_USCOREobject *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__replicate_USCOREobject, sizeof(struct ns1__replicate_USCOREobject), 0, NULL, NULL, NULL); 2042 if (!a) 2043 return NULL; 2044 if (soap->alloced) 2045 soap_default_ns1__replicate_USCOREobject(soap, a); 1926 { a = (struct ns1__lock_USCOREobject *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__lock_USCOREobject, 0, sizeof(struct ns1__lock_USCOREobject), 0, NULL); 1927 if (soap->body && soap_element_end_in(soap, tag)) 1928 return NULL; 1929 } 1930 return a; 1931 } 1932 1933 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__lock_USCOREobjectResponse(struct soap *soap, struct ns1__lock_USCOREobjectResponse *a) 1934 { 1935 (void)soap; (void)a; /* appease -Wall -Werror */ 1936 a->result = NULL; 1937 } 1938 1939 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__lock_USCOREobjectResponse(struct soap *soap, const struct ns1__lock_USCOREobjectResponse *a) 1940 { 1941 (void)soap; (void)a; /* appease -Wall -Werror */ 1942 soap_serialize_PointerToint(soap, &a->result); 1943 } 1944 1945 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__lock_USCOREobjectResponse(struct soap *soap, const struct ns1__lock_USCOREobjectResponse *a, const char *tag, const char *type) 1946 { 1947 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__lock_USCOREobjectResponse); 1948 if (soap_out_ns1__lock_USCOREobjectResponse(soap, tag, id, a, type)) 1949 return soap->error; 1950 return soap_putindependent(soap); 1951 } 1952 1953 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__lock_USCOREobjectResponse(struct soap *soap, const char *tag, int id, const struct ns1__lock_USCOREobjectResponse *a, const char *type) 1954 { 1955 if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__lock_USCOREobjectResponse), type)) 1956 return soap->error; 1957 if (soap_out_PointerToint(soap, "result", -1, &a->result, "")) 1958 return soap->error; 1959 return soap_element_end_out(soap, tag); 1960 } 1961 1962 SOAP_FMAC3 struct ns1__lock_USCOREobjectResponse * SOAP_FMAC4 soap_get_ns1__lock_USCOREobjectResponse(struct soap *soap, struct ns1__lock_USCOREobjectResponse *p, const char *tag, const char *type) 1963 { 1964 if ((p = soap_in_ns1__lock_USCOREobjectResponse(soap, tag, p, type))) 1965 if (soap_getindependent(soap)) 1966 return NULL; 1967 return p; 1968 } 1969 1970 SOAP_FMAC3 struct ns1__lock_USCOREobjectResponse * SOAP_FMAC4 soap_in_ns1__lock_USCOREobjectResponse(struct soap *soap, const char *tag, struct ns1__lock_USCOREobjectResponse *a, const char *type) 1971 { 1972 size_t soap_flag_result = 1; 1973 if (soap_element_begin_in(soap, tag, 0, type)) 1974 return NULL; 1975 a = (struct ns1__lock_USCOREobjectResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__lock_USCOREobjectResponse, sizeof(struct ns1__lock_USCOREobjectResponse), 0, NULL, NULL, NULL); 1976 if (!a) 1977 return NULL; 1978 soap_default_ns1__lock_USCOREobjectResponse(soap, a); 2046 1979 if (soap->body && !*soap->href) 2047 { for (;;) 1980 { 1981 for (;;) 2048 1982 { soap->error = SOAP_TAG_MISMATCH; 2049 if (soap_flag_key && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 2050 if (soap_in_string(soap, "key", &a->key, "")) 2051 { soap_flag_key = 0; 2052 continue; 2053 } 2054 if (soap_flag_volume && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 2055 if (soap_in_string(soap, "volume", &a->volume, "")) 2056 { soap_flag_volume = 0; 1983 if (soap_flag_result && soap->error == SOAP_TAG_MISMATCH) 1984 if (soap_in_PointerToint(soap, "result", &a->result, "xsd:int")) 1985 { soap_flag_result--; 2057 1986 continue; 2058 1987 } … … 2068 1997 } 2069 1998 else 2070 { a = (struct ns1__replicate_USCOREobject *)soap_id_forward(soap, soap->href, (void**)a, SOAP_TYPE_ns1__replicate_USCOREobject, 0, sizeof(struct ns1__replicate_USCOREobject), 0, NULL); 2071 if (soap->body && soap_element_end_in(soap, tag)) 2072 return NULL; 2073 } 2074 return a; 2075 } 2076 2077 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__replicate_USCOREobjectResponse(struct soap *soap, const struct ns1__replicate_USCOREobjectResponse *a) 2078 { 2079 (void)soap; (void)a; /* appease -Wall -Werror */ 2080 soap_embedded(soap, &a->result, SOAP_TYPE_PointerTostring); 2081 soap_serialize_PointerTostring(soap, &a->result); 2082 } 2083 2084 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__replicate_USCOREobjectResponse(struct soap *soap, struct ns1__replicate_USCOREobjectResponse *a) 2085 { 2086 (void)soap; (void)a; /* appease -Wall -Werror */ 2087 a->result = NULL; 2088 } 2089 2090 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__replicate_USCOREobjectResponse(struct soap *soap, const struct ns1__replicate_USCOREobjectResponse *a, const char *tag, const char *type) 2091 { 2092 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__replicate_USCOREobjectResponse); 2093 if (soap_out_ns1__replicate_USCOREobjectResponse(soap, tag, id, a, type)) 2094 return soap->error; 2095 return soap_putindependent(soap); 2096 } 2097 2098 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__replicate_USCOREobjectResponse(struct soap *soap, const char *tag, int id, const struct ns1__replicate_USCOREobjectResponse *a, const char *type) 2099 { 2100 soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__replicate_USCOREobjectResponse), type); 2101 if (a->result) 2102 soap_element_result(soap, "result"); 2103 soap_out_PointerTostring(soap, "result", -1, &a->result, ""); 2104 soap_element_end_out(soap, tag); 2105 return SOAP_OK; 2106 } 2107 2108 SOAP_FMAC3 struct ns1__replicate_USCOREobjectResponse * SOAP_FMAC4 soap_get_ns1__replicate_USCOREobjectResponse(struct soap *soap, struct ns1__replicate_USCOREobjectResponse *p, const char *tag, const char *type) 2109 { 2110 if ((p = soap_in_ns1__replicate_USCOREobjectResponse(soap, tag, p, type))) 2111 soap_getindependent(soap); 2112 return p; 2113 } 2114 2115 SOAP_FMAC3 struct ns1__replicate_USCOREobjectResponse * SOAP_FMAC4 soap_in_ns1__replicate_USCOREobjectResponse(struct soap *soap, const char *tag, struct ns1__replicate_USCOREobjectResponse *a, const char *type) 2116 { 2117 short soap_flag_result = 1; 2118 if (soap_element_begin_in(soap, tag, 0)) 2119 return NULL; 2120 if (*soap->type && soap_match_tag(soap, soap->type, type)) 2121 { soap->error = SOAP_TYPE; 2122 return NULL; 2123 } 2124 a = (struct ns1__replicate_USCOREobjectResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__replicate_USCOREobjectResponse, sizeof(struct ns1__replicate_USCOREobjectResponse), 0, NULL, NULL, NULL); 2125 if (!a) 2126 return NULL; 2127 if (soap->alloced) 2128 soap_default_ns1__replicate_USCOREobjectResponse(soap, a); 1999 { a = (struct ns1__lock_USCOREobjectResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__lock_USCOREobjectResponse, 0, sizeof(struct ns1__lock_USCOREobjectResponse), 0, NULL); 2000 if (soap->body && soap_element_end_in(soap, tag)) 2001 return NULL; 2002 } 2003 return a; 2004 } 2005 2006 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__replicate_USCOREobject(struct soap *soap, struct ns1__replicate_USCOREobject *a) 2007 { 2008 (void)soap; (void)a; /* appease -Wall -Werror */ 2009 soap_default_string(soap, &a->key); 2010 soap_default_string(soap, &a->volume); 2011 } 2012 2013 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__replicate_USCOREobject(struct soap *soap, const struct ns1__replicate_USCOREobject *a) 2014 { 2015 (void)soap; (void)a; /* appease -Wall -Werror */ 2016 soap_serialize_string(soap, &a->key); 2017 soap_serialize_string(soap, &a->volume); 2018 } 2019 2020 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__replicate_USCOREobject(struct soap *soap, const struct ns1__replicate_USCOREobject *a, const char *tag, const char *type) 2021 { 2022 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__replicate_USCOREobject); 2023 if (soap_out_ns1__replicate_USCOREobject(soap, tag, id, a, type)) 2024 return soap->error; 2025 return soap_putindependent(soap); 2026 } 2027 2028 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__replicate_USCOREobject(struct soap *soap, const char *tag, int id, const struct ns1__replicate_USCOREobject *a, const char *type) 2029 { 2030 if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__replicate_USCOREobject), type)) 2031 return soap->error; 2032 if (soap_out_string(soap, "key", -1, &a->key, "")) 2033 return soap->error; 2034 if (soap_out_string(soap, "volume", -1, &a->volume, "")) 2035 return soap->error; 2036 return soap_element_end_out(soap, tag); 2037 } 2038 2039 SOAP_FMAC3 struct ns1__replicate_USCOREobject * SOAP_FMAC4 soap_get_ns1__replicate_USCOREobject(struct soap *soap, struct ns1__replicate_USCOREobject *p, const char *tag, const char *type) 2040 { 2041 if ((p = soap_in_ns1__replicate_USCOREobject(soap, tag, p, type))) 2042 if (soap_getindependent(soap)) 2043 return NULL; 2044 return p; 2045 } 2046 2047 SOAP_FMAC3 struct ns1__replicate_USCOREobject * SOAP_FMAC4 soap_in_ns1__replicate_USCOREobject(struct soap *soap, const char *tag, struct ns1__replicate_USCOREobject *a, const char *type) 2048 { 2049 size_t soap_flag_key = 1; 2050 size_t soap_flag_volume = 1; 2051 if (soap_element_begin_in(soap, tag, 0, type)) 2052 return NULL; 2053 a = (struct ns1__replicate_USCOREobject *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__replicate_USCOREobject, sizeof(struct ns1__replicate_USCOREobject), 0, NULL, NULL, NULL); 2054 if (!a) 2055 return NULL; 2056 soap_default_ns1__replicate_USCOREobject(soap, a); 2129 2057 if (soap->body && !*soap->href) 2130 { for (;;) 2058 { 2059 for (;;) 2131 2060 { soap->error = SOAP_TAG_MISMATCH; 2132 if (soap_flag_result && soap->error == SOAP_TAG_MISMATCH) 2133 if (soap_in_PointerTostring(soap, "result", &a->result, "")) 2134 { soap_flag_result = 0; 2061 if (soap_flag_key && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 2062 if (soap_in_string(soap, "key", &a->key, "xsd:string")) 2063 { soap_flag_key--; 2064 continue; 2065 } 2066 if (soap_flag_volume && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 2067 if (soap_in_string(soap, "volume", &a->volume, "xsd:string")) 2068 { soap_flag_volume--; 2135 2069 continue; 2136 2070 } … … 2146 2080 } 2147 2081 else 2148 { a = (struct ns1__replicate_USCOREobjectResponse *)soap_id_forward(soap, soap->href, (void**)a, SOAP_TYPE_ns1__replicate_USCOREobjectResponse, 0, sizeof(struct ns1__replicate_USCOREobjectResponse), 0, NULL); 2149 if (soap->body && soap_element_end_in(soap, tag)) 2150 return NULL; 2151 } 2152 return a; 2153 } 2154 2155 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__rename_USCOREobject_(struct soap *soap, const struct ns1__rename_USCOREobject_ *a) 2156 { 2157 (void)soap; (void)a; /* appease -Wall -Werror */ 2158 soap_embedded(soap, &a->key, SOAP_TYPE_string); 2159 soap_serialize_string(soap, &a->key); 2160 soap_embedded(soap, &a->newkey, SOAP_TYPE_string); 2161 soap_serialize_string(soap, &a->newkey); 2162 } 2163 2164 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__rename_USCOREobject_(struct soap *soap, struct ns1__rename_USCOREobject_ *a) 2165 { 2166 (void)soap; (void)a; /* appease -Wall -Werror */ 2167 soap_default_string(soap, &a->key); 2168 soap_default_string(soap, &a->newkey); 2169 } 2170 2171 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__rename_USCOREobject_(struct soap *soap, const struct ns1__rename_USCOREobject_ *a, const char *tag, const char *type) 2172 { 2173 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__rename_USCOREobject_); 2174 if (soap_out_ns1__rename_USCOREobject_(soap, tag, id, a, type)) 2175 return soap->error; 2176 return soap_putindependent(soap); 2177 } 2178 2179 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__rename_USCOREobject_(struct soap *soap, const char *tag, int id, const struct ns1__rename_USCOREobject_ *a, const char *type) 2180 { 2181 soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__rename_USCOREobject_), type); 2182 soap_out_string(soap, "key", -1, &a->key, ""); 2183 soap_out_string(soap, "newkey", -1, &a->newkey, ""); 2184 soap_element_end_out(soap, tag); 2185 return SOAP_OK; 2186 } 2187 2188 SOAP_FMAC3 struct ns1__rename_USCOREobject_ * SOAP_FMAC4 soap_get_ns1__rename_USCOREobject_(struct soap *soap, struct ns1__rename_USCOREobject_ *p, const char *tag, const char *type) 2189 { 2190 if ((p = soap_in_ns1__rename_USCOREobject_(soap, tag, p, type))) 2191 soap_getindependent(soap); 2192 return p; 2193 } 2194 2195 SOAP_FMAC3 struct ns1__rename_USCOREobject_ * SOAP_FMAC4 soap_in_ns1__rename_USCOREobject_(struct soap *soap, const char *tag, struct ns1__rename_USCOREobject_ *a, const char *type) 2196 { 2197 short soap_flag_key = 1, soap_flag_newkey = 1; 2198 if (soap_element_begin_in(soap, tag, 0)) 2199 return NULL; 2200 if (*soap->type && soap_match_tag(soap, soap->type, type)) 2201 { soap->error = SOAP_TYPE; 2202 return NULL; 2203 } 2204 a = (struct ns1__rename_USCOREobject_ *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__rename_USCOREobject_, sizeof(struct ns1__rename_USCOREobject_), 0, NULL, NULL, NULL); 2205 if (!a) 2206 return NULL; 2207 if (soap->alloced) 2208 soap_default_ns1__rename_USCOREobject_(soap, a); 2082 { a = (struct ns1__replicate_USCOREobject *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__replicate_USCOREobject, 0, sizeof(struct ns1__replicate_USCOREobject), 0, NULL); 2083 if (soap->body && soap_element_end_in(soap, tag)) 2084 return NULL; 2085 } 2086 return a; 2087 } 2088 2089 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__replicate_USCOREobjectResponse(struct soap *soap, struct ns1__replicate_USCOREobjectResponse *a) 2090 { 2091 (void)soap; (void)a; /* appease -Wall -Werror */ 2092 a->result = NULL; 2093 } 2094 2095 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__replicate_USCOREobjectResponse(struct soap *soap, const struct ns1__replicate_USCOREobjectResponse *a) 2096 { 2097 (void)soap; (void)a; /* appease -Wall -Werror */ 2098 soap_serialize_PointerTostring(soap, &a->result); 2099 } 2100 2101 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__replicate_USCOREobjectResponse(struct soap *soap, const struct ns1__replicate_USCOREobjectResponse *a, const char *tag, const char *type) 2102 { 2103 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__replicate_USCOREobjectResponse); 2104 if (soap_out_ns1__replicate_USCOREobjectResponse(soap, tag, id, a, type)) 2105 return soap->error; 2106 return soap_putindependent(soap); 2107 } 2108 2109 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__replicate_USCOREobjectResponse(struct soap *soap, const char *tag, int id, const struct ns1__replicate_USCOREobjectResponse *a, const char *type) 2110 { 2111 if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__replicate_USCOREobjectResponse), type)) 2112 return soap->error; 2113 if (soap_out_PointerTostring(soap, "result", -1, &a->result, "")) 2114 return soap->error; 2115 return soap_element_end_out(soap, tag); 2116 } 2117 2118 SOAP_FMAC3 struct ns1__replicate_USCOREobjectResponse * SOAP_FMAC4 soap_get_ns1__replicate_USCOREobjectResponse(struct soap *soap, struct ns1__replicate_USCOREobjectResponse *p, const char *tag, const char *type) 2119 { 2120 if ((p = soap_in_ns1__replicate_USCOREobjectResponse(soap, tag, p, type))) 2121 if (soap_getindependent(soap)) 2122 return NULL; 2123 return p; 2124 } 2125 2126 SOAP_FMAC3 struct ns1__replicate_USCOREobjectResponse * SOAP_FMAC4 soap_in_ns1__replicate_USCOREobjectResponse(struct soap *soap, const char *tag, struct ns1__replicate_USCOREobjectResponse *a, const char *type) 2127 { 2128 size_t soap_flag_result = 1; 2129 if (soap_element_begin_in(soap, tag, 0, type)) 2130 return NULL; 2131 a = (struct ns1__replicate_USCOREobjectResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__replicate_USCOREobjectResponse, sizeof(struct ns1__replicate_USCOREobjectResponse), 0, NULL, NULL, NULL); 2132 if (!a) 2133 return NULL; 2134 soap_default_ns1__replicate_USCOREobjectResponse(soap, a); 2209 2135 if (soap->body && !*soap->href) 2210 { for (;;) 2136 { 2137 for (;;) 2211 2138 { soap->error = SOAP_TAG_MISMATCH; 2212 if (soap_flag_key && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 2213 if (soap_in_string(soap, "key", &a->key, "")) 2214 { soap_flag_key = 0; 2215 continue; 2216 } 2217 if (soap_flag_newkey && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 2218 if (soap_in_string(soap, "newkey", &a->newkey, "")) 2219 { soap_flag_newkey = 0; 2139 if (soap_flag_result && soap->error == SOAP_TAG_MISMATCH) 2140 if (soap_in_PointerTostring(soap, "result", &a->result, "xsd:string")) 2141 { soap_flag_result--; 2220 2142 continue; 2221 2143 } … … 2231 2153 } 2232 2154 else 2233 { a = (struct ns1__rename_USCOREobject_ *)soap_id_forward(soap, soap->href, (void**)a, SOAP_TYPE_ns1__rename_USCOREobject_, 0, sizeof(struct ns1__rename_USCOREobject_), 0, NULL); 2234 if (soap->body && soap_element_end_in(soap, tag)) 2235 return NULL; 2236 } 2237 return a; 2238 } 2239 2240 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__rename_USCOREobject_Response(struct soap *soap, const struct ns1__rename_USCOREobject_Response *a) 2241 { 2242 (void)soap; (void)a; /* appease -Wall -Werror */ 2243 soap_embedded(soap, &a->result, SOAP_TYPE_PointerTostring); 2244 soap_serialize_PointerTostring(soap, &a->result); 2245 } 2246 2247 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__rename_USCOREobject_Response(struct soap *soap, struct ns1__rename_USCOREobject_Response *a) 2248 { 2249 (void)soap; (void)a; /* appease -Wall -Werror */ 2250 a->result = NULL; 2251 } 2252 2253 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__rename_USCOREobject_Response(struct soap *soap, const struct ns1__rename_USCOREobject_Response *a, const char *tag, const char *type) 2254 { 2255 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__rename_USCOREobject_Response); 2256 if (soap_out_ns1__rename_USCOREobject_Response(soap, tag, id, a, type)) 2257 return soap->error; 2258 return soap_putindependent(soap); 2259 } 2260 2261 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__rename_USCOREobject_Response(struct soap *soap, const char *tag, int id, const struct ns1__rename_USCOREobject_Response *a, const char *type) 2262 { 2263 soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__rename_USCOREobject_Response), type); 2264 if (a->result) 2265 soap_element_result(soap, "result"); 2266 soap_out_PointerTostring(soap, "result", -1, &a->result, ""); 2267 soap_element_end_out(soap, tag); 2268 return SOAP_OK; 2269 } 2270 2271 SOAP_FMAC3 struct ns1__rename_USCOREobject_Response * SOAP_FMAC4 soap_get_ns1__rename_USCOREobject_Response(struct soap *soap, struct ns1__rename_USCOREobject_Response *p, const char *tag, const char *type) 2272 { 2273 if ((p = soap_in_ns1__rename_USCOREobject_Response(soap, tag, p, type))) 2274 soap_getindependent(soap); 2275 return p; 2276 } 2277 2278 SOAP_FMAC3 struct ns1__rename_USCOREobject_Response * SOAP_FMAC4 soap_in_ns1__rename_USCOREobject_Response(struct soap *soap, const char *tag, struct ns1__rename_USCOREobject_Response *a, const char *type) 2279 { 2280 short soap_flag_result = 1; 2281 if (soap_element_begin_in(soap, tag, 0)) 2282 return NULL; 2283 if (*soap->type && soap_match_tag(soap, soap->type, type)) 2284 { soap->error = SOAP_TYPE; 2285 return NULL; 2286 } 2287 a = (struct ns1__rename_USCOREobject_Response *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__rename_USCOREobject_Response, sizeof(struct ns1__rename_USCOREobject_Response), 0, NULL, NULL, NULL); 2288 if (!a) 2289 return NULL; 2290 if (soap->alloced) 2291 soap_default_ns1__rename_USCOREobject_Response(soap, a); 2155 { a = (struct ns1__replicate_USCOREobjectResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__replicate_USCOREobjectResponse, 0, sizeof(struct ns1__replicate_USCOREobjectResponse), 0, NULL); 2156 if (soap->body && soap_element_end_in(soap, tag)) 2157 return NULL; 2158 } 2159 return a; 2160 } 2161 2162 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__rename_USCOREobject_(struct soap *soap, struct ns1__rename_USCOREobject_ *a) 2163 { 2164 (void)soap; (void)a; /* appease -Wall -Werror */ 2165 soap_default_string(soap, &a->key); 2166 soap_default_string(soap, &a->newkey); 2167 } 2168 2169 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__rename_USCOREobject_(struct soap *soap, const struct ns1__rename_USCOREobject_ *a) 2170 { 2171 (void)soap; (void)a; /* appease -Wall -Werror */ 2172 soap_serialize_string(soap, &a->key); 2173 soap_serialize_string(soap, &a->newkey); 2174 } 2175 2176 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__rename_USCOREobject_(struct soap *soap, const struct ns1__rename_USCOREobject_ *a, const char *tag, const char *type) 2177 { 2178 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__rename_USCOREobject_); 2179 if (soap_out_ns1__rename_USCOREobject_(soap, tag, id, a, type)) 2180 return soap->error; 2181 return soap_putindependent(soap); 2182 } 2183 2184 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__rename_USCOREobject_(struct soap *soap, const char *tag, int id, const struct ns1__rename_USCOREobject_ *a, const char *type) 2185 { 2186 if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__rename_USCOREobject_), type)) 2187 return soap->error; 2188 if (soap_out_string(soap, "key", -1, &a->key, "")) 2189 return soap->error; 2190 if (soap_out_string(soap, "newkey", -1, &a->newkey, "")) 2191 return soap->error; 2192 return soap_element_end_out(soap, tag); 2193 } 2194 2195 SOAP_FMAC3 struct ns1__rename_USCOREobject_ * SOAP_FMAC4 soap_get_ns1__rename_USCOREobject_(struct soap *soap, struct ns1__rename_USCOREobject_ *p, const char *tag, const char *type) 2196 { 2197 if ((p = soap_in_ns1__rename_USCOREobject_(soap, tag, p, type))) 2198 if (soap_getindependent(soap)) 2199 return NULL; 2200 return p; 2201 } 2202 2203 SOAP_FMAC3 struct ns1__rename_USCOREobject_ * SOAP_FMAC4 soap_in_ns1__rename_USCOREobject_(struct soap *soap, const char *tag, struct ns1__rename_USCOREobject_ *a, const char *type) 2204 { 2205 size_t soap_flag_key = 1; 2206 size_t soap_flag_newkey = 1; 2207 if (soap_element_begin_in(soap, tag, 0, type)) 2208 return NULL; 2209 a = (struct ns1__rename_USCOREobject_ *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__rename_USCOREobject_, sizeof(struct ns1__rename_USCOREobject_), 0, NULL, NULL, NULL); 2210 if (!a) 2211 return NULL; 2212 soap_default_ns1__rename_USCOREobject_(soap, a); 2292 2213 if (soap->body && !*soap->href) 2293 { for (;;) 2214 { 2215 for (;;) 2294 2216 { soap->error = SOAP_TAG_MISMATCH; 2295 if (soap_flag_result && soap->error == SOAP_TAG_MISMATCH) 2296 if (soap_in_PointerTostring(soap, "result", &a->result, "")) 2297 { soap_flag_result = 0; 2217 if (soap_flag_key && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 2218 if (soap_in_string(soap, "key", &a->key, "xsd:string")) 2219 { soap_flag_key--; 2220 continue; 2221 } 2222 if (soap_flag_newkey && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 2223 if (soap_in_string(soap, "newkey", &a->newkey, "xsd:string")) 2224 { soap_flag_newkey--; 2298 2225 continue; 2299 2226 } … … 2309 2236 } 2310 2237 else 2311 { a = (struct ns1__rename_USCOREobject_Response *)soap_id_forward(soap, soap->href, (void**)a, SOAP_TYPE_ns1__rename_USCOREobject_Response, 0, sizeof(struct ns1__rename_USCOREobject_Response), 0, NULL); 2312 if (soap->body && soap_element_end_in(soap, tag)) 2313 return NULL; 2314 } 2315 return a; 2316 } 2317 2318 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__rename_USCOREobject(struct soap *soap, const struct ns1__rename_USCOREobject *a) 2319 { 2320 (void)soap; (void)a; /* appease -Wall -Werror */ 2321 soap_embedded(soap, &a->key, SOAP_TYPE_string); 2322 soap_serialize_string(soap, &a->key); 2323 soap_embedded(soap, &a->newkey, SOAP_TYPE_string); 2324 soap_serialize_string(soap, &a->newkey); 2325 } 2326 2327 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__rename_USCOREobject(struct soap *soap, struct ns1__rename_USCOREobject *a) 2328 { 2329 (void)soap; (void)a; /* appease -Wall -Werror */ 2330 soap_default_string(soap, &a->key); 2331 soap_default_string(soap, &a->newkey); 2332 } 2333 2334 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__rename_USCOREobject(struct soap *soap, const struct ns1__rename_USCOREobject *a, const char *tag, const char *type) 2335 { 2336 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__rename_USCOREobject); 2337 if (soap_out_ns1__rename_USCOREobject(soap, tag, id, a, type)) 2338 return soap->error; 2339 return soap_putindependent(soap); 2340 } 2341 2342 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__rename_USCOREobject(struct soap *soap, const char *tag, int id, const struct ns1__rename_USCOREobject *a, const char *type) 2343 { 2344 soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__rename_USCOREobject), type); 2345 soap_out_string(soap, "key", -1, &a->key, ""); 2346 soap_out_string(soap, "newkey", -1, &a->newkey, ""); 2347 soap_element_end_out(soap, tag); 2348 return SOAP_OK; 2349 } 2350 2351 SOAP_FMAC3 struct ns1__rename_USCOREobject * SOAP_FMAC4 soap_get_ns1__rename_USCOREobject(struct soap *soap, struct ns1__rename_USCOREobject *p, const char *tag, const char *type) 2352 { 2353 if ((p = soap_in_ns1__rename_USCOREobject(soap, tag, p, type))) 2354 soap_getindependent(soap); 2355 return p; 2356 } 2357 2358 SOAP_FMAC3 struct ns1__rename_USCOREobject * SOAP_FMAC4 soap_in_ns1__rename_USCOREobject(struct soap *soap, const char *tag, struct ns1__rename_USCOREobject *a, const char *type) 2359 { 2360 short soap_flag_key = 1, soap_flag_newkey = 1; 2361 if (soap_element_begin_in(soap, tag, 0)) 2362 return NULL; 2363 if (*soap->type && soap_match_tag(soap, soap->type, type)) 2364 { soap->error = SOAP_TYPE; 2365 return NULL; 2366 } 2367 a = (struct ns1__rename_USCOREobject *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__rename_USCOREobject, sizeof(struct ns1__rename_USCOREobject), 0, NULL, NULL, NULL); 2368 if (!a) 2369 return NULL; 2370 if (soap->alloced) 2371 soap_default_ns1__rename_USCOREobject(soap, a); 2238 { a = (struct ns1__rename_USCOREobject_ *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__rename_USCOREobject_, 0, sizeof(struct ns1__rename_USCOREobject_), 0, NULL); 2239 if (soap->body && soap_element_end_in(soap, tag)) 2240 return NULL; 2241 } 2242 return a; 2243 } 2244 2245 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__rename_USCOREobject_Response(struct soap *soap, struct ns1__rename_USCOREobject_Response *a) 2246 { 2247 (void)soap; (void)a; /* appease -Wall -Werror */ 2248 a->result = NULL; 2249 } 2250 2251 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__rename_USCOREobject_Response(struct soap *soap, const struct ns1__rename_USCOREobject_Response *a) 2252 { 2253 (void)soap; (void)a; /* appease -Wall -Werror */ 2254 soap_serialize_PointerTostring(soap, &a->result); 2255 } 2256 2257 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__rename_USCOREobject_Response(struct soap *soap, const struct ns1__rename_USCOREobject_Response *a, const char *tag, const char *type) 2258 { 2259 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__rename_USCOREobject_Response); 2260 if (soap_out_ns1__rename_USCOREobject_Response(soap, tag, id, a, type)) 2261 return soap->error; 2262 return soap_putindependent(soap); 2263 } 2264 2265 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__rename_USCOREobject_Response(struct soap *soap, const char *tag, int id, const struct ns1__rename_USCOREobject_Response *a, const char *type) 2266 { 2267 if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__rename_USCOREobject_Response), type)) 2268 return soap->error; 2269 if (soap_out_PointerTostring(soap, "result", -1, &a->result, "")) 2270 return soap->error; 2271 return soap_element_end_out(soap, tag); 2272 } 2273 2274 SOAP_FMAC3 struct ns1__rename_USCOREobject_Response * SOAP_FMAC4 soap_get_ns1__rename_USCOREobject_Response(struct soap *soap, struct ns1__rename_USCOREobject_Response *p, const char *tag, const char *type) 2275 { 2276 if ((p = soap_in_ns1__rename_USCOREobject_Response(soap, tag, p, type))) 2277 if (soap_getindependent(soap)) 2278 return NULL; 2279 return p; 2280 } 2281 2282 SOAP_FMAC3 struct ns1__rename_USCOREobject_Response * SOAP_FMAC4 soap_in_ns1__rename_USCOREobject_Response(struct soap *soap, const char *tag, struct ns1__rename_USCOREobject_Response *a, const char *type) 2283 { 2284 size_t soap_flag_result = 1; 2285 if (soap_element_begin_in(soap, tag, 0, type)) 2286 return NULL; 2287 a = (struct ns1__rename_USCOREobject_Response *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__rename_USCOREobject_Response, sizeof(struct ns1__rename_USCOREobject_Response), 0, NULL, NULL, NULL); 2288 if (!a) 2289 return NULL; 2290 soap_default_ns1__rename_USCOREobject_Response(soap, a); 2372 2291 if (soap->body && !*soap->href) 2373 { for (;;) 2292 { 2293 for (;;) 2374 2294 { soap->error = SOAP_TAG_MISMATCH; 2375 if (soap_flag_key && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 2376 if (soap_in_string(soap, "key", &a->key, "")) 2377 { soap_flag_key = 0; 2378 continue; 2379 } 2380 if (soap_flag_newkey && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 2381 if (soap_in_string(soap, "newkey", &a->newkey, "")) 2382 { soap_flag_newkey = 0; 2295 if (soap_flag_result && soap->error == SOAP_TAG_MISMATCH) 2296 if (soap_in_PointerTostring(soap, "result", &a->result, "xsd:string")) 2297 { soap_flag_result--; 2383 2298 continue; 2384 2299 } … … 2394 2309 } 2395 2310 else 2396 { a = (struct ns1__rename_USCOREobject *)soap_id_forward(soap, soap->href, (void**)a, SOAP_TYPE_ns1__rename_USCOREobject, 0, sizeof(struct ns1__rename_USCOREobject), 0, NULL); 2397 if (soap->body && soap_element_end_in(soap, tag)) 2398 return NULL; 2399 } 2400 return a; 2401 } 2402 2403 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__rename_USCOREobjectResponse(struct soap *soap, const struct ns1__rename_USCOREobjectResponse *a) 2404 { 2405 (void)soap; (void)a; /* appease -Wall -Werror */ 2406 soap_embedded(soap, &a->result, SOAP_TYPE_PointerTostring); 2407 soap_serialize_PointerTostring(soap, &a->result); 2408 } 2409 2410 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__rename_USCOREobjectResponse(struct soap *soap, struct ns1__rename_USCOREobjectResponse *a) 2411 { 2412 (void)soap; (void)a; /* appease -Wall -Werror */ 2413 a->result = NULL; 2414 } 2415 2416 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__rename_USCOREobjectResponse(struct soap *soap, const struct ns1__rename_USCOREobjectResponse *a, const char *tag, const char *type) 2417 { 2418 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__rename_USCOREobjectResponse); 2419 if (soap_out_ns1__rename_USCOREobjectResponse(soap, tag, id, a, type)) 2420 return soap->error; 2421 return soap_putindependent(soap); 2422 } 2423 2424 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__rename_USCOREobjectResponse(struct soap *soap, const char *tag, int id, const struct ns1__rename_USCOREobjectResponse *a, const char *type) 2425 { 2426 soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__rename_USCOREobjectResponse), type); 2427 if (a->result) 2428 soap_element_result(soap, "result"); 2429 soap_out_PointerTostring(soap, "result", -1, &a->result, ""); 2430 soap_element_end_out(soap, tag); 2431 return SOAP_OK; 2432 } 2433 2434 SOAP_FMAC3 struct ns1__rename_USCOREobjectResponse * SOAP_FMAC4 soap_get_ns1__rename_USCOREobjectResponse(struct soap *soap, struct ns1__rename_USCOREobjectResponse *p, const char *tag, const char *type) 2435 { 2436 if ((p = soap_in_ns1__rename_USCOREobjectResponse(soap, tag, p, type))) 2437 soap_getindependent(soap); 2438 return p; 2439 } 2440 2441 SOAP_FMAC3 struct ns1__rename_USCOREobjectResponse * SOAP_FMAC4 soap_in_ns1__rename_USCOREobjectResponse(struct soap *soap, const char *tag, struct ns1__rename_USCOREobjectResponse *a, const char *type) 2442 { 2443 short soap_flag_result = 1; 2444 if (soap_element_begin_in(soap, tag, 0)) 2445 return NULL; 2446 if (*soap->type && soap_match_tag(soap, soap->type, type)) 2447 { soap->error = SOAP_TYPE; 2448 return NULL; 2449 } 2450 a = (struct ns1__rename_USCOREobjectResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__rename_USCOREobjectResponse, sizeof(struct ns1__rename_USCOREobjectResponse), 0, NULL, NULL, NULL); 2451 if (!a) 2452 return NULL; 2453 if (soap->alloced) 2454 soap_default_ns1__rename_USCOREobjectResponse(soap, a); 2311 { a = (struct ns1__rename_USCOREobject_Response *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__rename_USCOREobject_Response, 0, sizeof(struct ns1__rename_USCOREobject_Response), 0, NULL); 2312 if (soap->body && soap_element_end_in(soap, tag)) 2313 return NULL; 2314 } 2315 return a; 2316 } 2317 2318 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__rename_USCOREobject(struct soap *soap, struct ns1__rename_USCOREobject *a) 2319 { 2320 (void)soap; (void)a; /* appease -Wall -Werror */ 2321 soap_default_string(soap, &a->key); 2322 soap_default_string(soap, &a->newkey); 2323 } 2324 2325 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__rename_USCOREobject(struct soap *soap, const struct ns1__rename_USCOREobject *a) 2326 { 2327 (void)soap; (void)a; /* appease -Wall -Werror */ 2328 soap_serialize_string(soap, &a->key); 2329 soap_serialize_string(soap, &a->newkey); 2330 } 2331 2332 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__rename_USCOREobject(struct soap *soap, const struct ns1__rename_USCOREobject *a, const char *tag, const char *type) 2333 { 2334 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__rename_USCOREobject); 2335 if (soap_out_ns1__rename_USCOREobject(soap, tag, id, a, type)) 2336 return soap->error; 2337 return soap_putindependent(soap); 2338 } 2339 2340 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__rename_USCOREobject(struct soap *soap, const char *tag, int id, const struct ns1__rename_USCOREobject *a, const char *type) 2341 { 2342 if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__rename_USCOREobject), type)) 2343 return soap->error; 2344 if (soap_out_string(soap, "key", -1, &a->key, "")) 2345 return soap->error; 2346 if (soap_out_string(soap, "newkey", -1, &a->newkey, "")) 2347 return soap->error; 2348 return soap_element_end_out(soap, tag); 2349 } 2350 2351 SOAP_FMAC3 struct ns1__rename_USCOREobject * SOAP_FMAC4 soap_get_ns1__rename_USCOREobject(struct soap *soap, struct ns1__rename_USCOREobject *p, const char *tag, const char *type) 2352 { 2353 if ((p = soap_in_ns1__rename_USCOREobject(soap, tag, p, type))) 2354 if (soap_getindependent(soap)) 2355 return NULL; 2356 return p; 2357 } 2358 2359 SOAP_FMAC3 struct ns1__rename_USCOREobject * SOAP_FMAC4 soap_in_ns1__rename_USCOREobject(struct soap *soap, const char *tag, struct ns1__rename_USCOREobject *a, const char *type) 2360 { 2361 size_t soap_flag_key = 1; 2362 size_t soap_flag_newkey = 1; 2363 if (soap_element_begin_in(soap, tag, 0, type)) 2364 return NULL; 2365 a = (struct ns1__rename_USCOREobject *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__rename_USCOREobject, sizeof(struct ns1__rename_USCOREobject), 0, NULL, NULL, NULL); 2366 if (!a) 2367 return NULL; 2368 soap_default_ns1__rename_USCOREobject(soap, a); 2455 2369 if (soap->body && !*soap->href) 2456 { for (;;) 2370 { 2371 for (;;) 2457 2372 { soap->error = SOAP_TAG_MISMATCH; 2458 if (soap_flag_result && soap->error == SOAP_TAG_MISMATCH) 2459 if (soap_in_PointerTostring(soap, "result", &a->result, "")) 2460 { soap_flag_result = 0; 2373 if (soap_flag_key && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 2374 if (soap_in_string(soap, "key", &a->key, "xsd:string")) 2375 { soap_flag_key--; 2376 continue; 2377 } 2378 if (soap_flag_newkey && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 2379 if (soap_in_string(soap, "newkey", &a->newkey, "xsd:string")) 2380 { soap_flag_newkey--; 2461 2381 continue; 2462 2382 } … … 2472 2392 } 2473 2393 else 2474 { a = (struct ns1__rename_USCOREobjectResponse *)soap_id_forward(soap, soap->href, (void**)a, SOAP_TYPE_ns1__rename_USCOREobjectResponse, 0, sizeof(struct ns1__rename_USCOREobjectResponse), 0, NULL); 2475 if (soap->body && soap_element_end_in(soap, tag)) 2476 return NULL; 2477 } 2478 return a; 2479 } 2480 2481 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__create_USCOREobject(struct soap *soap, const struct ns1__create_USCOREobject *a) 2482 { 2483 (void)soap; (void)a; /* appease -Wall -Werror */ 2484 soap_embedded(soap, &a->key, SOAP_TYPE_string); 2485 soap_serialize_string(soap, &a->key); 2486 soap_embedded(soap, &a->volume, SOAP_TYPE_string); 2487 soap_serialize_string(soap, &a->volume); 2488 } 2489 2490 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__create_USCOREobject(struct soap *soap, struct ns1__create_USCOREobject *a) 2491 { 2492 (void)soap; (void)a; /* appease -Wall -Werror */ 2493 soap_default_string(soap, &a->key); 2494 soap_default_string(soap, &a->volume); 2495 } 2496 2497 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__create_USCOREobject(struct soap *soap, const struct ns1__create_USCOREobject *a, const char *tag, const char *type) 2498 { 2499 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__create_USCOREobject); 2500 if (soap_out_ns1__create_USCOREobject(soap, tag, id, a, type)) 2501 return soap->error; 2502 return soap_putindependent(soap); 2503 } 2504 2505 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__create_USCOREobject(struct soap *soap, const char *tag, int id, const struct ns1__create_USCOREobject *a, const char *type) 2506 { 2507 soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__create_USCOREobject), type); 2508 soap_out_string(soap, "key", -1, &a->key, ""); 2509 soap_out_string(soap, "volume", -1, &a->volume, ""); 2510 soap_element_end_out(soap, tag); 2511 return SOAP_OK; 2512 } 2513 2514 SOAP_FMAC3 struct ns1__create_USCOREobject * SOAP_FMAC4 soap_get_ns1__create_USCOREobject(struct soap *soap, struct ns1__create_USCOREobject *p, const char *tag, const char *type) 2515 { 2516 if ((p = soap_in_ns1__create_USCOREobject(soap, tag, p, type))) 2517 soap_getindependent(soap); 2518 return p; 2519 } 2520 2521 SOAP_FMAC3 struct ns1__create_USCOREobject * SOAP_FMAC4 soap_in_ns1__create_USCOREobject(struct soap *soap, const char *tag, struct ns1__create_USCOREobject *a, const char *type) 2522 { 2523 short soap_flag_key = 1, soap_flag_volume = 1; 2524 if (soap_element_begin_in(soap, tag, 0)) 2525 return NULL; 2526 if (*soap->type && soap_match_tag(soap, soap->type, type)) 2527 { soap->error = SOAP_TYPE; 2528 return NULL; 2529 } 2530 a = (struct ns1__create_USCOREobject *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__create_USCOREobject, sizeof(struct ns1__create_USCOREobject), 0, NULL, NULL, NULL); 2531 if (!a) 2532 return NULL; 2533 if (soap->alloced) 2534 soap_default_ns1__create_USCOREobject(soap, a); 2394 { a = (struct ns1__rename_USCOREobject *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__rename_USCOREobject, 0, sizeof(struct ns1__rename_USCOREobject), 0, NULL); 2395 if (soap->body && soap_element_end_in(soap, tag)) 2396 return NULL; 2397 } 2398 return a; 2399 } 2400 2401 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__rename_USCOREobjectResponse(struct soap *soap, struct ns1__rename_USCOREobjectResponse *a) 2402 { 2403 (void)soap; (void)a; /* appease -Wall -Werror */ 2404 a->result = NULL; 2405 } 2406 2407 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__rename_USCOREobjectResponse(struct soap *soap, const struct ns1__rename_USCOREobjectResponse *a) 2408 { 2409 (void)soap; (void)a; /* appease -Wall -Werror */ 2410 soap_serialize_PointerTostring(soap, &a->result); 2411 } 2412 2413 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__rename_USCOREobjectResponse(struct soap *soap, const struct ns1__rename_USCOREobjectResponse *a, const char *tag, const char *type) 2414 { 2415 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__rename_USCOREobjectResponse); 2416 if (soap_out_ns1__rename_USCOREobjectResponse(soap, tag, id, a, type)) 2417 return soap->error; 2418 return soap_putindependent(soap); 2419 } 2420 2421 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__rename_USCOREobjectResponse(struct soap *soap, const char *tag, int id, const struct ns1__rename_USCOREobjectResponse *a, const char *type) 2422 { 2423 if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__rename_USCOREobjectResponse), type)) 2424 return soap->error; 2425 if (soap_out_PointerTostring(soap, "result", -1, &a->result, "")) 2426 return soap->error; 2427 return soap_element_end_out(soap, tag); 2428 } 2429 2430 SOAP_FMAC3 struct ns1__rename_USCOREobjectResponse * SOAP_FMAC4 soap_get_ns1__rename_USCOREobjectResponse(struct soap *soap, struct ns1__rename_USCOREobjectResponse *p, const char *tag, const char *type) 2431 { 2432 if ((p = soap_in_ns1__rename_USCOREobjectResponse(soap, tag, p, type))) 2433 if (soap_getindependent(soap)) 2434 return NULL; 2435 return p; 2436 } 2437 2438 SOAP_FMAC3 struct ns1__rename_USCOREobjectResponse * SOAP_FMAC4 soap_in_ns1__rename_USCOREobjectResponse(struct soap *soap, const char *tag, struct ns1__rename_USCOREobjectResponse *a, const char *type) 2439 { 2440 size_t soap_flag_result = 1; 2441 if (soap_element_begin_in(soap, tag, 0, type)) 2442 return NULL; 2443 a = (struct ns1__rename_USCOREobjectResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__rename_USCOREobjectResponse, sizeof(struct ns1__rename_USCOREobjectResponse), 0, NULL, NULL, NULL); 2444 if (!a) 2445 return NULL; 2446 soap_default_ns1__rename_USCOREobjectResponse(soap, a); 2535 2447 if (soap->body && !*soap->href) 2536 { for (;;) 2448 { 2449 for (;;) 2537 2450 { soap->error = SOAP_TAG_MISMATCH; 2538 if (soap_flag_key && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 2539 if (soap_in_string(soap, "key", &a->key, "")) 2540 { soap_flag_key = 0; 2541 continue; 2542 } 2543 if (soap_flag_volume && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 2544 if (soap_in_string(soap, "volume", &a->volume, "")) 2545 { soap_flag_volume = 0; 2451 if (soap_flag_result && soap->error == SOAP_TAG_MISMATCH) 2452 if (soap_in_PointerTostring(soap, "result", &a->result, "xsd:string")) 2453 { soap_flag_result--; 2546 2454 continue; 2547 2455 } … … 2557 2465 } 2558 2466 else 2559 { a = (struct ns1__create_USCOREobject *)soap_id_forward(soap, soap->href, (void**)a, SOAP_TYPE_ns1__create_USCOREobject, 0, sizeof(struct ns1__create_USCOREobject), 0, NULL); 2560 if (soap->body && soap_element_end_in(soap, tag)) 2561 return NULL; 2562 } 2563 return a; 2564 } 2565 2566 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__create_USCOREobjectResponse(struct soap *soap, const struct ns1__create_USCOREobjectResponse *a) 2567 { 2568 (void)soap; (void)a; /* appease -Wall -Werror */ 2569 soap_embedded(soap, &a->result, SOAP_TYPE_PointerTostring); 2570 soap_serialize_PointerTostring(soap, &a->result); 2571 } 2572 2573 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__create_USCOREobjectResponse(struct soap *soap, struct ns1__create_USCOREobjectResponse *a) 2574 { 2575 (void)soap; (void)a; /* appease -Wall -Werror */ 2576 a->result = NULL; 2577 } 2578 2579 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__create_USCOREobjectResponse(struct soap *soap, const struct ns1__create_USCOREobjectResponse *a, const char *tag, const char *type) 2580 { 2581 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__create_USCOREobjectResponse); 2582 if (soap_out_ns1__create_USCOREobjectResponse(soap, tag, id, a, type)) 2583 return soap->error; 2584 return soap_putindependent(soap); 2585 } 2586 2587 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__create_USCOREobjectResponse(struct soap *soap, const char *tag, int id, const struct ns1__create_USCOREobjectResponse *a, const char *type) 2588 { 2589 soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__create_USCOREobjectResponse), type); 2590 if (a->result) 2591 soap_element_result(soap, "result"); 2592 soap_out_PointerTostring(soap, "result", -1, &a->result, ""); 2593 soap_element_end_out(soap, tag); 2594 return SOAP_OK; 2595 } 2596 2597 SOAP_FMAC3 struct ns1__create_USCOREobjectResponse * SOAP_FMAC4 soap_get_ns1__create_USCOREobjectResponse(struct soap *soap, struct ns1__create_USCOREobjectResponse *p, const char *tag, const char *type) 2598 { 2599 if ((p = soap_in_ns1__create_USCOREobjectResponse(soap, tag, p, type))) 2600 soap_getindependent(soap); 2601 return p; 2602 } 2603 2604 SOAP_FMAC3 struct ns1__create_USCOREobjectResponse * SOAP_FMAC4 soap_in_ns1__create_USCOREobjectResponse(struct soap *soap, const char *tag, struct ns1__create_USCOREobjectResponse *a, const char *type) 2605 { 2606 short soap_flag_result = 1; 2607 if (soap_element_begin_in(soap, tag, 0)) 2608 return NULL; 2609 if (*soap->type && soap_match_tag(soap, soap->type, type)) 2610 { soap->error = SOAP_TYPE; 2611 return NULL; 2612 } 2613 a = (struct ns1__create_USCOREobjectResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__create_USCOREobjectResponse, sizeof(struct ns1__create_USCOREobjectResponse), 0, NULL, NULL, NULL); 2614 if (!a) 2615 return NULL; 2616 if (soap->alloced) 2617 soap_default_ns1__create_USCOREobjectResponse(soap, a); 2467 { a = (struct ns1__rename_USCOREobjectResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__rename_USCOREobjectResponse, 0, sizeof(struct ns1__rename_USCOREobjectResponse), 0, NULL); 2468 if (soap->body && soap_element_end_in(soap, tag)) 2469 return NULL; 2470 } 2471 return a; 2472 } 2473 2474 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__create_USCOREobject(struct soap *soap, struct ns1__create_USCOREobject *a) 2475 { 2476 (void)soap; (void)a; /* appease -Wall -Werror */ 2477 soap_default_string(soap, &a->key); 2478 soap_default_string(soap, &a->volume); 2479 } 2480 2481 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__create_USCOREobject(struct soap *soap, const struct ns1__create_USCOREobject *a) 2482 { 2483 (void)soap; (void)a; /* appease -Wall -Werror */ 2484 soap_serialize_string(soap, &a->key); 2485 soap_serialize_string(soap, &a->volume); 2486 } 2487 2488 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__create_USCOREobject(struct soap *soap, const struct ns1__create_USCOREobject *a, const char *tag, const char *type) 2489 { 2490 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__create_USCOREobject); 2491 if (soap_out_ns1__create_USCOREobject(soap, tag, id, a, type)) 2492 return soap->error; 2493 return soap_putindependent(soap); 2494 } 2495 2496 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__create_USCOREobject(struct soap *soap, const char *tag, int id, const struct ns1__create_USCOREobject *a, const char *type) 2497 { 2498 if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__create_USCOREobject), type)) 2499 return soap->error; 2500 if (soap_out_string(soap, "key", -1, &a->key, "")) 2501 return soap->error; 2502 if (soap_out_string(soap, "volume", -1, &a->volume, "")) 2503 return soap->error; 2504 return soap_element_end_out(soap, tag); 2505 } 2506 2507 SOAP_FMAC3 struct ns1__create_USCOREobject * SOAP_FMAC4 soap_get_ns1__create_USCOREobject(struct soap *soap, struct ns1__create_USCOREobject *p, const char *tag, const char *type) 2508 { 2509 if ((p = soap_in_ns1__create_USCOREobject(soap, tag, p, type))) 2510 if (soap_getindependent(soap)) 2511 return NULL; 2512 return p; 2513 } 2514 2515 SOAP_FMAC3 struct ns1__create_USCOREobject * SOAP_FMAC4 soap_in_ns1__create_USCOREobject(struct soap *soap, const char *tag, struct ns1__create_USCOREobject *a, const char *type) 2516 { 2517 size_t soap_flag_key = 1; 2518 size_t soap_flag_volume = 1; 2519 if (soap_element_begin_in(soap, tag, 0, type)) 2520 return NULL; 2521 a = (struct ns1__create_USCOREobject *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__create_USCOREobject, sizeof(struct ns1__create_USCOREobject), 0, NULL, NULL, NULL); 2522 if (!a) 2523 return NULL; 2524 soap_default_ns1__create_USCOREobject(soap, a); 2618 2525 if (soap->body && !*soap->href) 2619 { for (;;) 2526 { 2527 for (;;) 2620 2528 { soap->error = SOAP_TAG_MISMATCH; 2621 if (soap_flag_result && soap->error == SOAP_TAG_MISMATCH) 2622 if (soap_in_PointerTostring(soap, "result", &a->result, "")) 2623 { soap_flag_result = 0; 2529 if (soap_flag_key && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 2530 if (soap_in_string(soap, "key", &a->key, "xsd:string")) 2531 { soap_flag_key--; 2532 continue; 2533 } 2534 if (soap_flag_volume && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 2535 if (soap_in_string(soap, "volume", &a->volume, "xsd:string")) 2536 { soap_flag_volume--; 2624 2537 continue; 2625 2538 } … … 2635 2548 } 2636 2549 else 2637 { a = (struct ns1__create_USCOREobjectResponse *)soap_id_forward(soap, soap->href, (void**)a, SOAP_TYPE_ns1__create_USCOREobjectResponse, 0, sizeof(struct ns1__create_USCOREobjectResponse), 0, NULL); 2638 if (soap->body && soap_element_end_in(soap, tag)) 2639 return NULL; 2640 } 2641 return a; 2550 { a = (struct ns1__create_USCOREobject *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__create_USCOREobject, 0, sizeof(struct ns1__create_USCOREobject), 0, NULL); 2551 if (soap->body && soap_element_end_in(soap, tag)) 2552 return NULL; 2553 } 2554 return a; 2555 } 2556 2557 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__create_USCOREobjectResponse(struct soap *soap, struct ns1__create_USCOREobjectResponse *a) 2558 { 2559 (void)soap; (void)a; /* appease -Wall -Werror */ 2560 a->result = NULL; 2561 } 2562 2563 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__create_USCOREobjectResponse(struct soap *soap, const struct ns1__create_USCOREobjectResponse *a) 2564 { 2565 (void)soap; (void)a; /* appease -Wall -Werror */ 2566 soap_serialize_PointerTostring(soap, &a->result); 2567 } 2568 2569 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__create_USCOREobjectResponse(struct soap *soap, const struct ns1__create_USCOREobjectResponse *a, const char *tag, const char *type) 2570 { 2571 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__create_USCOREobjectResponse); 2572 if (soap_out_ns1__create_USCOREobjectResponse(soap, tag, id, a, type)) 2573 return soap->error; 2574 return soap_putindependent(soap); 2575 } 2576 2577 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__create_USCOREobjectResponse(struct soap *soap, const char *tag, int id, const struct ns1__create_USCOREobjectResponse *a, const char *type) 2578 { 2579 if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__create_USCOREobjectResponse), type)) 2580 return soap->error; 2581 if (soap_out_PointerTostring(soap, "result", -1, &a->result, "")) 2582 return soap->error; 2583 return soap_element_end_out(soap, tag); 2584 } 2585 2586 SOAP_FMAC3 struct ns1__create_USCOREobjectResponse * SOAP_FMAC4 soap_get_ns1__create_USCOREobjectResponse(struct soap *soap, struct ns1__create_USCOREobjectResponse *p, const char *tag, const char *type) 2587 { 2588 if ((p = soap_in_ns1__create_USCOREobjectResponse(soap, tag, p, type))) 2589 if (soap_getindependent(soap)) 2590 return NULL; 2591 return p; 2592 } 2593 2594 SOAP_FMAC3 struct ns1__create_USCOREobjectResponse * SOAP_FMAC4 soap_in_ns1__create_USCOREobjectResponse(struct soap *soap, const char *tag, struct ns1__create_USCOREobjectResponse *a, const char *type) 2595 { 2596 size_t soap_flag_result = 1; 2597 if (soap_element_begin_in(soap, tag, 0, type)) 2598 return NULL; 2599 a = (struct ns1__create_USCOREobjectResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__create_USCOREobjectResponse, sizeof(struct ns1__create_USCOREobjectResponse), 0, NULL, NULL, NULL); 2600 if (!a) 2601 return NULL; 2602 soap_default_ns1__create_USCOREobjectResponse(soap, a); 2603 if (soap->body && !*soap->href) 2604 { 2605 for (;;) 2606 { soap->error = SOAP_TAG_MISMATCH; 2607 if (soap_flag_result && soap->error == SOAP_TAG_MISMATCH) 2608 if (soap_in_PointerTostring(soap, "result", &a->result, "xsd:string")) 2609 { soap_flag_result--; 2610 continue; 2611 } 2612 if (soap->error == SOAP_TAG_MISMATCH) 2613 soap->error = soap_ignore_element(soap); 2614 if (soap->error == SOAP_NO_TAG) 2615 break; 2616 if (soap->error) 2617 return NULL; 2618 } 2619 if (soap_element_end_in(soap, tag)) 2620 return NULL; 2621 } 2622 else 2623 { a = (struct ns1__create_USCOREobjectResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__create_USCOREobjectResponse, 0, sizeof(struct ns1__create_USCOREobjectResponse), 0, NULL); 2624 if (soap->body && soap_element_end_in(soap, tag)) 2625 return NULL; 2626 } 2627 return a; 2628 } 2629 2630 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ArrayOfString(struct soap *soap, struct ArrayOfString *a) 2631 { 2632 a->__size = 0; 2633 a->__ptr = NULL; 2642 2634 } 2643 2635 … … 2647 2639 if (a->__ptr && !soap_array_reference(soap, a, (struct soap_array*)&a->__ptr, 1, SOAP_TYPE_ArrayOfString)) 2648 2640 for (i = 0; i < a->__size; i++) 2649 { soap_embedded(soap, a->__ptr + i, SOAP_TYPE_string);2641 { 2650 2642 soap_serialize_string(soap, a->__ptr + i); 2651 2643 } 2652 }2653 2654 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ArrayOfString(struct soap *soap, struct ArrayOfString *a)2655 {2656 a->__size = 0;2657 a->__ptr = NULL;2658 2644 } 2659 2645 … … 2669 2655 { 2670 2656 int i, n = a->__size; 2671 char *t = soap_putsize(soap, "xsd:string", n);2657 char *t = soap_putsize(soap, "xsd:string", a->__size); 2672 2658 id = soap_element_id(soap, tag, id, a, (struct soap_array*)&a->__ptr, 1, type, SOAP_TYPE_ArrayOfString); 2673 2659 if (id < 0) 2674 2660 return soap->error; 2675 soap_array_begin_out(soap, tag, id, t, NULL); 2661 if (soap_array_begin_out(soap, tag, id, t, NULL)) 2662 return soap->error; 2676 2663 for (i = 0; i < n; i++) 2677 2664 { … … 2681 2668 } 2682 2669 soap->position = 0; 2683 soap_element_end_out(soap, tag); 2684 return SOAP_OK; 2670 return soap_element_end_out(soap, tag); 2685 2671 } 2686 2672 … … 2688 2674 { 2689 2675 if ((p = soap_in_ArrayOfString(soap, tag, p, type))) 2690 soap_getindependent(soap); 2676 if (soap_getindependent(soap)) 2677 return NULL; 2691 2678 return p; 2692 2679 } … … 2695 2682 { int i, j; 2696 2683 char **p; 2697 if (soap_element_begin_in(soap, tag, 1 ))2684 if (soap_element_begin_in(soap, tag, 1, NULL)) 2698 2685 return NULL; 2699 2686 if (soap_match_array(soap, type)) … … 2704 2691 if (!a) 2705 2692 return NULL; 2706 if (soap->alloced) 2707 soap_default_ArrayOfString(soap, a); 2693 soap_default_ArrayOfString(soap, a); 2708 2694 if (soap->body && !*soap->href) 2709 2695 { … … 2722 2708 } 2723 2709 } 2724 if (!soap_in_string(soap, NULL, a->__ptr + i, " "))2710 if (!soap_in_string(soap, NULL, a->__ptr + i, "xsd:string")) 2725 2711 { if (soap->error != SOAP_NO_TAG) 2726 2712 return NULL; … … 2731 2717 } 2732 2718 else 2733 { soap_new_block(soap); 2719 { if (soap_new_block(soap) == NULL) 2720 return NULL; 2734 2721 for (a->__size = 0; ; a->__size++) 2735 { p = (char **)soap_push_block(soap, sizeof(char *));2722 { p = (char **)soap_push_block(soap, NULL, sizeof(char *)); 2736 2723 if (!p) 2737 2724 return NULL; 2738 2725 *p = NULL; 2739 if (!soap_in_string(soap, NULL, p, " "))2726 if (!soap_in_string(soap, NULL, p, "xsd:string")) 2740 2727 { if (soap->error != SOAP_NO_TAG) 2741 2728 return NULL; … … 2744 2731 } 2745 2732 } 2746 soap_pop_block(soap );2733 soap_pop_block(soap, NULL); 2747 2734 a->__ptr = (char **)soap_malloc(soap, soap->blist->size); 2748 soap_save_block(soap, (char*)a->__ptr, 0);2735 soap_save_block(soap, NULL, (char*)a->__ptr, 1); 2749 2736 } 2750 2737 if (soap_element_end_in(soap, tag)) … … 2752 2739 } 2753 2740 else 2754 { a = (struct ArrayOfString *)soap_id_forward(soap, soap->href, (void**)a, SOAP_TYPE_ArrayOfString, 0, sizeof(struct ArrayOfString), 0, NULL); 2755 if (soap->body && soap_element_end_in(soap, tag)) 2756 return NULL; 2757 } 2758 return a; 2759 } 2741 { a = (struct ArrayOfString *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ArrayOfString, 0, sizeof(struct ArrayOfString), 0, NULL); 2742 if (soap->body && soap_element_end_in(soap, tag)) 2743 return NULL; 2744 } 2745 return a; 2746 } 2747 2748 #ifndef WITH_NOGLOBAL 2749 2750 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Reason(struct soap *soap, struct SOAP_ENV__Reason *const*a) 2751 { 2752 if (!soap_reference(soap, *a, SOAP_TYPE_SOAP_ENV__Reason)) 2753 soap_serialize_SOAP_ENV__Reason(soap, *a); 2754 } 2755 2756 SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Reason(struct soap *soap, struct SOAP_ENV__Reason *const*a, const char *tag, const char *type) 2757 { 2758 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerToSOAP_ENV__Reason); 2759 if (soap_out_PointerToSOAP_ENV__Reason(soap, tag, id, a, type)) 2760 return soap->error; 2761 return soap_putindependent(soap); 2762 } 2763 2764 SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Reason(struct soap *soap, const char *tag, int id, struct SOAP_ENV__Reason *const*a, const char *type) 2765 { 2766 id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_SOAP_ENV__Reason); 2767 if (id < 0) 2768 return soap->error; 2769 return soap_out_SOAP_ENV__Reason(soap, tag, id, *a, type); 2770 } 2771 2772 SOAP_FMAC3 struct SOAP_ENV__Reason ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Reason(struct soap *soap, struct SOAP_ENV__Reason **p, const char *tag, const char *type) 2773 { 2774 if ((p = soap_in_PointerToSOAP_ENV__Reason(soap, tag, p, type))) 2775 if (soap_getindependent(soap)) 2776 return NULL; 2777 return p; 2778 } 2779 2780 SOAP_FMAC3 struct SOAP_ENV__Reason ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Reason(struct soap *soap, const char *tag, struct SOAP_ENV__Reason **a, const char *type) 2781 { 2782 if (soap_element_begin_in(soap, tag, 1, NULL)) 2783 return NULL; 2784 if (!a) 2785 if (!(a = (struct SOAP_ENV__Reason **)soap_malloc(soap, sizeof(struct SOAP_ENV__Reason *)))) 2786 return NULL; 2787 *a = NULL; 2788 if (!soap->null && *soap->href != '#') 2789 { soap_revert(soap); 2790 if (!(*a = soap_in_SOAP_ENV__Reason(soap, tag, *a, type))) 2791 return NULL; 2792 } 2793 else 2794 { a = (struct SOAP_ENV__Reason **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_SOAP_ENV__Reason, sizeof(struct SOAP_ENV__Reason), 0); 2795 if (soap->body && soap_element_end_in(soap, tag)) 2796 return NULL; 2797 } 2798 return a; 2799 } 2800 2801 #endif 2760 2802 2761 2803 #ifndef WITH_NOGLOBAL … … 2786 2828 { 2787 2829 if ((p = soap_in_PointerToSOAP_ENV__Detail(soap, tag, p, type))) 2788 soap_getindependent(soap); 2830 if (soap_getindependent(soap)) 2831 return NULL; 2789 2832 return p; 2790 2833 } … … 2792 2835 SOAP_FMAC3 struct SOAP_ENV__Detail ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Detail(struct soap *soap, const char *tag, struct SOAP_ENV__Detail **a, const char *type) 2793 2836 { 2794 if (soap_element_begin_in(soap, tag, 1 ))2837 if (soap_element_begin_in(soap, tag, 1, NULL)) 2795 2838 return NULL; 2796 2839 if (!a) … … 2840 2883 { 2841 2884 if ((p = soap_in_PointerToSOAP_ENV__Code(soap, tag, p, type))) 2842 soap_getindependent(soap); 2885 if (soap_getindependent(soap)) 2886 return NULL; 2843 2887 return p; 2844 2888 } … … 2846 2890 SOAP_FMAC3 struct SOAP_ENV__Code ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Code(struct soap *soap, const char *tag, struct SOAP_ENV__Code **a, const char *type) 2847 2891 { 2848 if (soap_element_begin_in(soap, tag, 1 ))2892 if (soap_element_begin_in(soap, tag, 1, NULL)) 2849 2893 return NULL; 2850 2894 if (!a) … … 2892 2936 { 2893 2937 if ((p = soap_in_PointerTons1__stat_USCOREobjectResponse(soap, tag, p, type))) 2894 soap_getindependent(soap); 2938 if (soap_getindependent(soap)) 2939 return NULL; 2895 2940 return p; 2896 2941 } … … 2898 2943 SOAP_FMAC3 struct ns1__stat_USCOREobjectResponse ** SOAP_FMAC4 soap_in_PointerTons1__stat_USCOREobjectResponse(struct soap *soap, const char *tag, struct ns1__stat_USCOREobjectResponse **a, const char *type) 2899 2944 { 2900 if (soap_element_begin_in(soap, tag, 1 ))2945 if (soap_element_begin_in(soap, tag, 1, NULL)) 2901 2946 return NULL; 2902 2947 if (!a) … … 2942 2987 { 2943 2988 if ((p = soap_in_PointerTons1__find_USCOREinstancesResponse(soap, tag, p, type))) 2944 soap_getindependent(soap); 2989 if (soap_getindependent(soap)) 2990 return NULL; 2945 2991 return p; 2946 2992 } … … 2948 2994 SOAP_FMAC3 struct ns1__find_USCOREinstancesResponse ** SOAP_FMAC4 soap_in_PointerTons1__find_USCOREinstancesResponse(struct soap *soap, const char *tag, struct ns1__find_USCOREinstancesResponse **a, const char *type) 2949 2995 { 2950 if (soap_element_begin_in(soap, tag, 1 ))2996 if (soap_element_begin_in(soap, tag, 1, NULL)) 2951 2997 return NULL; 2952 2998 if (!a) … … 2992 3038 { 2993 3039 if ((p = soap_in_PointerTons1__find_USCOREobjectsResponse(soap, tag, p, type))) 2994 soap_getindependent(soap); 3040 if (soap_getindependent(soap)) 3041 return NULL; 2995 3042 return p; 2996 3043 } … … 2998 3045 SOAP_FMAC3 struct ns1__find_USCOREobjectsResponse ** SOAP_FMAC4 soap_in_PointerTons1__find_USCOREobjectsResponse(struct soap *soap, const char *tag, struct ns1__find_USCOREobjectsResponse **a, const char *type) 2999 3046 { 3000 if (soap_element_begin_in(soap, tag, 1 ))3047 if (soap_element_begin_in(soap, tag, 1, NULL)) 3001 3048 return NULL; 3002 3049 if (!a) … … 3042 3089 { 3043 3090 if ((p = soap_in_PointerToArrayOfString(soap, tag, p, type))) 3044 soap_getindependent(soap); 3091 if (soap_getindependent(soap)) 3092 return NULL; 3045 3093 return p; 3046 3094 } … … 3048 3096 SOAP_FMAC3 struct ArrayOfString ** SOAP_FMAC4 soap_in_PointerToArrayOfString(struct soap *soap, const char *tag, struct ArrayOfString **a, const char *type) 3049 3097 { 3050 if (soap_element_begin_in(soap, tag, 1 ))3098 if (soap_element_begin_in(soap, tag, 1, NULL)) 3051 3099 return NULL; 3052 3100 if (!a) … … 3091 3139 { 3092 3140 if ((p = soap_in_PointerToint(soap, tag, p, type))) 3093 soap_getindependent(soap); 3141 if (soap_getindependent(soap)) 3142 return NULL; 3094 3143 return p; 3095 3144 } … … 3097 3146 SOAP_FMAC3 int ** SOAP_FMAC4 soap_in_PointerToint(struct soap *soap, const char *tag, int **a, const char *type) 3098 3147 { 3099 if (soap_element_begin_in(soap, tag, 1 ))3148 if (soap_element_begin_in(soap, tag, 1, NULL)) 3100 3149 return NULL; 3101 3150 if (!a) … … 3141 3190 { 3142 3191 if ((p = soap_in_PointerTostring(soap, tag, p, type))) 3143 soap_getindependent(soap); 3192 if (soap_getindependent(soap)) 3193 return NULL; 3144 3194 return p; 3145 3195 } … … 3147 3197 SOAP_FMAC3 char *** SOAP_FMAC4 soap_in_PointerTostring(struct soap *soap, const char *tag, char ***a, const char *type) 3148 3198 { 3149 if (soap_element_begin_in(soap, tag, 1 ))3199 if (soap_element_begin_in(soap, tag, 1, NULL)) 3150 3200 return NULL; 3151 3201 if (!a) … … 3166 3216 } 3167 3217 3168 SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENC__arrayType(struct soap *soap, char **a)3169 { soap_default_string(soap, a);3170 }3171 3172 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENC__arrayType(struct soap *soap, char *const*a)3173 { soap_serialize_string(soap, a);3174 }3175 3176 SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENC__arrayType(struct soap *soap, char *const*a, const char *tag, const char *type)3177 {3178 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENC__arrayType);3179 if (soap_out_SOAP_ENC__arrayType(soap, tag, id, a, type))3180 return soap->error;3181 return soap_putindependent(soap);3182 }3183 3184 SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENC__arrayType(struct soap *soap, const char *tag, int id, char *const*a, const char *type)3185 {3186 return soap_outstring(soap, tag, id, a, type, SOAP_TYPE_SOAP_ENC__arrayType);3187 }3188 3189 SOAP_FMAC3 char ** SOAP_FMAC4 soap_get_SOAP_ENC__arrayType(struct soap *soap, char **p, const char *tag, const char *type)3190 {3191 if ((p = soap_in_SOAP_ENC__arrayType(soap, tag, p, type)))3192 soap_getindependent(soap);3193 return p;3194 }3195 3196 SOAP_FMAC3 char * * SOAP_FMAC4 soap_in_SOAP_ENC__arrayType(struct soap *soap, const char *tag, char **a, const char *type)3197 {3198 return soap_instring(soap, tag, a, type, SOAP_TYPE_SOAP_ENC__arrayType, 1, 0, -1);3199 }3200 3201 3218 SOAP_FMAC3 void SOAP_FMAC4 soap_default__QName(struct soap *soap, char **a) 3202 3219 { soap_default_string(soap, a); … … 3223 3240 { 3224 3241 if ((p = soap_in__QName(soap, tag, p, type))) 3225 soap_getindependent(soap); 3242 if (soap_getindependent(soap)) 3243 return NULL; 3226 3244 return p; 3227 3245 } … … 3229 3247 SOAP_FMAC3 char * * SOAP_FMAC4 soap_in__QName(struct soap *soap, const char *tag, char **a, const char *type) 3230 3248 { 3231 return soap_instring(soap, tag, a, type, SOAP_TYPE__QName, 2, 0, -1);3249 return soap_instring(soap, tag, a, type, SOAP_TYPE__QName, 2, -1, -1); 3232 3250 } 3233 3251 3234 3252 SOAP_FMAC3 void SOAP_FMAC4 soap_default_string(struct soap *soap, char **a) 3235 { 3236 (void)soap; /* appease -Wall -Werror */ 3253 { (void)soap; /* appease -Wall -Werror */ 3237 3254 #ifdef SOAP_DEFAULT_string 3238 3255 *a = SOAP_DEFAULT_string; … … 3263 3280 { 3264 3281 if ((p = soap_in_string(soap, tag, p, type))) 3265 soap_getindependent(soap); 3282 if (soap_getindependent(soap)) 3283 return NULL; 3266 3284 return p; 3267 3285 } … … 3269 3287 SOAP_FMAC3 char * * SOAP_FMAC4 soap_in_string(struct soap *soap, const char *tag, char **a, const char *type) 3270 3288 { 3271 return soap_instring(soap, tag, a, type, SOAP_TYPE_string, 1, 0, -1); 3272 } 3273 3274 SOAP_END_NAMESPACE(soap) 3289 return soap_instring(soap, tag, a, type, SOAP_TYPE_string, 1, -1, -1); 3290 } 3275 3291 3276 3292 #ifdef __cplusplus -
trunk/Nebulous/nebclient/src/soapClient.c
r13096 r19542 1 1 /* soapClient.c 2 Generated by gSOAP 2.7. 2from src/nebulous.h3 Copyright (C) 2000-2005, Robert van Engelen, Genivia Inc. All Rights Reserved.2 Generated by gSOAP 2.7.11 from src/nebulous.h 3 Copyright(C) 2000-2008, Robert van Engelen, Genivia Inc. All Rights Reserved. 4 4 This part of the software is released under one of the following licenses: 5 5 GPL, the gSOAP public license, or Genivia's license for commercial use. … … 10 10 #endif 11 11 12 SOAP_BEGIN_NAMESPACE(soap) 13 14 SOAP_SOURCE_STAMP("@(#) soapClient.c ver 2.7.2 2007-05-01 02:53:36 GMT") 12 SOAP_SOURCE_STAMP("@(#) soapClient.c ver 2.7.11 2008-09-13 01:14:39 GMT") 15 13 16 14 … … 28 26 soap_serializeheader(soap); 29 27 soap_serialize_ns1__create_USCOREobject(soap, &soap_tmp_ns1__create_USCOREobject); 30 soap_begin_count(soap); 31 if (soap->mode & SOAP_IO_LENGTH) 32 { soap_envelope_begin_out(soap); 33 soap_putheader(soap); 34 soap_body_begin_out(soap); 35 soap_put_ns1__create_USCOREobject(soap, &soap_tmp_ns1__create_USCOREobject, "ns1:create_object", ""); 36 soap_body_end_out(soap); 37 soap_envelope_end_out(soap); 38 } 28 if (soap_begin_count(soap)) 29 return soap->error; 30 if (soap->mode & SOAP_IO_LENGTH) 31 { if (soap_envelope_begin_out(soap) 32 || soap_putheader(soap) 33 || soap_body_begin_out(soap) 34 || soap_put_ns1__create_USCOREobject(soap, &soap_tmp_ns1__create_USCOREobject, "ns1:create_object", "") 35 || soap_body_end_out(soap) 36 || soap_envelope_end_out(soap)) 37 return soap->error; 38 } 39 if (soap_end_count(soap)) 40 return soap->error; 39 41 if (soap_connect(soap, soap_endpoint, soap_action) 40 42 || soap_envelope_begin_out(soap) … … 46 48 || soap_end_send(soap)) 47 49 return soap_closesock(soap); 50 if (!result) 51 return soap_closesock(soap); 48 52 *result = NULL; 49 53 if (soap_begin_recv(soap) … … 60 64 if (soap_body_end_in(soap) 61 65 || soap_envelope_end_in(soap) 62 #ifndef WITH_LEANER63 || soap_resolve_attachments(soap)64 #endif65 66 || soap_end_recv(soap)) 66 67 return soap_closesock(soap); … … 83 84 soap_serializeheader(soap); 84 85 soap_serialize_ns1__rename_USCOREobject(soap, &soap_tmp_ns1__rename_USCOREobject); 85 soap_begin_count(soap); 86 if (soap->mode & SOAP_IO_LENGTH) 87 { soap_envelope_begin_out(soap); 88 soap_putheader(soap); 89 soap_body_begin_out(soap); 90 soap_put_ns1__rename_USCOREobject(soap, &soap_tmp_ns1__rename_USCOREobject, "ns1:rename_object", ""); 91 soap_body_end_out(soap); 92 soap_envelope_end_out(soap); 93 } 86 if (soap_begin_count(soap)) 87 return soap->error; 88 if (soap->mode & SOAP_IO_LENGTH) 89 { if (soap_envelope_begin_out(soap) 90 || soap_putheader(soap) 91 || soap_body_begin_out(soap) 92 || soap_put_ns1__rename_USCOREobject(soap, &soap_tmp_ns1__rename_USCOREobject, "ns1:rename_object", "") 93 || soap_body_end_out(soap) 94 || soap_envelope_end_out(soap)) 95 return soap->error; 96 } 97 if (soap_end_count(soap)) 98 return soap->error; 94 99 if (soap_connect(soap, soap_endpoint, soap_action) 95 100 || soap_envelope_begin_out(soap) … … 101 106 || soap_end_send(soap)) 102 107 return soap_closesock(soap); 108 if (!result) 109 return soap_closesock(soap); 103 110 *result = NULL; 104 111 if (soap_begin_recv(soap) … … 115 122 if (soap_body_end_in(soap) 116 123 || soap_envelope_end_in(soap) 117 #ifndef WITH_LEANER118 || soap_resolve_attachments(soap)119 #endif120 124 || soap_end_recv(soap)) 121 125 return soap_closesock(soap); … … 138 142 soap_serializeheader(soap); 139 143 soap_serialize_ns1__rename_USCOREobject_(soap, &soap_tmp_ns1__rename_USCOREobject_); 140 soap_begin_count(soap); 141 if (soap->mode & SOAP_IO_LENGTH) 142 { soap_envelope_begin_out(soap); 143 soap_putheader(soap); 144 soap_body_begin_out(soap); 145 soap_put_ns1__rename_USCOREobject_(soap, &soap_tmp_ns1__rename_USCOREobject_, "ns1:rename_object", ""); 146 soap_body_end_out(soap); 147 soap_envelope_end_out(soap); 148 } 144 if (soap_begin_count(soap)) 145 return soap->error; 146 if (soap->mode & SOAP_IO_LENGTH) 147 { if (soap_envelope_begin_out(soap) 148 || soap_putheader(soap) 149 || soap_body_begin_out(soap) 150 || soap_put_ns1__rename_USCOREobject_(soap, &soap_tmp_ns1__rename_USCOREobject_, "ns1:rename_object", "") 151 || soap_body_end_out(soap) 152 || soap_envelope_end_out(soap)) 153 return soap->error; 154 } 155 if (soap_end_count(soap)) 156 return soap->error; 149 157 if (soap_connect(soap, soap_endpoint, soap_action) 150 158 || soap_envelope_begin_out(soap) … … 156 164 || soap_end_send(soap)) 157 165 return soap_closesock(soap); 166 if (!result) 167 return soap_closesock(soap); 158 168 *result = NULL; 159 169 if (soap_begin_recv(soap) … … 170 180 if (soap_body_end_in(soap) 171 181 || soap_envelope_end_in(soap) 172 #ifndef WITH_LEANER173 || soap_resolve_attachments(soap)174 #endif175 182 || soap_end_recv(soap)) 176 183 return soap_closesock(soap); … … 193 200 soap_serializeheader(soap); 194 201 soap_serialize_ns1__replicate_USCOREobject(soap, &soap_tmp_ns1__replicate_USCOREobject); 195 soap_begin_count(soap); 196 if (soap->mode & SOAP_IO_LENGTH) 197 { soap_envelope_begin_out(soap); 198 soap_putheader(soap); 199 soap_body_begin_out(soap); 200 soap_put_ns1__replicate_USCOREobject(soap, &soap_tmp_ns1__replicate_USCOREobject, "ns1:replicate_object", ""); 201 soap_body_end_out(soap); 202 soap_envelope_end_out(soap); 203 } 202 if (soap_begin_count(soap)) 203 return soap->error; 204 if (soap->mode & SOAP_IO_LENGTH) 205 { if (soap_envelope_begin_out(soap) 206 || soap_putheader(soap) 207 || soap_body_begin_out(soap) 208 || soap_put_ns1__replicate_USCOREobject(soap, &soap_tmp_ns1__replicate_USCOREobject, "ns1:replicate_object", "") 209 || soap_body_end_out(soap) 210 || soap_envelope_end_out(soap)) 211 return soap->error; 212 } 213 if (soap_end_count(soap)) 214 return soap->error; 204 215 if (soap_connect(soap, soap_endpoint, soap_action) 205 216 || soap_envelope_begin_out(soap) … … 211 222 || soap_end_send(soap)) 212 223 return soap_closesock(soap); 224 if (!result) 225 return soap_closesock(soap); 213 226 *result = NULL; 214 227 if (soap_begin_recv(soap) … … 225 238 if (soap_body_end_in(soap) 226 239 || soap_envelope_end_in(soap) 227 #ifndef WITH_LEANER228 || soap_resolve_attachments(soap)229 #endif230 240 || soap_end_recv(soap)) 231 241 return soap_closesock(soap); … … 248 258 soap_serializeheader(soap); 249 259 soap_serialize_ns1__lock_USCOREobject(soap, &soap_tmp_ns1__lock_USCOREobject); 250 soap_begin_count(soap); 251 if (soap->mode & SOAP_IO_LENGTH) 252 { soap_envelope_begin_out(soap); 253 soap_putheader(soap); 254 soap_body_begin_out(soap); 255 soap_put_ns1__lock_USCOREobject(soap, &soap_tmp_ns1__lock_USCOREobject, "ns1:lock_object", ""); 256 soap_body_end_out(soap); 257 soap_envelope_end_out(soap); 258 } 260 if (soap_begin_count(soap)) 261 return soap->error; 262 if (soap->mode & SOAP_IO_LENGTH) 263 { if (soap_envelope_begin_out(soap) 264 || soap_putheader(soap) 265 || soap_body_begin_out(soap) 266 || soap_put_ns1__lock_USCOREobject(soap, &soap_tmp_ns1__lock_USCOREobject, "ns1:lock_object", "") 267 || soap_body_end_out(soap) 268 || soap_envelope_end_out(soap)) 269 return soap->error; 270 } 271 if (soap_end_count(soap)) 272 return soap->error; 259 273 if (soap_connect(soap, soap_endpoint, soap_action) 260 274 || soap_envelope_begin_out(soap) … … 266 280 || soap_end_send(soap)) 267 281 return soap_closesock(soap); 282 if (!result) 283 return soap_closesock(soap); 268 284 soap_default_int(soap, result); 269 285 if (soap_begin_recv(soap) … … 280 296 if (soap_body_end_in(soap) 281 297 || soap_envelope_end_in(soap) 282 #ifndef WITH_LEANER283 || soap_resolve_attachments(soap)284 #endif285 298 || soap_end_recv(soap)) 286 299 return soap_closesock(soap); … … 303 316 soap_serializeheader(soap); 304 317 soap_serialize_ns1__unlock_USCOREobject(soap, &soap_tmp_ns1__unlock_USCOREobject); 305 soap_begin_count(soap); 306 if (soap->mode & SOAP_IO_LENGTH) 307 { soap_envelope_begin_out(soap); 308 soap_putheader(soap); 309 soap_body_begin_out(soap); 310 soap_put_ns1__unlock_USCOREobject(soap, &soap_tmp_ns1__unlock_USCOREobject, "ns1:unlock_object", ""); 311 soap_body_end_out(soap); 312 soap_envelope_end_out(soap); 313 } 318 if (soap_begin_count(soap)) 319 return soap->error; 320 if (soap->mode & SOAP_IO_LENGTH) 321 { if (soap_envelope_begin_out(soap) 322 || soap_putheader(soap) 323 || soap_body_begin_out(soap) 324 || soap_put_ns1__unlock_USCOREobject(soap, &soap_tmp_ns1__unlock_USCOREobject, "ns1:unlock_object", "") 325 || soap_body_end_out(soap) 326 || soap_envelope_end_out(soap)) 327 return soap->error; 328 } 329 if (soap_end_count(soap)) 330 return soap->error; 314 331 if (soap_connect(soap, soap_endpoint, soap_action) 315 332 || soap_envelope_begin_out(soap) … … 321 338 || soap_end_send(soap)) 322 339 return soap_closesock(soap); 340 if (!result) 341 return soap_closesock(soap); 323 342 soap_default_int(soap, result); 324 343 if (soap_begin_recv(soap) … … 335 354 if (soap_body_end_in(soap) 336 355 || soap_envelope_end_in(soap) 337 #ifndef WITH_LEANER338 || soap_resolve_attachments(soap)339 #endif340 356 || soap_end_recv(soap)) 341 357 return soap_closesock(soap); … … 345 361 } 346 362 347 SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__find_USCOREobjects(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *pattern, struct ns1__find_USCOREobjectsResponse * param_1)363 SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__find_USCOREobjects(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *pattern, struct ns1__find_USCOREobjectsResponse *_param_1) 348 364 { struct ns1__find_USCOREobjects soap_tmp_ns1__find_USCOREobjects; 349 365 if (!soap_endpoint) … … 356 372 soap_serializeheader(soap); 357 373 soap_serialize_ns1__find_USCOREobjects(soap, &soap_tmp_ns1__find_USCOREobjects); 358 soap_begin_count(soap); 359 if (soap->mode & SOAP_IO_LENGTH) 360 { soap_envelope_begin_out(soap); 361 soap_putheader(soap); 362 soap_body_begin_out(soap); 363 soap_put_ns1__find_USCOREobjects(soap, &soap_tmp_ns1__find_USCOREobjects, "ns1:find_objects", ""); 364 soap_body_end_out(soap); 365 soap_envelope_end_out(soap); 366 } 374 if (soap_begin_count(soap)) 375 return soap->error; 376 if (soap->mode & SOAP_IO_LENGTH) 377 { if (soap_envelope_begin_out(soap) 378 || soap_putheader(soap) 379 || soap_body_begin_out(soap) 380 || soap_put_ns1__find_USCOREobjects(soap, &soap_tmp_ns1__find_USCOREobjects, "ns1:find_objects", "") 381 || soap_body_end_out(soap) 382 || soap_envelope_end_out(soap)) 383 return soap->error; 384 } 385 if (soap_end_count(soap)) 386 return soap->error; 367 387 if (soap_connect(soap, soap_endpoint, soap_action) 368 388 || soap_envelope_begin_out(soap) … … 374 394 || soap_end_send(soap)) 375 395 return soap_closesock(soap); 376 soap_default_ns1__find_USCOREobjectsResponse(soap, param_1); 377 if (soap_begin_recv(soap) 378 || soap_envelope_begin_in(soap) 379 || soap_recv_header(soap) 380 || soap_body_begin_in(soap)) 381 return soap_closesock(soap); 382 soap_get_ns1__find_USCOREobjectsResponse(soap, param_1, "ns1:find_objectsResponse", ""); 383 if (soap->error) 384 { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) 385 return soap_recv_fault(soap); 386 return soap_closesock(soap); 387 } 388 if (soap_body_end_in(soap) 389 || soap_envelope_end_in(soap) 390 #ifndef WITH_LEANER 391 || soap_resolve_attachments(soap) 392 #endif 393 || soap_end_recv(soap)) 394 return soap_closesock(soap); 395 return soap_closesock(soap); 396 } 397 398 SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__find_USCOREinstances(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *key, char *volume, struct ns1__find_USCOREinstancesResponse *param_2) 396 if (!_param_1) 397 return soap_closesock(soap); 398 soap_default_ns1__find_USCOREobjectsResponse(soap, _param_1); 399 if (soap_begin_recv(soap) 400 || soap_envelope_begin_in(soap) 401 || soap_recv_header(soap) 402 || soap_body_begin_in(soap)) 403 return soap_closesock(soap); 404 soap_get_ns1__find_USCOREobjectsResponse(soap, _param_1, "ns1:find_objectsResponse", ""); 405 if (soap->error) 406 { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) 407 return soap_recv_fault(soap); 408 return soap_closesock(soap); 409 } 410 if (soap_body_end_in(soap) 411 || soap_envelope_end_in(soap) 412 || soap_end_recv(soap)) 413 return soap_closesock(soap); 414 return soap_closesock(soap); 415 } 416 417 SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__find_USCOREinstances(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *key, char *volume, struct ns1__find_USCOREinstancesResponse *_param_2) 399 418 { struct ns1__find_USCOREinstances soap_tmp_ns1__find_USCOREinstances; 400 419 if (!soap_endpoint) … … 408 427 soap_serializeheader(soap); 409 428 soap_serialize_ns1__find_USCOREinstances(soap, &soap_tmp_ns1__find_USCOREinstances); 410 soap_begin_count(soap); 411 if (soap->mode & SOAP_IO_LENGTH) 412 { soap_envelope_begin_out(soap); 413 soap_putheader(soap); 414 soap_body_begin_out(soap); 415 soap_put_ns1__find_USCOREinstances(soap, &soap_tmp_ns1__find_USCOREinstances, "ns1:find_instances", ""); 416 soap_body_end_out(soap); 417 soap_envelope_end_out(soap); 418 } 429 if (soap_begin_count(soap)) 430 return soap->error; 431 if (soap->mode & SOAP_IO_LENGTH) 432 { if (soap_envelope_begin_out(soap) 433 || soap_putheader(soap) 434 || soap_body_begin_out(soap) 435 || soap_put_ns1__find_USCOREinstances(soap, &soap_tmp_ns1__find_USCOREinstances, "ns1:find_instances", "") 436 || soap_body_end_out(soap) 437 || soap_envelope_end_out(soap)) 438 return soap->error; 439 } 440 if (soap_end_count(soap)) 441 return soap->error; 419 442 if (soap_connect(soap, soap_endpoint, soap_action) 420 443 || soap_envelope_begin_out(soap) … … 426 449 || soap_end_send(soap)) 427 450 return soap_closesock(soap); 428 soap_default_ns1__find_USCOREinstancesResponse(soap, param_2); 429 if (soap_begin_recv(soap) 430 || soap_envelope_begin_in(soap) 431 || soap_recv_header(soap) 432 || soap_body_begin_in(soap)) 433 return soap_closesock(soap); 434 soap_get_ns1__find_USCOREinstancesResponse(soap, param_2, "ns1:find_instancesResponse", ""); 435 if (soap->error) 436 { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) 437 return soap_recv_fault(soap); 438 return soap_closesock(soap); 439 } 440 if (soap_body_end_in(soap) 441 || soap_envelope_end_in(soap) 442 #ifndef WITH_LEANER 443 || soap_resolve_attachments(soap) 444 #endif 451 if (!_param_2) 452 return soap_closesock(soap); 453 soap_default_ns1__find_USCOREinstancesResponse(soap, _param_2); 454 if (soap_begin_recv(soap) 455 || soap_envelope_begin_in(soap) 456 || soap_recv_header(soap) 457 || soap_body_begin_in(soap)) 458 return soap_closesock(soap); 459 soap_get_ns1__find_USCOREinstancesResponse(soap, _param_2, "ns1:find_instancesResponse", ""); 460 if (soap->error) 461 { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) 462 return soap_recv_fault(soap); 463 return soap_closesock(soap); 464 } 465 if (soap_body_end_in(soap) 466 || soap_envelope_end_in(soap) 445 467 || soap_end_recv(soap)) 446 468 return soap_closesock(soap); … … 460 482 soap_serializeheader(soap); 461 483 soap_serialize_ns1__delete_USCOREinstance(soap, &soap_tmp_ns1__delete_USCOREinstance); 462 soap_begin_count(soap); 463 if (soap->mode & SOAP_IO_LENGTH) 464 { soap_envelope_begin_out(soap); 465 soap_putheader(soap); 466 soap_body_begin_out(soap); 467 soap_put_ns1__delete_USCOREinstance(soap, &soap_tmp_ns1__delete_USCOREinstance, "ns1:delete_instance", ""); 468 soap_body_end_out(soap); 469 soap_envelope_end_out(soap); 470 } 484 if (soap_begin_count(soap)) 485 return soap->error; 486 if (soap->mode & SOAP_IO_LENGTH) 487 { if (soap_envelope_begin_out(soap) 488 || soap_putheader(soap) 489 || soap_body_begin_out(soap) 490 || soap_put_ns1__delete_USCOREinstance(soap, &soap_tmp_ns1__delete_USCOREinstance, "ns1:delete_instance", "") 491 || soap_body_end_out(soap) 492 || soap_envelope_end_out(soap)) 493 return soap->error; 494 } 495 if (soap_end_count(soap)) 496 return soap->error; 471 497 if (soap_connect(soap, soap_endpoint, soap_action) 472 498 || soap_envelope_begin_out(soap) … … 478 504 || soap_end_send(soap)) 479 505 return soap_closesock(soap); 506 if (!result) 507 return soap_closesock(soap); 480 508 soap_default_int(soap, result); 481 509 if (soap_begin_recv(soap) … … 492 520 if (soap_body_end_in(soap) 493 521 || soap_envelope_end_in(soap) 494 #ifndef WITH_LEANER495 || soap_resolve_attachments(soap)496 #endif497 522 || soap_end_recv(soap)) 498 523 return soap_closesock(soap); … … 502 527 } 503 528 504 SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__stat_USCOREobject(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *key, struct ns1__stat_USCOREobjectResponse * param_3)529 SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__stat_USCOREobject(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *key, struct ns1__stat_USCOREobjectResponse *_param_3) 505 530 { struct ns1__stat_USCOREobject soap_tmp_ns1__stat_USCOREobject; 506 531 if (!soap_endpoint) … … 513 538 soap_serializeheader(soap); 514 539 soap_serialize_ns1__stat_USCOREobject(soap, &soap_tmp_ns1__stat_USCOREobject); 515 soap_begin_count(soap); 516 if (soap->mode & SOAP_IO_LENGTH) 517 { soap_envelope_begin_out(soap); 518 soap_putheader(soap); 519 soap_body_begin_out(soap); 520 soap_put_ns1__stat_USCOREobject(soap, &soap_tmp_ns1__stat_USCOREobject, "ns1:stat_object", ""); 521 soap_body_end_out(soap); 522 soap_envelope_end_out(soap); 523 } 540 if (soap_begin_count(soap)) 541 return soap->error; 542 if (soap->mode & SOAP_IO_LENGTH) 543 { if (soap_envelope_begin_out(soap) 544 || soap_putheader(soap) 545 || soap_body_begin_out(soap) 546 || soap_put_ns1__stat_USCOREobject(soap, &soap_tmp_ns1__stat_USCOREobject, "ns1:stat_object", "") 547 || soap_body_end_out(soap) 548 || soap_envelope_end_out(soap)) 549 return soap->error; 550 } 551 if (soap_end_count(soap)) 552 return soap->error; 524 553 if (soap_connect(soap, soap_endpoint, soap_action) 525 554 || soap_envelope_begin_out(soap) … … 531 560 || soap_end_send(soap)) 532 561 return soap_closesock(soap); 533 soap_default_ns1__stat_USCOREobjectResponse(soap, param_3); 534 if (soap_begin_recv(soap) 535 || soap_envelope_begin_in(soap) 536 || soap_recv_header(soap) 537 || soap_body_begin_in(soap)) 538 return soap_closesock(soap); 539 soap_get_ns1__stat_USCOREobjectResponse(soap, param_3, "ns1:stat_objectResponse", ""); 540 if (soap->error) 541 { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) 542 return soap_recv_fault(soap); 543 return soap_closesock(soap); 544 } 545 if (soap_body_end_in(soap) 546 || soap_envelope_end_in(soap) 547 #ifndef WITH_LEANER 548 || soap_resolve_attachments(soap) 562 if (!_param_3) 563 return soap_closesock(soap); 564 soap_default_ns1__stat_USCOREobjectResponse(soap, _param_3); 565 if (soap_begin_recv(soap) 566 || soap_envelope_begin_in(soap) 567 || soap_recv_header(soap) 568 || soap_body_begin_in(soap)) 569 return soap_closesock(soap); 570 soap_get_ns1__stat_USCOREobjectResponse(soap, _param_3, "ns1:stat_objectResponse", ""); 571 if (soap->error) 572 { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) 573 return soap_recv_fault(soap); 574 return soap_closesock(soap); 575 } 576 if (soap_body_end_in(soap) 577 || soap_envelope_end_in(soap) 578 || soap_end_recv(soap)) 579 return soap_closesock(soap); 580 return soap_closesock(soap); 581 } 582 583 #ifdef __cplusplus 584 } 549 585 #endif 550 || soap_end_recv(soap))551 return soap_closesock(soap);552 return soap_closesock(soap);553 }554 555 SOAP_END_NAMESPACE(soap)556 557 #ifdef __cplusplus558 }559 #endif560 586 561 587 /* End of soapClient.c */ -
trunk/Nebulous/nebclient/src/soapClientLib.c
r10631 r19542 1 1 /* soapClientLib.c 2 Generated by gSOAP 2.7. 2from src/nebulous.h3 Copyright (C) 2000-2005, Robert van Engelen, Genivia Inc. All Rights Reserved.2 Generated by gSOAP 2.7.11 from src/nebulous.h 3 Copyright(C) 2000-2008, Robert van Engelen, Genivia Inc. All Rights Reserved. 4 4 This part of the software is released under one of the following licenses: 5 5 GPL, the gSOAP public license, or Genivia's license for commercial use. -
trunk/Nebulous/nebclient/src/soapH.h
r13078 r19542 1 1 /* soapH.h 2 Generated by gSOAP 2.7. 2from src/nebulous.h3 Copyright (C) 2000-2005, Robert van Engelen, Genivia Inc. All Rights Reserved.2 Generated by gSOAP 2.7.11 from src/nebulous.h 3 Copyright(C) 2000-2008, Robert van Engelen, Genivia Inc. All Rights Reserved. 4 4 This part of the software is released under one of the following licenses: 5 5 GPL, the gSOAP public license, or Genivia's license for commercial use. 6 6 */ 7 7 8 #ifndef soapH_H 8 9 #define soapH_H … … 11 12 extern "C" { 12 13 #endif 13 14 SOAP_BEGIN_NAMESPACE(soap)15 SOAP_FMAC3 int SOAP_FMAC4 soap_ignore_element(struct soap*);16 14 #ifndef WITH_NOIDREF 15 SOAP_FMAC3 void SOAP_FMAC4 soap_markelement(struct soap*, const void*, int); 16 SOAP_FMAC3 int SOAP_FMAC4 soap_putelement(struct soap*, const void*, const char*, int, int); 17 SOAP_FMAC3 void *SOAP_FMAC4 soap_getelement(struct soap*, int*); 17 18 SOAP_FMAC3 int SOAP_FMAC4 soap_putindependent(struct soap*); 18 19 SOAP_FMAC3 int SOAP_FMAC4 soap_getindependent(struct soap*); 19 SOAP_FMAC3 void SOAP_FMAC4 soap_markelement(struct soap*, const void*, int); 20 SOAP_FMAC3 int SOAP_FMAC4 soap_putelement(struct soap*, const void*, const char*, int, int); 21 SOAP_FMAC3 void * SOAP_FMAC4 soap_getelement(struct soap*, int*); 22 #endif 23 SOAP_FMAC3 int SOAP_FMAC4 soap_resolve_attachments(struct soap*); 20 #endif 21 SOAP_FMAC3 int SOAP_FMAC4 soap_ignore_element(struct soap*); 24 22 25 23 #ifndef SOAP_TYPE_byte 26 #define SOAP_TYPE_byte ( 2)24 #define SOAP_TYPE_byte (3) 27 25 #endif 28 26 SOAP_FMAC3 void SOAP_FMAC4 soap_default_byte(struct soap*, char *); … … 44 42 45 43 #ifndef SOAP_TYPE_SOAP_ENV__Fault 46 #define SOAP_TYPE_SOAP_ENV__Fault (50) 47 #endif 44 #define SOAP_TYPE_SOAP_ENV__Fault (51) 45 #endif 46 SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Fault(struct soap*, struct SOAP_ENV__Fault *); 48 47 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Fault(struct soap*, const struct SOAP_ENV__Fault *); 49 SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Fault(struct soap*, struct SOAP_ENV__Fault *);50 48 SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Fault(struct soap*, const struct SOAP_ENV__Fault *, const char*, const char*); 51 49 SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Fault(struct soap*, const char*, int, const struct SOAP_ENV__Fault *, const char*); … … 57 55 #ifndef WITH_NOGLOBAL 58 56 57 #ifndef SOAP_TYPE_SOAP_ENV__Reason 58 #define SOAP_TYPE_SOAP_ENV__Reason (50) 59 #endif 60 SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *); 61 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Reason(struct soap*, const struct SOAP_ENV__Reason *); 62 SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Reason(struct soap*, const struct SOAP_ENV__Reason *, const char*, const char*); 63 SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Reason(struct soap*, const char*, int, const struct SOAP_ENV__Reason *, const char*); 64 SOAP_FMAC3 struct SOAP_ENV__Reason * SOAP_FMAC4 soap_get_SOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *, const char*, const char*); 65 SOAP_FMAC3 struct SOAP_ENV__Reason * SOAP_FMAC4 soap_in_SOAP_ENV__Reason(struct soap*, const char*, struct SOAP_ENV__Reason *, const char*); 66 67 #endif 68 69 #ifndef WITH_NOGLOBAL 70 59 71 #ifndef SOAP_TYPE_SOAP_ENV__Detail 60 #define SOAP_TYPE_SOAP_ENV__Detail (49) 61 #endif 72 #define SOAP_TYPE_SOAP_ENV__Detail (47) 73 #endif 74 SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *); 62 75 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Detail(struct soap*, const struct SOAP_ENV__Detail *); 63 SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *);64 76 SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Detail(struct soap*, const struct SOAP_ENV__Detail *, const char*, const char*); 65 77 SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Detail(struct soap*, const char*, int, const struct SOAP_ENV__Detail *, const char*); … … 72 84 73 85 #ifndef SOAP_TYPE_SOAP_ENV__Code 74 #define SOAP_TYPE_SOAP_ENV__Code (47) 75 #endif 86 #define SOAP_TYPE_SOAP_ENV__Code (45) 87 #endif 88 SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *); 76 89 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Code(struct soap*, const struct SOAP_ENV__Code *); 77 SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *);78 90 SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Code(struct soap*, const struct SOAP_ENV__Code *, const char*, const char*); 79 91 SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Code(struct soap*, const char*, int, const struct SOAP_ENV__Code *, const char*); … … 86 98 87 99 #ifndef SOAP_TYPE_SOAP_ENV__Header 88 #define SOAP_TYPE_SOAP_ENV__Header (46) 89 #endif 100 #define SOAP_TYPE_SOAP_ENV__Header (44) 101 #endif 102 SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Header(struct soap*, struct SOAP_ENV__Header *); 90 103 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Header(struct soap*, const struct SOAP_ENV__Header *); 91 SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Header(struct soap*, struct SOAP_ENV__Header *);92 104 SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Header(struct soap*, const struct SOAP_ENV__Header *, const char*, const char*); 93 105 SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Header(struct soap*, const char*, int, const struct SOAP_ENV__Header *, const char*); … … 100 112 #define SOAP_TYPE_ns1__stat_USCOREobject (43) 101 113 #endif 114 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__stat_USCOREobject(struct soap*, struct ns1__stat_USCOREobject *); 102 115 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__stat_USCOREobject(struct soap*, const struct ns1__stat_USCOREobject *); 103 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__stat_USCOREobject(struct soap*, struct ns1__stat_USCOREobject *);104 116 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__stat_USCOREobject(struct soap*, const struct ns1__stat_USCOREobject *, const char*, const char*); 105 117 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__stat_USCOREobject(struct soap*, const char*, int, const struct ns1__stat_USCOREobject *, const char*); … … 110 122 #define SOAP_TYPE_ns1__stat_USCOREobjectResponse (40) 111 123 #endif 124 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__stat_USCOREobjectResponse(struct soap*, struct ns1__stat_USCOREobjectResponse *); 112 125 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__stat_USCOREobjectResponse(struct soap*, const struct ns1__stat_USCOREobjectResponse *); 113 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__stat_USCOREobjectResponse(struct soap*, struct ns1__stat_USCOREobjectResponse *);114 126 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__stat_USCOREobjectResponse(struct soap*, const struct ns1__stat_USCOREobjectResponse *, const char*, const char*); 115 127 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__stat_USCOREobjectResponse(struct soap*, const char*, int, const struct ns1__stat_USCOREobjectResponse *, const char*); … … 120 132 #define SOAP_TYPE_ns1__delete_USCOREinstance (39) 121 133 #endif 134 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__delete_USCOREinstance(struct soap*, struct ns1__delete_USCOREinstance *); 122 135 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__delete_USCOREinstance(struct soap*, const struct ns1__delete_USCOREinstance *); 123 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__delete_USCOREinstance(struct soap*, struct ns1__delete_USCOREinstance *);124 136 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__delete_USCOREinstance(struct soap*, const struct ns1__delete_USCOREinstance *, const char*, const char*); 125 137 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__delete_USCOREinstance(struct soap*, const char*, int, const struct ns1__delete_USCOREinstance *, const char*); … … 130 142 #define SOAP_TYPE_ns1__delete_USCOREinstanceResponse (38) 131 143 #endif 144 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__delete_USCOREinstanceResponse(struct soap*, struct ns1__delete_USCOREinstanceResponse *); 132 145 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__delete_USCOREinstanceResponse(struct soap*, const struct ns1__delete_USCOREinstanceResponse *); 133 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__delete_USCOREinstanceResponse(struct soap*, struct ns1__delete_USCOREinstanceResponse *);134 146 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__delete_USCOREinstanceResponse(struct soap*, const struct ns1__delete_USCOREinstanceResponse *, const char*, const char*); 135 147 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__delete_USCOREinstanceResponse(struct soap*, const char*, int, const struct ns1__delete_USCOREinstanceResponse *, const char*); … … 140 152 #define SOAP_TYPE_ns1__find_USCOREinstances (36) 141 153 #endif 154 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__find_USCOREinstances(struct soap*, struct ns1__find_USCOREinstances *); 142 155 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__find_USCOREinstances(struct soap*, const struct ns1__find_USCOREinstances *); 143 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__find_USCOREinstances(struct soap*, struct ns1__find_USCOREinstances *);144 156 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__find_USCOREinstances(struct soap*, const struct ns1__find_USCOREinstances *, const char*, const char*); 145 157 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__find_USCOREinstances(struct soap*, const char*, int, const struct ns1__find_USCOREinstances *, const char*); … … 150 162 #define SOAP_TYPE_ns1__find_USCOREinstancesResponse (33) 151 163 #endif 164 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__find_USCOREinstancesResponse(struct soap*, struct ns1__find_USCOREinstancesResponse *); 152 165 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__find_USCOREinstancesResponse(struct soap*, const struct ns1__find_USCOREinstancesResponse *); 153 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__find_USCOREinstancesResponse(struct soap*, struct ns1__find_USCOREinstancesResponse *);154 166 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__find_USCOREinstancesResponse(struct soap*, const struct ns1__find_USCOREinstancesResponse *, const char*, const char*); 155 167 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__find_USCOREinstancesResponse(struct soap*, const char*, int, const struct ns1__find_USCOREinstancesResponse *, const char*); … … 160 172 #define SOAP_TYPE_ns1__find_USCOREobjects (32) 161 173 #endif 174 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__find_USCOREobjects(struct soap*, struct ns1__find_USCOREobjects *); 162 175 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__find_USCOREobjects(struct soap*, const struct ns1__find_USCOREobjects *); 163 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__find_USCOREobjects(struct soap*, struct ns1__find_USCOREobjects *);164 176 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__find_USCOREobjects(struct soap*, const struct ns1__find_USCOREobjects *, const char*, const char*); 165 177 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__find_USCOREobjects(struct soap*, const char*, int, const struct ns1__find_USCOREobjects *, const char*); … … 170 182 #define SOAP_TYPE_ns1__find_USCOREobjectsResponse (28) 171 183 #endif 184 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__find_USCOREobjectsResponse(struct soap*, struct ns1__find_USCOREobjectsResponse *); 172 185 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__find_USCOREobjectsResponse(struct soap*, const struct ns1__find_USCOREobjectsResponse *); 173 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__find_USCOREobjectsResponse(struct soap*, struct ns1__find_USCOREobjectsResponse *);174 186 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__find_USCOREobjectsResponse(struct soap*, const struct ns1__find_USCOREobjectsResponse *, const char*, const char*); 175 187 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__find_USCOREobjectsResponse(struct soap*, const char*, int, const struct ns1__find_USCOREobjectsResponse *, const char*); … … 180 192 #define SOAP_TYPE_ns1__unlock_USCOREobject (27) 181 193 #endif 194 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__unlock_USCOREobject(struct soap*, struct ns1__unlock_USCOREobject *); 182 195 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__unlock_USCOREobject(struct soap*, const struct ns1__unlock_USCOREobject *); 183 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__unlock_USCOREobject(struct soap*, struct ns1__unlock_USCOREobject *);184 196 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__unlock_USCOREobject(struct soap*, const struct ns1__unlock_USCOREobject *, const char*, const char*); 185 197 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__unlock_USCOREobject(struct soap*, const char*, int, const struct ns1__unlock_USCOREobject *, const char*); … … 190 202 #define SOAP_TYPE_ns1__unlock_USCOREobjectResponse (26) 191 203 #endif 204 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__unlock_USCOREobjectResponse(struct soap*, struct ns1__unlock_USCOREobjectResponse *); 192 205 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__unlock_USCOREobjectResponse(struct soap*, const struct ns1__unlock_USCOREobjectResponse *); 193 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__unlock_USCOREobjectResponse(struct soap*, struct ns1__unlock_USCOREobjectResponse *);194 206 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__unlock_USCOREobjectResponse(struct soap*, const struct ns1__unlock_USCOREobjectResponse *, const char*, const char*); 195 207 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__unlock_USCOREobjectResponse(struct soap*, const char*, int, const struct ns1__unlock_USCOREobjectResponse *, const char*); … … 200 212 #define SOAP_TYPE_ns1__lock_USCOREobject (24) 201 213 #endif 214 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__lock_USCOREobject(struct soap*, struct ns1__lock_USCOREobject *); 202 215 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__lock_USCOREobject(struct soap*, const struct ns1__lock_USCOREobject *); 203 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__lock_USCOREobject(struct soap*, struct ns1__lock_USCOREobject *);204 216 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__lock_USCOREobject(struct soap*, const struct ns1__lock_USCOREobject *, const char*, const char*); 205 217 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__lock_USCOREobject(struct soap*, const char*, int, const struct ns1__lock_USCOREobject *, const char*); … … 210 222 #define SOAP_TYPE_ns1__lock_USCOREobjectResponse (23) 211 223 #endif 224 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__lock_USCOREobjectResponse(struct soap*, struct ns1__lock_USCOREobjectResponse *); 212 225 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__lock_USCOREobjectResponse(struct soap*, const struct ns1__lock_USCOREobjectResponse *); 213 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__lock_USCOREobjectResponse(struct soap*, struct ns1__lock_USCOREobjectResponse *);214 226 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__lock_USCOREobjectResponse(struct soap*, const struct ns1__lock_USCOREobjectResponse *, const char*, const char*); 215 227 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__lock_USCOREobjectResponse(struct soap*, const char*, int, const struct ns1__lock_USCOREobjectResponse *, const char*); … … 220 232 #define SOAP_TYPE_ns1__replicate_USCOREobject (20) 221 233 #endif 234 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__replicate_USCOREobject(struct soap*, struct ns1__replicate_USCOREobject *); 222 235 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__replicate_USCOREobject(struct soap*, const struct ns1__replicate_USCOREobject *); 223 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__replicate_USCOREobject(struct soap*, struct ns1__replicate_USCOREobject *);224 236 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__replicate_USCOREobject(struct soap*, const struct ns1__replicate_USCOREobject *, const char*, const char*); 225 237 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__replicate_USCOREobject(struct soap*, const char*, int, const struct ns1__replicate_USCOREobject *, const char*); … … 230 242 #define SOAP_TYPE_ns1__replicate_USCOREobjectResponse (19) 231 243 #endif 244 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__replicate_USCOREobjectResponse(struct soap*, struct ns1__replicate_USCOREobjectResponse *); 232 245 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__replicate_USCOREobjectResponse(struct soap*, const struct ns1__replicate_USCOREobjectResponse *); 233 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__replicate_USCOREobjectResponse(struct soap*, struct ns1__replicate_USCOREobjectResponse *);234 246 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__replicate_USCOREobjectResponse(struct soap*, const struct ns1__replicate_USCOREobjectResponse *, const char*, const char*); 235 247 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__replicate_USCOREobjectResponse(struct soap*, const char*, int, const struct ns1__replicate_USCOREobjectResponse *, const char*); … … 240 252 #define SOAP_TYPE_ns1__rename_USCOREobject_ (17) 241 253 #endif 254 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__rename_USCOREobject_(struct soap*, struct ns1__rename_USCOREobject_ *); 242 255 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__rename_USCOREobject_(struct soap*, const struct ns1__rename_USCOREobject_ *); 243 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__rename_USCOREobject_(struct soap*, struct ns1__rename_USCOREobject_ *);244 256 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__rename_USCOREobject_(struct soap*, const struct ns1__rename_USCOREobject_ *, const char*, const char*); 245 257 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__rename_USCOREobject_(struct soap*, const char*, int, const struct ns1__rename_USCOREobject_ *, const char*); … … 250 262 #define SOAP_TYPE_ns1__rename_USCOREobject_Response (16) 251 263 #endif 264 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__rename_USCOREobject_Response(struct soap*, struct ns1__rename_USCOREobject_Response *); 252 265 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__rename_USCOREobject_Response(struct soap*, const struct ns1__rename_USCOREobject_Response *); 253 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__rename_USCOREobject_Response(struct soap*, struct ns1__rename_USCOREobject_Response *);254 266 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__rename_USCOREobject_Response(struct soap*, const struct ns1__rename_USCOREobject_Response *, const char*, const char*); 255 267 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__rename_USCOREobject_Response(struct soap*, const char*, int, const struct ns1__rename_USCOREobject_Response *, const char*); … … 260 272 #define SOAP_TYPE_ns1__rename_USCOREobject (14) 261 273 #endif 274 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__rename_USCOREobject(struct soap*, struct ns1__rename_USCOREobject *); 262 275 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__rename_USCOREobject(struct soap*, const struct ns1__rename_USCOREobject *); 263 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__rename_USCOREobject(struct soap*, struct ns1__rename_USCOREobject *);264 276 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__rename_USCOREobject(struct soap*, const struct ns1__rename_USCOREobject *, const char*, const char*); 265 277 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__rename_USCOREobject(struct soap*, const char*, int, const struct ns1__rename_USCOREobject *, const char*); … … 270 282 #define SOAP_TYPE_ns1__rename_USCOREobjectResponse (13) 271 283 #endif 284 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__rename_USCOREobjectResponse(struct soap*, struct ns1__rename_USCOREobjectResponse *); 272 285 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__rename_USCOREobjectResponse(struct soap*, const struct ns1__rename_USCOREobjectResponse *); 273 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__rename_USCOREobjectResponse(struct soap*, struct ns1__rename_USCOREobjectResponse *);274 286 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__rename_USCOREobjectResponse(struct soap*, const struct ns1__rename_USCOREobjectResponse *, const char*, const char*); 275 287 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__rename_USCOREobjectResponse(struct soap*, const char*, int, const struct ns1__rename_USCOREobjectResponse *, const char*); … … 280 292 #define SOAP_TYPE_ns1__create_USCOREobject (11) 281 293 #endif 294 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__create_USCOREobject(struct soap*, struct ns1__create_USCOREobject *); 282 295 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__create_USCOREobject(struct soap*, const struct ns1__create_USCOREobject *); 283 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__create_USCOREobject(struct soap*, struct ns1__create_USCOREobject *);284 296 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__create_USCOREobject(struct soap*, const struct ns1__create_USCOREobject *, const char*, const char*); 285 297 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__create_USCOREobject(struct soap*, const char*, int, const struct ns1__create_USCOREobject *, const char*); … … 290 302 #define SOAP_TYPE_ns1__create_USCOREobjectResponse (10) 291 303 #endif 304 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__create_USCOREobjectResponse(struct soap*, struct ns1__create_USCOREobjectResponse *); 292 305 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__create_USCOREobjectResponse(struct soap*, const struct ns1__create_USCOREobjectResponse *); 293 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__create_USCOREobjectResponse(struct soap*, struct ns1__create_USCOREobjectResponse *);294 306 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__create_USCOREobjectResponse(struct soap*, const struct ns1__create_USCOREobjectResponse *, const char*, const char*); 295 307 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__create_USCOREobjectResponse(struct soap*, const char*, int, const struct ns1__create_USCOREobjectResponse *, const char*); … … 300 312 #define SOAP_TYPE_ArrayOfString (7) 301 313 #endif 314 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ArrayOfString(struct soap*, struct ArrayOfString *); 302 315 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ArrayOfString(struct soap*, struct ArrayOfString const*); 303 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ArrayOfString(struct soap*, struct ArrayOfString *);304 316 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ArrayOfString(struct soap*, const struct ArrayOfString *, const char*, const char*); 305 317 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ArrayOfString(struct soap*, const char*, int, const struct ArrayOfString *, const char*); … … 309 321 #ifndef WITH_NOGLOBAL 310 322 323 #ifndef SOAP_TYPE_PointerToSOAP_ENV__Reason 324 #define SOAP_TYPE_PointerToSOAP_ENV__Reason (53) 325 #endif 326 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *const*); 327 SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *const*, const char*, const char*); 328 SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Reason(struct soap*, const char *, int, struct SOAP_ENV__Reason *const*, const char *); 329 SOAP_FMAC3 struct SOAP_ENV__Reason ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason **, const char*, const char*); 330 SOAP_FMAC3 struct SOAP_ENV__Reason ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Reason(struct soap*, const char*, struct SOAP_ENV__Reason **, const char*); 331 332 #endif 333 334 #ifndef WITH_NOGLOBAL 335 311 336 #ifndef SOAP_TYPE_PointerToSOAP_ENV__Detail 312 #define SOAP_TYPE_PointerToSOAP_ENV__Detail (5 1)337 #define SOAP_TYPE_PointerToSOAP_ENV__Detail (52) 313 338 #endif 314 339 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *const*); … … 323 348 324 349 #ifndef SOAP_TYPE_PointerToSOAP_ENV__Code 325 #define SOAP_TYPE_PointerToSOAP_ENV__Code (4 8)350 #define SOAP_TYPE_PointerToSOAP_ENV__Code (46) 326 351 #endif 327 352 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *const*); … … 386 411 SOAP_FMAC3 char *** SOAP_FMAC4 soap_get_PointerTostring(struct soap*, char ***, const char*, const char*); 387 412 SOAP_FMAC3 char *** SOAP_FMAC4 soap_in_PointerTostring(struct soap*, const char*, char ***, const char*); 388 389 #ifndef SOAP_TYPE_SOAP_ENC__arrayType390 #define SOAP_TYPE_SOAP_ENC__arrayType (6)391 #endif392 SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENC__arrayType(struct soap*, char **);393 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENC__arrayType(struct soap*, char *const*);394 SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENC__arrayType(struct soap*, char *const*, const char*, const char*);395 SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENC__arrayType(struct soap*, const char*, int, char*const*, const char*);396 SOAP_FMAC3 char ** SOAP_FMAC4 soap_get_SOAP_ENC__arrayType(struct soap*, char **, const char*, const char*);397 SOAP_FMAC3 char * * SOAP_FMAC4 soap_in_SOAP_ENC__arrayType(struct soap*, const char*, char **, const char*);398 413 399 414 #ifndef SOAP_TYPE__QName … … 408 423 409 424 #ifndef SOAP_TYPE_string 410 #define SOAP_TYPE_string ( 3)425 #define SOAP_TYPE_string (4) 411 426 #endif 412 427 SOAP_FMAC3 void SOAP_FMAC4 soap_default_string(struct soap*, char **); … … 417 432 SOAP_FMAC3 char * * SOAP_FMAC4 soap_in_string(struct soap*, const char*, char **, const char*); 418 433 419 SOAP_END_NAMESPACE(soap)420 421 434 #ifdef __cplusplus 422 435 } -
trunk/Nebulous/nebclient/src/soapServer.c
r13096 r19542 1 1 /* soapServer.c 2 Generated by gSOAP 2.7. 2from src/nebulous.h3 Copyright (C) 2000-2005, Robert van Engelen, Genivia Inc. All Rights Reserved.2 Generated by gSOAP 2.7.11 from src/nebulous.h 3 Copyright(C) 2000-2008, Robert van Engelen, Genivia Inc. All Rights Reserved. 4 4 This part of the software is released under one of the following licenses: 5 5 GPL, the gSOAP public license, or Genivia's license for commercial use. … … 10 10 #endif 11 11 12 SOAP_BEGIN_NAMESPACE(soap) 13 14 SOAP_SOURCE_STAMP("@(#) soapServer.c ver 2.7.2 2007-05-01 02:53:36 GMT") 12 SOAP_SOURCE_STAMP("@(#) soapServer.c ver 2.7.11 2008-09-13 01:14:39 GMT") 15 13 16 14 17 15 SOAP_FMAC5 int SOAP_FMAC6 soap_serve(struct soap *soap) 18 16 { 19 unsigned int n = soap->max_keep_alive; 17 #ifndef WITH_FASTCGI 18 unsigned int k = soap->max_keep_alive; 19 #endif 20 20 21 do 21 { soap_begin(soap); 22 if (!--n) 22 { 23 #ifdef WITH_FASTCGI 24 if (FCGI_Accept() < 0) 25 { 26 soap->error = SOAP_EOF; 27 return soap_send_fault(soap); 28 } 29 #endif 30 31 soap_begin(soap); 32 33 #ifndef WITH_FASTCGI 34 if (soap->max_keep_alive > 0 && !--k) 23 35 soap->keep_alive = 0; 36 #endif 37 24 38 if (soap_begin_recv(soap)) 25 39 { if (soap->error < SOAP_STOP) 40 { 41 #ifdef WITH_FASTCGI 42 soap_send_fault(soap); 43 #else 26 44 return soap_send_fault(soap); 45 #endif 46 } 27 47 soap_closesock(soap); 48 28 49 continue; 29 50 } 51 30 52 if (soap_envelope_begin_in(soap) 31 53 || soap_recv_header(soap) 32 54 || soap_body_begin_in(soap) 33 || soap_serve_request(soap) || (soap->fserveloop && soap->fserveloop(soap))) 55 || soap_serve_request(soap) 56 || (soap->fserveloop && soap->fserveloop(soap))) 57 { 58 #ifdef WITH_FASTCGI 59 soap_send_fault(soap); 60 #else 34 61 return soap_send_fault(soap); 35 62 #endif 63 } 64 65 #ifdef WITH_FASTCGI 66 soap_destroy(soap); 67 soap_end(soap); 68 } while (1); 69 #else 36 70 } while (soap->keep_alive); 71 #endif 37 72 return SOAP_OK; 38 73 } … … 79 114 if (soap_body_end_in(soap) 80 115 || soap_envelope_end_in(soap) 81 #ifndef WITH_LEANER82 || soap_resolve_attachments(soap)83 #endif84 116 || soap_end_recv(soap)) 85 117 return soap->error; … … 89 121 soap_serializeheader(soap); 90 122 soap_serialize_ns1__create_USCOREobjectResponse(soap, &soap_tmp_ns1__create_USCOREobjectResponse); 91 soap_begin_count(soap); 92 if (soap->mode & SOAP_IO_LENGTH) 93 { soap_envelope_begin_out(soap); 94 soap_putheader(soap); 95 soap_body_begin_out(soap); 96 soap_put_ns1__create_USCOREobjectResponse(soap, &soap_tmp_ns1__create_USCOREobjectResponse, "ns1:create_objectResponse", ""); 97 soap_body_end_out(soap); 98 soap_envelope_end_out(soap); 99 }; 100 if (soap_response(soap, SOAP_OK) 123 if (soap_begin_count(soap)) 124 return soap->error; 125 if (soap->mode & SOAP_IO_LENGTH) 126 { if (soap_envelope_begin_out(soap) 127 || soap_putheader(soap) 128 || soap_body_begin_out(soap) 129 || soap_put_ns1__create_USCOREobjectResponse(soap, &soap_tmp_ns1__create_USCOREobjectResponse, "ns1:create_objectResponse", "") 130 || soap_body_end_out(soap) 131 || soap_envelope_end_out(soap)) 132 return soap->error; 133 }; 134 if (soap_end_count(soap) 135 || soap_response(soap, SOAP_OK) 101 136 || soap_envelope_begin_out(soap) 102 137 || soap_putheader(soap) … … 123 158 if (soap_body_end_in(soap) 124 159 || soap_envelope_end_in(soap) 125 #ifndef WITH_LEANER126 || soap_resolve_attachments(soap)127 #endif128 160 || soap_end_recv(soap)) 129 161 return soap->error; … … 133 165 soap_serializeheader(soap); 134 166 soap_serialize_ns1__rename_USCOREobjectResponse(soap, &soap_tmp_ns1__rename_USCOREobjectResponse); 135 soap_begin_count(soap); 136 if (soap->mode & SOAP_IO_LENGTH) 137 { soap_envelope_begin_out(soap); 138 soap_putheader(soap); 139 soap_body_begin_out(soap); 140 soap_put_ns1__rename_USCOREobjectResponse(soap, &soap_tmp_ns1__rename_USCOREobjectResponse, "ns1:rename_objectResponse", ""); 141 soap_body_end_out(soap); 142 soap_envelope_end_out(soap); 143 }; 144 if (soap_response(soap, SOAP_OK) 167 if (soap_begin_count(soap)) 168 return soap->error; 169 if (soap->mode & SOAP_IO_LENGTH) 170 { if (soap_envelope_begin_out(soap) 171 || soap_putheader(soap) 172 || soap_body_begin_out(soap) 173 || soap_put_ns1__rename_USCOREobjectResponse(soap, &soap_tmp_ns1__rename_USCOREobjectResponse, "ns1:rename_objectResponse", "") 174 || soap_body_end_out(soap) 175 || soap_envelope_end_out(soap)) 176 return soap->error; 177 }; 178 if (soap_end_count(soap) 179 || soap_response(soap, SOAP_OK) 145 180 || soap_envelope_begin_out(soap) 146 181 || soap_putheader(soap) … … 167 202 if (soap_body_end_in(soap) 168 203 || soap_envelope_end_in(soap) 169 #ifndef WITH_LEANER170 || soap_resolve_attachments(soap)171 #endif172 204 || soap_end_recv(soap)) 173 205 return soap->error; … … 177 209 soap_serializeheader(soap); 178 210 soap_serialize_ns1__rename_USCOREobject_Response(soap, &soap_tmp_ns1__rename_USCOREobject_Response); 179 soap_begin_count(soap); 180 if (soap->mode & SOAP_IO_LENGTH) 181 { soap_envelope_begin_out(soap); 182 soap_putheader(soap); 183 soap_body_begin_out(soap); 184 soap_put_ns1__rename_USCOREobject_Response(soap, &soap_tmp_ns1__rename_USCOREobject_Response, "ns1:rename_object-Response", ""); 185 soap_body_end_out(soap); 186 soap_envelope_end_out(soap); 187 }; 188 if (soap_response(soap, SOAP_OK) 211 if (soap_begin_count(soap)) 212 return soap->error; 213 if (soap->mode & SOAP_IO_LENGTH) 214 { if (soap_envelope_begin_out(soap) 215 || soap_putheader(soap) 216 || soap_body_begin_out(soap) 217 || soap_put_ns1__rename_USCOREobject_Response(soap, &soap_tmp_ns1__rename_USCOREobject_Response, "ns1:rename_object-Response", "") 218 || soap_body_end_out(soap) 219 || soap_envelope_end_out(soap)) 220 return soap->error; 221 }; 222 if (soap_end_count(soap) 223 || soap_response(soap, SOAP_OK) 189 224 || soap_envelope_begin_out(soap) 190 225 || soap_putheader(soap) … … 211 246 if (soap_body_end_in(soap) 212 247 || soap_envelope_end_in(soap) 213 #ifndef WITH_LEANER214 || soap_resolve_attachments(soap)215 #endif216 248 || soap_end_recv(soap)) 217 249 return soap->error; … … 221 253 soap_serializeheader(soap); 222 254 soap_serialize_ns1__replicate_USCOREobjectResponse(soap, &soap_tmp_ns1__replicate_USCOREobjectResponse); 223 soap_begin_count(soap); 224 if (soap->mode & SOAP_IO_LENGTH) 225 { soap_envelope_begin_out(soap); 226 soap_putheader(soap); 227 soap_body_begin_out(soap); 228 soap_put_ns1__replicate_USCOREobjectResponse(soap, &soap_tmp_ns1__replicate_USCOREobjectResponse, "ns1:replicate_objectResponse", ""); 229 soap_body_end_out(soap); 230 soap_envelope_end_out(soap); 231 }; 232 if (soap_response(soap, SOAP_OK) 255 if (soap_begin_count(soap)) 256 return soap->error; 257 if (soap->mode & SOAP_IO_LENGTH) 258 { if (soap_envelope_begin_out(soap) 259 || soap_putheader(soap) 260 || soap_body_begin_out(soap) 261 || soap_put_ns1__replicate_USCOREobjectResponse(soap, &soap_tmp_ns1__replicate_USCOREobjectResponse, "ns1:replicate_objectResponse", "") 262 || soap_body_end_out(soap) 263 || soap_envelope_end_out(soap)) 264 return soap->error; 265 }; 266 if (soap_end_count(soap) 267 || soap_response(soap, SOAP_OK) 233 268 || soap_envelope_begin_out(soap) 234 269 || soap_putheader(soap) … … 255 290 if (soap_body_end_in(soap) 256 291 || soap_envelope_end_in(soap) 257 #ifndef WITH_LEANER258 || soap_resolve_attachments(soap)259 #endif260 292 || soap_end_recv(soap)) 261 293 return soap->error; … … 265 297 soap_serializeheader(soap); 266 298 soap_serialize_ns1__lock_USCOREobjectResponse(soap, &soap_tmp_ns1__lock_USCOREobjectResponse); 267 soap_begin_count(soap); 268 if (soap->mode & SOAP_IO_LENGTH) 269 { soap_envelope_begin_out(soap); 270 soap_putheader(soap); 271 soap_body_begin_out(soap); 272 soap_put_ns1__lock_USCOREobjectResponse(soap, &soap_tmp_ns1__lock_USCOREobjectResponse, "ns1:lock_objectResponse", ""); 273 soap_body_end_out(soap); 274 soap_envelope_end_out(soap); 275 }; 276 if (soap_response(soap, SOAP_OK) 299 if (soap_begin_count(soap)) 300 return soap->error; 301 if (soap->mode & SOAP_IO_LENGTH) 302 { if (soap_envelope_begin_out(soap) 303 || soap_putheader(soap) 304 || soap_body_begin_out(soap) 305 || soap_put_ns1__lock_USCOREobjectResponse(soap, &soap_tmp_ns1__lock_USCOREobjectResponse, "ns1:lock_objectResponse", "") 306 || soap_body_end_out(soap) 307 || soap_envelope_end_out(soap)) 308 return soap->error; 309 }; 310 if (soap_end_count(soap) 311 || soap_response(soap, SOAP_OK) 277 312 || soap_envelope_begin_out(soap) 278 313 || soap_putheader(soap) … … 299 334 if (soap_body_end_in(soap) 300 335 || soap_envelope_end_in(soap) 301 #ifndef WITH_LEANER302 || soap_resolve_attachments(soap)303 #endif304 336 || soap_end_recv(soap)) 305 337 return soap->error; … … 309 341 soap_serializeheader(soap); 310 342 soap_serialize_ns1__unlock_USCOREobjectResponse(soap, &soap_tmp_ns1__unlock_USCOREobjectResponse); 311 soap_begin_count(soap); 312 if (soap->mode & SOAP_IO_LENGTH) 313 { soap_envelope_begin_out(soap); 314 soap_putheader(soap); 315 soap_body_begin_out(soap); 316 soap_put_ns1__unlock_USCOREobjectResponse(soap, &soap_tmp_ns1__unlock_USCOREobjectResponse, "ns1:unlock_objectResponse", ""); 317 soap_body_end_out(soap); 318 soap_envelope_end_out(soap); 319 }; 320 if (soap_response(soap, SOAP_OK) 343 if (soap_begin_count(soap)) 344 return soap->error; 345 if (soap->mode & SOAP_IO_LENGTH) 346 { if (soap_envelope_begin_out(soap) 347 || soap_putheader(soap) 348 || soap_body_begin_out(soap) 349 || soap_put_ns1__unlock_USCOREobjectResponse(soap, &soap_tmp_ns1__unlock_USCOREobjectResponse, "ns1:unlock_objectResponse", "") 350 || soap_body_end_out(soap) 351 || soap_envelope_end_out(soap)) 352 return soap->error; 353 }; 354 if (soap_end_count(soap) 355 || soap_response(soap, SOAP_OK) 321 356 || soap_envelope_begin_out(soap) 322 357 || soap_putheader(soap) … … 332 367 SOAP_FMAC5 int SOAP_FMAC6 soap_serve_ns1__find_USCOREobjects(struct soap *soap) 333 368 { struct ns1__find_USCOREobjects soap_tmp_ns1__find_USCOREobjects; 334 struct ns1__find_USCOREobjectsResponse param_1;335 soap_default_ns1__find_USCOREobjectsResponse(soap, & param_1);369 struct ns1__find_USCOREobjectsResponse _param_1; 370 soap_default_ns1__find_USCOREobjectsResponse(soap, &_param_1); 336 371 soap_default_ns1__find_USCOREobjects(soap, &soap_tmp_ns1__find_USCOREobjects); 337 372 soap->encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/"; … … 340 375 if (soap_body_end_in(soap) 341 376 || soap_envelope_end_in(soap) 342 #ifndef WITH_LEANER 343 || soap_resolve_attachments(soap)344 #endif 345 || soap_end_recv(soap))346 return soap->error; 347 soap ->error = ns1__find_USCOREobjects(soap, soap_tmp_ns1__find_USCOREobjects.pattern, ¶m_1);348 if (soap->error)349 return soap->error;350 soap_serializeheader(soap);351 soap_serialize_ns1__find_USCOREobjectsResponse(soap, ¶m_1);352 soap_begin_count(soap);353 if (soap->mode & SOAP_IO_LENGTH)354 { soap_envelope_begin_out(soap);355 soap_putheader(soap);356 soap_body_begin_out(soap);357 soap_put_ns1__find_USCOREobjectsResponse(soap, ¶m_1, "ns1:find_objectsResponse", "");358 soap_body_end_out(soap);359 soap_envelope_end_out(soap);360 };361 if (soap_response(soap, SOAP_OK)362 || soap_envelope_begin_out(soap) 363 || soap_putheader(soap) 364 || soap_body_begin_out(soap) 365 || soap_put_ns1__find_USCOREobjectsResponse(soap, & param_1, "ns1:find_objectsResponse", "")377 || soap_end_recv(soap)) 378 return soap->error; 379 soap->error = ns1__find_USCOREobjects(soap, soap_tmp_ns1__find_USCOREobjects.pattern, &_param_1); 380 if (soap->error) 381 return soap->error; 382 soap_serializeheader(soap); 383 soap_serialize_ns1__find_USCOREobjectsResponse(soap, &_param_1); 384 if (soap_begin_count(soap)) 385 return soap->error; 386 if (soap->mode & SOAP_IO_LENGTH) 387 { if (soap_envelope_begin_out(soap) 388 || soap_putheader(soap) 389 || soap_body_begin_out(soap) 390 || soap_put_ns1__find_USCOREobjectsResponse(soap, &_param_1, "ns1:find_objectsResponse", "") 391 || soap_body_end_out(soap) 392 || soap_envelope_end_out(soap)) 393 return soap->error; 394 }; 395 if (soap_end_count(soap) 396 || soap_response(soap, SOAP_OK) 397 || soap_envelope_begin_out(soap) 398 || soap_putheader(soap) 399 || soap_body_begin_out(soap) 400 || soap_put_ns1__find_USCOREobjectsResponse(soap, &_param_1, "ns1:find_objectsResponse", "") 366 401 || soap_body_end_out(soap) 367 402 || soap_envelope_end_out(soap) … … 373 408 SOAP_FMAC5 int SOAP_FMAC6 soap_serve_ns1__find_USCOREinstances(struct soap *soap) 374 409 { struct ns1__find_USCOREinstances soap_tmp_ns1__find_USCOREinstances; 375 struct ns1__find_USCOREinstancesResponse param_2;376 soap_default_ns1__find_USCOREinstancesResponse(soap, & param_2);410 struct ns1__find_USCOREinstancesResponse _param_2; 411 soap_default_ns1__find_USCOREinstancesResponse(soap, &_param_2); 377 412 soap_default_ns1__find_USCOREinstances(soap, &soap_tmp_ns1__find_USCOREinstances); 378 413 soap->encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/"; … … 381 416 if (soap_body_end_in(soap) 382 417 || soap_envelope_end_in(soap) 383 #ifndef WITH_LEANER 384 || soap_resolve_attachments(soap)385 #endif 386 || soap_end_recv(soap))387 return soap->error; 388 soap ->error = ns1__find_USCOREinstances(soap, soap_tmp_ns1__find_USCOREinstances.key, soap_tmp_ns1__find_USCOREinstances.volume, ¶m_2);389 if (soap->error)390 return soap->error;391 soap_serializeheader(soap);392 soap_serialize_ns1__find_USCOREinstancesResponse(soap, ¶m_2);393 soap_begin_count(soap);394 if (soap->mode & SOAP_IO_LENGTH)395 { soap_envelope_begin_out(soap);396 soap_putheader(soap);397 soap_body_begin_out(soap);398 soap_put_ns1__find_USCOREinstancesResponse(soap, ¶m_2, "ns1:find_instancesResponse", "");399 soap_body_end_out(soap);400 soap_envelope_end_out(soap);401 };402 if (soap_response(soap, SOAP_OK)403 || soap_envelope_begin_out(soap) 404 || soap_putheader(soap) 405 || soap_body_begin_out(soap) 406 || soap_put_ns1__find_USCOREinstancesResponse(soap, & param_2, "ns1:find_instancesResponse", "")418 || soap_end_recv(soap)) 419 return soap->error; 420 soap->error = ns1__find_USCOREinstances(soap, soap_tmp_ns1__find_USCOREinstances.key, soap_tmp_ns1__find_USCOREinstances.volume, &_param_2); 421 if (soap->error) 422 return soap->error; 423 soap_serializeheader(soap); 424 soap_serialize_ns1__find_USCOREinstancesResponse(soap, &_param_2); 425 if (soap_begin_count(soap)) 426 return soap->error; 427 if (soap->mode & SOAP_IO_LENGTH) 428 { if (soap_envelope_begin_out(soap) 429 || soap_putheader(soap) 430 || soap_body_begin_out(soap) 431 || soap_put_ns1__find_USCOREinstancesResponse(soap, &_param_2, "ns1:find_instancesResponse", "") 432 || soap_body_end_out(soap) 433 || soap_envelope_end_out(soap)) 434 return soap->error; 435 }; 436 if (soap_end_count(soap) 437 || soap_response(soap, SOAP_OK) 438 || soap_envelope_begin_out(soap) 439 || soap_putheader(soap) 440 || soap_body_begin_out(soap) 441 || soap_put_ns1__find_USCOREinstancesResponse(soap, &_param_2, "ns1:find_instancesResponse", "") 407 442 || soap_body_end_out(soap) 408 443 || soap_envelope_end_out(soap) … … 425 460 if (soap_body_end_in(soap) 426 461 || soap_envelope_end_in(soap) 427 #ifndef WITH_LEANER428 || soap_resolve_attachments(soap)429 #endif430 462 || soap_end_recv(soap)) 431 463 return soap->error; … … 435 467 soap_serializeheader(soap); 436 468 soap_serialize_ns1__delete_USCOREinstanceResponse(soap, &soap_tmp_ns1__delete_USCOREinstanceResponse); 437 soap_begin_count(soap); 438 if (soap->mode & SOAP_IO_LENGTH) 439 { soap_envelope_begin_out(soap); 440 soap_putheader(soap); 441 soap_body_begin_out(soap); 442 soap_put_ns1__delete_USCOREinstanceResponse(soap, &soap_tmp_ns1__delete_USCOREinstanceResponse, "ns1:delete_instanceResponse", ""); 443 soap_body_end_out(soap); 444 soap_envelope_end_out(soap); 445 }; 446 if (soap_response(soap, SOAP_OK) 469 if (soap_begin_count(soap)) 470 return soap->error; 471 if (soap->mode & SOAP_IO_LENGTH) 472 { if (soap_envelope_begin_out(soap) 473 || soap_putheader(soap) 474 || soap_body_begin_out(soap) 475 || soap_put_ns1__delete_USCOREinstanceResponse(soap, &soap_tmp_ns1__delete_USCOREinstanceResponse, "ns1:delete_instanceResponse", "") 476 || soap_body_end_out(soap) 477 || soap_envelope_end_out(soap)) 478 return soap->error; 479 }; 480 if (soap_end_count(soap) 481 || soap_response(soap, SOAP_OK) 447 482 || soap_envelope_begin_out(soap) 448 483 || soap_putheader(soap) … … 458 493 SOAP_FMAC5 int SOAP_FMAC6 soap_serve_ns1__stat_USCOREobject(struct soap *soap) 459 494 { struct ns1__stat_USCOREobject soap_tmp_ns1__stat_USCOREobject; 460 struct ns1__stat_USCOREobjectResponse param_3;461 soap_default_ns1__stat_USCOREobjectResponse(soap, & param_3);495 struct ns1__stat_USCOREobjectResponse _param_3; 496 soap_default_ns1__stat_USCOREobjectResponse(soap, &_param_3); 462 497 soap_default_ns1__stat_USCOREobject(soap, &soap_tmp_ns1__stat_USCOREobject); 463 498 soap->encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/"; … … 466 501 if (soap_body_end_in(soap) 467 502 || soap_envelope_end_in(soap) 468 #ifndef WITH_LEANER 469 || soap_resolve_attachments(soap) 470 #endif 471 || soap_end_recv(soap)) 472 return soap->error; 473 soap->error = ns1__stat_USCOREobject(soap, soap_tmp_ns1__stat_USCOREobject.key, ¶m_3); 474 if (soap->error) 475 return soap->error; 476 soap_serializeheader(soap); 477 soap_serialize_ns1__stat_USCOREobjectResponse(soap, ¶m_3); 478 soap_begin_count(soap); 479 if (soap->mode & SOAP_IO_LENGTH) 480 { soap_envelope_begin_out(soap); 481 soap_putheader(soap); 482 soap_body_begin_out(soap); 483 soap_put_ns1__stat_USCOREobjectResponse(soap, ¶m_3, "ns1:stat_objectResponse", ""); 484 soap_body_end_out(soap); 485 soap_envelope_end_out(soap); 486 }; 487 if (soap_response(soap, SOAP_OK) 488 || soap_envelope_begin_out(soap) 489 || soap_putheader(soap) 490 || soap_body_begin_out(soap) 491 || soap_put_ns1__stat_USCOREobjectResponse(soap, ¶m_3, "ns1:stat_objectResponse", "") 492 || soap_body_end_out(soap) 493 || soap_envelope_end_out(soap) 494 || soap_end_send(soap)) 495 return soap->error; 496 return soap_closesock(soap); 497 } 498 499 SOAP_END_NAMESPACE(soap) 503 || soap_end_recv(soap)) 504 return soap->error; 505 soap->error = ns1__stat_USCOREobject(soap, soap_tmp_ns1__stat_USCOREobject.key, &_param_3); 506 if (soap->error) 507 return soap->error; 508 soap_serializeheader(soap); 509 soap_serialize_ns1__stat_USCOREobjectResponse(soap, &_param_3); 510 if (soap_begin_count(soap)) 511 return soap->error; 512 if (soap->mode & SOAP_IO_LENGTH) 513 { if (soap_envelope_begin_out(soap) 514 || soap_putheader(soap) 515 || soap_body_begin_out(soap) 516 || soap_put_ns1__stat_USCOREobjectResponse(soap, &_param_3, "ns1:stat_objectResponse", "") 517 || soap_body_end_out(soap) 518 || soap_envelope_end_out(soap)) 519 return soap->error; 520 }; 521 if (soap_end_count(soap) 522 || soap_response(soap, SOAP_OK) 523 || soap_envelope_begin_out(soap) 524 || soap_putheader(soap) 525 || soap_body_begin_out(soap) 526 || soap_put_ns1__stat_USCOREobjectResponse(soap, &_param_3, "ns1:stat_objectResponse", "") 527 || soap_body_end_out(soap) 528 || soap_envelope_end_out(soap) 529 || soap_end_send(soap)) 530 return soap->error; 531 return soap_closesock(soap); 532 } 500 533 501 534 #ifdef __cplusplus -
trunk/Nebulous/nebclient/src/soapServerLib.c
r10631 r19542 1 1 /* soapServerLib.c 2 Generated by gSOAP 2.7. 2from src/nebulous.h3 Copyright (C) 2000-2005, Robert van Engelen, Genivia Inc. All Rights Reserved.2 Generated by gSOAP 2.7.11 from src/nebulous.h 3 Copyright(C) 2000-2008, Robert van Engelen, Genivia Inc. All Rights Reserved. 4 4 This part of the software is released under one of the following licenses: 5 5 GPL, the gSOAP public license, or Genivia's license for commercial use. -
trunk/Nebulous/nebclient/src/soapStub.h
r13096 r19542 1 1 /* soapStub.h 2 Generated by gSOAP 2.7. 2from src/nebulous.h3 Copyright (C) 2000-2005, Robert van Engelen, Genivia Inc. All Rights Reserved.2 Generated by gSOAP 2.7.11 from src/nebulous.h 3 Copyright(C) 2000-2008, Robert van Engelen, Genivia Inc. All Rights Reserved. 4 4 This part of the software is released under one of the following licenses: 5 5 GPL, the gSOAP public license, or Genivia's license for commercial use. 6 6 */ 7 7 8 #ifndef soapStub_H 8 9 #define soapStub_H … … 12 13 #endif 13 14 14 SOAP_BEGIN_NAMESPACE(soap)15 16 15 /******************************************************************************\ 17 16 * * … … 28 27 29 28 29 #if 0 /* volatile type: do not redeclare here */ 30 31 #endif 32 33 #ifndef SOAP_TYPE_ArrayOfString 34 #define SOAP_TYPE_ArrayOfString (7) 30 35 /* SOAP encoded array of xsd:string schema type: */ 31 36 struct ArrayOfString … … 34 39 int __size; 35 40 }; 36 37 /* ns1:create_objectResponse: */ 41 #endif 42 43 #ifndef SOAP_TYPE_ns1__create_USCOREobjectResponse 44 #define SOAP_TYPE_ns1__create_USCOREobjectResponse (10) 45 /* ns1:create_objectResponse */ 38 46 struct ns1__create_USCOREobjectResponse 39 47 { 40 char **result; /* RPC return element */ /* optional element of type xsd:string */ 41 }; 42 43 /* ns1:create_object: */ 48 char **result; /* SOAP 1.2 RPC return element (when namespace qualified) */ /* optional element of type xsd:string */ 49 }; 50 #endif 51 52 #ifndef SOAP_TYPE_ns1__create_USCOREobject 53 #define SOAP_TYPE_ns1__create_USCOREobject (11) 54 /* ns1:create_object */ 44 55 struct ns1__create_USCOREobject 45 56 { … … 47 58 char *volume; /* optional element of type xsd:string */ 48 59 }; 49 50 /* ns1:rename_objectResponse: */ 60 #endif 61 62 #ifndef SOAP_TYPE_ns1__rename_USCOREobjectResponse 63 #define SOAP_TYPE_ns1__rename_USCOREobjectResponse (13) 64 /* ns1:rename_objectResponse */ 51 65 struct ns1__rename_USCOREobjectResponse 52 66 { 53 char **result; /* RPC return element */ /* optional element of type xsd:string */ 54 }; 55 56 /* ns1:rename_object: */ 67 char **result; /* SOAP 1.2 RPC return element (when namespace qualified) */ /* optional element of type xsd:string */ 68 }; 69 #endif 70 71 #ifndef SOAP_TYPE_ns1__rename_USCOREobject 72 #define SOAP_TYPE_ns1__rename_USCOREobject (14) 73 /* ns1:rename_object */ 57 74 struct ns1__rename_USCOREobject 58 75 { … … 60 77 char *newkey; /* optional element of type xsd:string */ 61 78 }; 62 63 /* ns1:rename_object-Response: */ 79 #endif 80 81 #ifndef SOAP_TYPE_ns1__rename_USCOREobject_Response 82 #define SOAP_TYPE_ns1__rename_USCOREobject_Response (16) 83 /* ns1:rename_object-Response */ 64 84 struct ns1__rename_USCOREobject_Response 65 85 { 66 char **result; /* RPC return element */ /* optional element of type xsd:string */ 67 }; 68 69 /* ns1:rename_object: */ 86 char **result; /* SOAP 1.2 RPC return element (when namespace qualified) */ /* optional element of type xsd:string */ 87 }; 88 #endif 89 90 #ifndef SOAP_TYPE_ns1__rename_USCOREobject_ 91 #define SOAP_TYPE_ns1__rename_USCOREobject_ (17) 92 /* ns1:rename_object */ 70 93 struct ns1__rename_USCOREobject_ 71 94 { … … 73 96 char *newkey; /* optional element of type xsd:string */ 74 97 }; 75 76 /* ns1:replicate_objectResponse: */ 98 #endif 99 100 #ifndef SOAP_TYPE_ns1__replicate_USCOREobjectResponse 101 #define SOAP_TYPE_ns1__replicate_USCOREobjectResponse (19) 102 /* ns1:replicate_objectResponse */ 77 103 struct ns1__replicate_USCOREobjectResponse 78 104 { 79 char **result; /* RPC return element */ /* optional element of type xsd:string */ 80 }; 81 82 /* ns1:replicate_object: */ 105 char **result; /* SOAP 1.2 RPC return element (when namespace qualified) */ /* optional element of type xsd:string */ 106 }; 107 #endif 108 109 #ifndef SOAP_TYPE_ns1__replicate_USCOREobject 110 #define SOAP_TYPE_ns1__replicate_USCOREobject (20) 111 /* ns1:replicate_object */ 83 112 struct ns1__replicate_USCOREobject 84 113 { … … 86 115 char *volume; /* optional element of type xsd:string */ 87 116 }; 88 89 /* ns1:lock_objectResponse: */ 117 #endif 118 119 #ifndef SOAP_TYPE_ns1__lock_USCOREobjectResponse 120 #define SOAP_TYPE_ns1__lock_USCOREobjectResponse (23) 121 /* ns1:lock_objectResponse */ 90 122 struct ns1__lock_USCOREobjectResponse 91 123 { 92 int *result; /* RPC return element */ /* optional element of type xsd:int */ 93 }; 94 95 /* ns1:lock_object: */ 124 int *result; /* SOAP 1.2 RPC return element (when namespace qualified) */ /* optional element of type xsd:int */ 125 }; 126 #endif 127 128 #ifndef SOAP_TYPE_ns1__lock_USCOREobject 129 #define SOAP_TYPE_ns1__lock_USCOREobject (24) 130 /* ns1:lock_object */ 96 131 struct ns1__lock_USCOREobject 97 132 { … … 99 134 char *type; /* optional element of type xsd:string */ 100 135 }; 101 102 /* ns1:unlock_objectResponse: */ 136 #endif 137 138 #ifndef SOAP_TYPE_ns1__unlock_USCOREobjectResponse 139 #define SOAP_TYPE_ns1__unlock_USCOREobjectResponse (26) 140 /* ns1:unlock_objectResponse */ 103 141 struct ns1__unlock_USCOREobjectResponse 104 142 { 105 int *result; /* RPC return element */ /* optional element of type xsd:int */ 106 }; 107 108 /* ns1:unlock_object: */ 143 int *result; /* SOAP 1.2 RPC return element (when namespace qualified) */ /* optional element of type xsd:int */ 144 }; 145 #endif 146 147 #ifndef SOAP_TYPE_ns1__unlock_USCOREobject 148 #define SOAP_TYPE_ns1__unlock_USCOREobject (27) 149 /* ns1:unlock_object */ 109 150 struct ns1__unlock_USCOREobject 110 151 { … … 112 153 char *type; /* optional element of type xsd:string */ 113 154 }; 114 115 /* ns1:find_objectsResponse: */ 155 #endif 156 157 #ifndef SOAP_TYPE_ns1__find_USCOREobjectsResponse 158 #define SOAP_TYPE_ns1__find_USCOREobjectsResponse (28) 159 /* ns1:find_objectsResponse */ 116 160 struct ns1__find_USCOREobjectsResponse 117 161 { 118 struct ArrayOfString *result; /* RPC return element */ /* optional element of type ArrayOfstring */ 119 }; 120 121 /* ns1:find_objects: */ 162 struct ArrayOfString *result; /* SOAP 1.2 RPC return element (when namespace qualified) */ /* optional element of type ArrayOfstring */ 163 }; 164 #endif 165 166 #ifndef SOAP_TYPE_ns1__find_USCOREobjects 167 #define SOAP_TYPE_ns1__find_USCOREobjects (32) 168 /* ns1:find_objects */ 122 169 struct ns1__find_USCOREobjects 123 170 { 124 171 char *pattern; /* optional element of type xsd:string */ 125 172 }; 126 127 /* ns1:find_instancesResponse: */ 173 #endif 174 175 #ifndef SOAP_TYPE_ns1__find_USCOREinstancesResponse 176 #define SOAP_TYPE_ns1__find_USCOREinstancesResponse (33) 177 /* ns1:find_instancesResponse */ 128 178 struct ns1__find_USCOREinstancesResponse 129 179 { 130 struct ArrayOfString *result; /* RPC return element */ /* optional element of type ArrayOfstring */ 131 }; 132 133 /* ns1:find_instances: */ 180 struct ArrayOfString *result; /* SOAP 1.2 RPC return element (when namespace qualified) */ /* optional element of type ArrayOfstring */ 181 }; 182 #endif 183 184 #ifndef SOAP_TYPE_ns1__find_USCOREinstances 185 #define SOAP_TYPE_ns1__find_USCOREinstances (36) 186 /* ns1:find_instances */ 134 187 struct ns1__find_USCOREinstances 135 188 { … … 137 190 char *volume; /* optional element of type xsd:string */ 138 191 }; 139 140 /* ns1:delete_instanceResponse: */ 192 #endif 193 194 #ifndef SOAP_TYPE_ns1__delete_USCOREinstanceResponse 195 #define SOAP_TYPE_ns1__delete_USCOREinstanceResponse (38) 196 /* ns1:delete_instanceResponse */ 141 197 struct ns1__delete_USCOREinstanceResponse 142 198 { 143 int *result; /* RPC return element */ /* optional element of type xsd:int */ 144 }; 145 146 /* ns1:delete_instance: */ 199 int *result; /* SOAP 1.2 RPC return element (when namespace qualified) */ /* optional element of type xsd:int */ 200 }; 201 #endif 202 203 #ifndef SOAP_TYPE_ns1__delete_USCOREinstance 204 #define SOAP_TYPE_ns1__delete_USCOREinstance (39) 205 /* ns1:delete_instance */ 147 206 struct ns1__delete_USCOREinstance 148 207 { 149 208 char *uri; /* optional element of type xsd:string */ 150 209 }; 151 152 /* ns1:stat_objectResponse: */ 210 #endif 211 212 #ifndef SOAP_TYPE_ns1__stat_USCOREobjectResponse 213 #define SOAP_TYPE_ns1__stat_USCOREobjectResponse (40) 214 /* ns1:stat_objectResponse */ 153 215 struct ns1__stat_USCOREobjectResponse 154 216 { 155 struct ArrayOfString *result; /* RPC return element */ /* optional element of type ArrayOfstring */ 156 }; 157 158 /* ns1:stat_object: */ 217 struct ArrayOfString *result; /* SOAP 1.2 RPC return element (when namespace qualified) */ /* optional element of type ArrayOfstring */ 218 }; 219 #endif 220 221 #ifndef SOAP_TYPE_ns1__stat_USCOREobject 222 #define SOAP_TYPE_ns1__stat_USCOREobject (43) 223 /* ns1:stat_object */ 159 224 struct ns1__stat_USCOREobject 160 225 { 161 226 char *key; /* optional element of type xsd:string */ 162 227 }; 163 228 #endif 229 230 #ifndef SOAP_TYPE_SOAP_ENV__Header 231 #define SOAP_TYPE_SOAP_ENV__Header (44) 164 232 /* SOAP Header: */ 165 233 struct SOAP_ENV__Header 166 234 { 167 void *dummy; /* transient */ 168 }; 169 235 #ifdef WITH_NOEMPTYSTRUCT 236 char dummy; /* dummy member to enable compilation */ 237 #endif 238 }; 239 #endif 240 241 #ifndef SOAP_TYPE_SOAP_ENV__Code 242 #define SOAP_TYPE_SOAP_ENV__Code (45) 170 243 /* SOAP Fault Code: */ 171 244 struct SOAP_ENV__Code 172 245 { 173 char *SOAP_ENV__Value; /* optional element of type QName */246 char *SOAP_ENV__Value; /* optional element of type xsd:QName */ 174 247 struct SOAP_ENV__Code *SOAP_ENV__Subcode; /* optional element of type SOAP-ENV:Code */ 175 248 }; 176 177 /* SOAP-ENV:Detail: */ 249 #endif 250 251 #ifndef SOAP_TYPE_SOAP_ENV__Detail 252 #define SOAP_TYPE_SOAP_ENV__Detail (47) 253 /* SOAP-ENV:Detail */ 178 254 struct SOAP_ENV__Detail 179 255 { … … 182 258 char *__any; 183 259 }; 184 260 #endif 261 262 #ifndef SOAP_TYPE_SOAP_ENV__Reason 263 #define SOAP_TYPE_SOAP_ENV__Reason (50) 264 /* SOAP-ENV:Reason */ 265 struct SOAP_ENV__Reason 266 { 267 char *SOAP_ENV__Text; /* optional element of type xsd:string */ 268 }; 269 #endif 270 271 #ifndef SOAP_TYPE_SOAP_ENV__Fault 272 #define SOAP_TYPE_SOAP_ENV__Fault (51) 185 273 /* SOAP Fault: */ 186 274 struct SOAP_ENV__Fault 187 275 { 188 char *faultcode; /* optional element of type QName */276 char *faultcode; /* optional element of type xsd:QName */ 189 277 char *faultstring; /* optional element of type xsd:string */ 190 278 char *faultactor; /* optional element of type xsd:string */ 191 279 struct SOAP_ENV__Detail *detail; /* optional element of type SOAP-ENV:Detail */ 192 280 struct SOAP_ENV__Code *SOAP_ENV__Code; /* optional element of type SOAP-ENV:Code */ 193 char *SOAP_ENV__Reason; /* optional element of type xsd:string*/281 struct SOAP_ENV__Reason *SOAP_ENV__Reason; /* optional element of type SOAP-ENV:Reason */ 194 282 char *SOAP_ENV__Node; /* optional element of type xsd:string */ 195 283 char *SOAP_ENV__Role; /* optional element of type xsd:string */ 196 284 struct SOAP_ENV__Detail *SOAP_ENV__Detail; /* optional element of type SOAP-ENV:Detail */ 197 285 }; 286 #endif 198 287 199 288 /******************************************************************************\ … … 210 299 \******************************************************************************/ 211 300 301 #ifndef SOAP_TYPE__QName 302 #define SOAP_TYPE__QName (5) 303 typedef char *_QName; 304 #endif 305 306 #ifndef SOAP_TYPE__XML 307 #define SOAP_TYPE__XML (6) 212 308 typedef char *_XML; 213 typedef char *_QName; 214 typedef char *SOAP_ENC__arrayType; 309 #endif 310 311 312 /******************************************************************************\ 313 * * 314 * Typedef Synonyms * 315 * * 316 \******************************************************************************/ 317 215 318 216 319 /******************************************************************************\ … … 240 343 SOAP_FMAC5 int SOAP_FMAC6 ns1__unlock_USCOREobject(struct soap*, char *key, char *type, int *result); 241 344 242 SOAP_FMAC5 int SOAP_FMAC6 ns1__find_USCOREobjects(struct soap*, char *pattern, struct ns1__find_USCOREobjectsResponse * param_1);243 244 SOAP_FMAC5 int SOAP_FMAC6 ns1__find_USCOREinstances(struct soap*, char *key, char *volume, struct ns1__find_USCOREinstancesResponse * param_2);345 SOAP_FMAC5 int SOAP_FMAC6 ns1__find_USCOREobjects(struct soap*, char *pattern, struct ns1__find_USCOREobjectsResponse *_param_1); 346 347 SOAP_FMAC5 int SOAP_FMAC6 ns1__find_USCOREinstances(struct soap*, char *key, char *volume, struct ns1__find_USCOREinstancesResponse *_param_2); 245 348 246 349 SOAP_FMAC5 int SOAP_FMAC6 ns1__delete_USCOREinstance(struct soap*, char *uri, int *result); 247 350 248 SOAP_FMAC5 int SOAP_FMAC6 ns1__stat_USCOREobject(struct soap*, char *key, struct ns1__stat_USCOREobjectResponse * param_3);351 SOAP_FMAC5 int SOAP_FMAC6 ns1__stat_USCOREobject(struct soap*, char *key, struct ns1__stat_USCOREobjectResponse *_param_3); 249 352 250 353 /******************************************************************************\ … … 267 370 SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__unlock_USCOREobject(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *key, char *type, int *result); 268 371 269 SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__find_USCOREobjects(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *pattern, struct ns1__find_USCOREobjectsResponse * param_1);270 271 SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__find_USCOREinstances(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *key, char *volume, struct ns1__find_USCOREinstancesResponse * param_2);372 SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__find_USCOREobjects(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *pattern, struct ns1__find_USCOREobjectsResponse *_param_1); 373 374 SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__find_USCOREinstances(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *key, char *volume, struct ns1__find_USCOREinstancesResponse *_param_2); 272 375 273 376 SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__delete_USCOREinstance(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *uri, int *result); 274 377 275 SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__stat_USCOREobject(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *key, struct ns1__stat_USCOREobjectResponse * param_3);378 SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__stat_USCOREobject(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *key, struct ns1__stat_USCOREobjectResponse *_param_3); 276 379 277 380 /******************************************************************************\ … … 304 407 305 408 SOAP_FMAC5 int SOAP_FMAC6 soap_serve_ns1__stat_USCOREobject(struct soap*); 306 307 SOAP_END_NAMESPACE(soap)308 409 309 410 #ifdef __cplusplus -
trunk/Nebulous/nebclient/src/stdsoap2.c
r3017 r19542 1 1 /* 2 3 stdsoap2.c[pp] 2.7.0d 4 5 Runtime environment. 2 stdsoap2.c[pp] 2.7.11-upd 3 4 gSOAP runtime engine 6 5 7 6 gSOAP XML Web services tools 8 Copyright (C) 2000-2004, Robert van Engelen, Genivia, Inc., All Rights Reserved. 9 7 Copyright (C) 2000-2008, Robert van Engelen, Genivia Inc., All Rights Reserved. 8 This part of the software is released under ONE of the following licenses: 9 GPL, the gSOAP public license, OR Genivia's license for commercial use. 10 -------------------------------------------------------------------------------- 10 11 Contributors: 11 12 12 Wind River Systems , Inc., for the following additions (marked WR[...]):13 Wind River Systems Inc., for the following additions under gSOAP public license: 13 14 - vxWorks compatible 14 - Support for IPv6.15 16 15 -------------------------------------------------------------------------------- 17 16 gSOAP public license. … … 26 25 27 26 The Initial Developer of the Original Code is Robert A. van Engelen. 28 Copyright (C) 2000-200 4, Robert van Engelen, Genivia,Inc., All Rights Reserved.27 Copyright (C) 2000-2008, Robert van Engelen, Genivia Inc., All Rights Reserved. 29 28 -------------------------------------------------------------------------------- 30 29 GPL license. … … 45 44 Author contact information: 46 45 engelen@genivia.com / engelen@acm.org 46 47 This program is released under the GPL with the additional exemption that 48 compiling, linking, and/or using OpenSSL is allowed. 49 -------------------------------------------------------------------------------- 50 A commercial use license is available from Genivia, Inc., contact@genivia.com 47 51 -------------------------------------------------------------------------------- 48 52 … … 60 64 */ 61 65 66 #ifdef AS400 67 # pragma convert(819) /* EBCDIC to ASCII */ 68 #endif 69 62 70 #include "stdsoap2.h" 63 71 72 #ifdef __BORLANDC__ 73 # pragma warn -8060 74 #else 75 # ifdef WIN32 76 # ifdef UNDER_CE 77 # pragma comment(lib, "winsock.lib") 78 # else 79 # pragma comment(lib, "wsock32.lib") 80 # endif 81 # pragma warning(disable : 4996) /* disable deprecation warnings */ 82 # endif 83 #endif 84 64 85 #ifdef __cplusplus 65 SOAP_SOURCE_STAMP("@(#) stdsoap2.cpp ver 2.7. 0c 2004-09-27 12:00:00 GMT")86 SOAP_SOURCE_STAMP("@(#) stdsoap2.cpp ver 2.7.11 2008-07-26 00:00:00 GMT") 66 87 extern "C" { 67 88 #else 68 SOAP_SOURCE_STAMP("@(#) stdsoap2.c ver 2.7. 0c 2004-09-27 12:00:00 GMT")69 #endif 70 71 /* 8bit character representing unknown/nonrepresentable character data (e.g. not supported by current locale ) */89 SOAP_SOURCE_STAMP("@(#) stdsoap2.c ver 2.7.11 2008-07-26 00:00:00 GMT") 90 #endif 91 92 /* 8bit character representing unknown/nonrepresentable character data (e.g. not supported by current locale with multibyte support enabled) */ 72 93 #ifndef SOAP_UNKNOWN_CHAR 73 94 #define SOAP_UNKNOWN_CHAR (127) … … 83 104 #define soap_blank(c) ((c) >= 0 && (c) <= 32) 84 105 #define soap_notblank(c) ((c) > 32) 85 #define soap_hash_ptr(p) (((unsigned long)(p) >> 3) & (SOAP_PTRHASH - 1)) 86 106 107 #if defined(WIN32) && !defined(UNDER_CE) 108 #define soap_hash_ptr(p) ((PtrToUlong(p) >> 3) & (SOAP_PTRHASH - 1)) 109 #else 110 #define soap_hash_ptr(p) ((size_t)(((unsigned long)(p) >> 3) & (SOAP_PTRHASH-1))) 111 #endif 112 113 #ifdef SOAP_DEBUG 114 static void soap_init_logs(struct soap*); 115 static void soap_close_logfile(struct soap*, int); 116 static void soap_set_logfile(struct soap*, int, const char*); 117 #endif 118 119 #ifdef SOAP_MEM_DEBUG 120 static void soap_init_mht(struct soap*); 121 static void soap_free_mht(struct soap*); 122 static void soap_track_unlink(struct soap*, const void*); 123 #endif 124 125 #ifndef PALM_2 126 static int soap_set_error(struct soap*, const char*, const char*, const char*, const char*, int); 127 static int soap_copy_fault(struct soap*, const char*, const char*, const char*, const char*); 128 static int soap_getattrval(struct soap*, char*, size_t, soap_wchar); 129 #endif 130 131 #ifndef PALM_1 132 static soap_wchar soap_char(struct soap*); 133 static soap_wchar soap_get_pi(struct soap*); 87 134 static int soap_isxdigit(int); 88 static soap_wchar soap_char(struct soap*);89 static soap_wchar soap_getchunkchar(struct soap*); 90 static void soap_update_ptrs(struct soap*, char*, char*, long);135 static void *fplugin(struct soap*, const char*); 136 #ifndef WITH_NOIDREF 137 static void soap_update_ptrs(struct soap*, char*, char*, char*, char*); 91 138 static int soap_has_copies(struct soap*, const char*, const char*); 92 static struct soap_ilist *soap_hlookup(struct soap*, const char*);93 139 static void soap_init_iht(struct soap*); 94 140 static void soap_free_iht(struct soap*); 95 141 static void soap_init_pht(struct soap*); 96 142 static void soap_free_pht(struct soap*); 97 static int soap_set_error(struct soap*, const char*, const char*, const char*, int); 143 #endif 144 #endif 145 146 #ifndef WITH_LEAN 98 147 static const char *soap_set_validation_fault(struct soap*, const char*, const char*); 99 static int soap_copy_fault(struct soap*, const char*, const char*, const char*);100 static int soap_getattrval(struct soap*, char*, size_t, soap_wchar);101 static void soap_set_local_namespaces(struct soap*);102 148 static int soap_isnumeric(struct soap*, const char*); 103 static void *fplugin(struct soap*, const char*); 104 static const char *soap_decode(char*, size_t, const char*, const char*); 105 106 #ifndef WITH_LEAN 107 static time_t soap_timegm(struct tm*); 108 #endif 109 110 #ifdef SOAP_DEBUG 111 static void soap_init_logs(struct soap*); 112 static void soap_close_logfile(struct soap*, int); 113 static void soap_set_logfile(struct soap*, int, const char*); 114 #endif 115 116 #ifdef WITH_FAST 117 static int soap_append_lab(struct soap*, const char*, size_t); 149 static struct soap_nlist *soap_push_ns(struct soap *soap, const char *id, const char *ns, short utilized); 150 static void soap_pop_ns(struct soap *soap); 151 static void soap_utilize_ns(struct soap *soap, const char *tag, size_t n); 118 152 #endif 119 153 120 154 #ifndef WITH_LEANER 155 #ifndef PALM_1 121 156 static struct soap_multipart *soap_new_multipart(struct soap*, struct soap_multipart**, struct soap_multipart**, char*, size_t); 122 157 static int soap_putdimefield(struct soap*, const char*, size_t); … … 124 159 static void soap_select_mime_boundary(struct soap*); 125 160 static int soap_valid_mime_boundary(struct soap*); 161 static void soap_resolve_attachment(struct soap*, struct soap_multipart*); 162 #endif 126 163 #endif 127 164 … … 131 168 132 169 #ifdef WITH_OPENSSL 170 int soap_ssl_init_done = 0; 171 133 172 static int ssl_auth_init(struct soap*); 134 173 static int ssl_verify_callback(int, X509_STORE_CTX*); 174 static int ssl_verify_callback_allow_expired_certificate(int, X509_STORE_CTX*); 135 175 static int ssl_password(char*, int, int, void *); 136 static const char *ssl_error(struct soap*, int); 137 /* This callback is included for future references. It should not be deleted 176 /* The callback below is included for future references: 138 177 static DH *ssl_tmp_dh(SSL*, int, int); 139 178 */ 140 179 #endif 141 180 142 static const char *soap_strerror(struct soap*); 143 static const char *tcp_error(struct soap*); 181 #if !defined(WITH_NOHTTP) || !defined(WITH_LEANER) 182 #ifndef PALM_1 183 static const char *soap_decode(char*, size_t, const char*, const char*); 184 #endif 185 #endif 186 187 #ifndef WITH_NOHTTP 188 #ifndef PALM_1 189 static soap_wchar soap_getchunkchar(struct soap*); 144 190 static const char *http_error(struct soap*, int); 145 191 static int http_post(struct soap*, const char*, const char*, int, const char*, const char*, size_t); 146 192 static int http_get(struct soap*); 193 static int http_put(struct soap*); 194 static int http_del(struct soap*); 195 static int http_head(struct soap*); 147 196 static int http_send_header(struct soap*, const char*); 148 197 static int http_post_header(struct soap*, const char*, const char*); … … 150 199 static int http_parse(struct soap*); 151 200 static int http_parse_header(struct soap*, const char*, const char*); 152 #ifndef MAC_CARBON 201 #endif 202 #endif 203 204 #ifndef WITH_NOIO 205 206 #ifndef PALM_1 207 static int fsend(struct soap*, const char*, size_t); 208 static size_t frecv(struct soap*, char*, size_t); 209 static int tcp_init(struct soap*); 210 static const char *tcp_error(struct soap*); 211 #ifndef WITH_LEAN 212 static size_t frecv_stop(struct soap*, char*, size_t); 213 #endif 214 #ifndef WITH_IPV6 153 215 static int tcp_gethost(struct soap*, const char *addr, struct in_addr *inaddr); 154 static int tcp_connect(struct soap*, const char *endpoint, const char *host, int port); 155 static int tcp_accept(struct soap*, int, struct sockaddr*, int*); 216 #endif 217 static SOAP_SOCKET tcp_connect(struct soap*, const char *endpoint, const char *host, int port); 218 static SOAP_SOCKET tcp_accept(struct soap*, SOAP_SOCKET, struct sockaddr*, int*); 156 219 static int tcp_disconnect(struct soap*); 157 220 static int tcp_closesocket(struct soap*, SOAP_SOCKET); 158 221 static int tcp_shutdownsocket(struct soap*, SOAP_SOCKET, int); 159 static int fsend(struct soap*, const char*, size_t); 160 static size_t frecv(struct soap*, char*, size_t); 161 #endif 162 163 /* WR[ */ 164 #ifdef VXWORKS 165 static int vx_nonblocking = TRUE; /* ioctl argument */ 166 #endif 167 /* ]WR */ 222 static const char *soap_strerror(struct soap*); 223 #endif 224 225 #if defined(WIN32) 226 #define SOAP_SOCKBLOCK(fd) \ 227 { u_long blocking = 0; \ 228 ioctlsocket(fd, FIONBIO, &blocking); \ 229 } 230 #define SOAP_SOCKNONBLOCK(fd) \ 231 { u_long nonblocking = 1; \ 232 ioctlsocket(fd, FIONBIO, &nonblocking); \ 233 } 234 #elif defined(VXWORKS) 235 #define SOAP_SOCKBLOCK(fd) \ 236 { u_long blocking = 0; \ 237 ioctl(fd, FIONBIO, (int)(&blocking)); \ 238 } 239 #define SOAP_SOCKNONBLOCK(fd) \ 240 { u_long nonblocking = 1; \ 241 ioctl(fd, FIONBIO, (int)(&nonblocking)); \ 242 } 243 #elif defined(PALM) 244 #define SOAP_SOCKBLOCK(fd) fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0)&~O_NONBLOCK); 245 #define SOAP_SOCKNONBLOCK(fd) fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0)|O_NONBLOCK); 246 #elif defined(SYMBIAN) 247 #define SOAP_SOCKBLOCK(fd) \ 248 { long blocking = 0; \ 249 ioctl(fd, 0/*FIONBIO*/, &blocking); \ 250 } 251 #define SOAP_SOCKNONBLOCK(fd) \ 252 { long nonblocking = 1; \ 253 ioctl(fd, 0/*FIONBIO*/, &nonblocking); \ 254 } 255 #else 256 #define SOAP_SOCKBLOCK(fd) fcntl(fd, F_SETFL, fcntl(fd, F_GETFL)&~O_NONBLOCK); 257 #define SOAP_SOCKNONBLOCK(fd) fcntl(fd, F_SETFL, fcntl(fd, F_GETFL)|O_NONBLOCK); 258 #endif 259 260 #endif 168 261 169 262 #if defined(PALM) && !defined(PALM_2) … … 185 278 #endif 186 279 187 static const char soap_padding[3] = "\0\0"; 280 #ifndef WITH_LEAN 281 static const char soap_indent[11] = "\n\t\t\t\t\t\t\t\t\t"; 282 /* Alternative indentation form for SOAP_XML_INDENT: 283 static const char soap_indent[21] = "\n "; 284 */ 285 #endif 286 287 #ifndef SOAP_CANARY 288 # define SOAP_CANARY (0xC0DE) 289 #endif 290 291 static const char soap_padding[4] = "\0\0\0"; 188 292 #define SOAP_STR_PADDING (soap_padding) 189 293 #define SOAP_STR_EOS (soap_padding) 294 #define SOAP_NON_NULL (soap_padding) 190 295 191 296 #ifndef WITH_LEAN … … 291 396 #endif 292 397 398 #ifndef WITH_NOIO 293 399 #ifndef WITH_LEAN 294 400 static const struct soap_code_map h_error_codes[] = … … 312 418 }; 313 419 #endif 314 420 #endif 421 422 #ifndef WITH_NOHTTP 315 423 #ifndef WITH_LEAN 316 424 static const struct soap_code_map h_http_error_codes[] = 317 { { 201, "Created" }, 425 { { 200, "OK" }, 426 { 201, "Created" }, 318 427 { 202, "Accepted" }, 319 428 { 203, "Non-Authoritative Information" }, … … 355 464 }; 356 465 #endif 466 #endif 357 467 358 468 #ifdef WITH_OPENSSL … … 388 498 #endif 389 499 390 /******************************************************************************/ 391 #ifndef MAC_CARBON 500 #if defined(HP_UX) && defined(HAVE_GETHOSTBYNAME_R) 501 extern int h_errno; 502 #endif 503 504 /******************************************************************************/ 505 #ifndef WITH_NOIO 392 506 #ifndef PALM_1 393 507 static int 394 508 fsend(struct soap *soap, const char *s, size_t n) 395 { register int nwritten ;509 { register int nwritten, err; 396 510 #if defined(__cplusplus) && !defined(WITH_LEAN) 397 511 if (soap->os) 398 { soap->os->write(s, n);512 { soap->os->write(s, (std::streamsize)n); 399 513 if (soap->os->good()) 400 514 return SOAP_OK; 515 soap->errnum = 0; 401 516 return SOAP_EOF; 402 517 } … … 407 522 #ifndef WITH_LEAN 408 523 if (soap->send_timeout) 409 { struct timeval timeout; 410 fd_set fd; 411 if (soap->send_timeout > 0) 412 { timeout.tv_sec = soap->send_timeout; 413 timeout.tv_usec = 0; 414 } 415 else 416 { timeout.tv_sec = -soap->send_timeout/1000000; 417 timeout.tv_usec = -soap->send_timeout%1000000; 418 } 419 FD_ZERO(&fd); 420 FD_SET((SOAP_SOCKET)soap->socket, &fd); 524 { 525 #ifndef WIN32 526 if ((int)soap->socket >= (int)FD_SETSIZE) 527 return SOAP_FD_EXCEEDED; /* Hint: MUST increase FD_SETSIZE */ 528 #endif 421 529 for (;;) 422 { register int r = select((SOAP_SOCKET)(soap->socket + 1), NULL, &fd, &fd, &timeout); 530 { struct timeval timeout; 531 fd_set fd; 532 register int r; 533 if (soap->send_timeout > 0) 534 { timeout.tv_sec = soap->send_timeout; 535 timeout.tv_usec = 0; 536 } 537 else 538 { timeout.tv_sec = -soap->send_timeout/1000000; 539 timeout.tv_usec = -soap->send_timeout%1000000; 540 } 541 FD_ZERO(&fd); 542 FD_SET(soap->socket, &fd); 543 #ifdef WITH_OPENSSL 544 if (soap->ssl) 545 r = select((int)soap->socket + 1, &fd, &fd, &fd, &timeout); 546 else 547 #endif 548 r = select((int)soap->socket + 1, NULL, &fd, &fd, &timeout); 423 549 if (r > 0) 424 550 break; … … 427 553 return SOAP_EOF; 428 554 } 429 if (soap_socket_errno != SOAP_EINTR) 430 { soap->errnum = soap_socket_errno; 555 err = soap_socket_errno(soap->socket); 556 if (err != SOAP_EINTR && err != SOAP_EAGAIN && err != SOAP_EWOULDBLOCK) 557 { soap->errnum = err; 431 558 return SOAP_EOF; 432 559 } … … 436 563 #ifdef WITH_OPENSSL 437 564 if (soap->ssl) 438 nwritten = SSL_write(soap->ssl, s, n); 565 nwritten = SSL_write(soap->ssl, s, (int)n); 566 else if (soap->bio) 567 nwritten = BIO_write(soap->bio, s, (int)n); 439 568 else 440 569 #endif 441 #ifndef PALM 442 nwritten = send((SOAP_SOCKET)soap->socket, s, n, soap->socket_flags); 570 #ifndef WITH_LEAN 571 if ((soap->omode & SOAP_IO_UDP)) 572 { if (soap->peerlen) 573 nwritten = sendto(soap->socket, s, (SOAP_WINSOCKINT)n, soap->socket_flags, (struct sockaddr*)&soap->peer, (SOAP_WINSOCKINT)soap->peerlen); 574 else 575 nwritten = send(soap->socket, s, (SOAP_WINSOCKINT)n, soap->socket_flags); 576 /* retry and back-off algorithm */ 577 /* TODO: this is not very clear from specs so verify and limit conditions under which we should loop (e.g. ENOBUFS) */ 578 if (nwritten < 0) 579 { struct timeval timeout; 580 fd_set fd; 581 int udp_repeat; 582 int udp_delay; 583 #ifndef WIN32 584 if ((int)soap->socket >= (int)FD_SETSIZE) 585 return SOAP_FD_EXCEEDED; /* Hint: MUST increase FD_SETSIZE */ 586 #endif 587 if ((soap->connect_flags & SO_BROADCAST)) 588 udp_repeat = 3; /* SOAP-over-UDP MULTICAST_UDP_REPEAT - 1 */ 589 else 590 udp_repeat = 1; /* SOAP-over-UDP UNICAST_UDP_REPEAT - 1 */ 591 udp_delay = (soap_random % 201) + 50; /* UDP_MIN_DELAY .. UDP_MAX_DELAY */ 592 do 593 { timeout.tv_sec = 0; 594 timeout.tv_usec = 1000 * udp_delay; /* ms */ 595 FD_ZERO(&fd); 596 FD_SET(soap->socket, &fd); 597 select((int)soap->socket + 1, NULL, NULL, &fd, &timeout); 598 if (soap->peerlen) 599 nwritten = sendto(soap->socket, s, (SOAP_WINSOCKINT)n, soap->socket_flags, (struct sockaddr*)&soap->peer, (SOAP_WINSOCKINT)soap->peerlen); 600 else 601 nwritten = send(soap->socket, s, (SOAP_WINSOCKINT)n, soap->socket_flags); 602 udp_delay <<= 1; 603 if (udp_delay > 500) /* UDP_UPPER_DELAY */ 604 udp_delay = 500; 605 } 606 while (nwritten < 0 && --udp_repeat > 0); 607 } 608 } 609 else 610 #endif 611 #if !defined(PALM) && !defined(AS400) 612 nwritten = send(soap->socket, s, (int)n, soap->socket_flags); 443 613 #else 444 nwritten = send( (SOAP_SOCKET)soap->socket, (void*)s, n, soap->socket_flags);614 nwritten = send(soap->socket, (void*)s, n, soap->socket_flags); 445 615 #endif 446 616 if (nwritten <= 0) 447 617 { 618 #if defined(WITH_OPENSSL) || !defined(WITH_LEAN) 619 register int r = 0; 620 #endif 621 err = soap_socket_errno(soap->socket); 448 622 #ifdef WITH_OPENSSL 449 int err; 450 if (soap->ssl && (err = SSL_get_error(soap->ssl, nwritten)) != SSL_ERROR_NONE && err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE)623 if (soap->ssl && (r = SSL_get_error(soap->ssl, nwritten)) != SSL_ERROR_NONE && r != SSL_ERROR_WANT_READ && r != SSL_ERROR_WANT_WRITE) 624 { soap->errnum = err; 451 625 return SOAP_EOF; 452 #endif 453 if (soap_socket_errno != SOAP_EINTR && soap_socket_errno != SOAP_EWOULDBLOCK && soap_socket_errno != SOAP_EAGAIN) 454 { soap->errnum = soap_socket_errno; 626 } 627 #endif 628 if (err == SOAP_EWOULDBLOCK || err == SOAP_EAGAIN) 629 { 630 #ifndef WITH_LEAN 631 struct timeval timeout; 632 fd_set fd; 633 #ifndef WIN32 634 if ((int)soap->socket >= (int)FD_SETSIZE) 635 return SOAP_FD_EXCEEDED; /* Hint: MUST increase FD_SETSIZE */ 636 #endif 637 if (soap->send_timeout > 0) 638 { timeout.tv_sec = soap->send_timeout; 639 timeout.tv_usec = 0; 640 } 641 else if (soap->send_timeout < 0) 642 { timeout.tv_sec = -soap->send_timeout/1000000; 643 timeout.tv_usec = -soap->send_timeout%1000000; 644 } 645 else 646 { timeout.tv_sec = 0; 647 timeout.tv_usec = 10000; 648 } 649 FD_ZERO(&fd); 650 FD_SET(soap->socket, &fd); 651 #ifdef WITH_OPENSSL 652 if (soap->ssl && r == SSL_ERROR_WANT_READ) 653 r = select((int)soap->socket + 1, &fd, NULL, &fd, &timeout); 654 else 655 r = select((int)soap->socket + 1, NULL, &fd, &fd, &timeout); 656 #else 657 r = select((int)soap->socket + 1, NULL, &fd, &fd, &timeout); 658 #endif 659 if (r < 0 && (r = soap_socket_errno(soap->socket)) != SOAP_EINTR) 660 { soap->errnum = r; 661 return SOAP_EOF; 662 } 663 #endif 664 } 665 else if (err && err != SOAP_EINTR) 666 { soap->errnum = err; 455 667 return SOAP_EOF; 456 668 } … … 467 679 nwritten = fwrite(s, 1, n, soap->sendfd); 468 680 #else 469 /* WR[ */470 681 #ifdef VXWORKS 471 682 #ifdef WMW_RPM_IO 472 683 if (soap->rpmreqid) 473 { 474 httpBlockPut(soap->rpmreqid, s, n); 475 nwritten = n; 476 } 684 nwritten = (httpBlockPut(soap->rpmreqid, s, n) == 0) ? n : -1; 477 685 else 478 { 479 nwritten = fwrite(s, sizeof(char), n, fdopen(soap->sendfd, "w")); 480 } 686 #endif 687 nwritten = fwrite(s, sizeof(char), n, fdopen(soap->sendfd, "w")); 481 688 #else 482 nwritten = fwrite(s, sizeof(char), n, fdopen(soap->sendfd, "w")); 483 #endif /* WMW_RPM_IO */ 689 nwritten = write(soap->sendfd, s, (unsigned int)n); 690 #endif 691 #endif 692 #endif 693 if (nwritten <= 0) 694 { 695 #ifndef WITH_FASTCGI 696 err = soap_errno; 484 697 #else 485 /* ]WR */ 486 nwritten = write((SOAP_SOCKET)soap->sendfd, s, n); 487 /* WR[ */ 488 #endif 489 /* ]WR */ 490 #endif 491 #endif 492 if (nwritten <= 0) 493 { if (soap_errno != SOAP_EINTR && soap_errno != SOAP_EWOULDBLOCK && soap_errno != SOAP_EAGAIN) 494 { soap->errnum = soap_errno; 698 err = EOF; 699 #endif 700 if (err && err != SOAP_EINTR && err != SOAP_EWOULDBLOCK && err != SOAP_EAGAIN) 701 { soap->errnum = err; 495 702 return SOAP_EOF; 496 703 } … … 504 711 } 505 712 #endif 506 #endif507 508 /******************************************************************************/509 #ifndef PALM_1510 SOAP_FMAC1511 int512 SOAP_FMAC2513 soap_flush_raw(struct soap *soap, const char *s, size_t n)514 { if ((soap->mode & SOAP_IO) == SOAP_IO_STORE)515 { register char *t;516 if (!(t = (char*)soap_push_block(soap, n)))517 return soap->error = SOAP_EOM;518 memcpy(t, s, n);519 if (soap->fpreparesend)520 return soap->fpreparesend(soap, s, n);521 return SOAP_OK;522 }523 if ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK)524 { char t[16];525 sprintf(t, "\r\n%lX\r\n" + (soap->chunksize ? 0 : 2), (unsigned long)n);526 DBGMSG(SENT, t, strlen(t));527 if ((soap->error = soap->fsend(soap, t, strlen(t))))528 return soap->error;529 soap->chunksize += n;530 }531 DBGMSG(SENT, s, n);532 return soap->error = soap->fsend(soap, s, n);533 }534 #endif535 536 /******************************************************************************/537 #ifndef PALM_1538 SOAP_FMAC1539 int540 SOAP_FMAC2541 soap_flush(struct soap *soap)542 { if (soap->bufidx)543 {544 #ifdef WITH_ZLIB545 if (soap->mode & SOAP_ENC_ZLIB)546 { soap->d_stream.next_in = (Byte*)soap->buf;547 soap->d_stream.avail_in = (unsigned int)soap->bufidx;548 #ifdef WITH_GZIP549 soap->z_crc = crc32(soap->z_crc, (Byte*)soap->buf, (unsigned int)soap->bufidx);550 #endif551 do552 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Deflating %u bytes\n", soap->d_stream.avail_in));553 if (deflate(&soap->d_stream, Z_NO_FLUSH) != Z_OK)554 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unable to deflate: %s\n", soap->d_stream.msg?soap->d_stream.msg:""));555 return soap->error = SOAP_ZLIB_ERROR;556 }557 if (!soap->d_stream.avail_out)558 { if (soap_flush_raw(soap, soap->z_buf, SOAP_BUFLEN))559 return soap->error;560 soap->d_stream.next_out = (Byte*)soap->z_buf;561 soap->d_stream.avail_out = SOAP_BUFLEN;562 }563 } while (soap->d_stream.avail_in);564 }565 else566 #endif567 if (soap_flush_raw(soap, soap->buf, soap->bufidx))568 return soap->error;569 soap->bufidx = 0;570 }571 return SOAP_OK;572 }573 713 #endif 574 714 … … 583 723 if (soap->mode & SOAP_IO_LENGTH) 584 724 { soap->count += n; 725 #ifndef WITH_LEANER 585 726 if (soap->fpreparesend && (soap->mode & SOAP_IO) != SOAP_IO_STORE) 586 return soap->fpreparesend(soap, s, n); 727 return soap->error = soap->fpreparesend(soap, s, n); 728 #endif 587 729 return SOAP_OK; 588 730 } … … 611 753 int 612 754 SOAP_FMAC2 755 soap_flush(struct soap *soap) 756 { register size_t n = soap->bufidx; 757 if (n) 758 { soap->bufidx = 0; 759 #ifdef WITH_ZLIB 760 if (soap->mode & SOAP_ENC_ZLIB) 761 { soap->d_stream->next_in = (Byte*)soap->buf; 762 soap->d_stream->avail_in = (unsigned int)n; 763 #ifdef WITH_GZIP 764 soap->z_crc = crc32(soap->z_crc, (Byte*)soap->buf, (unsigned int)n); 765 #endif 766 do 767 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Deflating %u bytes\n", soap->d_stream->avail_in)); 768 if (deflate(soap->d_stream, Z_NO_FLUSH) != Z_OK) 769 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unable to deflate: %s\n", soap->d_stream->msg?soap->d_stream->msg:SOAP_STR_EOS)); 770 return soap->error = SOAP_ZLIB_ERROR; 771 } 772 if (!soap->d_stream->avail_out) 773 { if (soap_flush_raw(soap, soap->z_buf, SOAP_BUFLEN)) 774 return soap->error; 775 soap->d_stream->next_out = (Byte*)soap->z_buf; 776 soap->d_stream->avail_out = SOAP_BUFLEN; 777 } 778 } while (soap->d_stream->avail_in); 779 } 780 else 781 #endif 782 return soap_flush_raw(soap, soap->buf, n); 783 } 784 return SOAP_OK; 785 } 786 #endif 787 788 /******************************************************************************/ 789 #ifndef PALM_1 790 SOAP_FMAC1 791 int 792 SOAP_FMAC2 793 soap_flush_raw(struct soap *soap, const char *s, size_t n) 794 { if ((soap->mode & SOAP_IO) == SOAP_IO_STORE) 795 { register char *t; 796 if (!(t = (char*)soap_push_block(soap, NULL, n))) 797 return soap->error = SOAP_EOM; 798 memcpy(t, s, n); 799 #ifndef WITH_LEANER 800 if (soap->fpreparesend) 801 return soap->error = soap->fpreparesend(soap, s, n); 802 #endif 803 return SOAP_OK; 804 } 805 #ifndef WITH_LEANER 806 if ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK) 807 { char t[16]; 808 sprintf(t, "\r\n%lX\r\n" + (soap->chunksize ? 0 : 2), (unsigned long)n); 809 DBGMSG(SENT, t, strlen(t)); 810 if ((soap->error = soap->fsend(soap, t, strlen(t)))) 811 return soap->error; 812 soap->chunksize += n; 813 } 814 DBGMSG(SENT, s, n); 815 #endif 816 return soap->error = soap->fsend(soap, s, n); 817 } 818 #endif 819 820 /******************************************************************************/ 821 #ifndef PALM_1 822 SOAP_FMAC1 823 int 824 SOAP_FMAC2 613 825 soap_send(struct soap *soap, const char *s) 614 826 { if (s) … … 619 831 620 832 /******************************************************************************/ 833 #ifndef WITH_LEANER 621 834 #ifndef PALM_1 622 835 SOAP_FMAC1 … … 629 842 } 630 843 #endif 631 632 /******************************************************************************/ 844 #endif 845 846 /******************************************************************************/ 847 #ifndef WITH_LEANER 633 848 #ifndef PALM_1 634 849 SOAP_FMAC1 … … 642 857 } 643 858 #endif 644 645 /******************************************************************************/ 646 #ifndef MAC_CARBON 859 #endif 860 861 /******************************************************************************/ 862 #ifndef WITH_NOIO 647 863 #ifndef PALM_1 648 864 static size_t 649 865 frecv(struct soap *soap, char *s, size_t n) 650 866 { register int r; 867 #ifndef WITH_LEAN 868 register int retries = 100; /* max 100 retries with non-blocking sockets */ 869 #endif 651 870 soap->errnum = 0; 652 871 #if defined(__cplusplus) && !defined(WITH_LEAN) 653 872 if (soap->is) 654 873 { if (soap->is->good()) 655 return soap->is->read(s, n).gcount();874 return soap->is->read(s, (std::streamsize)n).gcount(); 656 875 return 0; 657 876 } … … 660 879 { for (;;) 661 880 { 881 #ifdef WITH_OPENSSL 882 register int err = 0; 883 #endif 662 884 #ifndef WITH_LEAN 663 struct timeval timeout; 664 fd_set fd; 885 #ifdef WITH_OPENSSL 886 if (soap->recv_timeout && !soap->ssl) /* SSL: sockets are nonblocking */ 887 #else 665 888 if (soap->recv_timeout) 666 { if (soap->recv_timeout > 0) 889 #endif 890 { 891 #ifndef WIN32 892 if ((int)soap->socket >= (int)FD_SETSIZE) 893 { soap->error = SOAP_FD_EXCEEDED; 894 return 0; /* Hint: MUST increase FD_SETSIZE */ 895 } 896 #endif 897 for (;;) 898 { struct timeval timeout; 899 fd_set fd; 900 if (soap->recv_timeout > 0) 901 { timeout.tv_sec = soap->recv_timeout; 902 timeout.tv_usec = 0; 903 } 904 else 905 { timeout.tv_sec = -soap->recv_timeout/1000000; 906 timeout.tv_usec = -soap->recv_timeout%1000000; 907 } 908 FD_ZERO(&fd); 909 FD_SET(soap->socket, &fd); 910 r = select((int)soap->socket + 1, &fd, NULL, &fd, &timeout); 911 if (r > 0) 912 break; 913 if (!r) 914 { soap->errnum = 0; 915 return 0; 916 } 917 r = soap_socket_errno(soap->socket); 918 if (r != SOAP_EINTR && r != SOAP_EAGAIN && r != SOAP_EWOULDBLOCK) 919 { soap->errnum = r; 920 return 0; 921 } 922 } 923 } 924 #endif 925 #ifdef WITH_OPENSSL 926 if (soap->ssl) 927 { r = SSL_read(soap->ssl, s, (int)n); 928 if (r > 0) 929 return (size_t)r; 930 err = SSL_get_error(soap->ssl, r); 931 if (err != SSL_ERROR_NONE && err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE) 932 return 0; 933 } 934 else if (soap->bio) 935 { r = BIO_read(soap->bio, s, (int)n); 936 if (r > 0) 937 return (size_t)r; 938 return 0; 939 } 940 else 941 #endif 942 { 943 #ifndef WITH_LEAN 944 if ((soap->omode & SOAP_IO_UDP)) 945 { SOAP_SOCKLEN_T k = (SOAP_SOCKLEN_T)sizeof(soap->peer); 946 memset((void*)&soap->peer, 0, sizeof(soap->peer)); 947 r = recvfrom(soap->socket, s, (SOAP_WINSOCKINT)n, soap->socket_flags, (struct sockaddr*)&soap->peer, &k); /* portability note: see SOAP_SOCKLEN_T definition in stdsoap2.h */ 948 soap->peerlen = (size_t)k; 949 #ifndef WITH_IPV6 950 soap->ip = ntohl(soap->peer.sin_addr.s_addr); 951 #endif 952 } 953 else 954 #endif 955 r = recv(soap->socket, s, (int)n, soap->socket_flags); 956 #ifdef PALM 957 /* CycleSyncDisplay(curStatusMsg); */ 958 #endif 959 if (r >= 0) 960 return (size_t)r; 961 r = soap_socket_errno(soap->socket); 962 if (r != SOAP_EINTR && r != SOAP_EAGAIN && r != SOAP_EWOULDBLOCK) 963 { soap->errnum = r; 964 return 0; 965 } 966 } 967 #ifndef WITH_LEAN 968 { struct timeval timeout; 969 fd_set fd; 970 if (soap->recv_timeout > 0) 667 971 { timeout.tv_sec = soap->recv_timeout; 668 972 timeout.tv_usec = 0; 669 973 } 670 else 974 else if (soap->recv_timeout < 0) 671 975 { timeout.tv_sec = -soap->recv_timeout/1000000; 672 976 timeout.tv_usec = -soap->recv_timeout%1000000; 673 977 } 978 else 979 { timeout.tv_sec = 5; 980 timeout.tv_usec = 0; 981 } 982 #ifndef WIN32 983 if ((int)soap->socket >= (int)FD_SETSIZE) 984 { soap->error = SOAP_FD_EXCEEDED; 985 return 0; /* Hint: MUST increase FD_SETSIZE */ 986 } 987 #endif 674 988 FD_ZERO(&fd); 675 FD_SET((SOAP_SOCKET)soap->socket, &fd); 676 for (;;) 677 { r = select((SOAP_SOCKET)(soap->socket + 1), &fd, NULL, &fd, &timeout); 678 if (r > 0) 679 break; 680 if (r == 0) 681 return 0; 682 if (soap_socket_errno != SOAP_EINTR) 683 { soap->errnum = soap_socket_errno; 989 FD_SET(soap->socket, &fd); 990 #ifdef WITH_OPENSSL 991 if (soap->ssl && err == SSL_ERROR_WANT_WRITE) 992 r = select((int)soap->socket + 1, NULL, &fd, &fd, &timeout); 993 else 994 r = select((int)soap->socket + 1, &fd, NULL, &fd, &timeout); 995 #else 996 r = select((int)soap->socket + 1, &fd, NULL, &fd, &timeout); 997 #endif 998 if (!r && soap->recv_timeout) 999 { soap->errnum = 0; 1000 return 0; 1001 } 1002 if (r < 0) 1003 { r = soap_socket_errno(soap->socket); 1004 if (r != SOAP_EINTR && r != SOAP_EAGAIN && r != SOAP_EWOULDBLOCK) 1005 { soap->errnum = r; 684 1006 return 0; 685 1007 } 686 1008 } 687 } 688 #endif 689 #ifdef WITH_OPENSSL 690 if (soap->ssl) 691 { int err; 692 r = SSL_read(soap->ssl, s, n); 693 if ((err = SSL_get_error(soap->ssl, r)) == SSL_ERROR_NONE) 694 return (size_t)r; 695 if (err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE) 696 return 0; 697 } 698 else 699 #endif 700 { r = recv((SOAP_SOCKET)soap->socket, s, n, soap->socket_flags); 701 if (r >= 0) 702 return (size_t)r; 703 if (soap_socket_errno != SOAP_EINTR && soap_socket_errno != SOAP_EAGAIN) 704 { soap->errnum = soap_socket_errno; 1009 if (retries-- <= 0) 1010 { soap->errnum = soap_socket_errno(soap->socket); 705 1011 return 0; 706 1012 } 707 1013 } 708 #ifndef WITH_LEAN 709 { struct timeval timeout; 710 fd_set fd; 711 timeout.tv_sec = 0; 712 timeout.tv_usec = 10000; 713 FD_ZERO(&fd); 714 FD_SET((SOAP_SOCKET)soap->socket, &fd); 715 r = select((SOAP_SOCKET)(soap->socket + 1), &fd, NULL, &fd, &timeout); 716 if (r < 0 && soap_socket_errno != SOAP_EINTR) 717 { soap->errnum = soap_socket_errno; 718 return 0; 719 } 1014 #endif 1015 #ifdef PALM 1016 r = soap_socket_errno(soap->socket); 1017 if (r != SOAP_EINTR && retries-- <= 0) 1018 { soap->errnum = r; 1019 return 0; 720 1020 } 721 1021 #endif … … 728 1028 return fread(s, 1, n, soap->recvfd); 729 1029 #else 730 /* WR[ */731 1030 #ifdef WMW_RPM_IO 732 1031 if (soap->rpmreqid) 733 1032 r = httpBlockRead(soap->rpmreqid, s, n); 734 1033 else 735 r = read(soap->recvfd, s, n); 736 if (r >= 0) 737 return r; 738 return 0; 739 #else 740 /* ]WR */ 741 r = read((SOAP_SOCKET)soap->recvfd, s, n); 1034 #endif 1035 r = read(soap->recvfd, s, (unsigned int)n); 742 1036 if (r >= 0) 743 1037 return (size_t)r; 744 1038 soap->errnum = soap_errno; 745 1039 return 0; 746 /* WR[ */ 747 #endif 748 /* ]WR */ 749 #endif 750 #endif 751 } 752 #endif 753 #endif 754 755 /******************************************************************************/ 1040 #endif 1041 #endif 1042 } 1043 #endif 1044 #endif 1045 1046 /******************************************************************************/ 1047 #ifndef WITH_LEAN 1048 #ifndef WITH_NOIO 1049 #ifndef PALM_1 1050 static size_t 1051 frecv_stop(struct soap *soap, char *s, size_t n) 1052 { return 0; 1053 } 1054 #endif 1055 #endif 1056 #endif 1057 1058 /******************************************************************************/ 1059 #ifndef WITH_NOHTTP 756 1060 #ifndef PALM_1 757 1061 static soap_wchar … … 761 1065 soap->bufidx = 0; 762 1066 soap->buflen = soap->chunkbuflen = soap->frecv(soap, soap->buf, SOAP_BUFLEN); 763 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Read %u bytes \n", (unsigned int)soap->buflen));1067 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Read %u bytes from socket %d\n", (unsigned int)soap->buflen, soap->socket)); 764 1068 DBGMSG(RECV, soap->buf, soap->buflen); 765 1069 if (soap->buflen) … … 768 1072 } 769 1073 #endif 1074 #endif 770 1075 771 1076 /******************************************************************************/ … … 773 1078 static int 774 1079 soap_isxdigit(int c) 775 { switch (c) 776 { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': 777 case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': 778 case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': 779 return 1; 780 } 781 return 0; 1080 { return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f'); 782 1081 } 783 1082 #endif … … 792 1091 #ifdef WITH_ZLIB 793 1092 if (soap->mode & SOAP_ENC_ZLIB) 794 { if (soap->d_stream .next_out == Z_NULL)1093 { if (soap->d_stream->next_out == Z_NULL) 795 1094 return EOF; 796 if (soap->d_stream .avail_in || !soap->d_stream.avail_out)1095 if (soap->d_stream->avail_in || !soap->d_stream->avail_out) 797 1096 { register int r; 798 1097 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflating\n")); 799 soap->d_stream .next_out = (Byte*)soap->buf;800 soap->d_stream .avail_out = SOAP_BUFLEN;801 r = inflate( &soap->d_stream, Z_NO_FLUSH);1098 soap->d_stream->next_out = (Byte*)soap->buf; 1099 soap->d_stream->avail_out = SOAP_BUFLEN; 1100 r = inflate(soap->d_stream, Z_NO_FLUSH); 802 1101 if (r == Z_OK || r == Z_STREAM_END) 803 1102 { soap->bufidx = 0; 804 soap->buflen = SOAP_BUFLEN - soap->d_stream.avail_out;1103 ret = soap->buflen = SOAP_BUFLEN - soap->d_stream->avail_out; 805 1104 if (soap->zlib_in == SOAP_ZLIB_GZIP) 806 soap->z_crc = crc32(soap->z_crc, (Byte*)soap->buf, (unsigned int) soap->buflen);1105 soap->z_crc = crc32(soap->z_crc, (Byte*)soap->buf, (unsigned int)ret); 807 1106 if (r == Z_STREAM_END) 808 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflated %lu->%lu bytes\n", soap->d_stream .total_in, soap->d_stream.total_out));809 soap->z_ratio_in = (float)soap->d_stream .total_in / (float)soap->d_stream.total_out;810 soap->d_stream .next_out = Z_NULL;1107 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflated %lu->%lu bytes\n", soap->d_stream->total_in, soap->d_stream->total_out)); 1108 soap->z_ratio_in = (float)soap->d_stream->total_in / (float)soap->d_stream->total_out; 1109 soap->d_stream->next_out = Z_NULL; 811 1110 } 812 if (soap->buflen) 813 { soap->count += soap->buflen; 1111 if (ret) 1112 { soap->count += ret; 1113 DBGLOG(RECV, SOAP_MESSAGE(fdebug, "\n---- decompressed ----\n")); 1114 DBGMSG(RECV, soap->buf, ret); 1115 DBGLOG(RECV, SOAP_MESSAGE(fdebug, "\n----\n")); 814 1116 return SOAP_OK; 815 1117 } 816 1118 } 817 1119 else if (r != Z_BUF_ERROR) 818 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflate error: %s\n", soap->d_stream.msg?soap->d_stream.msg:"")); 819 soap->d_stream.next_out = Z_NULL; 1120 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflate error: %s\n", soap->d_stream->msg?soap->d_stream->msg:SOAP_STR_EOS)); 1121 soap->d_stream->next_out = Z_NULL; 1122 soap->error = SOAP_ZLIB_ERROR; 820 1123 return EOF; 821 1124 } … … 826 1129 soap->buflen = soap->z_buflen; 827 1130 } 828 } 829 #endif 1131 DBGLOG(RECV, SOAP_MESSAGE(fdebug, "\n---- compressed ----\n")); 1132 } 1133 #endif 1134 #ifndef WITH_NOHTTP 830 1135 if ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK) /* read HTTP chunked transfer */ 831 { 832 chunk_again: 833 if (soap->chunksize) 834 { soap->buflen = ret = soap->frecv(soap, soap->buf, soap->chunksize > SOAP_BUFLEN ? SOAP_BUFLEN : soap->chunksize); 835 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Getting chunk: read %u bytes\n", (unsigned int)ret)); 836 DBGMSG(RECV, soap->buf, ret); 837 soap->bufidx = 0; 838 soap->chunksize -= ret; 839 } 840 else 1136 { for (;;) 841 1137 { register soap_wchar c; 842 1138 char *t, tmp[8]; 1139 if (soap->chunksize) 1140 { soap->buflen = ret = soap->frecv(soap, soap->buf, soap->chunksize > SOAP_BUFLEN ? SOAP_BUFLEN : soap->chunksize); 1141 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Getting chunk: read %u bytes\n", (unsigned int)ret)); 1142 DBGMSG(RECV, soap->buf, ret); 1143 soap->bufidx = 0; 1144 soap->chunksize -= ret; 1145 break; 1146 } 843 1147 t = tmp; 844 1148 if (!soap->chunkbuflen) 845 1149 { soap->chunkbuflen = ret = soap->frecv(soap, soap->buf, SOAP_BUFLEN); 846 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Read %u bytes \n", (unsigned int)ret));1150 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Read %u bytes (chunked) from socket %d\n", (unsigned int)ret, soap->socket)); 847 1151 DBGMSG(RECV, soap->buf, ret); 848 1152 soap->bufidx = 0; 849 1153 if (!ret) 850 return EOF;1154 return soap->ahead = EOF; 851 1155 } 852 1156 else 853 1157 soap->bufidx = soap->buflen; 854 1158 soap->buflen = soap->chunkbuflen; 855 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Getting chunk size ( %u%u)\n", (unsigned int)soap->bufidx, (unsigned int)soap->buflen));1159 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Getting chunk size (idx=%u len=%u)\n", (unsigned int)soap->bufidx, (unsigned int)soap->buflen)); 856 1160 while (!soap_isxdigit((int)(c = soap_getchunkchar(soap)))) 857 if ((int)c == EOF) 858 return EOF; 1161 { if ((int)c == EOF) 1162 return soap->ahead = EOF; 1163 } 859 1164 do 860 1165 *t++ = (char)c; … … 863 1168 c = soap_getchunkchar(soap); 864 1169 if ((int)c == EOF) 865 return EOF;1170 return soap->ahead = EOF; 866 1171 *t = '\0'; 1172 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Chunk size = %s (hex)\n", tmp)); 867 1173 soap->chunksize = soap_strtoul(tmp, &t, 16); 868 1174 if (!soap->chunksize) 869 1175 { soap->chunkbuflen = 0; 870 1176 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End of chunked message\n")); 871 while ((int)c != EOF && c != '\n')1177 while ((int)c != EOF && c != '\n') 872 1178 c = soap_getchunkchar(soap); 873 return EOF; 1179 ret = 0; 1180 soap->ahead = EOF; 1181 break; 874 1182 } 875 1183 soap->buflen = soap->bufidx + soap->chunksize; 876 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Moving buf len to %u (%u %s)\n", (unsigned int)soap->buflen, (unsigned int)soap->bufidx, tmp));1184 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Moving buf len to idx=%u len=%u (%s)\n", (unsigned int)soap->bufidx, (unsigned int)soap->buflen, tmp)); 877 1185 if (soap->buflen > soap->chunkbuflen) 878 1186 { soap->buflen = soap->chunkbuflen; 879 1187 soap->chunksize -= soap->buflen - soap->bufidx; 880 1188 soap->chunkbuflen = 0; 881 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Passed end of buffer for chunked HTTP (% lu bytes left)\n", (unsigned long)(soap->buflen - soap->bufidx)));1189 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Passed end of buffer for chunked HTTP (%u bytes left)\n", (unsigned int)(soap->buflen - soap->bufidx))); 882 1190 } 883 1191 else if (soap->chunkbuflen) 884 1192 soap->chunksize = 0; 885 1193 ret = soap->buflen - soap->bufidx; 886 if ( !ret)887 goto chunk_again;1194 if (ret) 1195 break; 888 1196 } 889 1197 } 890 1198 else 1199 #endif 891 1200 { soap->bufidx = 0; 892 1201 soap->buflen = ret = soap->frecv(soap, soap->buf, SOAP_BUFLEN); 893 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Read %u bytes \n", (unsigned int)ret));1202 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Read %u bytes from socket %d\n", (unsigned int)ret, soap->socket)); 894 1203 DBGMSG(RECV, soap->buf, ret); 895 1204 } 1205 #ifndef WITH_LEANER 896 1206 if (soap->fpreparerecv && (soap->error = soap->fpreparerecv(soap, soap->buf, ret))) 897 1207 return soap->error; 1208 #endif 898 1209 #ifdef WITH_ZLIB 899 1210 if (soap->mode & SOAP_ENC_ZLIB) 900 1211 { register int r; 901 1212 memcpy(soap->z_buf, soap->buf, SOAP_BUFLEN); 902 soap->d_stream .next_in = (Byte*)(soap->z_buf + soap->bufidx);903 soap->d_stream .avail_in = (unsigned int)ret;904 soap->d_stream .next_out = (Byte*)soap->buf;905 soap->d_stream .avail_out = SOAP_BUFLEN;906 r = inflate( &soap->d_stream, Z_NO_FLUSH);1213 soap->d_stream->next_in = (Byte*)(soap->z_buf + soap->bufidx); 1214 soap->d_stream->avail_in = (unsigned int)ret; 1215 soap->d_stream->next_out = (Byte*)soap->buf; 1216 soap->d_stream->avail_out = SOAP_BUFLEN; 1217 r = inflate(soap->d_stream, Z_NO_FLUSH); 907 1218 if (r == Z_OK || r == Z_STREAM_END) 908 1219 { soap->bufidx = 0; 909 1220 soap->z_buflen = soap->buflen; 910 soap->buflen = ret = SOAP_BUFLEN - soap->d_stream.avail_out;1221 soap->buflen = SOAP_BUFLEN - soap->d_stream->avail_out; 911 1222 if (soap->zlib_in == SOAP_ZLIB_GZIP) 912 1223 soap->z_crc = crc32(soap->z_crc, (Byte*)soap->buf, (unsigned int)soap->buflen); 913 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflated %u bytes\n", (unsigned int) ret));914 if ( !ret)1224 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflated %u bytes\n", (unsigned int)soap->buflen)); 1225 if (ret && !soap->buflen) 915 1226 goto zlib_again; 1227 ret = soap->buflen; 916 1228 if (r == Z_STREAM_END) 917 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflated %lu->%lu bytes\n", soap->d_stream.total_in, soap->d_stream.total_out)); 918 soap->z_ratio_in = (float)soap->d_stream.total_in / (float)soap->d_stream.total_out; 919 soap->d_stream.next_out = Z_NULL; 920 } 1229 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflated total %lu->%lu bytes\n", soap->d_stream->total_in, soap->d_stream->total_out)); 1230 soap->z_ratio_in = (float)soap->d_stream->total_in / (float)soap->d_stream->total_out; 1231 soap->d_stream->next_out = Z_NULL; 1232 } 1233 DBGLOG(RECV, SOAP_MESSAGE(fdebug, "\n---- decompressed ----\n")); 1234 DBGMSG(RECV, soap->buf, ret); 921 1235 } 922 1236 else 923 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unable to inflate: (%d) %s\n", r, soap->d_stream.msg?soap->d_stream.msg:"")); 924 soap->d_stream.next_out = Z_NULL; 1237 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unable to inflate: (%d) %s\n", r, soap->d_stream->msg?soap->d_stream->msg:SOAP_STR_EOS)); 1238 soap->d_stream->next_out = Z_NULL; 1239 soap->error = SOAP_ZLIB_ERROR; 925 1240 return EOF; 926 1241 } … … 1012 1327 soap_getchar(struct soap *soap) 1013 1328 { register soap_wchar c; 1014 if (soap->ahead) 1015 { c = soap->ahead; 1016 soap->ahead = 0; 1329 c = soap->ahead; 1330 if (c) 1331 { if (c != EOF) 1332 soap->ahead = 0; 1017 1333 return c; 1018 1334 } … … 1026 1342 const struct soap_code_map* 1027 1343 SOAP_FMAC2 1028 soap_code(const struct soap_code_map *map, const char *str) 1029 { while (map->string) 1030 { if (!strcmp(str, map->string)) /* case sensitive */ 1031 return map; 1032 map++; 1344 soap_code(const struct soap_code_map *code_map, const char *str) 1345 { if (code_map && str) 1346 { while (code_map->string) 1347 { if (!strcmp(str, code_map->string)) /* case sensitive */ 1348 return code_map; 1349 code_map++; 1350 } 1033 1351 } 1034 1352 return NULL; … … 1041 1359 long 1042 1360 SOAP_FMAC2 1043 soap_int_code(const struct soap_code_map *map, const char *str, long other) 1044 { while (map->string) 1045 { if (!soap_tag_cmp(str, map->string)) /* case insensitive */ 1046 return map->code; 1047 map++; 1361 soap_code_int(const struct soap_code_map *code_map, const char *str, long other) 1362 { if (code_map) 1363 { while (code_map->string) 1364 { if (!soap_tag_cmp(str, code_map->string)) /* case insensitive */ 1365 return code_map->code; 1366 code_map++; 1367 } 1048 1368 } 1049 1369 return other; … … 1056 1376 const char* 1057 1377 SOAP_FMAC2 1058 soap_str_code(const struct soap_code_map *map, long code) 1059 { while (map->code != code && map->string) 1060 map++; 1061 return map->string; 1378 soap_code_str(const struct soap_code_map *code_map, long code) 1379 { if (!code_map) 1380 return NULL; 1381 while (code_map->code != code && code_map->string) 1382 code_map++; 1383 return code_map->string; 1384 } 1385 #endif 1386 1387 /******************************************************************************/ 1388 #ifndef PALM_1 1389 SOAP_FMAC1 1390 long 1391 SOAP_FMAC2 1392 soap_code_bits(const struct soap_code_map *code_map, const char *str) 1393 { register long bits = 0; 1394 if (code_map) 1395 { while (str && *str) 1396 { const struct soap_code_map *p; 1397 for (p = code_map; p->string; p++) 1398 { register size_t n = strlen(p->string); 1399 if (!strncmp(p->string, str, n) && soap_blank(str[n])) 1400 { bits |= p->code; 1401 str += n; 1402 while (*str > 0 && *str <= 32) 1403 str++; 1404 break; 1405 } 1406 } 1407 if (!p->string) 1408 return 0; 1409 } 1410 } 1411 return bits; 1412 } 1413 #endif 1414 1415 /******************************************************************************/ 1416 #ifndef PALM_1 1417 SOAP_FMAC1 1418 const char* 1419 SOAP_FMAC2 1420 soap_code_list(struct soap *soap, const struct soap_code_map *code_map, long code) 1421 { register char *t = soap->tmpbuf; 1422 if (code_map) 1423 { while (code_map->string) 1424 { if (code_map->code & code) 1425 { register const char *s = code_map->string; 1426 if (t != soap->tmpbuf) 1427 *t++ = ' '; 1428 while (*s && t < soap->tmpbuf + sizeof(soap->tmpbuf) - 1) 1429 *t++ = *s++; 1430 if (t == soap->tmpbuf + sizeof(soap->tmpbuf) - 1) 1431 break; 1432 } 1433 code_map++; 1434 } 1435 } 1436 *t = '\0'; 1437 return soap->tmpbuf; 1062 1438 } 1063 1439 #endif … … 1094 1470 return '\''; 1095 1471 #ifndef WITH_LEAN 1096 return (soap_wchar)soap_ int_code(html_entity_codes, tmp, SOAP_UNKNOWN_CHAR);1472 return (soap_wchar)soap_code_int(html_entity_codes, tmp, SOAP_UNKNOWN_CHAR); 1097 1473 #else 1098 1474 return SOAP_UNKNOWN_CHAR; /* use this to represent unknown code */ 1099 1475 #endif 1100 1476 } 1477 #endif 1478 1479 /******************************************************************************/ 1480 #ifdef WITH_LEAN 1481 #ifndef PALM_1 1482 soap_wchar 1483 soap_get0(struct soap *soap) 1484 { if (soap->bufidx >= soap->buflen && soap_recv(soap)) 1485 return EOF; 1486 return (unsigned char)soap->buf[soap->bufidx]; 1487 } 1488 #endif 1489 #endif 1490 1491 /******************************************************************************/ 1492 #ifdef WITH_LEAN 1493 #ifndef PALM_1 1494 soap_wchar 1495 soap_get1(struct soap *soap) 1496 { if (soap->bufidx >= soap->buflen && soap_recv(soap)) 1497 return EOF; 1498 return (unsigned char)soap->buf[soap->bufidx++]; 1499 } 1500 #endif 1101 1501 #endif 1102 1502 … … 1110 1510 c = soap->ahead; 1111 1511 if (c) 1112 soap->ahead = 0; 1512 { if ((int)c != EOF) 1513 soap->ahead = 0; 1514 } 1113 1515 else 1114 1516 c = soap_get1(soap); 1115 for (;;)1517 while ((int)c != EOF) 1116 1518 { if (soap->cdata) 1117 1519 { if (c == ']') 1118 1520 { c = soap_get1(soap); 1119 1521 if (c == ']') 1120 { soap->cdata = 0; 1121 soap_get1(soap); /* skip > */ 1122 c = soap_get1(soap); 1522 { c = soap_get0(soap); 1523 if (c == '>') 1524 { soap->cdata = 0; 1525 soap_get1(soap); 1526 c = soap_get1(soap); 1527 } 1528 else 1529 { soap_unget(soap, ']'); 1530 return ']'; 1531 } 1123 1532 } 1124 else1533 else 1125 1534 { soap_revget1(soap); 1126 1535 return ']'; … … 1135 1544 while (soap_blank(c)); 1136 1545 if (c == '!' || c == '?' || c == '%') 1137 { if (c == '!') 1546 { register int k = 1; 1547 if (c == '!') 1138 1548 { c = soap_get1(soap); 1139 1549 if (c == '[') … … 1144 1554 soap->cdata = 1; 1145 1555 c = soap_get1(soap); 1146 continue;1556 continue; 1147 1557 } 1148 1558 if (c == '-' && (c = soap_get1(soap)) == '-') … … 1154 1564 } 1155 1565 } 1156 while ((int)c != EOF && c != '>') 1566 else if (c == '?') 1567 c = soap_get_pi(soap); 1568 while ((int)c != EOF) 1569 { if (c == '<') 1570 k++; 1571 else if (c == '>') 1572 { if (--k <= 0) 1573 break; 1574 } 1157 1575 c = soap_get1(soap); 1158 if ((int)c == EOF) 1159 break; 1576 } 1577 if ((int)c == EOF) 1578 break; 1160 1579 c = soap_get1(soap); 1161 1580 continue; … … 1182 1601 /******************************************************************************/ 1183 1602 #ifndef PALM_1 1184 SOAP_FMAC1 1185 soap_wchar 1186 SOAP_FMAC2 1187 soap_advance(struct soap *soap) 1188 { register soap_wchar c; 1189 while ((int)((c = soap_get(soap)) != EOF) && c != SOAP_LT && c != SOAP_TT) 1190 ; 1191 return c; 1192 } 1193 #endif 1194 1195 /******************************************************************************/ 1196 #ifndef PALM_1 1197 SOAP_FMAC1 1198 soap_wchar 1199 SOAP_FMAC2 1200 soap_skip(struct soap *soap) 1201 { register soap_wchar c; 1202 do c = soap_get(soap); 1203 while (soap_blank(c)); 1603 static soap_wchar 1604 soap_get_pi(struct soap *soap) 1605 { char buf[64]; 1606 register char *s = buf; 1607 register int i = sizeof(buf); 1608 register soap_wchar c = soap_getchar(soap); 1609 /* This is a quick way to parse XML PI and we could use a callback instead to 1610 * enable applications to intercept processing instructions */ 1611 while ((int)c != EOF && c != '?') 1612 { if (--i > 0) 1613 { if (soap_blank(c)) 1614 c = ' '; 1615 *s++ = (char)c; 1616 } 1617 c = soap_getchar(soap); 1618 } 1619 *s = '\0'; 1620 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "XML PI <?%s?>\n", buf)); 1621 if (!strncmp(buf, "xml ", 4)) 1622 { s = strstr(buf, " encoding="); 1623 if (s && s[10]) 1624 { if (!soap_tag_cmp(s + 11, "iso-8859-1*") 1625 || !soap_tag_cmp(s + 11, "latin1*")) 1626 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Switching to latin1 encoding\n")); 1627 soap->mode |= SOAP_ENC_LATIN; 1628 } 1629 else if (!soap_tag_cmp(s + 11, "utf-8*")) 1630 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Switching to utf-8 encoding\n")); 1631 soap->mode &= ~SOAP_ENC_LATIN; 1632 } 1633 } 1634 } 1635 if ((int)c != EOF) 1636 c = soap_getchar(soap); 1204 1637 return c; 1205 1638 } … … 1241 1674 soap_pututf8(struct soap *soap, register unsigned long c) 1242 1675 { char tmp[16]; 1243 if (c > 0 && c < 0x80)1676 if (c < 0x80 && c > 0) 1244 1677 { *tmp = (char)c; 1245 1678 return soap_send_raw(soap, tmp, 1); 1246 1679 } 1247 1680 #ifndef WITH_LEAN 1248 if ( soap->mode & SOAP_XML_CANONICAL)1681 if (c >= 0x80) 1249 1682 { register char *t = tmp; 1250 1683 if (c < 0x0800) … … 1272 1705 *t = '\0'; 1273 1706 } 1274 else1275 #endif 1276 sprintf(tmp, "&#%lu;", c); 1707 #else 1708 sprintf(tmp, "&#%lu;", c); 1709 #endif 1277 1710 return soap_send(soap, tmp); 1278 1711 } … … 1286 1719 soap_getutf8(struct soap *soap) 1287 1720 { register soap_wchar c, c1, c2, c3, c4; 1721 c = soap->ahead; 1722 if (c > 0xFF) 1723 { soap->ahead = 0; 1724 return c; 1725 } 1726 again: 1288 1727 c = soap_get(soap); 1289 1728 if (c < 0x80 || (soap->mode & SOAP_ENC_LATIN)) 1290 1729 return c; 1291 c1 = soap_get (soap);1730 c1 = soap_get1(soap); 1292 1731 if (c1 < 0x80) 1293 { soap_ unget(soap, c1);1732 { soap_revget1(soap); /* doesn't look like this is UTF8 */ 1294 1733 return c; 1295 1734 } … … 1298 1737 return ((soap_wchar)(c & 0x1F) << 6) | c1; 1299 1738 c2 = (soap_wchar)soap_get1(soap) & 0x3F; 1739 if (c == 0xEF && c1 == 0x3B && c2 == 0x3F) /* ignore UTF-8 BOM */ 1740 goto again; 1300 1741 if (c < 0xF0) 1301 1742 return ((soap_wchar)(c & 0x0F) << 12) | (c1 << 6) | c2; … … 1316 1757 SOAP_FMAC2 1317 1758 soap_puthex(struct soap *soap, const unsigned char *s, int n) 1318 { /* TODO: serialize to DOM (as an option) using new soap_s2hex() */ 1319 char d[2]; 1759 { char d[2]; 1320 1760 register int i; 1761 #ifdef WITH_DOM 1762 if ((soap->mode & SOAP_XML_DOM) && soap->dom) 1763 { if (!(soap->dom->data = soap_s2hex(soap, s, NULL, n))) 1764 return soap->error; 1765 return SOAP_OK; 1766 } 1767 #endif 1321 1768 for (i = 0; i < n; i++) 1322 1769 { register int m = *s++; … … 1338 1785 soap_gethex(struct soap *soap, int *n) 1339 1786 { 1787 #ifdef WITH_DOM 1788 if ((soap->mode & SOAP_XML_DOM) && soap->dom) 1789 { soap->dom->data = soap_string_in(soap, 0, -1, -1); 1790 return (unsigned char*)soap_hex2s(soap, soap->dom->data, NULL, 0, n); 1791 } 1792 #endif 1340 1793 #ifdef WITH_FAST 1341 1794 soap->labidx = 0; 1342 1795 for (;;) 1343 1796 { register char *s; 1344 register int i, k;1797 register size_t i, k; 1345 1798 if (soap_append_lab(soap, NULL, 0)) 1346 1799 return NULL; … … 1355 1808 { d1 = (char)c; 1356 1809 c = soap_get(soap); 1357 if (soap_isxdigit(c))1810 if (soap_isxdigit(c)) 1358 1811 d2 = (char)c; 1359 1812 else … … 1366 1819 soap_unget(soap, c); 1367 1820 if (n) 1368 *n = (int)(soap->lablen - k + i);1369 p = (unsigned char*)soap_malloc(soap, soap->lablen - k + i);1370 if (p)1371 memcpy(p, soap->labbuf, soap->lablen - k + i);1821 *n = (int)(soap->lablen + i - k); 1822 p = (unsigned char*)soap_malloc(soap, soap->lablen + i - k); 1823 if (p) 1824 memcpy(p, soap->labbuf, soap->lablen + i - k); 1372 1825 return p; 1373 1826 } … … 1376 1829 } 1377 1830 #else 1378 if (soap_new_block(soap) )1831 if (soap_new_block(soap) == NULL) 1379 1832 return NULL; 1380 1833 for (;;) 1381 1834 { register int i; 1382 register char *s = (char*)soap_push_block(soap, SOAP_BLKLEN);1835 register char *s = (char*)soap_push_block(soap, NULL, SOAP_BLKLEN); 1383 1836 if (!s) 1384 { soap_end_block(soap );1837 { soap_end_block(soap, NULL); 1385 1838 return NULL; 1386 1839 } … … 1391 1844 { d1 = (char)c; 1392 1845 c = soap_get(soap); 1393 if (soap_isxdigit(c))1846 if (soap_isxdigit(c)) 1394 1847 d2 = (char)c; 1395 1848 else 1396 { soap_end_block(soap );1397 soap->error = SOAP_TYPE;1849 { soap_end_block(soap, NULL); 1850 soap->error = SOAP_TYPE; 1398 1851 return NULL; 1399 1852 } … … 1403 1856 soap_unget(soap, c); 1404 1857 if (n) 1405 *n = soap_size_block(soap, i);1858 *n = (int)soap_size_block(soap, NULL, i); 1406 1859 p = (unsigned char*)soap_save_block(soap, NULL, 0); 1407 1860 return p; … … 1427 1880 #ifdef WITH_DOM 1428 1881 if ((soap->mode & SOAP_XML_DOM) && soap->dom) 1429 { if (!(soap->dom->data = soap_s2base64(soap, s, soap->dom->data, n)))1882 { if (!(soap->dom->data = soap_s2base64(soap, s, NULL, n))) 1430 1883 return soap->error; 1431 1884 return SOAP_OK; … … 1465 1918 soap_getbase64(struct soap *soap, int *n, int malloc_flag) 1466 1919 { 1920 #ifdef WITH_DOM 1921 if ((soap->mode & SOAP_XML_DOM) && soap->dom) 1922 { soap->dom->data = soap_string_in(soap, 0, -1, -1); 1923 return (unsigned char*)soap_base642s(soap, soap->dom->data, NULL, 0, n); 1924 } 1925 #endif 1467 1926 #ifdef WITH_FAST 1468 1927 soap->labidx = 0; 1469 1928 for (;;) 1470 { register int i, k;1929 { register size_t i, k; 1471 1930 register char *s; 1472 1931 if (soap_append_lab(soap, NULL, 2)) 1473 1932 return NULL; 1474 1933 s = soap->labbuf + soap->labidx; 1475 k = 3 * ((soap->lablen - soap->labidx) / 3);1934 k = soap->lablen - soap->labidx; 1476 1935 soap->labidx = 3 * (soap->lablen / 3); 1477 1936 if (!s) 1478 1937 return NULL; 1479 for (i = 0; i < k; i += 3) 1480 { register unsigned long m = 0; 1481 register int j = 0; 1482 do 1483 { register soap_wchar c = soap_get(soap); 1484 if (c == '=' || c < 0) 1485 { unsigned char *p; 1486 switch (j) 1487 { case 2: 1488 *s++ = (char)((m >> 4) & 0xFF); 1489 i++; 1490 break; 1491 case 3: 1492 *s++ = (char)((m >> 10) & 0xFF); 1493 *s++ = (char)((m >> 2) & 0xFF); 1494 i += 2; 1938 if (k > 2) 1939 { for (i = 0; i < k - 2; i += 3) 1940 { register unsigned long m = 0; 1941 register int j = 0; 1942 do 1943 { register soap_wchar c = soap_get(soap); 1944 if (c == '=' || c < 0) 1945 { unsigned char *p; 1946 switch (j) 1947 { case 2: 1948 *s++ = (char)((m >> 4) & 0xFF); 1949 i++; 1950 break; 1951 case 3: 1952 *s++ = (char)((m >> 10) & 0xFF); 1953 *s++ = (char)((m >> 2) & 0xFF); 1954 i += 2; 1955 } 1956 if (n) 1957 *n = (int)(soap->lablen + i - k); 1958 p = (unsigned char*)soap_malloc(soap, soap->lablen + i - k); 1959 if (p) 1960 memcpy(p, soap->labbuf, soap->lablen + i - k); 1961 if (c >= 0) 1962 { while ((int)((c = soap_get(soap)) != EOF) && c != SOAP_LT && c != SOAP_TT) 1963 ; 1964 } 1965 soap_unget(soap, c); 1966 return p; 1495 1967 } 1496 if (n) 1497 *n = (int)(soap->lablen - k + i); 1498 p = (unsigned char*)soap_malloc(soap, soap->lablen - k + i); 1499 if (p) 1500 memcpy(p, soap->labbuf, soap->lablen - k + i); 1501 if (c >= 0) 1502 { while ((int)((c = soap_get(soap)) != EOF) && c != SOAP_LT && c != SOAP_TT) 1503 ; 1504 } 1505 soap_unget(soap, c); 1506 return p; 1507 } 1508 c -= '+'; 1509 if (c >= 0 && c <= 79) 1510 { m = (m << 6) + soap_base64i[c]; 1511 j++; 1512 } 1513 } while (j < 4); 1514 *s++ = (char)((m >> 16) & 0xFF); 1515 *s++ = (char)((m >> 8) & 0xFF); 1516 *s++ = (char)(m & 0xFF); 1968 c -= '+'; 1969 if (c >= 0 && c <= 79) 1970 { register int b = soap_base64i[c]; 1971 if (b >= 64) 1972 { soap->error = SOAP_TYPE; 1973 return NULL; 1974 } 1975 m = (m << 6) + b; 1976 j++; 1977 } 1978 else if (!soap_blank(c + '+')) 1979 { soap->error = SOAP_TYPE; 1980 return NULL; 1981 } 1982 } while (j < 4); 1983 *s++ = (char)((m >> 16) & 0xFF); 1984 *s++ = (char)((m >> 8) & 0xFF); 1985 *s++ = (char)(m & 0xFF); 1986 } 1517 1987 } 1518 1988 } 1519 1989 #else 1520 if (soap_new_block(soap) )1990 if (soap_new_block(soap) == NULL) 1521 1991 return NULL; 1522 1992 for (;;) 1523 1993 { register int i; 1524 register char *s = (char*)soap_push_block(soap, 3 * SOAP_BLKLEN); /* must be multiple of 3 */1994 register char *s = (char*)soap_push_block(soap, NULL, 3 * SOAP_BLKLEN); /* must be multiple of 3 */ 1525 1995 if (!s) 1526 { soap_end_block(soap );1996 { soap_end_block(soap, NULL); 1527 1997 return NULL; 1528 1998 } … … 1546 2016 } 1547 2017 if (n) 1548 *n = (int)soap_size_block(soap, i);2018 *n = (int)soap_size_block(soap, NULL, i); 1549 2019 p = (unsigned char*)soap_save_block(soap, NULL, 0); 1550 2020 if (c >= 0) 1551 2021 { while ((int)((c = soap_get(soap)) != EOF) && c != SOAP_LT && c != SOAP_TT) 1552 2022 ; 1553 }2023 } 1554 2024 soap_unget(soap, c); 1555 2025 return p; … … 1557 2027 c -= '+'; 1558 2028 if (c >= 0 && c <= 79) 1559 { m = (m << 6) + soap_base64i[c]; 2029 { int b = soap_base64i[c]; 2030 if (b >= 64) 2031 { soap->error = SOAP_TYPE; 2032 return NULL; 2033 } 2034 m = (m << 6) + b; 1560 2035 j++; 2036 } 2037 else if (!soap_blank(c)) 2038 { soap->error = SOAP_TYPE; 2039 return NULL; 1561 2040 } 1562 2041 } while (j < 4); … … 1571 2050 1572 2051 /******************************************************************************/ 2052 #ifndef WITH_LEANER 2053 #ifndef PALM_1 2054 SOAP_FMAC1 2055 int 2056 SOAP_FMAC2 2057 soap_xop_forward(struct soap *soap, unsigned char **ptr, int *size, char **id, char **type, char **options) 2058 { /* Check MTOM xop:Include element (within hex/base64Binary) */ 2059 /* TODO: this code to be obsoleted with new import/xop.h conventions */ 2060 int body = soap->body; /* should save type too? */ 2061 if (!soap_peek_element(soap)) 2062 { if (!soap_element_begin_in(soap, "xop:Include", 0, NULL) && *soap->href) 2063 { if (soap_dime_forward(soap, ptr, size, id, type, options)) 2064 return soap->error; 2065 } 2066 if (soap->body && soap_element_end_in(soap, NULL)) 2067 return soap->error; 2068 } 2069 soap->body = body; 2070 return SOAP_OK; 2071 } 2072 #endif 2073 #endif 2074 2075 /******************************************************************************/ 2076 #ifndef WITH_LEANER 2077 #ifndef PALM_1 2078 SOAP_FMAC1 2079 int 2080 SOAP_FMAC2 2081 soap_dime_forward(struct soap *soap, unsigned char **ptr, int *size, char **id, char **type, char **options) 2082 { struct soap_xlist *xp; 2083 *ptr = NULL; 2084 *size = 0; 2085 *id = NULL; 2086 *type = NULL; 2087 *options = NULL; 2088 if (!*soap->href) 2089 return SOAP_OK; 2090 *id = soap_strdup(soap, soap->href); 2091 xp = (struct soap_xlist*)SOAP_MALLOC(soap, sizeof(struct soap_xlist)); 2092 if (!xp) 2093 return soap->error = SOAP_EOM; 2094 xp->next = soap->xlist; 2095 xp->ptr = ptr; 2096 xp->size = size; 2097 xp->id = *id; 2098 xp->type = type; 2099 xp->options = options; 2100 soap->xlist = xp; 2101 return SOAP_OK; 2102 } 2103 #endif 2104 #endif 2105 2106 /******************************************************************************/ 1573 2107 #ifndef PALM_1 1574 2108 SOAP_FMAC1 … … 1586 2120 #ifndef PALM_1 1587 2121 SOAP_FMAC1 1588 int 2122 wchar_t * 2123 SOAP_FMAC2 2124 soap_wstrdup(struct soap *soap, const wchar_t *s) 2125 { wchar_t *t = NULL; 2126 if (s) 2127 { size_t n = 0; 2128 while (s[n]) 2129 n++; 2130 if ((t = (wchar_t*)soap_malloc(soap, sizeof(wchar_t)*(n+1)))) 2131 memcpy(t, s, sizeof(wchar_t)*(n+1)); 2132 } 2133 return t; 2134 } 2135 #endif 2136 2137 /******************************************************************************/ 2138 #ifndef PALM_1 2139 SOAP_FMAC1 2140 struct soap_blist* 1589 2141 SOAP_FMAC2 1590 2142 soap_new_block(struct soap *soap) 1591 2143 { struct soap_blist *p; 1592 2144 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "New block sequence (prev=%p)\n", soap->blist)); 1593 if (!(p = (struct soap_blist*)SOAP_MALLOC(sizeof(struct soap_blist)))) 1594 return SOAP_EOM; 2145 if (!(p = (struct soap_blist*)SOAP_MALLOC(soap, sizeof(struct soap_blist)))) 2146 { soap->error = SOAP_EOM; 2147 return NULL; 2148 } 1595 2149 p->next = soap->blist; 1596 2150 p->ptr = NULL; 1597 2151 p->size = 0; 1598 2152 soap->blist = p; 1599 return SOAP_OK;2153 return p; 1600 2154 } 1601 2155 #endif … … 1606 2160 void* 1607 2161 SOAP_FMAC2 1608 soap_push_block(struct soap *soap, s ize_t n)2162 soap_push_block(struct soap *soap, struct soap_blist *b, size_t n) 1609 2163 { char *p; 1610 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)); 1611 if (!(p = (char*)SOAP_MALLOC(n + sizeof(char*) + sizeof(size_t)))) 2164 if (!b) 2165 b = soap->blist; 2166 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push block of %u bytes (%u bytes total)\n", (unsigned int)n, (unsigned int)b->size + (unsigned int)n)); 2167 if (!(p = (char*)SOAP_MALLOC(soap, n + sizeof(char*) + sizeof(size_t)))) 1612 2168 { soap->error = SOAP_EOM; 1613 2169 return NULL; 1614 2170 } 1615 *(char**)p = soap->blist->ptr;2171 *(char**)p = b->ptr; 1616 2172 *(size_t*)(p + sizeof(char*)) = n; 1617 soap->blist->ptr = p;1618 soap->blist->size += n;2173 b->ptr = p; 2174 b->size += n; 1619 2175 return p + sizeof(char*) + sizeof(size_t); 1620 2176 } … … 1626 2182 void 1627 2183 SOAP_FMAC2 1628 soap_pop_block(struct soap *soap )2184 soap_pop_block(struct soap *soap, struct soap_blist *b) 1629 2185 { char *p; 1630 if (!soap->blist->ptr) 2186 if (!b) 2187 b = soap->blist; 2188 if (!b->ptr) 1631 2189 return; 1632 2190 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Pop block\n")); 1633 p = soap->blist->ptr; 1634 soap->blist->size -= *(size_t*)(p + sizeof(char*)); 1635 soap->blist->ptr = *(char**)p; 1636 SOAP_FREE(p); 1637 } 1638 #endif 1639 1640 /******************************************************************************/ 2191 p = b->ptr; 2192 b->size -= *(size_t*)(p + sizeof(char*)); 2193 b->ptr = *(char**)p; 2194 SOAP_FREE(soap, p); 2195 } 2196 #endif 2197 2198 /******************************************************************************/ 2199 #ifndef WITH_NOIDREF 1641 2200 #ifndef PALM_1 1642 2201 static void 1643 soap_update_ptrs(struct soap *soap, char *start, char *end, long offset)2202 soap_update_ptrs(struct soap *soap, char *start, char *end, char *p1, char *p2) 1644 2203 { int i; 1645 register struct soap_ilist *ip; 1646 register struct soap_flist *fp; 2204 register struct soap_ilist *ip = NULL; 2205 register struct soap_flist *fp = NULL; 2206 #ifndef WITH_LEANER 2207 register struct soap_xlist *xp = NULL; 2208 #endif 1647 2209 register void *p, **q; 1648 2210 for (i = 0; i < SOAP_IDHASH; i++) 1649 for (ip = soap->iht[i]; ip; ip = ip->next)2211 { for (ip = soap->iht[i]; ip; ip = ip->next) 1650 2212 { if (ip->ptr && (char*)ip->ptr >= start && (char*)ip->ptr < end) 1651 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Update id='%s' %p -> %p\n", ip->id, ip->ptr, (char*)ip->ptr + offset));1652 ip->ptr = (char*)ip->ptr + offset;2213 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Update id='%s' %p -> %p\n", ip->id, ip->ptr, (char*)ip->ptr + (p1-p2))); 2214 ip->ptr = (char*)ip->ptr + (p1-p2); 1653 2215 } 1654 2216 for (q = &ip->link; q; q = (void**)p) … … 1656 2218 if (p && (char*)p >= start && (char*)p < end) 1657 2219 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Link update id='%s' %p\n", ip->id, p)); 1658 *q = (char*)p + offset;2220 *q = (char*)p + (p1-p2); 1659 2221 } 1660 2222 } … … 1663 2225 if (p && (char*)p >= start && (char*)p < end) 1664 2226 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copy chain update id='%s' %p\n", ip->id, p)); 1665 *q = (char*)p + offset;2227 *q = (char*)p + (p1-p2); 1666 2228 } 1667 2229 } … … 1669 2231 { if ((char*)fp->ptr >= start && (char*)fp->ptr < end) 1670 2232 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copy list update id='%s' %p\n", ip->id, fp)); 1671 fp->ptr = (char*)fp->ptr + offset;2233 fp->ptr = (char*)fp->ptr + (p1-p2); 1672 2234 } 1673 2235 } 1674 2236 } 1675 } 1676 #endif 1677 1678 /******************************************************************************/ 2237 } 2238 #ifndef WITH_LEANER 2239 for (xp = soap->xlist; xp; xp = xp->next) 2240 { if (xp->ptr && (char*)xp->ptr >= start && (char*)xp->ptr < end) 2241 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Update id='%s' %p -> %p\n", xp->id?xp->id:SOAP_STR_EOS, xp->ptr, (char*)xp->ptr + (p1-p2))); 2242 xp->ptr = (unsigned char**)((char*)xp->ptr + (p1-p2)); 2243 xp->size = (int*)((char*)xp->size + (p1-p2)); 2244 xp->type = (char**)((char*)xp->type + (p1-p2)); 2245 xp->options = (char**)((char*)xp->options + (p1-p2)); 2246 } 2247 } 2248 #endif 2249 } 2250 #endif 2251 #endif 2252 2253 /******************************************************************************/ 2254 #ifndef WITH_NOIDREF 1679 2255 #ifndef PALM_1 1680 2256 static int 1681 2257 soap_has_copies(struct soap *soap, register const char *start, register const char *end) 1682 2258 { register int i; 1683 register struct soap_ilist *ip ;1684 register struct soap_flist *fp ;2259 register struct soap_ilist *ip = NULL; 2260 register struct soap_flist *fp = NULL; 1685 2261 register const char *p; 1686 2262 for (i = 0; i < SOAP_IDHASH; i++) … … 1691 2267 for (fp = ip->flist; fp; fp = fp->next) 1692 2268 if ((const char*)fp->ptr >= start && (const char*)fp->ptr < end) 1693 return SOAP_ERR;2269 return SOAP_ERR; 1694 2270 } 1695 2271 } … … 1697 2273 } 1698 2274 #endif 1699 1700 /******************************************************************************/ 2275 #endif 2276 2277 /******************************************************************************/ 2278 #ifndef WITH_NOIDREF 1701 2279 #ifndef PALM_1 1702 2280 SOAP_FMAC1 … … 1705 2283 soap_resolve(struct soap *soap) 1706 2284 { register int i; 1707 register struct soap_ilist *ip ;1708 register struct soap_flist *fp ;2285 register struct soap_ilist *ip = NULL; 2286 register struct soap_flist *fp = NULL; 1709 2287 short flag; 1710 2288 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Resolving forwarded data\n")); … … 1743 2321 do 1744 2322 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "... copy %p -> %p (%u bytes)\n", ip->ptr, q, (unsigned int)ip->size)); 1745 p = *q;2323 p = *q; 1746 2324 memcpy(q, ip->ptr, ip->size); 1747 2325 q = (void**)p; 1748 2326 } while (q); 1749 flag = 1;1750 }2327 flag = 1; 2328 } 1751 2329 for (fp = ip->flist; fp; fp = ip->flist) 1752 2330 { register unsigned int k = fp->level; 1753 register void *p = ip->ptr;2331 register void *p = ip->ptr; 1754 2332 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)); 1755 while (ip->level < k)2333 while (ip->level < k) 1756 2334 { register void **q = (void**)soap_malloc(soap, sizeof(void*)); 1757 if (!q)1758 return soap->error;1759 *q = p;2335 if (!q) 2336 return soap->error; 2337 *q = p; 1760 2338 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Descending one level, new location=%p holds=%p...\n", q, *q)); 1761 2339 p = (void*)q; 1762 2340 k--; 1763 2341 } 1764 if (fp->fcopy)1765 fp->fcopy(soap, ip->type, fp->type, fp->ptr, p, ip->size);1766 else1767 soap_fcopy(soap, ip->type, fp->type, fp->ptr, p, ip->size);1768 ip->flist = fp->next;1769 SOAP_FREE(fp);1770 flag = 1;1771 }2342 if (fp->fcopy) 2343 fp->fcopy(soap, ip->type, fp->type, fp->ptr, fp->len, p, ip->size); 2344 else 2345 soap_fcopy(soap, ip->type, fp->type, fp->ptr, fp->len, p, ip->size); 2346 ip->flist = fp->next; 2347 SOAP_FREE(soap, fp); 2348 flag = 1; 2349 } 1772 2350 } 1773 2351 } … … 1787 2365 } 1788 2366 #endif 2367 #endif 1789 2368 1790 2369 /******************************************************************************/ … … 1793 2372 size_t 1794 2373 SOAP_FMAC2 1795 soap_size_block(struct soap *soap, size_t n) 1796 { if (soap->blist->ptr) 1797 { soap->blist->size -= *(size_t*)(soap->blist->ptr + sizeof(char*)) - n; 1798 *(size_t*)(soap->blist->ptr + sizeof(char*)) = n; 1799 } 1800 return soap->blist->size; 2374 soap_size_block(struct soap *soap, struct soap_blist *b, size_t n) 2375 { if (!b) 2376 b = soap->blist; 2377 if (b->ptr) 2378 { b->size -= *(size_t*)(b->ptr + sizeof(char*)) - n; 2379 *(size_t*)(b->ptr + sizeof(char*)) = n; 2380 } 2381 return b->size; 1801 2382 } 1802 2383 #endif … … 1807 2388 char* 1808 2389 SOAP_FMAC2 1809 soap_first_block(struct soap *soap )2390 soap_first_block(struct soap *soap, struct soap_blist *b) 1810 2391 { char *p, *q, *r; 1811 p = soap->blist->ptr; 2392 if (!b) 2393 b = soap->blist; 2394 p = b->ptr; 1812 2395 if (!p) 1813 2396 return NULL; … … 1820 2403 p = q; 1821 2404 } while (p); 1822 soap->blist->ptr = r;2405 b->ptr = r; 1823 2406 return r + sizeof(char*) + sizeof(size_t); 1824 2407 } … … 1830 2413 char* 1831 2414 SOAP_FMAC2 1832 soap_next_block(struct soap *soap )2415 soap_next_block(struct soap *soap, struct soap_blist *b) 1833 2416 { char *p; 1834 p = soap->blist->ptr; 2417 if (!b) 2418 b = soap->blist; 2419 p = b->ptr; 1835 2420 if (p) 1836 2421 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Next block\n")); 1837 soap->blist->ptr = *(char**)p;1838 SOAP_FREE( p);1839 if ( soap->blist->ptr)1840 return soap->blist->ptr + sizeof(char*) + sizeof(size_t);2422 b->ptr = *(char**)p; 2423 SOAP_FREE(soap, p); 2424 if (b->ptr) 2425 return b->ptr + sizeof(char*) + sizeof(size_t); 1841 2426 } 1842 2427 return NULL; … … 1849 2434 size_t 1850 2435 SOAP_FMAC2 1851 soap_block_size(struct soap *soap) 1852 { return *(size_t*)(soap->blist->ptr + sizeof(char*)); 2436 soap_block_size(struct soap *soap, struct soap_blist *b) 2437 { if (!b) 2438 b = soap->blist; 2439 return *(size_t*)(b->ptr + sizeof(char*)); 1853 2440 } 1854 2441 #endif … … 1859 2446 void 1860 2447 SOAP_FMAC2 1861 soap_end_block(struct soap *soap )1862 { struct soap_blist *bp;1863 char *p, *q;1864 bp= soap->blist;1865 if (b p)2448 soap_end_block(struct soap *soap, struct soap_blist *b) 2449 { char *p, *q; 2450 if (!b) 2451 b = soap->blist; 2452 if (b) 1866 2453 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End of block sequence, free all remaining blocks\n")); 1867 for (p = b p->ptr; p; p = q)2454 for (p = b->ptr; p; p = q) 1868 2455 { q = *(char**)p; 1869 SOAP_FREE(p); 1870 } 1871 soap->blist = bp->next; 1872 SOAP_FREE(bp); 2456 SOAP_FREE(soap, p); 2457 } 2458 if (soap->blist == b) 2459 soap->blist = b->next; 2460 else 2461 { struct soap_blist *bp; 2462 for (bp = soap->blist; bp; bp = bp->next) 2463 { if (bp->next == b) 2464 { bp->next = b->next; 2465 break; 2466 } 2467 } 2468 } 2469 SOAP_FREE(soap, b); 1873 2470 } 1874 2471 DBGLOG(TEST, if (soap->blist) SOAP_MESSAGE(fdebug, "Restore previous block sequence\n")); … … 1881 2478 char* 1882 2479 SOAP_FMAC2 1883 soap_save_block(struct soap *soap, char *p, int flag)2480 soap_save_block(struct soap *soap, struct soap_blist *b, char *p, int flag) 1884 2481 { register size_t n; 1885 2482 register char *q, *s; 1886 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)); 1887 if (soap->blist->size) 2483 if (!b) 2484 b = soap->blist; 2485 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Save all blocks in contiguous memory space of %u bytes (%p->%p)\n", (unsigned int)b->size, b->ptr, p)); 2486 if (b->size) 1888 2487 { if (!p) 1889 p = (char*)soap_malloc(soap, soap->blist->size);2488 p = (char*)soap_malloc(soap, b->size); 1890 2489 if (p) 1891 { for (s = p, q = soap_first_block(soap); q; q = soap_next_block(soap)) 1892 { n = soap_block_size(soap); 2490 { for (s = p, q = soap_first_block(soap, b); q; q = soap_next_block(soap, b)) 2491 { n = soap_block_size(soap, b); 2492 #ifndef WITH_NOIDREF 1893 2493 if (flag) 1894 soap_update_ptrs(soap, q, q + n, (long)s - (long)q); /* pointers s and q may or may not be related */ 2494 soap_update_ptrs(soap, q, q + n, s, q); 2495 #endif 1895 2496 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copy %u bytes from %p to %p\n", (unsigned int)n, q, s)); 1896 2497 memcpy(s, q, n); … … 1901 2502 soap->error = SOAP_EOM; 1902 2503 } 1903 soap_end_block(soap );2504 soap_end_block(soap, b); 1904 2505 return p; 1905 2506 } … … 2031 2632 if (!*attr1) 2032 2633 return -1; 2634 if (*attr1 == '[') 2635 attr1++; 2033 2636 n = 1; 2034 do 2035 { attr1++; 2036 k = (int)soap_strtol(attr1, &s, 10); 2637 for (;;) 2638 { k = (int)soap_strtol(attr1, &s, 10); 2037 2639 n *= k; 2038 2640 if (k < 0 || n > SOAP_MAXARRAYSIZE || s == attr1) … … 2050 2652 attr2 = s; 2051 2653 } 2052 } while (attr1 && *attr1 != ']'); 2654 if (!attr1) 2655 break; 2656 attr1++; 2657 } 2053 2658 return n - *j; 2054 2659 } … … 2064 2669 if (!*attr) 2065 2670 return -1; 2066 i = strlen(attr);2671 i = (int)strlen(attr); 2067 2672 n = 1; 2068 2673 do … … 2109 2714 { register struct soap_nlist *np; 2110 2715 register struct Namespace *p; 2111 np = (struct soap_nlist*)SOAP_MALLOC(sizeof(struct soap_nlist) + strlen(id)); 2716 register short i = -1; 2717 register size_t n, k; 2718 n = strlen(id); 2719 k = strlen(ns) + 1; 2720 p = soap->local_namespaces; 2721 if (p) 2722 { for (i = 0; p->id; p++, i++) 2723 { if (p->ns && !strcmp(ns, p->ns)) 2724 { if (p->out) 2725 { SOAP_FREE(soap, p->out); 2726 p->out = NULL; 2727 } 2728 break; 2729 } 2730 if (p->out) 2731 { if (!strcmp(ns, p->out)) 2732 break; 2733 } 2734 else if (p->in) 2735 { if (!soap_tag_cmp(ns, p->in)) 2736 { if ((p->out = (char*)SOAP_MALLOC(soap, k))) 2737 strcpy(p->out, ns); 2738 break; 2739 } 2740 } 2741 } 2742 if (!p || !p->id) 2743 i = -1; 2744 } 2745 if (i >= 0) 2746 k = 0; 2747 np = (struct soap_nlist*)SOAP_MALLOC(soap, sizeof(struct soap_nlist) + n + k); 2112 2748 if (!np) 2113 2749 return soap->error = SOAP_EOM; 2114 2750 np->next = soap->nlist; 2115 2751 soap->nlist = np; 2752 np->level = soap->level; 2753 np->index = i; 2116 2754 strcpy(np->id, id); 2117 np->level = soap->level;2118 np->index = -1;2119 np->ns = NULL;2120 2755 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push namespace binding (level=%u) '%s' '%s'\n", soap->level, id, ns)); 2121 p = soap->local_namespaces; 2122 if (p) 2123 { register short i = 0; 2124 for (; p->id; p++, i++) 2125 { if (p->ns && !strcmp(ns, p->ns)) 2126 { if (p->out) 2127 { SOAP_FREE(p->out); 2128 p->out = NULL; 2129 } 2130 break; 2131 } 2132 if (p->out) 2133 { if (!SOAP_STRCMP(ns, p->out)) 2134 break; 2135 } 2136 else if (p->in) 2137 { if (!soap_tag_cmp(ns, p->in)) 2138 { if ((p->out = (char*)SOAP_MALLOC(strlen(ns) + 1))) 2139 strcpy(p->out, ns); 2140 break; 2141 } 2142 } 2143 } 2144 if (p && p->id) 2145 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push OK ('%s' matches '%s' in namespace table)\n", id, p->id)); 2146 np->index = i; 2147 } 2148 } 2149 if (!p || !p->id) 2150 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push NOT OK: no match found for '%s' in namespace mapping table (added to stack anyway)\n", ns)); 2151 np->ns = (char*)SOAP_MALLOC(strlen(ns) + 1); 2152 if (!np->ns) 2153 return soap->error = SOAP_EOM; 2756 if (i < 0) 2757 { np->ns = np->id + n + 1; 2154 2758 strcpy(np->ns, ns); 2759 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push NOT OK: no match found for '%s' in namespace mapping table (added to stack anyway)\n", ns)); 2760 } 2761 else 2762 { np->ns = NULL; 2763 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push OK ('%s' matches '%s' in namespace table)\n", id, p->id)); 2155 2764 } 2156 2765 return SOAP_OK; … … 2164 2773 SOAP_FMAC2 2165 2774 soap_pop_namespace(struct soap *soap) 2166 { register struct soap_nlist *np; 2167 while (soap->nlist && soap->nlist->level >= soap->level) 2168 { np = soap->nlist->next; 2169 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Popped namespace binding (level=%u) '%s'\n", soap->level, soap->nlist->id)); 2170 if (soap->nlist->ns) 2171 SOAP_FREE(soap->nlist->ns); 2172 SOAP_FREE(soap->nlist); 2173 soap->nlist = np; 2174 } 2775 { register struct soap_nlist *np, *nq; 2776 for (np = soap->nlist; np && np->level >= soap->level; np = nq) 2777 { nq = np->next; 2778 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Pop namespace binding (level=%u) '%s'\n", soap->level, np->id)); 2779 SOAP_FREE(soap, np); 2780 } 2781 soap->nlist = np; 2175 2782 } 2176 2783 #endif … … 2181 2788 int 2182 2789 SOAP_FMAC2 2183 soap_match_namespace(struct soap *soap, const char *id1, const char *id2, int n1, int n2)2790 soap_match_namespace(struct soap *soap, const char *id1, const char *id2, size_t n1, size_t n2) 2184 2791 { register struct soap_nlist *np = soap->nlist; 2185 2792 while (np && (strncmp(np->id, id1, n1) || np->id[n1])) 2186 2793 np = np->next; 2187 2794 if (np) 2188 { if (np->index < 0 || (np->index >= 0 && soap->local_namespaces[np->index].id && (strncmp(soap->local_namespaces[np->index].id, id2, n2) || soap->local_namespaces[np->index].id[n2]))) 2795 { if (np->index < 0 2796 || (soap->local_namespaces[np->index].id 2797 && (strncmp(soap->local_namespaces[np->index].id, id2, n2) 2798 || soap->local_namespaces[np->index].id[n2]))) 2189 2799 return SOAP_NAMESPACE; 2190 2800 return SOAP_OK; 2191 2801 } 2192 if (n1 == 3 && n1 == n2 && !str cmp(id1, "xml") && !strcmp(id1, id2))2802 if (n1 == 3 && n1 == n2 && !strncmp(id1, "xml", 3) && !strncmp(id1, id2, 3)) 2193 2803 return SOAP_OK; 2194 return SOAP_SYNTAX_ERROR; 2804 return soap->error = SOAP_SYNTAX_ERROR; 2805 } 2806 #endif 2807 2808 /******************************************************************************/ 2809 #ifndef PALM_2 2810 SOAP_FMAC1 2811 const char* 2812 SOAP_FMAC2 2813 soap_current_namespace(struct soap *soap, const char *tag) 2814 { register struct soap_nlist *np; 2815 register const char *s; 2816 if (!tag || !strncmp(tag, "xml", 3)) 2817 return NULL; 2818 np = soap->nlist; 2819 if (!(s = strchr(tag, ':'))) 2820 { while (np && *np->id) /* find default namespace, if present */ 2821 np = np->next; 2822 } 2823 else 2824 { while (np && (strncmp(np->id, tag, s - tag) || np->id[s - tag])) 2825 np = np->next; 2826 if (!np) 2827 soap->error = SOAP_NAMESPACE; 2828 } 2829 if (np) 2830 { if (np->index >= 0) 2831 return soap->namespaces[np->index].ns; 2832 if (np->ns) 2833 return soap_strdup(soap, np->ns); 2834 } 2835 return NULL; 2195 2836 } 2196 2837 #endif … … 2217 2858 { if (c2 != '*') 2218 2859 return 1; 2219 c2 = *++t;2860 c2 = *++t; 2220 2861 if (!c2) 2221 return 0;2862 return 0; 2222 2863 if (c2 >= 'A' && c2 <= 'Z') 2223 2864 c2 += 'a' - 'A'; 2224 2865 for (;;) 2225 2866 { c1 = *s; 2226 if (!c1 || c1 == '"')2227 break;2228 if (c1 >= 'A' && c1 <= 'Z')2867 if (!c1 || c1 == '"') 2868 break; 2869 if (c1 >= 'A' && c1 <= 'Z') 2229 2870 c1 += 'a' - 'A'; 2230 if (c1 == c2) 2231 if (!soap_tag_cmp(s + 1, t + 1)) 2232 return 0; 2233 s++; 2871 if (c1 == c2 && !soap_tag_cmp(s + 1, t + 1)) 2872 return 0; 2873 s++; 2234 2874 } 2235 2875 break; … … 2252 2892 soap_match_tag(struct soap *soap, const char *tag1, const char *tag2) 2253 2893 { register const char *s, *t; 2894 register int err; 2254 2895 if (!tag1 || !tag2 || !*tag2) 2255 2896 return SOAP_OK; … … 2260 2901 { if (t[1] && SOAP_STRCMP(s + 1, t + 1)) 2261 2902 return SOAP_TAG_MISMATCH; 2262 if (t != tag2 && soap_match_namespace(soap, tag1, tag2, s - tag1, t - tag2))2903 if (t != tag2 && (err = soap_match_namespace(soap, tag1, tag2, s - tag1, t - tag2))) 2263 2904 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Tags '%s' and '%s' match but namespaces differ\n", tag1, tag2)); 2264 return SOAP_TAG_MISMATCH; 2905 if (err == SOAP_NAMESPACE) 2906 return SOAP_TAG_MISMATCH; 2907 return err; 2265 2908 } 2266 2909 } 2267 2910 else if (SOAP_STRCMP(tag1, t + 1)) 2268 return SOAP_TAG_MISMATCH; 2269 else if (t != tag2 && soap_match_namespace(soap, tag1, tag2, 0, t - tag2)) 2911 { return SOAP_TAG_MISMATCH; 2912 } 2913 else if (t != tag2 && (err = soap_match_namespace(soap, tag1, tag2, 0, t - tag2))) 2270 2914 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Tags '%s' and '%s' match but namespaces differ\n", tag1, tag2)); 2271 return SOAP_TAG_MISMATCH; 2915 if (err == SOAP_NAMESPACE) 2916 return SOAP_TAG_MISMATCH; 2917 return err; 2272 2918 } 2273 2919 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Tags and (default) namespaces match: '%s' '%s'\n", tag1, tag2)); … … 2303 2949 #endif 2304 2950 2305 /******************************************************************************/ 2951 /******************************************************************************\ 2952 * 2953 * SSL 2954 * 2955 \******************************************************************************/ 2306 2956 2307 2957 #ifdef WITH_OPENSSL 2958 /******************************************************************************/ 2959 #ifndef PALM_2 2960 SOAP_FMAC1 2961 int 2962 SOAP_FMAC2 2963 soap_rand() 2964 { unsigned char buf[4]; 2965 if (!soap_ssl_init_done) 2966 soap_ssl_init(); 2967 RAND_pseudo_bytes(buf, 4); 2968 return *(int*)buf; 2969 } 2970 #endif 2971 2308 2972 /******************************************************************************/ 2309 2973 #ifndef PALM_2 … … 2317 2981 soap->cafile = cafile; 2318 2982 soap->capath = capath; 2319 if (dhfile) 2320 { soap->dhfile = dhfile; 2321 soap->rsa = 0; 2322 } 2323 else 2324 { soap->dhfile = NULL; 2325 soap->rsa = 1; 2326 } 2983 soap->dhfile = dhfile; 2327 2984 soap->randfile = randfile; 2328 soap-> require_client_auth = (flags & SOAP_SSL_REQUIRE_CLIENT_AUTHENTICATION);2985 soap->ssl_flags = flags | (dhfile == NULL ? SOAP_SSL_RSA : 0); 2329 2986 if (!(err = soap->fsslauth(soap))) 2330 if (sid) 2331 SSL_CTX_set_session_id_context(soap->ctx, (unsigned char*)sid, strlen(sid)); 2987 { if (sid) 2988 SSL_CTX_set_session_id_context(soap->ctx, (unsigned char*)sid, (unsigned int)strlen(sid)); 2989 } 2332 2990 return err; 2333 2991 } … … 2345 3003 soap->capath = capath; 2346 3004 soap->dhfile = NULL; 2347 soap-> rsa = 0;3005 soap->ssl_flags = flags; 2348 3006 soap->randfile = randfile; 2349 soap-> require_server_auth = (flags & SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION);3007 soap->fsslverify = (flags & SOAP_SSL_ALLOW_EXPIRED_CERTIFICATE) == 0 ? ssl_verify_callback : ssl_verify_callback_allow_expired_certificate; 2350 3008 return soap->fsslauth(soap); 2351 3009 } … … 2354 3012 /******************************************************************************/ 2355 3013 #ifndef PALM_2 2356 static void 2357 ssl_init() 2358 { static int done = 0; 2359 if (!done) 2360 { done = 1; 3014 SOAP_FMAC1 3015 void 3016 SOAP_FMAC2 3017 soap_ssl_init() 3018 { /* Note: for MT systems, the main program MUST call soap_ssl_init() before any threads are started */ 3019 if (!soap_ssl_init_done) 3020 { soap_ssl_init_done = 1; 2361 3021 SSL_library_init(); 2362 3022 #ifndef WITH_LEAN … … 2364 3024 #endif 2365 3025 if (!RAND_load_file("/dev/urandom", 1024)) 2366 { int r; 2367 #ifdef HAVE_RAND_R 2368 unsigned int s = (unsigned int)time(NULL); 2369 #endif 2370 char buf[SOAP_BUFLEN]; 3026 { char buf[1024]; 2371 3027 RAND_seed(buf, sizeof(buf)); 2372 3028 while (!RAND_status()) 2373 { 2374 #ifdef HAVE_RAND_R 2375 r = rand_r(&s); 2376 #else 2377 r = rand(); 2378 #endif 3029 { int r = rand(); 2379 3030 RAND_seed(&r, sizeof(int)); 2380 3031 } … … 2386 3037 /******************************************************************************/ 2387 3038 #ifndef PALM_1 2388 static const char * 2389 ssl_error(struct soap *soap, int ret) 3039 SOAP_FMAC1 3040 const char * 3041 SOAP_FMAC2 3042 soap_ssl_error(struct soap *soap, int ret) 2390 3043 { int err = SSL_get_error(soap->ssl, ret); 2391 const char *msg = soap_ str_code(h_ssl_error_codes, err);3044 const char *msg = soap_code_str(h_ssl_error_codes, err); 2392 3045 if (msg) 2393 3046 strcpy(soap->msgbuf, msg); … … 2420 3073 { if (num < (int)strlen((char*)userdata) + 1) 2421 3074 return 0; 2422 return strlen(strcpy(buf, (char*)userdata));3075 return (int)strlen(strcpy(buf, (char*)userdata)); 2423 3076 } 2424 3077 #endif … … 2458 3111 #endif 2459 3112 */ 3113 2460 3114 /******************************************************************************/ 2461 3115 #ifndef PALM_1 2462 3116 static int 2463 3117 ssl_auth_init(struct soap *soap) 2464 { ssl_init(); 3118 { long flags; 3119 int mode; 3120 if (!soap_ssl_init_done) 3121 soap_ssl_init(); 3122 ERR_clear_error(); 2465 3123 if (!soap->ctx) 2466 if (!(soap->ctx = SSL_CTX_new(SSLv23_method())))3124 { if (!(soap->ctx = SSL_CTX_new(SSLv23_method()))) 2467 3125 return soap_set_receiver_error(soap, "SSL error", "Can't setup context", SOAP_SSL_ERROR); 3126 /* Alters the behavior of SSL read/write: 3127 SSL_CTX_set_mode(soap->ctx, SSL_MODE_ENABLE_PARTIAL_WRITE | SSL_MODE_AUTO_RETRY); 3128 */ 3129 } 2468 3130 if (soap->randfile) 2469 3131 { if (!RAND_load_file(soap->randfile, -1)) … … 2471 3133 } 2472 3134 if (soap->cafile || soap->capath) 2473 if (!SSL_CTX_load_verify_locations(soap->ctx, soap->cafile, soap->capath)) 2474 return soap_set_receiver_error(soap, "SSL error", "Can't read CA file and/or directory", SOAP_SSL_ERROR); 3135 { if (!SSL_CTX_load_verify_locations(soap->ctx, soap->cafile, soap->capath)) 3136 return soap_set_receiver_error(soap, "SSL error", "Can't read CA file and directory", SOAP_SSL_ERROR); 3137 if (soap->cafile && (soap->ssl_flags & SOAP_SSL_REQUIRE_CLIENT_AUTHENTICATION)) 3138 SSL_CTX_set_client_CA_list(soap->ctx, SSL_load_client_CA_file(soap->cafile)); 3139 } 2475 3140 if (!SSL_CTX_set_default_verify_paths(soap->ctx)) 2476 3141 return soap_set_receiver_error(soap, "SSL error", "Can't read default CA file and/or directory", SOAP_SSL_ERROR); 3142 /* This code assumes a typical scenario, see alternative code below */ 2477 3143 if (soap->keyfile) 2478 3144 { if (!SSL_CTX_use_certificate_chain_file(soap->ctx, soap->keyfile)) … … 2481 3147 { SSL_CTX_set_default_passwd_cb_userdata(soap->ctx, (void*)soap->password); 2482 3148 SSL_CTX_set_default_passwd_cb(soap->ctx, ssl_password); 3149 } 3150 if (!SSL_CTX_use_PrivateKey_file(soap->ctx, soap->keyfile, SSL_FILETYPE_PEM)) 3151 return soap_set_receiver_error(soap, "SSL error", "Can't read key file", SOAP_SSL_ERROR); 3152 } 3153 /* Suggested alternative approach to check the key file for certs (cafile=NULL): 3154 if (soap->password) 3155 { SSL_CTX_set_default_passwd_cb_userdata(soap->ctx, (void*)soap->password); 3156 SSL_CTX_set_default_passwd_cb(soap->ctx, ssl_password); 3157 } 3158 if (!soap->cafile || !SSL_CTX_use_certificate_chain_file(soap->ctx, soap->cafile)) 3159 { if (soap->keyfile) 3160 { if (!SSL_CTX_use_certificate_chain_file(soap->ctx, soap->keyfile)) 3161 return soap_set_receiver_error(soap, "SSL error", "Can't read certificate or key file", SOAP_SSL_ERROR); 2483 3162 if (!SSL_CTX_use_PrivateKey_file(soap->ctx, soap->keyfile, SSL_FILETYPE_PEM)) 2484 3163 return soap_set_receiver_error(soap, "SSL error", "Can't read key file", SOAP_SSL_ERROR); 2485 3164 } 2486 3165 } 2487 if (soap->rsa) 2488 { RSA *rsa = RSA_generate_key(512, RSA_F4, NULL, NULL); 3166 */ 3167 if ((soap->ssl_flags & SOAP_SSL_RSA)) 3168 { RSA *rsa = RSA_generate_key(1024, RSA_F4, NULL, NULL); 2489 3169 if (!SSL_CTX_set_tmp_rsa(soap->ctx, rsa)) 2490 3170 { if (rsa) … … 2509 3189 DH_free(dh); 2510 3190 } 2511 SSL_CTX_set_options(soap->ctx, SSL_OP_ALL | SSL_OP_NO_SSLv2); 2512 SSL_CTX_set_verify(soap->ctx, soap->require_client_auth ? (SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT) : soap->require_server_auth ? SSL_VERIFY_PEER : SSL_VERIFY_NONE, soap->fsslverify); 3191 flags = (SSL_OP_ALL | SSL_OP_NO_SSLv2); 3192 if ((soap->ssl_flags & SOAP_SSLv3)) 3193 flags |= SSL_OP_NO_TLSv1; 3194 if ((soap->ssl_flags & SOAP_TLSv1)) 3195 flags |= SSL_OP_NO_SSLv3; 3196 SSL_CTX_set_options(soap->ctx, flags); 3197 if ((soap->ssl_flags & SOAP_SSL_REQUIRE_CLIENT_AUTHENTICATION)) 3198 mode = (SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT); 3199 else if ((soap->ssl_flags & SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION)) 3200 mode = SSL_VERIFY_PEER; 3201 else 3202 mode = SSL_VERIFY_NONE; 3203 SSL_CTX_set_verify(soap->ctx, mode, soap->fsslverify); 2513 3204 #if (OPENSSL_VERSION_NUMBER < 0x00905100L) 2514 3205 SSL_CTX_set_verify_depth(soap->ctx, 1); … … 2529 3220 { char data[256]; 2530 3221 X509 *cert = X509_STORE_CTX_get_current_cert(store); 2531 fprintf(stderr, "SSL Verify errorwith certificate at depth %d: %s\n", X509_STORE_CTX_get_error_depth(store), X509_verify_cert_error_string(X509_STORE_CTX_get_error(store)));3222 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))); 2532 3223 X509_NAME_oneline(X509_get_issuer_name(cert), data, sizeof(data)); 2533 3224 fprintf(stderr, "certificate issuer %s\n", data); … … 2536 3227 } 2537 3228 #endif 2538 /* return 1 to alwayscontinue, but unsafe progress will be terminated by SSL */3229 /* Note: return 1 to continue, but unsafe progress will be terminated by SSL */ 2539 3230 return ok; 2540 3231 } … … 2543 3234 /******************************************************************************/ 2544 3235 #ifndef PALM_1 3236 static int 3237 ssl_verify_callback_allow_expired_certificate(int ok, X509_STORE_CTX *store) 3238 { ok = ssl_verify_callback(ok, store); 3239 if (ok == 0 && X509_STORE_CTX_get_error(store) == X509_V_ERR_CERT_HAS_EXPIRED) 3240 { 3241 #ifdef SOAP_DEBUG 3242 fprintf(stderr, "ignoring certificate expiration\n"); 3243 #endif 3244 X509_STORE_CTX_set_error(store, X509_V_OK); 3245 ok = 1; 3246 } 3247 /* Note: return 1 to continue, but unsafe progress will be terminated by SSL */ 3248 return ok; 3249 } 3250 #endif 3251 3252 /******************************************************************************/ 3253 #ifndef PALM_1 2545 3254 SOAP_FMAC1 2546 3255 int 2547 3256 SOAP_FMAC2 2548 3257 soap_ssl_accept(struct soap *soap) 2549 { int i, r; 3258 { BIO *bio; 3259 int retries, r, s; 2550 3260 if (!soap_valid_socket(soap->socket)) 2551 3261 return soap_set_receiver_error(soap, "SSL error", "No socket in soap_ssl_accept()", SOAP_SSL_ERROR); 3262 if (!soap->ctx && (soap->error = soap->fsslauth(soap))) 3263 return SOAP_INVALID_SOCKET; 2552 3264 if (!soap->ssl) 2553 3265 { soap->ssl = SSL_new(soap->ctx); … … 2559 3271 soap->imode |= SOAP_ENC_SSL; 2560 3272 soap->omode |= SOAP_ENC_SSL; 2561 #ifdef WIN32 2562 { u_long nonblocking = 1; 2563 ioctlsocket((SOAP_SOCKET)soap->socket, FIONBIO, &nonblocking); 2564 } 2565 #else 2566 fcntl((SOAP_SOCKET)soap->socket, F_SETFL, fcntl((SOAP_SOCKET)soap->socket, F_GETFL)|O_NONBLOCK); 2567 #endif 2568 soap->bio = BIO_new_socket((SOAP_SOCKET)soap->socket, BIO_NOCLOSE); 2569 SSL_set_bio(soap->ssl, soap->bio, soap->bio); 2570 i = 100; /* 100 * 0.1 ms retries */ 3273 /* Set SSL sockets to non-blocking */ 3274 SOAP_SOCKNONBLOCK(soap->socket) 3275 bio = BIO_new_socket((int)soap->socket, BIO_NOCLOSE); 3276 SSL_set_bio(soap->ssl, bio, bio); 3277 retries = 100; /* 10 sec retries, 100 times 0.1 sec */ 2571 3278 while ((r = SSL_accept(soap->ssl)) <= 0) 2572 3279 { int err = SSL_get_error(soap->ssl, r); … … 2574 3281 { struct timeval timeout; 2575 3282 fd_set fd; 2576 if (i-- <= 0) 2577 break; 3283 #ifndef WIN32 3284 if ((int)soap->socket >= (int)FD_SETSIZE) 3285 return SOAP_FD_EXCEEDED; /* Hint: MUST increase FD_SETSIZE */ 3286 #endif 2578 3287 timeout.tv_sec = 0; 2579 3288 timeout.tv_usec = 100000; 2580 3289 FD_ZERO(&fd); 2581 FD_SET((SOAP_SOCKET)soap->socket, &fd); 2582 r = select((SOAP_SOCKET)(soap->socket + 1), &fd, NULL, &fd, &timeout); 2583 if (r < 0 && soap_socket_errno != SOAP_EINTR) 2584 { soap->errnum = soap_socket_errno; 2585 return SOAP_EOF; 3290 FD_SET(soap->socket, &fd); 3291 if (err == SSL_ERROR_WANT_READ) 3292 s = select((int)soap->socket + 1, &fd, NULL, &fd, &timeout); 3293 else 3294 s = select((int)soap->socket + 1, NULL, &fd, &fd, &timeout); 3295 if (s < 0 && (s = soap_socket_errno(soap->socket)) != SOAP_EINTR) 3296 { soap->errnum = s; 3297 break; 2586 3298 } 2587 3299 } … … 2590 3302 break; 2591 3303 } 2592 } 2593 #ifdef WIN32 2594 { u_long blocking = 0; 2595 ioctlsocket((SOAP_SOCKET)soap->socket, FIONBIO, &blocking); 2596 } 2597 #else 2598 fcntl((SOAP_SOCKET)soap->socket, F_SETFL, fcntl((SOAP_SOCKET)soap->socket, F_GETFL)&~O_NONBLOCK); 2599 #endif 3304 if (retries-- <= 0) 3305 break; 3306 } 2600 3307 if (r <= 0) 2601 { soap_set_receiver_error(soap, s sl_error(soap, r), "SSL_accept() failed in soap_ssl_accept()", SOAP_SSL_ERROR);3308 { soap_set_receiver_error(soap, soap_ssl_error(soap, r), "SSL_accept() failed in soap_ssl_accept()", SOAP_SSL_ERROR); 2602 3309 soap_closesock(soap); 2603 3310 return SOAP_SSL_ERROR; 2604 3311 } 2605 if ( soap->require_client_auth)3312 if ((soap->ssl_flags & SOAP_SSL_REQUIRE_CLIENT_AUTHENTICATION)) 2606 3313 { X509 *peer; 2607 3314 int err; … … 2625 3332 2626 3333 /******************************************************************************/ 3334 #ifndef WITH_NOIO 2627 3335 #ifndef PALM_1 2628 3336 static int … … 2642 3350 } 2643 3351 #endif 3352 #endif 2644 3353 2645 3354 /******************************************************************************/ … … 2653 3362 int i; 2654 3363 #endif 2655 soap_free(soap); 3364 if (soap_check_state(soap)) 3365 return; 3366 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Done with context\n")); 3367 soap_free_temp(soap); 2656 3368 while (soap->clist) 2657 3369 { struct soap_clist *p = soap->clist->next; 2658 SOAP_FREE(soap ->clist);3370 SOAP_FREE(soap, soap->clist); 2659 3371 soap->clist = p; 2660 3372 } … … 2667 3379 { register struct soap_plugin *p = soap->plugins->next; 2668 3380 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Removing plugin '%s'\n", soap->plugins->id)); 2669 if (soap->plugins->fcopy || !soap->copy)3381 if (soap->plugins->fcopy || soap->state == SOAP_INIT) 2670 3382 soap->plugins->fdelete(soap, soap->plugins); 2671 SOAP_FREE(soap ->plugins);3383 SOAP_FREE(soap, soap->plugins); 2672 3384 soap->plugins = p; 2673 3385 } 2674 3386 soap->fplugin = fplugin; 3387 soap->fmalloc = NULL; 3388 #ifndef WITH_NOHTTP 2675 3389 soap->fpost = http_post; 2676 3390 soap->fget = http_get; 3391 soap->fput = http_put; 3392 soap->fdel = http_del; 3393 soap->fhead = http_head; 3394 soap->fform = NULL; 2677 3395 soap->fposthdr = http_post_header; 2678 3396 soap->fresponse = http_response; 2679 3397 soap->fparse = http_parse; 2680 3398 soap->fparsehdr = http_parse_header; 2681 #ifndef MAC_CARBON 3399 #endif 3400 soap->fheader = NULL; 3401 #ifndef WITH_NOIO 2682 3402 #ifndef WITH_IPV6 2683 3403 soap->fresolve = tcp_gethost; … … 2694 3414 soap->fpoll = soap_poll; 2695 3415 #else 3416 soap->fopen = NULL; 3417 soap->fclose = NULL; 2696 3418 soap->fpoll = NULL; 2697 3419 #endif 3420 #ifndef WITH_LEANER 2698 3421 soap->fprepareinit = NULL; 2699 3422 soap->fpreparesend = NULL; 2700 3423 soap->fpreparerecv = NULL; 3424 soap->fpreparefinal = NULL; 3425 #endif 3426 soap->fseterror = NULL; 2701 3427 soap->fignore = NULL; 2702 3428 soap->fserveloop = NULL; … … 2707 3433 } 2708 3434 #endif 2709 if ( !soap->copy)3435 if (soap->state == SOAP_INIT) 2710 3436 { if (soap_valid_socket(soap->master)) 2711 { soap->fclosesocket(soap, (SOAP_SOCKET)soap->master);3437 { soap->fclosesocket(soap, soap->master); 2712 3438 soap->master = SOAP_INVALID_SOCKET; 2713 3439 } 3440 } 2714 3441 #ifdef WITH_OPENSSL 2715 if (soap->ctx) 3442 if (soap->ssl) 3443 { SSL_free(soap->ssl); 3444 soap->ssl = NULL; 3445 } 3446 if (soap->state == SOAP_INIT) 3447 { if (soap->ctx) 2716 3448 { SSL_CTX_free(soap->ctx); 2717 3449 soap->ctx = NULL; 2718 3450 } 2719 #endif 2720 } 3451 } 3452 #endif 3453 #ifdef WITH_OPENSSL 3454 ERR_remove_state(0); 3455 #endif 3456 #ifdef WITH_C_LOCALE 3457 freelocale(soap->c_locale); 3458 #endif 3459 #ifdef WITH_ZLIB 3460 if (soap->d_stream) 3461 { SOAP_FREE(soap, (void*)soap->d_stream); 3462 soap->d_stream = NULL; 3463 } 3464 if (soap->z_buf) 3465 { SOAP_FREE(soap, (void*)soap->z_buf); 3466 soap->z_buf = NULL; 3467 } 3468 #endif 2721 3469 #ifdef SOAP_DEBUG 3470 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free logfiles\n")); 2722 3471 for (i = 0; i < SOAP_MAXLOGS; i++) 2723 { soap_close_logfile(soap, i); 2724 if (soap->logfile[i]) 2725 { SOAP_FREE((void*)soap->logfile[i]); 3472 { if (soap->logfile[i]) 3473 { SOAP_FREE(soap, (void*)soap->logfile[i]); 2726 3474 soap->logfile[i] = NULL; 2727 3475 } 2728 } 2729 #endif 2730 } 2731 #endif 2732 2733 /******************************************************************************/ 3476 soap_close_logfile(soap, i); 3477 } 3478 soap->state = SOAP_NONE; 3479 #endif 3480 #ifdef SOAP_MEM_DEBUG 3481 soap_free_mht(soap); 3482 #endif 3483 } 3484 #endif 3485 3486 /******************************************************************************/ 3487 #ifndef WITH_NOIO 2734 3488 #ifndef PALM_2 2735 3489 SOAP_FMAC1 … … 2746 3500 } 2747 3501 #endif 2748 2749 /******************************************************************************/ 3502 #endif 3503 3504 /******************************************************************************/ 3505 #ifndef WITH_NOIO 2750 3506 #ifndef PALM_1 2751 3507 static const char* … … 2762 3518 { 2763 3519 #ifndef WITH_LEAN 2764 msg = soap_ str_code(h_error_codes, soap->errnum);3520 msg = soap_code_str(h_error_codes, soap->errnum); 2765 3521 if (!msg) 2766 3522 #endif 2767 { sprintf(soap->msgbuf, "TCP error %d", soap->errnum);3523 { sprintf(soap->msgbuf, "TCP/UDP IP error %d", soap->errnum); 2768 3524 msg = soap->msgbuf; 2769 3525 } … … 2773 3529 } 2774 3530 #endif 2775 2776 /******************************************************************************/ 3531 #endif 3532 3533 /******************************************************************************/ 3534 #ifndef WITH_NOHTTP 2777 3535 #ifndef PALM_1 2778 3536 static const char* 2779 3537 http_error(struct soap *soap, int status) 2780 { register const char *msg = NULL;3538 { register const char *msg = SOAP_STR_EOS; 2781 3539 #ifndef WITH_LEAN 2782 msg = soap_ str_code(h_http_error_codes, status);3540 msg = soap_code_str(h_http_error_codes, status); 2783 3541 if (!msg) 2784 #endif 2785 { sprintf(soap->msgbuf, "HTTP error %d", status); 2786 msg = soap->msgbuf; 2787 } 3542 msg = SOAP_STR_EOS; 3543 #endif 2788 3544 return msg; 2789 3545 } 2790 3546 #endif 2791 2792 /******************************************************************************/ 2793 /* WR[*/3547 #endif 3548 3549 /******************************************************************************/ 2794 3550 #ifndef WITH_IPV6 2795 /* ]WR */ 2796 #ifndef MAC_CARBON 3551 #ifndef WITH_NOIO 2797 3552 #ifndef PALM_1 2798 3553 static int 2799 3554 tcp_gethost(struct soap *soap, const char *addr, struct in_addr *inaddr) 2800 { unsigned long iadd;3555 { soap_int32 iadd = -1; 2801 3556 struct hostent hostent, *host = &hostent; 2802 /* WR[ */2803 3557 #ifdef VXWORKS 2804 3558 int hostint; 2805 char *addrcopy = (char*)malloc(strlen(addr) + 1); /*copy of addr. */2806 3559 /* inet_addr(), and hostGetByName() expect "char *"; addr is a "const char *". */ 2807 strncpy(addrcopy, addr, strlen(addr)+1); 2808 iadd = inet_addr(addrcopy); 3560 iadd = inet_addr((char*)addr); 2809 3561 #else 2810 /* ]WR */ 2811 #if defined(_AIXVERSION_431) || defined(TRU64) 3562 #if defined(_AIX43) || ((defined(TRU64) || defined(HP_UX)) && defined(HAVE_GETHOSTBYNAME_R)) 2812 3563 struct hostent_data ht_data; 2813 3564 #endif 3565 #ifdef AS400 3566 iadd = inet_addr((void*)addr); 3567 #else 2814 3568 iadd = inet_addr(addr); 2815 /* WR[ */ 2816 #endif 2817 /* ]WR */ 2818 if ((int)iadd != -1) 3569 #endif 3570 #endif 3571 if (iadd != -1) 2819 3572 { memcpy(inaddr, &iadd, sizeof(iadd)); 2820 /* WR[ */2821 #ifdef VXWORKS2822 free(addrcopy);2823 #endif2824 /* ]WR */2825 3573 return SOAP_OK; 2826 3574 } 2827 #if defined(__GLIBC__) 3575 #if defined(__GLIBC__) || (defined(HAVE_GETHOSTBYNAME_R) && (defined(FREEBSD) || defined(__FreeBSD__))) 2828 3576 if (gethostbyname_r(addr, &hostent, soap->buf, SOAP_BUFLEN, &host, &soap->errnum) < 0) 2829 3577 host = NULL; 2830 #elif defined(_AIX VERSION_431) || defined(TRU64)3578 #elif defined(_AIX43) || ((defined(TRU64) || defined(HP_UX)) && defined(HAVE_GETHOSTBYNAME_R)) 2831 3579 memset((void*)&ht_data, 0, sizeof(ht_data)); 2832 3580 if (gethostbyname_r(addr, &hostent, &ht_data) < 0) … … 2836 3584 #elif defined(HAVE_GETHOSTBYNAME_R) 2837 3585 host = gethostbyname_r(addr, &hostent, soap->buf, SOAP_BUFLEN, &soap->errnum); 2838 /* WR[ */2839 3586 #elif defined(VXWORKS) 2840 3587 /* If the DNS resolver library resolvLib has been configured in the vxWorks 2841 3588 * image, a query for the host IP address is sent to the DNS server, if the 2842 3589 * name was not found in the local host table. */ 2843 hostint = hostGetByName( addrcopy);3590 hostint = hostGetByName((char*)addr); 2844 3591 if (hostint == ERROR) 2845 3592 { host = NULL; 2846 3593 soap->errnum = soap_errno; 2847 3594 } 2848 free(addrcopy); /*free() is placed after the error checking to assure that 2849 * errno captured is that from hostGetByName() */ 2850 /* ]WR */ 3595 #else 3596 #ifdef AS400 3597 if (!(host = gethostbyname((void*)addr))) 3598 soap->errnum = h_errno; 2851 3599 #else 2852 3600 if (!(host = gethostbyname(addr))) 2853 3601 soap->errnum = h_errno; 2854 3602 #endif 3603 #endif 2855 3604 if (!host) 2856 3605 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Host name not found\n")); 2857 3606 return SOAP_ERR; 2858 3607 } 2859 /* WR[ */2860 3608 #ifdef VXWORKS 2861 3609 inaddr->s_addr = hostint; 2862 3610 #else 2863 /* ]WR */2864 3611 memcpy(inaddr, host->h_addr, host->h_length); 2865 /* WR[ */ 2866 #endif 2867 /* ]WR */ 3612 #endif 2868 3613 return SOAP_OK; 2869 3614 } 2870 3615 #endif 2871 3616 #endif 2872 /* WR[ */ 2873 #endif /* WITH_IPV6 */ 2874 /* ]WR */ 2875 2876 /******************************************************************************/ 2877 #ifndef MAC_CARBON 2878 #ifndef PALM_1 2879 static int 3617 #endif 3618 3619 /******************************************************************************/ 3620 #ifndef WITH_NOIO 3621 #ifndef PALM_1 3622 static SOAP_SOCKET 2880 3623 tcp_connect(struct soap *soap, const char *endpoint, const char *host, int port) 2881 { struct sockaddr_in sockaddr; 2882 /* WR[ */ 3624 { 2883 3625 #ifdef WITH_IPV6 2884 struct addrinfo *addrinfo; 2885 struct addrinfo hints; 2886 struct addrinfo resaddr; 2887 struct sockaddr_storage addrstorage; 2888 int err; 2889 #endif /* WITH_IPV6 */ 2890 /* ]WR */ 2891 register int fd; 3626 struct addrinfo hints, *res, *ressave; 3627 #endif 3628 SOAP_SOCKET fd; 3629 int err = 0; 2892 3630 #ifndef WITH_LEAN 3631 int retry = 10; 2893 3632 int len = SOAP_BUFLEN; 2894 3633 int set = 1; 2895 3634 #endif 2896 3635 if (soap_valid_socket(soap->socket)) 2897 soap->fclosesocket(soap, (SOAP_SOCKET)soap->socket);3636 soap->fclosesocket(soap, soap->socket); 2898 3637 soap->socket = SOAP_INVALID_SOCKET; 2899 3638 if (tcp_init(soap)) 2900 { soap_set_sender_error(soap, tcp_error(soap), "TCP initialization failed in tcp_connect()", SOAP_TCP_ERROR); 2901 return -1; 3639 { soap->errnum = 0; 3640 soap_set_sender_error(soap, tcp_error(soap), "TCP init failed in tcp_connect()", SOAP_TCP_ERROR); 3641 return SOAP_INVALID_SOCKET; 2902 3642 } 2903 3643 soap->errmode = 0; 2904 /* WR[ */2905 3644 #ifdef WITH_IPV6 2906 3645 memset((void*)&hints, 0, sizeof(hints)); 2907 3646 hints.ai_family = PF_UNSPEC; 2908 hints.ai_socktype = SOCK_STREAM; 3647 #ifndef WITH_LEAN 3648 if ((soap->omode & SOAP_IO_UDP)) 3649 hints.ai_socktype = SOCK_DGRAM; 3650 else 3651 #endif 3652 hints.ai_socktype = SOCK_STREAM; 2909 3653 soap->errmode = 2; 2910 3654 if (soap->proxy_host) 2911 err = getaddrinfo(soap->proxy_host, soap_int2s(soap, soap->proxy_port), &hints, & addrinfo);3655 err = getaddrinfo(soap->proxy_host, soap_int2s(soap, soap->proxy_port), &hints, &res); 2912 3656 else 2913 err = getaddrinfo(host, soap_int2s(soap, port), &hints, &addrinfo); 2914 if (addrinfo) 2915 { resaddr = *addrinfo; 2916 addrstorage = *((struct sockaddr_storage*)addrinfo->ai_addr); 2917 resaddr.ai_addr = (struct sockaddr*)&addrstorage; 2918 freeaddrinfo(addrinfo); 2919 } 3657 err = getaddrinfo(host, soap_int2s(soap, port), &hints, &res); 2920 3658 if (err) 2921 { soap_set_sender_error(soap, gai_strerror(err), 2922 "TCP getaddrinfo on proxy host failed in tcp_connect()", SOAP_TCP_ERROR); 2923 return -1; 2924 } 2925 fd = (int)socket(resaddr.ai_family, resaddr.ai_socktype, resaddr.ai_protocol); /* modified to use fd */ 3659 { soap_set_sender_error(soap, SOAP_GAI_STRERROR(err), "getaddrinfo failed in tcp_connect()", SOAP_TCP_ERROR); 3660 return SOAP_INVALID_SOCKET; 3661 } 3662 ressave = res; 3663 again: 3664 fd = socket(res->ai_family, res->ai_socktype, res->ai_protocol); 2926 3665 soap->errmode = 0; 2927 #else /* WITH_IPV6 */ 2928 /* ]WR */ 2929 fd = (int)socket(AF_INET, SOCK_STREAM, 0); 2930 /* WR[ */ 2931 #endif /* WITH_IPV6 */ 2932 /* ]WR */ 2933 if (fd < 0) 2934 { soap->errnum = soap_socket_errno; 2935 soap_set_sender_error(soap, tcp_error(soap), "TCP socket failed in tcp_connect()", SOAP_TCP_ERROR); 2936 return -1; 3666 #else 3667 #ifndef WITH_LEAN 3668 again: 3669 #endif 3670 #ifndef WITH_LEAN 3671 if ((soap->omode & SOAP_IO_UDP)) 3672 fd = socket(AF_INET, SOCK_DGRAM, 0); 3673 else 3674 #endif 3675 fd = socket(AF_INET, SOCK_STREAM, 0); 3676 #endif 3677 if (!soap_valid_socket(fd)) 3678 { 3679 #ifdef WITH_IPV6 3680 if (res->ai_next) 3681 { res = res->ai_next; 3682 goto again; 3683 } 3684 #endif 3685 soap->errnum = soap_socket_errno(fd); 3686 soap_set_sender_error(soap, tcp_error(soap), "socket failed in tcp_connect()", SOAP_TCP_ERROR); 3687 #ifdef WITH_IPV6 3688 freeaddrinfo(ressave); 3689 #endif 3690 return SOAP_INVALID_SOCKET; 2937 3691 } 2938 3692 #ifdef SOCKET_CLOSE_ON_EXEC … … 2942 3696 #endif 2943 3697 #else 2944 fcntl (fd, F_SETFD, 1);3698 fcntl(fd, F_SETFD, 1); 2945 3699 #endif 2946 3700 #endif 2947 3701 #ifndef WITH_LEAN 2948 if (soap->connect_flags &SO_LINGER)3702 if (soap->connect_flags == SO_LINGER) 2949 3703 { struct linger linger; 2950 3704 memset((void*)&linger, 0, sizeof(linger)); 2951 3705 linger.l_onoff = 1; 2952 linger.l_linger = 0; 2953 if (setsockopt((SOAP_SOCKET)fd, SOL_SOCKET, SO_LINGER, (char*)&linger, sizeof(struct linger))) 2954 { soap->errnum = soap_socket_errno; 2955 soap_set_sender_error(soap, tcp_error(soap), "TCP setsockopt SO_LINGER failed in tcp_connect()", SOAP_TCP_ERROR); 2956 soap->fclosesocket(soap, (SOAP_SOCKET)fd); 2957 return -1; 2958 } 2959 } 2960 if ((soap->connect_flags & ~SO_LINGER) && setsockopt((SOAP_SOCKET)fd, SOL_SOCKET, soap->connect_flags & ~SO_LINGER, (char*)&set, sizeof(int))) 2961 { soap->errnum = soap_socket_errno; 2962 soap_set_sender_error(soap, tcp_error(soap), "TCP setsockopt failed in tcp_connect()", SOAP_TCP_ERROR); 3706 linger.l_linger = soap->linger_time; 3707 if (setsockopt(fd, SOL_SOCKET, SO_LINGER, (char*)&linger, sizeof(struct linger))) 3708 { soap->errnum = soap_socket_errno(fd); 3709 soap_set_sender_error(soap, tcp_error(soap), "setsockopt SO_LINGER failed in tcp_connect()", SOAP_TCP_ERROR); 3710 soap->fclosesocket(soap, fd); 3711 #ifdef WITH_IPV6 3712 freeaddrinfo(ressave); 3713 #endif 3714 return SOAP_INVALID_SOCKET; 3715 } 3716 } 3717 else if (soap->connect_flags && setsockopt(fd, SOL_SOCKET, soap->connect_flags, (char*)&set, sizeof(int))) 3718 { soap->errnum = soap_socket_errno(fd); 3719 soap_set_sender_error(soap, tcp_error(soap), "setsockopt failed in tcp_connect()", SOAP_TCP_ERROR); 3720 soap->fclosesocket(soap, fd); 3721 #ifdef WITH_IPV6 3722 freeaddrinfo(ressave); 3723 #endif 3724 return SOAP_INVALID_SOCKET; 3725 } 3726 if ((soap->keep_alive || soap->tcp_keep_alive) && setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int))) 3727 { soap->errnum = soap_socket_errno(fd); 3728 soap_set_sender_error(soap, tcp_error(soap), "setsockopt SO_KEEPALIVE failed in tcp_connect()", SOAP_TCP_ERROR); 3729 soap->fclosesocket(soap, fd); 3730 #ifdef WITH_IPV6 3731 freeaddrinfo(ressave); 3732 #endif 3733 return SOAP_INVALID_SOCKET; 3734 } 3735 if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int))) 3736 { soap->errnum = soap_socket_errno(fd); 3737 soap_set_sender_error(soap, tcp_error(soap), "setsockopt SO_SNDBUF failed in tcp_connect()", SOAP_TCP_ERROR); 3738 soap->fclosesocket(soap, fd); 3739 #ifdef WITH_IPV6 3740 freeaddrinfo(ressave); 3741 #endif 3742 return SOAP_INVALID_SOCKET; 3743 } 3744 if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) 3745 { soap->errnum = soap_socket_errno(fd); 3746 soap_set_sender_error(soap, tcp_error(soap), "setsockopt SO_RCVBUF failed in tcp_connect()", SOAP_TCP_ERROR); 3747 soap->fclosesocket(soap, fd); 3748 #ifdef WITH_IPV6 3749 freeaddrinfo(ressave); 3750 #endif 3751 return SOAP_INVALID_SOCKET; 3752 } 3753 #ifdef TCP_KEEPIDLE 3754 if (soap->tcp_keep_idle && setsockopt((SOAP_SOCKET)fd, IPPROTO_TCP, TCP_KEEPIDLE, (unsigned int*)&(soap->tcp_keep_idle), sizeof(int))) 3755 { soap->errnum = soap_socket_errno(fd); 3756 soap_set_sender_error(soap, tcp_error(soap), "setsockopt TCP_KEEPIDLE failed in tcp_connect()", SOAP_TCP_ERROR); 2963 3757 soap->fclosesocket(soap, (SOAP_SOCKET)fd); 2964 return -1; 2965 } 2966 if (soap->keep_alive && setsockopt((SOAP_SOCKET)fd, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int))) 2967 { soap->errnum = soap_socket_errno; 2968 soap_set_sender_error(soap, tcp_error(soap), "TCP setsockopt SO_KEEPALIVE failed in tcp_connect()", SOAP_TCP_ERROR); 3758 #ifdef WITH_IPV6 3759 freeaddrinfo(ressave); 3760 #endif 3761 return SOAP_INVALID_SOCKET; 3762 } 3763 #endif 3764 #ifdef TCP_KEEPINTVL 3765 if (soap->tcp_keep_intvl && setsockopt((SOAP_SOCKET)fd, IPPROTO_TCP, TCP_KEEPINTVL, (unsigned int*)&(soap->tcp_keep_intvl), sizeof(int))) 3766 { soap->errnum = soap_socket_errno(fd); 3767 soap_set_sender_error(soap, tcp_error(soap), "setsockopt TCP_KEEPINTVL failed in tcp_connect()", SOAP_TCP_ERROR); 2969 3768 soap->fclosesocket(soap, (SOAP_SOCKET)fd); 2970 return -1; 2971 } 2972 if (setsockopt((SOAP_SOCKET)fd, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int))) 2973 { soap->errnum = soap_socket_errno; 2974 soap_set_sender_error(soap, tcp_error(soap), "TCP setsockopt SO_SNDBUF failed in tcp_connect()", SOAP_TCP_ERROR); 3769 #ifdef WITH_IPV6 3770 freeaddrinfo(ressave); 3771 #endif 3772 return SOAP_INVALID_SOCKET; 3773 } 3774 #endif 3775 #ifdef TCP_KEEPCNT 3776 if (soap->tcp_keep_cnt && setsockopt((SOAP_SOCKET)fd, IPPROTO_TCP, TCP_KEEPCNT, (unsigned int*)&(soap->tcp_keep_cnt), sizeof(int))) 3777 { soap->errnum = soap_socket_errno(fd); 3778 soap_set_sender_error(soap, tcp_error(soap), "setsockopt TCP_KEEPCNT failed in tcp_connect()", SOAP_TCP_ERROR); 2975 3779 soap->fclosesocket(soap, (SOAP_SOCKET)fd); 2976 return -1; 2977 } 2978 if (setsockopt((SOAP_SOCKET)fd, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) 2979 { soap->errnum = soap_socket_errno; 2980 soap_set_sender_error(soap, tcp_error(soap), "TCP setsockopt SO_RCVBUF failed in tcp_connect()", SOAP_TCP_ERROR); 2981 soap->fclosesocket(soap, (SOAP_SOCKET)fd); 2982 return -1; 2983 } 3780 #ifdef WITH_IPV6 3781 freeaddrinfo(ressave); 3782 #endif 3783 return SOAP_INVALID_SOCKET; 3784 } 3785 #endif 2984 3786 #ifdef TCP_NODELAY 2985 if (setsockopt((SOAP_SOCKET)fd, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int))) 2986 { soap->errnum = soap_socket_errno; 2987 soap_set_sender_error(soap, tcp_error(soap), "TCP setsockopt TCP_NODELAY failed in tcp_connect()", SOAP_TCP_ERROR); 2988 soap->fclosesocket(soap, (SOAP_SOCKET)fd); 2989 return -1; 2990 } 2991 #endif 2992 #endif 2993 /* WR[ */ 3787 if (!(soap->omode & SOAP_IO_UDP) && setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int))) 3788 { soap->errnum = soap_socket_errno(fd); 3789 soap_set_sender_error(soap, tcp_error(soap), "setsockopt TCP_NODELAY failed in tcp_connect()", SOAP_TCP_ERROR); 3790 soap->fclosesocket(soap, fd); 3791 #ifdef WITH_IPV6 3792 freeaddrinfo(ressave); 3793 #endif 3794 return SOAP_INVALID_SOCKET; 3795 } 3796 #endif 3797 #ifdef WITH_IPV6 3798 if ((soap->omode & SOAP_IO_UDP) && soap->ipv6_multicast_if) 3799 { struct sockaddr_in6 *in6addr = (struct sockaddr_in6*)res->ai_addr; 3800 in6addr->sin6_scope_id = soap->ipv6_multicast_if; 3801 } 3802 #else 3803 if ((soap->omode & SOAP_IO_UDP) && soap->ipv4_multicast_if) 3804 { if (soap->ipv4_multicast_ttl > 0) 3805 { char ttl = (char)(soap->ipv4_multicast_ttl); 3806 if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl))) 3807 { soap->errnum = soap_socket_errno(fd); 3808 soap_set_sender_error(soap, tcp_error(soap), "setsockopt IP_MULTICAST_TTL failed in tcp_connect()", SOAP_TCP_ERROR); 3809 soap->fclosesocket(soap, fd); 3810 return SOAP_INVALID_SOCKET; 3811 } 3812 } 3813 #ifndef WINDOWS 3814 if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF, soap->ipv4_multicast_if, sizeof(struct in_addr))) 3815 { soap->errnum = soap_socket_errno(fd); 3816 soap_set_sender_error(soap, tcp_error(soap), "setsockopt IP_MULTICAST_IF failed in tcp_connect()", SOAP_TCP_ERROR); 3817 soap->fclosesocket(soap, fd); 3818 return SOAP_INVALID_SOCKET; 3819 } 3820 #else 3821 #ifndef IP_MULTICAST_IF 3822 #define IP_MULTICAST_IF 2 3823 #endif 3824 if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF, soap->ipv4_multicast_if, sizeof(struct in_addr))) 3825 { soap->errnum = soap_socket_errno(fd); 3826 soap_set_sender_error(soap, tcp_error(soap), "setsockopt IP_MULTICAST_IF failed in tcp_connect()", SOAP_TCP_ERROR); 3827 soap->fclosesocket(soap, fd); 3828 return SOAP_INVALID_SOCKET; 3829 } 3830 #endif 3831 } 3832 #endif 3833 #endif 3834 DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Opening socket %d to host='%s' port=%d\n", fd, host, port)); 2994 3835 #ifndef WITH_IPV6 2995 /* ]WR */ 2996 memset((void*)&sockaddr, 0, sizeof(sockaddr)); 2997 sockaddr.sin_family = AF_INET; 2998 DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Open socket %d to host='%s'\n", fd, host)); 3836 soap->peerlen = sizeof(soap->peer); 3837 memset((void*)&soap->peer, 0, sizeof(soap->peer)); 3838 soap->peer.sin_family = AF_INET; 2999 3839 soap->errmode = 2; 3000 3840 if (soap->proxy_host) 3001 { if (soap->fresolve(soap, soap->proxy_host, &sockaddr.sin_addr)) 3002 { soap_set_sender_error(soap, tcp_error(soap), "TCP get proxy host by name failed in tcp_connect()", SOAP_TCP_ERROR); 3003 soap->fclosesocket(soap, (SOAP_SOCKET)fd); 3004 return -1; 3005 } 3006 sockaddr.sin_port = htons((short)soap->proxy_port); 3841 { if (soap->fresolve(soap, soap->proxy_host, &soap->peer.sin_addr)) 3842 { soap_set_sender_error(soap, tcp_error(soap), "get proxy host by name failed in tcp_connect()", SOAP_TCP_ERROR); 3843 soap->fclosesocket(soap, fd); 3844 #ifdef WITH_IPV6 3845 freeaddrinfo(ressave); 3846 #endif 3847 return SOAP_INVALID_SOCKET; 3848 } 3849 soap->peer.sin_port = htons((short)soap->proxy_port); 3007 3850 } 3008 3851 else 3009 { if (soap->fresolve(soap, host, &sockaddr.sin_addr)) 3010 { soap_set_sender_error(soap, tcp_error(soap), "TCP get host by name failed in tcp_connect()", SOAP_TCP_ERROR); 3011 soap->fclosesocket(soap, (SOAP_SOCKET)fd); 3012 return -1; 3013 } 3014 sockaddr.sin_port = htons((short)port); 3852 { if (soap->fresolve(soap, host, &soap->peer.sin_addr)) 3853 { soap_set_sender_error(soap, tcp_error(soap), "get host by name failed in tcp_connect()", SOAP_TCP_ERROR); 3854 soap->fclosesocket(soap, fd); 3855 #ifdef WITH_IPV6 3856 freeaddrinfo(ressave); 3857 #endif 3858 return SOAP_INVALID_SOCKET; 3859 } 3860 soap->peer.sin_port = htons((short)port); 3015 3861 } 3016 3862 soap->errmode = 0; 3017 /* WR[ */ 3018 #endif /* WITH_IPV6 */ 3019 /* ]WR */ 3863 #ifndef WITH_LEAN 3864 if ((soap->omode & SOAP_IO_UDP)) 3865 { 3866 #ifdef WITH_IPV6 3867 freeaddrinfo(ressave); 3868 #endif 3869 return fd; 3870 } 3871 #endif 3872 #endif 3020 3873 #ifndef WITH_LEAN 3021 3874 if (soap->connect_timeout) 3022 #if defined(WIN32) 3023 { u_long nonblocking = 1; 3024 ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &nonblocking); 3025 } 3026 /* WR[ */ 3027 #elif defined(VXWORKS) 3028 { vx_nonblocking = TRUE; 3029 ioctl((SOAP_SOCKET)fd, FIONBIO, (int)(&vx_nonblocking)); /* modified to use fd */ 3030 } 3031 /* ]WR */ 3032 #else 3033 fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)|O_NONBLOCK); 3034 #endif 3875 SOAP_SOCKNONBLOCK(fd) 3035 3876 else 3036 #if defined(WIN32) 3037 { u_long blocking = 0; 3038 ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &blocking); 3039 } 3040 /* WR[ */ 3041 #elif defined(VXWORKS) 3042 { vx_nonblocking = FALSE; 3043 ioctl((SOAP_SOCKET)fd, FIONBIO, (int)(&vx_nonblocking)); /* modified to use fd */ 3044 } 3045 /* ]WR */ 3046 #else 3047 fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)&~O_NONBLOCK); 3048 #endif 3877 SOAP_SOCKBLOCK(fd) 3049 3878 #endif 3050 3879 for (;;) 3051 3880 { 3052 /* WR[ */3053 3881 #ifdef WITH_IPV6 3054 if (connect((SOAP_SOCKET)fd, resaddr.ai_addr, resaddr.ai_addrlen)) /* modified to use fd */ 3055 #else /* WITH_IPV6 */ 3056 if (connect((SOAP_SOCKET)fd, (struct sockaddr*)&sockaddr, sizeof(sockaddr))) 3057 #endif /* WITH_IPV6 */ 3058 /* ]WR */ 3059 { 3882 if (connect(fd, res->ai_addr, (int)res->ai_addrlen)) 3883 #else 3884 if (connect(fd, (struct sockaddr*)&soap->peer, sizeof(soap->peer))) 3885 #endif 3886 { err = soap_socket_errno(fd); 3060 3887 #ifndef WITH_LEAN 3061 if ( soap->connect_timeout && (soap_socket_errno == SOAP_EINPROGRESS || soap_socket_errno == SOAP_EWOULDBLOCK))3062 { s truct timeval timeout;3063 #if defined(SOCKLEN_T)3064 SOCKLEN_T n = sizeof(struct sockaddr_in);3065 #elif defined(__socklen_t_defined) || defined(_SOCKLEN_T) || defined(CYGWIN) 3066 socklen_t n = sizeof(struct sockaddr_in);3067 #elif defined(WIN32) || defined(__APPLE__) || defined(HP_UX) || defined(SUN_OS) || defined(OPENSERVER) || defined(TRU64) || defined(VXWORKS) 3068 int n = sizeof(struct sockaddr_in);3069 # else3070 size_t n = sizeof(struct sockaddr_in);3071 #endif 3072 fd_set fds; 3073 if (soap->connect_timeout > 0)3074 { timeout.tv_sec = soap->connect_timeout; 3075 timeout.tv_usec = 0;3888 if (err == SOAP_EADDRINUSE) 3889 { soap->fclosesocket(soap, fd); 3890 if (retry-- > 0) 3891 goto again; 3892 } 3893 else if (soap->connect_timeout && (err == SOAP_EINPROGRESS || err == SOAP_EAGAIN || err == SOAP_EWOULDBLOCK)) 3894 { 3895 SOAP_SOCKLEN_T k; 3896 #ifndef WIN32 3897 if ((int)soap->socket >= (int)FD_SETSIZE) 3898 { soap->error = SOAP_FD_EXCEEDED; 3899 #ifdef WITH_IPV6 3900 freeaddrinfo(ressave); 3901 #endif 3902 return SOAP_INVALID_SOCKET; /* Hint: MUST increase FD_SETSIZE */ 3076 3903 } 3077 else 3078 { timeout.tv_sec = -soap->connect_timeout/1000000; 3079 timeout.tv_usec = -soap->connect_timeout%1000000; 3080 } 3081 FD_ZERO(&fds); 3082 FD_SET((SOAP_SOCKET)fd, &fds); 3904 #endif 3083 3905 for (;;) 3084 { int r = select((SOAP_SOCKET)(fd + 1), NULL, &fds, NULL, &timeout);3085 if (r > 0)3086 break;3087 if (!r)3088 { soap->errnum = 0;3089 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Connect timeout\n"));3090 soap_set_sender_error(soap, "Timeout", "TCP connect failed in tcp_connect()", SOAP_TCP_ERROR);3091 soap->fclosesocket(soap, (SOAP_SOCKET)fd);3092 return -1;3093 }3094 if (soap_socket_errno != SOAP_EINTR)3095 { soap->errnum = soap_socket_errno;3096 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not connect to host\n"));3097 soap_set_sender_error(soap, tcp_error(soap), "TCP connect failed in tcp_connect()", SOAP_TCP_ERROR);3098 soap->fclosesocket(soap, (SOAP_SOCKET)fd);3099 return -1;3100 }3101 }3102 n = sizeof(soap->errnum);3103 if (!getsockopt((SOAP_SOCKET)fd, SOL_SOCKET, SO_ERROR, (char*)&soap->errnum, &n) && !soap->errnum)3104 break;3105 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not connect to host\n"));3106 soap_set_sender_error(soap, tcp_error(soap), "TCP connect failed in tcp_connect()", SOAP_TCP_ERROR);3107 soap->fclosesocket(soap, (SOAP_SOCKET)fd);3108 return -1;3109 }3110 else3111 #endif3112 if (soap_socket_errno != SOAP_EINTR)3113 { soap->errnum = soap_socket_errno;3114 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not connect to host\n"));3115 soap_set_sender_error(soap, tcp_error(soap), "TCP connect failed in tcp_connect()", SOAP_TCP_ERROR);3116 soap->fclosesocket(soap, (SOAP_SOCKET)fd);3117 return -1;3118 }3119 }3120 else3121 break;3122 }3123 #ifndef WITH_LEAN3124 if (soap->connect_timeout)3125 #if defined(WIN32)3126 { u_long blocking = 0;3127 ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &blocking);3128 }3129 /* WR[ */3130 #elif defined(VXWORKS)3131 { vx_nonblocking = FALSE;3132 ioctl((SOAP_SOCKET)fd, FIONBIO, (int)(&vx_nonblocking)); /* modified to use fd */3133 }3134 /* ]WR */3135 #else3136 fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)&~O_NONBLOCK);3137 #endif3138 #endif3139 soap->socket = fd;3140 #ifdef WITH_OPENSSL3141 soap->imode &= ~SOAP_ENC_SSL;3142 soap->omode &= ~SOAP_ENC_SSL;3143 if (!strncmp(endpoint, "https:", 6))3144 { int r;3145 if (soap->proxy_host)3146 { unsigned int k = soap->omode; /* make sure we only parse HTTP */3147 size_t n = soap->count; /* save the content length */3148 soap->omode &= ~0xFF; /* mask IO and ENC */3149 soap->omode |= SOAP_IO_BUFFER;3150 soap_begin_send(soap);3151 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Connecting to proxy server\n"));3152 sprintf(soap->tmpbuf, "CONNECT %s:%d HTTP/%s", host, port, soap->http_version);3153 if ((soap->error = soap->fposthdr(soap, soap->tmpbuf, NULL)))3154 return -1;3155 #ifndef WITH_LEAN3156 if (soap->proxy_userid && soap->proxy_passwd && strlen(soap->proxy_userid) + strlen(soap->proxy_passwd) < 761)3157 { sprintf(soap->tmpbuf + 262, "%s:%s", soap->proxy_userid, soap->proxy_passwd);3158 strcpy(soap->tmpbuf, "Basic ");3159 soap_s2base64(soap, (const unsigned char*)(soap->tmpbuf + 262), soap->tmpbuf + 6, strlen(soap->tmpbuf + 262));3160 if ((soap->error = soap->fposthdr(soap, "Proxy-Authorization", soap->tmpbuf)))3161 return soap->error;3162 }3163 #endif3164 if ((soap->error = soap->fposthdr(soap, NULL, NULL))3165 || soap_flush(soap))3166 return -1;3167 soap->omode = k;3168 k = soap->imode;3169 soap->imode &= ~0xFF; /* mask IO and ENC */3170 if (soap_begin_recv(soap))3171 return -1;3172 soap->imode = k;3173 soap->count = n;3174 soap_begin_send(soap);3175 }3176 if (!soap->ctx && (soap->error = soap->fsslauth(soap)))3177 { soap_set_sender_error(soap, "SSL error", "SSL authentication failed in tcp_connect(): check password, key file, and ca file.", SOAP_SSL_ERROR);3178 return -1;3179 }3180 soap->ssl = SSL_new(soap->ctx);3181 if (!soap->ssl)3182 { soap->error = SOAP_SSL_ERROR;3183 return -1;3184 }3185 if (soap->session)3186 { if (!strcmp(soap->session_host, host) && soap->session_port == port)3187 SSL_set_session(soap->ssl, soap->session);3188 SSL_SESSION_free(soap->session);3189 soap->session = NULL;3190 }3191 soap->imode |= SOAP_ENC_SSL;3192 soap->omode |= SOAP_ENC_SSL;3193 soap->bio = BIO_new_socket((SOAP_SOCKET)fd, BIO_NOCLOSE);3194 SSL_set_bio(soap->ssl, soap->bio, soap->bio);3195 #ifndef WITH_LEAN3196 if (soap->connect_timeout)3197 #ifdef WIN323198 { u_long nonblocking = 1;3199 ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &nonblocking);3200 }3201 #else3202 fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)|O_NONBLOCK);3203 #endif3204 #endif3205 for (;;)3206 { if ((r = SSL_connect(soap->ssl)) <= 0)3207 { int err = SSL_get_error(soap->ssl, r);3208 if (err != SSL_ERROR_NONE && err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE)3209 { soap_set_sender_error(soap, ssl_error(soap, r), "SSL connect failed in tcp_connect()", SOAP_SSL_ERROR);3210 return -1;3211 }3212 if (soap->connect_timeout)3213 3906 { struct timeval timeout; 3214 3907 fd_set fds; 3908 register int r; 3215 3909 if (soap->connect_timeout > 0) 3216 3910 { timeout.tv_sec = soap->connect_timeout; … … 3222 3916 } 3223 3917 FD_ZERO(&fds); 3224 FD_SET((SOAP_SOCKET)(soap->socket), &fds); 3918 FD_SET(fd, &fds); 3919 r = select((int)fd + 1, NULL, &fds, NULL, &timeout); 3920 if (r > 0) 3921 break; 3922 if (!r) 3923 { soap->errnum = 0; 3924 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Connect timeout\n")); 3925 soap_set_sender_error(soap, "Timeout", "connect failed in tcp_connect()", SOAP_TCP_ERROR); 3926 soap->fclosesocket(soap, fd); 3927 #ifdef WITH_IPV6 3928 freeaddrinfo(ressave); 3929 #endif 3930 return SOAP_INVALID_SOCKET; 3931 } 3932 r = soap_socket_errno(fd); 3933 if (r != SOAP_EINTR) 3934 { soap->errnum = r; 3935 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not connect to host\n")); 3936 soap_set_sender_error(soap, tcp_error(soap), "connect failed in tcp_connect()", SOAP_TCP_ERROR); 3937 soap->fclosesocket(soap, fd); 3938 #ifdef WITH_IPV6 3939 freeaddrinfo(ressave); 3940 #endif 3941 return SOAP_INVALID_SOCKET; 3942 } 3943 } 3944 k = (SOAP_SOCKLEN_T)sizeof(soap->errnum); 3945 if (!getsockopt(fd, SOL_SOCKET, SO_ERROR, (char*)&soap->errnum, &k) && !soap->errnum) /* portability note: see SOAP_SOCKLEN_T definition in stdsoap2.h */ 3946 break; 3947 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not connect to host\n")); 3948 if (!soap->errnum) 3949 soap->errnum = soap_socket_errno(fd); 3950 soap_set_sender_error(soap, tcp_error(soap), "connect failed in tcp_connect()", SOAP_TCP_ERROR); 3951 soap->fclosesocket(soap, fd); 3952 #ifdef WITH_IPV6 3953 freeaddrinfo(ressave); 3954 #endif 3955 return SOAP_INVALID_SOCKET; 3956 } 3957 #endif 3958 #ifdef WITH_IPV6 3959 if (res->ai_next) 3960 { res = res->ai_next; 3961 soap->fclosesocket(soap, fd); 3962 goto again; 3963 } 3964 #endif 3965 if (err && err != SOAP_EINTR) 3966 { soap->errnum = err; 3967 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not connect to host\n")); 3968 soap_set_sender_error(soap, tcp_error(soap), "connect failed in tcp_connect()", SOAP_TCP_ERROR); 3969 soap->fclosesocket(soap, fd); 3970 #ifdef WITH_IPV6 3971 freeaddrinfo(ressave); 3972 #endif 3973 return SOAP_INVALID_SOCKET; 3974 } 3975 } 3976 else 3977 break; 3978 } 3979 #ifdef WITH_IPV6 3980 soap->peerlen = 0; /* IPv6: already connected so use send() */ 3981 freeaddrinfo(ressave); 3982 #endif 3983 #ifndef WITH_LEAN 3984 if (soap->recv_timeout || soap->send_timeout) 3985 SOAP_SOCKNONBLOCK(fd) 3986 else 3987 SOAP_SOCKBLOCK(fd) 3988 #endif 3989 soap->socket = fd; 3990 soap->imode &= ~SOAP_ENC_SSL; 3991 soap->omode &= ~SOAP_ENC_SSL; 3992 if (!soap_tag_cmp(endpoint, "https:*")) 3993 { 3994 #ifdef WITH_OPENSSL 3995 BIO *bio; 3996 int r; 3997 if (soap->proxy_host) 3998 { soap_mode m = soap->omode; /* make sure we only parse HTTP */ 3999 size_t n = soap->count; /* save the content length */ 4000 char *userid, *passwd; 4001 soap->omode &= ~SOAP_ENC; /* mask IO and ENC */ 4002 soap->omode |= SOAP_IO_BUFFER; 4003 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Connecting to %s proxy server\n", soap->proxy_http_version)); 4004 sprintf(soap->tmpbuf, "CONNECT %s:%d HTTP/%s", host, port, soap->proxy_http_version); 4005 if (soap_begin_send(soap) 4006 || (soap->error = soap->fposthdr(soap, soap->tmpbuf, NULL))) 4007 { soap->fclosesocket(soap, fd); 4008 return SOAP_INVALID_SOCKET; 4009 } 4010 #ifndef WITH_LEAN 4011 if (soap->proxy_userid && soap->proxy_passwd && strlen(soap->proxy_userid) + strlen(soap->proxy_passwd) < 761) 4012 { sprintf(soap->tmpbuf + 262, "%s:%s", soap->proxy_userid, soap->proxy_passwd); 4013 strcpy(soap->tmpbuf, "Basic "); 4014 soap_s2base64(soap, (const unsigned char*)(soap->tmpbuf + 262), soap->tmpbuf + 6, (int)strlen(soap->tmpbuf + 262)); 4015 if ((soap->error = soap->fposthdr(soap, "Proxy-Authorization", soap->tmpbuf))) 4016 { soap->fclosesocket(soap, fd); 4017 return soap->error; 4018 } 4019 } 4020 #endif 4021 if ((soap->error = soap->fposthdr(soap, NULL, NULL)) 4022 || soap_flush(soap)) 4023 { soap->fclosesocket(soap, fd); 4024 return SOAP_INVALID_SOCKET; 4025 } 4026 soap->omode = m; 4027 m = soap->imode; 4028 soap->imode &= ~SOAP_ENC; /* mask IO and ENC */ 4029 userid = soap->userid; /* preserve */ 4030 passwd = soap->passwd; /* preserve */ 4031 if ((soap->error = soap->fparse(soap))) 4032 { soap->fclosesocket(soap, fd); 4033 return SOAP_INVALID_SOCKET; 4034 } 4035 soap->userid = userid; /* restore */ 4036 soap->passwd = passwd; /* restore */ 4037 soap->imode = m; /* restore */ 4038 soap->count = n; /* restore */ 4039 if (soap_begin_send(soap)) 4040 { soap->fclosesocket(soap, fd); 4041 return SOAP_INVALID_SOCKET; 4042 } 4043 if (endpoint) 4044 strncpy(soap->endpoint, endpoint, sizeof(soap->endpoint)-1); /* restore */ 4045 } 4046 if (!soap->ctx && (soap->error = soap->fsslauth(soap))) 4047 { soap_set_sender_error(soap, "SSL error", "SSL authentication failed in tcp_connect(): check password, key file, and ca file.", SOAP_SSL_ERROR); 4048 soap->fclosesocket(soap, fd); 4049 return SOAP_INVALID_SOCKET; 4050 } 4051 if (!soap->ssl) 4052 { soap->ssl = SSL_new(soap->ctx); 4053 if (!soap->ssl) 4054 { soap->fclosesocket(soap, fd); 4055 soap->error = SOAP_SSL_ERROR; 4056 return SOAP_INVALID_SOCKET; 4057 } 4058 } 4059 else 4060 SSL_clear(soap->ssl); 4061 if (soap->session) 4062 { if (!strcmp(soap->session_host, host) && soap->session_port == port) 4063 SSL_set_session(soap->ssl, soap->session); 4064 SSL_SESSION_free(soap->session); 4065 soap->session = NULL; 4066 } 4067 soap->imode |= SOAP_ENC_SSL; 4068 soap->omode |= SOAP_ENC_SSL; 4069 bio = BIO_new_socket((int)fd, BIO_NOCLOSE); 4070 SSL_set_bio(soap->ssl, bio, bio); 4071 #ifndef WITH_LEAN 4072 /* Connect timeout: set SSL sockets to non-blocking */ 4073 if (soap->connect_timeout) 4074 SOAP_SOCKNONBLOCK(fd) 4075 else 4076 SOAP_SOCKBLOCK(fd) 4077 /* Try connecting until success or timeout */ 4078 do 4079 { if ((r = SSL_connect(soap->ssl)) <= 0) 4080 { int err; 4081 if ((err = SSL_get_error(soap->ssl, r)) == SSL_ERROR_NONE) 4082 break; 4083 if (err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE) 4084 { soap_set_sender_error(soap, soap_ssl_error(soap, r), "SSL connect failed in tcp_connect()", SOAP_SSL_ERROR); 4085 soap->fclosesocket(soap, fd); 4086 return SOAP_INVALID_SOCKET; 4087 } 4088 if (soap->connect_timeout) 4089 { 4090 #ifndef WIN32 4091 if ((int)soap->socket >= (int)FD_SETSIZE) 4092 { soap->error = SOAP_FD_EXCEEDED; 4093 return SOAP_INVALID_SOCKET; /* Hint: MUST increase FD_SETSIZE */ 4094 } 4095 #endif 3225 4096 for (;;) 3226 { int r = select((SOAP_SOCKET)(soap->socket + 1), &fds, NULL, &fds, &timeout); 3227 if (r > 0) 4097 { struct timeval timeout; 4098 fd_set fds; 4099 register int r; 4100 if (soap->connect_timeout > 0) 4101 { timeout.tv_sec = soap->connect_timeout; 4102 timeout.tv_usec = 0; 4103 } 4104 else 4105 { timeout.tv_sec = -soap->connect_timeout/1000000; 4106 timeout.tv_usec = -soap->connect_timeout%1000000; 4107 } 4108 FD_ZERO(&fds); 4109 FD_SET(fd, &fds); 4110 if (err == SSL_ERROR_WANT_READ) 4111 r = select((int)fd + 1, &fds, NULL, NULL, &timeout); 4112 else 4113 r = select((int)fd + 1, NULL, &fds, NULL, &timeout); 4114 if (r >= 1) 4115 { r = 1; 3228 4116 break; 3229 if (!r) 4117 } 4118 else 3230 4119 { soap->errnum = 0; 3231 4120 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Connect timeout\n")); 3232 soap_set_sender_error(soap, "Timeout", "TCP connect failed in tcp_connect()", SOAP_TCP_ERROR); 3233 return -1; 4121 soap_set_sender_error(soap, "Timeout", "connect failed in tcp_connect()", SOAP_TCP_ERROR); 4122 soap->fclosesocket(soap, fd); 4123 return SOAP_INVALID_SOCKET; 3234 4124 } 3235 4125 } 3236 continue;4126 continue; 3237 4127 } 3238 4128 } 3239 4129 break; 3240 } 3241 #ifndef WITH_LEAN 3242 if (soap->connect_timeout) 3243 #ifdef WIN32 3244 { u_long blocking = 0; 3245 ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &blocking); 3246 } 3247 #else 3248 fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)&~O_NONBLOCK); 3249 #endif 3250 #endif 3251 if (soap->require_server_auth) 3252 { X509 *peer; 3253 int err; 4130 } while (r == 1 && !SSL_is_init_finished(soap->ssl)); 4131 /* Set SSL sockets to nonblocking */ 4132 SOAP_SOCKNONBLOCK(fd) 4133 #endif 4134 /* Check server credentials when required */ 4135 if ((soap->ssl_flags & SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION)) 4136 { int err; 3254 4137 if ((err = SSL_get_verify_result(soap->ssl)) != X509_V_OK) 3255 4138 { 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); 3256 return -1; 3257 } 3258 peer = SSL_get_peer_certificate(soap->ssl); 3259 if (!peer) 3260 { soap_set_sender_error(soap, "SSL error", "No SSL certificate was presented by the peer in tcp_connect()", SOAP_SSL_ERROR); 3261 return -1; 3262 } 3263 X509_NAME_get_text_by_NID(X509_get_subject_name(peer), NID_commonName, soap->msgbuf, sizeof(soap->msgbuf)); 3264 X509_free(peer); 3265 if (soap_tag_cmp(soap->msgbuf, host)) 3266 { soap_set_sender_error(soap, "SSL error", "SSL certificate host name mismatch in tcp_connect()", SOAP_SSL_ERROR); 3267 return -1; 3268 } 3269 } 3270 } 3271 #endif 4139 soap->fclosesocket(soap, fd); 4140 return SOAP_INVALID_SOCKET; 4141 } 4142 if (!(soap->ssl_flags & SOAP_SSL_SKIP_HOST_CHECK)) 4143 { X509_NAME *subj; 4144 int ext_count; 4145 int ok = 0; 4146 X509 *peer; 4147 peer = SSL_get_peer_certificate(soap->ssl); 4148 if (!peer) 4149 { soap_set_sender_error(soap, "SSL error", "No SSL certificate was presented by the peer in tcp_connect()", SOAP_SSL_ERROR); 4150 soap->fclosesocket(soap, fd); 4151 return SOAP_INVALID_SOCKET; 4152 } 4153 ext_count = X509_get_ext_count(peer); 4154 if (ext_count > 0) 4155 { int i; 4156 for (i = 0; i < ext_count; i++) 4157 { X509_EXTENSION *ext = X509_get_ext(peer, i); 4158 const char *ext_str = OBJ_nid2sn(OBJ_obj2nid(X509_EXTENSION_get_object(ext))); 4159 if (ext_str && !strcmp(ext_str, "subjectAltName")) 4160 { X509V3_EXT_METHOD *meth = X509V3_EXT_get(ext); 4161 void *ext_data; 4162 #if (OPENSSL_VERSION_NUMBER >= 0x0090800fL) 4163 const unsigned char *data; 4164 #else 4165 unsigned char *data; 4166 #endif 4167 STACK_OF(CONF_VALUE) *val; 4168 int j; 4169 if (!meth) 4170 break; 4171 data = ext->value->data; 4172 #if (OPENSSL_VERSION_NUMBER > 0x00907000L) 4173 if (meth->it) 4174 ext_data = ASN1_item_d2i(NULL, &data, ext->value->length, ASN1_ITEM_ptr(meth->it)); 4175 else 4176 { /* OpenSSL not perfectly portable at this point (?): 4177 Some compilers appear to prefer 4178 meth->d2i(NULL, (const unsigned char**)&data, ... 4179 or 4180 meth->d2i(NULL, &data, ext->value->length); 4181 */ 4182 ext_data = meth->d2i(NULL, &data, ext->value->length); 4183 } 4184 #else 4185 ext_data = meth->d2i(NULL, &data, ext->value->length); 4186 #endif 4187 val = meth->i2v(meth, ext_data, NULL); 4188 for (j = 0; j < sk_CONF_VALUE_num(val); j++) 4189 { CONF_VALUE *nval = sk_CONF_VALUE_value(val, j); 4190 if (nval && !strcmp(nval->name, "DNS") && !strcmp(nval->value, host)) 4191 { ok = 1; 4192 break; 4193 } 4194 } 4195 } 4196 if (ok) 4197 break; 4198 } 4199 } 4200 if (!ok && (subj = X509_get_subject_name(peer))) 4201 { int i = -1; 4202 do 4203 { ASN1_STRING *name; 4204 i = X509_NAME_get_index_by_NID(subj, NID_commonName, i); 4205 if (i == -1) 4206 break; 4207 name = X509_NAME_ENTRY_get_data(X509_NAME_get_entry(subj, i)); 4208 if (name) 4209 { if (!soap_tag_cmp(host, (const char*)name)) 4210 ok = 1; 4211 else 4212 { unsigned char *tmp = NULL; 4213 ASN1_STRING_to_UTF8(&tmp, name); 4214 if (tmp) 4215 { if (!soap_tag_cmp(host, (const char*)tmp)) 4216 ok = 1; 4217 OPENSSL_free(tmp); 4218 } 4219 } 4220 } 4221 } while (!ok); 4222 } 4223 X509_free(peer); 4224 if (!ok) 4225 { soap_set_sender_error(soap, "SSL error", "SSL certificate host name mismatch in tcp_connect()", SOAP_SSL_ERROR); 4226 soap->fclosesocket(soap, fd); 4227 return SOAP_INVALID_SOCKET; 4228 } 4229 } 4230 } 4231 #else 4232 soap->fclosesocket(soap, fd); 4233 soap->error = SOAP_SSL_ERROR; 4234 return SOAP_INVALID_SOCKET; 4235 #endif 4236 } 3272 4237 return fd; 3273 4238 } … … 3276 4241 3277 4242 /******************************************************************************/ 3278 #ifndef MAC_CARBON3279 #ifndef PALM_1 3280 SOAP_FMAC1 3281 int 4243 #ifndef WITH_NOIO 4244 #ifndef PALM_1 4245 SOAP_FMAC1 4246 SOAP_SOCKET 3282 4247 SOAP_FMAC2 3283 4248 soap_bind(struct soap *soap, const char *host, int port, int backlog) 3284 { struct sockaddr_in sockaddr; 3285 /* WR[ */ 4249 { 3286 4250 #ifdef WITH_IPV6 3287 struct addrinfo *addrinfo ;4251 struct addrinfo *addrinfo = NULL; 3288 4252 struct addrinfo hints; 3289 struct addrinfo resaddr; 3290 struct sockaddr_storage addrstorage; 4253 struct addrinfo res; 3291 4254 int err; 3292 #endif /* WITH_IPV6 */ 3293 /* ]WR */ 4255 #endif 3294 4256 #ifndef WITH_LEAN 3295 4257 int len = SOAP_BUFLEN; … … 3297 4259 #endif 3298 4260 if (soap_valid_socket(soap->master)) 3299 { soap->fclosesocket(soap, (SOAP_SOCKET)soap->master);4261 { soap->fclosesocket(soap, soap->master); 3300 4262 soap->master = SOAP_INVALID_SOCKET; 3301 4263 } … … 3304 4266 if (tcp_init(soap)) 3305 4267 { soap_set_receiver_error(soap, tcp_error(soap), "TCP init failed in soap_bind()", SOAP_TCP_ERROR); 3306 return -1; 3307 } 3308 /* WR[ */ 4268 return SOAP_INVALID_SOCKET; 4269 } 3309 4270 #ifdef WITH_IPV6 3310 4271 memset((void*)&hints, 0, sizeof(hints)); 3311 4272 hints.ai_family = PF_UNSPEC; 3312 hints.ai_socktype = SOCK_STREAM; 4273 #ifndef WITH_LEAN 4274 if ((soap->omode & SOAP_IO_UDP)) 4275 hints.ai_socktype = SOCK_DGRAM; 4276 else 4277 #endif 4278 hints.ai_socktype = SOCK_STREAM; 3313 4279 hints.ai_flags = AI_PASSIVE; 3314 4280 soap->errmode = 2; 3315 if (host) 3316 err = getaddrinfo(host, soap_int2s(soap, port), &hints, &addrinfo); 4281 err = getaddrinfo(host, soap_int2s(soap, port), &hints, &addrinfo); 4282 if (addrinfo) 4283 { res = *addrinfo; 4284 memcpy(&soap->peer, addrinfo->ai_addr, addrinfo->ai_addrlen); 4285 soap->peerlen = addrinfo->ai_addrlen; 4286 res.ai_addr = (struct sockaddr*)&soap->peer; 4287 res.ai_addrlen = soap->peerlen; 4288 freeaddrinfo(addrinfo); 4289 } 4290 if (err || !addrinfo) 4291 { soap_set_receiver_error(soap, SOAP_GAI_STRERROR(err), "getaddrinfo failed in soap_bind()", SOAP_TCP_ERROR); 4292 return SOAP_INVALID_SOCKET; 4293 } 4294 soap->master = (int)socket(res.ai_family, res.ai_socktype, res.ai_protocol); 4295 #else 4296 #ifndef WITH_LEAN 4297 if ((soap->omode & SOAP_IO_UDP)) 4298 soap->master = (int)socket(AF_INET, SOCK_DGRAM, 0); 3317 4299 else 3318 err = getaddrinfo(NULL, soap_int2s(soap, port), &hints, &addrinfo); 3319 if (NULL != addrinfo) 3320 { 3321 resaddr = *addrinfo; 3322 addrstorage = *((struct sockaddr_storage *) addrinfo->ai_addr); 3323 resaddr.ai_addr = (struct sockaddr *) &addrstorage; 3324 freeaddrinfo(addrinfo); 3325 } 3326 if (err) 3327 { soap_set_receiver_error(soap, gai_strerror(err), "TCP getaddrinfo failed in soap_bind()", SOAP_TCP_ERROR); 3328 return -1; 3329 } 4300 #endif 4301 soap->master = (int)socket(AF_INET, SOCK_STREAM, 0); 4302 #endif 3330 4303 soap->errmode = 0; 3331 if ((soap->master = socket(resaddr.ai_family, resaddr.ai_socktype, resaddr.ai_protocol)) < 0) 3332 { soap->errnum = soap_socket_errno; 3333 soap_set_receiver_error(soap, tcp_error(soap), "TCP socket failed in soap_bind()", SOAP_TCP_ERROR); 3334 return -1; 3335 } 3336 #else /* WITH_IPV6 */ 3337 /* ]WR */ 3338 soap->errmode = 0; 3339 if ((soap->master = (int)socket(AF_INET, SOCK_STREAM, 0)) < 0) 3340 { soap->errnum = soap_socket_errno; 3341 soap_set_receiver_error(soap, tcp_error(soap), "TCP socket failed in soap_bind()", SOAP_TCP_ERROR); 3342 return -1; 3343 } 3344 /* WR[ */ 3345 #endif /* WITH_IPV6 */ 3346 /* ]WR */ 4304 if (!soap_valid_socket(soap->master)) 4305 { soap->errnum = soap_socket_errno(soap->master); 4306 soap_set_receiver_error(soap, tcp_error(soap), "socket failed in soap_bind()", SOAP_TCP_ERROR); 4307 return SOAP_INVALID_SOCKET; 4308 } 4309 #ifndef WITH_LEAN 4310 if ((soap->omode & SOAP_IO_UDP)) 4311 soap->socket = soap->master; 4312 #endif 3347 4313 #ifdef SOCKET_CLOSE_ON_EXEC 3348 4314 #ifdef WIN32 … … 3351 4317 #endif 3352 4318 #else 3353 fcntl (soap->master, F_SETFD, 1);4319 fcntl(soap->master, F_SETFD, 1); 3354 4320 #endif 3355 4321 #endif 3356 4322 #ifndef WITH_LEAN 3357 if (soap->bind_flags && setsockopt( (SOAP_SOCKET)soap->master, SOL_SOCKET, soap->bind_flags, (char*)&set, sizeof(int)))3358 { soap->errnum = soap_socket_errno ;3359 soap_set_receiver_error(soap, tcp_error(soap), " TCPsetsockopt failed in soap_bind()", SOAP_TCP_ERROR);3360 return -1;3361 } 3362 if ( soap->keep_alive && setsockopt((SOAP_SOCKET)soap->master, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int)))3363 { soap->errnum = soap_socket_errno ;3364 soap_set_receiver_error(soap, tcp_error(soap), " TCPsetsockopt SO_KEEPALIVE failed in soap_bind()", SOAP_TCP_ERROR);3365 return -1;3366 } 3367 if (setsockopt( (SOAP_SOCKET)soap->master, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int)))3368 { soap->errnum = soap_socket_errno ;3369 soap_set_receiver_error(soap, tcp_error(soap), " TCPsetsockopt SO_SNDBUF failed in soap_bind()", SOAP_TCP_ERROR);3370 return -1;3371 } 3372 if (setsockopt( (SOAP_SOCKET)soap->master, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int)))3373 { soap->errnum = soap_socket_errno ;3374 soap_set_receiver_error(soap, tcp_error(soap), " TCPsetsockopt SO_RCVBUF failed in soap_bind()", SOAP_TCP_ERROR);3375 return -1;4323 if (soap->bind_flags && setsockopt(soap->master, SOL_SOCKET, soap->bind_flags, (char*)&set, sizeof(int))) 4324 { soap->errnum = soap_socket_errno(soap->master); 4325 soap_set_receiver_error(soap, tcp_error(soap), "setsockopt failed in soap_bind()", SOAP_TCP_ERROR); 4326 return SOAP_INVALID_SOCKET; 4327 } 4328 if (((soap->imode | soap->omode) & SOAP_IO_KEEPALIVE) && setsockopt(soap->master, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int))) 4329 { soap->errnum = soap_socket_errno(soap->master); 4330 soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_KEEPALIVE failed in soap_bind()", SOAP_TCP_ERROR); 4331 return SOAP_INVALID_SOCKET; 4332 } 4333 if (setsockopt(soap->master, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int))) 4334 { soap->errnum = soap_socket_errno(soap->master); 4335 soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_SNDBUF failed in soap_bind()", SOAP_TCP_ERROR); 4336 return SOAP_INVALID_SOCKET; 4337 } 4338 if (setsockopt(soap->master, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) 4339 { soap->errnum = soap_socket_errno(soap->master); 4340 soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_RCVBUF failed in soap_bind()", SOAP_TCP_ERROR); 4341 return SOAP_INVALID_SOCKET; 3376 4342 } 3377 4343 #ifdef TCP_NODELAY 3378 if (setsockopt((SOAP_SOCKET)soap->master, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int))) 3379 { soap->errnum = soap_socket_errno; 3380 soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt TCP_NODELAY failed in soap_bind()", SOAP_TCP_ERROR); 3381 return -1; 3382 } 3383 #endif 3384 #endif 3385 /* WR[ */ 4344 if (!(soap->omode & SOAP_IO_UDP) && setsockopt(soap->master, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int))) 4345 { soap->errnum = soap_socket_errno(soap->master); 4346 soap_set_receiver_error(soap, tcp_error(soap), "setsockopt TCP_NODELAY failed in soap_bind()", SOAP_TCP_ERROR); 4347 return SOAP_INVALID_SOCKET; 4348 } 4349 #endif 4350 #endif 3386 4351 #ifdef WITH_IPV6 3387 4352 soap->errmode = 0; 3388 if (bind(soap->master, resaddr.ai_addr, resaddr.ai_addrlen) || listen(soap->master, backlog)) 3389 { 3390 soap->errnum = soap_socket_errno; 4353 if (bind(soap->master, res.ai_addr, (int)res.ai_addrlen)) 4354 { soap->errnum = soap_socket_errno(soap->master); 3391 4355 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not bind to host\n")); 3392 4356 soap_closesock(soap); 3393 soap_set_receiver_error(soap, tcp_error(soap), " TCPbind failed in soap_bind()", SOAP_TCP_ERROR);3394 return -1;4357 soap_set_receiver_error(soap, tcp_error(soap), "bind failed in soap_bind()", SOAP_TCP_ERROR); 4358 return SOAP_INVALID_SOCKET; 3395 4359 } 3396 #else /* WITH_IPV6 */3397 /* ]WR */ 3398 memset((void*)&so ckaddr, 0, sizeof(sockaddr));3399 so ckaddr.sin_family = AF_INET;4360 #else 4361 soap->peerlen = sizeof(soap->peer); 4362 memset((void*)&soap->peer, 0, sizeof(soap->peer)); 4363 soap->peer.sin_family = AF_INET; 3400 4364 soap->errmode = 2; 3401 4365 if (host) 3402 { if (soap->fresolve(soap, host, &so ckaddr.sin_addr))3403 { soap_set_receiver_error(soap, tcp_error(soap), " TCPget host by name failed in soap_bind()", SOAP_TCP_ERROR);3404 return -1;4366 { if (soap->fresolve(soap, host, &soap->peer.sin_addr)) 4367 { soap_set_receiver_error(soap, tcp_error(soap), "get host by name failed in soap_bind()", SOAP_TCP_ERROR); 4368 return SOAP_INVALID_SOCKET; 3405 4369 } 3406 4370 } 3407 4371 else 3408 so ckaddr.sin_addr.s_addr = htonl(INADDR_ANY);3409 so ckaddr.sin_port = htons((short)port);4372 soap->peer.sin_addr.s_addr = htonl(INADDR_ANY); 4373 soap->peer.sin_port = htons((short)port); 3410 4374 soap->errmode = 0; 3411 if (bind( (SOAP_SOCKET)soap->master, (struct sockaddr*)&sockaddr, sizeof(sockaddr)) || listen((SOAP_SOCKET)soap->master, backlog))3412 { soap->errnum = soap_socket_errno ;4375 if (bind(soap->master, (struct sockaddr*)&soap->peer, (int)soap->peerlen)) 4376 { soap->errnum = soap_socket_errno(soap->master); 3413 4377 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not bind to host\n")); 3414 4378 soap_closesock(soap); 3415 soap_set_receiver_error(soap, tcp_error(soap), "TCP bind failed in soap_bind()", SOAP_TCP_ERROR); 3416 return -1; 4379 soap_set_receiver_error(soap, tcp_error(soap), "bind failed in soap_bind()", SOAP_TCP_ERROR); 4380 return SOAP_INVALID_SOCKET; 4381 } 4382 #endif 4383 if (!(soap->omode & SOAP_IO_UDP) && listen(soap->master, backlog)) 4384 { soap->errnum = soap_socket_errno(soap->master); 4385 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not bind to host\n")); 4386 soap_closesock(soap); 4387 soap_set_receiver_error(soap, tcp_error(soap), "listen failed in soap_bind()", SOAP_TCP_ERROR); 4388 return SOAP_INVALID_SOCKET; 3417 4389 } 3418 /* WR[ */3419 #endif /* WITH_IPV6 */3420 /* ]WR */3421 #ifdef WITH_OPENSSL3422 if (!soap->ctx && (soap->error = soap->fsslauth(soap)))3423 return -1;3424 #endif3425 4390 return soap->master; 3426 4391 } … … 3429 4394 3430 4395 /******************************************************************************/ 3431 #ifndef MAC_CARBON4396 #ifndef WITH_NOIO 3432 4397 #ifndef PALM_1 3433 4398 SOAP_FMAC1 … … 3438 4403 #ifndef WITH_LEAN 3439 4404 struct timeval timeout; 3440 fd_set sfd,rfd; 3441 int r; 4405 fd_set rfd, sfd, xfd; 4406 register int r; 4407 #ifndef WIN32 4408 if ((int)soap->socket >= (int)FD_SETSIZE) 4409 return SOAP_FD_EXCEEDED; /* Hint: MUST increase FD_SETSIZE */ 4410 #endif 3442 4411 timeout.tv_sec = 0; 3443 4412 timeout.tv_usec = 0; 3444 4413 FD_ZERO(&rfd); 3445 4414 FD_ZERO(&sfd); 3446 if (soap->socket >= 0) 4415 FD_ZERO(&xfd); 4416 if (soap_valid_socket(soap->socket)) 3447 4417 { FD_SET(soap->socket, &rfd); 3448 4418 FD_SET(soap->socket, &sfd); 3449 r = select(soap->socket + 1, &rfd, &sfd, NULL, &timeout); 3450 } 3451 else if (soap->master >= 0) 3452 { FD_SET(soap->master, &rfd); 3453 r = select(soap->master + 1, &rfd, &sfd, NULL, &timeout); 4419 FD_SET(soap->socket, &xfd); 4420 r = select((int)soap->socket + 1, &rfd, &sfd, &xfd, &timeout); 4421 if (r > 0 && FD_ISSET(soap->socket, &xfd)) 4422 r = -1; 4423 } 4424 else if (soap_valid_socket(soap->master)) 4425 { FD_SET(soap->master, &sfd); 4426 r = select((int)soap->master + 1, NULL, &sfd, NULL, &timeout); 3454 4427 } 3455 4428 else 3456 { FD_SET(soap->sendfd, &sfd); 3457 FD_SET(soap->recvfd, &rfd); 3458 r = select((soap->sendfd > soap->recvfd ? soap->sendfd : soap->recvfd) + 1, &rfd, &sfd, NULL, &timeout); 3459 } 4429 return SOAP_OK; 3460 4430 if (r > 0) 3461 4431 { 3462 4432 #ifdef WITH_OPENSSL 3463 if (soap->ssl) 3464 { if ((soap->socket >= 0) && FD_ISSET(soap->socket, &rfd)) 3465 { char buf = '\0'; 3466 if (SSL_peek(soap->ssl, &buf, 1) <= 0) 3467 return SOAP_EOF; 3468 } 3469 } 3470 #endif 3471 return SOAP_OK; 3472 } 3473 if (r < 0 && (soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) && soap_socket_errno != SOAP_EINTR) 3474 { soap->errnum = soap_socket_errno; 3475 soap_set_receiver_error(soap, tcp_error(soap), "select failed in soap_poll()", SOAP_TCP_ERROR); 3476 return soap->error = SOAP_TCP_ERROR; 4433 if (soap->imode & SOAP_ENC_SSL) 4434 { 4435 if (soap_valid_socket(soap->socket) 4436 && FD_ISSET(soap->socket, &sfd) 4437 && (!FD_ISSET(soap->socket, &rfd) 4438 || SSL_peek(soap->ssl, soap->tmpbuf, 1) > 0)) 4439 return SOAP_OK; 4440 } 4441 else 4442 #endif 4443 if (soap_valid_socket(soap->socket) 4444 && FD_ISSET(soap->socket, &sfd) 4445 && (!FD_ISSET(soap->socket, &rfd) 4446 || recv(soap->socket, soap->tmpbuf, 1, MSG_PEEK) > 0)) 4447 return SOAP_OK; 4448 } 4449 else if (r < 0) 4450 { soap->errnum = soap_socket_errno(soap->master); 4451 if ((soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) && soap_socket_errno(soap->master) != SOAP_EINTR) 4452 { soap_set_receiver_error(soap, tcp_error(soap), "select failed in soap_poll()", SOAP_TCP_ERROR); 4453 return soap->error = SOAP_TCP_ERROR; 4454 } 3477 4455 } 3478 4456 else 3479 soap->errnum = soap_errno; 4457 soap->errnum = 0; 4458 DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Polling: other end down on socket=%d select=%d\n", soap->socket, r)); 3480 4459 return SOAP_EOF; 3481 4460 #else … … 3487 4466 3488 4467 /******************************************************************************/ 3489 #ifndef MAC_CARBON 3490 #ifndef PALM_1 3491 static int 3492 tcp_accept(struct soap *soap, int s, struct sockaddr *a, int *n) 3493 { int fd; 3494 #if defined(SOCKLEN_T) 3495 fd = (int)accept((SOAP_SOCKET)s, a, (SOCKLEN_T*)n); 3496 #elif defined(__socklen_t_defined) || defined(_SOCKLEN_T) || defined(CYGWIN) 3497 fd = (int)accept((SOAP_SOCKET)s, a, (socklen_t*)n); 3498 #elif defined(WIN32) || defined(__APPLE__) || defined(HP_UX) || defined(SUN_OS) || defined(OPENSERVER) || defined(TRU64) || defined(VXWORKS) 3499 fd = (int)accept((SOAP_SOCKET)s, a, n); 3500 #else 3501 fd = (int)accept((SOAP_SOCKET)s, a, (size_t*)n); 3502 #endif 4468 #ifndef WITH_NOIO 4469 #ifndef PALM_1 4470 static SOAP_SOCKET 4471 tcp_accept(struct soap *soap, SOAP_SOCKET s, struct sockaddr *a, int *n) 4472 { SOAP_SOCKET fd; 4473 fd = accept(s, a, (SOAP_SOCKLEN_T*)n); /* portability note: see SOAP_SOCKLEN_T definition in stdsoap2.h */ 3503 4474 #ifdef SOCKET_CLOSE_ON_EXEC 3504 4475 #ifdef WIN32 … … 3516 4487 3517 4488 /******************************************************************************/ 3518 #ifndef MAC_CARBON3519 #ifndef PALM_1 3520 SOAP_FMAC1 3521 int 4489 #ifndef WITH_NOIO 4490 #ifndef PALM_1 4491 SOAP_FMAC1 4492 SOAP_SOCKET 3522 4493 SOAP_FMAC2 3523 4494 soap_accept(struct soap *soap) 3524 { 3525 /* WR[ */ 3526 #ifdef WITH_IPV6 3527 struct sockaddr_storage sockaddr; 3528 #else /* WITH_IPV6 */ 3529 /* ]WR */ 3530 struct sockaddr_in sockaddr; 3531 /* WR[ */ 3532 #endif 3533 /* ]WR */ 3534 int n = (int)sizeof(sockaddr); 4495 { int n = (int)sizeof(soap->peer); 3535 4496 #ifndef WITH_LEAN 3536 4497 int len = SOAP_BUFLEN; … … 3538 4499 #endif 3539 4500 soap->error = SOAP_OK; 3540 memset((void*)&sockaddr, 0, sizeof(sockaddr)); 4501 #ifndef WITH_LEAN 4502 if ((soap->omode & SOAP_IO_UDP)) 4503 return soap->socket = soap->master; 4504 #endif 4505 memset((void*)&soap->peer, 0, sizeof(soap->peer)); 3541 4506 soap->socket = SOAP_INVALID_SOCKET; 3542 4507 soap->errmode = 0; 4508 soap->keep_alive = 0; 3543 4509 if (soap_valid_socket(soap->master)) 3544 { for (;;) 4510 { register int err; 4511 for (;;) 3545 4512 { 3546 4513 #ifndef WITH_LEAN 3547 if (soap->accept_timeout )3548 { struct timeval timeout;3549 fd_set fd; 3550 if ( soap->accept_timeout > 0)3551 { timeout.tv_sec = soap->accept_timeout;3552 timeout.tv_usec = 0;4514 if (soap->accept_timeout || soap->send_timeout || soap->recv_timeout) 4515 { 4516 #ifndef WIN32 4517 if ((int)soap->socket >= (int)FD_SETSIZE) 4518 { soap->error = SOAP_FD_EXCEEDED; 4519 return SOAP_INVALID_SOCKET; /* Hint: MUST increase FD_SETSIZE */ 3553 4520 } 3554 else 3555 { timeout.tv_sec = -soap->accept_timeout/1000000; 3556 timeout.tv_usec = -soap->accept_timeout%1000000; 3557 } 3558 FD_ZERO(&fd); 3559 FD_SET((SOAP_SOCKET)soap->master, &fd); 4521 #endif 3560 4522 for (;;) 3561 { int r = select((SOAP_SOCKET)(soap->master + 1), &fd, &fd, NULL, &timeout); 4523 { struct timeval timeout; 4524 fd_set fd; 4525 register int r; 4526 if (soap->accept_timeout > 0) 4527 { timeout.tv_sec = soap->accept_timeout; 4528 timeout.tv_usec = 0; 4529 } 4530 else if (soap->accept_timeout < 0) 4531 { timeout.tv_sec = -soap->accept_timeout/1000000; 4532 timeout.tv_usec = -soap->accept_timeout%1000000; 4533 } 4534 else 4535 { timeout.tv_sec = 60; 4536 timeout.tv_usec = 0; 4537 } 4538 FD_ZERO(&fd); 4539 FD_SET(soap->master, &fd); 4540 r = select((int)soap->master + 1, &fd, &fd, &fd, &timeout); 3562 4541 if (r > 0) 3563 4542 break; 3564 if (!r )4543 if (!r && soap->accept_timeout) 3565 4544 { soap->errnum = 0; 3566 soap_set_receiver_error(soap, "Timeout", " TCPaccept failed in soap_accept()", SOAP_TCP_ERROR);3567 return -1;4545 soap_set_receiver_error(soap, "Timeout", "accept failed in soap_accept()", SOAP_TCP_ERROR); 4546 return SOAP_INVALID_SOCKET; 3568 4547 } 3569 if (soap_socket_errno != SOAP_EINTR) 3570 { soap->errnum = soap_socket_errno; 3571 soap_closesock(soap); 3572 soap_set_sender_error(soap, tcp_error(soap), "TCP accept failed in soap_accept()", SOAP_TCP_ERROR); 3573 return -1; 3574 } 4548 if (r < 0) 4549 { r = soap_socket_errno(soap->master); 4550 if (r != SOAP_EINTR) 4551 { soap->errnum = r; 4552 soap_closesock(soap); 4553 soap_set_sender_error(soap, tcp_error(soap), "accept failed in soap_accept()", SOAP_TCP_ERROR); 4554 return SOAP_INVALID_SOCKET; 4555 } 4556 } 3575 4557 } 3576 #if defined(WIN32) 3577 { u_long nonblocking = 1; 3578 ioctlsocket((SOAP_SOCKET)soap->master, FIONBIO, &nonblocking); 3579 } 3580 #elif defined(VXWORKS) 3581 { vx_nonblocking = TRUE; 3582 ioctl((SOAP_SOCKET)soap->master, FIONBIO, (int)(&vx_nonblocking)); 3583 } 3584 #else 3585 fcntl((SOAP_SOCKET)soap->master, F_SETFL, fcntl((SOAP_SOCKET)soap->master, F_GETFL)|O_NONBLOCK); 3586 #endif 3587 } 4558 } 4559 if (soap->accept_timeout || soap->send_timeout || soap->recv_timeout) 4560 SOAP_SOCKNONBLOCK(soap->master) 3588 4561 else 3589 #if defined(WIN32) 3590 { u_long blocking = 0; 3591 ioctlsocket((SOAP_SOCKET)soap->master, FIONBIO, &blocking); 3592 } 3593 /* WR[ */ 3594 #elif defined(VXWORKS) 3595 { vx_nonblocking = FALSE; 3596 ioctl((SOAP_SOCKET)soap->master, FIONBIO, (int)(&vx_nonblocking)); 3597 } 3598 /* ]WR */ 3599 #else 3600 fcntl((SOAP_SOCKET)soap->master, F_SETFL, fcntl((SOAP_SOCKET)soap->master, F_GETFL)&~O_NONBLOCK); 3601 #endif 3602 #endif 3603 if ((soap->socket = soap->faccept(soap, soap->master, (struct sockaddr*)&sockaddr, &n)) >= 0) 4562 SOAP_SOCKBLOCK(soap->master) 4563 #endif 4564 soap->socket = soap->faccept(soap, soap->master, (struct sockaddr*)&soap->peer, &n); 4565 soap->peerlen = (size_t)n; 4566 if (soap_valid_socket(soap->socket)) 3604 4567 { 3605 /* WR[ */3606 4568 #ifdef WITH_IPV6 3607 4569 /* Use soap->host to store the numeric form of the remote host */ 3608 getnameinfo((struct sockaddr*)&so ckaddr, n, soap->host, sizeof(soap->host), NULL, 0, NI_NUMERICHOST | NI_NUMERICSERV);4570 getnameinfo((struct sockaddr*)&soap->peer, n, soap->host, sizeof(soap->host), NULL, 0, NI_NUMERICHOST | NI_NUMERICSERV); 3609 4571 DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Accept socket %d from %s\n", soap->socket, soap->host)); 3610 soap->ip = 0; /* info stored in soap->host */ 3611 soap->port = 0; /* info stored in soap->host */ 3612 #else /* WITH_IPV6 */ 3613 /* ]WR */ 3614 soap->ip = ntohl(sockaddr.sin_addr.s_addr); 3615 soap->port = (int)ntohs(sockaddr.sin_port); /* does not return port number on some systems */ 4572 soap->ip = 0; /* info stored in soap->peer and soap->host */ 4573 soap->port = 0; /* info stored in soap->peer and soap->host */ 4574 #else 4575 soap->ip = ntohl(soap->peer.sin_addr.s_addr); 4576 soap->port = (int)ntohs(soap->peer.sin_port); /* does not return port number on some systems */ 3616 4577 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)); 3617 /* WR[ */ 3618 #endif /* WITH_IPV6 */ 3619 /* ]WR */ 3620 soap->keep_alive = ((soap->imode & SOAP_IO_KEEPALIVE) != 0); 4578 #endif 3621 4579 #ifndef WITH_LEAN 3622 if (soap->accept_flags &SO_LINGER)4580 if (soap->accept_flags == SO_LINGER) 3623 4581 { struct linger linger; 3624 4582 memset((void*)&linger, 0, sizeof(linger)); 3625 4583 linger.l_onoff = 1; 3626 linger.l_linger = 0; 3627 if (setsockopt((SOAP_SOCKET)soap->socket, SOL_SOCKET, SO_LINGER, (char*)&linger, sizeof(struct linger))) 3628 { soap->errnum = soap_socket_errno; 3629 soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt SO_LINGER failed in soap_accept()", SOAP_TCP_ERROR); 3630 return -1; 3631 } 4584 linger.l_linger = soap->linger_time; 4585 if (setsockopt(soap->socket, SOL_SOCKET, SO_LINGER, (char*)&linger, sizeof(struct linger))) 4586 { soap->errnum = soap_socket_errno(soap->socket); 4587 soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_LINGER failed in soap_accept()", SOAP_TCP_ERROR); 4588 soap_closesock(soap); 4589 return SOAP_INVALID_SOCKET; 4590 } 3632 4591 } 3633 if ((soap->accept_flags & ~SO_LINGER) && setsockopt((SOAP_SOCKET)soap->socket, SOL_SOCKET, soap->accept_flags & ~SO_LINGER, (char*)&set, sizeof(int))) 3634 { soap->errnum = soap_socket_errno; 3635 soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt failed in soap_accept()", SOAP_TCP_ERROR); 3636 return -1; 4592 else if (soap->accept_flags && setsockopt(soap->socket, SOL_SOCKET, soap->accept_flags, (char*)&set, sizeof(int))) 4593 { soap->errnum = soap_socket_errno(soap->socket); 4594 soap_set_receiver_error(soap, tcp_error(soap), "setsockopt failed in soap_accept()", SOAP_TCP_ERROR); 4595 soap_closesock(soap); 4596 return SOAP_INVALID_SOCKET; 3637 4597 } 3638 if (soap->keep_alive && setsockopt((SOAP_SOCKET)soap->socket, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int))) 3639 { soap->errnum = soap_socket_errno; 3640 soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt SO_KEEPALIVE failed in soap_accept()", SOAP_TCP_ERROR); 3641 return -1; 4598 if (((soap->imode | soap->omode) & SOAP_IO_KEEPALIVE) && setsockopt(soap->socket, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int))) 4599 { soap->errnum = soap_socket_errno(soap->socket); 4600 soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_KEEPALIVE failed in soap_accept()", SOAP_TCP_ERROR); 4601 soap_closesock(soap); 4602 return SOAP_INVALID_SOCKET; 3642 4603 } 3643 if (setsockopt((SOAP_SOCKET)soap->socket, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int))) 3644 { soap->errnum = soap_socket_errno; 3645 soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt SO_SNDBUF failed in soap_accept()", SOAP_TCP_ERROR); 3646 return -1; 4604 if (setsockopt(soap->socket, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int))) 4605 { soap->errnum = soap_socket_errno(soap->socket); 4606 soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_SNDBUF failed in soap_accept()", SOAP_TCP_ERROR); 4607 soap_closesock(soap); 4608 return SOAP_INVALID_SOCKET; 3647 4609 } 3648 if (setsockopt((SOAP_SOCKET)soap->socket, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) 3649 { soap->errnum = soap_socket_errno; 3650 soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt SO_RCVBUF failed in soap_accept()", SOAP_TCP_ERROR); 3651 return -1; 4610 if (setsockopt(soap->socket, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) 4611 { soap->errnum = soap_socket_errno(soap->socket); 4612 soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_RCVBUF failed in soap_accept()", SOAP_TCP_ERROR); 4613 soap_closesock(soap); 4614 return SOAP_INVALID_SOCKET; 3652 4615 } 3653 4616 #ifdef TCP_NODELAY 3654 if (setsockopt((SOAP_SOCKET)soap->socket, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int))) 3655 { soap->errnum = soap_socket_errno; 3656 soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt TCP_NODELAY failed in soap_accept()", SOAP_TCP_ERROR); 3657 return -1; 4617 if (!(soap->omode & SOAP_IO_UDP) && setsockopt(soap->socket, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int))) 4618 { soap->errnum = soap_socket_errno(soap->socket); 4619 soap_set_receiver_error(soap, tcp_error(soap), "setsockopt TCP_NODELAY failed in soap_accept()", SOAP_TCP_ERROR); 4620 soap_closesock(soap); 4621 return SOAP_INVALID_SOCKET; 3658 4622 } 3659 4623 #endif 3660 4624 #endif 3661 if (soap->accept_timeout) 3662 { 3663 #if defined(WIN32) 3664 u_long blocking = 0; 3665 ioctlsocket((SOAP_SOCKET)soap->master, FIONBIO, &blocking); 3666 ioctlsocket((SOAP_SOCKET)soap->socket, FIONBIO, &blocking); 3667 /* WR[ */ 3668 #elif defined(VXWORKS) 3669 vx_nonblocking = FALSE; 3670 ioctl((SOAP_SOCKET)soap->master, FIONBIO, (int)(&vx_nonblocking)); 3671 ioctl((SOAP_SOCKET)soap->socket, FIONBIO, (int)(&vx_nonblocking)); 3672 /* ]WR */ 3673 #elif defined(PALM) 3674 fcntl((SOAP_SOCKET)soap->master, F_SETFL, fcntl((SOAP_SOCKET)soap->master, F_GETFL,0)&~O_NONBLOCK); 3675 fcntl((SOAP_SOCKET)soap->socket, F_SETFL, fcntl((SOAP_SOCKET)soap->socket, F_GETFL,0)&~O_NONBLOCK); 3676 #elif defined(SYMBIAN) 3677 long blocking = 0; 3678 ioctl((SOAP_SOCKET)soap->master, 0/*FIONBIO*/, &blocking); 3679 #else 3680 fcntl((SOAP_SOCKET)soap->master, F_SETFL, fcntl((SOAP_SOCKET)soap->master, F_GETFL)&~O_NONBLOCK); 3681 fcntl((SOAP_SOCKET)soap->socket, F_SETFL, fcntl((SOAP_SOCKET)soap->socket, F_GETFL)&~O_NONBLOCK); 3682 #endif 3683 } 4625 soap->keep_alive = (((soap->imode | soap->omode) & SOAP_IO_KEEPALIVE) != 0); 3684 4626 return soap->socket; 3685 4627 } 3686 if (soap_socket_errno != SOAP_EINTR && soap_socket_errno != SOAP_EAGAIN) 3687 { soap->errnum = soap_socket_errno; 3688 soap_set_receiver_error(soap, tcp_error(soap), "TCP accept failed in soap_accept()", SOAP_TCP_ERROR); 3689 return -1; 4628 err = soap_socket_errno(soap->socket); 4629 if (err != 0 && err != SOAP_EINTR && err != SOAP_EAGAIN && err != SOAP_EWOULDBLOCK) 4630 { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Accept failed from %s\n", soap->host)); 4631 soap->errnum = err; 4632 soap_set_receiver_error(soap, tcp_error(soap), "accept failed in soap_accept()", SOAP_TCP_ERROR); 4633 soap_closesock(soap); 4634 return SOAP_INVALID_SOCKET; 3690 4635 } 3691 4636 } 3692 4637 } 3693 4638 else 3694 { soap_set_receiver_error(soap, tcp_error(soap), "TCP no master socket in soap_accept()", SOAP_TCP_ERROR); 3695 return -1; 3696 } 3697 } 3698 #endif 3699 #endif 3700 3701 /******************************************************************************/ 3702 #ifndef MAC_CARBON 4639 { soap->errnum = 0; 4640 soap_set_receiver_error(soap, tcp_error(soap), "no master socket in soap_accept()", SOAP_TCP_ERROR); 4641 return SOAP_INVALID_SOCKET; 4642 } 4643 } 4644 #endif 4645 #endif 4646 4647 /******************************************************************************/ 4648 #ifndef WITH_NOIO 3703 4649 #ifndef PALM_1 3704 4650 static int … … 3709 4655 { int r, s = 0; 3710 4656 if (soap->session) 3711 SSL_SESSION_free(soap->session); 4657 { SSL_SESSION_free(soap->session); 4658 soap->session = NULL; 4659 } 3712 4660 if (*soap->host) 3713 4661 { soap->session = SSL_get1_session(soap->ssl); … … 3718 4666 } 3719 4667 r = SSL_shutdown(soap->ssl); 4668 if (r == 0) 4669 { if (soap_valid_socket(soap->socket)) 4670 { struct timeval timeout; 4671 fd_set fd; 4672 if (soap->fshutdownsocket(soap, soap->socket, 1)) 4673 { /* 4674 wait up to 10 seconds for close_notify to be sent by peer (if peer not 4675 present, this avoids calling SSL_shutdown() which has a lengthy return 4676 timeout) 4677 */ 4678 #ifndef WIN32 4679 if ((int)soap->socket < (int)FD_SETSIZE) 4680 { 4681 #endif 4682 timeout.tv_sec = 10; 4683 timeout.tv_usec = 0; 4684 FD_ZERO(&fd); 4685 FD_SET(soap->socket, &fd); 4686 r = select((int)soap->socket + 1, &fd, NULL, &fd, &timeout); 4687 if (r <= 0 && soap_socket_errno(soap->socket) != SOAP_EINTR) 4688 { soap->errnum = 0; 4689 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Connection lost...\n")); 4690 soap->fclosesocket(soap, soap->socket); 4691 soap->socket = SOAP_INVALID_SOCKET; 4692 ERR_remove_state(0); 4693 return SOAP_OK; 4694 } 4695 #ifndef WIN32 4696 } 4697 #endif 4698 } 4699 } 4700 r = SSL_shutdown(soap->ssl); 4701 } 3720 4702 if (r != 1) 3721 4703 { s = ERR_get_error(); 3722 4704 if (s) 3723 { if (soap_valid_socket(soap->socket)) 3724 { soap->fshutdownsocket(soap, (SOAP_SOCKET)soap->socket, 1); 4705 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Shutdown failed: %d\n", SSL_get_error(soap->ssl, r))); 4706 if (soap_valid_socket(soap->socket) && !(soap->omode & SOAP_IO_UDP)) 4707 { soap->fclosesocket(soap, soap->socket); 3725 4708 soap->socket = SOAP_INVALID_SOCKET; 3726 4709 } 3727 r = SSL_shutdown(soap->ssl); 3728 } 3729 } 3730 DBGLOG(TEST, if (s) SOAP_MESSAGE(fdebug, "Shutdown failed: %d\n", SSL_get_error(soap->ssl, r))); 4710 } 4711 } 3731 4712 SSL_free(soap->ssl); 3732 4713 soap->ssl = NULL; … … 3736 4717 } 3737 4718 #endif 3738 if (soap_valid_socket(soap->socket)) 3739 { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Closing socket %d\n", soap->socket)); 3740 soap->fshutdownsocket(soap, (SOAP_SOCKET)soap->socket, 2); 3741 soap->fclosesocket(soap, (SOAP_SOCKET)soap->socket); 4719 if (soap_valid_socket(soap->socket) && !(soap->omode & SOAP_IO_UDP)) 4720 { soap->fshutdownsocket(soap, soap->socket, 2); 4721 soap->fclosesocket(soap, soap->socket); 3742 4722 soap->socket = SOAP_INVALID_SOCKET; 3743 4723 } … … 3748 4728 3749 4729 /******************************************************************************/ 3750 #ifndef MAC_CARBON4730 #ifndef WITH_NOIO 3751 4731 #ifndef PALM_1 3752 4732 static int 3753 4733 tcp_closesocket(struct soap *soap, SOAP_SOCKET fd) 3754 { return closesocket(fd); 3755 } 3756 #endif 3757 #endif 3758 3759 /******************************************************************************/ 3760 #ifndef MAC_CARBON 4734 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Close socket %d\n", (int)fd)); 4735 return soap_closesocket(fd); 4736 } 4737 #endif 4738 #endif 4739 4740 /******************************************************************************/ 4741 #ifndef WITH_NOIO 3761 4742 #ifndef PALM_1 3762 4743 static int 3763 4744 tcp_shutdownsocket(struct soap *soap, SOAP_SOCKET fd, int how) 3764 { return shutdown(fd, how); 4745 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Shutdown socket %d how=%d\n", (int)fd, how)); 4746 return shutdown(fd, how); 3765 4747 } 3766 4748 #endif … … 3774 4756 soap_closesock(struct soap *soap) 3775 4757 { register int status = soap->error; 3776 #ifndef MAC_CARBON3777 4758 if (status == SOAP_EOF || status == SOAP_TCP_ERROR || status == SOAP_SSL_ERROR || !soap->keep_alive) 3778 { if ( (soap->error = soap->fclose(soap)))4759 { if (soap->fclose && (soap->error = soap->fclose(soap))) 3779 4760 return soap->error; 3780 soap->socket = SOAP_INVALID_SOCKET; 3781 } 3782 #endif 4761 soap->keep_alive = 0; 4762 } 3783 4763 #ifdef WITH_ZLIB 3784 4764 if (soap->zlib_state == SOAP_ZLIB_DEFLATE) 3785 deflateEnd( &soap->d_stream);4765 deflateEnd(soap->d_stream); 3786 4766 else if (soap->zlib_state == SOAP_ZLIB_INFLATE) 3787 inflateEnd( &soap->d_stream);4767 inflateEnd(soap->d_stream); 3788 4768 soap->zlib_state = SOAP_ZLIB_NONE; 3789 4769 #endif … … 3793 4773 3794 4774 /******************************************************************************/ 4775 #ifndef WITH_NOIDREF 3795 4776 #ifndef PALM_2 3796 4777 SOAP_FMAC1 … … 3804 4785 } 3805 4786 #endif 3806 3807 /******************************************************************************/ 4787 #endif 4788 4789 /******************************************************************************/ 4790 #ifndef WITH_NOIDREF 3808 4791 #ifndef PALM_1 3809 4792 static void … … 3811 4794 { register int i; 3812 4795 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Initializing pointer hashtable\n")); 4796 soap->pblk = NULL; 4797 soap->pidx = 0; 3813 4798 for (i = 0; i < (int)SOAP_PTRHASH; i++) 3814 4799 soap->pht[i] = NULL; 3815 4800 } 3816 4801 #endif 4802 #endif 3817 4803 3818 4804 /******************************************************************************/ … … 3821 4807 struct soap* 3822 4808 SOAP_FMAC2 4809 soap_new1(soap_mode mode) 4810 { return soap_new2(mode, mode); 4811 } 4812 #endif 4813 4814 /******************************************************************************/ 4815 #ifndef PALM_1 4816 SOAP_FMAC1 4817 struct soap* 4818 SOAP_FMAC2 3823 4819 soap_new() 3824 { struct soap *soap = (struct soap*)SOAP_MALLOC(sizeof(struct soap)); 3825 if (soap) 3826 soap_init(soap); 3827 return soap; 4820 { return soap_new2(SOAP_IO_DEFAULT, SOAP_IO_DEFAULT); 3828 4821 } 3829 4822 #endif … … 3834 4827 struct soap* 3835 4828 SOAP_FMAC2 3836 soap_new1(int mode) 3837 { return soap_new2(mode, mode); 3838 } 3839 #endif 3840 3841 /******************************************************************************/ 3842 #ifndef PALM_1 3843 SOAP_FMAC1 3844 struct soap* 3845 SOAP_FMAC2 3846 soap_new2(int imode, int omode) 3847 { struct soap *soap = (struct soap*)SOAP_MALLOC(sizeof(struct soap)); 4829 soap_new2(soap_mode imode, soap_mode omode) 4830 { struct soap *soap = (struct soap*)malloc(sizeof(struct soap)); 3848 4831 if (soap) 3849 4832 soap_init2(soap, imode, omode); … … 3854 4837 /******************************************************************************/ 3855 4838 #ifndef PALM_1 4839 SOAP_FMAC1 4840 void 4841 SOAP_FMAC2 4842 soap_free(struct soap *soap) 4843 { soap_done(soap); 4844 free(soap); 4845 } 4846 #endif 4847 4848 /******************************************************************************/ 4849 #ifndef PALM_1 4850 SOAP_FMAC1 4851 void 4852 SOAP_FMAC2 4853 soap_del(struct soap *soap) 4854 { free(soap); 4855 } 4856 #endif 4857 4858 /******************************************************************************/ 4859 #ifndef WITH_NOIDREF 4860 #ifndef PALM_1 3856 4861 static void 3857 4862 soap_free_pht(struct soap *soap) 3858 { register struct soap_p list *pp, *next;4863 { register struct soap_pblk *pb, *next; 3859 4864 register int i; 3860 4865 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free pointer hashtable\n")); 4866 for (pb = soap->pblk; pb; pb = next) 4867 { next = pb->next; 4868 SOAP_FREE(soap, pb); 4869 } 4870 soap->pblk = NULL; 4871 soap->pidx = 0; 3861 4872 for (i = 0; i < (int)SOAP_PTRHASH; i++) 3862 { for (pp = soap->pht[i]; pp; pp = next)3863 { next = pp->next;3864 SOAP_FREE(pp);3865 }3866 4873 soap->pht[i] = NULL; 3867 } 3868 } 3869 #endif 3870 3871 /******************************************************************************/ 4874 } 4875 #endif 4876 #endif 4877 4878 /******************************************************************************/ 4879 #ifndef WITH_NOIDREF 3872 4880 #ifndef PALM_2 3873 4881 SOAP_FMAC1 … … 3892 4900 } 3893 4901 #endif 3894 3895 /******************************************************************************/ 4902 #endif 4903 4904 /******************************************************************************/ 4905 #ifndef WITH_NOIDREF 3896 4906 #ifndef PALM_2 3897 4907 SOAP_FMAC1 … … 3902 4912 *ppp = NULL; 3903 4913 if (p) 3904 for (pp = soap->pht[soap_hash_ptr(p)]; pp; pp = pp->next)3905 if (pp->ptr == p && pp->type == type)4914 { for (pp = soap->pht[soap_hash_ptr(p)]; pp; pp = pp->next) 4915 { if (pp->ptr == p && pp->type == type) 3906 4916 { *ppp = pp; 3907 4917 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Lookup location=%p type=%d id=%d\n", p, type, pp->id)); 3908 4918 return pp->id; 3909 4919 } 4920 } 4921 } 3910 4922 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Lookup location=%p type=%d: not found\n", p, type)); 3911 4923 return 0; 3912 4924 } 3913 4925 #endif 3914 3915 /******************************************************************************/ 4926 #endif 4927 4928 /******************************************************************************/ 4929 #ifndef WITH_NOIDREF 3916 4930 #ifndef PALM_2 3917 4931 SOAP_FMAC1 … … 3919 4933 SOAP_FMAC2 3920 4934 soap_pointer_enter(struct soap *soap, const void *p, const struct soap_array *a, int n, int type, struct soap_plist **ppp) 3921 { register int h; 3922 register struct soap_plist *pp = *ppp = (struct soap_plist*)SOAP_MALLOC(sizeof(struct soap_plist)); 3923 if (!pp) 3924 return 0; 4935 { register size_t h; 4936 register struct soap_plist *pp; 4937 if (!soap->pblk || soap->pidx >= SOAP_PTRBLK) 4938 { register struct soap_pblk *pb = (struct soap_pblk*)SOAP_MALLOC(soap, sizeof(struct soap_pblk)); 4939 if (!pb) 4940 { soap->error = SOAP_EOM; 4941 return 0; 4942 } 4943 pb->next = soap->pblk; 4944 soap->pblk = pb; 4945 soap->pidx = 0; 4946 } 4947 *ppp = pp = &soap->pblk->plist[soap->pidx++]; 3925 4948 if (a) 3926 4949 h = soap_hash_ptr(a->__ptr); 3927 4950 else 3928 4951 h = soap_hash_ptr(p); 3929 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Pointer enter location=%p array=%p size=%d dim=%d type=%d id=% lu\n", p, a?a->__ptr:NULL, a?a->__size:0, n, type, soap->idnum+1));4952 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)); 3930 4953 pp->next = soap->pht[h]; 3931 4954 pp->type = type; … … 3939 4962 } 3940 4963 #endif 3941 3942 /******************************************************************************/ 4964 #endif 4965 4966 /******************************************************************************/ 4967 #ifndef WITH_NOIDREF 3943 4968 #ifndef PALM_2 3944 4969 SOAP_FMAC1 … … 3955 4980 for (i = 0; i < n; i++) 3956 4981 if (((const int*)&pp->array->__size)[i] != ((const int*)&a->__size)[i]) 3957 break;4982 break; 3958 4983 if (i == n) 3959 4984 { *ppp = pp; … … 3967 4992 } 3968 4993 #endif 3969 3970 /******************************************************************************/ 3971 #ifndef PALM_1 3972 SOAP_FMAC1 3973 void 4994 #endif 4995 4996 /******************************************************************************/ 4997 #ifndef PALM_1 4998 SOAP_FMAC1 4999 int 3974 5000 SOAP_FMAC2 3975 5001 soap_begin_count(struct soap *soap) 3976 { soap_clr_attr(soap); 3977 soap_set_local_namespaces(soap); 5002 { 3978 5003 #ifndef WITH_LEANER 3979 5004 if ((soap->mode & SOAP_ENC_DIME) || (soap->omode & SOAP_ENC_DIME)) … … 3983 5008 { soap->mode = soap->omode; 3984 5009 if ((soap->mode & SOAP_IO) == SOAP_IO_STORE 3985 || (((soap->mode & SOAP_IO) == SOAP_IO_CHUNK || (soap->mode & SOAP_ENC_XML)) && !soap->fpreparesend)) 5010 || (((soap->mode & SOAP_IO) == SOAP_IO_CHUNK || (soap->mode & SOAP_ENC_XML)) 5011 #ifndef WITH_LEANER 5012 && !soap->fpreparesend 5013 #endif 5014 )) 3986 5015 soap->mode &= ~SOAP_IO_LENGTH; 3987 5016 else 3988 5017 soap->mode |= SOAP_IO_LENGTH; 3989 5018 } 5019 #ifdef WITH_ZLIB 3990 5020 if ((soap->mode & SOAP_ENC_ZLIB) && (soap->mode & SOAP_IO) == SOAP_IO_FLUSH) 3991 5021 { if (!(soap->mode & SOAP_ENC_DIME)) … … 3996 5026 soap->mode |= SOAP_IO_STORE; 3997 5027 } 5028 #endif 3998 5029 if (!soap->encodingStyle && !(soap->mode & SOAP_XML_GRAPH)) 3999 5030 soap->mode |= SOAP_XML_TREE; 4000 5031 #ifndef WITH_LEANER 5032 if ((soap->mode & SOAP_ENC_MTOM) && (soap->mode & SOAP_ENC_DIME)) 5033 soap->mode |= SOAP_ENC_MIME; 5034 else 5035 soap->mode &= ~SOAP_ENC_MTOM; 4001 5036 if (soap->mode & SOAP_ENC_MIME) 4002 5037 soap_select_mime_boundary(soap); … … 4011 5046 soap->part = SOAP_BEGIN; 4012 5047 soap->idnum = 0; 5048 soap_clr_attr(soap); 5049 soap_set_local_namespaces(soap); 5050 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Begin count phase (socket=%d mode=0x%x count=%lu)\n", soap->socket, soap->mode, (unsigned long)soap->count)); 5051 #ifndef WITH_LEANER 4013 5052 soap->dime.count = 0; /* count # of attachments */ 4014 5053 soap->dime.size = 0; /* accumulate total size of attachments */ 4015 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Begin count phase (socket=%d mode=%x count=%lu)\n", soap->socket, soap->mode, (unsigned long)soap->count));4016 5054 if (soap->fprepareinit && (soap->mode & SOAP_IO) != SOAP_IO_STORE) 4017 soap->fprepareinit(soap); 5055 return soap->error = soap->fprepareinit(soap); 5056 #endif 5057 return SOAP_OK; 4018 5058 } 4019 5059 #endif … … 4024 5064 int 4025 5065 SOAP_FMAC2 5066 soap_end_count(struct soap *soap) 5067 { 5068 #ifndef WITH_LEANER 5069 if (soap->fpreparefinal) 5070 return soap->error = soap->fpreparefinal(soap); 5071 #endif 5072 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End of count phase\n")); 5073 return SOAP_OK; 5074 } 5075 #endif 5076 5077 /******************************************************************************/ 5078 #ifndef PALM_1 5079 SOAP_FMAC1 5080 int 5081 SOAP_FMAC2 4026 5082 soap_begin_send(struct soap *soap) 4027 { soap->error = SOAP_OK;4028 soap _clr_attr(soap);4029 soap _set_local_namespaces(soap);4030 soap->mode = (soap->omode & ~SOAP_IO_LENGTH) | (soap->mode & SOAP_ENC_DIME); 5083 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Initializing for output\n")); 5084 soap->error = SOAP_OK; 5085 soap->mode = soap->omode | (soap->mode & (SOAP_IO_LENGTH | SOAP_ENC_DIME)); 5086 #ifdef WITH_ZLIB 4031 5087 if ((soap->mode & SOAP_ENC_ZLIB) && (soap->mode & SOAP_IO) == SOAP_IO_FLUSH) 4032 5088 { if (soap->mode & SOAP_ENC_XML) … … 4035 5091 soap->mode |= SOAP_IO_STORE; 4036 5092 } 5093 #endif 5094 #ifndef WITH_LEAN 5095 if ((soap->mode & SOAP_IO_UDP)) 5096 { soap->mode |= SOAP_ENC_XML; 5097 if (soap->count > SOAP_BUFLEN) 5098 return soap->error = SOAP_UDP_ERROR; 5099 } 5100 #endif 4037 5101 if ((soap->mode & SOAP_IO) == SOAP_IO_FLUSH && soap_valid_socket(soap->socket)) 4038 { if (soap->count || (soap->mode & SOAP_ ENC_XML))5102 { if (soap->count || (soap->mode & SOAP_IO_LENGTH) || (soap->mode & SOAP_ENC_XML)) 4039 5103 soap->mode |= SOAP_IO_BUFFER; 4040 5104 else 4041 5105 soap->mode |= SOAP_IO_STORE; 4042 5106 } 5107 soap->mode &= ~SOAP_IO_LENGTH; 4043 5108 if ((soap->mode & SOAP_IO) == SOAP_IO_STORE) 4044 soap_new_block(soap); 5109 if (soap_new_block(soap) == NULL) 5110 return soap->error; 4045 5111 if (!(soap->mode & SOAP_IO_KEEPALIVE)) 4046 5112 soap->keep_alive = 0; … … 4048 5114 soap->mode |= SOAP_XML_TREE; 4049 5115 #ifndef WITH_LEANER 5116 if ((soap->mode & SOAP_ENC_MTOM) && (soap->mode & SOAP_ENC_DIME)) 5117 { soap->mode |= SOAP_ENC_MIME; 5118 soap->mode &= ~SOAP_ENC_DIME; 5119 } 5120 else 5121 soap->mode &= ~SOAP_ENC_MTOM; 4050 5122 if (soap->mode & SOAP_ENC_MIME) 4051 5123 soap_select_mime_boundary(soap); 4052 #endif4053 5124 #ifdef WIN32 4054 5125 #ifndef UNDER_CE … … 4056 5127 if (!soap_valid_socket(soap->socket)) /* Set win32 stdout or soap->sendfd to BINARY, e.g. to support DIME */ 4057 5128 #ifdef __BORLANDC__ 4058 setmode( (SOAP_SOCKET)soap->sendfd, O_BINARY);5129 setmode(soap->sendfd, O_BINARY); 4059 5130 #else 4060 _setmode((SOAP_SOCKET)soap->sendfd, _O_BINARY); 5131 _setmode(soap->sendfd, _O_BINARY); 5132 #endif 4061 5133 #endif 4062 5134 #endif … … 4073 5145 soap->mustUnderstand = 0; 4074 5146 soap->encoding = 0; 4075 soap->part = SOAP_BEGIN;4076 5147 soap->idnum = 0; 4077 5148 soap->level = 0; 5149 soap_clr_attr(soap); 5150 soap_set_local_namespaces(soap); 4078 5151 #ifdef WITH_ZLIB 4079 5152 soap->z_ratio_out = 1.0; 4080 5153 if ((soap->mode & SOAP_ENC_ZLIB) && soap->zlib_state != SOAP_ZLIB_DEFLATE) 4081 { 5154 { if (!soap->z_buf) 5155 soap->z_buf = (char*)SOAP_MALLOC(soap, SOAP_BUFLEN); 5156 soap->d_stream->next_out = (Byte*)soap->z_buf; 5157 soap->d_stream->avail_out = SOAP_BUFLEN; 4082 5158 #ifdef WITH_GZIP 4083 memcpy(soap->z_buf, "\37\213\10\0\0\0\0\0\0\377", 10); 4084 soap->d_stream.next_out = (Byte*)soap->z_buf + 10; 4085 soap->d_stream.avail_out = SOAP_BUFLEN - 10; 4086 soap->z_crc = crc32(0L, NULL, 0); 4087 if (deflateInit2(&soap->d_stream, soap->z_level, Z_DEFLATED, -MAX_WBITS, 8, Z_DEFAULT_STRATEGY) != Z_OK) 4088 #else 4089 soap->d_stream.next_out = (Byte*)soap->z_buf; 4090 soap->d_stream.avail_out = SOAP_BUFLEN; 4091 if (deflateInit(&soap->d_stream, soap->z_level) != Z_OK) 4092 #endif 5159 if (soap->zlib_out != SOAP_ZLIB_DEFLATE) 5160 { memcpy(soap->z_buf, "\37\213\10\0\0\0\0\0\0\377", 10); 5161 soap->d_stream->next_out = (Byte*)soap->z_buf + 10; 5162 soap->d_stream->avail_out = SOAP_BUFLEN - 10; 5163 soap->z_crc = crc32(0L, NULL, 0); 5164 soap->zlib_out = SOAP_ZLIB_GZIP; 5165 if (deflateInit2(soap->d_stream, soap->z_level, Z_DEFLATED, -MAX_WBITS, 8, Z_DEFAULT_STRATEGY) != Z_OK) 5166 return soap->error = SOAP_ZLIB_ERROR; 5167 } 5168 else 5169 #endif 5170 if (deflateInit(soap->d_stream, soap->z_level) != Z_OK) 4093 5171 return soap->error = SOAP_ZLIB_ERROR; 4094 5172 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Deflate initialized\n")); … … 4096 5174 } 4097 5175 #endif 4098 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Begin send phase (socket=%d mode=%x count=%lu)\n", soap->socket, soap->mode, (unsigned long)soap->count)); 5176 #ifdef WITH_OPENSSL 5177 if (soap->ssl) 5178 ERR_clear_error(); 5179 #endif 5180 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Begin send phase (socket=%d mode=0x%x count=%lu)\n", soap->socket, soap->mode, (unsigned long)soap->count)); 5181 soap->part = SOAP_BEGIN; 5182 #ifndef WITH_LEANER 4099 5183 if (soap->fprepareinit && (soap->mode & SOAP_IO) == SOAP_IO_STORE) 4100 5184 soap->fprepareinit(soap); 5185 #endif 4101 5186 return SOAP_OK; 4102 5187 } … … 4104 5189 4105 5190 /******************************************************************************/ 5191 #ifndef WITH_NOIDREF 4106 5192 #ifndef PALM_2 4107 5193 SOAP_FMAC1 … … 4117 5203 } 4118 5204 #endif 4119 4120 /******************************************************************************/ 5205 #endif 5206 5207 /******************************************************************************/ 5208 #ifndef WITH_NOIDREF 4121 5209 #ifndef PALM_2 4122 5210 SOAP_FMAC1 … … 4143 5231 } 4144 5232 #endif 4145 4146 /******************************************************************************/ 5233 #endif 5234 5235 /******************************************************************************/ 5236 #ifndef WITH_NOIDREF 4147 5237 #ifndef PALM_2 4148 5238 SOAP_FMAC1 … … 4152 5242 { register int i; 4153 5243 struct soap_plist *pp; 4154 if (!p )5244 if (!p || !a->__ptr) 4155 5245 return 1; 4156 5246 i = soap_array_pointer_lookup(soap, p, a, n, t, &pp); … … 4171 5261 } 4172 5262 #endif 4173 4174 /******************************************************************************/ 5263 #endif 5264 5265 /******************************************************************************/ 5266 #ifndef WITH_NOIDREF 4175 5267 #ifndef PALM_2 4176 5268 SOAP_FMAC1 … … 4178 5270 SOAP_FMAC2 4179 5271 soap_embedded_id(struct soap *soap, int id, const void *p, int t) 4180 { struct soap_plist *pp; 4181 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Embedded_id %p type=%d id=%d\n", p, t, id)); 5272 { struct soap_plist *pp = NULL; 4182 5273 if (soap->mode & SOAP_XML_TREE) 4183 5274 return id; 5275 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Embedded_id %p type=%d id=%d\n", p, t, id)); 4184 5276 if (soap->version == 1 && soap->encodingStyle && !(soap->mode & SOAP_XML_GRAPH) && soap->part != SOAP_IN_HEADER) 4185 5277 { if (id < 0) … … 4210 5302 } 4211 5303 #endif 4212 4213 /******************************************************************************/ 5304 #endif 5305 5306 /******************************************************************************/ 5307 #ifndef WITH_NOIDREF 4214 5308 #ifndef PALM_2 4215 5309 SOAP_FMAC1 … … 4230 5324 } 4231 5325 #endif 4232 4233 /******************************************************************************/ 5326 #endif 5327 5328 /******************************************************************************/ 5329 #ifndef WITH_NOIDREF 4234 5330 #ifndef PALM_2 4235 5331 SOAP_FMAC1 … … 4246 5342 } 4247 5343 #endif 4248 4249 /******************************************************************************/ 5344 #endif 5345 5346 /******************************************************************************/ 5347 #ifndef WITH_NOIDREF 4250 5348 #ifndef PALM_2 4251 5349 SOAP_FMAC1 … … 4261 5359 } 4262 5360 #endif 5361 #endif 4263 5362 4264 5363 /******************************************************************************/ … … 4268 5367 int 4269 5368 SOAP_FMAC2 4270 soap_element_dime(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) 4271 { struct soap_plist *pp; 5369 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) 5370 { 5371 #ifndef WITH_NOIDREF 5372 struct soap_plist *pp; 5373 int i; 4272 5374 if (!p || !a->__ptr || (!aid && !atype)) 4273 5375 return soap_element_id(soap, tag, id, p, a, n, type, t); 4274 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Attachment tag='%s' id='%s' (%d) type='%s'\n", tag, aid?aid:"", id, atype?atype:"")); 4275 if (id < 0) 4276 id = soap_array_pointer_lookup(soap, p, a, n, t, &pp); 5376 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Attachment tag='%s' id='%s' (%d) type='%s'\n", tag, aid?aid:SOAP_STR_EOS, id, atype?atype:SOAP_STR_EOS)); 5377 i = soap_array_pointer_lookup(soap, p, a, n, t, &pp); 5378 if (!i) 5379 { i = soap_pointer_enter(soap, p, a, n, t, &pp); 5380 if (!i) 5381 { soap->error = SOAP_EOM; 5382 return -1; 5383 } 5384 } 5385 if (id <= 0) 5386 id = i; 4277 5387 if (!aid) 4278 5388 { sprintf(soap->tmpbuf, soap->dime_id_format, id); 4279 5389 aid = soap_strdup(soap, soap->tmpbuf); 4280 5390 } 4281 if (soap_element_href(soap, tag, 0, "href", aid)) 5391 /* Add MTOM xop:Include element when necessary */ 5392 /* TODO: this code to be obsoleted with new import/xop.h conventions */ 5393 if ((soap->mode & SOAP_ENC_MTOM) && strcmp(tag, "xop:Include")) 5394 { if (soap_element_begin_out(soap, tag, 0, type) 5395 || soap_element_href(soap, "xop:Include", 0, "href", aid) 5396 || soap_element_end_out(soap, tag)) 5397 return soap->error; 5398 } 5399 else if (soap_element_href(soap, tag, 0, "href", aid)) 4282 5400 return soap->error; 4283 5401 if (soap->mode & SOAP_IO_LENGTH) 4284 5402 { if (pp->mark1 != 3) 4285 { struct soap_multipart *content = soap_new_multipart(soap, &soap->dime.first, &soap->dime.last, (char*)a->__ptr, a->__size); 5403 { struct soap_multipart *content; 5404 if (soap->mode & SOAP_ENC_MTOM) 5405 content = soap_new_multipart(soap, &soap->mime.first, &soap->mime.last, (char*)a->__ptr, a->__size); 5406 else 5407 content = soap_new_multipart(soap, &soap->dime.first, &soap->dime.last, (char*)a->__ptr, a->__size); 4286 5408 if (!content) 4287 return soap->error = SOAP_EOM; 4288 content->id = aid; 5409 { soap->error = SOAP_EOM; 5410 return -1; 5411 } 5412 if (!strncmp(aid, "cid:", 4)) /* RFC 2111 */ 5413 { if (soap->mode & SOAP_ENC_MTOM) 5414 { char *s = (char*)soap_malloc(soap, strlen(aid) - 1); 5415 if (s) 5416 { *s = '<'; 5417 strcpy(s + 1, aid + 4); 5418 strcat(s, ">"); 5419 content->id = s; 5420 } 5421 } 5422 else 5423 content->id = aid + 4; 5424 } 5425 else 5426 content->id = aid; 4289 5427 content->type = atype; 4290 5428 content->options = aoptions; 5429 content->encoding = SOAP_MIME_BINARY; 4291 5430 pp->mark1 = 3; 4292 5431 } … … 4294 5433 else 4295 5434 pp->mark2 = 3; 4296 return SOAP_OK; 4297 } 4298 #endif 4299 #endif 4300 4301 /******************************************************************************/ 5435 #endif 5436 return -1; 5437 } 5438 #endif 5439 #endif 5440 5441 /******************************************************************************/ 5442 #ifndef WITH_NOIDREF 4302 5443 #ifndef PALM_1 4303 5444 static void … … 4309 5450 } 4310 5451 #endif 4311 4312 /******************************************************************************/ 5452 #endif 5453 5454 /******************************************************************************/ 5455 #ifndef WITH_NOIDREF 4313 5456 #ifndef PALM_1 4314 5457 static void 4315 5458 soap_free_iht(struct soap *soap) 4316 5459 { register int i; 4317 register struct soap_ilist *ip , *p;4318 register struct soap_flist *fp , *fq;5460 register struct soap_ilist *ip = NULL, *p = NULL; 5461 register struct soap_flist *fp = NULL, *fq = NULL; 4319 5462 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free ID hashtable\n")); 4320 5463 for (i = 0; i < SOAP_IDHASH; i++) … … 4322 5465 { for (fp = ip->flist; fp; fp = fq) 4323 5466 { fq = fp->next; 4324 SOAP_FREE( fp);5467 SOAP_FREE(soap, fp); 4325 5468 } 4326 5469 p = ip->next; 4327 SOAP_FREE( ip);5470 SOAP_FREE(soap, ip); 4328 5471 } 4329 5472 soap->iht[i] = NULL; … … 4331 5474 } 4332 5475 #endif 4333 4334 /******************************************************************************/ 5476 #endif 5477 5478 /******************************************************************************/ 5479 #ifndef WITH_NOIDREF 4335 5480 #ifndef PALM_2 4336 static struct soap_ilist * 4337 soap_hlookup(struct soap *soap, const char *id) 4338 { register struct soap_ilist *ip; 5481 SOAP_FMAC1 5482 struct soap_ilist * 5483 SOAP_FMAC2 5484 soap_lookup(struct soap *soap, const char *id) 5485 { register struct soap_ilist *ip = NULL; 4339 5486 for (ip = soap->iht[soap_hash(id)]; ip; ip = ip->next) 4340 5487 if (!strcmp(ip->id, id)) … … 4343 5490 } 4344 5491 #endif 4345 4346 /******************************************************************************/ 4347 #ifndef PALM_2 4348 SOAP_FMAC1 4349 struct soap_ilist * 4350 SOAP_FMAC2 4351 soap_lookup(struct soap *soap, const char *id) 4352 { register struct soap_ilist *ip; 4353 ip = soap_hlookup(soap, id); 4354 #ifndef WITH_LEANER 4355 if (!ip && *id != '#' && !strchr(id, ':')) /* try content id "cid:" with DIME attachments */ 4356 { char cid[SOAP_TAGLEN]; 4357 strcpy(cid, "cid:"); 4358 strncat(cid + 4, id, sizeof(cid) - 5); 4359 cid[sizeof(cid) - 1] = '\0'; 4360 ip = soap_hlookup(soap, cid); 4361 } 4362 #endif 4363 return ip; 4364 } 4365 #endif 4366 4367 /******************************************************************************/ 5492 #endif 5493 5494 /******************************************************************************/ 5495 #ifndef WITH_NOIDREF 4368 5496 #ifndef PALM_2 4369 5497 SOAP_FMAC1 … … 4373 5501 { register size_t h; 4374 5502 register struct soap_ilist *ip; 4375 ip = (struct soap_ilist*)SOAP_MALLOC(s izeof(struct soap_ilist) + strlen(id));5503 ip = (struct soap_ilist*)SOAP_MALLOC(soap, sizeof(struct soap_ilist) + strlen(id)); 4376 5504 if (ip) 4377 5505 { h = soap_hash(id); … … 4379 5507 ip->next = soap->iht[h]; 4380 5508 soap->iht[h] = ip; 4381 return ip;4382 }4383 return NULL; 4384 } 5509 } 5510 return ip; 5511 } 5512 #endif 4385 5513 #endif 4386 5514 … … 4393 5521 { register char *p; 4394 5522 if (!n) 4395 return NULL;5523 return (void*)SOAP_NON_NULL; 4396 5524 if (!soap) 4397 return SOAP_MALLOC(n); 4398 n += (-(long)n) & 7; 4399 if (!(p = (char*)SOAP_MALLOC(n + sizeof(void*) + sizeof(size_t)))) 4400 { soap->error = SOAP_EOM; 4401 return NULL; 4402 } 4403 /* keep chain of alloced cells for later destruction */ 5525 return SOAP_MALLOC(soap, n); 5526 if (soap->fmalloc) 5527 p = (char*)soap->fmalloc(soap, n); 5528 else 5529 { n += sizeof(short); 5530 n += (-(long)n) & (sizeof(void*)-1); /* align at 4-, 8- or 16-byte boundary */ 5531 if (!(p = (char*)SOAP_MALLOC(soap, n + sizeof(void*) + sizeof(size_t)))) 5532 { soap->error = SOAP_EOM; 5533 return NULL; 5534 } 5535 /* set the canary to detect corruption */ 5536 *(short*)(p + n - sizeof(short)) = (short)SOAP_CANARY; 5537 /* keep chain of alloced cells for destruction */ 5538 *(void**)(p + n) = soap->alist; 5539 *(size_t*)(p + n + sizeof(void*)) = n; 5540 soap->alist = p + n; 5541 } 4404 5542 soap->alloced = 1; 4405 *(void**)(p + n) = soap->alist;4406 *(size_t*)(p + n + sizeof(void*)) = n;4407 soap->alist = p + n;4408 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Malloc %u bytes at location %p\n", (unsigned int)n, p));4409 5543 return p; 4410 5544 } … … 4412 5546 4413 5547 /******************************************************************************/ 5548 #ifdef SOAP_MEM_DEBUG 5549 static void 5550 soap_init_mht(struct soap *soap) 5551 { register int i; 5552 for (i = 0; i < (int)SOAP_PTRHASH; i++) 5553 soap->mht[i] = NULL; 5554 } 5555 #endif 5556 5557 /******************************************************************************/ 5558 #ifdef SOAP_MEM_DEBUG 5559 static void 5560 soap_free_mht(struct soap *soap) 5561 { register int i; 5562 register struct soap_mlist *mp, *mq; 5563 for (i = 0; i < (int)SOAP_PTRHASH; i++) 5564 { for (mp = soap->mht[i]; mp; mp = mq) 5565 { mq = mp->next; 5566 if (mp->live) 5567 fprintf(stderr, "%s(%d): malloc() = %p not freed (memory leak or forgot to call soap_end()?)\n", mp->file, mp->line, mp->ptr); 5568 free(mp); 5569 } 5570 soap->mht[i] = NULL; 5571 } 5572 } 5573 #endif 5574 5575 /******************************************************************************/ 5576 #ifdef SOAP_MEM_DEBUG 5577 SOAP_FMAC1 5578 void* 5579 SOAP_FMAC2 5580 soap_track_malloc(struct soap *soap, const char *file, int line, size_t size) 5581 { register void *p = malloc(size); 5582 if (soap) 5583 { register size_t h = soap_hash_ptr(p); 5584 register struct soap_mlist *mp = (struct soap_mlist*)malloc(sizeof(struct soap_mlist)); 5585 if (soap->fdebug[SOAP_INDEX_TEST]) 5586 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "%s(%d): malloc(%lu) = %p\n", file, line, (unsigned long)size, p)); 5587 } 5588 mp->next = soap->mht[h]; 5589 mp->ptr = p; 5590 mp->file = file; 5591 mp->line = line; 5592 mp->live = 1; 5593 soap->mht[h] = mp; 5594 } 5595 return p; 5596 } 5597 #endif 5598 5599 /******************************************************************************/ 5600 #ifdef SOAP_MEM_DEBUG 5601 SOAP_FMAC1 5602 void 5603 SOAP_FMAC2 5604 soap_track_free(struct soap *soap, const char *file, int line, void *p) 5605 { register size_t h = soap_hash_ptr(p); 5606 register struct soap_mlist *mp; 5607 for (mp = soap->mht[h]; mp; mp = mp->next) 5608 if (mp->ptr == p) 5609 break; 5610 if (mp) 5611 { if (mp->live) 5612 { free(p); 5613 if (soap->fdebug[SOAP_INDEX_TEST]) 5614 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "%s(%d): free(%p)\n", file, line, p)); 5615 } 5616 mp->live = 0; 5617 } 5618 else 5619 fprintf(stderr, "%s(%d): free(%p) double free of pointer malloced at %s(%d)\n", file, line, p, mp->file, mp->line); 5620 } 5621 else 5622 fprintf(stderr, "%s(%d): free(%p) pointer not malloced\n", file, line, p); 5623 } 5624 #endif 5625 5626 /******************************************************************************/ 5627 #ifdef SOAP_MEM_DEBUG 5628 static void 5629 soap_track_unlink(struct soap *soap, const void *p) 5630 { register size_t h = soap_hash_ptr(p); 5631 register struct soap_mlist *mp; 5632 for (mp = soap->mht[h]; mp; mp = mp->next) 5633 if (mp->ptr == p) 5634 break; 5635 if (mp) 5636 mp->live = 0; 5637 } 5638 #endif 5639 5640 /******************************************************************************/ 4414 5641 #ifndef PALM_2 4415 5642 SOAP_FMAC1 … … 4417 5644 SOAP_FMAC2 4418 5645 soap_dealloc(struct soap *soap, void *p) 4419 { if ( !soap)5646 { if (soap_check_state(soap)) 4420 5647 return; 4421 5648 if (p) 4422 5649 { register char **q; 4423 5650 for (q = (char**)&soap->alist; *q; q = *(char***)q) 4424 { if (p == (void*)(*q - *(size_t*)(*q + sizeof(void*)))) 5651 { 5652 if (*(short*)(char*)(*q - sizeof(short)) != (short)SOAP_CANARY) 5653 { 5654 #ifdef SOAP_MEM_DEBUG 5655 fprintf(stderr, "Data corruption in dynamic allocation (see logs)\n"); 5656 #endif 5657 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Data corruption:\n")); 5658 DBGHEX(TEST, *q - 200, 200); 5659 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "\n")); 5660 soap->error = SOAP_MOE; 5661 return; 5662 } 5663 if (p == (void*)(*q - *(size_t*)(*q + sizeof(void*)))) 4425 5664 { *q = **(char***)q; 4426 5665 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Freed data at %p\n", p)); 4427 SOAP_FREE( p);5666 SOAP_FREE(soap, p); 4428 5667 return; 4429 5668 } … … 4433 5672 else 4434 5673 { register char *q; 5674 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free all soap_malloc() data\n")); 4435 5675 while (soap->alist) 4436 5676 { q = (char*)soap->alist; 5677 if (*(short*)(char*)(q - sizeof(short)) != (short)SOAP_CANARY) 5678 { 5679 #ifdef SOAP_MEM_DEBUG 5680 fprintf(stderr, "Data corruption in dynamic allocation (see logs)\n"); 5681 #endif 5682 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Data corruption:\n")); 5683 DBGHEX(TEST, q - 200, 200); 5684 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "\n")); 5685 soap->error = SOAP_MOE; 5686 return; 5687 } 4437 5688 soap->alist = *(void**)q; 4438 5689 q -= *(size_t*)(q + sizeof(void*)); 4439 SOAP_FREE(q); 4440 } 4441 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Dealloc all data done\n")); 4442 } 4443 /* we must assume these were deallocated: */ 4444 soap->action = NULL; 4445 soap->fault = NULL; 4446 soap->header = NULL; 4447 soap->authrealm = NULL; 5690 SOAP_FREE(soap, q); 5691 } 5692 /* we must assume these were deallocated: */ 5693 soap->action = NULL; 5694 soap->fault = NULL; 5695 soap->header = NULL; 5696 soap->userid = NULL; 5697 soap->passwd = NULL; 5698 soap->authrealm = NULL; 5699 soap->http_content = NULL; 4448 5700 #ifndef WITH_LEANER 4449 soap_clr_mime(soap); 4450 #endif 5701 soap_clr_mime(soap); 5702 #endif 5703 } 4451 5704 } 4452 5705 #endif … … 4458 5711 SOAP_FMAC2 4459 5712 soap_delete(struct soap *soap, void *p) 4460 { register struct soap_clist **cp = &soap->clist; 5713 { register struct soap_clist **cp; 5714 if (soap_check_state(soap)) 5715 return; 5716 cp = &soap->clist; 4461 5717 if (p) 4462 5718 { while (*cp) … … 4464 5720 { register struct soap_clist *q = *cp; 4465 5721 *cp = q->next; 4466 q->fdelete(q); 4467 SOAP_FREE(q); 5722 if (q->fdelete(q)) 5723 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not dealloc data %p: deletion callback failed for object type %d\n", q->ptr, q->type)); 5724 #ifdef SOAP_MEM_DEBUG 5725 fprintf(stderr, "new(object type = %d) = %p not freed: deletion callback failed\n", q->type, q->ptr); 5726 #endif 5727 } 5728 SOAP_FREE(soap, q); 4468 5729 return; 4469 5730 } … … 4476 5737 { register struct soap_clist *q = *cp; 4477 5738 *cp = q->next; 4478 if (q->ptr == (void*)soap->fault) 4479 soap->fault = NULL; /* this was deallocated */ 4480 else if (q->ptr == (void*)soap->header) 4481 soap->header = NULL; /* this was deallocated */ 4482 q->fdelete(q); 4483 SOAP_FREE(q); 4484 } 4485 } 5739 if (q->fdelete(q)) 5740 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not dealloc data %p: deletion callback failed for object type %d\n", q->ptr, q->type)); 5741 #ifdef SOAP_MEM_DEBUG 5742 fprintf(stderr, "new(object type = %d) = %p not freed: deletion callback failed\n", q->type, q->ptr); 5743 #endif 5744 } 5745 SOAP_FREE(soap, q); 5746 } 5747 } 5748 soap->fault = NULL; /* this was possibly deallocated */ 5749 soap->header = NULL; /* this was possibly deallocated */ 4486 5750 } 4487 5751 #endif … … 4492 5756 struct soap_clist * 4493 5757 SOAP_FMAC2 4494 soap_link(struct soap *soap, void *p, int t, int n, void(*fdelete)(struct soap_clist*))5758 soap_link(struct soap *soap, void *p, int t, int n, int (*fdelete)(struct soap_clist*)) 4495 5759 { register struct soap_clist *cp; 4496 if ((cp = (struct soap_clist*)SOAP_MALLOC(s izeof(struct soap_clist))))5760 if ((cp = (struct soap_clist*)SOAP_MALLOC(soap, sizeof(struct soap_clist)))) 4497 5761 { cp->next = soap->clist; 4498 5762 cp->type = t; … … 4520 5784 { *q = **(char***)q; 4521 5785 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unlinked data %p\n", p)); 5786 #ifdef SOAP_MEM_DEBUG 5787 soap_track_unlink(soap, p); 5788 #endif 4522 5789 return; 4523 5790 } … … 4528 5795 q = (char**)*cp; 4529 5796 *cp = (*cp)->next; 4530 SOAP_FREE( q);5797 SOAP_FREE(soap, q); 4531 5798 return; 4532 5799 } … … 4536 5803 4537 5804 /******************************************************************************/ 5805 #ifndef WITH_NOIDREF 4538 5806 #ifndef PALM_2 4539 5807 SOAP_FMAC1 … … 4553 5821 } 4554 5822 #endif 4555 4556 /******************************************************************************/ 5823 #endif 5824 5825 /******************************************************************************/ 5826 #ifndef WITH_NOIDREF 4557 5827 #ifndef PALM_2 4558 5828 SOAP_FMAC1 … … 4562 5832 { struct soap_ilist *ip; 4563 5833 void **q; 4564 if (! id || !*id)5834 if (!p || !id || !*id) 4565 5835 return p; 4566 soap->alloced = 0;4567 if (!p)4568 p = (void**)soap_malloc(soap, sizeof(void*));4569 5836 ip = soap_lookup(soap, id); /* lookup pointer to hash table entry for string id */ 4570 5837 if (!ip) 4571 { ip = soap_enter(soap, id); /* new hash table entry for string id */ 5838 { if (!(ip = soap_enter(soap, id))) /* new hash table entry for string id */ 5839 return NULL; 4572 5840 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Forwarding first href='%s' type=%d %p (%u bytes)\n", id, t, p, (unsigned int)n)); 4573 5841 ip->type = t; … … 4585 5853 { strcpy(soap->id, id); 4586 5854 soap->error = SOAP_HREF; 4587 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Type incompatibility: id type=%d href type=%d\n", ip->type, t));5855 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Type incompatibility: href='%s' id-type=%d href-type=%d\n", id, ip->type, t)); 4588 5856 return NULL; 4589 5857 } … … 4606 5874 while (q) 4607 5875 { *r = (void*)soap_malloc(soap, sizeof(void*)); 5876 if (!*r) 5877 return NULL; 4608 5878 s = *q; 4609 5879 *q = *r; … … 4625 5895 while (ip->level < k) 4626 5896 { q = (void**)soap_malloc(soap, sizeof(void*)); 5897 if (!q) 5898 return NULL; 4627 5899 *p = q; 4628 5900 p = q; … … 4637 5909 } 4638 5910 #endif 4639 4640 /******************************************************************************/ 5911 #endif 5912 5913 /******************************************************************************/ 5914 #ifndef WITH_NOIDREF 4641 5915 #ifndef PALM_2 4642 5916 SOAP_FMAC1 4643 5917 void* 4644 5918 SOAP_FMAC2 4645 soap_id_forward(struct soap *soap, const char *href, void *p, int st, int tt, size_t n, unsigned int k, void (*fcopy)(struct soap*, int, int, void*, const void*, size_t))5919 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)) 4646 5920 { struct soap_ilist *ip; 4647 5921 if (!p || !href || !*href) … … 4649 5923 ip = soap_lookup(soap, href); /* lookup pointer to hash table entry for string id */ 4650 5924 if (!ip) 4651 { ip = soap_enter(soap, href); /* new hash table entry for string id */ 5925 { if (!(ip = soap_enter(soap, href))) /* new hash table entry for string id */ 5926 return NULL; 4652 5927 ip->type = st; 4653 5928 ip->size = n; … … 4666 5941 } 4667 5942 if (fcopy || n < sizeof(void*) || *href != '#') 4668 { register struct soap_flist *fp = (struct soap_flist*)SOAP_MALLOC(s izeof(struct soap_flist));5943 { register struct soap_flist *fp = (struct soap_flist*)SOAP_MALLOC(soap, sizeof(struct soap_flist)); 4669 5944 if (!fp) 4670 5945 { soap->error = SOAP_EOM; … … 4675 5950 fp->ptr = p; 4676 5951 fp->level = k; 5952 fp->len = len; 4677 5953 if (fcopy) 4678 5954 fp->fcopy = fcopy; … … 4680 5956 fp->fcopy = soap_fcopy; 4681 5957 ip->flist = fp; 4682 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Forwarding type=%d (target type=%d) size=%lu location=%p level=%u href='%s'\n", st, tt, (unsigned long)n, p, k, href));5958 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)); 4683 5959 } 4684 5960 else … … 4690 5966 } 4691 5967 #endif 5968 #endif 4692 5969 4693 5970 /******************************************************************************/ … … 4697 5974 SOAP_FMAC2 4698 5975 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*)) 4699 { struct soap_ilist *ip; 5976 { 5977 #ifndef WITH_NOIDREF 5978 struct soap_ilist *ip; 5979 #endif 4700 5980 DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Enter id='%s' type=%d loc=%p size=%lu level=%u\n", id, t, p, (unsigned long)n, k)); 4701 5981 soap->alloced = 0; … … 4708 5988 soap->alloced = 1; 4709 5989 } 5990 #ifndef WITH_NOIDREF 4710 5991 if (!id || !*id) 5992 #endif 4711 5993 return p; 5994 #ifndef WITH_NOIDREF 4712 5995 ip = soap_lookup(soap, id); /* lookup pointer to hash table entry for string id */ 4713 5996 DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Lookup entry id='%s for location=%p'\n", id, p)); 4714 5997 if (!ip) 4715 { ip = soap_enter(soap, id); /* new hash table entry for string id */ 5998 { if (!(ip = soap_enter(soap, id))) /* new hash table entry for string id */ 5999 return NULL; 4716 6000 ip->type = t; 4717 6001 ip->link = NULL; … … 4732 6016 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Multiply defined id='%s'\n", id)); 4733 6017 strcpy(soap->id, id); 4734 soap->error = SOAP_ MULTI_ID;6018 soap->error = SOAP_DUPLICATE_ID; 4735 6019 return NULL; 4736 6020 } … … 4742 6026 } 4743 6027 return ip->ptr; 6028 #endif 4744 6029 } 4745 6030 #endif … … 4750 6035 void 4751 6036 SOAP_FMAC2 4752 soap_fcopy(struct soap *soap, int st, int tt, void *p, const void *q, size_t n)6037 soap_fcopy(struct soap *soap, int st, int tt, void *p, size_t len, const void *q, size_t n) 4753 6038 { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Copying data type=%d (target type=%d) %p -> %p (%lu bytes)\n", st, tt, q, p, (unsigned long)n)); 4754 6039 memcpy(p, q, n); … … 4786 6071 { if (soap->mode & SOAP_ENC_ZLIB && soap->zlib_state == SOAP_ZLIB_DEFLATE) 4787 6072 { soap->zlib_state = SOAP_ZLIB_NONE; 4788 deflateEnd( &soap->d_stream);6073 deflateEnd(soap->d_stream); 4789 6074 } 4790 6075 return soap->error; … … 4796 6081 if (soap->mode & SOAP_ENC_ZLIB) 4797 6082 { int r; 4798 soap->d_stream .avail_in = 0;6083 soap->d_stream->avail_in = 0; 4799 6084 do 4800 6085 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Deflating remainder\n")); 4801 r = deflate( &soap->d_stream, Z_FINISH);4802 if (soap->d_stream .avail_out != SOAP_BUFLEN)4803 { if (soap_flush_raw(soap, soap->z_buf, SOAP_BUFLEN - soap->d_stream .avail_out))6086 r = deflate(soap->d_stream, Z_FINISH); 6087 if (soap->d_stream->avail_out != SOAP_BUFLEN) 6088 { if (soap_flush_raw(soap, soap->z_buf, SOAP_BUFLEN - soap->d_stream->avail_out)) 4804 6089 { soap->zlib_state = SOAP_ZLIB_NONE; 4805 deflateEnd( &soap->d_stream);6090 deflateEnd(soap->d_stream); 4806 6091 return soap->error; 4807 }4808 soap->d_stream .next_out = (Byte*)soap->z_buf;4809 soap->d_stream .avail_out = SOAP_BUFLEN;6092 } 6093 soap->d_stream->next_out = (Byte*)soap->z_buf; 6094 soap->d_stream->avail_out = SOAP_BUFLEN; 4810 6095 } 4811 6096 } while (r == Z_OK); 4812 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Deflated %lu->%lu bytes\n", soap->d_stream.total_in, soap->d_stream.total_out));4813 soap->z_ratio_out = (float)soap->d_stream .total_out / (float)soap->d_stream.total_in;6097 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Deflated total %lu->%lu bytes\n", soap->d_stream->total_in, soap->d_stream->total_out)); 6098 soap->z_ratio_out = (float)soap->d_stream->total_out / (float)soap->d_stream->total_in; 4814 6099 soap->mode &= ~SOAP_ENC_ZLIB; 4815 6100 soap->zlib_state = SOAP_ZLIB_NONE; 4816 if (deflateEnd( &soap->d_stream) != Z_OK || r != Z_STREAM_END)4817 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unable to end deflate: %s\n", soap->d_stream .msg?soap->d_stream.msg:""));6101 if (deflateEnd(soap->d_stream) != Z_OK || r != Z_STREAM_END) 6102 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unable to end deflate: %s\n", soap->d_stream->msg?soap->d_stream->msg:SOAP_STR_EOS)); 4818 6103 return soap->error = SOAP_ZLIB_ERROR; 4819 6104 } 4820 6105 #ifdef WITH_GZIP 4821 soap->z_buf[0] = soap->z_crc & 0xFF; 4822 soap->z_buf[1] = (soap->z_crc >> 8) & 0xFF; 4823 soap->z_buf[2] = (soap->z_crc >> 16) & 0xFF; 4824 soap->z_buf[3] = (soap->z_crc >> 24) & 0xFF; 4825 soap->z_buf[4] = soap->d_stream.total_in & 0xFF; 4826 soap->z_buf[5] = (soap->d_stream.total_in >> 8) & 0xFF; 4827 soap->z_buf[6] = (soap->d_stream.total_in >> 16) & 0xFF; 4828 soap->z_buf[7] = (soap->d_stream.total_in >> 24) & 0xFF; 4829 if (soap_flush_raw(soap, soap->z_buf, 8)) 4830 return soap->error; 4831 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "gzip crc32=%lu\n", (unsigned long)soap->z_crc)); 6106 if (soap->zlib_out != SOAP_ZLIB_DEFLATE) 6107 { soap->z_buf[0] = soap->z_crc & 0xFF; 6108 soap->z_buf[1] = (soap->z_crc >> 8) & 0xFF; 6109 soap->z_buf[2] = (soap->z_crc >> 16) & 0xFF; 6110 soap->z_buf[3] = (soap->z_crc >> 24) & 0xFF; 6111 soap->z_buf[4] = soap->d_stream->total_in & 0xFF; 6112 soap->z_buf[5] = (soap->d_stream->total_in >> 8) & 0xFF; 6113 soap->z_buf[6] = (soap->d_stream->total_in >> 16) & 0xFF; 6114 soap->z_buf[7] = (soap->d_stream->total_in >> 24) & 0xFF; 6115 if (soap_flush_raw(soap, soap->z_buf, 8)) 6116 return soap->error; 6117 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "gzip crc32=%lu\n", (unsigned long)soap->z_crc)); 6118 } 4832 6119 #endif 4833 6120 } … … 4835 6122 if ((soap->mode & SOAP_IO) == SOAP_IO_STORE) 4836 6123 { char *p; 6124 #ifndef WITH_NOHTTP 4837 6125 if (!(soap->mode & SOAP_ENC_XML)) 4838 6126 { soap->mode--; … … 4846 6134 soap->mode++; 4847 6135 } 4848 for (p = soap_first_block(soap); p; p = soap_next_block(soap)) 4849 { DBGMSG(SENT, p, soap_block_size(soap)); 4850 if ((soap->error = soap->fsend(soap, p, soap_block_size(soap)))) 4851 { soap_end_block(soap); 6136 #endif 6137 for (p = soap_first_block(soap, NULL); p; p = soap_next_block(soap, NULL)) 6138 { DBGMSG(SENT, p, soap_block_size(soap, NULL)); 6139 if ((soap->error = soap->fsend(soap, p, soap_block_size(soap, NULL)))) 6140 { soap_end_block(soap, NULL); 4852 6141 return soap->error; 4853 6142 } 4854 6143 } 4855 soap_end_block(soap); 4856 } 6144 soap_end_block(soap, NULL); 6145 } 6146 #ifndef WITH_LEANER 4857 6147 else if ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK) 4858 6148 { DBGMSG(SENT, "\r\n0\r\n\r\n", 7); … … 4860 6150 return soap->error; 4861 6151 } 4862 } 6152 #endif 6153 } 6154 #ifdef WITH_TCPFIN 4863 6155 #ifdef WITH_OPENSSL 4864 if (!soap->ssl && soap_valid_socket(soap->socket) && !soap->keep_alive )4865 soap->fshutdownsocket(soap, (SOAP_SOCKET)soap->socket, 1); /* Send TCP FIN */6156 if (!soap->ssl && soap_valid_socket(soap->socket) && !soap->keep_alive && !(soap->omode & SOAP_IO_UDP)) 6157 soap->fshutdownsocket(soap, soap->socket, 1); /* Send TCP FIN */ 4866 6158 #else 4867 if (soap_valid_socket(soap->socket) && !soap->keep_alive) 4868 soap->fshutdownsocket(soap, (SOAP_SOCKET)soap->socket, 1); /* Send TCP FIN */ 4869 #endif 4870 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End of send message ok\n")); 6159 if (soap_valid_socket(soap->socket) && !soap->keep_alive && !(soap->omode & SOAP_IO_UDP)) 6160 soap->fshutdownsocket(soap, soap->socket, 1); /* Send TCP FIN */ 6161 #endif 6162 #endif 6163 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End of send phase\n")); 6164 soap->omode &= ~SOAP_XML_SEC; 6165 soap->count = 0; 4871 6166 soap->part = SOAP_END; 4872 soap->count = 0;4873 6167 return SOAP_OK; 4874 6168 } … … 4883 6177 { soap->part = SOAP_END; 4884 6178 #ifndef WITH_LEANER 4885 if ((soap->mode & SOAP_ENC_MIME) && soap_getmime(soap)) 6179 if ((soap->mode & SOAP_ENC_DIME) && soap_getdime(soap)) 6180 { soap->dime.first = NULL; 6181 soap->dime.last = NULL; 4886 6182 return soap->error; 6183 } 6184 soap->dime.list = soap->dime.first; 6185 soap->dime.first = NULL; 6186 soap->dime.last = NULL; 6187 /* Check if MIME attachments and mime-post-check flag is set, if set call soap_resolve() and return */ 6188 if (soap->mode & SOAP_ENC_MIME) 6189 { 6190 #ifndef WITH_NOIDREF 6191 if (soap->mode & SOAP_MIME_POSTCHECK) 6192 { soap_resolve(soap); 6193 return SOAP_OK; 6194 } 6195 #endif 6196 if (soap_getmime(soap)) 6197 return soap->error; 6198 } 4887 6199 soap->mime.list = soap->mime.first; 4888 6200 soap->mime.first = NULL; 4889 6201 soap->mime.last = NULL; 4890 soap->dime.list = soap->dime.first; 4891 soap->dime.first = NULL; 4892 soap->dime.last = NULL; 6202 soap->mime.boundary = NULL; 6203 if (soap->xlist) 6204 { struct soap_multipart *content; 6205 for (content = soap->mime.list; content; content = content->next) 6206 soap_resolve_attachment(soap, content); 6207 } 4893 6208 #endif 4894 6209 DBGLOG(TEST,SOAP_MESSAGE(fdebug, "End of receive message ok\n")); 4895 6210 #ifdef WITH_ZLIB 4896 6211 if (soap->mode & SOAP_ENC_ZLIB) 4897 { soap->mode &= ~SOAP_ENC_ZLIB; 6212 { /* Make sure end of compressed content is reached */ 6213 while (soap->d_stream->next_out != Z_NULL) 6214 if ((int)soap_get1(soap) == EOF) 6215 break; 6216 soap->mode &= ~SOAP_ENC_ZLIB; 4898 6217 memcpy(soap->buf, soap->z_buf, SOAP_BUFLEN); 4899 soap->bufidx = (char*)soap->d_stream .next_in - soap->z_buf;6218 soap->bufidx = (char*)soap->d_stream->next_in - soap->z_buf; 4900 6219 soap->buflen = soap->z_buflen; 4901 6220 soap->zlib_state = SOAP_ZLIB_NONE; 4902 if (inflateEnd( &soap->d_stream) != Z_OK)6221 if (inflateEnd(soap->d_stream) != Z_OK) 4903 6222 return soap->error = SOAP_ZLIB_ERROR; 6223 DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Inflate end ok\n")); 4904 6224 #ifdef WITH_GZIP 4905 6225 if (soap->zlib_in == SOAP_ZLIB_GZIP) 4906 6226 { soap_wchar c; 4907 6227 short i; 6228 DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Inflate gzip crc check\n")); 4908 6229 for (i = 0; i < 8; i++) 4909 { if ((int)(c = soap_get char(soap)) == EOF)6230 { if ((int)(c = soap_get1(soap)) == EOF) 4910 6231 return soap->error = SOAP_EOF; 4911 6232 soap->z_buf[i] = (char)c; … … 4915 6236 return soap->error = SOAP_ZLIB_ERROR; 4916 6237 } 4917 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)))6238 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))) 4918 6239 { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Gzip error: incorrect message length\n")); 4919 6240 return soap->error = SOAP_ZLIB_ERROR; 4920 6241 } 4921 6242 } 6243 soap->zlib_in = SOAP_ZLIB_NONE; 4922 6244 #endif 4923 6245 } … … 4928 6250 if (soap->fdisconnect && (soap->error = soap->fdisconnect(soap))) 4929 6251 return soap->error; 4930 return soap_resolve(soap); 6252 #ifndef WITH_NOIDREF 6253 if (soap_resolve(soap)) 6254 return soap->error; 6255 #endif 6256 #ifndef WITH_LEANER 6257 if (soap->xlist) 6258 { if (soap->mode & SOAP_ENC_MTOM) 6259 return soap->error = SOAP_MIME_HREF; 6260 return soap->error = SOAP_DIME_HREF; 6261 } 6262 #endif 6263 soap_free_temp(soap); 6264 return SOAP_OK; 4931 6265 } 4932 6266 #endif … … 4937 6271 void 4938 6272 SOAP_FMAC2 4939 soap_free (struct soap *soap)4940 { register struct soap_nlist *np ;4941 register struct soap_attribute *tp ;6273 soap_free_temp(struct soap *soap) 6274 { register struct soap_nlist *np, *nq; 6275 register struct soap_attribute *tp, *tq; 4942 6276 register struct Namespace *ns; 4943 6277 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free namespace stack\n")); 4944 while (soap->nlist) 4945 { np = soap->nlist->next; 4946 if (soap->nlist->ns) 4947 SOAP_FREE(soap->nlist->ns); 4948 SOAP_FREE(soap->nlist); 4949 soap->nlist = np; 4950 } 6278 for (np = soap->nlist; np; np = nq) 6279 { nq = np->next; 6280 SOAP_FREE(soap, np); 6281 } 6282 soap->nlist = NULL; 4951 6283 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free any remaining temp blocks\n")); 4952 6284 while (soap->blist) 4953 soap_end_block(soap );4954 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free attribute s\n"));4955 while (soap->attributes)4956 { t p = soap->attributes->next;4957 if ( soap->attributes->value)4958 SOAP_FREE(soap ->attributes->value);4959 SOAP_FREE(soap ->attributes);4960 soap->attributes = tp;4961 }6285 soap_end_block(soap, NULL); 6286 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free attribute storage\n")); 6287 for (tp = soap->attributes; tp; tp = tq) 6288 { tq = tp->next; 6289 if (tp->value) 6290 SOAP_FREE(soap, tp->value); 6291 SOAP_FREE(soap, tp); 6292 } 6293 soap->attributes = NULL; 4962 6294 #ifdef WITH_FAST 4963 6295 if (soap->labbuf) 4964 SOAP_FREE(soap ->labbuf);6296 SOAP_FREE(soap, soap->labbuf); 4965 6297 soap->labbuf = NULL; 4966 6298 soap->lablen = 0; 4967 6299 soap->labidx = 0; 4968 6300 #endif 4969 soap_free_pht(soap);4970 soap_free_iht(soap);4971 6301 ns = soap->local_namespaces; 4972 6302 if (ns) 4973 6303 { for (; ns->id; ns++) 4974 6304 { if (ns->out) 4975 { SOAP_FREE(ns->out); 4976 if (soap->encodingStyle == ns->out) 6305 { if (soap->encodingStyle == ns->out) 4977 6306 soap->encodingStyle = SOAP_STR_EOS; 6307 SOAP_FREE(soap, ns->out); 4978 6308 ns->out = NULL; 4979 6309 } … … 4981 6311 soap->encodingStyle = SOAP_STR_EOS; 4982 6312 } 4983 SOAP_FREE(soap ->local_namespaces);6313 SOAP_FREE(soap, soap->local_namespaces); 4984 6314 soap->local_namespaces = NULL; 4985 6315 } 6316 #ifndef WITH_LEANER 6317 while (soap->xlist) 6318 { struct soap_xlist *xp = soap->xlist->next; 6319 SOAP_FREE(soap, soap->xlist); 6320 soap->xlist = xp; 6321 } 6322 #endif 6323 #ifndef WITH_NOIDREF 6324 soap_free_pht(soap); 6325 soap_free_iht(soap); 6326 #endif 4986 6327 } 4987 6328 #endif … … 5037 6378 static void 5038 6379 soap_set_logfile(struct soap *soap, int i, const char *logfile) 5039 { char *s = NULL; 6380 { const char *s; 6381 char *t = NULL; 5040 6382 soap_close_logfile(soap, i); 5041 if (soap->logfile[i]) 5042 SOAP_FREE((void*)soap->logfile[i]); 6383 s = soap->logfile[i]; 6384 soap->logfile[i] = logfile; 6385 if (s) 6386 SOAP_FREE(soap, (void*)s); 5043 6387 if (logfile) 5044 if (( s = (char*)SOAP_MALLOC(strlen(logfile) + 1)))5045 strcpy( s, logfile);5046 soap->logfile[i] = s;6388 if ((t = (char*)SOAP_MALLOC(soap, strlen(logfile) + 1))) 6389 strcpy(t, logfile); 6390 soap->logfile[i] = t; 5047 6391 } 5048 6392 #endif … … 5083 6427 struct soap* 5084 6428 SOAP_FMAC2 5085 soap_copy( struct soap *soap)5086 { return soap_copy_context((struct soap*) SOAP_MALLOC(sizeof(struct soap)), soap);6429 soap_copy(const struct soap *soap) 6430 { return soap_copy_context((struct soap*)malloc(sizeof(struct soap)), soap); 5087 6431 } 5088 6432 #endif … … 5093 6437 struct soap* 5094 6438 SOAP_FMAC2 5095 soap_copy_context(struct soap *copy, struct soap *soap) 5096 { if (copy) 5097 { register struct soap_plugin *p; 6439 soap_copy_context(struct soap *copy, const struct soap *soap) 6440 { if (soap_check_state(soap)) 6441 return NULL; 6442 if (copy) 6443 { register struct soap_plugin *p = NULL; 6444 #ifdef __cplusplus 6445 *copy = *soap; 6446 #else 5098 6447 memcpy(copy, soap, sizeof(struct soap)); 5099 copy->copy = 1; 5100 copy->user = NULL; 6448 #endif 6449 copy->state = SOAP_COPY; 6450 copy->error = SOAP_OK; 5101 6451 copy->userid = NULL; 5102 6452 copy->passwd = NULL; … … 5106 6456 copy->alist = NULL; 5107 6457 copy->attributes = NULL; 6458 copy->labbuf = NULL; 6459 copy->lablen = 0; 6460 copy->labidx = 0; 6461 #ifdef SOAP_MEM_DEBUG 6462 soap_init_mht(copy); 6463 #endif 6464 #ifdef SOAP_DEBUG 6465 soap_init_logs(copy); 6466 soap_set_recv_logfile(copy, soap->logfile[SOAP_INDEX_RECV]); 6467 soap_set_sent_logfile(copy, soap->logfile[SOAP_INDEX_SENT]); 6468 soap_set_test_logfile(copy, soap->logfile[SOAP_INDEX_TEST]); 6469 #endif 6470 #ifdef WITH_C_LOCALE 6471 copy->c_locale = duplocale(soap->c_locale); 6472 #else 6473 copy->c_locale = NULL; 6474 #endif 6475 #ifdef WITH_OPENSSL 6476 copy->bio = NULL; 6477 copy->ssl = NULL; 6478 #endif 6479 #ifdef WITH_ZLIB 6480 copy->d_stream = (z_stream*)SOAP_MALLOC(copy, sizeof(z_stream)); 6481 copy->d_stream->zalloc = Z_NULL; 6482 copy->d_stream->zfree = Z_NULL; 6483 copy->d_stream->opaque = Z_NULL; 6484 copy->z_buf = NULL; 6485 #endif 5108 6486 copy->local_namespaces = NULL; 5109 soap_set_local_namespaces(copy); 6487 #ifndef WITH_NOIDREF 5110 6488 soap_init_iht(copy); 5111 6489 soap_init_pht(copy); 6490 #endif 5112 6491 copy->header = NULL; 5113 6492 copy->fault = NULL; 5114 6493 copy->action = NULL; 5115 *copy->host = '\0';5116 6494 #ifndef WITH_LEAN 5117 6495 #ifdef WITH_COOKIES 5118 copy->cookies = soap_copy_cookies( soap);6496 copy->cookies = soap_copy_cookies(copy, soap); 5119 6497 #else 5120 6498 copy->cookies = NULL; 5121 6499 #endif 5122 6500 #endif 5123 #ifdef SOAP_DEBUG5124 soap_init_logs(copy);5125 soap_set_recv_logfile(copy, "RECV.log");5126 soap_set_sent_logfile(copy, "SENT.log");5127 soap_set_test_logfile(copy, "TEST.log");5128 #endif5129 6501 copy->plugins = NULL; 5130 6502 for (p = soap->plugins; p; p = p->next) 5131 { register struct soap_plugin *q = (struct soap_plugin*)SOAP_MALLOC( sizeof(struct soap_plugin));6503 { register struct soap_plugin *q = (struct soap_plugin*)SOAP_MALLOC(copy, sizeof(struct soap_plugin)); 5132 6504 if (!q) 5133 6505 return NULL; 5134 6506 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copying plugin '%s'\n", p->id)); 5135 6507 *q = *p; 5136 if (p->fcopy && (soap->error = p->fcopy(soap, q, p))) 5137 { SOAP_FREE(q); 6508 if (p->fcopy && p->fcopy(copy, q, p)) 6509 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not copy plugin '%s'\n", p->id)); 6510 SOAP_FREE(copy, q); 5138 6511 return NULL; 5139 6512 } … … 5142 6515 } 5143 6516 } 5144 else5145 soap->error = SOAP_EOM;5146 6517 return copy; 5147 6518 } … … 5153 6524 void 5154 6525 SOAP_FMAC2 6526 soap_copy_stream(struct soap *copy, struct soap *soap) 6527 { copy->mode = soap->mode; 6528 copy->imode = soap->imode; 6529 copy->omode = soap->omode; 6530 copy->socket = soap->socket; 6531 copy->recv_timeout = soap->recv_timeout; 6532 copy->send_timeout = soap->send_timeout; 6533 #if defined(__cplusplus) && !defined(WITH_LEAN) 6534 copy->os = soap->os; 6535 copy->is = soap->is; 6536 #endif 6537 copy->sendfd = soap->sendfd; 6538 copy->recvfd = soap->recvfd; 6539 copy->bufidx = soap->bufidx; 6540 copy->buflen = soap->buflen; 6541 copy->ahead = soap->ahead; 6542 copy->cdata = soap->cdata; 6543 copy->chunksize = soap->chunksize; 6544 copy->chunkbuflen = soap->chunkbuflen; 6545 copy->keep_alive = soap->keep_alive; 6546 copy->tcp_keep_alive = soap->tcp_keep_alive; 6547 copy->tcp_keep_idle = soap->tcp_keep_idle; 6548 copy->tcp_keep_intvl = soap->tcp_keep_intvl; 6549 copy->tcp_keep_cnt = soap->tcp_keep_cnt; 6550 copy->max_keep_alive = soap->max_keep_alive; 6551 #ifndef WITH_NOIO 6552 copy->peer = soap->peer; 6553 copy->peerlen = soap->peerlen; 6554 #endif 6555 #ifdef WITH_OPENSSL 6556 copy->bio = soap->bio; 6557 copy->ssl = soap->ssl; 6558 copy->ctx = soap->ctx; 6559 #endif 6560 #ifdef WITH_ZLIB 6561 copy->zlib_state = soap->zlib_state; 6562 copy->zlib_in = soap->zlib_in; 6563 copy->zlib_out = soap->zlib_out; 6564 copy->d_stream = (z_stream*)SOAP_MALLOC(copy, sizeof(z_stream)); 6565 memcpy(copy->d_stream, soap->d_stream, sizeof(z_stream)); 6566 copy->z_crc = soap->z_crc; 6567 copy->z_ratio_in = soap->z_ratio_in; 6568 copy->z_ratio_out = soap->z_ratio_out; 6569 copy->z_buf = NULL; 6570 copy->z_buflen = soap->z_buflen; 6571 copy->z_level = soap->z_level; 6572 if (soap->z_buf && soap->zlib_state != SOAP_ZLIB_NONE) 6573 { copy->z_buf = (char*)SOAP_MALLOC(copy, SOAP_BUFLEN); 6574 memcpy(copy->z_buf, soap->z_buf, sizeof(soap->z_buf)); 6575 } 6576 #endif 6577 memcpy(copy->buf, soap->buf, sizeof(soap->buf)); 6578 } 6579 #endif 6580 6581 /******************************************************************************/ 6582 #ifndef PALM_1 6583 SOAP_FMAC1 6584 void 6585 SOAP_FMAC2 5155 6586 soap_init(struct soap *soap) 5156 { soap->version = 0; 6587 { soap->state = SOAP_INIT; 6588 #ifdef SOAP_MEM_DEBUG 6589 soap_init_mht(soap); 6590 #endif 6591 #ifdef SOAP_DEBUG 6592 soap_init_logs(soap); 6593 soap_set_recv_logfile(soap, "RECV.log"); 6594 soap_set_sent_logfile(soap, "SENT.log"); 6595 soap_set_test_logfile(soap, "TEST.log"); 6596 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Initializing context\n")); 6597 #endif 6598 soap->version = 0; 5157 6599 soap_imode(soap, SOAP_IO_DEFAULT); 5158 6600 soap_omode(soap, SOAP_IO_DEFAULT); 5159 soap->copy = 0;5160 6601 soap->plugins = NULL; 5161 6602 soap->user = NULL; 5162 6603 soap->userid = NULL; 5163 6604 soap->passwd = NULL; 6605 #ifndef WITH_NOHTTP 5164 6606 soap->fpost = http_post; 5165 6607 soap->fget = http_get; 6608 soap->fput = http_put; 6609 soap->fdel = http_del; 6610 soap->fhead = http_head; 6611 soap->fform = NULL; 5166 6612 soap->fposthdr = http_post_header; 5167 6613 soap->fresponse = http_response; 5168 6614 soap->fparse = http_parse; 5169 6615 soap->fparsehdr = http_parse_header; 6616 #endif 6617 soap->fheader = NULL; 5170 6618 soap->fconnect = NULL; 5171 6619 soap->fdisconnect = NULL; 5172 #ifndef MAC_CARBON 6620 #ifndef WITH_NOIO 6621 soap->ipv6_multicast_if = 0; 6622 soap->ipv4_multicast_if = NULL; 5173 6623 #ifndef WITH_IPV6 5174 6624 soap->fresolve = tcp_gethost; … … 5185 6635 soap->fpoll = soap_poll; 5186 6636 #else 6637 soap->fopen = NULL; 6638 soap->fclose = NULL; 5187 6639 soap->fpoll = NULL; 5188 6640 #endif 6641 soap->fseterror = NULL; 6642 soap->fignore = NULL; 6643 soap->fserveloop = NULL; 6644 soap->fplugin = fplugin; 6645 soap->fmalloc = NULL; 6646 #ifndef WITH_LEANER 5189 6647 soap->fprepareinit = NULL; 5190 6648 soap->fpreparesend = NULL; 5191 6649 soap->fpreparerecv = NULL; 5192 soap->fignore = NULL; 5193 soap->fserveloop = NULL; 5194 soap->fplugin = fplugin; 6650 soap->fpreparefinal = NULL; 5195 6651 soap->fdimereadopen = NULL; 5196 6652 soap->fdimewriteopen = NULL; … … 5199 6655 soap->fdimeread = NULL; 5200 6656 soap->fdimewrite = NULL; 5201 soap->float_format = "%.8g"; /* .8 preserves single FP precision as much as possible, but might not be very efficient */ 5202 soap->double_format = "%.17lg"; /* .17 preserves double FP precision as much as possible, but might not be very efficient */ 6657 soap->fmimereadopen = NULL; 6658 soap->fmimewriteopen = NULL; 6659 soap->fmimereadclose = NULL; 6660 soap->fmimewriteclose = NULL; 6661 soap->fmimeread = NULL; 6662 soap->fmimewrite = NULL; 6663 #endif 6664 soap->float_format = "%.9G"; /* Alternative: use "%G" */ 6665 soap->double_format = "%.17lG"; /* Alternative: use "%lG" */ 5203 6666 soap->dime_id_format = "cid:id%d"; /* default DIME id format */ 5204 6667 soap->http_version = "1.1"; 6668 soap->proxy_http_version = "1.0"; 6669 soap->http_content = NULL; 5205 6670 soap->actor = NULL; 6671 soap->lang = "en"; 6672 soap->keep_alive = 0; 6673 soap->tcp_keep_alive = 0; 6674 soap->tcp_keep_idle = 0; 6675 soap->tcp_keep_intvl = 0; 6676 soap->tcp_keep_cnt = 0; 5206 6677 soap->max_keep_alive = SOAP_MAXKEEPALIVE; 5207 soap->keep_alive = 0;5208 6678 soap->recv_timeout = 0; 5209 6679 soap->send_timeout = 0; … … 5214 6684 soap->bind_flags = 0; 5215 6685 soap->accept_flags = 0; 6686 soap->linger_time = 0; 5216 6687 soap->ip = 0; 5217 6688 soap->labbuf = NULL; … … 5236 6707 soap->os = NULL; 5237 6708 soap->is = NULL; 6709 #ifndef WITH_LEANER 5238 6710 soap->dom = NULL; 5239 6711 soap->dime.list = NULL; … … 5245 6717 soap->mime.boundary = NULL; 5246 6718 soap->mime.start = NULL; 6719 soap->xlist = NULL; 6720 #endif 5247 6721 #ifndef UNDER_CE 5248 6722 soap->recvfd = 0; … … 5261 6735 soap->authrealm = NULL; 5262 6736 soap->prolog = NULL; 6737 #ifdef WITH_ZLIB 6738 soap->zlib_state = SOAP_ZLIB_NONE; 6739 soap->zlib_in = SOAP_ZLIB_NONE; 6740 soap->zlib_out = SOAP_ZLIB_NONE; 6741 soap->d_stream = (z_stream*)SOAP_MALLOC(soap, sizeof(z_stream)); 6742 soap->d_stream->zalloc = Z_NULL; 6743 soap->d_stream->zfree = Z_NULL; 6744 soap->d_stream->opaque = Z_NULL; 6745 soap->z_buf = NULL; 6746 soap->z_level = 6; 6747 #endif 6748 #ifndef WITH_LEAN 6749 soap->c14ninclude = NULL; 6750 soap->c14nexclude = NULL; 6751 soap->cookies = NULL; 6752 soap->cookie_domain = NULL; 6753 soap->cookie_path = NULL; 6754 soap->cookie_max = 32; 6755 #endif 6756 #ifdef WMW_RPM_IO 6757 soap->rpmreqid = NULL; 6758 #endif 6759 #ifdef PALM 6760 palmNetLibOpen(); 6761 #endif 6762 #ifndef WITH_NOIDREF 6763 soap_init_iht(soap); 6764 soap_init_pht(soap); 6765 #endif 5263 6766 #ifdef WITH_OPENSSL 6767 if (!soap_ssl_init_done) 6768 { soap_ssl_init(); 6769 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Initializing OpenSSL, version=%ld\n", (long)OPENSSL_VERSION_NUMBER)); 6770 } 5264 6771 soap->fsslauth = ssl_auth_init; 5265 6772 soap->fsslverify = ssl_verify_callback; … … 5267 6774 soap->ssl = NULL; 5268 6775 soap->ctx = NULL; 5269 soap->require_server_auth = 0; 5270 soap->require_client_auth = 0; 5271 soap->rsa = 0; 6776 soap->ssl_flags = SOAP_SSL_DEFAULT; 5272 6777 soap->keyfile = NULL; 5273 6778 soap->password = NULL; … … 5275 6780 soap->cafile = NULL; 5276 6781 soap->capath = NULL; 6782 soap->crlfile = NULL; 5277 6783 soap->randfile = NULL; 5278 6784 soap->session = NULL; 5279 6785 #endif 5280 #ifdef WITH_ZLIB 5281 soap->zlib_state = SOAP_ZLIB_NONE; 5282 soap->zlib_in = SOAP_ZLIB_NONE; 5283 soap->zlib_out = SOAP_ZLIB_NONE; 5284 soap->d_stream.zalloc = NULL; 5285 soap->d_stream.zfree = NULL; 5286 soap->d_stream.opaque = NULL; 5287 soap->z_level = 6; 5288 #endif 5289 #ifndef WITH_LEAN 5290 soap->cookies = NULL; 5291 soap->cookie_domain = NULL; 5292 soap->cookie_path = NULL; 5293 soap->cookie_max = 32; 5294 #endif 5295 #ifdef SOAP_DEBUG 5296 soap_init_logs(soap); 5297 soap_set_recv_logfile(soap, "RECV.log"); 5298 soap_set_sent_logfile(soap, "SENT.log"); 5299 soap_set_test_logfile(soap, NULL); 5300 #endif 5301 /* WR[ */ 5302 #ifdef WMW_RPM_IO 5303 soap->rpmreqid = NULL; 5304 #endif /* WMW_RPM_IO */ 5305 /* ]WR */ 5306 #ifdef PALM 5307 palmNetLibOpen(); 5308 #endif 5309 soap_init_iht(soap); 5310 soap_init_pht(soap); 6786 #ifdef WITH_C_LOCALE 6787 soap->c_locale = newlocale(LC_ALL_MASK, "C", NULL); 6788 #else 6789 soap->c_locale = NULL; 6790 #endif 5311 6791 soap_begin(soap); 5312 #ifdef SOAP_DEBUG5313 soap_set_test_logfile(soap, "TEST.log");5314 #endif5315 6792 } 5316 6793 #endif … … 5321 6798 void 5322 6799 SOAP_FMAC2 5323 soap_init1(struct soap *soap, intmode)6800 soap_init1(struct soap *soap, soap_mode mode) 5324 6801 { soap_init2(soap, mode, mode); 5325 6802 } … … 5331 6808 void 5332 6809 SOAP_FMAC2 5333 soap_init2(struct soap *soap, int imode, intomode)6810 soap_init2(struct soap *soap, soap_mode imode, soap_mode omode) 5334 6811 { soap_init(soap); 5335 6812 soap_imode(soap, imode); … … 5344 6821 SOAP_FMAC2 5345 6822 soap_begin(struct soap *soap) 5346 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, " Initializing\n"));6823 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Reinitializing context\n")); 5347 6824 if (!soap->keep_alive) 5348 6825 { soap->buflen = 0; … … 5356 6833 soap->mode = 0; 5357 6834 soap->ns = 0; 5358 soap->part = SOAP_ BEGIN;6835 soap->part = SOAP_END; 5359 6836 soap->alloced = 0; 5360 6837 soap->count = 0; … … 5367 6844 soap->level = 0; 5368 6845 soap->endpoint[0] = '\0'; 6846 #ifndef WITH_LEANER 5369 6847 soap->dime.chunksize = 0; 5370 6848 soap->dime.buflen = 0; 5371 soap_free(soap); 6849 #endif 6850 soap_free_temp(soap); 5372 6851 } 5373 6852 #endif … … 5379 6858 SOAP_FMAC2 5380 6859 soap_end(struct soap *soap) 5381 { register struct soap_clist *cp; 5382 soap_free(soap); 6860 { if (soap_check_state(soap)) 6861 return; 6862 soap_free_temp(soap); 5383 6863 soap_dealloc(soap, NULL); 5384 6864 while (soap->clist) 5385 { cp = soap->clist->next;5386 SOAP_FREE(soap ->clist);6865 { register struct soap_clist *cp = soap->clist->next; 6866 SOAP_FREE(soap, soap->clist); 5387 6867 soap->clist = cp; 5388 6868 } … … 5402 6882 int 5403 6883 SOAP_FMAC2 5404 soap_set_namespaces(struct soap *soap, struct Namespace *p)5405 { struct Namespace *ns = soap->local_namespaces;5406 struct soap_nlist *np, *nq, *nr;5407 unsigned int level = soap->level;6884 soap_set_namespaces(struct soap *soap, const struct Namespace *p) 6885 { register struct Namespace *ns = soap->local_namespaces; 6886 register struct soap_nlist *np, *nq, *nr; 6887 register unsigned int level = soap->level; 5408 6888 soap->namespaces = p; 5409 6889 soap->local_namespaces = NULL; 5410 6890 soap_set_local_namespaces(soap); 5411 /* reverse the list */6891 /* reverse the namespace list */ 5412 6892 np = soap->nlist; 5413 6893 soap->nlist = NULL; … … 5422 6902 } 5423 6903 } 6904 /* then push on new stack */ 5424 6905 while (np) 5425 { soap->level = np->level; /* preserve element nesting level */ 5426 if (np->ns) 5427 { if (soap_push_namespace(soap, np->id, np->ns)) 5428 return soap->error; 5429 } 5430 else if (np->index >= 0 && ns) 5431 { if (ns[np->index].out) 5432 { if (soap_push_namespace(soap, np->id, ns[np->index].out)) 5433 return soap->error; 5434 } 5435 else if (soap_push_namespace(soap, np->id, ns[np->index].ns)) 5436 return soap->error; 5437 } 5438 if (np->ns) 5439 SOAP_FREE(np->ns); 6906 { register const char *s; 6907 soap->level = np->level; /* preserve element nesting level */ 6908 s = np->ns; 6909 if (!s && np->index >= 0 && ns) 6910 { s = ns[np->index].out; 6911 if (!s) 6912 s = ns[np->index].ns; 6913 } 6914 if (s && soap_push_namespace(soap, np->id, s)) 6915 return soap->error; 5440 6916 nq = np; 5441 6917 np = np->next; 5442 SOAP_FREE( nq);6918 SOAP_FREE(soap, nq); 5443 6919 } 5444 6920 if (ns) 5445 { int i;6921 { register int i; 5446 6922 for (i = 0; ns[i].id; i++) 5447 6923 { if (ns[i].out) 5448 { SOAP_FREE( ns[i].out);6924 { SOAP_FREE(soap, ns[i].out); 5449 6925 ns[i].out = NULL; 5450 6926 } 5451 6927 } 5452 SOAP_FREE( ns);6928 SOAP_FREE(soap, ns); 5453 6929 } 5454 6930 soap->level = level; /* restore level */ … … 5459 6935 /******************************************************************************/ 5460 6936 #ifndef PALM_1 5461 static void 6937 SOAP_FMAC1 6938 void 6939 SOAP_FMAC2 5462 6940 soap_set_local_namespaces(struct soap *soap) 5463 6941 { if (soap->namespaces && !soap->local_namespaces) … … 5467 6945 for (ns1 = soap->namespaces; ns1->id; ns1++) 5468 6946 n++; 5469 if (n > 3) 5470 { n *= sizeof(struct Namespace); 5471 ns2 = (struct Namespace*)SOAP_MALLOC(n); 5472 if (ns2) 5473 { memcpy(ns2, soap->namespaces, n); 5474 ns2[0].id = "SOAP-ENV"; 5475 ns2[1].id = "SOAP-ENC"; 5476 ns2[2].id = "xsi"; 5477 if (ns2[0].ns) 5478 { if (!strcmp(ns2[0].ns, soap_env1)) 5479 soap->version = 1; 5480 else 5481 soap->version = 2; 5482 } 5483 soap->local_namespaces = ns2; 5484 } 5485 } 5486 } 6947 n *= sizeof(struct Namespace); 6948 ns2 = (struct Namespace*)SOAP_MALLOC(soap, n); 6949 if (ns2) 6950 { memcpy(ns2, soap->namespaces, n); 6951 if (ns2[0].ns) 6952 { if (!strcmp(ns2[0].ns, soap_env1)) 6953 soap->version = 1; 6954 else 6955 soap->version = 2; 6956 } 6957 soap->local_namespaces = ns2; 6958 } 6959 } 6960 } 6961 #endif 6962 6963 /******************************************************************************/ 6964 #ifndef WITH_LEAN 6965 #ifndef PALM_1 6966 SOAP_FMAC1 6967 const char * 6968 SOAP_FMAC2 6969 soap_strsearch(const char *big, const char *little) 6970 { size_t n = strlen(little); 6971 const char *s = big; 6972 while (s) 6973 { if (!strncmp(s, little, n) && (s[n] == '\0' || s[n] == ' ')) 6974 return s; 6975 s = strchr(s, ' '); 6976 if (s) 6977 s++; 6978 } 6979 return NULL; 6980 } 6981 #endif 6982 #endif 6983 6984 /******************************************************************************/ 6985 #ifndef WITH_LEAN 6986 #ifndef PALM_1 6987 SOAP_FMAC1 6988 struct soap_nlist * 6989 SOAP_FMAC2 6990 soap_lookup_ns(struct soap *soap, const char *tag, size_t n) 6991 { register struct soap_nlist *np; 6992 for (np = soap->nlist; np; np = np->next) 6993 { if (!strncmp(np->id, tag, n) && !np->id[n]) 6994 return np; 6995 } 6996 return NULL; 6997 } 6998 #endif 6999 #endif 7000 7001 /******************************************************************************/ 7002 #ifndef WITH_LEAN 7003 static struct soap_nlist * 7004 soap_push_ns(struct soap *soap, const char *id, const char *ns, short utilized) 7005 { register struct soap_nlist *np; 7006 size_t n, k; 7007 if (soap_strsearch(soap->c14nexclude, id)) 7008 return NULL; 7009 if (!utilized) 7010 { for (np = soap->nlist; np; np = np->next) 7011 { if (!strcmp(np->id, id) && (!np->ns || !strcmp(np->ns, ns))) 7012 break; 7013 } 7014 if (np) 7015 { if ((np->level < soap->level || !np->ns) && np->index == 1) 7016 utilized = 1; 7017 else 7018 return NULL; 7019 } 7020 } 7021 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Adding namespace binding (level=%u) '%s' '%s' utilized=%d\n", soap->level, id, ns?ns:"(null)", utilized)); 7022 n = strlen(id); 7023 if (ns) 7024 k = strlen(ns); 7025 else 7026 k = 0; 7027 np = (struct soap_nlist*)SOAP_MALLOC(soap, sizeof(struct soap_nlist) + n + k + 1); 7028 if (!np) 7029 { soap->error = SOAP_EOM; 7030 return NULL; 7031 } 7032 np->next = soap->nlist; 7033 soap->nlist = np; 7034 strcpy(np->id, id); 7035 if (ns) 7036 { np->ns = np->id + n + 1; 7037 strcpy(np->ns, ns); 7038 } 7039 else 7040 np->ns = NULL; 7041 np->level = soap->level; 7042 np->index = utilized; 7043 return np; 7044 } 7045 #endif 7046 7047 /******************************************************************************/ 7048 #ifndef WITH_LEAN 7049 static void 7050 soap_utilize_ns(struct soap *soap, const char *tag, size_t n) 7051 { register struct soap_nlist *np = soap_lookup_ns(soap, tag, n); 7052 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Utilizing namespace of '%s'\n", tag)); 7053 if (np) 7054 { if (np->index == 0) 7055 soap_push_ns(soap, np->id, np->ns, 1); 7056 } 7057 else if (strncmp(tag, "xml", 3)) 7058 { strncpy(soap->tmpbuf, tag, n); 7059 soap->tmpbuf[n] = '\0'; 7060 soap_push_ns(soap, soap->tmpbuf, NULL, 1); 7061 } 7062 } 7063 #endif 7064 7065 /******************************************************************************/ 7066 #ifndef WITH_LEAN 7067 static void 7068 soap_pop_ns(struct soap *soap) 7069 { soap_pop_namespace(soap); 5487 7070 } 5488 7071 #endif … … 5494 7077 SOAP_FMAC2 5495 7078 soap_element(struct soap *soap, const char *tag, int id, const char *type) 5496 { struct Namespace *ns = soap->local_namespaces; 5497 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Element begin tag='%s' id='%d' type='%s'\n", tag, id, type?type:"")); 5498 /**/ 7079 { 7080 #ifdef WITH_XMLNS 7081 register const char *s; 7082 #endif 7083 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Element begin tag='%s' id='%d' type='%s'\n", tag, id, type?type:SOAP_STR_EOS)); 5499 7084 #ifdef WITH_DOM 7085 if (soap->part == SOAP_BEGIN_SECURITY && (soap->mode & SOAP_XML_CANONICAL) && !(soap->mode & SOAP_DOM_ASIS)) 7086 { register struct soap_nlist *np; 7087 /* wsu:Id found: clear xmlns renderings, so re-emit them for exc-c14n */ 7088 for (np = soap->nlist; np; np = np->next) 7089 { if (np->index == 2) 7090 np->index = 0; 7091 } 7092 } 5500 7093 if (soap->mode & SOAP_XML_DOM) 5501 { register struct soap_dom_element *p, *e = (struct soap_dom_element*)soap_malloc(soap, sizeof(struct soap_dom_element)); 5502 e->next = NULL; 5503 e->prnt = soap->dom; 5504 e->nstr = NULL; 5505 e->name = soap_strdup(soap, tag); /* check EOM? */ 5506 e->data = NULL; 5507 e->type = 0; 5508 e->node = NULL; 5509 e->elts = NULL; 5510 e->atts = NULL; 7094 { register struct soap_dom_element *elt = (struct soap_dom_element*)soap_malloc(soap, sizeof(struct soap_dom_element)); 7095 if (!elt) 7096 return soap->error; 7097 elt->soap = soap; 7098 elt->next = NULL; 7099 elt->prnt = soap->dom; 7100 elt->name = soap_strdup(soap, tag); 7101 elt->elts = NULL; 7102 elt->atts = NULL; 7103 elt->nstr = NULL; 7104 elt->data = NULL; 7105 elt->wide = NULL; 7106 elt->node = NULL; 7107 elt->type = 0; 7108 elt->head = NULL; 7109 elt->tail = NULL; 5511 7110 if (soap->dom) 5512 { p = soap->dom->elts;7111 { struct soap_dom_element *p = soap->dom->elts; 5513 7112 if (p) 5514 7113 { while (p->next) 5515 7114 p = p->next; 5516 p->next = e ;7115 p->next = elt; 5517 7116 } 5518 7117 else 5519 soap->dom->elts = e ;5520 } 5521 soap->dom = e ;7118 soap->dom->elts = elt; 7119 } 7120 soap->dom = elt; 5522 7121 } 5523 7122 else 5524 #endif 5525 { 5526 soap->level++; 5527 if (!soap->ns && !(soap->mode & SOAP_XML_CANONICAL)) 5528 if (soap_send(soap, soap->prolog ? soap->prolog : "<?xml version=\"1.0\" encoding=\"UTF-8\"?>")) 7123 { 7124 #endif 7125 soap->level++; 7126 #ifndef WITH_LEAN 7127 if (!soap->ns) 7128 { if (!(soap->mode & SOAP_XML_CANONICAL) 7129 && soap_send(soap, soap->prolog ? soap->prolog : "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")) 7130 return soap->error; 7131 } 7132 else if (soap->mode & SOAP_XML_INDENT) 7133 { if (soap->ns == 1 && soap_send_raw(soap, soap_indent, soap->level < sizeof(soap_indent) ? soap->level : sizeof(soap_indent) - 1)) 7134 return soap->error; 7135 soap->body = 1; 7136 } 7137 #endif 7138 #ifdef WITH_XMLNS 7139 s = strchr(tag, ':'); 7140 if (s && strncmp(tag, "SOAP-ENV", s - tag)) 7141 { struct Namespace *ns = soap->local_namespaces; 7142 size_t n = s - tag; 7143 if (soap_send_raw(soap, "<", 1) 7144 || soap_send(soap, s + 1)) 7145 return soap->error; 7146 if (soap->nlist && !strncmp(soap->nlist->id, tag, n) && !soap->nlist->id[n]) 7147 ns = NULL; 7148 for (; ns && ns->id; ns++) 7149 { if (*ns->id && (ns->out || ns->ns) && !strncmp(ns->id, tag, n) && !ns->id[n]) 7150 { soap_push_ns(soap, ns->id, ns->out ? ns->out : ns->ns, 0); 7151 if (soap_attribute(soap, "xmlns", ns->out ? ns->out : ns->ns)) 7152 return soap->error; 7153 break; 7154 } 7155 } 7156 } 7157 else 7158 #endif 7159 if (soap_send_raw(soap, "<", 1) 7160 || soap_send(soap, tag)) 5529 7161 return soap->error; 5530 if (soap_send_raw(soap, "<", 1) 5531 || soap_send(soap, tag)) 5532 return soap->error; 5533 } 5534 /**/ 7162 #ifdef WITH_DOM 7163 } 7164 #endif 5535 7165 if (!soap->ns) 5536 { for (ns = soap->local_namespaces; ns && ns->id; ns++) 7166 { struct Namespace *ns; 7167 for (ns = soap->local_namespaces; ns && ns->id; ns++) 5537 7168 { if (*ns->id && (ns->out || ns->ns)) 5538 7169 { sprintf(soap->tmpbuf, "xmlns:%s", ns->id); … … 5541 7172 } 5542 7173 } 5543 soap->ns = 1; 5544 } 7174 } 7175 soap->ns = 1; /* namespace table control: ns = 0 or 2 to start, then 1 to stop dumping the table */ 7176 #ifndef WITH_LEAN 7177 if (soap->mode & SOAP_XML_CANONICAL) 7178 { const char *t = strchr(tag, ':'); 7179 if (t) 7180 soap_utilize_ns(soap, tag, t - tag); 7181 } 7182 #endif 5545 7183 if (id > 0) 5546 7184 { sprintf(soap->tmpbuf, "_%d", id); … … 5548 7186 return soap->error; 5549 7187 } 5550 if (type && *type )7188 if (type && *type && (!(soap->mode & SOAP_XML_SEC) || soap->part == SOAP_IN_BODY)) 5551 7189 { if (soap_attribute(soap, "xsi:type", type)) 5552 7190 return soap->error; 7191 #ifndef WITH_LEAN 7192 if (soap->mode & SOAP_XML_CANONICAL) 7193 { const char *t = strchr(type, ':'); 7194 if (t) 7195 soap_utilize_ns(soap, type, t - type); 7196 } 7197 #endif 5553 7198 } 5554 7199 if (soap->null && soap->position > 0) 5555 { int i;7200 { register int i; 5556 7201 sprintf(soap->tmpbuf, "[%d", soap->positions[0]); 5557 7202 for (i = 1; i < soap->position; i++) … … 5585 7230 soap->null = 0; 5586 7231 soap->position = 0; 7232 if (soap->part == SOAP_BEGIN_SECURITY && (soap->mode & SOAP_XML_CANONICAL)) 7233 soap->part = SOAP_IN_SECURITY; 5587 7234 return SOAP_OK; 5588 7235 } … … 5639 7286 s++; 5640 7287 while ((c = *s) && c >= '0' && c <= '9') 5641 { if (n > 214748364)7288 { if (n >= 214748364 && (n > 214748364 || c >= '8')) 5642 7289 break; 5643 7290 n *= 10; … … 5685 7332 s++; 5686 7333 while ((c = *s) && c >= '0' && c <= '9') 5687 { if (n > 429496729)7334 { if (n >= 429496729 && (n > 429496729 || c >= '6')) 5688 7335 break; 5689 7336 n *= 10; … … 5740 7387 return soap->error; 5741 7388 } 7389 #ifndef WITH_LEAN 7390 if (type && *type && (soap->mode & SOAP_XML_CANONICAL)) 7391 { const char *s = strchr(type, ':'); 7392 if (s) 7393 soap_utilize_ns(soap, type, s - type); 7394 } 7395 #endif 5742 7396 return soap_element_start_end_out(soap, NULL); 5743 7397 } … … 5751 7405 soap_element_start_end_out(struct soap *soap, const char *tag) 5752 7406 { register struct soap_attribute *tp; 5753 /**/ 7407 #ifndef WITH_LEAN 7408 if (soap->mode & SOAP_XML_CANONICAL) 7409 { struct soap_nlist *np; 7410 for (tp = soap->attributes; tp; tp = tp->next) 7411 { if (tp->visible && tp->name) 7412 { const char *s = strchr(tp->name, ':'); 7413 if (s) 7414 soap_utilize_ns(soap, tp->name, s - tp->name); 7415 } 7416 } 7417 for (np = soap->nlist; np; np = np->next) 7418 { if (np->index == 1 && np->ns) 7419 { sprintf(soap->tmpbuf, "xmlns:%s", np->id); 7420 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Enabling utilized binding (level=%u) %s='%s'\n", np->level, soap->tmpbuf, np->ns)); 7421 soap_set_attr(soap, soap->tmpbuf, np->ns); 7422 np->index = 2; 7423 } 7424 } 7425 } 7426 #endif 5754 7427 #ifdef WITH_DOM 5755 7428 if ((soap->mode & SOAP_XML_DOM) && soap->dom) 5756 { for (tp = soap->attributes; tp; tp = tp->next) 7429 { register struct soap_dom_attribute **att; 7430 att = &soap->dom->atts; 7431 for (tp = soap->attributes; tp; tp = tp->next) 5757 7432 { if (tp->visible) 5758 { register struct soap_dom_attribute *a = (struct soap_dom_attribute*)soap_malloc(soap, sizeof(struct soap_dom_attribute)); 5759 a->next = soap->dom->atts; 5760 a->nstr = NULL; 5761 a->name = soap_strdup(soap, tp->name); /* check EOM */ 5762 a->data = soap_strdup(soap, tp->value); /* check EOM */ 5763 a->wide = NULL; 5764 soap->dom->atts = a; 7433 { *att = (struct soap_dom_attribute*)soap_malloc(soap, sizeof(struct soap_dom_attribute)); 7434 if (!*att) 7435 return soap->error; 7436 (*att)->next = NULL; 7437 (*att)->nstr = NULL; 7438 (*att)->name = soap_strdup(soap, tp->name); 7439 (*att)->data = soap_strdup(soap, tp->value); 7440 (*att)->wide = NULL; 7441 (*att)->soap = soap; 7442 att = &(*att)->next; 5765 7443 tp->visible = 0; 5766 7444 } … … 5769 7447 } 5770 7448 #endif 5771 /**/5772 7449 for (tp = soap->attributes; tp; tp = tp->next) 5773 7450 { if (tp->visible) 5774 { if (soap_send2(soap, " ", tp->name)) 7451 { 7452 #ifdef WITH_XMLNS 7453 const char *s = strchr(tp->name, ':'); 7454 if (s) 7455 { size_t n = s - tp->name; 7456 if (soap->nlist && !strncmp(soap->nlist->id, tp->name, n) && !soap->nlist->id[n]) 7457 s++; 7458 else 7459 s = tp->name; 7460 if (soap_send(soap, " ") || soap_send(soap, s)) 7461 return soap->error; 7462 } 7463 else 7464 #endif 7465 if (soap_send(soap, " ") || soap_send(soap, tp->name)) 5775 7466 return soap->error; 5776 7467 if (tp->visible == 2 && tp->value) 5777 7468 if (soap_send_raw(soap, "=\"", 2) 5778 || soap_string_out(soap, tp->value, 1)5779 || soap_send_raw(soap, "\"", 1))7469 || soap_string_out(soap, tp->value, 1) 7470 || soap_send_raw(soap, "\"", 1)) 5780 7471 return soap->error; 5781 7472 tp->visible = 0; … … 5783 7474 } 5784 7475 if (tag) 5785 { soap->level--;7476 { 5786 7477 #ifndef WITH_LEAN 5787 7478 if (soap->mode & SOAP_XML_CANONICAL) … … 5792 7483 } 5793 7484 #endif 5794 return soap_send_raw(soap, "/>", 2); 7485 soap->level--; /* decrement level just before /> */ 7486 if (soap_send_raw(soap, "/>", 2)) 7487 return soap->error; 7488 return SOAP_OK; 5795 7489 } 5796 7490 return soap_send_raw(soap, ">", 1); … … 5807 7501 return SOAP_OK; 5808 7502 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Element ending tag='%s'\n", tag)); 5809 /**/5810 7503 #ifdef WITH_DOM 5811 7504 if ((soap->mode & SOAP_XML_DOM) && soap->dom) … … 5815 7508 } 5816 7509 #endif 5817 /**/ 5818 soap->level--; 7510 #ifndef WITH_LEAN 7511 if (soap->mode & SOAP_XML_CANONICAL) 7512 soap_pop_ns(soap); 7513 if (soap->mode & SOAP_XML_INDENT) 7514 { if (!soap->body) 7515 { if (soap_send_raw(soap, soap_indent, soap->level < sizeof(soap_indent) ? soap->level : sizeof(soap_indent) - 1)) 7516 return soap->error; 7517 } 7518 soap->body = 0; 7519 } 7520 #endif 7521 #ifdef WITH_XMLNS 7522 { const char *s = strchr(tag, ':'); 7523 if (s && strncmp(tag, "SOAP-ENV", s - tag)) 7524 { soap_pop_ns(soap); 7525 tag = s + 1; 7526 } 7527 } 7528 #endif 5819 7529 if (soap_send_raw(soap, "</", 2) 5820 7530 || soap_send(soap, tag)) 5821 7531 return soap->error; 7532 soap->level--; /* decrement level just before > */ 5822 7533 return soap_send_raw(soap, ">", 1); 5823 7534 } … … 5831 7542 soap_element_ref(struct soap *soap, const char *tag, int id, int href) 5832 7543 { register int n = 0; 7544 const char *s = "href"; 5833 7545 if (soap->version == 2) 7546 { s = "SOAP-ENC:ref"; 5834 7547 n = 1; 7548 } 5835 7549 sprintf(soap->href, "#_%d", href); 5836 return soap_element_href(soap, tag, id, "href" + n, soap->href + n);7550 return soap_element_href(soap, tag, id, s, soap->href + n); 5837 7551 } 5838 7552 #endif … … 5866 7580 { if (soap_element(soap, tag, id, type)) 5867 7581 return soap->error; 5868 if (soap->part != SOAP_IN_HEADER && soap->encodingStyle) 5869 if (soap_attribute(soap, "xsi:nil", "true")) 5870 return soap->error; 7582 if (!tp && soap_attribute(soap, "xsi:nil", "true")) 7583 return soap->error; 5871 7584 return soap_element_start_end_out(soap, tag); 5872 7585 } … … 5884 7597 SOAP_FMAC2 5885 7598 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) 5886 { struct soap_plist *pp; 5887 if (!p || (a && !a->__ptr)) 7599 { if (!p || (a && !a->__ptr)) 5888 7600 { soap_element_null(soap, tag, id, type); 5889 7601 return -1; 5890 7602 } 7603 #ifndef WITH_NOIDREF 5891 7604 if (soap->mode & SOAP_XML_TREE) 5892 7605 return 0; 5893 7606 if (id < 0) 5894 { if (a) 7607 { struct soap_plist *pp; 7608 if (a) 5895 7609 id = soap_array_pointer_lookup(soap, p, a, n, t, &pp); 5896 7610 else … … 5907 7621 } 5908 7622 return id; 7623 #else 7624 return 0; 7625 #endif 5909 7626 } 5910 7627 #endif … … 5917 7634 soap_element_result(struct soap *soap, const char *tag) 5918 7635 { if (soap->version == 2 && soap->encodingStyle) 5919 if (soap_element(soap, "SOAP-RPC:result", 0, NULL)7636 { if (soap_element(soap, "SOAP-RPC:result", 0, NULL) 5920 7637 || soap_attribute(soap, "xmlns:SOAP-RPC", soap_rpc) 5921 7638 || soap_element_start_end_out(soap, NULL) … … 5923 7640 || soap_element_end_out(soap, "SOAP-RPC:result")) 5924 7641 return soap->error; 7642 } 5925 7643 return SOAP_OK; 7644 } 7645 #endif 7646 7647 /******************************************************************************/ 7648 #ifndef PALM_1 7649 SOAP_FMAC1 7650 void 7651 SOAP_FMAC2 7652 soap_check_result(struct soap *soap, const char *tag) 7653 { if (soap->version == 2 && soap->encodingStyle) 7654 { soap_instring(soap, ":result", NULL, NULL, 0, 2, -1, -1); 7655 /* just ignore content for compliance reasons, but should compare tag to element's QName value? */ 7656 } 5926 7657 } 5927 7658 #endif … … 5934 7665 soap_attribute(struct soap *soap, const char *name, const char *value) 5935 7666 { 5936 /**/5937 7667 #ifdef WITH_DOM 5938 if ((soap->mode & SOAP_XML_DOM) && soap->dom)7668 if ((soap->mode & SOAP_XML_DOM) && !(soap->mode & SOAP_XML_CANONICAL) && soap->dom) 5939 7669 { register struct soap_dom_attribute *a = (struct soap_dom_attribute*)soap_malloc(soap, sizeof(struct soap_dom_attribute)); 7670 if (!a) 7671 return soap->error; 5940 7672 a->next = soap->dom->atts; 5941 7673 a->nstr = NULL; 5942 a->name = soap_strdup(soap, name); /* check EOM */5943 a->data = soap_strdup(soap, value); /* check EOM */7674 a->name = soap_strdup(soap, name); 7675 a->data = soap_strdup(soap, value); 5944 7676 a->wide = NULL; 7677 a->soap = soap; 5945 7678 soap->dom->atts = a; 5946 7679 return SOAP_OK; 5947 7680 } 5948 7681 #endif 5949 /**/5950 7682 #ifndef WITH_LEAN 5951 7683 if (soap->mode & SOAP_XML_CANONICAL) 5952 { if (soap_set_attr(soap, name, value)) 7684 { /* TODO: consider using this code to handle default namespace bindings 7685 if (!strncmp(name, "xmlns", 5) && (name[5] == ':' || name[5] == '\0')) 7686 { if (name[5] == ':') 7687 soap_push_ns(soap, name + 6, value, 0); 7688 else 7689 soap_push_ns(soap, "", value, 0); 7690 } 7691 */ 7692 if (!strncmp(name, "xmlns:", 6)) 7693 soap_push_ns(soap, name + 6, value, 0); 7694 else if (soap_set_attr(soap, name, value)) 5953 7695 return soap->error; 5954 7696 } 5955 7697 else 5956 7698 #endif 5957 { if (soap_send 2(soap, " ", name))7699 { if (soap_send(soap, " ") || soap_send(soap, name)) 5958 7700 return soap->error; 5959 7701 if (value) … … 5972 7714 int 5973 7715 SOAP_FMAC2 5974 soap_element_begin_in(struct soap *soap, const char *tag, int nillable )7716 soap_element_begin_in(struct soap *soap, const char *tag, int nillable, const char *type) 5975 7717 { if (!soap_peek_element(soap)) 5976 7718 { if (soap->other) … … 5980 7722 if (!(soap->error = soap_match_tag(soap, soap->tag, tag))) 5981 7723 { soap->peeked = 0; 7724 if (type && *soap->type && soap_match_tag(soap, soap->type, type)) 7725 return soap->error = SOAP_TYPE; 7726 if (!nillable && soap->null && (soap->mode & SOAP_XML_STRICT)) 7727 return soap->error = SOAP_NULL; 5982 7728 if (soap->body) 5983 7729 soap->level++; 5984 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Begin element found (level=%u) '%s'='%s'\n", soap->level, soap->tag, tag?tag: ""));5985 if (!nillable && soap->null && (soap->mode & SOAP_XML_STRICT))5986 return soap->error = SOAP_NULL;5987 }5988 }7730 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Begin element found (level=%u) '%s'='%s'\n", soap->level, soap->tag, tag?tag:SOAP_STR_EOS )); 7731 } 7732 } 7733 else if (soap->error == SOAP_NO_TAG && tag && *tag == '-') 7734 soap->error = SOAP_OK; 5989 7735 return soap->error; 5990 7736 } … … 5999 7745 { register soap_wchar c; 6000 7746 register char *s; 6001 register const char *t;7747 register int n = 0; 6002 7748 if (tag && *tag == '-') 6003 7749 return SOAP_OK; 6004 soap->level--; 6005 soap_pop_namespace(soap); 7750 if (soap->error == SOAP_NO_TAG) 7751 soap->error = SOAP_OK; 7752 #ifdef WITH_DOM 7753 /* this whitespace or mixed content is not insignificant for DOM */ 7754 if ((soap->mode & SOAP_XML_DOM) && soap->dom) 7755 { if (!soap->peeked && !soap_string_in(soap, 3, -1, -1)) 7756 return soap->error; 7757 if (soap->dom->prnt) 7758 soap->dom = soap->dom->prnt; 7759 } 7760 #endif 6006 7761 if (soap->peeked) 6007 { if (*soap->tag == '\0') 6008 { soap->peeked = 0; 6009 if (soap->error == SOAP_NO_TAG || soap->error == SOAP_TAG_END) 6010 soap->error = SOAP_OK; 6011 } 6012 else 6013 return soap->error = SOAP_TAG_END; 6014 } 6015 else 7762 { if (*soap->tag) 7763 n++; 7764 soap->peeked = 0; 7765 } 7766 do 6016 7767 { while (((c = soap_get(soap)) != SOAP_TT)) 6017 7768 { if ((int)c == EOF) 6018 7769 return soap->error = SOAP_EOF; 6019 7770 if (c == SOAP_LT) 6020 return soap->error = SOAP_TAG_END; 6021 } 6022 } 7771 n++; 7772 else if (c == '/') 7773 { c = soap_get(soap); 7774 if (c == SOAP_GT) 7775 n--; 7776 else 7777 soap_unget(soap, c); 7778 } 7779 } 7780 } while (n--); 6023 7781 s = soap->tag; 6024 do c = soap_get(soap); 6025 while (soap_blank(c)); 6026 do 6027 { *s++ = (char)c; 6028 c = soap_get(soap); 6029 } while (soap_notblank(c)); 7782 n = sizeof(soap->tag); 7783 while (soap_notblank(c = soap_get(soap))) 7784 { if (--n > 0) 7785 *s++ = (char)c; 7786 } 6030 7787 *s = '\0'; 6031 7788 if ((int)c == EOF) … … 6035 7792 if (c != SOAP_GT) 6036 7793 return soap->error = SOAP_SYNTAX_ERROR; 6037 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End element found (level=%u) '%s'='%s'\n", soap->level, soap->tag, tag?tag:"")); 6038 if (!tag) 6039 return SOAP_OK; 6040 if ((s = strchr(soap->tag, ':'))) 6041 s++; 6042 else 6043 s = soap->tag; 6044 if ((t = strchr(tag, ':'))) 6045 t++; 6046 else 6047 t = tag; 6048 if (!SOAP_STRCMP(s, t)) 6049 return SOAP_OK; 6050 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End element tag name does not match\n")); 6051 return soap->error = SOAP_SYNTAX_ERROR; 7794 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End element found (level=%u) '%s'='%s'\n", soap->level, soap->tag, tag?tag:SOAP_STR_EOS)); 7795 #ifndef WITH_LEAN 7796 if (tag && (soap->mode & SOAP_XML_STRICT)) 7797 { soap_pop_namespace(soap); 7798 if (soap_match_tag(soap, soap->tag, tag)) 7799 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End element tag name does not match\n")); 7800 return soap->error = SOAP_SYNTAX_ERROR; 7801 } 7802 } 7803 #endif 7804 soap->level--; 7805 return SOAP_OK; 6052 7806 } 6053 7807 #endif … … 6060 7814 soap_attr_value(struct soap *soap, const char *name, int flag) 6061 7815 { register struct soap_attribute *tp; 7816 if (*name == '-') 7817 return SOAP_STR_EOS; 6062 7818 for (tp = soap->attributes; tp; tp = tp->next) 6063 if (!soap_match_tag(soap, tp->name, name))7819 { if (tp->visible && !soap_match_tag(soap, tp->name, name)) 6064 7820 break; 6065 if (tp && tp->visible == 2) 7821 } 7822 if (tp) 6066 7823 { if (flag == 2 && (soap->mode & SOAP_XML_STRICT)) 6067 7824 soap->error = SOAP_PROHIBITED; … … 6082 7839 soap_set_attr(struct soap *soap, const char *name, const char *value) 6083 7840 { register struct soap_attribute *tp; 6084 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set attribute %s='%s'\n", name, value?value:"")); 7841 if (*name == '-') 7842 return SOAP_OK; 7843 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set attribute %s='%s'\n", name, value?value:SOAP_STR_EOS)); 6085 7844 for (tp = soap->attributes; tp; tp = tp->next) 6086 if (!strcmp(tp->name, name))7845 { if (!strcmp(tp->name, name)) 6087 7846 break; 7847 } 6088 7848 if (!tp) 6089 7849 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Allocate attribute %s\n", name)); 6090 if (!(tp = (struct soap_attribute*)SOAP_MALLOC(s izeof(struct soap_attribute) + strlen(name))))7850 if (!(tp = (struct soap_attribute*)SOAP_MALLOC(soap, sizeof(struct soap_attribute) + strlen(name)))) 6091 7851 return soap->error = SOAP_EOM; 6092 7852 tp->ns = NULL; … … 6095 7855 { struct soap_attribute **tpp = &soap->attributes; 6096 7856 const char *s = strchr(name, ':'); 7857 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inserting attribute %s for c14n\n", name)) 6097 7858 if (!strncmp(name, "xmlns", 5)) 6098 7859 { for (; *tpp; tpp = &(*tpp)->next) … … 6108 7869 { int k; 6109 7870 for (; *tpp; tpp = &(*tpp)->next) 6110 { if (!strncmp((*tpp)->name, "xmlns:", 6) && !strncmp((*tpp)->name + 6, name, s - name) && !(*tpp)->name[6 + s - name])6111 { if (!tp->ns)6112 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Canonicalization: prefix %s=%p (%s)\n", name, (*tpp)->ns, (*tpp)->ns));6113 tp->ns = (*tpp)->ns;6114 }6115 }7871 { if (!strncmp((*tpp)->name, "xmlns:", 6) && !strncmp((*tpp)->name + 6, name, s - name) && !(*tpp)->name[6 + s - name]) 7872 { if (!tp->ns) 7873 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Canonicalization: prefix %s=%p (%s)\n", name, (*tpp)->ns, (*tpp)->ns)); 7874 tp->ns = (*tpp)->ns; 7875 } 7876 } 6116 7877 else if (strncmp((*tpp)->name, "xmlns", 5) && (*tpp)->ns && tp->ns && ((k = strcmp((*tpp)->ns, tp->ns)) > 0 || (!k && strcmp((*tpp)->name, name) > 0))) 6117 7878 break; … … 6129 7890 tp->value = NULL; 6130 7891 } 7892 else if (tp->visible) 7893 { return SOAP_OK; 7894 } 6131 7895 else if (value && tp->value && tp->size <= strlen(value)) 6132 7896 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free attribute value of %s (free %p)\n", name, tp->value)); 6133 SOAP_FREE( tp->value);7897 SOAP_FREE(soap, tp->value); 6134 7898 tp->value = NULL; 6135 7899 tp->ns = NULL; … … 6138 7902 { if (!tp->value) 6139 7903 { tp->size = strlen(value) + 1; 6140 if (!(tp->value = (char*)SOAP_MALLOC( tp->size)))7904 if (!(tp->value = (char*)SOAP_MALLOC(soap, tp->size))) 6141 7905 return soap->error = SOAP_EOM; 6142 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Allocate attribute value of%s (%p)\n", tp->name, tp->value));7906 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Allocate attribute value for %s (%p)\n", tp->name, tp->value)); 6143 7907 } 6144 7908 strcpy(tp->value, value); … … 6146 7910 tp->ns = tp->value; 6147 7911 tp->visible = 2; 7912 #ifndef WITH_LEAN 7913 if (!strcmp(name, "wsu:Id")) 7914 { soap->part = SOAP_BEGIN_SECURITY; 7915 strncpy(soap->id, value, sizeof(soap->id)); 7916 soap->id[sizeof(soap->id)-1] = '\0'; 7917 } 7918 #endif 6148 7919 } 6149 7920 else … … 6161 7932 { register struct soap_attribute *tp; 6162 7933 #ifndef WITH_LEAN 6163 if ( soap->mode & SOAP_XML_CANONICAL)7934 if ((soap->mode & SOAP_XML_CANONICAL)) 6164 7935 { while (soap->attributes) 6165 7936 { tp = soap->attributes->next; 6166 SOAP_FREE(soap->attributes->value); 6167 SOAP_FREE(soap->attributes); 7937 if (soap->attributes->value) 7938 SOAP_FREE(soap, soap->attributes->value); 7939 SOAP_FREE(soap, soap->attributes); 6168 7940 soap->attributes = tp; 6169 7941 } … … 6181 7953 static int 6182 7954 soap_getattrval(struct soap *soap, char *s, size_t n, soap_wchar d) 6183 { size_t i; 6184 soap_wchar c; 7955 { register size_t i; 6185 7956 for (i = 0; i < n; i++) 6186 { c = soap_getutf8(soap);7957 { register soap_wchar c = soap_get(soap); 6187 7958 switch (c) 6188 7959 { … … 6239 8010 #ifdef WITH_FAST 6240 8011 #ifndef PALM_2 6241 static int 8012 SOAP_FMAC1 8013 int 8014 SOAP_FMAC2 8015 soap_store_lab(struct soap *soap, const char *s, size_t n) 8016 { soap->labidx = 0; 8017 return soap_append_lab(soap, s, n); 8018 } 8019 #endif 8020 #endif 8021 8022 /******************************************************************************/ 8023 #ifdef WITH_FAST 8024 #ifndef PALM_2 8025 SOAP_FMAC1 8026 int 8027 SOAP_FMAC2 6242 8028 soap_append_lab(struct soap *soap, const char *s, size_t n) 6243 8029 { if (soap->labidx + n >= soap->lablen) … … 6249 8035 soap->lablen <<= 1; 6250 8036 DBGLOG(TEST, SOAP_MESSAGE(fdebug, ", new size=%lu\n", (unsigned long)soap->lablen)); 6251 soap->labbuf = (char*)SOAP_MALLOC(soap ->lablen);8037 soap->labbuf = (char*)SOAP_MALLOC(soap, soap->lablen); 6252 8038 if (!soap->labbuf) 6253 8039 { if (t) 6254 free(t);8040 SOAP_FREE(soap, t); 6255 8041 return soap->error = SOAP_EOM; 6256 8042 } 6257 if (t && soap->labidx)8043 if (t) 6258 8044 { memcpy(soap->labbuf, t, soap->labidx); 6259 free(t);8045 SOAP_FREE(soap, t); 6260 8046 } 6261 8047 } … … 6275 8061 SOAP_FMAC2 6276 8062 soap_peek_element(struct soap *soap) 6277 { register struct soap_attribute *tp; 8063 { 8064 #ifdef WITH_DOM 8065 register struct soap_dom_attribute **att = NULL; 8066 register char *lead = NULL; 8067 #endif 8068 register struct soap_attribute *tp, *tq = NULL; 6278 8069 const char *t; 6279 8070 register char *s; 6280 8071 register soap_wchar c; 6281 8072 register int i; 6282 if (soap->error == SOAP_NO_TAG || soap->error == SOAP_TAG_END || soap->error == SOAP_TAG_MISMATCH)6283 soap->error = SOAP_OK; /* retry */6284 8073 if (soap->peeked) 6285 { if ( *soap->tag == '\0')8074 { if (!*soap->tag) 6286 8075 return soap->error = SOAP_NO_TAG; 6287 8076 return SOAP_OK; 6288 8077 } 6289 8078 soap->peeked = 1; 6290 for (;;)6291 { while (((c = soap_getutf8(soap)) != SOAP_LT) && c != SOAP_TT)6292 { if ((int)c == EOF)6293 return soap->error = SOAP_EOF;6294 }6295 if (c == SOAP_TT)6296 { *soap->tag = '\0';6297 return soap->error = SOAP_NO_TAG; /* ending tag found */6298 }6299 s = soap->tag;6300 do c = soap_get(soap);6301 while (soap_blank(c));6302 i = sizeof(soap->tag);6303 while (c != '/' && soap_notblank(c))6304 { if (--i > 0)6305 *s++ = (char)c;6306 c = soap_get(soap);6307 }6308 while (soap_blank(c))6309 c = soap_get(soap);6310 *s = '\0';6311 if (*soap->tag != '?')6312 break;6313 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "XML PI <%s?>\n", soap->tag));6314 while ((int)c != EOF && c != SOAP_GT && c != '?')6315 { s = soap->tmpbuf;6316 i = sizeof(soap->tmpbuf) - 2;6317 while (c != '=' && c != SOAP_GT && c != '?' && soap_notblank(c))6318 { if (--i > 0)6319 *s++ = (char)c;6320 c = soap_get(soap);6321 }6322 while (soap_blank(c))6323 c = soap_get(soap);6324 if (c == '=')6325 { *s++ = '=';6326 do c = soap_get(soap);6327 while (soap_blank(c));6328 if (c != SOAP_QT && c != SOAP_AP)6329 { soap_unget(soap, c);6330 c = ' '; /* blank delimiter */6331 }6332 if (soap_getattrval(soap, s, i, c) == SOAP_EOM)6333 while (soap_getattrval(soap, soap->tmpbuf, sizeof(soap->tmpbuf), c) == SOAP_EOM)6334 ;6335 else if (!strcmp(soap->tag, "?xml") && (!soap_tag_cmp(soap->tmpbuf, "encoding=iso-8859-1") || !soap_tag_cmp(soap->tmpbuf, "encoding=latin1")))6336 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "XML latin1 encoding\n"));6337 soap->mode |= SOAP_ENC_LATIN;6338 }6339 }6340 do c = soap_get(soap);6341 while (soap_blank(c));6342 }6343 }6344 8079 soap->id[0] = '\0'; 6345 8080 soap->href[0] = '\0'; … … 6353 8088 soap->null = 0; 6354 8089 soap->mustUnderstand = 0; 6355 soap_clr_attr(soap); 6356 while ((int)c != EOF && c != SOAP_GT && c != '/') 8090 c = soap_getutf8(soap); 8091 #ifdef WITH_DOM 8092 /* whitespace leading to start tag is not insignificant for DOM */ 8093 if (soap_blank(c)) 8094 { soap->labidx = 0; 8095 do 8096 { if (soap_append_lab(soap, NULL, 0)) 8097 return SOAP_EOM; 8098 s = soap->labbuf + soap->labidx; 8099 i = soap->lablen - soap->labidx; 8100 soap->labidx = soap->lablen; 8101 while (soap_blank(c) && i--) 8102 { *s++ = c; 8103 c = soap_getutf8(soap); 8104 } 8105 } 8106 while (soap_blank(c)); 8107 *s = '\0'; 8108 lead = soap_strdup(soap, soap->labbuf); 8109 } 8110 #else 8111 while (soap_blank(c)) 8112 c = soap_getutf8(soap); 8113 #endif 8114 if (c != SOAP_LT) 8115 { *soap->tag = '\0'; 8116 if ((int)c == EOF) 8117 return soap->error = SOAP_EOF; 8118 soap_unget(soap, c); 8119 #ifdef WITH_DOM 8120 /* whitespace leading to end tag is not insignificant for DOM */ 8121 if ((soap->mode & SOAP_XML_DOM) && soap->dom) 8122 soap->dom->tail = soap_strdup(soap, lead); 8123 #endif 8124 return soap->error = SOAP_NO_TAG; 8125 } 8126 s = soap->tag; 8127 do c = soap_get1(soap); 8128 while (soap_blank(c)); 8129 i = sizeof(soap->tag); 8130 while (c != '>' && c != '/' && soap_notblank(c) && (int)c != EOF) 8131 { if (--i > 0) 8132 *s++ = (char)c; 8133 c = soap_get1(soap); 8134 } 8135 while (soap_blank(c)) 8136 c = soap_get1(soap); 8137 *s = '\0'; 8138 #ifdef WITH_DOM 8139 if (soap->mode & SOAP_XML_DOM) 8140 { register struct soap_dom_element *elt; 8141 elt = (struct soap_dom_element*)soap_malloc(soap, sizeof(struct soap_dom_element)); 8142 if (!elt) 8143 return soap->error; 8144 elt->next = NULL; 8145 elt->nstr = NULL; 8146 elt->name = soap_strdup(soap, soap->tag); 8147 elt->prnt = soap->dom; 8148 elt->elts = NULL; 8149 elt->atts = NULL; 8150 elt->data = NULL; 8151 elt->wide = NULL; 8152 elt->type = 0; 8153 elt->node = NULL; 8154 elt->head = lead; 8155 elt->tail = NULL; 8156 elt->soap = soap; 8157 if (soap->dom) 8158 { struct soap_dom_element *p = soap->dom->elts; 8159 if (p) 8160 { while (p->next) 8161 p = p->next; 8162 p->next = elt; 8163 } 8164 else 8165 soap->dom->elts = elt; 8166 } 8167 soap->dom = elt; 8168 att = &elt->atts; 8169 } 8170 #endif 8171 soap_pop_namespace(soap); 8172 for (tp = soap->attributes; tp; tp = tp->next) 8173 tp->visible = 0; 8174 while ((int)c != EOF && c != '>' && c != '/') 6357 8175 { s = soap->tmpbuf; 6358 8176 i = sizeof(soap->tmpbuf); 6359 while (c != '=' && c != ' /' && soap_notblank(c))8177 while (c != '=' && c != '>' && c != '/' && soap_notblank(c) && (int)c != EOF) 6360 8178 { if (--i > 0) 6361 8179 *s++ = (char)c; 6362 c = soap_get (soap);8180 c = soap_get1(soap); 6363 8181 } 6364 8182 *s = '\0'; 6365 8183 if (i == sizeof(soap->tmpbuf)) 6366 8184 return soap->error = SOAP_SYNTAX_ERROR; 6367 if (!strncmp(soap->tmpbuf, "xmlns:", 6)) 6368 { soap->tmpbuf[5] = '\0'; 6369 t = soap->tmpbuf + 6; 6370 } 6371 else if (!strcmp(soap->tmpbuf, "xmlns")) 6372 t = SOAP_STR_EOS; 8185 #ifdef WITH_DOM 8186 /* add attribute name to dom */ 8187 if (att) 8188 { *att = (struct soap_dom_attribute*)soap_malloc(soap, sizeof(struct soap_dom_attribute)); 8189 if (!*att) 8190 return soap->error; 8191 (*att)->next = NULL; 8192 (*att)->nstr = NULL; 8193 (*att)->name = soap_strdup(soap, soap->tmpbuf); 8194 (*att)->data = NULL; 8195 (*att)->wide = NULL; 8196 (*att)->soap = soap; 8197 } 8198 #endif 8199 if (!strncmp(soap->tmpbuf, "xmlns", 5)) 8200 { if (soap->tmpbuf[5] == ':') 8201 t = soap->tmpbuf + 6; 8202 else if (soap->tmpbuf[5]) 8203 t = NULL; 8204 else 8205 t = SOAP_STR_EOS; 8206 } 6373 8207 else 6374 8208 t = NULL; 6375 for (tp = soap->attributes; tp; tp = tp->next) 6376 if (!SOAP_STRCMP(tp->name, soap->tmpbuf)) 8209 tq = NULL; 8210 for (tp = soap->attributes; tp; tq = tp, tp = tp->next) 8211 { if (!SOAP_STRCMP(tp->name, soap->tmpbuf)) 6377 8212 break; 8213 } 6378 8214 if (!tp) 6379 { tp = (struct soap_attribute*)SOAP_MALLOC(s izeof(struct soap_attribute) + strlen(soap->tmpbuf));8215 { tp = (struct soap_attribute*)SOAP_MALLOC(soap, sizeof(struct soap_attribute) + strlen(soap->tmpbuf)); 6380 8216 if (!tp) 6381 8217 return soap->error = SOAP_EOM; … … 6383 8219 tp->value = NULL; 6384 8220 tp->size = 0; 6385 tp->next = soap->attributes; 6386 soap->attributes = tp; 8221 /* if attribute name is qualified, append it to the end of the list */ 8222 if (tq && strchr(soap->tmpbuf, ':')) 8223 { tq->next = tp; 8224 tp->next = NULL; 8225 } 8226 else 8227 { tp->next = soap->attributes; 8228 soap->attributes = tp; 8229 } 6387 8230 } 6388 8231 while (soap_blank(c)) 6389 c = soap_get (soap);8232 c = soap_get1(soap); 6390 8233 if (c == '=') 6391 { do c = soap_get (soap);8234 { do c = soap_getutf8(soap); 6392 8235 while (soap_blank(c)); 6393 8236 if (c != SOAP_QT && c != SOAP_AP) … … 6401 8244 return soap->error; 6402 8245 soap->error = SOAP_OK; 6403 soap->labidx = 0; 6404 if (soap_append_lab(soap, tp->value, tp->size)) 6405 return soap->error; 6406 SOAP_FREE(tp->value);6407 for (;;)6408 { if (soap_getattrval(soap, soap->labbuf + soap->labidx, soap->lablen - soap->labidx, c))6409 { if (soap->error != SOAP_EOM)6410 return soap->error;8246 if (soap_store_lab(soap, tp->value, tp->size)) 8247 return soap->error; 8248 if (tp->value) 8249 SOAP_FREE(soap, tp->value); 8250 for (;;) 8251 { if (soap_getattrval(soap, soap->labbuf + soap->labidx, soap->lablen - soap->labidx, c)) 8252 { if (soap->error != SOAP_EOM) 8253 return soap->error; 6411 8254 soap->error = SOAP_OK; 6412 soap->labidx = soap->lablen; 6413 if (soap_append_lab(soap, NULL, 0)) 6414 return soap->error; 6415 } 6416 else 6417 break; 6418 } 6419 tp->size = soap->lablen; 6420 if (!(tp->value = (char*)SOAP_MALLOC(tp->size))) 6421 return soap->error = SOAP_EOM; 6422 memcpy(tp->value, soap->labbuf, soap->lablen); 8255 soap->labidx = soap->lablen; 8256 if (soap_append_lab(soap, NULL, 0)) 8257 return soap->error; 8258 } 8259 else 8260 break; 8261 } 8262 if (soap->labidx) 8263 tp->size = soap->lablen; 8264 else 8265 { tp->size = strlen(soap->labbuf) + 1; 8266 if (tp->size < SOAP_LABLEN) 8267 tp->size = SOAP_LABLEN; 8268 } 8269 if (!(tp->value = (char*)SOAP_MALLOC(soap, tp->size))) 8270 return soap->error = SOAP_EOM; 8271 strcpy(tp->value, soap->labbuf); 6423 8272 #else 6424 size_t n;8273 size_t n; 6425 8274 if (soap->error != SOAP_EOM) 6426 8275 return soap->error; 6427 8276 soap->error = SOAP_OK; 6428 if (soap_new_block(soap) )8277 if (soap_new_block(soap) == NULL) 6429 8278 return soap->error; 6430 8279 for (;;) 6431 { if (!(s = (char*)soap_push_block(soap, SOAP_BLKLEN)))8280 { if (!(s = (char*)soap_push_block(soap, NULL, SOAP_BLKLEN))) 6432 8281 return soap->error; 6433 8282 if (soap_getattrval(soap, s, SOAP_BLKLEN, c)) … … 6439 8288 break; 6440 8289 } 6441 n = tp->size + soap->blist->size;6442 if (!(s = (char*)SOAP_MALLOC( n)))8290 n = tp->size + soap->blist->size; 8291 if (!(s = (char*)SOAP_MALLOC(soap, n))) 6443 8292 return soap->error = SOAP_EOM; 6444 8293 if (tp->value) 6445 8294 { memcpy(s, tp->value, tp->size); 6446 SOAP_FREE( tp->value);8295 SOAP_FREE(soap, tp->value); 6447 8296 } 6448 soap_save_block(soap, s + tp->size, 0);8297 soap_save_block(soap, NULL, s + tp->size, 0); 6449 8298 tp->value = s; 6450 8299 tp->size = n; 6451 8300 #endif 6452 8301 } 6453 do c = soap_get (soap);8302 do c = soap_get1(soap); 6454 8303 while (soap_blank(c)); 6455 8304 tp->visible = 2; /* seen this attribute w/ value */ 8305 #ifdef WITH_DOM 8306 if (att) 8307 (*att)->data = soap_strdup(soap, tp->value); 8308 #endif 6456 8309 } 6457 8310 else 6458 8311 tp->visible = 1; /* seen this attribute w/o value */ 8312 #ifdef WITH_DOM 8313 if (att) 8314 att = &(*att)->next; 8315 #endif 6459 8316 if (t && tp->value) 6460 8317 { if (soap_push_namespace(soap, t, tp->value)) 6461 8318 return soap->error; 6462 tp->visible = 0; 6463 } 6464 } 8319 } 8320 } 8321 #ifdef WITH_DOM 8322 if (att) 8323 { soap->dom->nstr = soap_current_namespace(soap, soap->tag); 8324 for (att = &soap->dom->atts; *att; att = &(*att)->next) 8325 (*att)->nstr = soap_current_namespace(soap, (*att)->name); 8326 } 8327 #endif 6465 8328 if ((int)c == EOF) 6466 8329 return soap->error = SOAP_EOF; 8330 if (!(soap->body = (c != '/'))) 8331 do c = soap_get1(soap); 8332 while (soap_blank(c)); 8333 #ifdef WITH_DOM 8334 if (soap->mode & SOAP_XML_DOM) 8335 { if (!soap->body && soap->dom->prnt) 8336 soap->dom = soap->dom->prnt; 8337 } 8338 #endif 6467 8339 for (tp = soap->attributes; tp; tp = tp->next) 6468 8340 { if (tp->visible && tp->value) 6469 { if (!strcmp(tp->name, "id")) 6470 { *soap->id = '#'; 6471 strncpy(soap->id + 1, tp->value, sizeof(soap->id) - 2); 6472 soap->id[sizeof(soap->id)-1] = '\0'; 8341 { 8342 #ifndef WITH_NOIDREF 8343 if (!strcmp(tp->name, "id")) 8344 { if ((soap->version > 0 && !(soap->mode & SOAP_XML_TREE)) 8345 || (soap->mode & SOAP_XML_GRAPH)) 8346 { *soap->id = '#'; 8347 strncpy(soap->id + 1, tp->value, sizeof(soap->id) - 2); 8348 soap->id[sizeof(soap->id)-1] = '\0'; 8349 } 6473 8350 } 6474 8351 else if (!strcmp(tp->name, "href")) 6475 { strncpy(soap->href, tp->value, sizeof(soap->href) - 1); 6476 soap->href[sizeof(soap->href)-1] = '\0'; 6477 } 6478 else if ((soap->version == 2 || (soap->mode & SOAP_XML_GRAPH)) && !strcmp(tp->name, "ref")) 6479 { *soap->href = '#'; 6480 strncpy(soap->href + 1, tp->value, sizeof(soap->href) - 2); 6481 soap->href[sizeof(soap->href)-1] = '\0'; 6482 } 6483 else if (!soap_match_tag(soap, tp->name, "xsi:type")) 8352 { if (soap->version == 1 8353 || (soap->mode & SOAP_XML_GRAPH) 8354 || (soap->mode & SOAP_ENC_MTOM)) 8355 { strncpy(soap->href, tp->value, sizeof(soap->href) - 1); 8356 soap->href[sizeof(soap->href)-1] = '\0'; 8357 } 8358 } 8359 else 8360 #endif 8361 if (!soap_match_tag(soap, tp->name, "xsi:type")) 6484 8362 { strncpy(soap->type, tp->value, sizeof(soap->type) - 1); 6485 8363 soap->type[sizeof(soap->type)-1] = '\0'; 6486 8364 } 6487 else if (soap->version == 1 && !soap_match_tag(soap, tp->name, "SOAP-ENC:arrayType"))6488 { s = soap_strrchr(tp->value, '[');6489 if (s && (size_t)(s - tp->value) < sizeof(soap->arrayType))6490 { strncpy(soap->arrayType, tp->value, s - tp->value);6491 soap->arrayType[s - tp->value] = '\0';6492 strncpy(soap->arraySize, s, sizeof(soap->arraySize) - 1);6493 }6494 else6495 strncpy(soap->arrayType, tp->value, sizeof(soap->arrayType) - 1);6496 soap->arraySize[sizeof(soap->arrayType)-1] = '\0';6497 soap->arrayType[sizeof(soap->arrayType)-1] = '\0';6498 }6499 else if (soap->version == 2 && !soap_match_tag(soap, tp->name, "SOAP-ENC:itemType"))6500 strncpy(soap->arrayType, tp->value, sizeof(soap->arrayType) - 1);6501 else if (soap->version == 2 && !soap_match_tag(soap, tp->name, "SOAP-ENC:arraySize"))6502 strncpy(soap->arraySize, tp->value, sizeof(soap->arraySize) - 1);6503 else if (soap->version == 1 && !soap_match_tag(soap, tp->name, "SOAP-ENC:offset"))6504 strncpy(soap->arrayOffset, tp->value, sizeof(soap->arrayOffset));6505 else if (soap->version == 1 && !soap_match_tag(soap, tp->name, "SOAP-ENC:position"))6506 soap->position = soap_getposition(tp->value, soap->positions);6507 else if (soap->version == 1 && !soap_match_tag(soap, tp->name, "SOAP-ENC:root"))6508 soap->root = ((!strcmp(tp->value, "1") || !strcmp(tp->value, "true")));6509 else if (!soap_match_tag(soap, tp->name, "SOAP-ENV:actor")6510 || !soap_match_tag(soap, tp->name, "SOAP-ENV:role"))6511 { if ((!soap->actor || strcmp(soap->actor, tp->value))6512 && strcmp(tp->value, "http://schemas.xmlsoap.org/soap/actor/next")6513 && strcmp(tp->value, "http://www.w3.org/2003/05/soap-envelope/role/next"))6514 soap->other = 1;6515 }6516 else if (!soap_match_tag(soap, tp->name, "SOAP-ENV:mustUnderstand")6517 && (!strcmp(tp->value, "1") || !strcmp(tp->value, "true")))6518 soap->mustUnderstand = 1;6519 8365 else if ((!soap_match_tag(soap, tp->name, "xsi:null") 6520 8366 || !soap_match_tag(soap, tp->name, "xsi:nil")) 6521 8367 && (!strcmp(tp->value, "1") 6522 8368 || !strcmp(tp->value, "true"))) 6523 soap->null = 1; 6524 } 6525 } 6526 if (!(soap->body = (c != '/'))) 6527 do c = soap_get(soap); 6528 while (soap_blank(c)); 6529 return SOAP_OK; 8369 { soap->null = 1; 8370 } 8371 else if (soap->version == 1) 8372 { if (!soap_match_tag(soap, tp->name, "SOAP-ENC:arrayType")) 8373 { s = soap_strrchr(tp->value, '['); 8374 if (s && (size_t)(s - tp->value) < sizeof(soap->arrayType)) 8375 { strncpy(soap->arrayType, tp->value, s - tp->value); 8376 soap->arrayType[s - tp->value] = '\0'; 8377 strncpy(soap->arraySize, s, sizeof(soap->arraySize) - 1); 8378 } 8379 else 8380 strncpy(soap->arrayType, tp->value, sizeof(soap->arrayType) - 1); 8381 soap->arraySize[sizeof(soap->arrayType)-1] = '\0'; 8382 soap->arrayType[sizeof(soap->arrayType)-1] = '\0'; 8383 } 8384 else if (!soap_match_tag(soap, tp->name, "SOAP-ENC:offset")) 8385 strncpy(soap->arrayOffset, tp->value, sizeof(soap->arrayOffset)); 8386 else if (!soap_match_tag(soap, tp->name, "SOAP-ENC:position")) 8387 soap->position = soap_getposition(tp->value, soap->positions); 8388 else if (!soap_match_tag(soap, tp->name, "SOAP-ENC:root")) 8389 soap->root = ((!strcmp(tp->value, "1") || !strcmp(tp->value, "true"))); 8390 else if (!soap_match_tag(soap, tp->name, "SOAP-ENV:mustUnderstand") 8391 && (!strcmp(tp->value, "1") || !strcmp(tp->value, "true"))) 8392 soap->mustUnderstand = 1; 8393 else if (!soap_match_tag(soap, tp->name, "SOAP-ENV:actor")) 8394 { if ((!soap->actor || strcmp(soap->actor, tp->value)) 8395 && strcmp(tp->value, "http://schemas.xmlsoap.org/soap/actor/next")) 8396 soap->other = 1; 8397 } 8398 } 8399 else if (soap->version == 2) 8400 { 8401 #ifndef WITH_NOIDREF 8402 if (!strcmp(tp->name, "ref") 8403 || !soap_match_tag(soap, tp->name, "SOAP-ENC:ref")) 8404 { *soap->href = '#'; 8405 strncpy(soap->href + 1, tp->value, sizeof(soap->href) - 2); 8406 soap->href[sizeof(soap->href)-1] = '\0'; 8407 } 8408 else 8409 #endif 8410 if (!soap_match_tag(soap, tp->name, "SOAP-ENC:itemType")) 8411 strncpy(soap->arrayType, tp->value, sizeof(soap->arrayType) - 1); 8412 else if (!soap_match_tag(soap, tp->name, "SOAP-ENC:arraySize")) 8413 strncpy(soap->arraySize, tp->value, sizeof(soap->arraySize) - 1); 8414 else if (!soap_match_tag(soap, tp->name, "SOAP-ENV:mustUnderstand") 8415 && (!strcmp(tp->value, "1") || !strcmp(tp->value, "true"))) 8416 soap->mustUnderstand = 1; 8417 else if (!soap_match_tag(soap, tp->name, "SOAP-ENV:role")) 8418 { if ((!soap->actor || strcmp(soap->actor, tp->value)) 8419 && strcmp(tp->value, "http://www.w3.org/2003/05/soap-envelope/role/next")) 8420 soap->other = 1; 8421 } 8422 } 8423 } 8424 } 8425 return soap->error = SOAP_OK; 6530 8426 } 6531 8427 #endif … … 6537 8433 SOAP_FMAC2 6538 8434 soap_retry(struct soap *soap) 6539 { soap-> peeked = 1;6540 soap ->error = SOAP_OK;8435 { soap->error = SOAP_OK; 8436 soap_revert(soap); 6541 8437 } 6542 8438 #endif … … 6565 8461 { register const char *t; 6566 8462 register soap_wchar c; 6567 register soap_wchar mask = 0x80000000;8463 register soap_wchar mask = (soap_wchar)0xFFFFFF80UL; 6568 8464 #ifdef WITH_DOM 6569 8465 if ((soap->mode & SOAP_XML_DOM) && soap->dom) 6570 { soap->dom->data = soap_strdup(soap, s); /* check EOM */8466 { soap->dom->data = soap_strdup(soap, s); 6571 8467 return SOAP_OK; 6572 8468 } … … 6578 8474 { switch (c) 6579 8475 { 6580 case 9:8476 case 0x09: 6581 8477 if (flag) 6582 8478 { if (soap_send_raw(soap, s, t - s - 1) || soap_send_raw(soap, "	", 5)) 6583 return soap->error;8479 return soap->error; 6584 8480 s = t; 6585 8481 } 6586 8482 break; 6587 case 10:8483 case 0x0A: 6588 8484 if (flag || !(soap->mode & SOAP_XML_CANONICAL)) 6589 8485 { if (soap_send_raw(soap, s, t - s - 1) || soap_send_raw(soap, "
", 5)) 6590 return soap->error;8486 return soap->error; 6591 8487 s = t; 6592 8488 } 6593 8489 break; 6594 case 13:8490 case 0x0D: 6595 8491 if (soap_send_raw(soap, s, t - s - 1) || soap_send_raw(soap, "
", 5)) 6596 8492 return soap->error; … … 6610 8506 if (!flag) 6611 8507 { if (soap_send_raw(soap, s, t - s - 1) || soap_send_raw(soap, ">", 4)) 6612 return soap->error;8508 return soap->error; 6613 8509 s = t; 6614 8510 } … … 6617 8513 if (flag) 6618 8514 { if (soap_send_raw(soap, s, t - s - 1) || soap_send_raw(soap, """, 6)) 6619 return soap->error;8515 return soap->error; 6620 8516 s = t; 6621 8517 } 6622 8518 break; 6623 8519 default: 8520 #ifndef WITH_LEANER 6624 8521 #ifdef HAVE_MBTOWC 6625 8522 if (soap->mode & SOAP_C_MBSTRING) … … 6629 8526 { if (soap_send_raw(soap, s, t - s - 1) || soap_pututf8(soap, wc)) 6630 8527 return soap->error; 6631 s = t +m - 1;6632 continue;8528 s = t += m - 1; 8529 continue; 6633 8530 } 6634 8531 } 6635 8532 #endif 6636 if (c & mask) 8533 #endif 8534 #ifndef WITH_NOSTRINGTOUTF8 8535 if ((c & mask) || !(c & 0xFFFFFFE0UL)) 6637 8536 { if (soap_send_raw(soap, s, t - s - 1) || soap_pututf8(soap, (unsigned char)c)) 6638 8537 return soap->error; 6639 8538 s = t; 6640 8539 } 8540 #endif 6641 8541 } 6642 8542 } … … 6655 8555 register size_t i; 6656 8556 register long l = 0; 6657 register int n = 0; 6658 register int m = 0; 8557 register int n = 0, f = 0, m = 0; 6659 8558 register soap_wchar c; 6660 #if def HAVE_WCTOMB8559 #if !defined(WITH_LEANER) && defined(HAVE_WCTOMB) 6661 8560 char buf[MB_LEN_MAX > 8 ? MB_LEN_MAX : 8]; 6662 8561 #else 6663 8562 char buf[8]; 6664 8563 #endif 8564 DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Reading string content\n")); 8565 if (soap->peeked) 8566 { if (*soap->tag) 8567 { 8568 #ifndef WITH_LEAN 8569 struct soap_attribute *tp; 8570 t = soap->tmpbuf; 8571 *t = '<'; 8572 t[sizeof(soap->tmpbuf)-1] = '\0'; 8573 strncpy(t + 1, soap->tag, sizeof(soap->tmpbuf) - 2); 8574 t += strlen(t); 8575 for (tp = soap->attributes; tp; tp = tp->next) 8576 { if (tp->visible) 8577 { if (t >= soap->tmpbuf + sizeof(soap->tmpbuf) - 2) 8578 break; 8579 *t++ = ' '; 8580 strcpy(t, tp->name); 8581 t += strlen(t); 8582 if (t >= soap->tmpbuf + sizeof(soap->tmpbuf) - 2) 8583 break; /* too many or large attribute values */ 8584 if (tp->value) 8585 { *t++ = '='; 8586 *t++ = '"'; 8587 strcpy(t, tp->value); 8588 t += strlen(t); 8589 *t++ = '"'; 8590 } 8591 } 8592 } 8593 if (!soap->body) 8594 *t++ = '/'; 8595 *t++ = '>'; 8596 *t = '\0'; 8597 t = soap->tmpbuf; 8598 m = (int)strlen(soap->tmpbuf); 8599 #endif 8600 if (soap->body) 8601 n = 1; 8602 f = 1; 8603 soap->peeked = 0; 8604 } 8605 } 6665 8606 #ifdef WITH_CDATA 6666 8607 if (!flag) … … 6669 8610 soap->labidx = 0; /* use look-aside buffer */ 6670 8611 #else 6671 if (soap_new_block(soap) )8612 if (soap_new_block(soap) == NULL) 6672 8613 return NULL; 6673 8614 #endif … … 6683 8624 #else 6684 8625 register size_t k = SOAP_BLKLEN; 6685 if (!(s = (char*)soap_push_block(soap, k)))8626 if (!(s = (char*)soap_push_block(soap, NULL, k))) 6686 8627 return NULL; 6687 8628 #endif … … 6689 8630 { if (m > 0) 6690 8631 { *s++ = *t++; /* copy multibyte characters */ 6691 m--;8632 m--; 6692 8633 continue; 6693 8634 } 6694 8635 c = soap_getchar(soap); 6695 if ((int)c == EOF)8636 if ((int)c == EOF) 6696 8637 goto end; 6697 if (c >= 0x80 && !(soap->mode & SOAP_ENC_LATIN))8638 if (c >= 0x80 && state != 1 && !(soap->mode & SOAP_ENC_LATIN)) 6698 8639 { soap_unget(soap, c); 6699 c = soap_getutf8(soap);6700 if (soap->mode & SOAP_C_UTFSTRING)8640 c = soap_getutf8(soap); 8641 if (soap->mode & SOAP_C_UTFSTRING) 6701 8642 { if ((c & 0x80000000) && c >= -0x7FFFFF80 && c < SOAP_AP) 6702 8643 { c &= 0x7FFFFFFF; … … 6724 8665 } 6725 8666 *t++ = (char)(0x80 | (c & 0x3F)); 6726 m = (int)(t - buf) - 1;8667 m = (int)(t - buf) - 1; 6727 8668 t = buf; 6728 8669 *s++ = *t++; 6729 8670 continue; 6730 }8671 } 6731 8672 } 6732 8673 } 6733 switch (state)8674 switch (state) 6734 8675 { case 1: 6735 8676 if (c == ']') 6736 state = 4;6737 *s++ = c;6738 continue;6739 case 2:6740 if (c == '-')8677 state = 4; 8678 *s++ = c; 8679 continue; 8680 case 2: 8681 if (c == '-') 6741 8682 state = 6; 6742 *s++ = c;6743 continue;6744 case 3:6745 if (c == '?')6746 state = 8;6747 *s++ = c;6748 continue;8683 *s++ = c; 8684 continue; 8685 case 3: 8686 if (c == '?') 8687 state = 8; 8688 *s++ = c; 8689 continue; 6749 8690 /* CDATA */ 6750 case 4:6751 if (c == ']')8691 case 4: 8692 if (c == ']') 6752 8693 state = 5; 6753 else6754 state = 1;6755 *s++ = c;6756 continue;6757 case 5:6758 if (c == '>')6759 state = 0;6760 else6761 state = 1;6762 *s++ = c;6763 continue;8694 else 8695 state = 1; 8696 *s++ = c; 8697 continue; 8698 case 5: 8699 if (c == '>') 8700 state = 0; 8701 else 8702 state = 1; 8703 *s++ = c; 8704 continue; 6764 8705 /* comment */ 6765 8706 case 6: 6766 8707 if (c == '-') 6767 state = 7;6768 else6769 state = 2;6770 *s++ = c;6771 continue;8708 state = 7; 8709 else 8710 state = 2; 8711 *s++ = c; 8712 continue; 6772 8713 case 7: 6773 8714 if (c == '>') 6774 state = 0;6775 else6776 state = 2;6777 *s++ = c;6778 continue;8715 state = 0; 8716 else 8717 state = 2; 8718 *s++ = c; 8719 continue; 6779 8720 /* PI */ 6780 case 8:8721 case 8: 6781 8722 if (c == '>') 6782 state = 0;6783 else6784 state = 3;6785 *s++ = c;6786 continue;8723 state = 0; 8724 else 8725 state = 3; 8726 *s++ = c; 8727 continue; 6787 8728 } 6788 8729 switch (c) … … 6798 8739 break; 6799 8740 case '<': 6800 c = soap_getchar(soap);6801 if (c == '/')6802 { if (n == 0)6803 { c = SOAP_TT;6804 goto end;6805 }6806 n--;6807 }6808 else if (c == '!')6809 { c = soap_getchar(soap);6810 if (c == '[')8741 c = soap_getchar(soap); 8742 if (c == '/') 8743 { if (n == 0) 8744 { c = SOAP_TT; 8745 goto end; 8746 } 8747 n--; 8748 } 8749 else if (c == '!') 8750 { c = soap_getchar(soap); 8751 if (c == '[') 6811 8752 { do c = soap_getchar(soap); 6812 8753 while ((int)c != EOF && c != '['); 6813 8754 if ((int)c == EOF) 6814 8755 goto end; 6815 t = (char*)"![CDATA[";6816 m = 8;6817 state = 1;6818 }8756 t = (char*)"![CDATA["; 8757 m = 8; 8758 state = 1; 8759 } 6819 8760 else if (c == '-') 6820 { if ((c = soap_getchar(soap)) == '-')6821 state = 2;6822 t = (char*)"!-";6823 m = 2;6824 soap_unget(soap, c);6825 }6826 else6827 { t = (char*)"!";6828 m = 1;6829 soap_unget(soap, c);6830 }6831 *s++ = '<';6832 break;6833 }6834 else if (c == '?')6835 state = 3;6836 else6837 n++;8761 { if ((c = soap_getchar(soap)) == '-') 8762 state = 2; 8763 t = (char*)"!-"; 8764 m = 2; 8765 soap_unget(soap, c); 8766 } 8767 else 8768 { t = (char*)"!"; 8769 m = 1; 8770 soap_unget(soap, c); 8771 } 8772 *s++ = '<'; 8773 break; 8774 } 8775 else if (c == '?') 8776 state = 3; 8777 else 8778 n++; 6838 8779 soap_unget(soap, c); 6839 8780 *s++ = '<'; … … 6846 8787 break; 6847 8788 default: 8789 #ifndef WITH_LEANER 6848 8790 #ifdef HAVE_WCTOMB 6849 8791 if (soap->mode & SOAP_C_MBSTRING) 6850 8792 { m = wctomb(buf, c & 0x7FFFFFFF); 6851 if (m >= 1 )8793 if (m >= 1 && m <= (int)MB_CUR_MAX) 6852 8794 { t = buf; 6853 8795 *s++ = *t++; … … 6855 8797 } 6856 8798 else 6857 *s++ = SOAP_UNKNOWN_CHAR; 8799 { *s++ = SOAP_UNKNOWN_CHAR; 8800 m = 0; 8801 } 6858 8802 } 6859 8803 else 6860 8804 #endif 8805 #endif 6861 8806 *s++ = (char)(c & 0xFF); 6862 8807 } 6863 l++;8808 l++; 6864 8809 if ((soap->mode & SOAP_XML_STRICT) && maxlen >= 0 && l > maxlen) 6865 8810 { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "String too long: maxlen=%ld\n", maxlen)); … … 6874 8819 soap->labidx = 0; /* use look-aside buffer */ 6875 8820 #else 6876 if (soap_new_block(soap) )8821 if (soap_new_block(soap) == NULL) 6877 8822 return NULL; 6878 8823 #endif … … 6888 8833 #else 6889 8834 register size_t k = SOAP_BLKLEN; 6890 if (!(s = (char*)soap_push_block(soap, k)))8835 if (!(s = (char*)soap_push_block(soap, NULL, k))) 6891 8836 return NULL; 6892 8837 #endif … … 6923 8868 } 6924 8869 *t++ = (char)(0x80 | (c & 0x3F)); 6925 m = (int)(t - buf) - 1;8870 m = (int)(t - buf) - 1; 6926 8871 t = buf; 6927 8872 *s++ = *t++; … … 6939 8884 *s++ = '<'; 6940 8885 t = (char*)"/"; 6941 m = 1;8886 m = 1; 6942 8887 break; 6943 8888 case SOAP_LT: 8889 if (f && n == 0) 8890 goto end; 6944 8891 n++; 6945 8892 *s++ = '<'; … … 6963 8910 *s++ = '/'; 6964 8911 break; 6965 case '<' | 0x80000000:8912 case (soap_wchar)('<' | 0x80000000): 6966 8913 if (flag) 6967 8914 *s++ = '<'; … … 6969 8916 { *s++ = '&'; 6970 8917 t = (char*)"lt;"; 6971 m = 3;8918 m = 3; 6972 8919 } 6973 8920 break; 6974 case '>' | 0x80000000:8921 case (soap_wchar)('>' | 0x80000000): 6975 8922 if (flag) 6976 8923 *s++ = '>'; … … 6978 8925 { *s++ = '&'; 6979 8926 t = (char*)"gt;"; 6980 m = 3;8927 m = 3; 6981 8928 } 6982 8929 break; 6983 case '"' | 0x80000000: 8930 case (soap_wchar)('&' | 0x80000000): 8931 if (flag) 8932 *s++ = '&'; 8933 else 8934 { *s++ = '&'; 8935 t = (char*)"amp;"; 8936 m = 4; 8937 } 8938 break; 8939 case (soap_wchar)('"' | 0x80000000): 6984 8940 if (flag) 6985 8941 *s++ = '"'; … … 6987 8943 { *s++ = '&'; 6988 8944 t = (char*)"quot;"; 6989 m = 5;8945 m = 5; 6990 8946 } 6991 8947 break; 6992 case '\'' | 0x80000000:8948 case (soap_wchar)('\'' | 0x80000000): 6993 8949 if (flag) 6994 8950 *s++ = '\''; … … 6996 8952 { *s++ = '&'; 6997 8953 t = (char*)"apos;"; 6998 m = 5;8954 m = 5; 6999 8955 } 7000 8956 break; … … 7002 8958 if ((int)c == EOF) 7003 8959 goto end; 8960 #ifndef WITH_LEANER 7004 8961 #ifdef HAVE_WCTOMB 7005 8962 if (soap->mode & SOAP_C_MBSTRING) 7006 8963 { m = wctomb(buf, c & 0x7FFFFFFF); 7007 if (m >= 1 )8964 if (m >= 1 && m <= (int)MB_CUR_MAX) 7008 8965 { t = buf; 7009 8966 *s++ = *t++; … … 7011 8968 } 7012 8969 else 7013 *s++ = SOAP_UNKNOWN_CHAR; 8970 { *s++ = SOAP_UNKNOWN_CHAR; 8971 m = 0; 8972 } 7014 8973 } 7015 8974 else 8975 #endif 7016 8976 #endif 7017 8977 *s++ = (char)(c & 0xFF); … … 7031 8991 t = soap_strdup(soap, soap->labbuf); 7032 8992 #else 7033 soap_size_block(soap, i+1);8993 soap_size_block(soap, NULL, i+1); 7034 8994 t = soap_save_block(soap, NULL, 0); 7035 8995 #endif … … 7039 8999 return NULL; 7040 9000 } 9001 #ifdef WITH_DOM 9002 if ((soap->mode & SOAP_XML_DOM) && soap->dom) 9003 { if (flag == 3) 9004 soap->dom->tail = t; 9005 else 9006 soap->dom->data = t; 9007 } 9008 #endif 7041 9009 if (flag == 2) 7042 9010 if (soap_s2QName(soap, t, &t)) … … 7047 9015 7048 9016 /******************************************************************************/ 9017 #ifndef WITH_LEANER 7049 9018 #ifndef PALM_2 7050 9019 SOAP_FMAC1 … … 7057 9026 #ifdef WITH_DOM 7058 9027 if ((soap->mode & SOAP_XML_DOM) && soap->dom) 7059 { soap->dom->wide = NULL; /* soap_malloc() ??? */ 9028 { wchar_t *r = (wchar_t*)s; 9029 int n = 1; 9030 while (*r++) 9031 n++; 9032 soap->dom->wide = r = (wchar_t*)soap_malloc(soap, n * sizeof(wchar_t)); 9033 while (n--) 9034 *r++ = *s++; 7060 9035 return SOAP_OK; 7061 9036 } … … 7064 9039 { switch (c) 7065 9040 { 7066 case 9:9041 case 0x09: 7067 9042 if (flag) 7068 9043 t = "	"; … … 7070 9045 t = "\t"; 7071 9046 break; 7072 case 10:9047 case 0x0A: 7073 9048 if (flag || !(soap->mode & SOAP_XML_CANONICAL)) 7074 9049 t = "
"; … … 7076 9051 t = "\n"; 7077 9052 break; 7078 case 13:9053 case 0x0D: 7079 9054 t = "
"; 7080 9055 break; … … 7089 9064 t = ">"; 7090 9065 else 7091 t = ">";9066 t = ">"; 7092 9067 break; 7093 9068 case '"': … … 7098 9073 break; 7099 9074 default: 7100 if (c > 0 && c < 0x80)9075 if (c >= 0x20 && c < 0x80) 7101 9076 { tmp = (char)c; 7102 9077 if (soap_send_raw(soap, &tmp, 1)) … … 7113 9088 } 7114 9089 #endif 7115 7116 /******************************************************************************/ 9090 #endif 9091 9092 /******************************************************************************/ 9093 #ifndef WITH_LEANER 7117 9094 #ifndef PALM_2 7118 9095 SOAP_FMAC1 … … 7121 9098 soap_wstring_in(struct soap *soap, int flag, long minlen, long maxlen) 7122 9099 { wchar_t *s; 7123 register int i, n = 0 ;9100 register int i, n = 0, f = 0; 7124 9101 register long l = 0; 7125 9102 register soap_wchar c; 7126 const char *t = NULL; 7127 if (soap_new_block(soap)) 9103 char *t = NULL; 9104 DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Reading wide string content\n")); 9105 if (soap->peeked) 9106 { if (*soap->tag) 9107 { 9108 #ifndef WITH_LEAN 9109 struct soap_attribute *tp; 9110 t = soap->tmpbuf; 9111 *t = '<'; 9112 t[sizeof(soap->tmpbuf)-1] = '\0'; 9113 strncpy(t + 1, soap->tag, sizeof(soap->tmpbuf) - 2); 9114 t += strlen(t); 9115 for (tp = soap->attributes; tp; tp = tp->next) 9116 { if (tp->visible) 9117 { if (t >= soap->tmpbuf + sizeof(soap->tmpbuf) - 2) 9118 break; 9119 *t++ = ' '; 9120 strcpy(t, tp->name); 9121 t += strlen(t); 9122 if (t >= soap->tmpbuf + sizeof(soap->tmpbuf) - 2) 9123 break; 9124 if (tp->value) 9125 { *t++ = '='; 9126 *t++ = '"'; 9127 strcpy(t, tp->value); 9128 t += strlen(t); 9129 *t++ = '"'; 9130 } 9131 } 9132 } 9133 if (!soap->body) 9134 *t++ = '/'; 9135 *t++ = '>'; 9136 *t = '\0'; 9137 t = soap->tmpbuf; 9138 #endif 9139 if (soap->body) 9140 n = 1; 9141 f = 1; 9142 soap->peeked = 0; 9143 } 9144 } 9145 if (soap_new_block(soap) == NULL) 7128 9146 return NULL; 7129 9147 for (;;) 7130 { if (!(s = (wchar_t*)soap_push_block(soap, sizeof(wchar_t)*SOAP_BLKLEN)))9148 { if (!(s = (wchar_t*)soap_push_block(soap, NULL, sizeof(wchar_t)*SOAP_BLKLEN))) 7131 9149 return NULL; 7132 9150 for (i = 0; i < SOAP_BLKLEN; i++) … … 7148 9166 break; 7149 9167 case SOAP_LT: 9168 if (f && n == 0) 9169 goto end; 7150 9170 n++; 7151 9171 *s++ = '<'; … … 7174 9194 else 7175 9195 { *s++ = (soap_wchar)'&'; 7176 t = "lt;";9196 t = (char*)"lt;"; 7177 9197 } 7178 9198 break; … … 7182 9202 else 7183 9203 { *s++ = (soap_wchar)'&'; 7184 t = "gt;";9204 t = (char*)"gt;"; 7185 9205 } 7186 9206 break; … … 7190 9210 else 7191 9211 { *s++ = (soap_wchar)'&'; 7192 t = "quot;";9212 t = (char*)"quot;"; 7193 9213 } 7194 9214 break; … … 7209 9229 soap_unget(soap, c); 7210 9230 *s = '\0'; 7211 soap_size_block(soap, sizeof(wchar_t) * (i + 1));9231 soap_size_block(soap, NULL, sizeof(wchar_t) * (i + 1)); 7212 9232 if ((soap->mode & SOAP_XML_STRICT) && l < minlen) 7213 9233 { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "String too short: %ld chars, minlen=%ld\n", l, minlen)); … … 7215 9235 return NULL; 7216 9236 } 7217 return (wchar_t*)soap_save_block(soap, NULL, 0); 7218 } 9237 s = (wchar_t*)soap_save_block(soap, NULL, NULL, 0); 9238 #ifdef WITH_DOM 9239 if ((soap->mode & SOAP_XML_DOM) && soap->dom) 9240 soap->dom->wide = s; 9241 #endif 9242 return s; 9243 } 9244 #endif 7219 9245 #endif 7220 9246 … … 7250 9276 { if (s) 7251 9277 { char *r; 9278 #ifndef WITH_NOIO 9279 #ifndef WITH_LEAN 9280 soap_reset_errno; 9281 #endif 9282 #endif 7252 9283 *p = (int)soap_strtol(s, &r, 10); 7253 if (*r) 9284 if ((s == r && (soap->mode & SOAP_XML_STRICT)) || *r 9285 #ifndef WITH_NOIO 9286 #ifndef WITH_LEAN 9287 || soap_errno == SOAP_ERANGE 9288 #endif 9289 #endif 9290 ) 7254 9291 soap->error = SOAP_TYPE; 7255 9292 } … … 7264 9301 SOAP_FMAC2 7265 9302 soap_inint(struct soap *soap, const char *tag, int *p, const char *type, int t) 7266 { if (soap_element_begin_in(soap, tag, 0 ))9303 { if (soap_element_begin_in(soap, tag, 0, NULL)) 7267 9304 return NULL; 7268 9305 #ifndef WITH_LEAN … … 7278 9315 #endif 7279 9316 p = (int*)soap_id_enter(soap, soap->id, p, t, sizeof(int), 0, NULL, NULL, NULL); 7280 if (p) 9317 if (*soap->href) 9318 p = (int*)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(int), 0, NULL); 9319 else if (p) 7281 9320 { if (soap_s2int(soap, soap_value(soap), p)) 7282 9321 return NULL; 7283 9322 } 7284 p = (int*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(int), 0, NULL);7285 9323 if (soap->body && soap_element_end_in(soap, tag)) 7286 9324 return NULL; … … 7321 9359 { if (s) 7322 9360 { char *r; 9361 #ifndef WITH_NOIO 9362 #ifndef WITH_LEAN 9363 soap_reset_errno; 9364 #endif 9365 #endif 7323 9366 *p = soap_strtol(s, &r, 10); 7324 if (*r) 9367 if ((s == r && (soap->mode & SOAP_XML_STRICT)) || *r 9368 #ifndef WITH_NOIO 9369 #ifndef WITH_LEAN 9370 || soap_errno == SOAP_ERANGE 9371 #endif 9372 #endif 9373 ) 7325 9374 soap->error = SOAP_TYPE; 7326 9375 } … … 7335 9384 SOAP_FMAC2 7336 9385 soap_inlong(struct soap *soap, const char *tag, long *p, const char *type, int t) 7337 { if (soap_element_begin_in(soap, tag, 0 ))9386 { if (soap_element_begin_in(soap, tag, 0, NULL)) 7338 9387 return NULL; 7339 9388 #ifndef WITH_LEAN … … 7349 9398 #endif 7350 9399 p = (long*)soap_id_enter(soap, soap->id, p, t, sizeof(long), 0, NULL, NULL, NULL); 7351 if (p) 9400 if (*soap->href) 9401 p = (long*)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(long), 0, NULL); 9402 else if (p) 7352 9403 { if (soap_s2long(soap, soap_value(soap), p)) 7353 9404 return NULL; 7354 9405 } 7355 p = (long*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(long), 0, NULL);7356 9406 if (soap->body && soap_element_end_in(soap, tag)) 7357 9407 return NULL; … … 7390 9440 SOAP_FMAC2 7391 9441 soap_s2LONG64(struct soap *soap, const char *s, LONG64 *p) 7392 { if (s && sscanf(s, SOAP_LONG_FORMAT, p) != 1) 7393 soap->error = SOAP_TYPE; 9442 { if (s) 9443 { 9444 #ifdef HAVE_STRTOLL 9445 char *r; 9446 #ifndef WITH_NOIO 9447 #ifndef WITH_LEAN 9448 soap_reset_errno; 9449 #endif 9450 #endif 9451 *p = strtoll(s, &r, 10); 9452 if ((s == r && (soap->mode & SOAP_XML_STRICT)) || *r 9453 #ifndef WITH_NOIO 9454 #ifndef WITH_LEAN 9455 || soap_errno == SOAP_ERANGE 9456 #endif 9457 #endif 9458 ) 9459 #else 9460 # ifdef HAVE_SSCANF 9461 if (sscanf(s, SOAP_LONG_FORMAT, p) != 1) 9462 # endif 9463 #endif 9464 soap->error = SOAP_TYPE; 9465 } 7394 9466 return soap->error; 7395 9467 } … … 7402 9474 SOAP_FMAC2 7403 9475 soap_inLONG64(struct soap *soap, const char *tag, LONG64 *p, const char *type, int t) 7404 { if (soap_element_begin_in(soap, tag, 0 ))9476 { if (soap_element_begin_in(soap, tag, 0, NULL)) 7405 9477 return NULL; 7406 9478 #ifndef WITH_LEAN … … 7422 9494 #endif 7423 9495 p = (LONG64*)soap_id_enter(soap, soap->id, p, t, sizeof(LONG64), 0, NULL, NULL, NULL); 7424 if (p) 9496 if (*soap->href) 9497 p = (LONG64*)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(LONG64), 0, NULL); 9498 else if (p) 7425 9499 { if (soap_s2LONG64(soap, soap_value(soap), p)) 7426 9500 return NULL; 7427 9501 } 7428 p = (LONG64*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(LONG64), 0, NULL);7429 9502 if (soap->body && soap_element_end_in(soap, tag)) 7430 9503 return NULL; … … 7466 9539 char *r; 7467 9540 n = soap_strtol(s, &r, 10); 7468 if ( *r || n < -128 || n > 127)9541 if (s == r || *r || n < -128 || n > 127) 7469 9542 soap->error = SOAP_TYPE; 7470 9543 *p = (char)n; … … 7480 9553 SOAP_FMAC2 7481 9554 soap_inbyte(struct soap *soap, const char *tag, char *p, const char *type, int t) 7482 { if (soap_element_begin_in(soap, tag, 0 ))9555 { if (soap_element_begin_in(soap, tag, 0, NULL)) 7483 9556 return NULL; 7484 9557 #ifndef WITH_LEAN … … 7492 9565 #endif 7493 9566 p = (char*)soap_id_enter(soap, soap->id, p, t, sizeof(char), 0, NULL, NULL, NULL); 7494 if (p) 9567 if (*soap->href) 9568 p = (char*)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(char), 0, NULL); 9569 else if (p) 7495 9570 { if (soap_s2byte(soap, soap_value(soap), p)) 7496 9571 return NULL; 7497 9572 } 7498 p = (char*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(char), 0, NULL);7499 9573 if (soap->body && soap_element_end_in(soap, tag)) 7500 9574 return NULL; … … 7536 9610 char *r; 7537 9611 n = soap_strtol(s, &r, 10); 7538 if ( *r || n < -32768 || n > 32767)9612 if (s == r || *r || n < -32768 || n > 32767) 7539 9613 soap->error = SOAP_TYPE; 7540 9614 *p = (short)n; … … 7550 9624 SOAP_FMAC2 7551 9625 soap_inshort(struct soap *soap, const char *tag, short *p, const char *type, int t) 7552 { if (soap_element_begin_in(soap, tag, 0 ))9626 { if (soap_element_begin_in(soap, tag, 0, NULL)) 7553 9627 return NULL; 7554 9628 #ifndef WITH_LEAN … … 7563 9637 #endif 7564 9638 p = (short*)soap_id_enter(soap, soap->id, p, t, sizeof(short), 0, NULL, NULL, NULL); 7565 if (p) 9639 if (*soap->href) 9640 p = (short*)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(short), 0, NULL); 9641 else if (p) 7566 9642 { if (soap_s2short(soap, soap_value(soap), p)) 7567 9643 return NULL; 7568 9644 } 7569 p = (short*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(short), 0, NULL);7570 9645 if (soap->body && soap_element_end_in(soap, tag)) 7571 9646 return NULL; … … 7580 9655 SOAP_FMAC2 7581 9656 soap_float2s(struct soap *soap, float n) 7582 { c onst char *s;9657 { char *s; 7583 9658 if (soap_isnan((double)n)) 7584 s = "NaN"; 7585 else if (soap_ispinff(n)) 7586 s = "INF"; 7587 else if (soap_isninff(n)) 7588 s = "-INF"; 7589 else 7590 { sprintf(soap->tmpbuf, soap->float_format, n); 7591 s = soap->tmpbuf; 7592 } 7593 return s; 9659 return "NaN"; 9660 if (soap_ispinff(n)) 9661 return "INF"; 9662 if (soap_isninff(n)) 9663 return "-INF"; 9664 s = soap->tmpbuf; 9665 #if defined(HAVE_SPRINTF_L) 9666 sprintf_l(s, soap->c_locale, soap->float_format, n); 9667 #else 9668 sprintf(s, soap->float_format, n); 9669 s = strchr(s, ','); /* convert decimal comma to DP */ 9670 if (s) 9671 *s = '.'; 9672 #endif 9673 return soap->tmpbuf; 7594 9674 } 7595 9675 #endif … … 7615 9695 soap_s2float(struct soap *soap, const char *s, float *p) 7616 9696 { if (s) 7617 { if (!soap_tag_cmp(s, "INF")) 9697 { if (!*s) 9698 return soap->error = SOAP_TYPE; 9699 if (!soap_tag_cmp(s, "INF")) 7618 9700 *p = FLT_PINFTY; 7619 9701 else if (!soap_tag_cmp(s, "+INF")) … … 7625 9707 else 7626 9708 { 7627 #ifdef HAVE_STRTOD 9709 /* On some systems, strtof appears to be broken or doesn't link: use with caution */ 9710 #if defined(HAVE_STRTOF_L) 9711 char *r; 9712 *p = strtof_l((char*)s, &r, soap->c_locale); 9713 if (*r) 9714 #elif defined(HAVE_STRTOD_L) 9715 char *r; 9716 *p = (float)strtod_l(s, &r, soap->c_locale); 9717 if (*r) 9718 #elif defined(HAVE_STRTOF) 9719 char *r; 9720 *p = strtof((char*)s, &r); 9721 if (*r) 9722 #elif defined(HAVE_STRTOD) 7628 9723 char *r; 7629 9724 *p = (float)strtod(s, &r); 7630 9725 if (*r) 7631 9726 #endif 7632 #ifdef HAVE_SSCANF 7633 if (sscanf(s, soap->float_format, p) != 1) 9727 { 9728 #if defined(HAVE_SSCANF_L) && !defined(HAVE_STRTOF_L) && !defined(HAVE_STRTOD_L) 9729 if (sscanf_l(s, soap->c_locale, "%g", p) != 1) 9730 soap->error = SOAP_TYPE; 9731 #elif defined(HAVE_SSCANF) 9732 if (sscanf(s, "%g", p) != 1) 7634 9733 soap->error = SOAP_TYPE; 7635 9734 #else 7636 9735 soap->error = SOAP_TYPE; 7637 9736 #endif 9737 } 7638 9738 } 7639 9739 } … … 7676 9776 SOAP_FMAC2 7677 9777 soap_infloat(struct soap *soap, const char *tag, float *p, const char *type, int t) 7678 { if (soap_element_begin_in(soap, tag, 0 ))9778 { if (soap_element_begin_in(soap, tag, 0, NULL)) 7679 9779 return NULL; 7680 9780 #ifndef WITH_LEAN … … 7683 9783 #endif 7684 9784 p = (float*)soap_id_enter(soap, soap->id, p, t, sizeof(float), 0, NULL, NULL, NULL); 7685 if (p) 9785 if (*soap->href) 9786 p = (float*)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(float), 0, NULL); 9787 else if (p) 7686 9788 { if (soap_s2float(soap, soap_value(soap), p)) 7687 9789 return NULL; 7688 9790 } 7689 p = (float*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(float), 0, NULL);7690 9791 if (soap->body && soap_element_end_in(soap, tag)) 7691 9792 return NULL; … … 7700 9801 SOAP_FMAC2 7701 9802 soap_double2s(struct soap *soap, double n) 7702 { c onst char *s;9803 { char *s; 7703 9804 if (soap_isnan(n)) 7704 s = "NaN"; 7705 else if (soap_ispinfd(n)) 7706 s = "INF"; 7707 else if (soap_isninfd(n)) 7708 s = "-INF"; 7709 else 7710 { sprintf(soap->tmpbuf, soap->double_format, n); 7711 s = soap->tmpbuf; 7712 } 7713 return s; 9805 return "NaN"; 9806 if (soap_ispinfd(n)) 9807 return "INF"; 9808 if (soap_isninfd(n)) 9809 return "-INF"; 9810 s = soap->tmpbuf; 9811 #if defined(HAVE_SPRINTF_L) 9812 sprintf_l(s, soap->c_locale, soap->double_format, n); 9813 #else 9814 sprintf(s, soap->double_format, n); 9815 s = strchr(s, ','); /* convert decimal comma to DP */ 9816 if (s) 9817 *s = '.'; 9818 #endif 9819 return soap->tmpbuf; 7714 9820 } 7715 9821 #endif … … 7735 9841 soap_s2double(struct soap *soap, const char *s, double *p) 7736 9842 { if (s) 7737 { if (!soap_tag_cmp(s, "INF")) 9843 { if (!*s) 9844 return soap->error = SOAP_TYPE; 9845 if (!soap_tag_cmp(s, "INF")) 7738 9846 *p = DBL_PINFTY; 7739 9847 else if (!soap_tag_cmp(s, "+INF")) … … 7745 9853 else 7746 9854 { 7747 #ifdef HAVE_STRTOD 9855 #if defined(HAVE_STRTOD_L) 9856 char *r; 9857 *p = strtod_l(s, &r, soap->c_locale); 9858 if (*r) 9859 #elif defined(HAVE_STRTOD) 7748 9860 char *r; 7749 9861 *p = strtod(s, &r); 7750 9862 if (*r) 7751 9863 #endif 7752 #ifdef HAVE_SSCANF 7753 if (sscanf(s, soap->double_format, p) != 1) 9864 { 9865 #if defined(HAVE_SSCANF_L) && !defined(HAVE_STRTOF_L) && !defined(HAVE_STRTOD_L) 9866 if (sscanf_l(s, soap->c_locale, "%lg", p) != 1) 9867 soap->error = SOAP_TYPE; 9868 #elif defined(HAVE_SSCANF) 9869 if (sscanf(s, "%lg", p) != 1) 7754 9870 soap->error = SOAP_TYPE; 7755 9871 #else 7756 9872 soap->error = SOAP_TYPE; 7757 9873 #endif 9874 } 7758 9875 } 7759 9876 } … … 7768 9885 SOAP_FMAC2 7769 9886 soap_indouble(struct soap *soap, const char *tag, double *p, const char *type, int t) 7770 { if (soap_element_begin_in(soap, tag, 0 ))9887 { if (soap_element_begin_in(soap, tag, 0, NULL)) 7771 9888 return NULL; 7772 9889 #ifndef WITH_LEAN … … 7775 9892 #endif 7776 9893 p = (double*)soap_id_enter(soap, soap->id, p, t, sizeof(double), 0, NULL, NULL, NULL); 7777 if (p) 9894 if (*soap->href) 9895 p = (double*)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(double), 0, NULL); 9896 else if (p) 7778 9897 { if (soap_s2double(soap, soap_value(soap), p)) 7779 9898 return NULL; 7780 9899 } 7781 p = (double*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(double), 0, NULL);7782 9900 if (soap->body && soap_element_end_in(soap, tag)) 7783 9901 return NULL; … … 7819 9937 char *r; 7820 9938 n = soap_strtoul(s, &r, 10); 7821 if ( *r || n > 255)9939 if (s == r || *r || n > 255) 7822 9940 soap->error = SOAP_TYPE; 7823 9941 *p = (unsigned char)n; … … 7833 9951 SOAP_FMAC2 7834 9952 soap_inunsignedByte(struct soap *soap, const char *tag, unsigned char *p, const char *type, int t) 7835 { if (soap_element_begin_in(soap, tag, 0 ))9953 { if (soap_element_begin_in(soap, tag, 0, NULL)) 7836 9954 return NULL; 7837 9955 #ifndef WITH_LEAN … … 7845 9963 #endif 7846 9964 p = (unsigned char*)soap_id_enter(soap, soap->id, p, t, sizeof(unsigned char), 0, NULL, NULL, NULL); 7847 if (p) 9965 if (*soap->href) 9966 p = (unsigned char*)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(unsigned char), 0, NULL); 9967 else if (p) 7848 9968 { if (soap_s2unsignedByte(soap, soap_value(soap), p)) 7849 9969 return NULL; 7850 9970 } 7851 p = (unsigned char*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(unsigned char), 0, NULL);7852 9971 if (soap->body && soap_element_end_in(soap, tag)) 7853 9972 return NULL; … … 7857 9976 7858 9977 /******************************************************************************/ 7859 #ifndef WITH_LEAN9978 #ifndef PALM_2 7860 9979 SOAP_FMAC1 7861 9980 const char* … … 7867 9986 7868 9987 /******************************************************************************/ 7869 #ifndef WITH_LEAN9988 #ifndef PALM_2 7870 9989 SOAP_FMAC1 7871 9990 int … … 7880 9999 7881 10000 /******************************************************************************/ 7882 #ifndef WITH_LEAN10001 #ifndef PALM_2 7883 10002 SOAP_FMAC1 7884 10003 int … … 7889 10008 char *r; 7890 10009 n = soap_strtoul(s, &r, 10); 7891 if ( *r || n > 65535)10010 if (s == r || *r || n > 65535) 7892 10011 soap->error = SOAP_TYPE; 7893 10012 *p = (unsigned short)n; … … 7898 10017 7899 10018 /******************************************************************************/ 7900 #ifndef WITH_LEAN10019 #ifndef PALM_2 7901 10020 SOAP_FMAC1 7902 10021 unsigned short * 7903 10022 SOAP_FMAC2 7904 10023 soap_inunsignedShort(struct soap *soap, const char *tag, unsigned short *p, const char *type, int t) 7905 { if (soap_element_begin_in(soap, tag, 0 ))10024 { if (soap_element_begin_in(soap, tag, 0, NULL)) 7906 10025 return NULL; 7907 10026 #ifndef WITH_LEAN … … 7916 10035 #endif 7917 10036 p = (unsigned short*)soap_id_enter(soap, soap->id, p, t, sizeof(unsigned short), 0, NULL, NULL, NULL); 7918 if (p) 10037 if (*soap->href) 10038 p = (unsigned short*)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(unsigned short), 0, NULL); 10039 else if (p) 7919 10040 { if (soap_s2unsignedShort(soap, soap_value(soap), p)) 7920 10041 return NULL; 7921 10042 } 7922 p = (unsigned short*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(unsigned short), 0, NULL);7923 10043 if (soap->body && soap_element_end_in(soap, tag)) 7924 10044 return NULL; … … 7958 10078 { if (s) 7959 10079 { char *r; 10080 #ifndef WITH_NOIO 10081 #ifndef WITH_LEAN 10082 soap_reset_errno; 10083 #endif 10084 #endif 7960 10085 *p = (unsigned int)soap_strtoul(s, &r, 10); 7961 if (*r) 10086 if ((s == r && (soap->mode & SOAP_XML_STRICT)) || *r 10087 #ifndef WITH_NOIO 10088 #ifndef WITH_LEAN 10089 || soap_errno == SOAP_ERANGE 10090 #endif 10091 #endif 10092 ) 7962 10093 soap->error = SOAP_TYPE; 7963 10094 } … … 7972 10103 SOAP_FMAC2 7973 10104 soap_inunsignedInt(struct soap *soap, const char *tag, unsigned int *p, const char *type, int t) 7974 { if (soap_element_begin_in(soap, tag, 0 ))10105 { if (soap_element_begin_in(soap, tag, 0, NULL)) 7975 10106 return NULL; 7976 10107 #ifndef WITH_LEAN … … 7986 10117 #endif 7987 10118 p = (unsigned int*)soap_id_enter(soap, soap->id, p, t, sizeof(unsigned int), 0, NULL, NULL, NULL); 7988 if (p) 10119 if (*soap->href) 10120 p = (unsigned int*)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(unsigned int), 0, NULL); 10121 else if (p) 7989 10122 { if (soap_s2unsignedInt(soap, soap_value(soap), p)) 7990 10123 return NULL; 7991 10124 } 7992 p = (unsigned int*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(unsigned int), 0, NULL);7993 10125 if (soap->body && soap_element_end_in(soap, tag)) 7994 10126 return NULL; … … 8029 10161 { if (s) 8030 10162 { char *r; 10163 #ifndef WITH_NOIO 10164 #ifndef WITH_LEAN 10165 soap_reset_errno; 10166 #endif 10167 #endif 8031 10168 *p = soap_strtoul(s, &r, 10); 8032 if (*r) 10169 if ((s == r && (soap->mode & SOAP_XML_STRICT)) || *r 10170 #ifndef WITH_NOIO 10171 #ifndef WITH_LEAN 10172 || soap_errno == SOAP_ERANGE 10173 #endif 10174 #endif 10175 ) 8033 10176 soap->error = SOAP_TYPE; 8034 10177 } … … 8043 10186 SOAP_FMAC2 8044 10187 soap_inunsignedLong(struct soap *soap, const char *tag, unsigned long *p, const char *type, int t) 8045 { if (soap_element_begin_in(soap, tag, 0 ))10188 { if (soap_element_begin_in(soap, tag, 0, NULL)) 8046 10189 return NULL; 8047 10190 #ifndef WITH_LEAN … … 8057 10200 #endif 8058 10201 p = (unsigned long*)soap_id_enter(soap, soap->id, p, t, sizeof(unsigned long), 0, NULL, NULL, NULL); 8059 if (p) 10202 if (*soap->href) 10203 p = (unsigned long*)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(unsigned long), 0, NULL); 10204 else if (p) 8060 10205 { if (soap_s2unsignedLong(soap, soap_value(soap), p)) 8061 10206 return NULL; 8062 10207 } 8063 p = (unsigned long*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(unsigned long), 0, NULL);8064 10208 if (soap->body && soap_element_end_in(soap, tag)) 8065 10209 return NULL; … … 8098 10242 SOAP_FMAC2 8099 10243 soap_s2ULONG64(struct soap *soap, const char *s, ULONG64 *p) 8100 { if (s && sscanf(s, SOAP_ULONG_FORMAT, p) != 1) 8101 soap->error = SOAP_TYPE; 10244 { if (s) 10245 { 10246 #ifdef HAVE_STRTOULL 10247 char *r; 10248 #ifndef WITH_NOIO 10249 #ifndef WITH_LEAN 10250 soap_reset_errno; 10251 #endif 10252 #endif 10253 *p = strtoull(s, &r, 10); 10254 if ((s == r && (soap->mode & SOAP_XML_STRICT)) || *r 10255 #ifndef WITH_NOIO 10256 #ifndef WITH_LEAN 10257 || soap_errno == SOAP_ERANGE 10258 #endif 10259 #endif 10260 ) 10261 #else 10262 #ifdef HAVE_SSCANF 10263 if (sscanf(s, SOAP_ULONG_FORMAT, p) != 1) 10264 #endif 10265 #endif 10266 soap->error = SOAP_TYPE; 10267 } 8102 10268 return soap->error; 8103 10269 } … … 8110 10276 SOAP_FMAC2 8111 10277 soap_inULONG64(struct soap *soap, const char *tag, ULONG64 *p, const char *type, int t) 8112 { if (soap_element_begin_in(soap, tag, 0 ))10278 { if (soap_element_begin_in(soap, tag, 0, NULL)) 8113 10279 return NULL; 8114 10280 if (*soap->type … … 8125 10291 } 8126 10292 p = (ULONG64*)soap_id_enter(soap, soap->id, p, t, sizeof(ULONG64), 0, NULL, NULL, NULL); 8127 if (p) 10293 if (*soap->href) 10294 p = (ULONG64*)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(ULONG64), 0, NULL); 10295 else if (p) 8128 10296 { if (soap_s2ULONG64(soap, soap_value(soap), p)) 8129 10297 return NULL; 8130 10298 } 8131 p = (ULONG64*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(ULONG64), 0, NULL);8132 10299 if (soap->body && soap_element_end_in(soap, tag)) 8133 10300 return NULL; … … 8142 10309 SOAP_FMAC2 8143 10310 soap_s2string(struct soap *soap, const char *s, char **t) 8144 { *t = NULL; 8145 if (s && !(*t = soap_strdup(soap, s))) 8146 soap->error = SOAP_EOM; 10311 { if (s) 10312 { if (!(*t = soap_strdup(soap, s))) 10313 return soap->error = SOAP_EOM; 10314 if (!(soap->mode & (SOAP_ENC_LATIN | SOAP_C_UTFSTRING))) 10315 { /* TODO: consider truncating UTF8 to ASCII for regular XML attribute strings? */ 10316 } 10317 } 8147 10318 return soap->error; 8148 10319 } … … 8156 10327 soap_s2QName(struct soap *soap, const char *s, char **t) 8157 10328 { if (s) 8158 { struct soap_nlist *np; 8159 const char *p; 8160 if (!strncmp(s, "xml:", 4)) 8161 { *t = soap_strdup(soap, s); 8162 return SOAP_OK; 8163 } 8164 np = soap->nlist; 8165 p = strchr(s, ':'); 8166 if (p) 8167 { register int n = p - s; 8168 while (np && (strncmp(np->id, s, n) || np->id[n])) 8169 np = np->next; 8170 p++; 10329 { soap->labidx = 0; 10330 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Normalized namespace(s) of QNames '%s'", s)); 10331 /* convert (by prefix normalize prefix) all QNames in s */ 10332 for (;;) 10333 { size_t n; 10334 struct soap_nlist *np; 10335 register const char *p; 10336 /* skip blanks */ 10337 while (*s && soap_blank(*s)) 10338 s++; 10339 if (!*s) 10340 break; 10341 /* find next QName */ 10342 n = 1; 10343 while (s[n] && !soap_blank(s[n])) 10344 n++; 10345 np = soap->nlist; 10346 /* if there is no namespace stack, or prefix is "xml" then copy string */ 10347 if (!np || !strncmp(s, "xml:", 4)) 10348 { soap_append_lab(soap, s, n); 10349 } 10350 else /* we normalize the QName by replacing its prefix */ 10351 { p = strchr(s, ':'); 10352 if (p) 10353 { size_t k = p - s; 10354 while (np && (strncmp(np->id, s, k) || np->id[k])) 10355 np = np->next; 10356 p++; 10357 } 10358 else 10359 { while (np && *np->id) 10360 np = np->next; 10361 p = s; 10362 } 10363 /* replace prefix */ 10364 if (np) 10365 { if (np->index >= 0 && soap->local_namespaces) 10366 { const char *q = soap->local_namespaces[np->index].id; 10367 if (q) 10368 soap_append_lab(soap, q, strlen(q)); 10369 } 10370 else if (np->ns) 10371 { soap_append_lab(soap, "\"", 1); 10372 soap_append_lab(soap, np->ns, strlen(np->ns)); 10373 soap_append_lab(soap, "\"", 1); 10374 } 10375 else 10376 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "\nNamespace prefix of '%s' not defined (index=%d, URI=%s)\n", s, np->index, np->ns?np->ns:SOAP_STR_EOS)); 10377 return soap->error = SOAP_NAMESPACE; 10378 } 10379 } 10380 else /* no namespace: assume default "" namespace */ 10381 { soap_append_lab(soap, "\"\"", 2); 10382 } 10383 soap_append_lab(soap, ":", 1); 10384 soap_append_lab(soap, p, n - (p-s)); 10385 } 10386 /* advance to next and add spacing */ 10387 s += n; 10388 if (*s) 10389 soap_append_lab(soap, " ", 1); 10390 } 10391 soap_append_lab(soap, SOAP_STR_EOS, 1); 10392 *t = soap_strdup(soap, soap->labbuf); 10393 DBGLOG(TEST, SOAP_MESSAGE(fdebug, " into '%s'\n", *t)); 10394 } 10395 return soap->error; 10396 } 10397 #endif 10398 10399 /******************************************************************************/ 10400 #ifndef PALM_2 10401 SOAP_FMAC1 10402 const char* 10403 SOAP_FMAC2 10404 soap_QName2s(struct soap *soap, const char *s) 10405 { const char *t = NULL; 10406 if (s) 10407 { soap->labidx = 0; 10408 for (;;) 10409 { size_t n; 10410 /* skip blanks */ 10411 while (*s && soap_blank(*s)) 10412 s++; 10413 if (!*s) 10414 break; 10415 /* find next QName */ 10416 n = 1; 10417 while (s[n] && !soap_blank(s[n])) 10418 n++; 10419 /* normal prefix: pass string as is */ 10420 if (*s != '"') 10421 { soap_append_lab(soap, s, n); 10422 #ifndef WITH_LEAN 10423 if ((soap->mode & SOAP_XML_CANONICAL)) 10424 { const char *r = strchr(s, ':'); 10425 if (r) 10426 soap_utilize_ns(soap, s, r - s); 10427 } 10428 #endif 10429 } 10430 else /* URL-based string prefix */ 10431 { const char *q; 10432 s++; 10433 q = strchr(s, '"'); 10434 if (q) 10435 { struct Namespace *p = soap->local_namespaces; 10436 if (p) 10437 { for (; p->id; p++) 10438 { if (p->ns) 10439 if (!soap_tag_cmp(s, p->ns)) 10440 break; 10441 if (p->in) 10442 if (!soap_tag_cmp(s, p->in)) 10443 break; 10444 } 10445 } 10446 /* URL is in the namespace table? */ 10447 if (p && p->id) 10448 { soap_append_lab(soap, p->id, strlen(p->id)); 10449 } 10450 else /* not in namespace table: create xmlns binding */ 10451 { char *r = soap_strdup(soap, s); 10452 r[q-s] = '\0'; 10453 sprintf(soap->tmpbuf, "xmlns:_%d", soap->idnum++); 10454 soap_set_attr(soap, soap->tmpbuf, r); 10455 soap_append_lab(soap, soap->tmpbuf + 6, strlen(soap->tmpbuf + 6)); 10456 } 10457 soap_append_lab(soap, q + 1, n - (q-s) - 1); 10458 } 10459 } 10460 /* advance to next and add spacing */ 10461 s += n; 10462 if (*s) 10463 soap_append_lab(soap, " ", 1); 10464 } 10465 soap_append_lab(soap, SOAP_STR_EOS, 1); 10466 t = soap_strdup(soap, soap->labbuf); 10467 } 10468 return t; 10469 } 10470 #endif 10471 10472 /******************************************************************************/ 10473 #ifndef WITH_LEAN 10474 SOAP_FMAC1 10475 int 10476 SOAP_FMAC2 10477 soap_s2wchar(struct soap *soap, const char *s, wchar_t **t) 10478 { if (s) 10479 { wchar_t *r; 10480 *t = r = (wchar_t*)soap_malloc(soap, sizeof(wchar_t) * (strlen(s) + 1)); 10481 if (!r) 10482 return soap->error; 10483 if (soap->mode & SOAP_ENC_LATIN) 10484 { while (*s) 10485 *r++ = (wchar_t)*s++; 8171 10486 } 8172 10487 else 8173 { while (np && *np->id) 8174 np = np->next; 8175 p = s; 8176 } 8177 if (np) 8178 { if (np->index >= 0 && soap->local_namespaces) 8179 { register const char *q = soap->local_namespaces[np->index].id; 8180 if (q) 8181 { if ((*t = (char*)soap_malloc(soap, strlen(p) + strlen(q) + 2))) 8182 sprintf(*t, "%s:%s", q, p); 8183 return SOAP_OK; 10488 { /* Convert UTF8 to wchar */ 10489 while (*s) 10490 { register soap_wchar c, c1, c2, c3, c4; 10491 c = (unsigned char)*s++; 10492 if (c < 0x80) 10493 *r++ = (wchar_t)c; 10494 else 10495 { c1 = (soap_wchar)*s++ & 0x3F; 10496 if (c < 0xE0) 10497 *r++ = (wchar_t)(((soap_wchar)(c & 0x1F) << 6) | c1); 10498 else 10499 { c2 = (soap_wchar)*s++ & 0x3F; 10500 if (c < 0xF0) 10501 *r++ = (wchar_t)(((soap_wchar)(c & 0x0F) << 12) | (c1 << 6) | c2); 10502 else 10503 { c3 = (soap_wchar)*s++ & 0x3F; 10504 if (c < 0xF8) 10505 *r++ = (wchar_t)(((soap_wchar)(c & 0x07) << 18) | (c1 << 12) | (c2 << 6) | c3); 10506 else 10507 { c4 = (soap_wchar)*s++ & 0x3F; 10508 if (c < 0xFC) 10509 *r++ = (wchar_t)(((soap_wchar)(c & 0x03) << 24) | (c1 << 18) | (c2 << 12) | (c3 << 6) | c4); 10510 else 10511 *r++ = (wchar_t)(((soap_wchar)(c & 0x01) << 30) | (c1 << 24) | (c2 << 18) | (c3 << 12) | (c4 << 6) | (soap_wchar)(*s++ & 0x3F)); 10512 } 10513 } 10514 } 8184 10515 } 8185 10516 } 8186 if (np->ns) 8187 { if ((*t = (char*)soap_malloc(soap, strlen(p) + strlen(np->ns) + 4))) 8188 sprintf(*t, "\"%s\":%s", np->ns, p); 8189 return SOAP_OK; 8190 } 8191 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Namespace prefix of '%s' not defined (index=%d, URI=%s)\n", s, np->index, np->ns?np->ns:"")); 8192 return soap->error = SOAP_NAMESPACE; 8193 } 8194 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Namespace prefix of '%s' not defined, assuming empty namespace\n", s)); 8195 if ((*t = (char*)soap_malloc(soap, strlen(p) + 4))) 8196 sprintf(*t, "\"\":%s", p); 8197 } 8198 return soap->error; 8199 } 8200 #endif 8201 8202 /******************************************************************************/ 8203 #ifndef PALM_2 10517 } 10518 *r = L'\0'; 10519 } 10520 return SOAP_OK; 10521 } 10522 #endif 10523 10524 /******************************************************************************/ 10525 #ifndef WITH_LEAN 8204 10526 SOAP_FMAC1 8205 10527 const char* 8206 10528 SOAP_FMAC2 8207 soap_QName2s(struct soap *soap, const char *s) 8208 { struct Namespace *p; 8209 char *t; 8210 int n; 8211 if (!s || *s != '"') 8212 return s; 8213 s++; 8214 if ((p = soap->local_namespaces)) 8215 { for (; p->id; p++) 8216 { if (p->ns) 8217 if (!soap_tag_cmp(s, p->ns)) 8218 break; 8219 if (p->in) 8220 if (!soap_tag_cmp(s, p->in)) 8221 break; 8222 } 8223 if (p && p->id) 8224 { s = strchr(s, '"'); 8225 if (s) 8226 { t = (char*)soap_malloc(soap, strlen(p->id) + strlen(s)); 8227 strcpy(t, p->id); 8228 strcat(t, s + 1); 8229 return t; 8230 } 8231 } 8232 } 8233 t = (char*)strchr(s, '"'); 8234 if (t) 8235 n = t - s; 8236 else 8237 n = 0; 8238 t = soap_strdup(soap, s); 8239 t[n] = '\0'; 8240 sprintf(soap->tmpbuf, "xmlns:_%lu", soap->idnum++); 8241 soap_set_attr(soap, soap->tmpbuf, t); 8242 s = strchr(s, '"'); 8243 if (s) 8244 { t = (char*)soap_malloc(soap, strlen(soap->tmpbuf) + strlen(s) - 6); 8245 strcpy(t, soap->tmpbuf + 6); 8246 strcat(t, s + 1); 8247 } 8248 return t; 10529 soap_wchar2s(struct soap *soap, const wchar_t *s) 10530 { register soap_wchar c; 10531 register char *r, *t; 10532 const wchar_t *q = s; 10533 size_t n = 0; 10534 while ((c = *q++)) 10535 { if (c > 0 && c < 0x80) 10536 n++; 10537 else 10538 n += 6; 10539 } 10540 r = t = (char*)soap_malloc(soap, n + 1); 10541 if (r) 10542 { /* Convert wchar to UTF8 */ 10543 while ((c = *s++)) 10544 { if (c > 0 && c < 0x80) 10545 *t++ = (char)c; 10546 else 10547 { if (c < 0x0800) 10548 *t++ = (char)(0xC0 | ((c >> 6) & 0x1F)); 10549 else 10550 { if (c < 0x010000) 10551 *t++ = (char)(0xE0 | ((c >> 12) & 0x0F)); 10552 else 10553 { if (c < 0x200000) 10554 *t++ = (char)(0xF0 | ((c >> 18) & 0x07)); 10555 else 10556 { if (c < 0x04000000) 10557 *t++ = (char)(0xF8 | ((c >> 24) & 0x03)); 10558 else 10559 { *t++ = (char)(0xFC | ((c >> 30) & 0x01)); 10560 *t++ = (char)(0x80 | ((c >> 24) & 0x3F)); 10561 } 10562 *t++ = (char)(0x80 | ((c >> 18) & 0x3F)); 10563 } 10564 *t++ = (char)(0x80 | ((c >> 12) & 0x3F)); 10565 } 10566 *t++ = (char)(0x80 | ((c >> 6) & 0x3F)); 10567 } 10568 *t++ = (char)(0x80 | (c & 0x3F)); 10569 } 10570 } 10571 *t = '\0'; 10572 } 10573 return r; 8249 10574 } 8250 10575 #endif … … 8257 10582 soap_outstring(struct soap *soap, const char *tag, int id, char *const*p, const char *type, int n) 8258 10583 { id = soap_element_id(soap, tag, id, *p, NULL, 0, type, n); 8259 if (id < 0 8260 || soap_element_begin_out(soap, tag, id, type) 10584 if (id < 0) 10585 return soap->error; 10586 if (!**p && (soap->mode & SOAP_C_NILSTRING)) 10587 return soap_element_null(soap, tag, id, type); 10588 if (soap_element_begin_out(soap, tag, id, type) 8261 10589 || soap_string_out(soap, *p, 0) 8262 10590 || soap_element_end_out(soap, tag)) … … 8272 10600 SOAP_FMAC2 8273 10601 soap_instring(struct soap *soap, const char *tag, char **p, const char *type, int t, int flag, long minlen, long maxlen) 8274 { if (soap_element_begin_in(soap, tag, 1)) 8275 return NULL; 10602 { if (soap_element_begin_in(soap, tag, 1, NULL)) 10603 { if (!tag || *tag != '-' || soap->error != SOAP_NO_TAG) 10604 return NULL; 10605 soap->error = SOAP_OK; 10606 } 8276 10607 if (!p) 8277 if (!(p = (char**)soap_malloc(soap, sizeof(char*))))10608 { if (!(p = (char**)soap_malloc(soap, sizeof(char*)))) 8278 10609 return NULL; 10610 } 8279 10611 if (soap->body) 8280 10612 { *p = soap_string_in(soap, flag, minlen, maxlen); 8281 10613 if (!*p || !(char*)soap_id_enter(soap, soap->id, *p, t, sizeof(char*), 0, NULL, NULL, NULL)) 8282 10614 return NULL; 8283 } 10615 if (!**p && tag && *tag == '-') 10616 { soap->error = SOAP_NO_TAG; 10617 return NULL; 10618 } 10619 } 10620 else if (tag && *tag == '-') 10621 { soap->error = SOAP_NO_TAG; 10622 return NULL; 10623 } 10624 else if (soap->null) 10625 *p = NULL; 8284 10626 else 8285 *p = NULL; 8286 p = (char**)soap_id_lookup(soap, soap->href, (void**)p, t, sizeof(char**), 0); 10627 *p = soap_strdup(soap, SOAP_STR_EOS); 10628 if (*soap->href) 10629 p = (char**)soap_id_lookup(soap, soap->href, (void**)p, t, sizeof(char**), 0); 8287 10630 if (soap->body && soap_element_end_in(soap, tag)) 8288 10631 return NULL; … … 8292 10635 8293 10636 /******************************************************************************/ 10637 #ifndef WITH_LEANER 8294 10638 #ifndef PALM_2 8295 10639 SOAP_FMAC1 … … 8298 10642 soap_outwstring(struct soap *soap, const char *tag, int id, wchar_t *const*p, const char *type, int n) 8299 10643 { id = soap_element_id(soap, tag, id, *p, NULL, 0, type, n); 8300 if (id < 0 8301 || soap_element_begin_out(soap, tag, id, type) 10644 if (id < 0) 10645 return soap->error; 10646 if (!**p && (soap->mode & SOAP_C_NILSTRING)) 10647 return soap_element_null(soap, tag, id, type); 10648 if (soap_element_begin_out(soap, tag, id, type) 8302 10649 || soap_wstring_out(soap, *p, 0) 8303 10650 || soap_element_end_out(soap, tag)) … … 8306 10653 } 8307 10654 #endif 8308 8309 /******************************************************************************/ 10655 #endif 10656 10657 /******************************************************************************/ 10658 #ifndef WITH_LEANER 8310 10659 #ifndef PALM_2 8311 10660 SOAP_FMAC1 … … 8313 10662 SOAP_FMAC2 8314 10663 soap_inwstring(struct soap *soap, const char *tag, wchar_t **p, const char *type, int t, long minlen, long maxlen) 8315 { if (soap_element_begin_in(soap, tag, 1)) 8316 return NULL; 10664 { if (soap_element_begin_in(soap, tag, 1, NULL)) 10665 { if (!tag || *tag != '-' || soap->error != SOAP_NO_TAG) 10666 return NULL; 10667 soap->error = SOAP_OK; 10668 } 8317 10669 if (!p) 8318 if (!(p = (wchar_t**)soap_malloc(soap, sizeof(wchar_t*))))10670 { if (!(p = (wchar_t**)soap_malloc(soap, sizeof(wchar_t*)))) 8319 10671 return NULL; 10672 } 8320 10673 if (soap->body) 8321 10674 { *p = soap_wstring_in(soap, 1, minlen, maxlen); 8322 10675 if (!*p || !(wchar_t*)soap_id_enter(soap, soap->id, *p, t, sizeof(wchar_t*), 0, NULL, NULL, NULL)) 8323 10676 return NULL; 8324 } 10677 if (!**p && tag && *tag == '-') 10678 { soap->error = SOAP_NO_TAG; 10679 return NULL; 10680 } 10681 } 10682 else if (tag && *tag == '-') 10683 { soap->error = SOAP_NO_TAG; 10684 return NULL; 10685 } 10686 else if (soap->null) 10687 *p = NULL; 8325 10688 else 8326 *p = NULL; 8327 p = (wchar_t**)soap_id_lookup(soap, soap->href, (void**)p, t, sizeof(wchar_t**), 0); 10689 *p = soap_wstrdup(soap, (wchar_t*)SOAP_STR_EOS); 10690 if (*soap->href) 10691 p = (wchar_t**)soap_id_lookup(soap, soap->href, (void**)p, t, sizeof(wchar_t**), 0); 8328 10692 if (soap->body && soap_element_end_in(soap, tag)) 8329 10693 return NULL; … … 8331 10695 } 8332 10696 #endif 10697 #endif 8333 10698 8334 10699 /******************************************************************************/ 8335 10700 #ifndef WITH_LEAN 8336 static time_t 10701 SOAP_FMAC1 10702 time_t 10703 SOAP_FMAC2 8337 10704 soap_timegm(struct tm *T) 8338 10705 { 8339 10706 #if defined(HAVE_TIMEGM) 8340 10707 return timegm(T); 8341 #elif defined(HAVE_GETTIMEOFDAY)8342 struct timezone t;8343 struct timeval tv;8344 memset((void*)&t, 0, sizeof(t));8345 gettimeofday(&tv, &t);8346 T->tm_min -= t.tz_minuteswest - (t.tz_dsttime != 0)*60;8347 T->tm_isdst = 0;8348 return mktime(T);8349 /* WR[ */8350 /* The following define was added for VxWorks*/8351 #elif defined(HAVE_MKTIME)8352 /* FOR VXWORKS:8353 vxWorks does not seem to have any variable representation of time zones, but8354 timezone information can be set in INSTALL_DIR/target/h/private/timeP.h header8355 file, by setting the ZONEBUFFER define. The ZONEBUFFER define follows this8356 format:8357 name_of_zone:<(unused)>:time_in_minutes_from_UTC:daylight_start:daylight_end8358 To calculate local time, the value of time_in_minutes_from_UTC is subtracted8359 from UTC; time_in_minutes_from_UTC must be positive. Daylight information is8360 expressed as mmddhh (month-day-hour), for example:8361 UTC::0:040102:1001028362 */8363 return mktime(T);8364 /* ]WR */8365 #elif defined(HAVE_FTIME)8366 struct timeb t;8367 memset((void*)&t, 0, sizeof(t));8368 t.timezone = 0;8369 t.dstflag = -1;8370 ftime(&t);8371 T->tm_min -= t.timezone - (t.dstflag != 0)*60;8372 T->tm_isdst = 0;8373 return mktime(T);8374 10708 #else 8375 #warning "time_t (de)serialization is not MT safe on this platform" 8376 time_t t; 8377 char *tz = getenv("TZ"); 8378 putenv("TZ=UTC"); 8379 tzset(); 10709 time_t t, g, z; 10710 struct tm tm; 8380 10711 t = mktime(T); 8381 if (tz) 8382 { char tmp[16]; 8383 strcpy(tmp, "TZ="); 8384 strncat(tmp, tz, 12); 8385 tmp[15] = '\0'; 8386 putenv(tmp); 8387 } 8388 else 8389 putenv("TZ="); 8390 tzset(); 8391 return t; 10712 if (t == (time_t)-1) 10713 return (time_t)-1; 10714 #ifdef HAVE_GMTIME_R 10715 gmtime_r(&t, &tm); 10716 #else 10717 tm = *gmtime(&t); 10718 #endif 10719 tm.tm_isdst = 0; 10720 g = mktime(&tm); 10721 if (g == (time_t)-1) 10722 return (time_t)-1; 10723 z = g - t; 10724 return t - z; 8392 10725 #endif 8393 10726 } … … 8400 10733 SOAP_FMAC2 8401 10734 soap_dateTime2s(struct soap *soap, time_t n) 8402 { struct tm T; 8403 struct tm *pT = &T; 10735 { struct tm T, *pT = &T; 8404 10736 #if defined(HAVE_GMTIME_R) 8405 10737 if (gmtime_r(&n, pT)) 8406 10738 strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%SZ", pT); 8407 /* WR[ */8408 /* The following defines were added for VxWorks*/8409 #elif defined(HAVE_PGMTIME_R)8410 if (gmtime_r(&n, pT))8411 strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%SZ", pT);8412 #elif defined(HAVE_PGMTIME)8413 if (gmtime(&n, pT))8414 strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%SZ", pT);8415 /* ]WR */8416 10739 #elif defined(HAVE_GMTIME) 8417 10740 if ((pT = gmtime(&n))) … … 8425 10748 gettimeofday(&tv, &tz); 8426 10749 strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%S", pT); 8427 sprintf(soap->tmpbuf + strlen(soap->tmpbuf), "%+03d:%02d", -tz.tz_minuteswest/60+( tz.tz_dsttime!=0), abs(tz.tz_minuteswest)%60);10750 sprintf(soap->tmpbuf + strlen(soap->tmpbuf), "%+03d:%02d", -tz.tz_minuteswest/60+(pT->tm_isdst!=0), abs(tz.tz_minuteswest)%60); 8428 10751 } 8429 10752 #else … … 8432 10755 gettimeofday(&tv, &tz); 8433 10756 strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%S", pT); 8434 sprintf(soap->tmpbuf + strlen(soap->tmpbuf), "%+03d:%02d", -tz.tz_minuteswest/60+( tz.tz_dsttime!=0), abs(tz.tz_minuteswest)%60);10757 sprintf(soap->tmpbuf + strlen(soap->tmpbuf), "%+03d:%02d", -tz.tz_minuteswest/60+(pT->tm_isdst!=0), abs(tz.tz_minuteswest)%60); 8435 10758 } 8436 10759 #endif … … 8440 10763 #if defined(HAVE_LOCALTIME_R) 8441 10764 if (localtime_r(&n, pT)) 8442 { ftime(&t); 10765 { 10766 #ifdef __BORLANDC__ 10767 ::ftime(&t); 10768 #else 10769 ftime(&t); 10770 #endif 8443 10771 strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%S", pT); 8444 sprintf(soap->tmpbuf + strlen(soap->tmpbuf), "%+03d:%02d", -t.timezone/60+(t.dstflag!=0), abs(t.timezone)%60); 8445 } 8446 /* WR[ */ 8447 /* The following defines were added for VxWorks*/ 8448 #elif defined(HAVE_PLOCALTIME_R) 8449 if (localtime_r(&n, pT)) 8450 { strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%S", pT); 8451 sprintf(soap->tmpbuf+strlen(soap->tmpbuf), "%+03d:%02d", t.timezone/60, abs(t.timezone)%60); 8452 } 8453 /* ]WR */ 10772 sprintf(soap->tmpbuf + strlen(soap->tmpbuf), "%+03d:%02d", -t.timezone/60+(pT->tm_isdst!=0), abs(t.timezone)%60); 10773 } 8454 10774 #else 8455 10775 if ((pT = localtime(&n))) 8456 { ftime(&t); 10776 { 10777 #ifdef __BORLANDC__ 10778 ::ftime(&t); 10779 #else 10780 ftime(&t); 10781 #endif 8457 10782 strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%S", pT); 8458 sprintf(soap->tmpbuf + strlen(soap->tmpbuf), "%+03d:%02d", -t.timezone/60+( t.dstflag!=0), abs(t.timezone)%60);10783 sprintf(soap->tmpbuf + strlen(soap->tmpbuf), "%+03d:%02d", -t.timezone/60+(pT->tm_isdst!=0), abs(t.timezone)%60); 8459 10784 } 8460 10785 #endif … … 8462 10787 if (localtime_r(&n, pT)) 8463 10788 strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%S", pT); 8464 /* WR[ */8465 /* The following defines were added for VxWorks*/8466 #elif defined(HAVE_PLOCALTIME_R)8467 if (localtime_r(&n, pT))8468 strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%S", pT);8469 /* ]WR */8470 10789 #else 8471 10790 if ((pT = localtime(&n))) … … 8498 10817 soap_s2dateTime(struct soap *soap, const char *s, time_t *p) 8499 10818 { if (s) 8500 { struct tm T; 8501 char zone[16]; 10819 { char zone[32]; 10820 struct tm T; 10821 const char *t; 10822 *zone = '\0'; 8502 10823 memset((void*)&T, 0, sizeof(T)); 8503 zone[sizeof(zone)-1] = '\0'; 8504 sscanf(s, "%d-%d-%dT%d:%d:%d%15s", &T.tm_year, &T.tm_mon, &T.tm_mday, &T.tm_hour, &T.tm_min, &T.tm_sec, zone); 10824 if (strchr(s, '-')) 10825 t = "%d-%d-%dT%d:%d:%d%31s"; 10826 else if (strchr(s, ':')) 10827 t = "%4d%2d%2dT%d:%d:%d%31s"; 10828 else /* parse non-XSD-standard alternative ISO 8601 format */ 10829 t = "%4d%2d%2dT%2d%2d%2d%31s"; 10830 if (sscanf(s, t, &T.tm_year, &T.tm_mon, &T.tm_mday, &T.tm_hour, &T.tm_min, &T.tm_sec, zone) < 6) 10831 return soap->error = SOAP_TYPE; 8505 10832 if (T.tm_year == 1) 8506 10833 T.tm_year = 70; … … 8508 10835 T.tm_year -= 1900; 8509 10836 T.tm_mon--; 8510 if (*zone) 8511 { if (*zone == '.') 8512 { for (s = zone + 1; *s; s++) 8513 if (*s < '0' || *s > '9') 8514 break; 8515 } 8516 else 8517 s = zone; 8518 if (*s != 'Z') 10837 if (*zone == '.') 10838 { for (s = zone + 1; *s; s++) 10839 if (*s < '0' || *s > '9') 10840 break; 10841 } 10842 else 10843 s = zone; 10844 if (*s) 10845 { 10846 #ifndef WITH_NOZONE 10847 if (*s == '+' || *s == '-') 8519 10848 { int h = 0, m = 0; 8520 sscanf(s, "%d:%d", &h, &m); 8521 T.tm_hour -= h; 8522 if (h >= 0) 8523 T.tm_min -= m; 8524 else 8525 T.tm_min += m; 8526 } 10849 if (s[3] == ':') 10850 { /* +hh:mm */ 10851 sscanf(s, "%d:%d", &h, &m); 10852 if (h < 0) 10853 m = -m; 10854 } 10855 else /* +hhmm */ 10856 { m = (int)atol(s); 10857 h = m / 100; 10858 m = m % 100; 10859 } 10860 T.tm_min -= m; 10861 T.tm_hour -= h; 10862 /* put hour and min in range */ 10863 T.tm_hour += T.tm_min / 60; 10864 T.tm_min %= 60; 10865 if (T.tm_min < 0) 10866 T.tm_min += 60; 10867 T.tm_mday += T.tm_hour / 24; 10868 T.tm_hour %= 24; 10869 if (T.tm_hour < 0) 10870 T.tm_hour += 24; 10871 /* note: day of the month may be out of range, timegm() handles it */ 10872 } 10873 #endif 8527 10874 *p = soap_timegm(&T); 8528 10875 } 8529 10876 else 8530 *p = mktime(&T); /* no time zone: suppose it is localtime? */10877 *p = mktime(&T); 8531 10878 } 8532 10879 return soap->error; … … 8539 10886 time_t * 8540 10887 SOAP_FMAC2 8541 soap_indateTime(struct soap *soap, const char *tag, time_t *p, const char * type, int t)8542 { if (soap_element_begin_in(soap, tag, 0 ))10888 soap_indateTime(struct soap *soap, const char *tag, time_t *p, const char *type, int t) 10889 { if (soap_element_begin_in(soap, tag, 0, NULL)) 8543 10890 return NULL; 8544 10891 if (*soap->type … … 8550 10897 } 8551 10898 p = (time_t*)soap_id_enter(soap, soap->id, p, t, sizeof(time_t), 0, NULL, NULL, NULL); 8552 if (p) 10899 if (*soap->href) 10900 p = (time_t*)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(time_t), 0, NULL); 10901 else if (p) 8553 10902 { if (soap_s2dateTime(soap, soap_value(soap), p)) 8554 10903 return NULL; 8555 10904 } 8556 p = (time_t*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(time_t), 0, NULL);8557 10905 if (soap->body && soap_element_end_in(soap, tag)) 8558 10906 return NULL; … … 8566 10914 int 8567 10915 SOAP_FMAC2 8568 soap_outliteral(struct soap *soap, const char *tag, char *const*p )10916 soap_outliteral(struct soap *soap, const char *tag, char *const*p, const char *type) 8569 10917 { int i; 8570 10918 const char *t = NULL; 8571 10919 if (tag && *tag != '-') 8572 { if ( (t = strchr(tag, ':')))10920 { if (soap->local_namespaces && (t = strchr(tag, ':'))) 8573 10921 { strncpy(soap->tmpbuf, tag, t-tag); 8574 10922 soap->tmpbuf[t-tag] = '\0'; … … 8577 10925 break; 8578 10926 t++; 8579 sprintf(soap->tmpbuf, "<%s xmlns=\"%s\">", t, soap->local_namespaces[i].ns ? soap->local_namespaces[i].ns : SOAP_STR_EOS); 10927 if (soap_element(soap, t, 0, type) 10928 || soap_attribute(soap, "xmlns", soap->local_namespaces[i].ns ? soap->local_namespaces[i].ns : SOAP_STR_EOS) 10929 || soap_element_start_end_out(soap, NULL)) 10930 return soap->error; 8580 10931 } 8581 10932 else 8582 10933 { t = tag; 8583 sprintf(soap->tmpbuf, "<%s>", tag); 8584 } 8585 if (soap_send(soap, soap->tmpbuf)) 8586 return soap->error; 10934 if (soap_element_begin_out(soap, t, 0, type)) 10935 return soap->error; 10936 } 8587 10937 } 8588 10938 if (p && *p) … … 8591 10941 } 8592 10942 if (t) 8593 { sprintf(soap->tmpbuf, "</%s>", t); 8594 return soap_send(soap, soap->tmpbuf); 8595 } 10943 return soap_element_end_out(soap, t); 8596 10944 return SOAP_OK; 8597 10945 } … … 8604 10952 SOAP_FMAC2 8605 10953 soap_inliteral(struct soap *soap, const char *tag, char **p) 8606 { if (soap_element_begin_in(soap, tag, 1)) 8607 return NULL; 10954 { if (soap_element_begin_in(soap, tag, 1, NULL)) 10955 { if (soap->error != SOAP_NO_TAG || soap_unget(soap, soap_get(soap)) == SOAP_TT) 10956 return NULL; 10957 soap->error = SOAP_OK; 10958 } 8608 10959 if (!p) 8609 if (!(p = (char**)soap_malloc(soap, sizeof(char*))))10960 { if (!(p = (char**)soap_malloc(soap, sizeof(char*)))) 8610 10961 return NULL; 8611 if (soap->null) 10962 } 10963 if (soap->body || (tag && *tag == '-')) 10964 { *p = soap_string_in(soap, 0, -1, -1); 10965 if (!*p) 10966 return NULL; 10967 if (!**p && tag && *tag == '-') 10968 { soap->error = SOAP_NO_TAG; 10969 return NULL; 10970 } 10971 } 10972 else if (soap->null) 8612 10973 *p = NULL; 8613 else if (soap->body)8614 *p = soap_string_in(soap, 0, -1, -1);8615 10974 else 8616 *p = NULL;10975 *p = soap_strdup(soap, SOAP_STR_EOS); 8617 10976 if (soap->body && soap_element_end_in(soap, tag)) 8618 10977 return NULL; … … 8622 10981 8623 10982 /******************************************************************************/ 10983 #ifndef WITH_LEANER 8624 10984 #ifndef PALM_2 8625 10985 SOAP_FMAC1 8626 10986 int 8627 10987 SOAP_FMAC2 8628 soap_outwliteral(struct soap *soap, const char *tag, wchar_t *const*p )10988 soap_outwliteral(struct soap *soap, const char *tag, wchar_t *const*p, const char *type) 8629 10989 { int i; 8630 10990 const char *t = NULL; 8631 wchar_t c;8632 const wchar_t *s;8633 10991 if (tag && *tag != '-') 8634 { if ( tag&& (t = strchr(tag, ':')))10992 { if (soap->local_namespaces && (t = strchr(tag, ':'))) 8635 10993 { strncpy(soap->tmpbuf, tag, t-tag); 8636 10994 soap->tmpbuf[t-tag] = '\0'; … … 8639 10997 break; 8640 10998 t++; 8641 sprintf(soap->tmpbuf, "<%s xmlns=\"%s\">", t, soap->local_namespaces[i].ns ? soap->local_namespaces[i].ns : SOAP_STR_EOS); 10999 if (soap_element(soap, t, 0, type) 11000 || soap_attribute(soap, "xmlns", soap->local_namespaces[i].ns ? soap->local_namespaces[i].ns : SOAP_STR_EOS) 11001 || soap_element_start_end_out(soap, NULL)) 11002 return soap->error; 8642 11003 } 8643 11004 else 8644 11005 { t = tag; 8645 sprintf(soap->tmpbuf, "<%s>", tag); 11006 if (soap_element_begin_out(soap, t, 0, type)) 11007 return soap->error; 8646 11008 } 8647 11009 if (soap_send(soap, soap->tmpbuf)) … … 8649 11011 } 8650 11012 if (p) 8651 { s = *p; 11013 { wchar_t c; 11014 const wchar_t *s = *p; 8652 11015 while ((c = *s++)) 8653 if (soap_pututf8(soap, (unsigned char)c))11016 { if (soap_pututf8(soap, (unsigned long)c)) 8654 11017 return soap->error; 11018 } 8655 11019 } 8656 11020 if (t) 8657 { sprintf(soap->tmpbuf, "</%s>", t); 8658 return soap_send(soap, soap->tmpbuf); 8659 } 11021 return soap_element_end_out(soap, t); 8660 11022 return SOAP_OK; 8661 11023 } 8662 11024 #endif 8663 8664 /******************************************************************************/ 11025 #endif 11026 11027 /******************************************************************************/ 11028 #ifndef WITH_LEANER 8665 11029 #ifndef PALM_2 8666 11030 SOAP_FMAC1 … … 8668 11032 SOAP_FMAC2 8669 11033 soap_inwliteral(struct soap *soap, const char *tag, wchar_t **p) 8670 { if (soap_element_begin_in(soap, tag, 1)) 11034 { if (soap_element_begin_in(soap, tag, 1, NULL)) 11035 { if (soap->error != SOAP_NO_TAG || soap_unget(soap, soap_get(soap)) == SOAP_TT) 11036 return NULL; 11037 soap->error = SOAP_OK; 11038 } 11039 if (!p) 11040 { if (!(p = (wchar_t**)soap_malloc(soap, sizeof(wchar_t*)))) 11041 return NULL; 11042 } 11043 if (soap->body) 11044 { *p = soap_wstring_in(soap, 0, -1, -1); 11045 if (!*p) 11046 return NULL; 11047 if (!**p && tag && *tag == '-') 11048 { soap->error = SOAP_NO_TAG; 11049 return NULL; 11050 } 11051 } 11052 else if (tag && *tag == '-') 11053 { soap->error = SOAP_NO_TAG; 8671 11054 return NULL; 8672 if (!p) 8673 if (!(p = (wchar_t**)soap_malloc(soap, sizeof(wchar_t*)))) 8674 return NULL; 8675 if (soap->null) 11055 } 11056 else if (soap->null) 8676 11057 *p = NULL; 8677 else if (soap->body)8678 *p = soap_wstring_in(soap, 0, -1, -1);8679 11058 else 8680 *p = NULL;11059 *p = soap_wstrdup(soap, (wchar_t*)SOAP_STR_EOS); 8681 11060 if (soap->body && soap_element_end_in(soap, tag)) 8682 11061 return NULL; … … 8684 11063 } 8685 11064 #endif 11065 #endif 8686 11066 8687 11067 /******************************************************************************/ … … 8691 11071 SOAP_FMAC2 8692 11072 soap_value(struct soap *soap) 8693 { size_t i;8694 soap_wchar c = 0;8695 char *s = soap->tmpbuf;11073 { register size_t i; 11074 register soap_wchar c = 0; 11075 register char *s = soap->tmpbuf; 8696 11076 if (!soap->body) 8697 11077 return SOAP_STR_EOS; 11078 do c = soap_get(soap); 11079 while (soap_blank(c)); 8698 11080 for (i = 0; i < sizeof(soap->tmpbuf) - 1; i++) 8699 { c = soap_get(soap); 8700 if (c == SOAP_TT || (int)c == EOF || soap_blank(c)) 11081 { if (c == SOAP_TT || (int)c == EOF) 8701 11082 break; 8702 11083 *s++ = (char)c; 8703 } 11084 c = soap_get(soap); 11085 } 11086 for (s--; i > 0; i--, s--) 11087 { if (!soap_blank(*s)) 11088 break; 11089 } 11090 s[1] = '\0'; 8704 11091 if ((int)c == EOF || c == SOAP_TT) 8705 11092 soap_unget(soap, c); 8706 *s = '\0'; 11093 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Element content value='%s'\n", soap->tmpbuf)); 11094 #ifdef WITH_DOM 11095 if ((soap->mode & SOAP_XML_DOM) && soap->dom) 11096 soap->dom->data = soap_strdup(soap, soap->tmpbuf); 11097 #endif 8707 11098 return soap->tmpbuf; /* return non-null pointer */ 8708 11099 } … … 8710 11101 8711 11102 /******************************************************************************/ 11103 #if !defined(WITH_LEANER) || !defined(WITH_NOHTTP) 8712 11104 #ifndef PALM_2 8713 11105 SOAP_FMAC1 … … 8720 11112 { while (--i > 0) 8721 11113 { c = soap_getchar(soap); 8722 if (c == '\r' )11114 if (c == '\r' || c == '\n') 8723 11115 break; 8724 11116 if ((int)c == EOF) … … 8726 11118 *s++ = (char)c; 8727 11119 } 8728 c = soap_getchar(soap); 11120 if (c != '\n') 11121 c = soap_getchar(soap); /* got \r or something else, now get \n */ 8729 11122 if (c == '\n') 8730 11123 { *s = '\0'; 8731 if (i+1 == len) /* empty line: end of HTTP header */11124 if (i+1 == len) /* empty line: end of HTTP/MIME header */ 8732 11125 break; 8733 c = soap_ unget(soap, soap_getchar(soap));11126 c = soap_get0(soap); 8734 11127 if (c != ' ' && c != '\t') /* HTTP line continuation? */ 8735 11128 break; … … 8738 11131 return soap->error = SOAP_EOF; 8739 11132 } 11133 if (i < 0) 11134 return soap->error = SOAP_HDR; 8740 11135 return SOAP_OK; 8741 11136 } 11137 #endif 8742 11138 #endif 8743 11139 … … 8750 11146 register struct soap_multipart *content; 8751 11147 register size_t count = soap->count; 8752 if (soap->mode & SOAP_ENC_DIME) 11148 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Calculating the message size with attachments, current count=%lu\n", (unsigned long)count)); 11149 if ((soap->mode & SOAP_ENC_DIME) && !(soap->mode & SOAP_ENC_MTOM)) 8753 11150 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Calculating the size of DIME attachments\n")); 8754 11151 for (content = soap->dime.first; content; content = content->next) … … 8760 11157 if (content->options) 8761 11158 count += ((((unsigned char)content->options[2] << 8) | ((unsigned char)content->options[3]))+7)&(~3); 8762 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Size of DIME attachment %lu bytes\n", (unsigned long)content->size));11159 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Size of DIME attachment content is %lu bytes\n", (unsigned long)content->size)); 8763 11160 } 8764 11161 } … … 8773 11170 if (content->type) 8774 11171 count += 16 + strlen(content->type); 8775 s = soap_str_code(mime_codes, content->encoding);8776 11172 /* count Content-Transfer-Encoding: ...\r\n */ 11173 s = soap_code_str(mime_codes, content->encoding); 8777 11174 if (s) 8778 11175 count += 29 + strlen(s); … … 8785 11182 /* count Content-Description: ...\r\n */ 8786 11183 if (content->description) 8787 count += 23 + strlen(content-> location);11184 count += 23 + strlen(content->description); 8788 11185 /* count \r\n...content */ 8789 11186 count += 2 + content->size; 8790 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Size of MIME attachment %lu bytes\n", (unsigned long)content->size)); 8791 } 8792 /* count \r\n--boundary--\r\n */ 8793 count += 8 + n; 8794 } 11187 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Size of MIME attachment content is %lu bytes\n", (unsigned long)content->size)); 11188 } 11189 /* count \r\n--boundary-- */ 11190 count += 6 + n; 11191 } 11192 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "New count is %lu bytes\n", (unsigned long)count)); 8795 11193 return count; 8796 11194 #else … … 8825 11223 s = (char*)soap_malloc(soap, n + 5); 8826 11224 if (s) 8827 { s[0] = optype >> 8;8828 s[1] = optype & 0xFF;8829 s[2] = n >> 8;8830 s[3] = n & 0xFF;11225 { s[0] = (char)(optype >> 8); 11226 s[1] = (char)(optype & 0xFF); 11227 s[2] = (char)(n >> 8); 11228 s[3] = (char)(n & 0xFF); 8831 11229 strcpy(s + 4, option); 8832 11230 } … … 8846 11244 { unsigned char tmp[12]; 8847 11245 size_t optlen = 0, idlen = 0, typelen = 0; 8848 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Put DIME header id='%s'\n", soap->dime.id?soap->dime.id: ""));11246 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Put DIME header id='%s'\n", soap->dime.id?soap->dime.id:SOAP_STR_EOS)); 8849 11247 if (soap->dime.options) 8850 11248 optlen = (((unsigned char)soap->dime.options[2] << 8) | ((unsigned char)soap->dime.options[3])) + 4; 8851 11249 if (soap->dime.id) 8852 idlen = strlen(soap->dime.id); 11250 { idlen = strlen(soap->dime.id); 11251 if (idlen > 0x0000FFFF) 11252 idlen = 0x0000FFFF; 11253 } 8853 11254 if (soap->dime.type) 8854 typelen = strlen(soap->dime.type); 11255 { typelen = strlen(soap->dime.type); 11256 if (typelen > 0x0000FFFF) 11257 typelen = 0x0000FFFF; 11258 } 8855 11259 tmp[0] = SOAP_DIME_VERSION | (soap->dime.flags & 0x7); 8856 11260 tmp[1] = soap->dime.flags & 0xF0; 8857 tmp[2] = optlen >> 8;8858 tmp[3] = optlen & 0xFF;8859 tmp[4] = idlen >> 8;8860 tmp[5] = idlen & 0xFF;8861 tmp[6] = typelen >> 8;8862 tmp[7] = typelen & 0xFF;8863 tmp[8] = soap->dime.size >> 24;8864 tmp[9] = ( soap->dime.size >> 16) & 0xFF;8865 tmp[10] = ( soap->dime.size >> 8) & 0xFF;8866 tmp[11] = soap->dime.size & 0xFF;11261 tmp[2] = (char)(optlen >> 8); 11262 tmp[3] = (char)(optlen & 0xFF); 11263 tmp[4] = (char)(idlen >> 8); 11264 tmp[5] = (char)(idlen & 0xFF); 11265 tmp[6] = (char)(typelen >> 8); 11266 tmp[7] = (char)(typelen & 0xFF); 11267 tmp[8] = (char)(soap->dime.size >> 24); 11268 tmp[9] = (char)((soap->dime.size >> 16) & 0xFF); 11269 tmp[10] = (char)((soap->dime.size >> 8) & 0xFF); 11270 tmp[11] = (char)(soap->dime.size & 0xFF); 8867 11271 if (soap_send_raw(soap, (char*)tmp, 12) 8868 11272 || soap_putdimefield(soap, soap->dime.options, optlen) … … 8898 11302 return soap->error; 8899 11303 } 8900 if (! content->size && ((soap->mode & SOAP_ENC_XML) || (soap->mode & SOAP_IO) == SOAP_IO_CHUNK || (soap->mode & SOAP_IO) == SOAP_IO_STORE))11304 if (!size && ((soap->mode & SOAP_ENC_XML) || (soap->mode & SOAP_IO) == SOAP_IO_CHUNK || (soap->mode & SOAP_IO) == SOAP_IO_STORE)) 8901 11305 { size_t chunksize = sizeof(soap->tmpbuf); 8902 11306 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Chunked streaming DIME\n")); … … 8905 11309 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "fdimeread returned %lu bytes\n", (unsigned long)size)); 8906 11310 if (size < chunksize) 8907 { soap->dime.flags &= ~SOAP_DIME_CF;11311 { soap->dime.flags &= ~SOAP_DIME_CF; 8908 11312 if (!content->next) 8909 11313 soap->dime.flags |= SOAP_DIME_ME; 8910 }11314 } 8911 11315 else 8912 11316 soap->dime.flags |= SOAP_DIME_CF; 8913 soap->dime.size = size;11317 soap->dime.size = size; 8914 11318 if (soap_putdimehdr(soap) 8915 || soap_putdimefield(soap, soap->tmpbuf, size))11319 || soap_putdimefield(soap, soap->tmpbuf, size)) 8916 11320 break; 8917 11321 if (soap->dime.id) 8918 { soap->dime.flags &= ~(SOAP_DIME_MB | SOAP_DIME_MEDIA);11322 { soap->dime.flags &= ~(SOAP_DIME_MB | SOAP_DIME_MEDIA); 8919 11323 soap->dime.id = NULL; 8920 11324 soap->dime.type = NULL; … … 8930 11334 do 8931 11335 { size_t bufsize; 8932 if (size < sizeof(soap->tmpbuf))11336 if (size < sizeof(soap->tmpbuf)) 8933 11337 bufsize = size; 8934 11338 else 8935 11339 bufsize = sizeof(soap->tmpbuf); 8936 11340 if (!(bufsize = soap->fdimeread(soap, handle, soap->tmpbuf, bufsize))) 8937 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "fdimeread failed: insufficient data (%lu bytes remaining from %lu bytes)\n", (unsigned long)size, (unsigned long) soap->dime.size));11341 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "fdimeread failed: insufficient data (%lu bytes remaining from %lu bytes)\n", (unsigned long)size, (unsigned long)content->size)); 8938 11342 soap->error = SOAP_EOF; 8939 break;11343 break; 8940 11344 } 8941 11345 if (soap_send_raw(soap, soap->tmpbuf, bufsize)) … … 8969 11373 soap_getdimefield(struct soap *soap, size_t n) 8970 11374 { register soap_wchar c; 8971 register int i;11375 register size_t i; 8972 11376 register char *s; 8973 char *p = NULL;11377 register char *p = NULL; 8974 11378 if (n) 8975 11379 { p = (char*)soap_malloc(soap, n + 1); … … 9037 11441 if (!(soap->dime.type = soap_getdimefield(soap, typelen)) && soap->error) 9038 11442 return soap->error; 9039 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:""));11443 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "DIME id=%s, type=%s, options=%s\n", soap->dime.id?soap->dime.id:SOAP_STR_EOS, soap->dime.type?soap->dime.type:"", soap->dime.options?soap->dime.options+4:SOAP_STR_EOS)); 9040 11444 if (soap->dime.flags & SOAP_DIME_ME) 9041 11445 soap->mode &= ~SOAP_ENC_DIME; … … 9052 11456 SOAP_FMAC2 9053 11457 soap_getdime(struct soap *soap) 9054 { struct soap_multipart *content; 9055 if (soap_getdimehdr(soap)) 11458 { while (soap->dime.flags & SOAP_DIME_CF) 11459 { if (soap_getdimehdr(soap)) 11460 return soap->error; 11461 if (soap_move(soap, (long)soap->dime.size)) 11462 return soap->error = SOAP_EOF; 11463 } 11464 if (soap_move(soap, (long)(((soap->dime.size+3)&(~3))-soap_tell(soap)))) 11465 return soap->error = SOAP_EOF; 11466 for (;;) 11467 { register struct soap_multipart *content; 11468 if (soap_getdimehdr(soap)) 11469 break; 11470 if (soap->fdimewriteopen && ((soap->dime.ptr = (char*)soap->fdimewriteopen(soap, soap->dime.id, soap->dime.type, soap->dime.options)) || soap->error)) 11471 { const char *id, *type, *options; 11472 size_t size, n; 11473 if (!soap->dime.ptr) 11474 return soap->error; 11475 id = soap->dime.id; 11476 type = soap->dime.type; 11477 options = soap->dime.options; 11478 for (;;) 11479 { size = soap->dime.size; 11480 for (;;) 11481 { n = soap->buflen - soap->bufidx; 11482 if (size < n) 11483 n = size; 11484 if ((soap->error = soap->fdimewrite(soap, (void*)soap->dime.ptr, soap->buf + soap->bufidx, n))) 11485 break; 11486 size -= n; 11487 if (!size) 11488 { soap->bufidx += n; 11489 break; 11490 } 11491 if (soap_recv(soap)) 11492 { soap->error = SOAP_EOF; 11493 goto end; 11494 } 11495 } 11496 if (soap_move(soap, -(long)soap->dime.size&3)) 11497 { soap->error = SOAP_EOF; 11498 break; 11499 } 11500 if (!(soap->dime.flags & SOAP_DIME_CF)) 11501 break; 11502 if (soap_getdimehdr(soap)) 11503 break; 11504 } 11505 end: 11506 if (soap->fdimewriteclose) 11507 soap->fdimewriteclose(soap, (void*)soap->dime.ptr); 11508 soap->dime.size = 0; 11509 soap->dime.id = id; 11510 soap->dime.type = type; 11511 soap->dime.options = options; 11512 } 11513 else if (soap->dime.flags & SOAP_DIME_CF) 11514 { const char *id, *type, *options; 11515 id = soap->dime.id; 11516 type = soap->dime.type; 11517 options = soap->dime.options; 11518 if (soap_new_block(soap) == NULL) 11519 return SOAP_EOM; 11520 for (;;) 11521 { register soap_wchar c; 11522 register size_t i; 11523 register char *s; 11524 s = (char*)soap_push_block(soap, NULL, soap->dime.size); 11525 if (!s) 11526 return soap->error = SOAP_EOM; 11527 for (i = soap->dime.size; i > 0; i--) 11528 { if ((int)(c = soap_get1(soap)) == EOF) 11529 return soap->error = SOAP_EOF; 11530 *s++ = (char)c; 11531 } 11532 if (soap_move(soap, -(long)soap->dime.size&3)) 11533 return soap->error = SOAP_EOF; 11534 if (!(soap->dime.flags & SOAP_DIME_CF)) 11535 break; 11536 if (soap_getdimehdr(soap)) 11537 return soap->error; 11538 } 11539 soap->dime.size = soap->blist->size++; /* allocate one more for '\0' */ 11540 if (!(soap->dime.ptr = soap_save_block(soap, NULL, NULL, 0))) 11541 return soap->error; 11542 soap->dime.ptr[soap->dime.size] = '\0'; /* force 0-terminated */ 11543 soap->dime.id = id; 11544 soap->dime.type = type; 11545 soap->dime.options = options; 11546 } 11547 else 11548 soap->dime.ptr = soap_getdimefield(soap, soap->dime.size); 11549 content = soap_new_multipart(soap, &soap->dime.first, &soap->dime.last, soap->dime.ptr, soap->dime.size); 11550 if (!content) 11551 return soap->error = SOAP_EOM; 11552 content->id = soap->dime.id; 11553 content->type = soap->dime.type; 11554 content->options = soap->dime.options; 11555 if (soap->error) 11556 return soap->error; 11557 soap_resolve_attachment(soap, content); 11558 } 11559 if (soap->error != SOAP_DIME_END) 9056 11560 return soap->error; 9057 if (soap->fdimewriteopen && ((soap->dime.ptr = (char*)soap->fdimewriteopen(soap, soap->dime.id, soap->dime.type, soap->dime.options)) || soap->error)) 9058 { const char *id, *type, *options; 9059 size_t size, n; 9060 if (!soap->dime.ptr) 9061 return soap->error; 9062 id = soap->dime.id; 9063 type = soap->dime.type; 9064 options = soap->dime.options; 9065 for (;;) 9066 { size = soap->dime.size; 9067 for (;;) 9068 { n = soap->buflen - soap->bufidx; 9069 if (size < n) 9070 n = size; 9071 if ((soap->error = soap->fdimewrite(soap, (void*)soap->dime.ptr, soap->buf + soap->bufidx, n))) 9072 break; 9073 size -= n; 9074 if (!size) 9075 { soap->bufidx += n; 9076 break; 9077 } 9078 if (soap_recv(soap)) 9079 { soap->error = SOAP_EOF; 9080 goto end; 9081 } 9082 } 9083 if (soap_move(soap, -(long)soap->dime.size&3)) 9084 { soap->error = SOAP_EOF; 9085 break; 9086 } 9087 if (!(soap->dime.flags & SOAP_DIME_CF)) 9088 break; 9089 if (soap_getdimehdr(soap)) 9090 break; 9091 } 9092 end: 9093 if (soap->fdimewriteclose) 9094 soap->fdimewriteclose(soap, (void*)soap->dime.ptr); 9095 soap->dime.size = 0; 9096 soap->dime.id = id; 9097 soap->dime.type = type; 9098 soap->dime.options = options; 9099 } 9100 else if (soap->dime.flags & SOAP_DIME_CF) 9101 { const char *id, *type, *options; 9102 register soap_wchar c; 9103 register char *s; 9104 register int i; 9105 id = soap->dime.id; 9106 type = soap->dime.type; 9107 options = soap->dime.options; 9108 if (soap_new_block(soap)) 9109 return SOAP_EOM; 9110 for (;;) 9111 { s = (char*)soap_push_block(soap, soap->dime.size); 9112 if (!s) 9113 return soap->error = SOAP_EOM; 9114 for (i = soap->dime.size; i > 0; i--) 9115 { if ((int)(c = soap_get1(soap)) == EOF) 9116 return soap->error = SOAP_EOF; 9117 *s++ = (char)c; 9118 } 9119 if (soap_move(soap, -(long)soap->dime.size&3)) 9120 return soap->error = SOAP_EOF; 9121 if (!(soap->dime.flags & SOAP_DIME_CF)) 9122 break; 9123 if (soap_getdimehdr(soap)) 9124 return soap->error; 9125 } 9126 soap->dime.size = soap->blist->size++; /* allocate one more for '\0' */ 9127 if (!(soap->dime.ptr = soap_save_block(soap, NULL, 0))) 9128 return soap->error; 9129 soap->dime.ptr[soap->dime.size] = '\0'; /* force 0-terminated */ 9130 soap->dime.id = id; 9131 soap->dime.type = type; 9132 soap->dime.options = options; 9133 } 9134 else 9135 soap->dime.ptr = soap_getdimefield(soap, soap->dime.size); 9136 content = soap_new_multipart(soap, &soap->dime.first, &soap->dime.last, soap->dime.ptr, soap->dime.size); 9137 if (!content) 9138 return soap->error = SOAP_EOM; 9139 content->id = soap->dime.id; 9140 content->type = soap->dime.type; 9141 content->options = soap->dime.options; 9142 return soap->error; 11561 return soap->error = SOAP_OK; 9143 11562 } 9144 11563 #endif … … 9191 11610 else if (!soap_tag_cmp(key, "Content-Location")) 9192 11611 content->location = soap_strdup(soap, val); 11612 else if (!soap_tag_cmp(key, "Content-Disposition")) 11613 content->id = soap_strdup(soap, soap_get_header_attribute(soap, val, "name")); 9193 11614 else if (!soap_tag_cmp(key, "Content-Type")) 9194 11615 content->type = soap_strdup(soap, val); … … 9196 11617 content->description = soap_strdup(soap, val); 9197 11618 else if (!soap_tag_cmp(key, "Content-Transfer-Encoding")) 9198 content->encoding = (enum soap_mime_encoding)soap_ int_code(mime_codes, val, (long)SOAP_MIME_NONE);11619 content->encoding = (enum soap_mime_encoding)soap_code_int(mime_codes, val, (long)SOAP_MIME_NONE); 9199 11620 } 9200 11621 if (soap_getline(soap, key, sizeof(soap->msgbuf))) … … 9213 11634 SOAP_FMAC2 9214 11635 soap_getmime(struct soap *soap) 9215 { register soap_wchar c; 9216 if (!soap->mime.last) 9217 return SOAP_OK; 11636 { while (soap_get_mime_attachment(soap, NULL)) 11637 ; 11638 return soap->error; 11639 } 11640 #endif 11641 #endif 11642 11643 /******************************************************************************/ 11644 #ifndef WITH_LEANER 11645 #ifndef PALM_1 11646 SOAP_FMAC1 11647 void 11648 SOAP_FMAC2 11649 soap_post_check_mime_attachments(struct soap *soap) 11650 { soap->imode |= SOAP_MIME_POSTCHECK; 11651 } 11652 #endif 11653 #endif 11654 11655 /******************************************************************************/ 11656 #ifndef WITH_LEANER 11657 #ifndef PALM_1 11658 SOAP_FMAC1 11659 int 11660 SOAP_FMAC2 11661 soap_check_mime_attachments(struct soap *soap) 11662 { if (soap->mode & SOAP_MIME_POSTCHECK) 11663 return soap_get_mime_attachment(soap, NULL) != NULL; 11664 return 0; 11665 } 11666 #endif 11667 #endif 11668 11669 /******************************************************************************/ 11670 #ifndef WITH_LEANER 11671 #ifndef PALM_1 11672 SOAP_FMAC1 11673 struct soap_multipart * 11674 SOAP_FMAC2 11675 soap_get_mime_attachment(struct soap *soap, void *handle) 11676 { register soap_wchar c = 0; 11677 register size_t i, m = 0; 11678 register char *s, *t = NULL; 11679 register struct soap_multipart *content; 11680 register short flag = 0; 11681 if (!(soap->mode & SOAP_ENC_MIME)) 11682 return NULL; 11683 content = soap->mime.last; 11684 if (!content) 11685 { if (soap_getmimehdr(soap)) 11686 return NULL; 11687 content = soap->mime.last; 11688 } 11689 else if (content != soap->mime.first) 11690 { if (soap->fmimewriteopen && ((content->ptr = (char*)soap->fmimewriteopen(soap, (void*)handle, content->id, content->type, content->description, content->encoding)) || soap->error)) 11691 { if (!content->ptr) 11692 return NULL; 11693 } 11694 } 11695 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Parsing MIME content id=%s type=%s\n", content->id?content->id:SOAP_STR_EOS, content->type?content->type:SOAP_STR_EOS)); 11696 if (!content->ptr && soap_new_block(soap) == NULL) 11697 { soap->error = SOAP_EOM; 11698 return NULL; 11699 } 9218 11700 for (;;) 9219 { register size_t i, m = 0; 9220 register char *s; 9221 struct soap_multipart *content = soap->mime.last; 9222 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Parsing MIME content id=%s type=%s\n", content->id?content->id:"", content->type?content->type:"")); 9223 if (soap_new_block(soap)) 9224 return soap->error = SOAP_EOM; 9225 for (;;) 9226 { register char *t = NULL; 9227 if (!(s = (char*)soap_push_block(soap, SOAP_BLKLEN))) 9228 return soap->error = SOAP_EOM; 9229 for (i = 0; i < SOAP_BLKLEN; i++) 9230 { if (m > 0) 9231 { *s++ = *t++; 9232 m--; 9233 } 9234 else 11701 { if (content->ptr) 11702 s = soap->tmpbuf; 11703 else if (!(s = (char*)soap_push_block(soap, NULL, sizeof(soap->tmpbuf)))) 11704 { soap->error = SOAP_EOM; 11705 return NULL; 11706 } 11707 for (i = 0; i < sizeof(soap->tmpbuf); i++) 11708 { if (m > 0) 11709 { *s++ = *t++; 11710 m--; 11711 } 11712 else 11713 { if (!flag) 9235 11714 { c = soap_get1(soap); 9236 if ((int)c == EOF) 9237 return soap->error = SOAP_EOF; 9238 if (c == '\r') 9239 { t = soap->tmpbuf; 9240 strcpy(t, "\n--"); 9241 strncat(t, soap->mime.boundary, sizeof(soap->tmpbuf)-3); 9242 t[sizeof(soap->tmpbuf)-1] = '\0'; 9243 do c = soap_getchar(soap); 9244 while (c == *t++); 9245 if ((int)c == EOF) 9246 return soap->error = SOAP_EOF; 9247 if (!*--t) 9248 goto end; 9249 *t = (char)c; 9250 m = t - soap->tmpbuf + 1; 9251 t = soap->tmpbuf; 9252 c = '\r'; 9253 } 9254 *s++ = (char)c; 11715 if ((int)c == EOF) 11716 { soap->error = SOAP_EOF; 11717 return NULL; 11718 } 9255 11719 } 9256 } 9257 } 11720 if (flag || c == '\r') 11721 { t = soap->msgbuf; 11722 memset(t, 0, sizeof(soap->msgbuf)); 11723 strcpy(t, "\n--"); 11724 if (soap->mime.boundary) 11725 strncat(t, soap->mime.boundary, sizeof(soap->msgbuf)-4); 11726 do c = soap_getchar(soap); 11727 while (c == *t++); 11728 if ((int)c == EOF) 11729 { soap->error = SOAP_EOF; 11730 return NULL; 11731 } 11732 if (!*--t) 11733 goto end; 11734 *t = (char)c; 11735 flag = (c == '\r'); 11736 m = t - soap->msgbuf + 1 - flag; 11737 t = soap->msgbuf; 11738 c = '\r'; 11739 } 11740 *s++ = (char)c; 11741 } 11742 } 11743 if (content->ptr && soap->fmimewrite) 11744 { if ((soap->error = soap->fmimewrite(soap, (void*)content->ptr, soap->tmpbuf, i))) 11745 break; 11746 } 11747 } 9258 11748 end: 9259 *s = '\0'; /* force 0-terminated */ 9260 content->size = soap_size_block(soap, i+1)-1; 9261 content->ptr = soap_save_block(soap, NULL, 0); 9262 if (c == '-' && soap_getchar(soap) == '-') 9263 break; 9264 while (c != '\r' && (int)c != EOF && soap_blank(c)) 11749 *s = '\0'; /* force 0-terminated */ 11750 if (content->ptr) 11751 { if (!soap->error && soap->fmimewrite) 11752 soap->error = soap->fmimewrite(soap, (void*)content->ptr, soap->tmpbuf, i); 11753 if (soap->fmimewriteclose) 11754 soap->fmimewriteclose(soap, (void*)content->ptr); 11755 if (soap->error) 11756 return NULL; 11757 } 11758 else 11759 { content->size = soap_size_block(soap, NULL, i+1)-1; 11760 content->ptr = soap_save_block(soap, NULL, NULL, 0); 11761 } 11762 soap_resolve_attachment(soap, content); 11763 if (c == '-' && soap_getchar(soap) == '-') 11764 { soap->mode &= ~SOAP_ENC_MIME; 11765 if ((soap->mode & SOAP_MIME_POSTCHECK) && soap_end_recv(soap)) 11766 return NULL; 11767 } 11768 else 11769 { while (c != '\r' && (int)c != EOF && soap_blank(c)) 9265 11770 c = soap_getchar(soap); 9266 11771 if (c != '\r' || soap_getchar(soap) != '\n') 9267 return soap->error = SOAP_MIME_ERROR; 11772 { soap->error = SOAP_MIME_ERROR; 11773 return NULL; 11774 } 9268 11775 if (soap_getmimehdr(soap)) 9269 return soap->error; 9270 } 9271 do c = soap_getchar(soap); 9272 while ((int)c != EOF && c != '\r'); 9273 if ((int)c == EOF) 9274 return soap->error = SOAP_EOF; 9275 if (soap_getchar(soap) != '\n') 9276 return soap->error = SOAP_MIME_ERROR; 9277 return SOAP_OK; 11776 return NULL; 11777 } 11778 return content; 11779 } 11780 #endif 11781 #endif 11782 11783 /******************************************************************************/ 11784 #ifndef WITH_LEANER 11785 #ifndef PALM_1 11786 SOAP_FMAC1 11787 int 11788 SOAP_FMAC2 11789 soap_match_cid(struct soap *soap, const char *s, const char *t) 11790 { register size_t n; 11791 if (!s) 11792 return 1; 11793 if (!strcmp(s, t)) 11794 return 0; 11795 if (!strncmp(s, "cid:", 4)) 11796 s += 4; 11797 n = strlen(t); 11798 if (*t == '<') 11799 { t++; 11800 n -= 2; 11801 } 11802 if (!strncmp(s, t, n) && !s[n]) 11803 return 0; 11804 soap_decode(soap->tmpbuf, sizeof(soap->tmpbuf), s, SOAP_STR_EOS); 11805 if (!strncmp(soap->tmpbuf, t, n) && !soap->tmpbuf[n]) 11806 return 0; 11807 return 1; 11808 } 11809 #endif 11810 #endif 11811 11812 /******************************************************************************/ 11813 #ifndef WITH_LEANER 11814 #ifndef PALM_1 11815 static void 11816 soap_resolve_attachment(struct soap *soap, struct soap_multipart *content) 11817 { if (content->id) 11818 { register struct soap_xlist **xp = &soap->xlist; 11819 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Resolving attachment data for id=%s\n", content->id)); 11820 while (*xp) 11821 { register struct soap_xlist *xq = *xp; 11822 if (!soap_match_cid(soap, xq->id, content->id)) 11823 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Found matching attachment %s for content id=%s\n", xq->id, content->id)); 11824 *xp = xq->next; 11825 *xq->ptr = (unsigned char*)content->ptr; 11826 *xq->size = (int)content->size; 11827 *xq->type = (char*)content->type; 11828 if (content->options) 11829 *xq->options = (char*)content->options; 11830 else 11831 *xq->options = (char*)content->description; 11832 SOAP_FREE(soap, xq); 11833 } 11834 else 11835 xp = &(*xp)->next; 11836 } 11837 } 9278 11838 } 9279 11839 #endif … … 9288 11848 soap_putmimehdr(struct soap *soap, struct soap_multipart *content) 9289 11849 { const char *s; 9290 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "MIME attachment type=%s\n", content->type?content->type: ""));11850 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "MIME attachment type=%s\n", content->type?content->type:SOAP_STR_EOS)); 9291 11851 if (soap_send3(soap, "\r\n--", soap->mime.boundary, "\r\n")) 9292 11852 return soap->error; 9293 11853 if (content->type && soap_send3(soap, "Content-Type: ", content->type, "\r\n")) 9294 11854 return soap->error; 9295 s = soap_ str_code(mime_codes, content->encoding);11855 s = soap_code_str(mime_codes, content->encoding); 9296 11856 if (s && soap_send3(soap, "Content-Transfer-Encoding: ", s, "\r\n")) 9297 11857 return soap->error; … … 9319 11879 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Sending MIME attachments\n")); 9320 11880 for (content = soap->mime.first; content; content = content->next) 9321 if (soap_putmimehdr(soap, content) 9322 || soap_send_raw(soap, content->ptr, content->size)) 9323 return soap->error; 9324 return soap_send3(soap, "\r\n--", soap->mime.boundary, "--\r\n"); 11881 { void *handle; 11882 if (soap->fmimereadopen && ((handle = soap->fmimereadopen(soap, (void*)content->ptr, content->id, content->type, content->description)) || soap->error)) 11883 { size_t size = content->size; 11884 if (!handle) 11885 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "fmimereadopen failed\n")); 11886 return soap->error; 11887 } 11888 if (soap_putmimehdr(soap, content)) 11889 return soap->error; 11890 if (!size) 11891 { if ((soap->mode & SOAP_ENC_XML) || (soap->mode & SOAP_IO) == SOAP_IO_CHUNK || (soap->mode & SOAP_IO) == SOAP_IO_STORE) 11892 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Chunked streaming MIME\n")); 11893 do 11894 { size = soap->fmimeread(soap, handle, soap->tmpbuf, sizeof(soap->tmpbuf)); 11895 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "fmimeread returned %lu bytes\n", (unsigned long)size)); 11896 if (soap_send_raw(soap, soap->tmpbuf, size)) 11897 break; 11898 } while (size); 11899 } 11900 else 11901 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Error: cannot chunk streaming MIME (no HTTP chunking)\n")); 11902 } 11903 } 11904 else 11905 { do 11906 { size_t bufsize; 11907 if (size < sizeof(soap->tmpbuf)) 11908 bufsize = size; 11909 else 11910 bufsize = sizeof(soap->tmpbuf); 11911 if (!(bufsize = soap->fmimeread(soap, handle, soap->tmpbuf, bufsize))) 11912 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "fmimeread failed: insufficient data (%lu bytes remaining from %lu bytes)\n", (unsigned long)size, (unsigned long)content->size)); 11913 soap->error = SOAP_EOF; 11914 break; 11915 } 11916 if (soap_send_raw(soap, soap->tmpbuf, bufsize)) 11917 break; 11918 size -= bufsize; 11919 } while (size); 11920 } 11921 if (soap->fmimereadclose) 11922 soap->fmimereadclose(soap, handle); 11923 } 11924 else 11925 { if (soap_putmimehdr(soap, content) 11926 || soap_send_raw(soap, content->ptr, content->size)) 11927 return soap->error; 11928 } 11929 } 11930 return soap_send3(soap, "\r\n--", soap->mime.boundary, "--"); 9325 11931 } 9326 11932 #endif … … 9478 12084 n = strlen(s); 9479 12085 if (n < 16) 9480 { n = 72;9481 s = soap->mime.boundary = (char*)soap_malloc(soap, n );12086 { n = 64; 12087 s = soap->mime.boundary = (char*)soap_malloc(soap, n + 1); 9482 12088 if (!s) 9483 12089 return; 9484 12090 } 9485 strcpy(s, " <>");12091 strcpy(s, "=="); 9486 12092 s += 2; 9487 12093 n -= 4; 9488 12094 while (n) 9489 { *s++ = soap_base64o[ rand()&0x3F];12095 { *s++ = soap_base64o[soap_random & 0x3F]; 9490 12096 n--; 9491 12097 } 9492 *s = '\0'; 9493 strcat(s, "<>"); 12098 strcpy(s, "=="); 9494 12099 } 9495 12100 if (!soap->mime.start) … … 9505 12110 soap_valid_mime_boundary(struct soap *soap) 9506 12111 { register struct soap_multipart *content; 9507 register size_t k = strlen(soap->mime.boundary); 12112 register size_t k; 12113 if (soap->fmimeread) 12114 return SOAP_OK; 12115 k = strlen(soap->mime.boundary); 9508 12116 for (content = soap->mime.first; content; content = content->next) 9509 12117 { if (content->ptr && content->size >= k) … … 9511 12119 register size_t i; 9512 12120 for (i = 0; i < content->size - k; i++, p++) 9513 if (!strncmp(p, soap->mime.boundary, k))12121 { if (!strncmp(p, soap->mime.boundary, k)) 9514 12122 return SOAP_ERR; 12123 } 9515 12124 } 9516 12125 } … … 9520 12129 #endif 9521 12130 9522 /******************************************************************************/ 12131 /******************************************************************************\ 12132 * 12133 * HTTP cookie handling 12134 * 12135 \******************************************************************************/ 9523 12136 9524 12137 #ifdef WITH_COOKIES … … 9531 12144 register size_t n = len; 9532 12145 while ((c = *s++) && --n > 0) 9533 { if (c > ' ' && c < 128 && c != ';' && c != ',')12146 { if (c > ' ' && c < 128 && !strchr("()<>@,;:\\\"/[]?={}", c)) 9534 12147 *t++ = c; 9535 12148 else if (n > 2) … … 9558 12171 if (!path) 9559 12172 path = soap->cookie_path; 9560 if (*path == '/') 12173 if (!path) 12174 path = SOAP_STR_EOS; 12175 else if (*path == '/') 9561 12176 path++; 9562 12177 n = strlen(path); 12178 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Search cookie %s domain=%s path=%s\n", name, domain?domain:"(null)", path?path:"(null)")); 9563 12179 for (p = soap->cookies; p; p = p->next) 12180 { 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)); 9564 12181 if (!strcmp(p->name, name) 9565 && domain9566 12182 && p->domain 12183 && p->path 9567 12184 && !strcmp(p->domain, domain) 9568 12185 && !strncmp(p->path, path, n)) 9569 12186 break; 12187 } 9570 12188 return p; 9571 12189 } … … 9578 12196 { struct soap_cookie **p, *q; 9579 12197 int n; 9580 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set cookie: %s=%s domain=%s path=%s\n", name, value?value:"", domain?domain:"", path?path:""));9581 12198 if (!domain) 9582 12199 domain = soap->cookie_domain; … … 9584 12201 path = soap->cookie_path; 9585 12202 if (!path) 9586 { soap_set_receiver_error(soap, "Cookie path not set", NULL, SOAP_HTTP_ERROR); 9587 return NULL; 9588 } 9589 if (*path == '/') 12203 path = SOAP_STR_EOS; 12204 else if (*path == '/') 9590 12205 path++; 9591 12206 q = soap_cookie(soap, name, domain, path); 12207 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set %scookie: %s=%s domain=%s path=%s\n", q ? SOAP_STR_EOS : "new ", name, value?value:"(null)", domain?domain:"(null)", path?path:"(null)")); 9592 12208 if (!q) 9593 { if ((q = (struct soap_cookie*)SOAP_MALLOC(s izeof(struct soap_cookie))))9594 { if ((q->name = (char*)SOAP_MALLOC(s trlen(name)+1)))12209 { if ((q = (struct soap_cookie*)SOAP_MALLOC(soap, sizeof(struct soap_cookie)))) 12210 { if ((q->name = (char*)SOAP_MALLOC(soap, strlen(name)+1))) 9595 12211 strcpy(q->name, name); 9596 12212 q->value = NULL; 9597 12213 q->domain = NULL; 9598 12214 q->path = NULL; 9599 q->expire = -1; 9600 q->version = 0; 12215 q->expire = 0; 12216 q->maxage = -1; 12217 q->version = 1; 9601 12218 q->secure = 0; 9602 q->env = 0;9603 12219 q->modified = 0; 9604 12220 for (p = &soap->cookies, n = soap->cookie_max; *p && n; p = &(*p)->next, n--) 9605 if (!strcmp((*p)->name, name) && (*p)->path && strcmp((*p)->path, path) < 0)12221 if (!strcmp((*p)->name, name) && (*p)->path && path && strcmp((*p)->path, path) < 0) 9606 12222 break; 9607 12223 if (n) … … 9610 12226 } 9611 12227 else 9612 { SOAP_FREE( q->name);9613 SOAP_FREE( q);12228 { SOAP_FREE(soap, q->name); 12229 SOAP_FREE(soap, q); 9614 12230 q = NULL; 9615 12231 } … … 9620 12236 if (q) 9621 12237 { if (q->value) 9622 { SOAP_FREE( q->value);12238 { SOAP_FREE(soap, q->value); 9623 12239 q->value = NULL; 9624 12240 } 9625 12241 if (q->domain) 9626 { SOAP_FREE( q->domain);12242 { SOAP_FREE(soap, q->domain); 9627 12243 q->domain = NULL; 9628 12244 } 9629 12245 if (q->path) 9630 { SOAP_FREE( q->path);12246 { SOAP_FREE(soap, q->path); 9631 12247 q->path = NULL; 9632 12248 } 9633 if (value && *value && (q->value = (char*)SOAP_MALLOC(s trlen(value)+1)))12249 if (value && *value && (q->value = (char*)SOAP_MALLOC(soap, strlen(value)+1))) 9634 12250 strcpy(q->value, value); 9635 if (domain && *domain && (q->domain = (char*)SOAP_MALLOC(strlen(domain)+1)))12251 if (domain && (q->domain = (char*)SOAP_MALLOC(soap, strlen(domain)+1))) 9636 12252 strcpy(q->domain, domain); 9637 if (path && *path && (q->path = (char*)SOAP_MALLOC(strlen(path)+1)))12253 if (path && (q->path = (char*)SOAP_MALLOC(soap, strlen(path)+1))) 9638 12254 strcpy(q->path, path); 9639 12255 q->session = 1; 12256 q->env = 0; 9640 12257 } 9641 12258 return q; … … 9651 12268 domain = soap->cookie_domain; 9652 12269 if (!domain) 9653 { soap_set_receiver_error(soap, "Cookie domain not set", SOAP_STR_EOS, SOAP_HTTP_ERROR);12270 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Error in clear cookie %s: cookie domain not set\n", name?name:"(null)")); 9654 12271 return; 9655 12272 } … … 9657 12274 path = soap->cookie_path; 9658 12275 if (!path) 9659 { soap_set_receiver_error(soap, "Cookie path not set", SOAP_STR_EOS, SOAP_HTTP_ERROR);12276 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Error in clear cookie %s: cookie path not set\n", name?name:"(null)")); 9660 12277 return; 9661 12278 } … … 9663 12280 path++; 9664 12281 for (p = &soap->cookies, q = *p; q; q = *p) 9665 if (!strcmp(q->name, name) && !strcmp(q->domain, domain) && !strncmp(q->path, path, strlen(q->path)))12282 { if (!strcmp(q->name, name) && !strcmp(q->domain, domain) && !strncmp(q->path, path, strlen(q->path))) 9666 12283 { if (q->value) 9667 SOAP_FREE( q->value);12284 SOAP_FREE(soap, q->value); 9668 12285 if (q->domain) 9669 SOAP_FREE( q->domain);12286 SOAP_FREE(soap, q->domain); 9670 12287 if (q->path) 9671 SOAP_FREE( q->path);12288 SOAP_FREE(soap, q->path); 9672 12289 *p = q->next; 9673 SOAP_FREE( q);12290 SOAP_FREE(soap, q); 9674 12291 } 9675 12292 else 9676 12293 p = &q->next; 12294 } 9677 12295 } 9678 12296 … … 9690 12308 /******************************************************************************/ 9691 12309 SOAP_FMAC1 9692 long 12310 char * 12311 SOAP_FMAC2 12312 soap_env_cookie_value(struct soap *soap, const char *name, const char *domain, const char *path) 12313 { struct soap_cookie *p; 12314 if ((p = soap_cookie(soap, name, domain, path)) && p->env) 12315 return p->value; 12316 return NULL; 12317 } 12318 12319 /******************************************************************************/ 12320 SOAP_FMAC1 12321 time_t 9693 12322 SOAP_FMAC2 9694 12323 soap_cookie_expire(struct soap *soap, const char *name, const char *domain, const char *path) … … 9705 12334 soap_set_cookie_expire(struct soap *soap, const char *name, long expire, const char *domain, const char *path) 9706 12335 { struct soap_cookie *p; 12336 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)")); 9707 12337 if ((p = soap_cookie(soap, name, domain, path))) 9708 { p-> expire = expire;12338 { p->maxage = expire; 9709 12339 p->modified = 1; 9710 12340 return SOAP_OK; … … 9750 12380 const char *t; 9751 12381 for (p = soap->cookies; p; p = p->next) 9752 { if (p->modified || !p->env) 12382 { 12383 if (p->modified 12384 #ifdef WITH_OPENSSL 12385 || (!p->env && !soap->ssl == !p->secure) 12386 #endif 12387 ) 9753 12388 { s = tmp; 9754 12389 if (p->name) … … 9759 12394 } 9760 12395 if (p->domain && (int)strlen(p->domain) < tmp-s+4064) 9761 sprintf(s, ";Domain=%s", p->domain); 12396 { strcpy(s, ";Domain="); 12397 strcat(s, p->domain); 12398 } 9762 12399 else if (soap->cookie_domain && (int)strlen(soap->cookie_domain) < tmp-s+4064) 9763 sprintf(s, ";Domain=%s", soap->cookie_domain); 12400 { strcpy(s, ";Domain="); 12401 strcat(s, soap->cookie_domain); 12402 } 9764 12403 strcat(s, ";Path=/"); 12404 s += strlen(s); 9765 12405 if (p->path) 9766 12406 t = p->path; … … 9771 12411 t++; 9772 12412 if ((int)strlen(t) < tmp-s+4064) 9773 strcat(s, t); 9774 } 9775 s += strlen(s); 9776 if (p->version > 0) 9777 sprintf(s, ";Version=%u", p->version); 9778 if (p->expire >= 0) 9779 sprintf(s, ";Max-Age=%ld", p->expire); 9780 if (p->secure) 9781 strcat(s, ";Secure"); 12413 { if (strchr(t, '%')) /* already URL encoded? */ 12414 { strcpy(s, t); 12415 s += strlen(s); 12416 } 12417 else 12418 s += soap_encode_cookie(t, s, tmp-s+4064); 12419 } 12420 } 12421 if (p->version > 0 && s-tmp < 4060) 12422 { sprintf(s, ";Version=%u", p->version); 12423 s += strlen(s); 12424 } 12425 if (p->maxage >= 0 && s-tmp < 4060) 12426 { sprintf(s, ";Max-Age=%ld", p->maxage); 12427 s += strlen(s); 12428 } 12429 if (s-tmp < 4073 12430 && (p->secure 12431 #ifdef WITH_OPENSSL 12432 || soap->ssl 12433 #endif 12434 )) 12435 strcpy(s, ";Secure"); 9782 12436 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set-Cookie: %s\n", tmp)); 9783 if ( soap->fposthdr(soap, "Set-Cookie", tmp))12437 if ((soap->error = soap->fposthdr(soap, "Set-Cookie", tmp))) 9784 12438 return soap->error; 9785 12439 } … … 9798 12452 char *s, tmp[4096]; 9799 12453 p = &soap->cookies; 12454 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Sending cookies for domain=%s path=%s\n", domain, path)); 12455 if (*path == '/') 12456 path++; 9800 12457 while ((q = *p)) 9801 12458 { if (q->expire && now > q->expire) 9802 12459 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Cookie %s expired\n", q->name)); 9803 SOAP_FREE( q->name);12460 SOAP_FREE(soap, q->name); 9804 12461 if (q->value) 9805 SOAP_FREE( q->value);12462 SOAP_FREE(soap, q->value); 9806 12463 if (q->domain) 9807 SOAP_FREE( q->domain);12464 SOAP_FREE(soap, q->domain); 9808 12465 if (q->path) 9809 SOAP_FREE( q->path);12466 SOAP_FREE(soap, q->path); 9810 12467 *p = q->next; 9811 SOAP_FREE(q); 9812 } 9813 else if ((!q->domain || !strcmp(q->domain, domain)) 12468 SOAP_FREE(soap, q); 12469 } 12470 else 12471 { int flag; 12472 char *t = q->domain; 12473 size_t n = 0; 12474 if (!t) 12475 flag = 1; 12476 else 12477 { const char *r = strchr(t, ':'); 12478 if (r) 12479 n = r - t; 12480 else 12481 n = strlen(t); 12482 flag = !strncmp(t, domain, n); 12483 } 12484 /* domain-level cookies, cannot compile when WITH_NOIO set */ 12485 #ifndef WITH_NOIO 12486 if (!flag) 12487 { struct hostent *hostent = gethostbyname((char*)domain); 12488 if (hostent) 12489 { const char *r = strchr(hostent->h_name, '.'); 12490 if (!r) 12491 r = hostent->h_name; 12492 flag = !strncmp(t, r, n); 12493 } 12494 } 12495 #endif 12496 if (flag 9814 12497 && (!q->path || !strncmp(q->path, path, strlen(q->path))) 9815 12498 && (!q->secure || secure)) 9816 { s = tmp; 9817 if (q->version != version) 9818 { sprintf(s, "$Version=%u;", q->version); 9819 version = q->version; 9820 } 9821 if (q->name) 9822 s += soap_encode_cookie(q->name, s, tmp-s+4080); 9823 if (q->value && *q->value) 9824 { *s++ = '='; 9825 s += soap_encode_cookie(q->value, s, tmp-s+4080); 9826 } 9827 if (q->path && (int)strlen(q->path) < tmp-s+4080) 9828 { sprintf(s, ";$Path=/%s", q->path); 9829 s += strlen(s); 9830 } 9831 if (q->domain && (int)strlen(q->domain) < tmp-s+4080) 9832 sprintf(s, ";$Domain=%s", q->domain); 9833 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Cookie: %s\n", tmp)); 9834 if (soap->fposthdr(soap, "Cookie", tmp)) 9835 return soap->error; 12499 { s = tmp; 12500 if (q->version != version) 12501 { sprintf(s, "$Version=%u;", q->version); 12502 version = q->version; 12503 } 12504 if (q->name) 12505 s += soap_encode_cookie(q->name, s, tmp-s+4080); 12506 if (q->value && *q->value) 12507 { *s++ = '='; 12508 s += soap_encode_cookie(q->value, s, tmp-s+4080); 12509 } 12510 if (q->path && *q->path && (int)strlen(q->path) < tmp-s+4080) 12511 { sprintf(s, ";$Path=\"/%s\"", (*q->path == '/' ? q->path + 1 : q->path)); 12512 s += strlen(s); 12513 } 12514 if (q->domain && (int)strlen(q->domain) < tmp-s+4080) 12515 sprintf(s, ";$Domain=\"%s\"", q->domain); 12516 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Cookie: %s\n", tmp)); 12517 if ((soap->error = soap->fposthdr(soap, "Cookie", tmp))) 12518 return soap->error; 12519 } 9836 12520 p = &q->next; 9837 12521 } 9838 else9839 p = &q->next;9840 12522 } 9841 12523 return SOAP_OK; … … 9870 12552 { s = soap_decode_val(tmp, sizeof(tmp), s); 9871 12553 if (*tmp) 9872 { if ((t = (char*)SOAP_MALLOC(s trlen(tmp)+1)))12554 { if ((t = (char*)SOAP_MALLOC(soap, strlen(tmp)+1))) 9873 12555 strcpy(t, tmp); 9874 12556 } … … 9877 12559 if (p) 9878 12560 { if (p->path) 9879 SOAP_FREE( p->path);12561 SOAP_FREE(soap, p->path); 9880 12562 p->path = t; 9881 12563 } 9882 12564 else 9883 12565 { if (path) 9884 SOAP_FREE( path);12566 SOAP_FREE(soap, path); 9885 12567 path = t; 9886 12568 } … … 9889 12571 { s = soap_decode_val(tmp, sizeof(tmp), s); 9890 12572 if (*tmp) 9891 { if ((t = (char*)SOAP_MALLOC(s trlen(tmp)+1)))12573 { if ((t = (char*)SOAP_MALLOC(soap, strlen(tmp)+1))) 9892 12574 strcpy(t, tmp); 9893 12575 } … … 9896 12578 if (p) 9897 12579 { if (p->domain) 9898 SOAP_FREE( p->domain);9899 p->domain = t;12580 SOAP_FREE(soap, p->domain); 12581 p->domain = t; 9900 12582 } 9901 12583 else 9902 12584 { if (domain) 9903 SOAP_FREE( domain);12585 SOAP_FREE(soap, domain); 9904 12586 domain = t; 9905 12587 } … … 9907 12589 else if (p && !soap_tag_cmp(tmp, "Path")) 9908 12590 { if (p->path) 9909 SOAP_FREE( p->path);12591 SOAP_FREE(soap, p->path); 9910 12592 s = soap_decode_val(tmp, sizeof(tmp), s); 9911 12593 if (*tmp) 9912 { if ((p->path = (char*)SOAP_MALLOC(s trlen(tmp)+1)))12594 { if ((p->path = (char*)SOAP_MALLOC(soap, strlen(tmp)+1))) 9913 12595 strcpy(p->path, tmp); 9914 12596 } … … 9918 12600 else if (p && !soap_tag_cmp(tmp, "Domain")) 9919 12601 { if (p->domain) 9920 SOAP_FREE( p->domain);12602 SOAP_FREE(soap, p->domain); 9921 12603 s = soap_decode_val(tmp, sizeof(tmp), s); 9922 12604 if (*tmp) 9923 { if ((p->domain = (char*)SOAP_MALLOC(s trlen(tmp)+1)))12605 { if ((p->domain = (char*)SOAP_MALLOC(soap, strlen(tmp)+1))) 9924 12606 strcpy(p->domain, tmp); 9925 12607 } … … 9948 12630 a[0] = tmp[8]; 9949 12631 a[1] = tmp[9]; 9950 T.tm_mon = ( strstr(mns, a) - mns) / 2;12632 T.tm_mon = (int)(strstr(mns, a) - mns) / 2; 9951 12633 a[0] = tmp[11]; 9952 12634 a[1] = tmp[12]; … … 9968 12650 else 9969 12651 { if (p) 9970 { 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:" ", p->domain?p->domain:"", p->path?p->path:"", p->expire, p->secure));12652 { 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)); 9971 12653 if ((q = soap_set_cookie(soap, p->name, p->value, p->domain, p->path))) 9972 12654 { q->version = p->version; … … 9976 12658 } 9977 12659 if (p->name) 9978 SOAP_FREE( p->name);12660 SOAP_FREE(soap, p->name); 9979 12661 if (p->value) 9980 SOAP_FREE( p->value);12662 SOAP_FREE(soap, p->value); 9981 12663 if (p->domain) 9982 SOAP_FREE( p->domain);12664 SOAP_FREE(soap, p->domain); 9983 12665 if (p->path) 9984 SOAP_FREE( p->path);9985 SOAP_FREE( p);9986 } 9987 if ((p = (struct soap_cookie*)SOAP_MALLOC(s izeof(struct soap_cookie))))9988 { p->name = (char*)SOAP_MALLOC(s trlen(tmp)+1);12666 SOAP_FREE(soap, p->path); 12667 SOAP_FREE(soap, p); 12668 } 12669 if ((p = (struct soap_cookie*)SOAP_MALLOC(soap, sizeof(struct soap_cookie)))) 12670 { p->name = (char*)SOAP_MALLOC(soap, strlen(tmp)+1); 9989 12671 strcpy(p->name, tmp); 9990 12672 s = soap_decode_val(tmp, sizeof(tmp), s); 9991 12673 if (*tmp) 9992 { p->value = (char*)SOAP_MALLOC(s trlen(tmp)+1);12674 { p->value = (char*)SOAP_MALLOC(soap, strlen(tmp)+1); 9993 12675 strcpy(p->value, tmp); 9994 12676 } 9995 12677 else 9996 12678 p->value = NULL; 9997 p->domain = domain; 9998 p->path = path; 12679 if (domain) 12680 p->domain = domain; 12681 else if (*soap->host) 12682 { p->domain = (char*)SOAP_MALLOC(soap, strlen(soap->host)+1); 12683 strcpy(p->domain, soap->host); 12684 } 12685 else 12686 p->domain = NULL; 12687 if (path) 12688 p->path = path; 12689 else if (soap->path && *soap->path) 12690 { p->path = (char*)SOAP_MALLOC(soap, strlen(soap->path)+1); 12691 strcpy(p->path, soap->path); 12692 } 12693 else 12694 { p->path = (char*)SOAP_MALLOC(soap, 2); 12695 strcpy(p->path, "/"); 12696 } 9999 12697 p->expire = 0; 10000 12698 p->secure = 0; … … 10004 12702 } 10005 12703 if (p) 10006 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Got cookie %s=%s domain=%s path=%s expire=%ld secure=%d\n", p->name, p->value?p->value:"", p->domain?p->domain:"", p->path?p->path:"", p->expire, p->secure));12704 { 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)); 10007 12705 if ((q = soap_set_cookie(soap, p->name, p->value, p->domain, p->path))) 10008 12706 { q->version = p->version; 10009 12707 q->expire = p->expire; 10010 12708 q->secure = p->secure; 12709 q->env = 1; 10011 12710 } 10012 12711 if (p->name) 10013 SOAP_FREE( p->name);12712 SOAP_FREE(soap, p->name); 10014 12713 if (p->value) 10015 SOAP_FREE( p->value);12714 SOAP_FREE(soap, p->value); 10016 12715 if (p->domain) 10017 SOAP_FREE( p->domain);12716 SOAP_FREE(soap, p->domain); 10018 12717 if (p->path) 10019 SOAP_FREE( p->path);10020 SOAP_FREE( p);12718 SOAP_FREE(soap, p->path); 12719 SOAP_FREE(soap, p); 10021 12720 } 10022 12721 if (domain) 10023 SOAP_FREE( domain);12722 SOAP_FREE(soap, domain); 10024 12723 if (path) 10025 SOAP_FREE( path);12724 SOAP_FREE(soap, path); 10026 12725 } 10027 12726 … … 10050 12749 struct soap_cookie* 10051 12750 SOAP_FMAC2 10052 soap_copy_cookies(struct soap * soap)12751 soap_copy_cookies(struct soap *copy, const struct soap *soap) 10053 12752 { struct soap_cookie *p, **q, *r; 10054 12753 q = &r; 10055 12754 for (p = soap->cookies; p; p = p->next) 10056 { if (!(*q = (struct soap_cookie*)SOAP_MALLOC( sizeof(struct soap_cookie))))12755 { if (!(*q = (struct soap_cookie*)SOAP_MALLOC(copy, sizeof(struct soap_cookie)))) 10057 12756 return r; 10058 12757 **q = *p; 10059 12758 if (p->name) 10060 { if (((*q)->name = (char*)SOAP_MALLOC( strlen(p->name)+1)))12759 { if (((*q)->name = (char*)SOAP_MALLOC(copy, strlen(p->name)+1))) 10061 12760 strcpy((*q)->name, p->name); 10062 12761 } 10063 12762 if (p->value) 10064 { if (((*q)->value = (char*)SOAP_MALLOC( strlen(p->value)+1)))12763 { if (((*q)->value = (char*)SOAP_MALLOC(copy, strlen(p->value)+1))) 10065 12764 strcpy((*q)->value, p->value); 10066 12765 } 10067 12766 if (p->domain) 10068 { if (((*q)->domain = (char*)SOAP_MALLOC( strlen(p->domain)+1)))12767 { if (((*q)->domain = (char*)SOAP_MALLOC(copy, strlen(p->domain)+1))) 10069 12768 strcpy((*q)->domain, p->domain); 10070 12769 } 10071 12770 if (p->path) 10072 { if (((*q)->path = (char*)SOAP_MALLOC( strlen(p->path)+1)))12771 { if (((*q)->path = (char*)SOAP_MALLOC(copy, strlen(p->path)+1))) 10073 12772 strcpy((*q)->path, p->path); 10074 12773 } … … 10087 12786 for (p = soap->cookies; p; p = soap->cookies) 10088 12787 { soap->cookies = p->next; 10089 SOAP_FREE( p->name);12788 SOAP_FREE(soap, p->name); 10090 12789 if (p->value) 10091 SOAP_FREE( p->value);12790 SOAP_FREE(soap, p->value); 10092 12791 if (p->domain) 10093 SOAP_FREE( p->domain);12792 SOAP_FREE(soap, p->domain); 10094 12793 if (p->path) 10095 SOAP_FREE( p->path);10096 SOAP_FREE( p);12794 SOAP_FREE(soap, p->path); 12795 SOAP_FREE(soap, p); 10097 12796 } 10098 12797 } … … 10107 12806 soap_getgziphdr(struct soap *soap) 10108 12807 { int i; 10109 soap_wchar c , f = 0;12808 soap_wchar c = 0, f = 0; 10110 12809 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Get gzip header\n")); 10111 12810 for (i = 0; i < 9; i++) … … 10117 12816 if (f & 0x04) /* FEXTRA */ 10118 12817 { for (i = soap_get1(soap) | (soap_get1(soap) << 8); i; i--) 10119 if ((int)soap_get1(soap) == EOF)12818 { if ((int)soap_get1(soap) == EOF) 10120 12819 return soap->error = SOAP_EOF; 12820 } 10121 12821 } 10122 12822 if (f & 0x08) /* FNAME */ 10123 do12823 { do 10124 12824 c = soap_get1(soap); 10125 12825 while (c && (int)c != EOF); 12826 } 10126 12827 if ((int)c != EOF && (f & 0x10)) /* FCOMMENT */ 10127 do12828 { do 10128 12829 c = soap_get1(soap); 10129 while (c && (int)f != EOF); 12830 while (c && (int)c != EOF); 12831 } 10130 12832 if ((int)c != EOF && (f & 0x01)) /* FHCRC */ 10131 12833 { if ((int)(c = soap_get1(soap)) != EOF) … … 10146 12848 soap_begin_recv(struct soap *soap) 10147 12849 { soap_wchar c; 12850 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Initializing for input\n")); 10148 12851 soap->error = SOAP_OK; 10149 soap_free (soap);12852 soap_free_temp(soap); 10150 12853 soap_set_local_namespaces(soap); 10151 12854 soap->version = 0; /* don't assume we're parsing SOAP content by default */ 12855 #ifndef WITH_NOIDREF 10152 12856 soap_free_iht(soap); 12857 #endif 10153 12858 if ((soap->imode & SOAP_IO) == SOAP_IO_CHUNK) 10154 12859 soap->omode |= SOAP_IO_CHUNK; … … 10170 12875 soap->cdata = 0; 10171 12876 *soap->endpoint = '\0'; 10172 soap->userid = NULL;10173 soap->passwd = NULL;10174 12877 soap->action = NULL; 10175 soap->authrealm = NULL; 12878 soap->header = NULL; 12879 soap->fault = NULL; 12880 soap->status = 0; 12881 #ifndef WITH_LEANER 12882 soap->dom = NULL; 10176 12883 soap->dime.chunksize = 0; 10177 12884 soap->dime.buflen = 0; … … 10184 12891 soap->mime.boundary = NULL; 10185 12892 soap->mime.start = NULL; 12893 soap->xlist = NULL; 12894 #endif 10186 12895 #ifdef WIN32 10187 12896 #ifndef UNDER_CE … … 10189 12898 if (!soap_valid_socket(soap->socket)) 10190 12899 #ifdef __BORLANDC__ 10191 setmode( (SOAP_SOCKET)soap->recvfd, O_BINARY);12900 setmode(soap->recvfd, O_BINARY); 10192 12901 #else 10193 _setmode( (SOAP_SOCKET)soap->recvfd, _O_BINARY);12902 _setmode(soap->recvfd, _O_BINARY); 10194 12903 #endif 10195 12904 #endif … … 10200 12909 soap->zlib_in = SOAP_ZLIB_NONE; 10201 12910 soap->zlib_out = SOAP_ZLIB_NONE; 10202 soap->d_stream .next_in = Z_NULL;10203 soap->d_stream .avail_in = 0;10204 soap->d_stream .next_out = (Byte*)soap->buf;10205 soap->d_stream .avail_out = SOAP_BUFLEN;12911 soap->d_stream->next_in = Z_NULL; 12912 soap->d_stream->avail_in = 0; 12913 soap->d_stream->next_out = (Byte*)soap->buf; 12914 soap->d_stream->avail_out = SOAP_BUFLEN; 10206 12915 soap->z_ratio_in = 1.0; 12916 #endif 12917 #ifdef WITH_OPENSSL 12918 if (soap->ssl) 12919 ERR_clear_error(); 12920 #endif 12921 #ifndef WITH_LEANER 10207 12922 if (soap->fprepareinit) 10208 12923 soap->fprepareinit(soap); … … 10213 12928 { if (soap_getgziphdr(soap)) 10214 12929 return soap->error; 10215 if (inflateInit2( &soap->d_stream, -MAX_WBITS) != Z_OK)12930 if (inflateInit2(soap->d_stream, -MAX_WBITS) != Z_OK) 10216 12931 return soap->error = SOAP_ZLIB_ERROR; 10217 12932 soap->zlib_state = SOAP_ZLIB_INFLATE; … … 10220 12935 soap->z_crc = crc32(0L, NULL, 0); 10221 12936 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "gzip initialized\n")); 12937 if (!soap->z_buf) 12938 soap->z_buf = (char*)SOAP_MALLOC(soap, SOAP_BUFLEN); 10222 12939 memcpy(soap->z_buf, soap->buf, SOAP_BUFLEN); 10223 12940 /* should not chunk over plain transport, so why bother to check? */ … … 10225 12942 /* soap->z_buflen = soap->bufidx; */ 10226 12943 /* else */ 10227 soap->d_stream .next_in = (Byte*)(soap->z_buf + soap->bufidx);10228 soap->d_stream .avail_in = soap->buflen - soap->bufidx;12944 soap->d_stream->next_in = (Byte*)(soap->z_buf + soap->bufidx); 12945 soap->d_stream->avail_in = soap->buflen - soap->bufidx; 10229 12946 soap->z_buflen = soap->buflen; 10230 12947 soap->buflen = soap->bufidx; … … 10232 12949 } 10233 12950 #endif 12951 #ifndef WITH_LEANER 10234 12952 if (c == '-' && soap_get0(soap) == '-') 10235 12953 soap->mode |= SOAP_ENC_MIME; … … 10237 12955 soap->mode |= SOAP_ENC_DIME; 10238 12956 else 12957 #endif 10239 12958 { while (soap_blank(c)) 10240 12959 c = soap_getchar(soap); … … 10243 12962 return soap->error = SOAP_EOF; 10244 12963 soap_unget(soap, c); 10245 if (c != '<' && !(soap->mode & (SOAP_ENC_DIME | SOAP_ENC_ZLIB))) 12964 #ifndef WITH_NOHTTP 12965 /* if not XML or (start of)BOM or MIME/DIME/ZLIB, assume HTTP header */ 12966 if (c != '<' && c != 0xEF && !(soap->mode & (SOAP_ENC_MIME | SOAP_ENC_DIME | SOAP_ENC_ZLIB))) 10246 12967 { soap->mode &= ~SOAP_IO; 10247 if ((soap->error = soap->fparse(soap))) 12968 soap->error = soap->fparse(soap); 12969 if (soap->error && soap->error < SOAP_STOP) 10248 12970 { soap->keep_alive = 0; /* force close later */ 10249 12971 return soap->error; 10250 12972 } 12973 if (soap->error == SOAP_STOP) 12974 return soap->error; 12975 soap->mode = soap->imode; /* if imode is changed, copy */ 10251 12976 if ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK) 10252 12977 { soap->chunkbuflen = soap->buflen; … … 10254 12979 soap->chunksize = 0; 10255 12980 } 12981 #ifndef WITH_LEANER 10256 12982 else if (soap->fpreparerecv && soap->buflen != soap->bufidx) 10257 12983 soap->fpreparerecv(soap, soap->buf + soap->bufidx, soap->buflen - soap->bufidx); 12984 #endif 12985 /* Note: fparse should not use soap_unget to push back last char */ 12986 if (soap_get0(soap) == (int)EOF) 12987 { if (soap->status == 200) 12988 return soap->error = SOAP_NO_DATA; 12989 return soap->error = soap->status; 12990 } 10258 12991 #ifdef WITH_ZLIB 10259 if (soap->zlib_in )10260 { /* fparse should not use soap_unget to push back last char */12992 if (soap->zlib_in != SOAP_ZLIB_NONE) 12993 { 10261 12994 #ifdef WITH_GZIP 10262 c = soap_get1(soap); 10263 if (c == 0x1F) 10264 { if (soap_getgziphdr(soap)) 10265 return soap->error; 10266 if (inflateInit2(&soap->d_stream, -MAX_WBITS) != Z_OK) 10267 return soap->error = SOAP_ZLIB_ERROR; 10268 soap->zlib_state = SOAP_ZLIB_INFLATE; 10269 soap->z_crc = crc32(0L, NULL, 0); 10270 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "gzip initialized\n")); 12995 if (soap->zlib_in != SOAP_ZLIB_DEFLATE) 12996 { c = soap_get1(soap); 12997 if (c == 0x1F) 12998 { if (soap_getgziphdr(soap)) 12999 return soap->error; 13000 if (inflateInit2(soap->d_stream, -MAX_WBITS) != Z_OK) 13001 return soap->error = SOAP_ZLIB_ERROR; 13002 soap->z_crc = crc32(0L, NULL, 0); 13003 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "gzip initialized\n")); 13004 } 13005 else 13006 { soap_revget1(soap); 13007 if (inflateInit(soap->d_stream) != Z_OK) 13008 return soap->error = SOAP_ZLIB_ERROR; 13009 soap->zlib_in = SOAP_ZLIB_DEFLATE; 13010 } 10271 13011 } 10272 13012 else 10273 { soap_revget1(soap); 10274 #else 10275 { 10276 #endif 10277 if (inflateInit(&soap->d_stream) != Z_OK) 10278 return soap->error = SOAP_ZLIB_ERROR; 10279 soap->zlib_state = SOAP_ZLIB_INFLATE; 10280 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflate initialized\n")); 10281 } 13013 #endif 13014 if (inflateInit(soap->d_stream) != Z_OK) 13015 return soap->error = SOAP_ZLIB_ERROR; 13016 soap->zlib_state = SOAP_ZLIB_INFLATE; 13017 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflate initialized\n")); 10282 13018 soap->mode |= SOAP_ENC_ZLIB; 13019 if (!soap->z_buf) 13020 soap->z_buf = (char*)SOAP_MALLOC(soap, SOAP_BUFLEN); 10283 13021 memcpy(soap->z_buf, soap->buf, SOAP_BUFLEN); 10284 soap->d_stream .next_in = (Byte*)(soap->z_buf + soap->bufidx);10285 soap->d_stream .avail_in = soap->buflen - soap->bufidx;13022 soap->d_stream->next_in = (Byte*)(soap->z_buf + soap->bufidx); 13023 soap->d_stream->avail_in = soap->buflen - soap->bufidx; 10286 13024 soap->z_buflen = soap->buflen; 10287 13025 soap->buflen = soap->bufidx; 10288 13026 } 10289 13027 #endif 10290 } 13028 if (soap->error) 13029 { if (soap->error == SOAP_FORM && soap->fform) 13030 { soap->error = soap->fform(soap); 13031 if (soap->error == SOAP_OK) 13032 soap->error = SOAP_STOP; /* prevents further processing */ 13033 } 13034 return soap->error; 13035 } 13036 } 13037 #endif 10291 13038 #ifndef WITH_LEANER 10292 13039 if (soap->mode & SOAP_ENC_MIME) 10293 13040 { if (soap_getmimehdr(soap)) 10294 13041 return soap->error; 13042 if (soap->mime.start) 13043 { do 13044 { if (!soap->mime.last->id) 13045 break; 13046 if (!soap_match_cid(soap, soap->mime.start, soap->mime.last->id)) 13047 break; 13048 } while (soap_get_mime_attachment(soap, NULL)); 13049 } 10295 13050 if (soap_get_header_attribute(soap, soap->mime.first->type, "application/dime")) 10296 13051 soap->mode |= SOAP_ENC_DIME; … … 10317 13072 10318 13073 /******************************************************************************/ 13074 #ifndef WITH_NOHTTP 10319 13075 #ifndef PALM_1 10320 13076 static int 10321 13077 http_parse(struct soap *soap) 10322 13078 { char header[SOAP_HDRLEN], *s; 10323 unsigned short g = 0, k;10324 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Waiting for response...\n"));13079 unsigned short httpcmd = 0, status = 0, k = 0; 13080 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Waiting for HTTP request/response...\n")); 10325 13081 *soap->endpoint = '\0'; 10326 13082 soap->length = 0; 13083 soap->userid = NULL; 13084 soap->passwd = NULL; 13085 soap->action = NULL; 13086 soap->authrealm = NULL; 13087 soap->proxy_from = NULL; 13088 soap->http_content = NULL; 13089 soap->status = 0; 10327 13090 do 10328 13091 { if (soap_getline(soap, soap->msgbuf, sizeof(soap->msgbuf))) 10329 return soap->error; 13092 { if (soap->error == SOAP_EOF) 13093 return SOAP_EOF; 13094 return soap->error = 414; 13095 } 10330 13096 DBGLOG(TEST,SOAP_MESSAGE(fdebug, "HTTP status: %s\n", soap->msgbuf)); 10331 13097 for (;;) 10332 13098 { if (soap_getline(soap, header, SOAP_HDRLEN)) 13099 { if (soap->error == SOAP_EOF) 13100 { soap->error = SOAP_OK; 13101 DBGLOG(TEST,SOAP_MESSAGE(fdebug, "EOF in HTTP header, continue anyway\n")); 13102 break; 13103 } 10333 13104 return soap->error; 13105 } 10334 13106 if (!*header) 10335 13107 break; … … 10337 13109 s = strchr(header, ':'); 10338 13110 if (s) 10339 { *s = '\0'; 13111 { char *t; 13112 *s = '\0'; 10340 13113 do s++; 10341 13114 while (*s && *s <= 32); 13115 if (*s == '"') 13116 s++; 13117 t = s + strlen(s) - 1; 13118 while (t > s && *t <= 32) 13119 t--; 13120 if (t >= s && *t == '"') 13121 t--; 13122 t[1] = '\0'; 10342 13123 if ((soap->error = soap->fparsehdr(soap, header, s))) 10343 return soap->error; 13124 { if (soap->error < SOAP_STOP) 13125 return soap->error; 13126 status = soap->error; 13127 soap->error = SOAP_OK; 13128 } 10344 13129 } 10345 13130 } 10346 13131 if ((s = strchr(soap->msgbuf, ' '))) 10347 k = (unsigned short)soap_strtoul(s, NULL, 10); 13132 { k = (unsigned short)soap_strtoul(s, &s, 10); 13133 if (!soap_blank(*s)) 13134 k = 0; 13135 } 10348 13136 else 10349 13137 k = 0; 10350 13138 } while (k == 100); 10351 DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Finished HTTP header parsing \n"));13139 DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Finished HTTP header parsing, status = %d\n", k)); 10352 13140 s = strstr(soap->msgbuf, "HTTP/"); 10353 13141 if (s && s[7] != '1') … … 10362 13150 soap->keep_alive = 1; 10363 13151 DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Keep alive connection = %d\n", soap->keep_alive)); 10364 if (s && (((g = !strncmp(soap->msgbuf, "GET ", 4))) || !strncmp(soap->msgbuf, "POST ", 5))) 10365 { size_t m = strlen(soap->endpoint); 10366 size_t n = m + (s - soap->msgbuf) - 5 - (!g); 10367 if (n >= sizeof(soap->endpoint)) 10368 n = sizeof(soap->endpoint) - 1; 10369 strncpy(soap->path, soap->msgbuf + 4 + (!g), n - m); 10370 soap->path[n - m] = '\0'; 10371 strcat(soap->endpoint, soap->path); 10372 DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Target endpoint='%s'\n", soap->endpoint)); 10373 if (g) 10374 { soap->error = soap->fget(soap); 10375 if (soap->error == SOAP_OK) 10376 soap->error = SOAP_STOP; /* prevents further processing */ 10377 return soap->error; 10378 } 13152 if (k == 0) 13153 { size_t l = 0; 13154 if (s) 13155 { if (!strncmp(soap->msgbuf, "POST ", l = 5)) 13156 httpcmd = 1; 13157 else if (!strncmp(soap->msgbuf, "GET ", l = 4)) 13158 httpcmd = 2; 13159 else if (!strncmp(soap->msgbuf, "PUT ", l = 4)) 13160 httpcmd = 3; 13161 else if (!strncmp(soap->msgbuf, "DELETE ", l = 7)) 13162 httpcmd = 4; 13163 else if (!strncmp(soap->msgbuf, "HEAD ", l = 5)) 13164 httpcmd = 5; 13165 } 13166 if (s && httpcmd) 13167 { size_t m = strlen(soap->endpoint); 13168 size_t n = m + (s - soap->msgbuf) - l - 1; 13169 if (m > n) 13170 m = n; 13171 if (n >= sizeof(soap->endpoint)) 13172 n = sizeof(soap->endpoint) - 1; 13173 strncpy(soap->path, soap->msgbuf + l, n - m); 13174 soap->path[n - m] = '\0'; 13175 strcat(soap->endpoint, soap->path); 13176 DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Target endpoint='%s'\n", soap->endpoint)); 13177 if (httpcmd > 1) 13178 { switch (httpcmd) 13179 { case 2: soap->error = soap->fget(soap); break; 13180 case 3: soap->error = soap->fput(soap); break; 13181 case 4: soap->error = soap->fdel(soap); break; 13182 case 5: soap->error = soap->fhead(soap); break; 13183 default: soap->error = SOAP_HTTP_METHOD; break; 13184 } 13185 if (soap->error == SOAP_OK) 13186 soap->error = SOAP_STOP; /* prevents further processing */ 13187 return soap->error; 13188 } 13189 if (status) 13190 return soap->error = status; 13191 } 13192 else if (status) 13193 return soap->error = status; 13194 else if (s) 13195 return soap->error = 405; 13196 } 13197 soap->status = k; 13198 /* Status OK (HTTP 200) */ 13199 if (k == 0 || k == 200) 10379 13200 return SOAP_OK; 10380 } 10381 if (k == 0 || (k >= 200 && k <= 299) || k == 400 || k == 500) 13201 /* Status 201 (Created), 202 (Accepted), ... and HTTP 400 and 500 errors. 13202 Only keep parsing HTTP body when content-length>0 or chunked is set. 13203 */ 13204 if (((k > 200 && k <= 299) || k == 400 || k == 500) && (soap->length > 0 || (soap->imode & SOAP_IO) == SOAP_IO_CHUNK)) 10382 13205 return SOAP_OK; 10383 return soap_set_receiver_error(soap, "HTTP error", soap->msgbuf, k); 10384 } 10385 #endif 10386 10387 /******************************************************************************/ 13206 /* HTTP 400 and 500 headers are supposed to set content-length or chunked. 13207 For those that don't we keep parsing the body only if content type is 13208 given and connection closes. 13209 */ 13210 if ((k == 400 || k == 500) && (soap->http_content || soap->keep_alive == 0)) 13211 return SOAP_OK; 13212 DBGLOG(TEST,SOAP_MESSAGE(fdebug, "HTTP error %d\n", k)); 13213 return soap_set_receiver_error(soap, "HTTP Error", soap->msgbuf, k); 13214 } 13215 #endif 13216 #endif 13217 13218 /******************************************************************************/ 13219 #ifndef WITH_NOHTTP 10388 13220 #ifndef PALM_1 10389 13221 static int … … 10402 13234 #ifndef WITH_LEANER 10403 13235 else if (!soap_tag_cmp(key, "Content-Type")) 10404 { if (soap_get_header_attribute(soap, val, "application/dime")) 10405 soap->mode |= SOAP_ENC_DIME; 10406 else if (soap_get_header_attribute(soap, val, "multipart/related")) 13236 { const char *action; 13237 soap->http_content = soap_strdup(soap, val); 13238 if (soap_get_header_attribute(soap, val, "application/dime")) 13239 soap->imode |= SOAP_ENC_DIME; 13240 else if (soap_get_header_attribute(soap, val, "multipart/related") 13241 || soap_get_header_attribute(soap, val, "multipart/form-data")) 10407 13242 { soap->mime.boundary = soap_strdup(soap, soap_get_header_attribute(soap, val, "boundary")); 10408 13243 soap->mime.start = soap_strdup(soap, soap_get_header_attribute(soap, val, "start")); 10409 soap->mode |= SOAP_ENC_MIME; 13244 soap->imode |= SOAP_ENC_MIME; 13245 } 13246 action = soap_get_header_attribute(soap, val, "action"); 13247 if (action) 13248 { if (*action == '"') 13249 { soap->action = soap_strdup(soap, action + 1); 13250 soap->action[strlen(soap->action) - 1] = '\0'; 13251 } 13252 else 13253 soap->action = soap_strdup(soap, action); 10410 13254 } 10411 13255 } 10412 13256 #endif 10413 13257 else if (!soap_tag_cmp(key, "Content-Length")) 10414 soap->length = soap_strtoul(val, NULL, 10); 13258 { soap->length = soap_strtoul(val, NULL, 10); 13259 } 10415 13260 else if (!soap_tag_cmp(key, "Content-Encoding")) 10416 13261 { if (!soap_tag_cmp(val, "deflate")) … … 10442 13287 #endif 10443 13288 else if (!soap_tag_cmp(key, "Transfer-Encoding")) 10444 { soap-> mode &= ~SOAP_IO;13289 { soap->imode &= ~SOAP_IO; 10445 13290 if (!soap_tag_cmp(val, "chunked")) 10446 soap-> mode |= SOAP_IO_CHUNK;13291 soap->imode |= SOAP_IO_CHUNK; 10447 13292 } 10448 13293 else if (!soap_tag_cmp(key, "Connection")) … … 10455 13300 else if (!soap_tag_cmp(key, "Authorization")) 10456 13301 { if (!soap_tag_cmp(val, "Basic *")) 10457 { size_t n;13302 { int n; 10458 13303 char *s; 10459 13304 soap_base642s(soap, val + 6, soap->tmpbuf, sizeof(soap->tmpbuf) - 1, &n); … … 10461 13306 if ((s = strchr(soap->tmpbuf, ':'))) 10462 13307 { *s = '\0'; 10463 soap->userid = soap_strdup(soap, soap->tmpbuf);10464 soap->passwd = soap_strdup(soap, s + 1);13308 soap->userid = soap_strdup(soap, soap->tmpbuf); 13309 soap->passwd = soap_strdup(soap, s + 1); 10465 13310 } 10466 13311 } 10467 13312 } 10468 13313 else if (!soap_tag_cmp(key, "WWW-Authenticate")) 10469 soap->authrealm = soap_strdup(soap, soap_get_header_attribute(soap, val+6, "realm")); 13314 { soap->authrealm = soap_strdup(soap, soap_get_header_attribute(soap, val + 6, "realm")); 13315 } 10470 13316 else if (!soap_tag_cmp(key, "Expect")) 10471 13317 { if (!soap_tag_cmp(val, "100-continue")) … … 10477 13323 #endif 10478 13324 else if (!soap_tag_cmp(key, "SOAPAction")) 10479 { if ( val[0] && val[1])13325 { if (*val == '"') 10480 13326 { soap->action = soap_strdup(soap, val + 1); 10481 13327 soap->action[strlen(soap->action) - 1] = '\0'; 10482 13328 } 13329 else 13330 soap->action = soap_strdup(soap, val); 10483 13331 } 10484 13332 else if (!soap_tag_cmp(key, "Location")) … … 10486 13334 soap->endpoint[sizeof(soap->endpoint) - 1] = '\0'; 10487 13335 } 13336 else if (!soap_tag_cmp(key, "X-Forwarded-For")) 13337 { soap->proxy_from = soap_strdup(soap, val); 13338 } 10488 13339 #ifdef WITH_COOKIES 10489 else if (!soap_tag_cmp(key, "Cookie") || !soap_tag_cmp(key, "Set-Cookie")) 10490 soap_getcookies(soap, val); 13340 else if (!soap_tag_cmp(key, "Cookie") 13341 || !soap_tag_cmp(key, "Cookie2") 13342 || !soap_tag_cmp(key, "Set-Cookie") 13343 || !soap_tag_cmp(key, "Set-Cookie2")) 13344 { soap_getcookies(soap, val); 13345 } 10491 13346 #endif 10492 13347 return SOAP_OK; 10493 13348 } 10494 13349 #endif 10495 10496 /******************************************************************************/ 13350 #endif 13351 13352 /******************************************************************************/ 13353 #if !defined(WITH_NOHTTP) || !defined(WITH_LEANER) 10497 13354 #ifndef PALM_1 10498 13355 SOAP_FMAC1 … … 10514 13371 } 10515 13372 #endif 10516 10517 /******************************************************************************/ 13373 #endif 13374 13375 /******************************************************************************/ 13376 #if !defined(WITH_NOHTTP) || !defined(WITH_LEANER) 10518 13377 #ifndef PALM_1 10519 13378 SOAP_FMAC1 … … 10524 13383 } 10525 13384 #endif 10526 10527 /******************************************************************************/ 13385 #endif 13386 13387 /******************************************************************************/ 13388 #if !defined(WITH_NOHTTP) || !defined(WITH_LEANER) 10528 13389 #ifndef PALM_1 10529 13390 SOAP_FMAC1 … … 10538 13399 } 10539 13400 #endif 10540 10541 /******************************************************************************/ 13401 #endif 13402 13403 /******************************************************************************/ 13404 #if !defined(WITH_NOHTTP) || !defined(WITH_LEANER) 10542 13405 #ifndef PALM_1 10543 13406 static const char* … … 10554 13417 } 10555 13418 else 10556 { while ( soap_notblank(*s) && !strchr(sep, *s) && --len)13419 { while (*s && !soap_blank(*s) && !strchr(sep, *s) && --len) 10557 13420 { if (*s == '%') 10558 13421 { *t++ = ((s[1] >= 'A' ? (s[1] & 0x7) + 9 : s[1] - '0') << 4) … … 10570 13433 } 10571 13434 #endif 13435 #endif 10572 13436 10573 13437 /******************************************************************************/ … … 10580 13444 #ifndef WITH_LEANER 10581 13445 size_t n = 0; 10582 if ((soap->mode & SOAP_ENC_MIME) && soap->mime.boundary && soap->mime.start )13446 if ((soap->mode & SOAP_ENC_MIME) && soap->mime.boundary && soap->mime.start && strlen(soap->mime.boundary) + strlen(soap->mime.start) < sizeof(soap->tmpbuf) - 80 ) 10583 13447 { const char *s; 10584 if ( soap->mode & SOAP_ENC_DIME)13448 if ((soap->mode & SOAP_ENC_DIME) && !(soap->mode & SOAP_ENC_MTOM)) 10585 13449 s = "application/dime"; 10586 13450 else if (soap->version == 2) 10587 s = "application/soap+xml; charset=utf-8"; 13451 { if (soap->mode & SOAP_ENC_MTOM) 13452 s = "application/xop+xml; charset=utf-8; type=\"application/soap+xml\""; 13453 else 13454 s = "application/soap+xml; charset=utf-8"; 13455 } 13456 else if (soap->mode & SOAP_ENC_MTOM) 13457 s = "application/xop+xml; text/xml; charset=utf-8"; 10588 13458 else 10589 13459 s = "text/xml; charset=utf-8"; … … 10614 13484 return soap->error; 10615 13485 #ifndef WITH_LEANER 10616 if ((soap->mode & SOAP_IO_LENGTH) && (soap->mode & SOAP_ENC_DIME) )13486 if ((soap->mode & SOAP_IO_LENGTH) && (soap->mode & SOAP_ENC_DIME) && !(soap->mode & SOAP_ENC_MTOM)) 10617 13487 { soap->dime.size = soap->count - soap->dime.size; /* DIME in MIME correction */ 10618 13488 sprintf(soap->id, soap->dime_id_format, 0); … … 10628 13498 if (!soap->dime.first) 10629 13499 soap->dime.flags |= SOAP_DIME_ME; 10630 soap->count += 12 + ((strlen(soap->dime.id)+3)&(~3)) + ( (strlen(soap->dime.type)+3)&(~3));10631 } 10632 if ( soap->mode & SOAP_ENC_DIME)13500 soap->count += 12 + ((strlen(soap->dime.id)+3)&(~3)) + (soap->dime.type ? ((strlen(soap->dime.type)+3)&(~3)) : 0); 13501 } 13502 if ((soap->mode & SOAP_ENC_DIME) && !(soap->mode & SOAP_ENC_MTOM)) 10633 13503 return soap_send_raw(soap, SOAP_STR_PADDING, -(long)soap->dime.size&3); 10634 13504 #endif … … 10646 13516 { register struct Namespace *p; 10647 13517 soap->part = SOAP_IN_ENVELOPE; 10648 if (soap_element_begin_in(soap, "SOAP-ENV:Envelope", 0)) 10649 return soap->error = SOAP_VERSIONMISMATCH; 13518 if (soap_element_begin_in(soap, "SOAP-ENV:Envelope", 0, NULL)) 13519 { 13520 #ifndef WITH_LEAN 13521 if (soap->error == SOAP_TAG_MISMATCH && !soap_element_begin_in(soap, "html", 0, NULL)) 13522 { /* get HTML from buffer, stop receiving to avoid HTML parsing issues */ 13523 char *s; 13524 #ifndef WITH_NOIO 13525 size_t (*f)(struct soap*, char*, size_t) = soap->frecv; 13526 soap->frecv = frecv_stop; 13527 #endif 13528 soap_revert(soap); 13529 s = soap_string_in(soap, 1, -1, -1); 13530 #ifndef WITH_NOIO 13531 soap->frecv = f; 13532 #endif 13533 return soap_set_receiver_error(soap, "HTTP Error", s, SOAP_HTTP_ERROR); 13534 } 13535 #endif 13536 if (soap->error == SOAP_TAG_MISMATCH) 13537 return soap->error = SOAP_VERSIONMISMATCH; 13538 return soap->error; 13539 } 10650 13540 p = soap->local_namespaces; 10651 13541 if (p) … … 10656 13546 { soap->version = 1; /* make sure we use SOAP 1.1 */ 10657 13547 if (p[1].out) 10658 SOAP_FREE( p[1].out);10659 if ((p[1].out = (char*)SOAP_MALLOC(s izeof(soap_enc1))))13548 SOAP_FREE(soap, p[1].out); 13549 if ((p[1].out = (char*)SOAP_MALLOC(soap, sizeof(soap_enc1)))) 10660 13550 strcpy(p[1].out, soap_enc1); 10661 13551 } … … 10663 13553 { soap->version = 2; /* make sure we use SOAP 1.2 */ 10664 13554 if (p[1].out) 10665 SOAP_FREE( p[1].out);10666 if ((p[1].out = (char*)SOAP_MALLOC(s izeof(soap_enc2))))13555 SOAP_FREE(soap, p[1].out); 13556 if ((p[1].out = (char*)SOAP_MALLOC(soap, sizeof(soap_enc2)))) 10667 13557 strcpy(p[1].out, soap_enc2); 10668 13558 } … … 10678 13568 SOAP_FMAC2 10679 13569 soap_envelope_end_in(struct soap *soap) 10680 { if (soap_element_end_in(soap, "SOAP-ENV:Envelope")) 10681 return soap->error; 10682 soap->part = SOAP_END_ENVELOPE; 10683 return SOAP_OK; 13570 { soap->part = SOAP_END_ENVELOPE; 13571 return soap_element_end_in(soap, "SOAP-ENV:Envelope"); 10684 13572 } 10685 13573 #endif … … 10694 13582 if (soap->version == 1) 10695 13583 soap->encoding = 1; 13584 #ifndef WITH_LEAN 13585 if ((soap->mode & SOAP_XML_SEC) && soap_set_attr(soap, "wsu:Id", "Body")) 13586 return soap->error; 13587 #endif 10696 13588 if (soap_element(soap, "SOAP-ENV:Body", 0, NULL)) 10697 return soap->error;10698 if ((soap->mode & SOAP_XML_SEC) && soap_attribute(soap, "id", "_0"))10699 13589 return soap->error; 10700 13590 return soap_element_start_end_out(soap, NULL); … … 10710 13600 { if (soap_element_end_out(soap, "SOAP-ENV:Body")) 10711 13601 return soap->error; 10712 soap->part = SOAP_ IN_BODY;13602 soap->part = SOAP_END_BODY; 10713 13603 return SOAP_OK; 10714 13604 } … … 10722 13612 soap_body_begin_in(struct soap *soap) 10723 13613 { soap->part = SOAP_IN_BODY; 10724 return soap_element_begin_in(soap, "SOAP-ENV:Body", 0); 13614 if (soap_element_begin_in(soap, "SOAP-ENV:Body", 0, NULL)) 13615 return soap->error; 13616 if (!soap->body) 13617 soap->part = SOAP_NO_BODY; 13618 return SOAP_OK; 10725 13619 } 10726 13620 #endif … … 10732 13626 SOAP_FMAC2 10733 13627 soap_body_end_in(struct soap *soap) 10734 { if (soap _element_end_in(soap, "SOAP-ENV:Body"))10735 return soap->error;13628 { if (soap->part == SOAP_NO_BODY) 13629 return SOAP_OK; 10736 13630 soap->part = SOAP_END_BODY; 10737 return SOAP_OK;13631 return soap_element_end_in(soap, "SOAP-ENV:Body"); 10738 13632 } 10739 13633 #endif … … 10747 13641 { if (soap_getheader(soap) && soap->error == SOAP_TAG_MISMATCH) 10748 13642 soap->error = SOAP_OK; 13643 else if (soap->error == SOAP_OK && soap->fheader) 13644 soap->error = soap->fheader(soap); 10749 13645 return soap->error; 10750 13646 } … … 10759 13655 { register const char *s; 10760 13656 register size_t i, n; 10761 *soap->endpoint = '\0'; 10762 *soap->host = '\0'; 10763 *soap->path = '\0'; 13657 soap->endpoint[0] = '\0'; 13658 soap->host[0] = '\0'; 13659 soap->path[0] = '/'; 13660 soap->path[1] = '\0'; 10764 13661 soap->port = 80; 10765 13662 if (!endpoint || !*endpoint) 10766 13663 return; 10767 13664 #ifdef WITH_OPENSSL 10768 if (!s trncmp(endpoint, "https:", 6))13665 if (!soap_tag_cmp(endpoint, "https:*")) 10769 13666 soap->port = 443; 10770 13667 #endif 10771 13668 strncpy(soap->endpoint, endpoint, sizeof(soap->endpoint) - 1); 13669 soap->endpoint[sizeof(soap->endpoint) - 1] = '\0'; 10772 13670 s = strchr(endpoint, ':'); 10773 13671 if (s && s[1] == '/' && s[2] == '/') … … 10778 13676 if (n >= sizeof(soap->host)) 10779 13677 n = sizeof(soap->host) - 1; 10780 /* WR[ */10781 13678 #ifdef WITH_IPV6 10782 if ( '[' == s[0])13679 if (s[0] == '[') 10783 13680 { s++; 10784 13681 for (i = 0; i < n; i++) 10785 { soap->host[i] = s[i]; 10786 if (']' == s[i]) 10787 { 10788 s++; 13682 { if (s[i] == ']') 13683 { s++; 13684 --n; 10789 13685 break; 10790 13686 } 13687 soap->host[i] = s[i]; 10791 13688 } 10792 13689 } … … 10798 13695 } 10799 13696 } 10800 #else /* WITH_IPV6 */ 10801 /* ]WR */ 13697 #else 10802 13698 for (i = 0; i < n; i++) 10803 13699 { soap->host[i] = s[i]; … … 10805 13701 break; 10806 13702 } 10807 /* WR[ */ 10808 #endif /* WITH_IPV6 */ 10809 /* ]WR */ 13703 #endif 10810 13704 soap->host[i] = '\0'; 10811 13705 if (s[i] == ':') … … 10815 13709 break; 10816 13710 } 10817 if ( s[i])10818 { strncpy(soap->path, s + i + 1, sizeof(soap->path));13711 if (i < n && s[i]) 13712 { strncpy(soap->path, s + i, sizeof(soap->path)); 10819 13713 soap->path[sizeof(soap->path) - 1] = '\0'; 10820 13714 } … … 10842 13736 size_t count; 10843 13737 soap->error = SOAP_OK; 10844 strcpy(host, soap->host); /* save to compare */ 10845 port = soap->port; /* save to compare */ 13738 strcpy(host, soap->host); /* save previous host name to compare */ 13739 port = soap->port; /* save previous port to compare */ 13740 soap->status = http_command; 10846 13741 soap_set_endpoint(soap, endpoint); 10847 if (action) 10848 soap->action = soap_strdup(soap, action); 13742 #ifndef WITH_LEANER 10849 13743 if (soap->fconnect) 10850 if ((soap->error = soap->fconnect(soap, endpoint, soap->host, soap->port)))13744 { if ((soap->error = soap->fconnect(soap, endpoint, soap->host, soap->port))) 10851 13745 return soap->error; 10852 if (*soap->host) 10853 { soap->status = http_command; 10854 if (!soap_valid_socket(soap->socket) || strcmp(soap->host, host) || soap->port != port) 10855 { soap->keep_alive = 0; /* force close */ 13746 } 13747 else 13748 #endif 13749 if (soap->fopen && *soap->host) 13750 { if (!soap->keep_alive || !soap_valid_socket(soap->socket) || strcmp(soap->host, host) || soap->port != port || !soap->fpoll || soap->fpoll(soap)) 13751 { soap->keep_alive = 0; /* to force close */ 13752 soap->omode &= ~SOAP_IO_UDP; /* to force close */ 10856 13753 soap_closesock(soap); 10857 DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Connect to host='%s' path='%s' port=%d\n", soap->host, soap->path, soap->port)); 13754 DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Connect/reconnect to host='%s' path='%s' port=%d\n", soap->host, soap->path, soap->port)); 13755 #ifndef WITH_LEAN 13756 if (!strncmp(endpoint, "soap.udp:", 9)) 13757 soap->omode |= SOAP_IO_UDP; 13758 #endif 10858 13759 soap->socket = soap->fopen(soap, endpoint, soap->host, soap->port); 10859 13760 if (soap->error) … … 10861 13762 soap->keep_alive = ((soap->omode & SOAP_IO_KEEPALIVE) != 0); 10862 13763 } 10863 else if (!soap->keep_alive || !soap->fpoll || soap->fpoll(soap)) 10864 { soap->keep_alive = 0; /* force close */ 10865 soap_closesock(soap); 10866 DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Reconnect to host='%s' path='%s' port=%d\n", soap->host, soap->path, soap->port)); 10867 soap->socket = soap->fopen(soap, endpoint, soap->host, soap->port); 10868 if (soap->error) 10869 return soap->error; 10870 } 10871 } 13764 } 13765 count = soap_count_attachments(soap); 10872 13766 if (soap_begin_send(soap)) 10873 13767 return soap->error; 10874 count = soap_count_attachments(soap); 13768 if (http_command != SOAP_POST) 13769 { soap->mode &= ~SOAP_IO; 13770 soap->mode |= SOAP_IO_BUFFER; 13771 } 13772 #ifndef WITH_NOHTTP 13773 soap->action = soap_strdup(soap, action); 10875 13774 if ((soap->mode & SOAP_IO) != SOAP_IO_STORE && !(soap->mode & SOAP_ENC_XML) && endpoint) 10876 13775 { unsigned int k = soap->mode; … … 10880 13779 if ((soap->error = soap->fpost(soap, endpoint, soap->host, soap->port, soap->path, action, count))) 10881 13780 return soap->error; 13781 #ifndef WITH_LEANER 10882 13782 if ((k & SOAP_IO) == SOAP_IO_CHUNK) 10883 13783 { if (soap_flush(soap)) 10884 13784 return soap->error; 10885 13785 } 13786 #endif 10886 13787 soap->mode = k; 10887 13788 } 10888 13789 if (http_command != SOAP_POST) 10889 13790 return soap_end_send(soap); 13791 #endif 10890 13792 return SOAP_OK; 10891 13793 } … … 10897 13799 char* 10898 13800 SOAP_FMAC2 10899 soap_s2base64(struct soap *soap, const unsigned char *s, char *t, size_t n)10900 { register size_t i;13801 soap_s2base64(struct soap *soap, const unsigned char *s, char *t, int n) 13802 { register int i; 10901 13803 register unsigned long m; 10902 13804 register char *p; … … 10904 13806 t = (char*)soap_malloc(soap, (n + 2) / 3 * 4 + 1); 10905 13807 if (!t) 10906 { soap->error = SOAP_EOM;10907 13808 return NULL; 10908 }10909 13809 p = t; 10910 13810 t[0] = '\0'; … … 10941 13841 const char* 10942 13842 SOAP_FMAC2 10943 soap_base642s(struct soap *soap, const char *s, char *t, size_t l, size_t *n)13843 soap_base642s(struct soap *soap, const char *s, char *t, size_t l, int *n) 10944 13844 { register int i, j, c; 10945 13845 register unsigned long m; 10946 char *p = t; 13846 register const char *p; 13847 if (!s || !*s) 13848 { if (n) 13849 *n = 0; 13850 if (soap->error) 13851 return NULL; 13852 return SOAP_NON_NULL; 13853 } 13854 if (!t) 13855 { l = (strlen(s) + 3) / 4 * 3; 13856 t = (char*)soap_malloc(soap, l); 13857 } 13858 if (!t) 13859 return NULL; 13860 p = t; 10947 13861 if (n) 10948 13862 *n = 0; … … 10966 13880 } 10967 13881 if (n) 10968 *n += i;13882 *n += i; 10969 13883 return p; 10970 13884 } 10971 13885 c -= '+'; 10972 13886 if (c >= 0 && c <= 79) 10973 { m = (m << 6) + soap_base64i[c]; 13887 { int b = soap_base64i[c]; 13888 if (b >= 64) 13889 { soap->error = SOAP_TYPE; 13890 return NULL; 13891 } 13892 m = (m << 6) + b; 10974 13893 j++; 13894 } 13895 else if (!soap_blank(c + '+')) 13896 { soap->error = SOAP_TYPE; 13897 return NULL; 10975 13898 } 10976 13899 } … … 10980 13903 if (l < 3) 10981 13904 { if (n) 10982 *n += i;13905 *n += i; 10983 13906 return p; 10984 13907 } … … 10992 13915 10993 13916 /******************************************************************************/ 13917 #ifndef WITH_LEAN 13918 SOAP_FMAC1 13919 char* 13920 SOAP_FMAC2 13921 soap_s2hex(struct soap *soap, const unsigned char *s, char *t, int n) 13922 { register char *p; 13923 if (!t) 13924 t = (char*)soap_malloc(soap, 2 * n + 1); 13925 if (!t) 13926 return NULL; 13927 p = t; 13928 t[0] = '\0'; 13929 if (s) 13930 { for (; n > 0; n--) 13931 { register int m = *s++; 13932 *t++ = (char)((m >> 4) + (m > 159 ? 'a' - 10 : '0')); 13933 m &= 0x0F; 13934 *t++ = (char)(m + (m > 9 ? 'a' - 10 : '0')); 13935 } 13936 } 13937 *t++ = '\0'; 13938 return p; 13939 } 13940 #endif 13941 13942 /******************************************************************************/ 13943 #ifndef WITH_LEAN 13944 SOAP_FMAC1 13945 const char* 13946 SOAP_FMAC2 13947 soap_hex2s(struct soap *soap, const char *s, char *t, size_t l, int *n) 13948 { register const char *p; 13949 if (!s || !*s) 13950 { if (n) 13951 *n = 0; 13952 if (soap->error) 13953 return NULL; 13954 return SOAP_NON_NULL; 13955 } 13956 if (!t) 13957 { l = strlen(s) / 2; 13958 t = (char*)soap_malloc(soap, l); 13959 } 13960 if (!t) 13961 return NULL; 13962 p = t; 13963 while (l) 13964 { register int d1, d2; 13965 d1 = *s++; 13966 if (!d1) 13967 break; 13968 d2 = *s++; 13969 if (!d2) 13970 break; 13971 *t++ = ((d1 >= 'A' ? (d1 & 0x7) + 9 : d1 - '0') << 4) + (d2 >= 'A' ? (d2 & 0x7) + 9 : d2 - '0'); 13972 l--; 13973 } 13974 if (n) 13975 *n = (int)(t - p); 13976 return p; 13977 } 13978 #endif 13979 13980 /******************************************************************************/ 13981 #ifndef WITH_NOHTTP 10994 13982 #ifndef PALM_1 10995 13983 SOAP_FMAC1 … … 10997 13985 SOAP_FMAC2 10998 13986 soap_puthttphdr(struct soap *soap, int status, size_t count) 10999 { register const char *s; 11000 register int err; 11001 if (status == SOAP_FILE) 11002 s = soap->http_content; 11003 else if (status == SOAP_HTML) 11004 s = "text/html; charset=utf-8"; 13987 { if (soap->status != SOAP_GET) 13988 { register const char *s = "text/xml; charset=utf-8"; 13989 register int err = SOAP_OK; 11005 13990 #ifndef WITH_LEANER 11006 else if (soap->mode & SOAP_ENC_DIME) 11007 s = "application/dime"; 11008 #endif 11009 else if (soap->version == 2) 11010 s = "application/soap+xml; charset=utf-8"; 11011 else 11012 s = "text/xml; charset=utf-8"; 13991 register const char *r = NULL; 13992 #endif 13993 if (status == SOAP_FILE && soap->http_content) 13994 s = soap->http_content; 13995 else if (status == SOAP_HTML) 13996 s = "text/html; charset=utf-8"; 13997 else if (count || ((soap->omode & SOAP_IO) == SOAP_IO_CHUNK)) 13998 { if (soap->version == 2) 13999 s = "application/soap+xml; charset=utf-8"; 14000 } 11013 14001 #ifndef WITH_LEANER 11014 if ((soap->mode & SOAP_ENC_MIME) && soap->mime.boundary && soap->mime.start && soap->status != SOAP_GET) 11015 { sprintf(soap->tmpbuf, "multipart/related; boundary=\"%s\"; type=%s; start=\"%s\"", soap->mime.boundary, s, soap->mime.start); 11016 s = soap->tmpbuf; 11017 } 11018 #endif 11019 if ((err = soap->fposthdr(soap, "Content-Type", s))) 11020 return err; 14002 if (soap->mode & (SOAP_ENC_DIME | SOAP_ENC_MTOM)) 14003 { if (soap->mode & SOAP_ENC_MTOM) 14004 { r = s; 14005 s = "application/xop+xml; charset=utf-8"; 14006 } 14007 else 14008 s = "application/dime"; 14009 } 14010 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) 14011 { register const char *t = strchr(s, ';'); 14012 sprintf(soap->tmpbuf, "multipart/related; boundary=\"%s\"; type=\"", soap->mime.boundary); 14013 if (t) 14014 { strncat(soap->tmpbuf, s, t - s); 14015 soap->tmpbuf[sizeof(soap->tmpbuf)-1] = '\0'; 14016 } 14017 else 14018 strcat(soap->tmpbuf, s); 14019 if (soap->mime.start) 14020 { strcat(soap->tmpbuf, "\"; start=\""); 14021 strcat(soap->tmpbuf, soap->mime.start); 14022 } 14023 strcat(soap->tmpbuf, "\""); 14024 if (r) 14025 { strcat(soap->tmpbuf, "; start-info=\""); 14026 strcat(soap->tmpbuf, r); 14027 strcat(soap->tmpbuf, "\""); 14028 } 14029 s = soap->tmpbuf; 14030 } 14031 #endif 14032 if (s && (err = soap->fposthdr(soap, "Content-Type", s))) 14033 return err; 11021 14034 #ifdef WITH_ZLIB 11022 if (soap->omode & SOAP_ENC_ZLIB)11023 {14035 if ((soap->omode & SOAP_ENC_ZLIB)) 14036 { 11024 14037 #ifdef WITH_GZIP 11025 err = soap->fposthdr(soap, "Content-Encoding","gzip");14038 err = soap->fposthdr(soap, "Content-Encoding", soap->zlib_out == SOAP_ZLIB_DEFLATE ? "deflate" : "gzip"); 11026 14039 #else 11027 err = soap->fposthdr(soap, "Content-Encoding", "deflate"); 11028 #endif 14040 err = soap->fposthdr(soap, "Content-Encoding", "deflate"); 14041 #endif 14042 if (err) 14043 return err; 14044 } 14045 #endif 14046 #ifndef WITH_LEANER 14047 if ((soap->omode & SOAP_IO) == SOAP_IO_CHUNK) 14048 err = soap->fposthdr(soap, "Transfer-Encoding", "chunked"); 14049 else 14050 #endif 14051 if (s) 14052 { sprintf(soap->tmpbuf, "%lu", (unsigned long)count); 14053 err = soap->fposthdr(soap, "Content-Length", soap->tmpbuf); 14054 } 11029 14055 if (err) 11030 14056 return err; 11031 14057 } 11032 #endif11033 if ((soap->omode & SOAP_IO) == SOAP_IO_CHUNK)11034 err = soap->fposthdr(soap, "Transfer-Encoding", "chunked");11035 else if (count > 0)11036 { sprintf(soap->tmpbuf, "%lu", (unsigned long)count);11037 err = soap->fposthdr(soap, "Content-Length", soap->tmpbuf);11038 }11039 if (err)11040 return err;11041 14058 return soap->fposthdr(soap, "Connection", soap->keep_alive ? "keep-alive" : "close"); 11042 14059 } 11043 14060 #endif 11044 11045 /******************************************************************************/ 14061 #endif 14062 14063 /******************************************************************************/ 14064 #ifndef WITH_NOHTTP 11046 14065 #ifndef PALM_1 11047 14066 static int … … 11050 14069 } 11051 14070 #endif 11052 11053 /******************************************************************************/ 14071 #endif 14072 14073 /******************************************************************************/ 14074 #ifndef WITH_NOHTTP 14075 #ifndef PALM_1 14076 static int 14077 http_put(struct soap *soap) 14078 { return SOAP_PUT_METHOD; 14079 } 14080 #endif 14081 #endif 14082 14083 /******************************************************************************/ 14084 #ifndef WITH_NOHTTP 14085 #ifndef PALM_1 14086 static int 14087 http_del(struct soap *soap) 14088 { return SOAP_DEL_METHOD; 14089 } 14090 #endif 14091 #endif 14092 14093 /******************************************************************************/ 14094 #ifndef WITH_NOHTTP 14095 #ifndef PALM_1 14096 static int 14097 http_head(struct soap *soap) 14098 { return SOAP_HEAD_METHOD; 14099 } 14100 #endif 14101 #endif 14102 14103 /******************************************************************************/ 14104 #ifndef WITH_NOHTTP 11054 14105 #ifndef PALM_1 11055 14106 static int … … 11058 14109 register int err; 11059 14110 if (soap->status == SOAP_GET) 11060 { s = "GET"; 11061 count = 0; 11062 } 14111 s = "GET"; 11063 14112 else 11064 14113 s = "POST"; 11065 14114 #ifdef PALM 11066 if (!endpoint || (s trncmp(endpoint, "http:", 5) && strncmp(endpoint, "https:", 6) && strncmp(endpoint, "httpg:", 6)) && strncmp(endpoint, "_beam:", 6) && strncmp(endpoint, "_local:", 7) && strncmp(endpoint, "_btobex:", 8))14115 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)) 11067 14116 #else 11068 if (!endpoint || (s trncmp(endpoint, "http:", 5) && strncmp(endpoint, "https:", 6) && strncmp(endpoint, "httpg:", 6)))14117 if (!endpoint || (soap_tag_cmp(endpoint, "http:*") && soap_tag_cmp(endpoint, "https:*") && strncmp(endpoint, "httpg:", 6))) 11069 14118 #endif 11070 14119 return SOAP_OK; 11071 if (soap->proxy_host && strncmp(endpoint, "https:", 6)) 14120 if (strlen(endpoint) + strlen(soap->http_version) > sizeof(soap->tmpbuf) - 80) 14121 return soap->error = SOAP_EOM; 14122 if (soap->proxy_host && soap_tag_cmp(endpoint, "https:*")) 11072 14123 sprintf(soap->tmpbuf, "%s %s HTTP/%s", s, endpoint, soap->http_version); 11073 14124 else 11074 sprintf(soap->tmpbuf, "%s /%s HTTP/%s", s, path, soap->http_version);14125 sprintf(soap->tmpbuf, "%s /%s HTTP/%s", s, (*path == '/' ? path + 1 : path), soap->http_version); 11075 14126 if ((err = soap->fposthdr(soap, soap->tmpbuf, NULL))) 11076 14127 return err; 14128 #ifdef WITH_OPENSSL 14129 if ((soap->ssl && soap->port != 443) || (!soap->ssl && soap->port != 80)) 14130 sprintf(soap->tmpbuf, "%s:%d", host, port); 14131 else 14132 strcpy(soap->tmpbuf, host); 14133 #else 11077 14134 if (port != 80) 11078 14135 sprintf(soap->tmpbuf, "%s:%d", host, port); 11079 14136 else 11080 14137 strcpy(soap->tmpbuf, host); 14138 #endif 11081 14139 if ((err = soap->fposthdr(soap, "Host", soap->tmpbuf)) 11082 14140 || (err = soap->fposthdr(soap, "User-Agent", "gSOAP/2.7")) … … 11095 14153 { sprintf(soap->tmpbuf + 262, "%s:%s", soap->userid, soap->passwd); 11096 14154 strcpy(soap->tmpbuf, "Basic "); 11097 soap_s2base64(soap, (const unsigned char*)(soap->tmpbuf + 262), soap->tmpbuf + 6, strlen(soap->tmpbuf + 262));14155 soap_s2base64(soap, (const unsigned char*)(soap->tmpbuf + 262), soap->tmpbuf + 6, (int)strlen(soap->tmpbuf + 262)); 11098 14156 if ((err = soap->fposthdr(soap, "Authorization", soap->tmpbuf))) 11099 14157 return err; … … 11102 14160 { sprintf(soap->tmpbuf + 262, "%s:%s", soap->proxy_userid, soap->proxy_passwd); 11103 14161 strcpy(soap->tmpbuf, "Basic "); 11104 soap_s2base64(soap, (const unsigned char*)(soap->tmpbuf + 262), soap->tmpbuf + 6, strlen(soap->tmpbuf + 262));14162 soap_s2base64(soap, (const unsigned char*)(soap->tmpbuf + 262), soap->tmpbuf + 6, (int)strlen(soap->tmpbuf + 262)); 11105 14163 if ((err = soap->fposthdr(soap, "Proxy-Authorization", soap->tmpbuf))) 11106 14164 return err; … … 11116 14174 #endif 11117 14175 #endif 11118 if ( action && soap->version == 1)11119 { sprintf(soap->tmpbuf, "\"%s\"", action );14176 if (soap->status != SOAP_GET && (soap->version == 1 || (action && *action))) 14177 { sprintf(soap->tmpbuf, "\"%s\"", action && strlen(action) < sizeof(soap->tmpbuf) - 3 ? action : SOAP_STR_EOS); 11120 14178 if ((err = soap->fposthdr(soap, "SOAPAction", soap->tmpbuf))) 11121 14179 return err; … … 11124 14182 } 11125 14183 #endif 11126 11127 /******************************************************************************/ 14184 #endif 14185 14186 /******************************************************************************/ 14187 #ifndef WITH_NOHTTP 11128 14188 #ifndef PALM_1 11129 14189 static int … … 11141 14201 } 11142 14202 #endif 11143 11144 /******************************************************************************/ 14203 #endif 14204 14205 /******************************************************************************/ 14206 #ifndef WITH_NOHTTP 11145 14207 #ifndef PALM_1 11146 14208 static int … … 11155 14217 } 11156 14218 #endif 11157 11158 /******************************************************************************/ 14219 #endif 14220 14221 /******************************************************************************/ 14222 #ifndef WITH_NOHTTP 11159 14223 #ifndef PALM_1 11160 14224 static int 11161 14225 http_response(struct soap *soap, int status, size_t count) 11162 14226 { register int err; 11163 /* WR[ */11164 14227 #ifdef WMW_RPM_IO 11165 14228 if (soap->rpmreqid) 11166 14229 httpOutputEnable(soap->rpmreqid); 11167 #endif /* WMW_RPM_IO */ 11168 /* ]WR */ 14230 #endif 14231 if (strlen(soap->http_version) > 4) 14232 return soap->error = SOAP_EOM; 11169 14233 if (!status || status == SOAP_HTML || status == SOAP_FILE) 11170 { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "OK 200\n")); 11171 /* WR[ */ 14234 { const char *s; 14235 if (count || ((soap->omode & SOAP_IO) == SOAP_IO_CHUNK)) 14236 s = "200 OK"; 14237 else 14238 s = "202 ACCEPTED"; 14239 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Status = %s\n", s)); 11172 14240 #ifdef WMW_RPM_IO 11173 14241 if (soap->rpmreqid || soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) /* RPM behaves as if standalone */ 11174 14242 #else 11175 /* ]WR */11176 14243 if (soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) /* standalone application */ 11177 /* WR[ */ 11178 #endif /* WMW_RPM_IO */ 11179 /* ]WR */ 11180 { sprintf(soap->tmpbuf, "HTTP/%s 200 OK", soap->http_version); 14244 #endif 14245 { sprintf(soap->tmpbuf, "HTTP/%s %s", soap->http_version, s); 11181 14246 if ((err = soap->fposthdr(soap, soap->tmpbuf, NULL))) 11182 14247 return err; 11183 14248 } 11184 else if ((err = soap->fposthdr(soap, "Status", "200 OK")))14249 else if ((err = soap->fposthdr(soap, "Status", s))) 11185 14250 return err; 11186 14251 } 11187 else if (status > 200 && status < 600)14252 else if (status >= 200 && status < 600) 11188 14253 { sprintf(soap->tmpbuf, "HTTP/%s %d %s", soap->http_version, status, http_error(soap, status)); 11189 14254 if ((err = soap->fposthdr(soap, soap->tmpbuf, NULL))) 11190 14255 return err; 14256 #ifndef WITH_LEAN 11191 14257 if (status == 401) 11192 { sprintf(soap->tmpbuf, "Basic realm=\"%s\"", soap->authrealm? soap->authrealm : "gSOAP Web Service");14258 { sprintf(soap->tmpbuf, "Basic realm=\"%s\"", (soap->authrealm && strlen(soap->authrealm) < sizeof(soap->tmpbuf) - 14) ? soap->authrealm : "gSOAP Web Service"); 11193 14259 if ((err = soap->fposthdr(soap, "WWW-Authenticate", soap->tmpbuf))) 11194 14260 return err; … … 11198 14264 return err; 11199 14265 } 14266 #endif 11200 14267 } 11201 14268 else 11202 14269 { const char *s = *soap_faultcode(soap); 11203 if (soap->version == 2 && !strcmp(s, "SOAP-ENV:Sender"))14270 if (soap->version == 2 && (!s || !strcmp(s, "SOAP-ENV:Sender"))) 11204 14271 s = "400 Bad Request"; 11205 14272 else 11206 14273 s = "500 Internal Server Error"; 11207 14274 DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Error %s (status=%d)\n", s, status)); 11208 /* WR[ */11209 14275 #ifdef WMW_RPM_IO 11210 14276 if (soap->rpmreqid || soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) /* RPM behaves as if standalone */ 11211 14277 #else 11212 /* ]WR */11213 14278 if (soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) /* standalone application */ 11214 /* WR[ */ 11215 #endif /* WMW_RPM_IO */ 11216 /* ]WR */ 14279 #endif 11217 14280 { sprintf(soap->tmpbuf, "HTTP/%s %s", soap->http_version, s); 11218 14281 if ((err = soap->fposthdr(soap, soap->tmpbuf, NULL))) 11219 14282 return err; 11220 14283 } 11221 else if ((err = soap->fposthdr(soap, "Status", s))) 14284 else if ((err = soap->fposthdr(soap, "Status", s))) /* CGI */ 11222 14285 return err; 11223 14286 } … … 11232 14295 } 11233 14296 #endif 14297 #endif 11234 14298 11235 14299 /******************************************************************************/ … … 11242 14306 if (!(soap->omode & (SOAP_ENC_XML | SOAP_IO_STORE /* this tests for chunking too */)) 11243 14307 && (status == SOAP_HTML || status == SOAP_FILE)) 11244 { soap->omode &= ~SOAP_IO; 11245 soap->omode |= SOAP_IO_STORE; 11246 } 14308 soap->omode = (soap->omode & ~SOAP_IO) | SOAP_IO_STORE; 11247 14309 soap->status = status; 11248 14310 count = soap_count_attachments(soap); 11249 14311 if (soap_begin_send(soap)) 11250 14312 return soap->error; 14313 #ifndef WITH_NOHTTP 11251 14314 if ((soap->mode & SOAP_IO) != SOAP_IO_STORE && !(soap->mode & SOAP_ENC_XML)) 11252 14315 { register int n = soap->mode; … … 11256 14319 if ((soap->error = soap->fresponse(soap, status, count))) 11257 14320 return soap->error; 14321 #ifndef WITH_LEANER 11258 14322 if ((n & SOAP_IO) == SOAP_IO_CHUNK) 11259 14323 { if (soap_flush(soap)) 11260 14324 return soap->error; 11261 14325 } 14326 #endif 11262 14327 soap->mode = n; 11263 14328 } 14329 #endif 11264 14330 return SOAP_OK; 11265 14331 } … … 11270 14336 static const char* 11271 14337 soap_set_validation_fault(struct soap *soap, const char *s, const char *t) 11272 { sprintf(soap->msgbuf, "Validation constraint violation: %s%s in element <%s>", s, t?t:SOAP_STR_EOS, soap->tag); 14338 { if (*soap->tag) 14339 sprintf(soap->msgbuf, "Validation constraint violation: %s%s in element <%s>", s, t?t:SOAP_STR_EOS, soap->tag); 14340 else 14341 sprintf(soap->msgbuf, "Validation constraint violation: %s%s", s, t?t:SOAP_STR_EOS); 11273 14342 return soap->msgbuf; 11274 14343 } … … 11283 14352 { const char **c = soap_faultcode(soap); 11284 14353 const char **s = soap_faultstring(soap); 14354 if (soap->fseterror) 14355 soap->fseterror(soap, c, s); 11285 14356 if (!*c) 11286 14357 { if (soap->version == 2) … … 11303 14374 *s = soap_set_validation_fault(soap, "tag name or namespace mismatch", NULL); 11304 14375 break; 11305 case SOAP_TAG_END:11306 *s = soap_set_validation_fault(soap, "incorrect end tag", NULL);11307 break;11308 14376 case SOAP_TYPE: 11309 14377 *s = soap_set_validation_fault(soap, "data type mismatch ", soap->type); 11310 14378 break; 11311 14379 case SOAP_SYNTAX_ERROR: 11312 *s = "Well-formedness constraintviolation";14380 *s = "Well-formedness violation"; 11313 14381 break; 11314 14382 case SOAP_NO_TAG: 11315 *s = "No XML element tag found";14383 *s = "No XML element tag"; 11316 14384 break; 11317 14385 case SOAP_MUSTUNDERSTAND: … … 11322 14390 case SOAP_VERSIONMISMATCH: 11323 14391 *c = "SOAP-ENV:VersionMismatch"; 11324 *s = " SOAP version mismatch or invalid SOAP message";14392 *s = "Invalid SOAP message or SOAP version mismatch"; 11325 14393 break; 11326 14394 case SOAP_DATAENCODINGUNKNOWN: … … 11329 14397 break; 11330 14398 case SOAP_NAMESPACE: 11331 *s = soap_set_validation_fault(soap, "namespace mismatch", NULL); 14399 *s = soap_set_validation_fault(soap, "namespace error", NULL); 14400 break; 14401 case SOAP_USER_ERROR: 14402 *s = "User error"; 11332 14403 break; 11333 14404 case SOAP_FATAL_ERROR: … … 11338 14409 *s = soap->msgbuf; 11339 14410 break; 14411 case SOAP_NO_DATA: 14412 *s = "Data required for operation"; 14413 break; 11340 14414 case SOAP_GET_METHOD: 11341 14415 *s = "HTTP GET method not implemented"; 11342 14416 break; 14417 case SOAP_PUT_METHOD: 14418 *s = "HTTP PUT method not implemented"; 14419 break; 14420 case SOAP_HEAD_METHOD: 14421 *s = "HTTP HEAD method not implemented"; 14422 break; 14423 case SOAP_HTTP_METHOD: 14424 *s = "HTTP method not implemented"; 14425 break; 11343 14426 case SOAP_EOM: 11344 14427 *s = "Out of memory"; 14428 break; 14429 case SOAP_MOE: 14430 *s = "Memory overflow or memory corruption error"; 14431 break; 14432 case SOAP_HDR: 14433 *s = "Header line too long"; 11345 14434 break; 11346 14435 case SOAP_IOB: … … 11350 14439 *s = soap_set_validation_fault(soap, "nil not allowed", NULL); 11351 14440 break; 11352 case SOAP_ MULTI_ID:14441 case SOAP_DUPLICATE_ID: 11353 14442 *s = soap_set_validation_fault(soap, "multiple definitions of id ", soap->id); 14443 if (soap->version == 2) 14444 *soap_faultsubcode(soap) = "SOAP-ENC:DuplicateID"; 11354 14445 break; 11355 14446 case SOAP_MISSING_ID: 11356 14447 *s = soap_set_validation_fault(soap, "missing id for ref ", soap->id); 14448 if (soap->version == 2) 14449 *soap_faultsubcode(soap) = "SOAP-ENC:MissingID"; 11357 14450 break; 11358 14451 case SOAP_HREF: 11359 *s = soap_set_validation_fault(soap, "incompatible object ref", soap->id);14452 *s = soap_set_validation_fault(soap, "incompatible object type ref/id pair ", soap->id); 11360 14453 break; 11361 14454 case SOAP_FAULT: 14455 break; 14456 #ifndef WITH_NOIO 14457 case SOAP_UDP_ERROR: 14458 *s = "Message too large for UDP packet"; 11362 14459 break; 11363 14460 case SOAP_TCP_ERROR: 11364 14461 *s = tcp_error(soap); 11365 14462 break; 14463 #endif 11366 14464 case SOAP_HTTP_ERROR: 11367 *s = " HTTP error";14465 *s = "An HTTP processing error occurred"; 11368 14466 break; 11369 14467 case SOAP_SSL_ERROR: 14468 #ifdef WITH_OPENSSL 11370 14469 *s = "SSL error"; 14470 #else 14471 *s = "OpenSSL not installed: recompile with -DWITH_OPENSSL"; 14472 #endif 11371 14473 break; 11372 14474 case SOAP_PLUGIN_ERROR: 11373 14475 *s = "Plugin registry error"; 14476 break; 14477 case SOAP_DIME_ERROR: 14478 *s = "DIME format error"; 14479 break; 14480 case SOAP_DIME_HREF: 14481 *s = "DIME href to missing attachment"; 11374 14482 break; 11375 14483 case SOAP_DIME_MISMATCH: … … 11379 14487 *s = "End of DIME error"; 11380 14488 break; 11381 case SOAP_DIME_ERROR:11382 *s = "DIME format error";11383 break;11384 14489 case SOAP_MIME_ERROR: 11385 14490 *s = "MIME format error"; 11386 14491 break; 14492 case SOAP_MIME_HREF: 14493 *s = "MIME href to missing attachment"; 14494 break; 14495 case SOAP_MIME_END: 14496 *s = "End of MIME error"; 14497 break; 11387 14498 case SOAP_ZLIB_ERROR: 11388 14499 #ifdef WITH_ZLIB 11389 sprintf(soap->msgbuf, "Zlib/gzip error: '%s'", soap->d_stream .msg?soap->d_stream.msg:"");14500 sprintf(soap->msgbuf, "Zlib/gzip error: '%s'", soap->d_stream->msg?soap->d_stream->msg:SOAP_STR_EOS); 11390 14501 *s = soap->msgbuf; 11391 14502 #else 11392 *s = "Zlib not installed for required message (de)compression";14503 *s = "Zlib/gzip not installed for (de)compression: recompile with -DWITH_GZIP"; 11393 14504 #endif 11394 14505 break; … … 11400 14511 break; 11401 14512 case SOAP_OCCURS: 11402 *s = soap_set_validation_fault(soap, " a min/maxOccurs violation was detected", NULL);14513 *s = soap_set_validation_fault(soap, "occurrence violation", NULL); 11403 14514 break; 11404 14515 case SOAP_LENGTH: 11405 14516 *s = soap_set_validation_fault(soap, "content length violation", NULL); 11406 14517 break; 14518 case SOAP_FD_EXCEEDED: 14519 *s = "Maximum number of open connections was reached"; 14520 break; 14521 case SOAP_STOP: 14522 *s = "Stopped: no response sent"; 14523 break; 11407 14524 #endif 11408 14525 case SOAP_EOF: 11409 sprintf(soap->msgbuf, "End of file or no input: '%s'", soap_strerror(soap)); 14526 #ifndef WITH_NOIO 14527 strcpy(soap->msgbuf, soap_strerror(soap)); 14528 #ifndef WITH_LEAN 14529 if (strlen(soap->msgbuf) + 25 < sizeof(soap->msgbuf)) 14530 { memmove(soap->msgbuf + 25, soap->msgbuf, strlen(soap->msgbuf) + 1); 14531 memcpy(soap->msgbuf, "End of file or no input: ", 25); 14532 } 14533 #endif 11410 14534 *s = soap->msgbuf; 11411 14535 break; 14536 #else 14537 *s = "End of file or no input"; 14538 break; 14539 #endif 11412 14540 default: 14541 #ifndef WITH_NOHTTP 14542 #ifndef WITH_LEAN 11413 14543 if (soap->error > 200 && soap->error < 600) 11414 { sprintf(soap->msgbuf, "HTTP Error: '%s'", http_error(soap, soap->error));14544 { sprintf(soap->msgbuf, "HTTP Error: %d %s", soap->error, http_error(soap, soap->error)); 11415 14545 *s = soap->msgbuf; 11416 14546 } 11417 14547 else 11418 { sprintf(soap->msgbuf, "Error code %d", soap->error); 14548 #endif 14549 #endif 14550 { sprintf(soap->msgbuf, "Error %d", soap->error); 11419 14551 *s = soap->msgbuf; 11420 14552 } … … 11430 14562 soap_send_fault(struct soap *soap) 11431 14563 { register int status = soap->error; 14564 int r = 1; 11432 14565 if (status == SOAP_STOP) 11433 14566 return status; … … 11435 14568 soap->keep_alive = 0; /* to terminate connection */ 11436 14569 soap_set_fault(soap); 11437 if ((status != SOAP_EOF || (!soap->recv_timeout && !soap->send_timeout)) && (!soap->fpoll || soap->fpoll(soap) == SOAP_OK)) 14570 #ifndef WITH_NOIO 14571 #ifndef WITH_LEAN 14572 if (soap_valid_socket(soap->socket)) 14573 { struct timeval timeout; 14574 fd_set rfd, sfd; 14575 timeout.tv_sec = 0; 14576 timeout.tv_usec = 0; 14577 FD_ZERO(&rfd); 14578 FD_ZERO(&sfd); 14579 FD_SET(soap->socket, &rfd); 14580 FD_SET(soap->socket, &sfd); 14581 r = select((int)soap->socket + 1, &rfd, &sfd, NULL, &timeout); 14582 if (r > 0) 14583 { if (!FD_ISSET(soap->socket, &sfd) 14584 || (FD_ISSET(soap->socket, &rfd) 14585 && recv(soap->socket, soap->tmpbuf, 1, MSG_PEEK) < 0)) 14586 r = 0; 14587 } 14588 } 14589 #endif 14590 #endif 14591 if ((status != SOAP_EOF || (!soap->recv_timeout && !soap->send_timeout)) && r > 0) 11438 14592 { soap->error = SOAP_OK; 11439 14593 soap_serializeheader(soap); … … 11448 14602 soap_envelope_end_out(soap); 11449 14603 } 14604 soap_end_count(soap); 11450 14605 if (soap_response(soap, status) 11451 14606 || soap_envelope_begin_out(soap) … … 11503 14658 11504 14659 /******************************************************************************/ 14660 #ifndef WITH_NOHTTP 14661 #ifndef PALM_1 14662 SOAP_FMAC1 14663 int 14664 SOAP_FMAC2 14665 soap_send_empty_response(struct soap *soap, int httpstatuscode) 14666 { register soap_mode m = soap->omode; 14667 soap->count = 0; 14668 if ((m & SOAP_IO) == SOAP_IO_CHUNK) 14669 soap->omode = (m & ~SOAP_IO) | SOAP_IO_BUFFER; 14670 if (soap_response(soap, httpstatuscode) || soap_end_send(soap)) 14671 { soap->omode = m; 14672 return soap_closesock(soap); 14673 } 14674 soap->omode = m; 14675 return SOAP_OK; 14676 } 14677 #endif 14678 #endif 14679 14680 /******************************************************************************/ 14681 #ifndef WITH_NOHTTP 14682 #ifndef PALM_1 14683 SOAP_FMAC1 14684 int 14685 SOAP_FMAC2 14686 soap_recv_empty_response(struct soap *soap) 14687 { if (soap_begin_recv(soap) || soap_end_recv(soap)) 14688 { if (soap->error != 202) 14689 return soap_closesock(soap); 14690 soap->error = SOAP_OK; 14691 } 14692 return SOAP_OK; 14693 } 14694 #endif 14695 #endif 14696 14697 /******************************************************************************/ 14698 #ifndef WITH_NOIO 11505 14699 #ifndef PALM_1 11506 14700 static const char* 11507 14701 soap_strerror(struct soap *soap) 11508 { int err = soap->errnum; 11509 if (!err) 11510 err = soap_errno; 14702 { register int err = soap->errnum; 11511 14703 if (err) 11512 14704 { 11513 #ifndef UNDER_CE14705 #ifndef WIN32 11514 14706 return strerror(err); 11515 14707 #else 11516 FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, NULL, err, 0, (LPTSTR)&soap->werrorstr, sizeof(soap->werrorstr), NULL); 11517 wcstombs(soap->errorstr, soap->werrorstr, sizeof(soap->errorstr)); 11518 return soap->errorstr; 11519 #endif 11520 } 14708 #ifndef UNDER_CE 14709 DWORD len; 14710 *soap->msgbuf = '\0'; 14711 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); 14712 #else 14713 DWORD i, len; 14714 *soap->msgbuf = '\0'; 14715 len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, err, 0, (LPTSTR)soap->msgbuf, (DWORD)(sizeof(soap->msgbuf)/sizeof(TCHAR)), NULL); 14716 for (i = 0; i <= len; i++) 14717 { if (((TCHAR*)soap->msgbuf)[i] < 0x80) 14718 soap->msgbuf[i] = (char)((TCHAR*)soap->msgbuf)[i]; 14719 else 14720 soap->msgbuf[i] = '?'; 14721 } 14722 #endif 14723 return soap->msgbuf; 14724 #endif 14725 } 14726 #ifndef WITH_LEAN 14727 if (soap->recv_timeout > 0) 14728 { if (soap->send_timeout > 0) 14729 sprintf(soap->msgbuf, "Operation interrupted or timed out after %ds send or %ds receive delay", soap->send_timeout, soap->recv_timeout); 14730 else 14731 sprintf(soap->msgbuf, "Operation interrupted or timed out after %ds receive delay", soap->recv_timeout); 14732 return soap->msgbuf; 14733 } 14734 #endif 11521 14735 return "Operation interrupted or timed out"; 11522 14736 } 11523 14737 #endif 14738 #endif 11524 14739 11525 14740 /******************************************************************************/ 11526 14741 #ifndef PALM_2 11527 14742 static int 11528 soap_set_error(struct soap *soap, const char *faultcode, const char *faults tring, const char *faultdetail, int soaperror)14743 soap_set_error(struct soap *soap, const char *faultcode, const char *faultsubcodeQName, const char *faultstring, const char *faultdetailXML, int soaperror) 11529 14744 { *soap_faultcode(soap) = faultcode; 14745 if (faultsubcodeQName) 14746 *soap_faultsubcode(soap) = faultsubcodeQName; 11530 14747 *soap_faultstring(soap) = faultstring; 11531 if (faultdetail && *faultdetail)14748 if (faultdetailXML && *faultdetailXML) 11532 14749 { register const char **s = soap_faultdetail(soap); 11533 14750 if (s) 11534 *s = faultdetail ;14751 *s = faultdetailXML; 11535 14752 } 11536 14753 return soap->error = soaperror; … … 11543 14760 int 11544 14761 SOAP_FMAC2 11545 soap_set_sender_error(struct soap *soap, const char *faultstring, const char *faultdetail , int soaperror)11546 { return soap_set_error(soap, soap->version == 2 ? "SOAP-ENV:Sender" : "SOAP-ENV:Client", faultstring, faultdetail, soaperror);14762 soap_set_sender_error(struct soap *soap, const char *faultstring, const char *faultdetailXML, int soaperror) 14763 { return soap_set_error(soap, soap->version == 2 ? "SOAP-ENV:Sender" : "SOAP-ENV:Client", NULL, faultstring, faultdetailXML, soaperror); 11547 14764 } 11548 14765 #endif … … 11553 14770 int 11554 14771 SOAP_FMAC2 11555 soap_set_receiver_error(struct soap *soap, const char *faultstring, const char *faultdetail , int soaperror)11556 { return soap_set_error(soap, soap->version == 2 ? "SOAP-ENV:Receiver" : "SOAP-ENV:Server", faultstring, faultdetail, soaperror);14772 soap_set_receiver_error(struct soap *soap, const char *faultstring, const char *faultdetailXML, int soaperror) 14773 { return soap_set_error(soap, soap->version == 2 ? "SOAP-ENV:Receiver" : "SOAP-ENV:Server", NULL, faultstring, faultdetailXML, soaperror); 11557 14774 } 11558 14775 #endif … … 11561 14778 #ifndef PALM_2 11562 14779 static int 11563 soap_copy_fault(struct soap *soap, const char *faultcode, const char *faultstring, const char *faultdetail) 11564 { char *s = NULL, *t = NULL; 14780 soap_copy_fault(struct soap *soap, const char *faultcode, const char *faultsubcodeQName, const char *faultstring, const char *faultdetailXML) 14781 { char *r = NULL, *s = NULL, *t = NULL; 14782 if (faultsubcodeQName) 14783 r = soap_strdup(soap, faultsubcodeQName); 11565 14784 if (faultstring) 11566 14785 s = soap_strdup(soap, faultstring); 11567 if (faultdetail )11568 t = soap_strdup(soap, faultdetail );11569 return soap_set_error(soap, faultcode, s, t, SOAP_FAULT);14786 if (faultdetailXML) 14787 t = soap_strdup(soap, faultdetailXML); 14788 return soap_set_error(soap, faultcode, r, s, t, SOAP_FAULT); 11570 14789 } 11571 14790 #endif … … 11576 14795 int 11577 14796 SOAP_FMAC2 11578 soap_sender_fault(struct soap *soap, const char *faultstring, const char *faultdetail )11579 { return soap_ copy_fault(soap, soap->version == 2 ? "SOAP-ENV:Sender" : "SOAP-ENV:Client", faultstring, faultdetail);14797 soap_sender_fault(struct soap *soap, const char *faultstring, const char *faultdetailXML) 14798 { return soap_sender_fault_subcode(soap, NULL, faultstring, faultdetailXML); 11580 14799 } 11581 14800 #endif … … 11586 14805 int 11587 14806 SOAP_FMAC2 11588 soap_ receiver_fault(struct soap *soap, const char *faultstring, const char *faultdetail)11589 { return soap_copy_fault(soap, soap->version == 2 ? "SOAP-ENV: Receiver" : "SOAP-ENV:Server", faultstring, faultdetail);14807 soap_sender_fault_subcode(struct soap *soap, const char *faultsubcodeQName, const char *faultstring, const char *faultdetailXML) 14808 { return soap_copy_fault(soap, soap->version == 2 ? "SOAP-ENV:Sender" : "SOAP-ENV:Client", faultsubcodeQName, faultstring, faultdetailXML); 11590 14809 } 11591 14810 #endif … … 11594 14813 #ifndef PALM_2 11595 14814 SOAP_FMAC1 14815 int 14816 SOAP_FMAC2 14817 soap_receiver_fault(struct soap *soap, const char *faultstring, const char *faultdetailXML) 14818 { return soap_receiver_fault_subcode(soap, NULL, faultstring, faultdetailXML); 14819 } 14820 #endif 14821 14822 /******************************************************************************/ 14823 #ifndef PALM_2 14824 SOAP_FMAC1 14825 int 14826 SOAP_FMAC2 14827 soap_receiver_fault_subcode(struct soap *soap, const char *faultsubcodeQName, const char *faultstring, const char *faultdetailXML) 14828 { return soap_copy_fault(soap, soap->version == 2 ? "SOAP-ENV:Receiver" : "SOAP-ENV:Server", faultsubcodeQName, faultstring, faultdetailXML); 14829 } 14830 #endif 14831 14832 /******************************************************************************/ 14833 #ifndef PALM_2 14834 #ifndef WITH_NOSTDLIB 14835 SOAP_FMAC1 11596 14836 void 11597 14837 SOAP_FMAC2 11598 14838 soap_print_fault(struct soap *soap, FILE *fd) 11599 { if (soap->error) 11600 { const char **s; 11601 if (!*soap_faultcode(soap)) 14839 { if (soap_check_state(soap)) 14840 fprintf(fd, "Error: soap struct state not initialized\n"); 14841 else if (soap->error) 14842 { const char *c, *v = NULL, *s, **d; 14843 d = soap_faultcode(soap); 14844 if (!*d) 11602 14845 soap_set_fault(soap); 11603 fprintf(fd, "SOAP FAULT: %s\n\"%s\"\n", *soap_faultcode(soap), *soap_faultstring(soap)); 11604 s = soap_faultdetail(soap); 11605 if (s && *s) 11606 fprintf(fd, "Detail: %s\n", *s); 11607 } 11608 } 14846 c = *d; 14847 if (soap->version == 2) 14848 v = *soap_faultsubcode(soap); 14849 s = *soap_faultstring(soap); 14850 d = soap_faultdetail(soap); 14851 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]"); 14852 } 14853 } 14854 #endif 11609 14855 #endif 11610 14856 11611 14857 /******************************************************************************/ 11612 #ifndef PALM_1 14858 #ifdef __cplusplus 14859 #ifndef WITH_LEAN 14860 #ifndef WITH_NOSTDLIB 14861 SOAP_FMAC1 14862 void 14863 SOAP_FMAC2 14864 soap_stream_fault(struct soap *soap, std::ostream& os) 14865 { if (soap_check_state(soap)) 14866 os << "Error: soap struct state not initialized\n"; 14867 else if (soap->error) 14868 { const char *c, *v = NULL, *s, **d; 14869 d = soap_faultcode(soap); 14870 if (!*d) 14871 soap_set_fault(soap); 14872 c = *d; 14873 if (soap->version == 2) 14874 v = *soap_faultsubcode(soap); 14875 s = *soap_faultstring(soap); 14876 d = soap_faultdetail(soap); 14877 os << (soap->version ? "SOAP 1." : "Error ") 14878 << (soap->version ? (int)soap->version : soap->error) 14879 << " fault: " << c 14880 << "[" << (v ? v : "no subcode") << "]" 14881 << std::endl 14882 << "\"" << (s ? s : "[no reason]") << "\"" 14883 << std::endl 14884 << "Detail: " << (d && *d ? *d : "[no detail]") 14885 << std::endl; 14886 } 14887 } 14888 #endif 14889 #endif 14890 #endif 14891 14892 /******************************************************************************/ 14893 #ifndef WITH_LEAN 14894 #ifndef WITH_NOSTDLIB 14895 SOAP_FMAC1 14896 char* 14897 SOAP_FMAC2 14898 soap_sprint_fault(struct soap *soap, char *buf, size_t len) 14899 { if (soap_check_state(soap)) 14900 strncpy(buf, "Error: soap struct not initialized", len); 14901 else if (soap->error) 14902 { const char *c, *v = NULL, *s, **d; 14903 d = soap_faultcode(soap); 14904 if (!*d) 14905 soap_set_fault(soap); 14906 c = *d; 14907 if (soap->version == 2) 14908 v = *soap_faultsubcode(soap); 14909 s = *soap_faultstring(soap); 14910 d = soap_faultdetail(soap); 14911 #ifdef WIN32 14912 _snprintf 14913 #else 14914 snprintf 14915 #endif 14916 (buf, len, "%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]"); 14917 } 14918 return buf; 14919 } 14920 #endif 14921 #endif 14922 14923 /******************************************************************************/ 14924 #ifndef PALM_1 14925 #ifndef WITH_NOSTDLIB 11613 14926 SOAP_FMAC1 11614 14927 void … … 11617 14930 { 11618 14931 #ifndef WITH_LEAN 11619 int c; 11620 if (soap->error && soap->buflen > 0) 11621 { if (soap->bufidx == 0) 11622 soap->bufidx = 1; 11623 c = soap->buf[soap->bufidx - 1]; 11624 soap->buf[soap->bufidx - 1] = '\0'; 11625 if (soap->buflen - soap->bufidx > 1024) 11626 soap->buf[soap->bufidx + 1024] = '\0'; 14932 int i, j, c1, c2; 14933 if (soap->error && soap->bufidx <= soap->buflen && soap->buflen > 0 && soap->buflen <= SOAP_BUFLEN) 14934 { i = (int)soap->bufidx - 1; 14935 if (i <= 0) 14936 i = 0; 14937 c1 = soap->buf[i]; 14938 soap->buf[i] = '\0'; 14939 if ((int)soap->buflen >= i + 1024) 14940 j = i + 1023; 11627 14941 else 11628 soap->buf[soap->buflen - 1] = '\0'; 11629 fprintf(fd, "%s%c\n** HERE **\n", soap->buf, c); 14942 j = (int)soap->buflen - 1; 14943 c2 = soap->buf[j]; 14944 soap->buf[j] = '\0'; 14945 fprintf(fd, "%s%c\n<!-- ** HERE ** -->\n", soap->buf, c1); 11630 14946 if (soap->bufidx < soap->buflen) 11631 14947 fprintf(fd, "%s\n", soap->buf + soap->bufidx); 11632 } 11633 #endif 11634 } 14948 soap->buf[i] = c1; 14949 soap->buf[j] = c2; 14950 } 14951 #endif 14952 } 14953 #endif 11635 14954 #endif 11636 14955 … … 11643 14962 { register struct soap_plugin *p; 11644 14963 register int r; 11645 if (!(p = (struct soap_plugin*)SOAP_MALLOC(s izeof(struct soap_plugin))))14964 if (!(p = (struct soap_plugin*)SOAP_MALLOC(soap, sizeof(struct soap_plugin)))) 11646 14965 return soap->error = SOAP_EOM; 11647 14966 p->id = NULL; … … 11657 14976 } 11658 14977 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)); 11659 SOAP_FREE( p);14978 SOAP_FREE(soap, p); 11660 14979 return r; 11661 14980 } … … 11689 15008 #endif 11690 15009 15010 /******************************************************************************\ 15011 * 15012 * C++ soap struct methods 15013 * 15014 \******************************************************************************/ 15015 15016 #ifdef __cplusplus 15017 soap::soap() 15018 { soap_init(this); 15019 } 15020 #endif 15021 15022 /******************************************************************************/ 15023 #ifdef __cplusplus 15024 soap::soap(soap_mode m) 15025 { soap_init1(this, m); 15026 } 15027 #endif 15028 15029 /******************************************************************************/ 15030 #ifdef __cplusplus 15031 soap::soap(soap_mode im, soap_mode om) 15032 { soap_init2(this, im, om); 15033 } 15034 #endif 15035 15036 /******************************************************************************/ 15037 #ifdef __cplusplus 15038 soap::soap(struct soap& soap) 15039 { soap_copy_context(this, &soap); 15040 } 15041 #endif 15042 15043 /******************************************************************************/ 15044 #ifdef __cplusplus 15045 soap::~soap() 15046 { soap_destroy(this); 15047 soap_end(this); 15048 soap_done(this); 15049 } 15050 #endif 15051 15052 /******************************************************************************/ -
trunk/Nebulous/nebclient/src/stdsoap2.h
r3017 r19542 1 1 /* 2 3 stdsoap2.h 2.7.0d 4 5 gSOAP runtime environment. 2 stdsoap2.h 2.7.11-upd 3 4 gSOAP runtime engine 6 5 7 6 gSOAP XML Web services tools 8 Copyright (C) 2000-2004, Robert van Engelen, Genivia, Inc., All Rights Reserved. 9 7 Copyright (C) 2000-2008, Robert van Engelen, Genivia Inc., All Rights Reserved. 8 This part of the software is released under ONE of the following licenses: 9 GPL, the gSOAP public license, OR Genivia's license for commercial use. 10 -------------------------------------------------------------------------------- 10 11 Contributors: 11 12 12 Wind River Systems, Inc., for the following additions (marked WR[...]) :13 Wind River Systems, Inc., for the following additions 13 14 - vxWorks compatible 14 - Support for IPv6.15 16 15 -------------------------------------------------------------------------------- 17 16 gSOAP public license. … … 26 25 27 26 The Initial Developer of the Original Code is Robert A. van Engelen. 28 Copyright (C) 2000-200 4, Robert van Engelen, Genivia,Inc., All Rights Reserved.27 Copyright (C) 2000-2008, Robert van Engelen, Genivia Inc., All Rights Reserved. 29 28 -------------------------------------------------------------------------------- 30 29 GPL license. … … 45 44 Author contact information: 46 45 engelen@genivia.com / engelen@acm.org 46 47 This program is released under the GPL with the additional exemption that 48 compiling, linking, and/or using OpenSSL is allowed. 49 -------------------------------------------------------------------------------- 50 A commercial use license is available from Genivia, Inc., contact@genivia.com 47 51 -------------------------------------------------------------------------------- 48 52 */ … … 62 66 #endif 63 67 64 #ifndef SOAP_BEGIN_NAMESPACE65 # define SOAP_BEGIN_NAMESPACE(name)66 #endif67 68 #ifndef SOAP_END_NAMESPACE69 # define SOAP_END_NAMESPACE(name)70 #endif71 72 68 #ifndef SOAP_FMAC1 /* stdsoap2.h declaration macro */ 73 69 # define SOAP_FMAC1 … … 82 78 #endif 83 79 80 #ifndef SOAP_FMAC3S /* string converter for (de)serializer declaration macro */ 81 # define SOAP_FMAC3S SOAP_FMAC3 82 #endif 83 84 84 #ifndef SOAP_FMAC4 /* (de)serializer declaration macro */ 85 85 # define SOAP_FMAC4 86 86 #endif 87 87 88 #ifndef SOAP_FMAC4S /* string converter for (de)serializer declaration macro */ 89 # define SOAP_FMAC4S SOAP_FMAC4 90 #endif 91 88 92 #ifndef SOAP_FMAC5 /* stub/skeleton declaration macro */ 89 93 # define SOAP_FMAC5 … … 104 108 #ifndef SOAP_SOURCE_STAMP 105 109 # define SOAP_SOURCE_STAMP(str) 110 #endif 111 112 /* gSOAP 2.7.4 and higher: fast look-aside buffering is stable */ 113 #ifndef WITH_FAST 114 # define WITH_FAST 106 115 #endif 107 116 … … 128 137 # ifndef WIN32 129 138 # define WIN32 139 # endif 140 #endif 141 142 #ifdef _WIN32_WCE 143 # ifndef UNDER_CE 144 # define UNDER_CE _WIN32_WCE 130 145 # endif 131 146 #endif … … 157 172 158 173 #if defined(__palmos__) || defined(PALM_GCC) || defined(__PALMOS_TRAPS__) 159 # define PALM 160 #endif 161 162 #ifdef __hpux 163 # define HP_UX 164 #endif 165 166 #ifdef __alpha 167 # define TRU64 174 # ifndef PALM 175 # define PALM 176 # endif 177 #endif 178 179 #if defined(__hpux) 180 # ifndef HP_UX 181 # define HP_UX 182 # endif 183 #endif 184 185 #if defined(__digital__) && defined(__unix__) 186 # ifndef TRU64 187 # define TRU64 188 # endif 168 189 #endif 169 190 170 191 #ifdef __MVS__ 171 # define OS390 172 #endif 173 174 #ifdef _AIX 175 # define __socklen_t_defined 192 # ifndef OS390 193 # define OS390 194 # endif 176 195 #endif 177 196 178 197 #ifdef HAVE_CONFIG_H 179 198 # include "config.h" 199 # if defined(WITH_OPENSSL) 200 # ifndef HAVE_OPENSSL_SSL_H 201 # undef WITH_OPENSSL 202 # endif 203 # endif 204 # if defined(WITH_ZLIB) || defined(WITH_GZIP) 205 # ifndef HAVE_ZLIB_H 206 # undef WITH_ZLIB 207 # undef WITH_GZIP 208 # endif 209 # endif 180 210 #else 181 211 # if defined(UNDER_CE) 212 # define WITH_NOEMPTYSTRUCT 182 213 # define WITH_LEAN 183 214 # define HAVE_SSCANF 184 215 # elif defined(WIN32) 216 # define WITH_NOEMPTYSTRUCT 185 217 # define HAVE_STRRCHR 186 218 # define HAVE_STRTOD … … 192 224 # define HAVE_WCTOMB 193 225 # define HAVE_MBTOWC 226 # define SOAP_LONG_FORMAT "%I64d" 227 # define SOAP_ULONG_FORMAT "%I64u" 194 228 # elif defined(CYGWIN) 195 229 # define HAVE_STRRCHR … … 209 243 # define HAVE_STRTOD 210 244 # define HAVE_SSCANF 245 # define HAVE_STRTOD_L 246 # define HAVE_SSCANF_L 247 # define HAVE_SPRINTF_L 211 248 # define HAVE_STRTOL 212 249 # define HAVE_STRTOUL … … 217 254 # define HAVE_WCTOMB 218 255 # define HAVE_MBTOWC 219 # elif defined(_AIX VERSION_431)256 # elif defined(_AIX43) 220 257 # define HAVE_STRRCHR 221 258 # define HAVE_STRTOD … … 228 265 # define HAVE_GMTIME_R 229 266 # define HAVE_LOCALTIME_R 267 # define HAVE_WCTOMB 268 # define HAVE_MBTOWC 269 # elif defined(_AIX41) 270 # define HAVE_STRRCHR 271 # define HAVE_STRTOD 272 # define HAVE_SSCANF 273 # define HAVE_STRTOL 274 # define HAVE_STRTOUL 275 # define HAVE_SYS_TIMEB_H 230 276 # define HAVE_WCTOMB 231 277 # define HAVE_MBTOWC … … 243 289 # define HAVE_WCTOMB 244 290 # define HAVE_MBTOWC 245 # elif defined(FREEBSD) 291 # elif defined(FREEBSD) || defined(__FreeBSD__) 246 292 # define HAVE_STRRCHR 247 293 # define HAVE_STRTOD 248 294 # define HAVE_SSCANF 295 # define HAVE_STRTOD_L 296 # define HAVE_SSCANF_L 297 # define HAVE_SPRINTF_L 249 298 # define HAVE_STRTOL 250 299 # define HAVE_STRTOUL 300 # define HAVE_STRTOLL 301 # define HAVE_STRTOULL 251 302 # define HAVE_GETTIMEOFDAY 252 303 # define HAVE_RAND_R … … 255 306 # define HAVE_WCTOMB 256 307 # define HAVE_MBTOWC 308 # define SOAP_LONG_FORMAT "%qd" 309 # define SOAP_ULONG_FORMAT "%qu" 257 310 # elif defined(__VMS) 258 311 # define HAVE_STRRCHR … … 268 321 # define HAVE_WCTOMB 269 322 # define HAVE_MBTOWC 270 # elif defined(__GLIBC__) 323 # elif defined(__GLIBC__) || defined(__GNU__) 271 324 # define HAVE_STRRCHR 272 325 # define HAVE_STRTOD 273 326 # define HAVE_SSCANF 327 # define HAVE_STRTOD_L 328 # define HAVE_SSCANF_L 329 # define HAVE_SPRINTF_L 274 330 # define HAVE_STRTOL 275 331 # define HAVE_STRTOUL 332 # define HAVE_STRTOLL 333 # define HAVE_STRTOULL 276 334 # define HAVE_SYS_TIMEB_H 277 335 # define HAVE_FTIME … … 297 355 # define HAVE_WCTOMB 298 356 # define HAVE_MBTOWC 357 # define SOAP_LONG_FORMAT "%ld" 358 # define SOAP_ULONG_FORMAT "%lu" 299 359 # elif defined(MAC_CARBON) 360 # define WITH_NOIO 300 361 # define HAVE_STRRCHR 301 362 # define HAVE_STRTOD 302 363 # define HAVE_SSCANF 364 # define HAVE_STRTOD_L 365 # define HAVE_SSCANF_L 366 # define HAVE_SPRINTF_L 303 367 # define HAVE_STRTOL 304 368 # define HAVE_STRTOUL … … 319 383 # define O_NONBLOCK FNONBIO 320 384 # include <sys_socket.h> 321 # include <time.h>322 385 # include "palmFunctions.h" 323 386 # elif defined(SYMBIAN) … … 325 388 # define WITH_NONAMESPACES 326 389 # define HAVE_STRTOD /* use STRTOD since sscanf doesn't seem to work */ 390 # include <e32def.h> 327 391 # include <sys/ioctl.h> 328 392 # elif defined(VXWORKS) 393 # ifdef _WRS_KERNEL 394 # define _POSIX_THREADS 1 395 # endif 329 396 # define HAVE_STRRCHR 330 397 # define HAVE_STRTOD … … 332 399 # define HAVE_STRTOL 333 400 # define HAVE_STRTOUL 334 # define HAVE_RAND_R 335 # define HAVE_PGMTIME_R 336 # define HAVE_PLOCALTIME_R 401 # define HAVE_GMTIME 402 # define HAVE_LOCALTIME 337 403 # define HAVE_MKTIME 338 404 # elif defined(OS390) … … 348 414 # define HAVE_LOCALTIME_R 349 415 # define HAVE_WCTOMB 350 # define HAVE_MB 416 # define HAVE_MBTOWC 417 # elif defined(AS400) 418 # define HAVE_STRRCHR 419 # define HAVE_STRTOD 420 # define HAVE_SSCANF 421 # define HAVE_STRTOL 422 # define HAVE_STRTOUL 423 # define HAVE_SYS_TIMEB_H 424 # define HAVE_FTIME 425 # define HAVE_RAND_R 426 # define HAVE_GMTIME_R 427 # define HAVE_LOCALTIME_R 428 # define HAVE_WCTOMB 429 # define HAVE_MBTOWC 430 # elif defined(__QNX__) || defined(QNX) 431 /* QNX does not have a working version of strtof */ 432 # undef HAVE_STRTOF 433 # define HAVE_STRRCHR 434 # define HAVE_STRTOD 435 # define HAVE_SSCANF 436 # define HAVE_STRTOL 437 # define HAVE_STRTOUL 438 # define HAVE_SYS_TIMEB_H 439 # define HAVE_FTIME 440 # define HAVE_RAND_R 441 # define HAVE_GETHOSTBYNAME_R 442 # define HAVE_GMTIME_R 443 # define HAVE_LOCALTIME_R 444 # define HAVE_WCTOMB 445 # define HAVE_MBTOWC 446 # define LONG64 long 447 # define ULONG64 unsigned LONG64 448 # define SOAP_LONG_FORMAT "%ld" 449 # define SOAP_ULONG_FORMAT "%lu" 351 450 # else 352 451 /* Default asumptions on supported functions */ … … 367 466 #endif 368 467 369 #if defined(TRU64) 370 # define SOAP_LONG_FORMAT "%ld" 371 # define SOAP_ULONG_FORMAT "%lu" 372 #elif defined(WIN32) 373 # define SOAP_LONG_FORMAT "%I64d" 374 # define SOAP_ULONG_FORMAT "%I64u" 375 #endif 376 377 #ifndef SOAP_LONG_FORMAT 378 # define SOAP_LONG_FORMAT "%lld" /* printf format for 64 bit ints */ 379 #endif 380 381 #ifndef SOAP_ULONG_FORMAT 382 # define SOAP_ULONG_FORMAT "%llu" /* printf format for unsigned 64 bit ints */ 383 #endif 384 385 #ifndef SOAP_MALLOC /* use libc malloc */ 386 # define SOAP_MALLOC(n) malloc(n) 387 #endif 388 389 #ifndef SOAP_FREE /* use libc free */ 390 # define SOAP_FREE(p) free(p) 391 #endif 392 393 #include <stdlib.h> 394 395 #ifndef PALM 396 # include <stdio.h> 397 # include <string.h> 398 #endif 399 400 #include <ctype.h> 401 #include <limits.h> 468 #ifdef WITH_C_LOCALE 469 # include <xlocale.h> 470 #else 471 # undef HAVE_STRTOF_L 472 # undef HAVE_STRTOD_L 473 # undef HAVE_SSCANF_L 474 # undef HAVE_SPRINTF_L 475 #endif 476 477 #ifndef WITH_NOSTDLIB 478 # include <stdlib.h> 479 # ifndef PALM 480 # include <stdio.h> 481 # include <string.h> 482 # endif 483 # include <ctype.h> 484 # include <limits.h> 485 #endif 402 486 403 487 #if defined(__cplusplus) && !defined(WITH_LEAN) 404 488 # include <string> 405 489 # include <iostream> 406 using namespace std; 407 #endif 490 #endif 491 492 #ifdef WITH_NOHTTP 493 # ifndef WITH_NOIO 494 # define WITH_NOIO 495 # undef WITH_COOKIES 496 # endif 497 #endif 498 499 /* Suggestion when SOAP_FD_EXCEEDED error occurs: 500 Some systems allow increasing FD_SETSIZE before including sys/types.h: 501 #define FD_SETSIZE (2048) 502 */ 408 503 409 504 #ifndef UNDER_CE 410 505 # ifndef PALM 411 # i nclude <errno.h>412 # ifndef MAC_CARBON506 # ifndef WITH_NOIO 507 # include <errno.h> 413 508 # include <sys/types.h> 414 509 # endif … … 429 524 #endif 430 525 431 #ifndef MAC_CARBON526 #ifndef WITH_NOIO 432 527 # ifndef WIN32 433 528 # ifndef PALM … … 435 530 # ifdef VXWORKS 436 531 # include <sockLib.h> 437 # endif 438 # ifndef VXWORKS 532 # include <selectLib.h> 533 # ifndef _WRS_KERNEL 534 # include <strings.h> 535 # endif 536 # else 439 537 # ifndef SYMBIAN 440 538 # include <strings.h> … … 446 544 # endif 447 545 # ifdef VXWORKS 448 # include <sys/times.h> 546 # ifdef _WRS_KERNEL 547 # include <sys/times.h> 548 # endif 449 549 # else 450 550 # include <sys/time.h> … … 461 561 #endif 462 562 463 #ifdef WITH_FASTCGI 464 # include <fcgi_stdio.h> 465 #endif 466 467 #ifdef WITH_OPENSSL 468 # define OPENSSL_NO_KRB5 469 # include <openssl/ssl.h> 470 # include <openssl/err.h> 471 # include <openssl/rand.h> 472 # ifndef ALLOW_OLD_VERSIONS 473 # if (OPENSSL_VERSION_NUMBER < 0x00905100L) 474 # error "Must use OpenSSL 0.9.6 or later" 475 # endif 476 # endif 477 #endif 478 479 #ifdef WITH_GZIP 480 # ifndef WITH_ZLIB 481 # define WITH_ZLIB 482 # endif 483 #endif 484 485 #ifdef WITH_CASEINSENSITIVETAGS 486 # define SOAP_STRCMP soap_tag_cmp /* case insensitve XML element/attribute names */ 563 #ifdef WIN32 564 # define SOAP_WINSOCKINT int 487 565 #else 488 # define SOAP_STRCMP strcmp /* case sensitive XML element/attribute names */ 489 #endif 490 491 #ifdef WITH_ZLIB 492 # include <zlib.h> 493 #endif 494 495 #ifndef PALM 496 # include <math.h> /* for isnan() */ 497 #endif 498 499 /* #define DEBUG */ /* Uncomment to debug sending (in file SENT.log) receiving (in file RECV.log) and messages (in file TEST.log) */ 500 501 #ifdef __cplusplus 502 extern "C" { 503 #endif 504 505 #define soap_get0(soap) (((soap)->bufidx>=(soap)->buflen && soap_recv(soap)) ? EOF : (unsigned char)(soap)->buf[(soap)->bufidx]) 506 #define soap_get1(soap) (((soap)->bufidx>=(soap)->buflen && soap_recv(soap)) ? EOF : (unsigned char)(soap)->buf[(soap)->bufidx++]) 507 #define soap_revget1(soap) ((soap)->bufidx--) 508 #define soap_unget(soap, c) ((soap)->ahead = c) 509 #define soap_register_plugin(soap, plugin) soap_register_plugin_arg(soap, plugin, NULL) 510 #define soap_imode(soap, n) ((soap)->mode = (soap)->imode = (n)) 511 #define soap_set_imode(soap, n) ((soap)->mode = (soap)->imode |= (n)) 512 #define soap_clr_imode(soap, n) ((soap)->mode = (soap)->imode &= ~(n)) 513 #define soap_omode(soap, n) ((soap)->mode = (soap)->omode = (n)) 514 #define soap_set_omode(soap, n) ((soap)->mode = (soap)->omode |= (n)) 515 #define soap_clr_omode(soap, n) ((soap)->mode = (soap)->omode &= ~(n)) 516 #define soap_destroy(soap) soap_delete((soap), NULL) 566 # define SOAP_WINSOCKINT size_t 567 #endif 517 568 518 569 #ifdef WIN32 … … 521 572 # include <fcntl.h> 522 573 # endif 523 # include <winsock.h>524 /* # include <winsock2.h> */ /* Alternative: use winsock2 (not available with eVC) */525 /* WR[ */526 574 # ifdef WITH_IPV6 575 # include <winsock2.h> /* Visual Studio 2005 users: you must install the Platform SDK (R2) */ 527 576 # include <ws2tcpip.h> 528 577 # include <wspiapi.h> 578 # define SOAP_GAI_STRERROR gai_strerrorA 579 # else 580 # include <winsock.h> /* Visual Studio 2005 users: you must install the Platform SDK (R2) */ 581 /* # include <winsock2.h> */ /* Alternative: use winsock2 (not available with eVC) */ 529 582 # endif 530 583 #else … … 534 587 # include <ioLib.h> 535 588 # endif 536 /* ]WR */ 537 # ifndef MAC_CARBON 589 # ifndef WITH_NOIO 538 590 # ifndef PALM 539 591 # include <netdb.h> … … 541 593 # include <unistd.h> 542 594 # include <fcntl.h> 595 # ifdef _AIX41 596 # include <sys/select.h> 597 # endif 543 598 # endif 544 599 # endif 545 600 #endif 546 601 547 #ifdef WIN32 548 # define SOAP_SOCKET SOCKET 602 #ifdef WITH_FASTCGI 603 # include <fcgi_stdio.h> 604 #endif 605 606 #ifdef WITH_OPENSSL 607 # define OPENSSL_NO_KRB5 608 # include <openssl/bio.h> 609 # include <openssl/err.h> 610 # include <openssl/rand.h> 611 # include <openssl/ssl.h> 612 # include <openssl/x509v3.h> 613 # ifndef ALLOW_OLD_VERSIONS 614 # if (OPENSSL_VERSION_NUMBER < 0x00905100L) 615 # error "Must use OpenSSL 0.9.6 or later" 616 # endif 617 # endif 618 #endif 619 620 #ifdef WITH_GZIP 621 # ifndef WITH_ZLIB 622 # define WITH_ZLIB 623 # endif 624 #endif 625 626 #ifdef WITH_CASEINSENSITIVETAGS 627 # define SOAP_STRCMP soap_tag_cmp /* case insensitve XML element/attribute names */ 549 628 #else 550 # define SOAP_SOCKET int 551 # define closesocket(n) close(n) 552 #endif 553 554 #define soap_valid_socket(n) ((n) >= 0) 555 #define SOAP_INVALID_SOCKET (-1) 629 # define SOAP_STRCMP strcmp /* case sensitive XML element/attribute names */ 630 #endif 631 632 #ifdef WITH_ZLIB 633 # include <zlib.h> 634 #endif 635 636 #ifndef WITH_NOSTDLIB 637 # ifndef PALM 638 # include <math.h> /* for isnan() */ 639 # endif 640 #endif 641 642 /* #define DEBUG */ /* Uncomment to debug sending (in file SENT.log) receiving (in file RECV.log) and messages (in file TEST.log) */ 643 644 #ifdef __cplusplus 645 extern "C" { 646 #endif 647 648 /* Portability: define SOAP_SOCKLEN_T */ 649 #if defined(_AIX) 650 # if defined(_AIX43) 651 # define SOAP_SOCKLEN_T socklen_t 652 # else 653 # define SOAP_SOCKLEN_T int 654 # endif 655 #elif defined(SOCKLEN_T) 656 # define SOAP_SOCKLEN_T SOCKLEN_T 657 #elif defined(__socklen_t_defined) || defined(_SOCKLEN_T) || defined(CYGWIN) || defined(FREEBSD) || defined(__FreeBSD__) || defined(__QNX__) || defined(QNX) 658 # define SOAP_SOCKLEN_T socklen_t 659 #elif defined(IRIX) || defined(WIN32) || defined(__APPLE__) || defined(HP_UX) || defined(SUN_OS) || defined(OPENSERVER) || defined(TRU64) || defined(VXWORKS) 660 # define SOAP_SOCKLEN_T int 661 #else 662 # define SOAP_SOCKLEN_T size_t 663 #endif 664 665 #ifndef SOAP_SOCKET 666 # ifdef WIN32 667 # define SOAP_SOCKET SOCKET 668 # define soap_closesocket(n) closesocket(n) 669 # else 670 # define SOAP_SOCKET int 671 # define soap_closesocket(n) close(n) 672 # endif 673 #endif 674 675 #define SOAP_INVALID_SOCKET ((SOAP_SOCKET)-1) 676 #define soap_valid_socket(n) ((n) != SOAP_INVALID_SOCKET) 677 678 #ifndef SOAP_GAI_STRERROR 679 # define SOAP_GAI_STRERROR gai_strerror 680 #endif 681 682 #ifndef FD_SETSIZE 683 # define FD_SETSIZE (1024) 684 #endif 556 685 557 686 #if defined(SYMBIAN) 558 687 # define LONG64 long 559 688 # define ULONG64 unsigned LONG64 560 #elif !defined(WIN32) 561 # define LONG64 long long 562 # define ULONG64 unsigned LONG64 689 #elif !defined(WIN32) || defined(CYGWIN) || defined(__GLIBC__) || defined(__GNU__) 690 # ifndef LONG64 691 # if defined(HAVE_STDINT_H) 692 # include <stdint.h> 693 # define LONG64 int64_t 694 # define ULONG64 uint64_t 695 # elif defined(__GLIBC__) 696 # include <bits/wordsize.h> 697 # if (__WORDSIZE == 64) 698 # define LONG64 int64_t 699 # define ULONG64 uint64_t 700 # ifndef SOAP_LONG_FORMAT 701 # define SOAP_LONG_FORMAT "%ld" 702 # endif 703 # ifndef SOAP_ULONG_FORMAT 704 # define SOAP_ULONG_FORMAT "%lu" 705 # endif 706 # else 707 # define LONG64 long long 708 # define ULONG64 unsigned LONG64 709 # endif 710 # else 711 # define LONG64 long long 712 # define ULONG64 unsigned LONG64 713 # endif 714 # endif 563 715 #elif defined(UNDER_CE) 564 716 # define LONG64 __int64 … … 569 721 #endif 570 722 571 #if defined(WIN32) 723 #ifndef SOAP_LONG_FORMAT 724 # define SOAP_LONG_FORMAT "%lld" /* printf format for 64 bit ints */ 725 #endif 726 727 #ifndef SOAP_ULONG_FORMAT 728 # define SOAP_ULONG_FORMAT "%llu" /* printf format for unsigned 64 bit ints */ 729 #endif 730 731 #if defined(WIN32) && !defined(CYGWIN) 572 732 # define soap_int32 __int32 573 733 #elif defined(SYMBIAN) … … 575 735 #elif defined(PALM) 576 736 # define soap_int32 Int32 737 #elif defined(_AIX) 738 # if defined(_AIX43) 739 # define soap_int32 int32_t 740 # else 741 # define soap_int32 signed int 742 # endif 577 743 #else 578 744 # define soap_int32 int32_t 579 745 #endif 580 746 581 /* UCS-4 requires 32 bits (0-7FFFFFFF, the sign bit is used by gSOAP to distinguish XML entities) */582 typedef soap_int32 soap_wchar;583 584 747 #ifdef WIN32 748 # define SOAP_ERANGE ERANGE 585 749 # define SOAP_EINTR WSAEINTR 586 750 # define SOAP_EAGAIN WSAEWOULDBLOCK 587 751 # define SOAP_EWOULDBLOCK WSAEWOULDBLOCK 588 752 # define SOAP_EINPROGRESS WSAEINPROGRESS 753 # define SOAP_EADDRINUSE WSAEADDRINUSE 589 754 #else 755 # define SOAP_ERANGE ERANGE 590 756 # define SOAP_EINTR EINTR 591 757 # define SOAP_EAGAIN EAGAIN 758 # define SOAP_EADDRINUSE EADDRINUSE 592 759 # ifdef SYMBIAN 593 760 # define SOAP_EWOULDBLOCK 9898 … … 602 769 # ifdef UNDER_CE 603 770 # define soap_errno GetLastError() 604 # define soap_socket_errno GetLastError() 771 # define soap_socket_errno(s) GetLastError() 772 # define soap_reset_errno SetLastError(0) 605 773 # else 606 774 # define soap_errno GetLastError() 607 # define soap_socket_errno WSAGetLastError() 775 # define soap_socket_errno(s) WSAGetLastError() 776 # define soap_reset_errno SetLastError(0) 608 777 # endif 609 778 #else 610 # define soap_errno errno 611 # define soap_socket_errno errno 779 # ifndef WITH_NOIO 780 # define soap_errno errno 781 # define soap_socket_errno(s) errno 782 # define soap_reset_errno (errno = 0) 783 # else 784 # define soap_errno 0 785 # define soap_socket_errno(s) 0 786 # define soap_reset_errno 787 # endif 612 788 #endif 613 789 614 790 #ifndef SOAP_BUFLEN 615 791 # ifndef WITH_LEAN 616 # define SOAP_BUFLEN (32768) /* buffer length for socket packets, also used by gethostbyname_rso don't make this too small */792 # define SOAP_BUFLEN (65536) /* buffer length for socket packets, also used by gethostbyname_r and UDP messages, so don't make this too small */ 617 793 # else 618 # define SOAP_BUFLEN (2048)794 # define SOAP_BUFLEN (2048) 619 795 # endif 620 796 #endif 621 797 #ifndef SOAP_LABLEN 622 # ifndef WITH_LEAN 623 # define SOAP_LABLEN (256) /* initial look-aside buffer length */ 624 # else 625 # define SOAP_LABLEN (64) 626 # endif 798 # define SOAP_LABLEN (256) /* initial look-aside buffer length */ 799 #endif 800 #ifndef SOAP_PTRBLK 801 # define SOAP_PTRBLK (32) /* block allocation for pointer hash table chains */ 627 802 #endif 628 803 #ifndef SOAP_PTRHASH 629 804 # ifndef WITH_LEAN 630 # define SOAP_PTRHASH (1024) /* size of pointer analysis hash table (must be power of 2) */805 # define SOAP_PTRHASH (1024) /* size of pointer analysis hash table (must be power of 2) */ 631 806 # else 632 # define SOAP_PTRHASH (16)807 # define SOAP_PTRHASH (32) 633 808 # endif 634 809 #endif 635 810 #ifndef SOAP_IDHASH 636 811 # ifndef WITH_LEAN 637 # define SOAP_IDHASH (1999) /* prime size of hash table for parsed id/ref */812 # define SOAP_IDHASH (1999) /* prime size of hash table for parsed id/ref */ 638 813 # else 639 # define SOAP_IDHASH (19 9)814 # define SOAP_IDHASH (19) /* 19, 199 */ 640 815 # endif 641 816 #endif 642 817 #ifndef SOAP_BLKLEN 643 # define SOAP_BLKLEN (256) /* size of blocks to collect long strings and XML attributes */ 818 # ifndef WITH_LEAN 819 # define SOAP_BLKLEN (256) /* size of blocks to collect long strings and XML attributes */ 820 # else 821 # define SOAP_BLKLEN (32) 822 # endif 644 823 #endif 645 824 #ifndef SOAP_TAGLEN 646 # define SOAP_TAGLEN (256) /* maximum length of XML element tag/attribute name + 1 */ 825 # ifndef WITH_LEAN 826 # define SOAP_TAGLEN (1024) /* maximum length of XML element tag/attribute name or host/path name + 1 */ 827 # else 828 # define SOAP_TAGLEN (64) 829 # endif 647 830 #endif 648 831 #ifndef SOAP_HDRLEN 649 832 # ifndef WITH_LEAN 650 # define SOAP_HDRLEN (8192) /* maximum length of HTTP header line (must be >4096 to read cookies) */833 # define SOAP_HDRLEN (8192) /* maximum length of HTTP header line (must be >4096 to read cookies) */ 651 834 # else 652 # define SOAP_HDRLEN (1024)835 # define SOAP_HDRLEN (1024) 653 836 # endif 654 837 #endif 655 838 #ifndef SOAP_MAXDIMS 656 # define SOAP_MAXDIMS (16) /* maximum array dimensions (array nestings) must be less than 64 to protect soap->tmpbuf */ 839 # ifndef WITH_LEAN 840 # define SOAP_MAXDIMS (16) /* maximum array dimensions (array nestings) must be less than 64 to protect soap->tmpbuf */ 841 # else 842 # define SOAP_MAXDIMS (4) 843 # endif 657 844 #endif 658 845 … … 669 856 670 857 #ifndef SOAP_MAXARRAYSIZE 671 # define SOAP_MAXARRAYSIZE (100000 ) /* "trusted" max size of inbound SOAP array for compound array allocation */858 # define SOAP_MAXARRAYSIZE (1000000) /* "trusted" max size of inbound SOAP array for compound array allocation */ 672 859 #endif 673 860 … … 691 878 692 879 #ifdef SUN_OS 693 # define soap_isnan(n) isnan(n) 880 # define HAVE_ISNAN 881 #endif 882 883 #ifdef __APPLE__ 884 # ifdef __cplusplus 885 # ifndef isnan 886 extern "C" int isnan(double); 887 # endif 888 # endif 889 # define HAVE_ISNAN 694 890 #endif 695 891 696 892 #if !defined(HAVE_ISNAN) && (defined(_MATH_H) || defined(_MATH_INCLUDED)) 697 893 # define HAVE_ISNAN 894 #endif 895 896 extern const struct soap_double_nan { unsigned int n1, n2; } soap_double_nan; 897 898 #ifdef VXWORKS 899 # ifndef FLT_MAX 900 # define FLT_MAX _ARCH_FLT_MAX 901 # endif 902 # ifndef DBL_MAX 903 # define DBL_MAX _ARCH_DBL_MAX 904 # endif 905 #endif 906 907 #ifndef FLT_NAN 908 # define FLT_NAN (*(float*)(void*)&soap_double_nan) 909 #endif 910 911 #ifndef FLT_PINFTY 912 # if defined(FLT_MAX) 913 # define FLT_PINFTY FLT_MAX 914 # elif defined(HUGE_VALF) 915 # define FLT_PINFTY (float)HUGE_VALF 916 # elif defined(HUGE_VAL) 917 # define FLT_PINFTY (float)HUGE_VAL 918 # elif defined(FLOAT_MAX) 919 # define FLT_PINFTY FLOAT_MAX 920 # else 921 # define FLT_PINFTY (3.40282347e+38F) 922 # endif 923 #endif 924 925 #ifndef FLT_NINFTY 926 # define FLT_NINFTY (-FLT_PINFTY) 927 #endif 928 929 #ifndef DBL_NAN 930 # define DBL_NAN (*(double*)(void*)&soap_double_nan) 931 #endif 932 933 #ifndef DBL_PINFTY 934 # if defined(DBL_MAX) 935 # define DBL_PINFTY DBL_MAX 936 # elif defined(HUGE_VALF) 937 # define DBL_PINFTY (double)HUGE_VALF 938 # elif defined(HUGE_VAL) 939 # define DBL_PINFTY (double)HUGE_VAL 940 # elif defined(DOUBLE_MAX) 941 # define DBL_PINFTY DOUBLE_MAX 942 # else 943 # define DBL_PINFTY (1.7976931348623157e+308) 944 # endif 945 #endif 946 947 #ifndef DBL_NINFTY 948 # define DBL_NINFTY (-DBL_PINFTY) 698 949 #endif 699 950 … … 702 953 # define soap_isnan(n) isnan(n) 703 954 # else 704 # define soap_isnan(_) (0) 705 # endif 706 #endif 707 708 extern const struct soap_double_nan { unsigned int n1, n2; } soap_double_nan; 709 710 #ifdef VXWORKS 711 # ifndef FLT_MAX 712 # define FLT_MAX _ARCH_FLT_MAX 713 # endif 714 # ifndef DBL_MAX 715 # define DBL_MAX _ARCH_DBL_MAX 716 # endif 717 #endif 718 719 #ifndef FLT_NAN 720 # ifdef HAVE_ISNAN 721 # define FLT_NAN (*(float*)&soap_double_nan) 722 # else 723 # define FLT_NAN (0.0) 724 # endif 725 #endif 726 727 #ifndef FLT_PINFTY 728 # ifdef FLT_MAX 729 # define FLT_PINFTY FLT_MAX 730 # else 731 # ifdef HUGE_VAL 732 # define FLT_PINFTY (float)HUGE_VAL 733 # else 734 # ifdef FLOAT_MAX 735 # define FLT_PINFTY FLOAT_MAX 736 # else 737 # define FLT_PINFTY (3.40282347e+38) 738 # endif 739 # endif 740 # endif 741 #endif 742 743 #ifndef FLT_NINFTY 744 # define FLT_NINFTY (-FLT_PINFTY) 745 #endif 746 747 #ifndef DBL_NAN 748 # ifdef HAVE_ISNAN 749 # define DBL_NAN (*(double*)&soap_double_nan) 750 # else 751 # define DBL_NAN (0.0) 752 # endif 753 #endif 754 755 #ifndef DBL_PINFTY 756 # ifdef DBL_MAX 757 # define DBL_PINFTY DBL_MAX 758 # else 759 # ifdef HUGE_VAL 760 # define DBL_PINFTY (double)HUGE_VAL 761 # else 762 # ifdef DOUBLE_MAX 763 # define DBL_PINFTY DOUBLE_MAX 764 # else 765 # define DBL_PINFTY (1.7976931348623157e+308) 766 # endif 767 # endif 768 # endif 769 #endif 770 771 #ifndef DBL_NINFTY 772 # define DBL_NINFTY (-DBL_PINFTY) 955 # define soap_isnan(n) (0) 956 # endif 773 957 #endif 774 958 … … 792 976 #define SOAP_MUSTUNDERSTAND 8 793 977 #define SOAP_NAMESPACE 9 794 /* #define SOAP_OBJ_MISMATCH 10 obsolete */ 795 #define SOAP_TAG_END 10 978 #define SOAP_USER_ERROR 10 796 979 #define SOAP_FATAL_ERROR 11 797 980 #define SOAP_FAULT 12 798 981 #define SOAP_NO_METHOD 13 799 #define SOAP_GET_METHOD 14 800 #define SOAP_EOM 15 801 #define SOAP_NULL 16 802 #define SOAP_MULTI_ID 17 803 #define SOAP_MISSING_ID 18 804 #define SOAP_HREF 19 805 #define SOAP_TCP_ERROR 20 806 #define SOAP_HTTP_ERROR 21 807 #define SOAP_SSL_ERROR 22 808 #define SOAP_ZLIB_ERROR 23 809 #define SOAP_DIME_ERROR 24 810 #define SOAP_DIME_HREF 25 811 #define SOAP_DIME_MISMATCH 26 812 #define SOAP_DIME_END 27 813 #define SOAP_MIME_ERROR 28 814 #define SOAP_VERSIONMISMATCH 29 815 #define SOAP_PLUGIN_ERROR 30 816 #define SOAP_DATAENCODINGUNKNOWN 31 817 #define SOAP_REQUIRED 32 818 #define SOAP_PROHIBITED 33 819 #define SOAP_OCCURS 34 820 #define SOAP_LENGTH 35 821 822 #define soap_xml_error_check(e) ((e) == SOAP_TAG_MISMATCH || (e) == SOAP_TAG_END || (e) == SOAP_SYNTAX_ERROR || (e) == SOAP_NAMESPACE || (e) == SOAP_MULTI_ID || (e) == SOAP_MISSING_ID || (e) == SOAP_REQUIRED || (e) == SOAP_PROHIBITED || (e) == SOAP_OCCURS || (e) == SOAP_LENGTH || (e) == SOAP_NULL || (e) == SOAP_HREF) 982 #define SOAP_NO_DATA 14 983 #define SOAP_GET_METHOD 15 984 #define SOAP_PUT_METHOD 16 985 #define SOAP_DEL_METHOD 17 986 #define SOAP_HEAD_METHOD 18 987 #define SOAP_HTTP_METHOD 19 988 #define SOAP_EOM 20 989 #define SOAP_MOE 21 990 #define SOAP_HDR 22 991 #define SOAP_NULL 23 992 #define SOAP_DUPLICATE_ID 24 993 #define SOAP_MISSING_ID 25 994 #define SOAP_HREF 26 995 #define SOAP_UDP_ERROR 27 996 #define SOAP_TCP_ERROR 28 997 #define SOAP_HTTP_ERROR 29 998 #define SOAP_SSL_ERROR 30 999 #define SOAP_ZLIB_ERROR 31 1000 #define SOAP_DIME_ERROR 32 1001 #define SOAP_DIME_HREF 33 1002 #define SOAP_DIME_MISMATCH 34 1003 #define SOAP_DIME_END 35 1004 #define SOAP_MIME_ERROR 36 1005 #define SOAP_MIME_HREF 37 1006 #define SOAP_MIME_END 38 1007 #define SOAP_VERSIONMISMATCH 39 1008 #define SOAP_PLUGIN_ERROR 40 1009 #define SOAP_DATAENCODINGUNKNOWN 41 1010 #define SOAP_REQUIRED 42 1011 #define SOAP_PROHIBITED 43 1012 #define SOAP_OCCURS 44 1013 #define SOAP_LENGTH 45 1014 #define SOAP_FD_EXCEEDED 46 1015 1016 #define soap_xml_error_check(e) ((e) == SOAP_TAG_MISMATCH || (e) == SOAP_NO_TAG || (e) == SOAP_SYNTAX_ERROR || (e) == SOAP_NAMESPACE || (e) == SOAP_DUPLICATE_ID || (e) == SOAP_MISSING_ID || (e) == SOAP_REQUIRED || (e) == SOAP_PROHIBITED || (e) == SOAP_OCCURS || (e) == SOAP_LENGTH || (e) == SOAP_NULL || (e) == SOAP_HREF) 823 1017 #define soap_soap_error_check(e) ((e) == SOAP_CLI_FAULT || (e) == SOAP_SVR_FAULT || (e) == SOAP_VERSIONMISMATCH || (e) == SOAP_MUSTUNDERSTAND || (e) == SOAP_FAULT || (e) == SOAP_NO_METHOD) 824 1018 #define soap_tcp_error_check(e) ((e) == SOAP_EOF || (e) == SOAP_TCP_ERROR) 825 1019 #define soap_ssl_error_check(e) ((e) == SOAP_SSL_ERROR) 826 1020 #define soap_zlib_error_check(e) ((e) == SOAP_ZLIB_ERROR) 827 #define soap_ mime_error_check(e) ((e) == SOAP_MIME_ERROR)828 #define soap_dime_error_check(e) ((e) == SOAP_DIME_ERROR || (e) == SOAP_DIME_MISMATCH) 829 #define soap_http_error_check(e) ((e) == SOAP_HTTP_ERROR || (e) == SOAP_GET_METHOD || ((e) >= 100 && (e) < 600)) 830 831 /* gSOAP HTTP response status codes 100 to 600 are reserved*/832 833 /* Special gSOAP HTTP response status codes*/1021 #define soap_http_error_check(e) ((e) == SOAP_HTTP_ERROR || ((e) >= SOAP_GET_METHOD && (e) <= SOAP_HTTP_METHOD)|| (e) == SOAP_NO_DATA || ((e) >= 100 && (e) < 600)) 1022 1023 /* gSOAP HTTP response status codes 100 to 599 are reserved */ 1024 1025 /* Codes 600 to 999 are user definable */ 1026 1027 /* Exceptional gSOAP HTTP response status codes >= 1000 */ 834 1028 835 1029 #define SOAP_STOP 1000 /* No HTTP response */ 836 #define SOAP_HTML 1001 /* Custom HTML response */ 837 #define SOAP_FILE 1002 /* Custom file-based response */ 838 839 /* gSOAP HTTP request status codes */ 840 841 #define SOAP_POST 1003 842 #define SOAP_GET 1104 1030 #define SOAP_FORM 1001 /* Form request/response */ 1031 #define SOAP_HTML 1002 /* Custom HTML response */ 1032 #define SOAP_FILE 1003 /* Custom file-based response */ 1033 1034 /* gSOAP HTTP method codes */ 1035 1036 #define SOAP_POST 2000 1037 #define SOAP_GET 2001 843 1038 844 1039 /* gSOAP DIME */ … … 868 1063 #define SOAP_IO_CHUNK 0x00000003 /* use HTTP chunked transfer AND buffer packets */ 869 1064 870 #define SOAP_IO_LENGTH 0x00000004 871 #define SOAP_IO_KEEPALIVE 0x00000008 872 873 #define SOAP_ENC_LATIN 0x00800010 /* iso-8859-1 encoding */ 874 #define SOAP_ENC_XML 0x00000020 /* plain XML encoding, no HTTP header */ 875 #define SOAP_ENC_DIME 0x00000040 876 #define SOAP_ENC_MIME 0x00000080 877 #define SOAP_ENC_ZLIB 0x00000100 878 #define SOAP_ENC_SSL 0x00000200 879 880 #define SOAP_XML_STRICT 0x00001000 /* strict validation */ 881 #define SOAP_XML_CANONICAL 0x00002000 /* C14N canonical XML */ 882 #define SOAP_XML_TREE 0x00004000 883 #define SOAP_XML_GRAPH 0x00008000 884 #define SOAP_XML_NIL 0x00010000 885 #define SOAP_XML_DOM 0x00020000 886 #define SOAP_XML_SEC 0x00040000 /* reserved for WS security */ 887 888 #define SOAP_C_NOIOB 0x00100000 889 #define SOAP_C_UTFSTRING 0x00200000 890 #define SOAP_C_MBSTRING 0x00400000 1065 #define SOAP_IO_UDP 0x00000004 /* TCP or UDP */ 1066 1067 #define SOAP_IO_LENGTH 0x00000008 /* calc message length (internal) */ 1068 #define SOAP_IO_KEEPALIVE 0x00000010 /* keep connection alive */ 1069 1070 #define SOAP_ENC_LATIN 0x00000020 /* accept iso-8859-1 encoding */ 1071 #define SOAP_ENC_XML 0x00000040 /* plain XML encoding, no HTTP header */ 1072 #define SOAP_ENC_DIME 0x00000080 1073 #define SOAP_ENC_MIME 0x00000100 1074 #define SOAP_ENC_MTOM 0x00000200 1075 #define SOAP_ENC_ZLIB 0x00000400 1076 #define SOAP_ENC_SSL 0x00000800 1077 1078 #define SOAP_ENC 0x00000FFF /* IO and ENC mask */ 1079 1080 #define SOAP_XML_STRICT 0x00001000 /* apply strict validation */ 1081 #define SOAP_XML_INDENT 0x00002000 /* emit indented XML */ 1082 #define SOAP_XML_CANONICAL 0x00004000 /* EXC C14N canonical XML */ 1083 #define SOAP_XML_TREE 0x00008000 /* emit XML tree (no id/ref) */ 1084 #define SOAP_XML_GRAPH 0x00010000 1085 #define SOAP_XML_NIL 0x00020000 1086 #define SOAP_XML_DOM 0x00040000 1087 #define SOAP_XML_SEC 0x00080000 /* reserved for WS security */ 1088 1089 #define SOAP_C_NOIOB 0x00100000 /* don't fault on array index out of bounds (just ignore) */ 1090 #define SOAP_C_UTFSTRING 0x00200000 /* (de)serialize strings with UTF8 content */ 1091 #define SOAP_C_MBSTRING 0x00400000 /* (de)serialize strings with multi-byte content */ 1092 #define SOAP_C_NILSTRING 0x00800000 /* serialize empty strings as nil (omitted) */ 891 1093 892 1094 #define SOAP_DOM_TREE 0x01000000 893 1095 #define SOAP_DOM_NODE 0x02000000 1096 #define SOAP_DOM_ASIS 0x04000000 1097 1098 #define SOAP_MIME_POSTCHECK 0x10000000 /* MIME flag (internal) */ 894 1099 895 1100 #define SOAP_IO_DEFAULT SOAP_IO_FLUSH … … 900 1105 #define SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION 0x01 /* client requires server to authenticate */ 901 1106 #define SOAP_SSL_REQUIRE_CLIENT_AUTHENTICATION 0x02 /* server requires client to authenticate */ 902 903 #define SOAP_SSL_DEFAULT SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION 904 905 /* */ 1107 #define SOAP_SSL_SKIP_HOST_CHECK 0x04 /* client does not check the common name of the host in certificate */ 1108 #define SOAP_SSL_ALLOW_EXPIRED_CERTIFICATE 0x08 /* client does not check the expiration date of the host certificate */ 1109 #define SOAP_SSL_RSA 0x10 /* use RSA */ 1110 #define SOAP_SSLv3 0x20 /* SSL v3 only */ 1111 #define SOAP_TLSv1 0x40 /* TLS v1 only */ 1112 #define SOAP_SSLv3_TLSv1 0x00 /* SSL v3 and TLS v1 support by default */ 1113 1114 #define SOAP_SSL_DEFAULT (SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION | SOAP_SSLv3_TLSv1) 1115 1116 /* state */ 1117 1118 #define SOAP_NONE 0 1119 #define SOAP_INIT 1 1120 #define SOAP_COPY 2 1121 1122 #define soap_check_state(soap) (!(soap) || ((soap)->state != SOAP_INIT && (soap)->state != SOAP_COPY)) 1123 1124 /* part */ 906 1125 907 1126 #define SOAP_BEGIN 0 … … 909 1128 #define SOAP_IN_HEADER 3 910 1129 #define SOAP_END_HEADER 4 911 #define SOAP_IN_BODY 5 912 #define SOAP_END_BODY 6 913 #define SOAP_END_ENVELOPE 7 914 #define SOAP_END 8 1130 #define SOAP_NO_BODY 5 1131 #define SOAP_IN_BODY 6 1132 #define SOAP_END_BODY 7 1133 #define SOAP_END_ENVELOPE 8 1134 #define SOAP_END 9 1135 #define SOAP_BEGIN_SECURITY 10 1136 #define SOAP_IN_SECURITY 11 1137 #define SOAP_END_SECURITY 12 915 1138 916 1139 /* DEBUG macros */ … … 921 1144 # define SOAP_DEBUG 922 1145 # endif 923 # endif 1146 # ifndef SOAP_MEM_DEBUG 1147 # define SOAP_MEM_DEBUG 1148 # endif 1149 # endif 1150 #endif 1151 1152 #ifdef SOAP_MEM_DEBUG 1153 # ifndef SOAP_MALLOC 1154 # define SOAP_MALLOC(soap, size) soap_track_malloc(soap, __FILE__, __LINE__, size) 1155 # endif 1156 # ifndef SOAP_FREE 1157 # define SOAP_FREE(soap, ptr) soap_track_free(soap, __FILE__, __LINE__, ptr) 1158 # endif 1159 #endif 1160 1161 #ifndef SOAP_MALLOC /* use libc malloc */ 1162 # define SOAP_MALLOC(soap, size) malloc(size) 1163 #endif 1164 1165 #ifndef SOAP_FREE /* use libc free */ 1166 # define SOAP_FREE(soap, ptr) free(ptr) 924 1167 #endif 925 1168 … … 932 1175 { if (soap)\ 933 1176 { if (!soap->fdebug[SOAP_INDEX_##DBGFILE])\ 934 soap_open_logfile( soap, SOAP_INDEX_##DBGFILE);\1177 soap_open_logfile((struct soap*)soap, SOAP_INDEX_##DBGFILE);\ 935 1178 if (soap->fdebug[SOAP_INDEX_##DBGFILE])\ 936 1179 { FILE *fdebug = soap->fdebug[SOAP_INDEX_##DBGFILE];\ … … 945 1188 { if (soap)\ 946 1189 { if (!soap->fdebug[SOAP_INDEX_##DBGFILE])\ 947 soap_open_logfile( soap, SOAP_INDEX_##DBGFILE);\1190 soap_open_logfile((struct soap*)soap, SOAP_INDEX_##DBGFILE);\ 948 1191 if (soap->fdebug[SOAP_INDEX_##DBGFILE])\ 949 1192 { fwrite((MSG), 1, (LEN), soap->fdebug[SOAP_INDEX_##DBGFILE]);\ … … 953 1196 } 954 1197 # endif 1198 # ifndef DBGFUN 1199 # define DBGFUN(FNAME) DBGLOG(TEST, SOAP_MESSAGE(fdebug, "%s(%d): %s()\n", __FILE__, __LINE__, FNAME)) 1200 # define DBGFUN1(FNAME, FMT, ARG) DBGLOG(TEST, SOAP_MESSAGE(fdebug, "%s(%d): %s("FMT")\n", __FILE__, __LINE__, FNAME, (ARG))) 1201 # define DBGFUN2(FNAME, FMT1, ARG1, FMT2, ARG2) DBGLOG(TEST, SOAP_MESSAGE(fdebug, "%s(%d): %s("FMT1", "FMT2")\n", __FILE__, __LINE__, FNAME, (ARG1), (ARG2))) 1202 # define DBGFUN3(FNAME, FMT1, ARG1, FMT2, ARG2, FMT3, ARG3) DBGLOG(TEST, SOAP_MESSAGE(fdebug, "%s(%d): %s("FMT1", "FMT2", "FMT3")\n", __FILE__, __LINE__, FNAME, (ARG1), (ARG2), (ARG3))) 1203 # endif 1204 # ifndef DBGHEX 1205 # define DBGHEX(DBGFILE, MSG, LEN) \ 1206 { if (soap)\ 1207 { if (!soap->fdebug[SOAP_INDEX_##DBGFILE])\ 1208 soap_open_logfile(soap, SOAP_INDEX_##DBGFILE);\ 1209 if (soap->fdebug[SOAP_INDEX_##DBGFILE])\ 1210 { int i; char *s;\ 1211 for (s = (char*)(MSG), i = (LEN); i; i--)\ 1212 fprintf(soap->fdebug[SOAP_INDEX_##DBGFILE], "%2.2X ", (int)*s++&0xFF);\ 1213 fflush(soap->fdebug[SOAP_INDEX_##DBGFILE]);\ 1214 }\ 1215 }\ 1216 } 1217 # endif 955 1218 #else 956 1219 # define DBGLOG(DBGFILE, CMD) 957 1220 # define DBGMSG(DBGFILE, MSG, LEN) 958 #endif 959 1221 # define DBGFUN(FNAME) 1222 # define DBGFUN1(FNAME, FMT, ARG) 1223 # define DBGFUN2(FNAME, FMT1, ARG1, FMT2, ARG2) 1224 # define DBGFUN3(FNAME, FMT1, ARG1, FMT2, ARG2, FMT3, ARG3) 1225 # define DBGHEX(DBGFILE, MSG, LEN) 1226 #endif 1227 1228 /* UCS-4 requires 32 bits (0-7FFFFFFF, the sign bit is used by gSOAP to distinguish XML entities) */ 1229 typedef soap_int32 soap_wchar; 1230 1231 /* namespace table row */ 960 1232 struct Namespace 961 1233 { const char *id; … … 965 1237 }; 966 1238 1239 /* namespace stack */ 967 1240 struct soap_nlist 968 1241 { struct soap_nlist *next; 969 unsigned int level; 1242 unsigned int level; /* nesting depth level */ 970 1243 short index; /* corresponding entry in ns mapping table */ 971 1244 char *ns; /* only set when parsed ns URI is not in the ns mapping table */ … … 973 1246 }; 974 1247 1248 /* block stack for nested block allocations */ 975 1249 struct soap_blist 976 1250 { struct soap_blist *next; … … 979 1253 }; 980 1254 1255 /* array layout */ 981 1256 struct soap_array 982 1257 { void *__ptr; … … 995 1270 }; 996 1271 1272 /* block allocation for pointer serialization management */ 1273 struct soap_pblk 1274 { struct soap_pblk *next; 1275 struct soap_plist plist[SOAP_PTRBLK]; 1276 }; 1277 1278 #ifdef SOAP_MEM_DEBUG 1279 /* malloc/free tracking for debugging */ 1280 struct soap_mlist 1281 { struct soap_mlist *next; 1282 const void *ptr; 1283 const char *file; 1284 int line; 1285 short live; 1286 }; 1287 #endif 1288 997 1289 /* class allocation list */ 998 1290 struct soap_clist … … 1001 1293 int type; 1002 1294 int size; 1003 void (*fdelete)(struct soap_clist*); 1004 }; 1005 1295 int (*fdelete)(struct soap_clist*); 1296 }; 1297 1298 /* attributes */ 1006 1299 struct soap_attribute 1007 1300 { struct soap_attribute *next; … … 1013 1306 }; 1014 1307 1308 #ifndef WITH_LEAN 1015 1309 struct soap_cookie 1016 1310 { struct soap_cookie *next; … … 1019 1313 char *domain; 1020 1314 char *path; 1021 long expire; /* client-side: local time to expire; server-side: seconds to expire */ 1315 time_t expire; /* client-side: local time to expire */ 1316 long maxage; /* server-side: seconds to expire */ 1022 1317 unsigned int version; 1023 1318 short secure; 1024 1319 short session; /* server-side */ 1025 short env; /* server-side: got cookie from client */ 1026 short modified; /* server-side: client cookie was modified */ 1027 }; 1320 short env; /* server-side: got cookie from client and should not be (re)send */ 1321 short modified; /* server-side: client cookie was modified and should be send */ 1322 }; 1323 #endif 1028 1324 1029 1325 #ifdef __cplusplus 1030 1326 SOAP_FMAC1 struct soap_multipart* SOAP_FMAC2 soap_next_multipart(struct soap_multipart*); 1327 1031 1328 class soap_multipart_iterator 1032 1329 { public: … … 1047 1344 #endif 1048 1345 1346 #ifndef WITH_LEANER 1049 1347 struct soap_dime 1050 1348 { size_t count; … … 1066 1364 #endif 1067 1365 }; 1068 1366 #endif 1367 1368 #ifndef WITH_LEANER 1069 1369 struct soap_mime 1070 1370 { char *boundary; /* MIME boundary */ 1071 1371 const char *start; /* MIME start ID */ 1072 struct soap_multipart *list; /* list of DIME attachments received */1372 struct soap_multipart *list; /* list of MIME attachments received */ 1073 1373 struct soap_multipart *first, *last; /* temporary in/out queue */ 1074 1374 #ifdef __cplusplus … … 1079 1379 #endif 1080 1380 }; 1081 1381 #endif 1382 1383 #ifndef WITH_LEANER 1082 1384 /* RFC2045 MIME content transfer encodings */ 1083 1385 enum soap_mime_encoding … … 1091 1393 SOAP_MIME_X_TOKEN 1092 1394 }; 1093 1395 #endif 1396 1397 #ifndef WITH_LEANER 1094 1398 /* DIME/MIME multipart list */ 1095 1399 struct soap_multipart … … 1097 1401 char *ptr; /* points to raw data content */ 1098 1402 size_t size; /* size of data content */ 1099 const char *id; /* DIME/MIME content ID */1403 const char *id; /* DIME/MIME content ID or form data name */ 1100 1404 const char *type; /* DIME/MIME type (MIME type format) */ 1101 1405 const char *options; /* DIME options */ … … 1107 1411 #endif 1108 1412 }; 1109 1413 #endif 1414 1415 #ifndef WITH_LEANER 1416 /* attachment DIME and MTOM XOP forwarding */ 1417 struct soap_xlist 1418 { struct soap_xlist *next; 1419 unsigned char **ptr; 1420 int *size; 1421 char *id; 1422 char **type; 1423 char **options; 1424 }; 1425 #endif 1426 1427 /******************************************************************************/ 1428 1429 #ifndef WITH_LEANER 1430 #ifdef __cplusplus 1431 class soap_dom_attribute_iterator 1432 { public: 1433 struct soap_dom_attribute *att; 1434 const char *nstr; 1435 const char *name; 1436 bool operator==(const soap_dom_attribute_iterator&) const; 1437 bool operator!=(const soap_dom_attribute_iterator&) const; 1438 struct soap_dom_attribute &operator*() const; 1439 soap_dom_attribute_iterator &operator++(); 1440 soap_dom_attribute_iterator(); 1441 soap_dom_attribute_iterator(struct soap_dom_attribute*); 1442 ~soap_dom_attribute_iterator(); 1443 }; 1444 #endif 1445 #endif 1446 1447 #ifndef WITH_LEANER 1110 1448 struct soap_dom_attribute 1111 1449 { struct soap_dom_attribute *next; … … 1116 1454 struct soap *soap; 1117 1455 #ifdef __cplusplus 1118 struct soap_dom_attribute &set(const char *nstr, const char *name); // set namespace and name 1119 struct soap_dom_attribute &set(const char *data); // set data 1456 typedef soap_dom_attribute_iterator iterator; 1457 struct soap_dom_attribute &set(const char *nstr, const char *name); /* set namespace and name */ 1458 struct soap_dom_attribute &set(const char *data); /* set data */ 1459 soap_dom_attribute_iterator begin(); 1460 soap_dom_attribute_iterator end(); 1461 soap_dom_attribute_iterator find(const char *nstr, const char *name); 1120 1462 void unlink(); 1121 1463 soap_dom_attribute(); … … 1125 1467 #endif 1126 1468 }; 1127 1469 #endif 1470 1471 #ifndef WITH_LEANER 1128 1472 #ifdef __cplusplus 1129 class soap_dom_ iterator1473 class soap_dom_element_iterator 1130 1474 { public: 1131 1475 struct soap_dom_element *elt; … … 1133 1477 const char *name; 1134 1478 int type; 1135 bool operator==(const soap_dom_ iterator&) const;1136 bool operator!=(const soap_dom_ iterator&) const;1479 bool operator==(const soap_dom_element_iterator&) const; 1480 bool operator!=(const soap_dom_element_iterator&) const; 1137 1481 struct soap_dom_element &operator*() const; 1138 soap_dom_iterator &operator++(); 1139 soap_dom_iterator(); 1140 soap_dom_iterator(struct soap_dom_element*); 1141 ~soap_dom_iterator(); 1142 }; 1143 #endif 1144 1482 soap_dom_element_iterator &operator++(); 1483 soap_dom_element_iterator(); 1484 soap_dom_element_iterator(struct soap_dom_element*); 1485 ~soap_dom_element_iterator(); 1486 }; 1487 #endif 1488 #endif 1489 1490 #ifndef WITH_LEANER 1145 1491 struct soap_dom_element 1146 1492 { struct soap_dom_element *next; /* next sibling */ 1147 1493 struct soap_dom_element *prnt; /* parent */ 1148 struct soap_dom_element *elts; /* first child element*/1149 struct soap_dom_attribute *atts; /* first child attribute*/1494 struct soap_dom_element *elts; /* list of child elements */ 1495 struct soap_dom_attribute *atts; /* list of attributes */ 1150 1496 const char *nstr; /* namespace string */ 1151 1497 char *name; /* element tag name */ … … 1154 1500 int type; /* optional: serialized C/C++ data type */ 1155 1501 void *node; /* optional: pointer to serialized C/C++ data */ 1156 struct soap *soap; 1502 char *head; /* leading whitespace to start tag */ 1503 char *tail; /* leading whitespace to end tag */ 1504 struct soap *soap; /* soap context that manages this node */ 1157 1505 #ifdef __cplusplus 1158 typedef soap_dom_ iterator iterator;1506 typedef soap_dom_element_iterator iterator; 1159 1507 struct soap_dom_element &set(const char *nstr, const char *name); 1160 1508 struct soap_dom_element &set(const char *data); … … 1164 1512 struct soap_dom_element &add(struct soap_dom_attribute*); 1165 1513 struct soap_dom_element &add(struct soap_dom_attribute&); 1166 soap_dom_ iterator begin();1167 soap_dom_ iterator end();1168 soap_dom_ iterator find(const char *nstr, const char *name);1169 soap_dom_ iterator find(int type);1514 soap_dom_element_iterator begin(); 1515 soap_dom_element_iterator end(); 1516 soap_dom_element_iterator find(const char *nstr, const char *name); 1517 soap_dom_element_iterator find(int type); 1170 1518 void unlink(); 1171 1519 soap_dom_element(); … … 1177 1525 #endif 1178 1526 }; 1527 SOAP_FMAC1 struct soap_dom_element * SOAP_FMAC2 soap_dom_next_element(struct soap_dom_element *elt); 1528 SOAP_FMAC1 struct soap_dom_attribute * SOAP_FMAC2 soap_dom_next_attribute(struct soap_dom_attribute *att); 1529 #endif 1179 1530 1180 1531 #if defined(__cplusplus) && !defined(WITH_LEAN) 1181 1532 } 1182 extern ostream &operator<<(ostream&, const struct soap_dom_element&);1183 extern istream &operator>>(istream&, struct soap_dom_element&);1533 extern std::ostream &operator<<(std::ostream&, const struct soap_dom_element&); 1534 extern std::istream &operator>>(std::istream&, struct soap_dom_element&); 1184 1535 extern "C" { 1185 1536 #endif 1186 1537 1187 struct soap 1188 { short version; /* 1 = SOAP1.1 and 2 = SOAP1.2 (set automatically from namespace URI in nsmap table) */ 1189 short copy; /* 1 = copy of another soap struct */ 1538 /******************************************************************************/ 1539 1540 #ifdef WIN32 1541 # ifdef SOAP_STD_EXPORTS 1542 # define SOAP_STD_API __declspec(dllexport) 1543 # else 1544 # define SOAP_STD_API 1545 # endif 1546 #else 1547 # define SOAP_STD_API 1548 #endif 1549 1550 struct SOAP_STD_API soap 1551 { short state; /* 0 = uninitialized, 1 = initialized, 2 = copy of another soap struct */ 1552 short version; /* 1 = SOAP1.1 and 2 = SOAP1.2 (set automatically from namespace URI in nsmap table) */ 1190 1553 soap_mode mode; 1191 1554 soap_mode imode; 1192 1555 soap_mode omode; 1193 const char *float_format; /* points touser-definable format string for floats (<1024 chars) */1194 const char *double_format; /* points touser-definable format string for doubles (<1024 chars) */1195 const char *dime_id_format; /* points touser-definable format string for integer DIME id (<SOAP_TAGLEN chars) */1196 const char *http_version; /* default = "1.0" */1556 const char *float_format; /* user-definable format string for floats (<1024 chars) */ 1557 const char *double_format; /* user-definable format string for doubles (<1024 chars) */ 1558 const char *dime_id_format; /* user-definable format string for integer DIME id (<SOAP_TAGLEN chars) */ 1559 const char *http_version; /* HTTP version used "1.0" or "1.1" */ 1197 1560 const char *http_content; /* optional custom response content type (with SOAP_FILE) */ 1198 1561 const char *encodingStyle; /* default = NULL which means that SOAP encoding is used */ 1199 const char *actor; 1562 const char *actor; /* SOAP-ENV:actor or role attribute value */ 1563 const char *lang; /* xml:lang attribute value of SOAP-ENV:Text */ 1200 1564 int recv_timeout; /* when > 0, gives socket recv timeout in seconds, < 0 in usec */ 1201 1565 int send_timeout; /* when > 0, gives socket send timeout in seconds, < 0 in usec */ … … 1206 1570 int bind_flags; /* bind() SOL_SOCKET sockopt flags, e.g. set to SO_REUSEADDR to enable reuse */ 1207 1571 int accept_flags; /* accept() SOL_SOCKET sockopt flags */ 1572 unsigned short linger_time; /* linger time for SO_LINGER option */ 1208 1573 const struct Namespace *namespaces; /* Pointer to global namespace mapping table */ 1209 1574 struct Namespace *local_namespaces; /* Local namespace mapping table */ … … 1211 1576 struct soap_blist *blist; /* block allocation stack */ 1212 1577 struct soap_clist *clist; /* class instance allocation list */ 1213 void *alist; /* memory allocation list */1578 void *alist; /* memory allocation (malloc) list */ 1214 1579 struct soap_ilist *iht[SOAP_IDHASH]; 1215 1580 struct soap_plist *pht[SOAP_PTRHASH]; 1581 struct soap_pblk *pblk; /* plist block allocation */ 1582 short pidx; /* plist block allocation */ 1216 1583 struct SOAP_ENV__Header *header; 1217 1584 struct SOAP_ENV__Fault *fault; 1585 int idnum; 1218 1586 void *user; /* to pass user-defined data */ 1219 1587 struct soap_plugin *plugins; /* linked list of plug-in data */ … … 1222 1590 int (*fpost)(struct soap*, const char*, const char*, int, const char*, const char*, size_t); 1223 1591 int (*fget)(struct soap*); 1592 int (*fput)(struct soap*); 1593 int (*fdel)(struct soap*); 1594 int (*fhead)(struct soap*); 1595 int (*fform)(struct soap*); 1224 1596 int (*fposthdr)(struct soap*, const char*, const char*); 1225 1597 int (*fresponse)(struct soap*, int, size_t); 1226 1598 int (*fparse)(struct soap*); 1227 1599 int (*fparsehdr)(struct soap*, const char*, const char*); 1600 int (*fheader)(struct soap*); 1228 1601 int (*fresolve)(struct soap*, const char*, struct in_addr* inaddr); 1229 1602 int (*fconnect)(struct soap*, const char*, const char*, int); … … 1231 1604 int (*fclosesocket)(struct soap*, SOAP_SOCKET); 1232 1605 int (*fshutdownsocket)(struct soap*, SOAP_SOCKET, int); 1233 int(*fopen)(struct soap*, const char*, const char*, int);1234 int (*faccept)(struct soap*, int, struct sockaddr*, int *n);1606 SOAP_SOCKET (*fopen)(struct soap*, const char*, const char*, int); 1607 SOAP_SOCKET (*faccept)(struct soap*, SOAP_SOCKET, struct sockaddr*, int *n); 1235 1608 int (*fclose)(struct soap*); 1236 1609 int (*fsend)(struct soap*, const char*, size_t); 1237 1610 size_t (*frecv)(struct soap*, char*, size_t); 1238 1611 int (*fpoll)(struct soap*); 1612 void (*fseterror)(struct soap*, const char **c, const char **s); 1613 int (*fignore)(struct soap*, const char*); 1614 int (*fserveloop)(struct soap*); 1615 void *(*fplugin)(struct soap*, const char*); 1616 void *(*fmalloc)(struct soap*, size_t); 1617 #ifndef WITH_LEANER 1239 1618 int (*fprepareinit)(struct soap*); 1240 1619 int (*fpreparesend)(struct soap*, const char*, size_t); 1241 1620 int (*fpreparerecv)(struct soap*, const char*, size_t); 1242 int (*fignore)(struct soap*, const char*); 1243 int (*fserveloop)(struct soap*); 1244 void *(*fplugin)(struct soap*, const char*); 1621 int (*fpreparefinal)(struct soap*); 1245 1622 void *(*fdimereadopen)(struct soap*, void*, const char*, const char*, const char*); 1246 1623 void *(*fdimewriteopen)(struct soap*, const char*, const char*, const char*); … … 1249 1626 size_t (*fdimeread)(struct soap*, void*, char*, size_t); 1250 1627 int (*fdimewrite)(struct soap*, void*, const char*, size_t); 1251 int master; 1252 int socket; 1628 void *(*fmimereadopen)(struct soap*, void*, const char*, const char*, const char*); 1629 void *(*fmimewriteopen)(struct soap*, void*, const char*, const char*, const char*, enum soap_mime_encoding); 1630 void (*fmimereadclose)(struct soap*, void*); 1631 void (*fmimewriteclose)(struct soap*, void*); 1632 size_t (*fmimeread)(struct soap*, void*, char*, size_t); 1633 int (*fmimewrite)(struct soap*, void*, const char*, size_t); 1634 #endif 1635 SOAP_SOCKET master; 1636 SOAP_SOCKET socket; 1253 1637 #if defined(__cplusplus) && !defined(WITH_LEAN) 1254 ostream *os;1255 istream *is;1638 std::ostream *os; 1639 std::istream *is; 1256 1640 #else 1257 void *os; /* preserve alignment*/1258 void *is; /* preserve alignment*/1641 void *os; /* preserve struct size */ 1642 void *is; /* preserve struct size */ 1259 1643 #endif 1260 1644 #ifndef UNDER_CE … … 1264 1648 FILE *sendfd; 1265 1649 FILE *recvfd; 1266 char errorstr[256]; 1267 wchar_t werrorstr[256]; 1268 #endif 1269 size_t bufidx; 1270 size_t buflen; 1271 soap_wchar ahead; 1272 short cdata; 1273 short body; 1274 unsigned int level; 1650 #endif 1651 size_t bufidx; /* index in soap.buf[] */ 1652 size_t buflen; /* length of soap.buf[] content */ 1653 soap_wchar ahead; /* parser lookahead */ 1654 short cdata; /* CDATA parser state */ 1655 short body; /* parsed XML element has a body or not */ 1656 unsigned int level; /* XML nesting level */ 1275 1657 size_t count; /* message length counter */ 1276 1658 size_t length; /* message length as set by HTTP header */ … … 1279 1661 size_t labidx; /* look-aside buffer index to available part */ 1280 1662 char buf[SOAP_BUFLEN];/* send and receive buffer */ 1281 char tmpbuf[1024]; /* output buffer for HTTP headers, simpleType values, attribute names, and DIME>=1024 bytes */1282 char msgbuf[1024]; /* output buffer for (error) messages <=1024 bytes */1663 char msgbuf[1024]; /* in/out buffer for HTTP/MIME headers >=1024 bytes */ 1664 char tmpbuf[1024]; /* in/out buffer for HTTP/MIME headers, simpleType values, element and attribute tag names, and DIME must be >=1024 bytes */ 1283 1665 char tag[SOAP_TAGLEN]; 1284 1666 char id[SOAP_TAGLEN]; … … 1289 1671 char arrayOffset[SOAP_TAGLEN]; 1290 1672 short other; 1291 short root;1292 1673 short position; 1293 1674 int positions[SOAP_MAXDIMS]; 1675 short root; 1294 1676 struct soap_attribute *attributes; /* attribute list */ 1295 short encoding; 1296 short mustUnderstand; 1297 short null; 1298 short ns; 1299 short part; 1677 short encoding; /* when set, output encodingStyle */ 1678 short mustUnderstand; /* a mustUnderstand element was parsed or is output */ 1679 short null; /* parsed XML is xsi:nil */ 1680 short ns; /* when not set, output full xmlns bindings */ 1681 short part; /* parsing state */ 1300 1682 short alloced; 1301 1683 short peeked; 1302 short keep_alive;1303 1684 size_t chunksize; 1304 1685 size_t chunkbuflen; … … 1309 1690 char *authrealm; /* HTTP authentication realm */ 1310 1691 char *prolog; /* XML declaration prolog */ 1311 int port; 1312 unsigned int max_keep_alive; 1692 unsigned long ip; /* IP number */ 1693 int port; /* port number */ 1694 short keep_alive; /* connection should be kept open */ 1695 short tcp_keep_alive; /* enable SO_KEEPALIVE */ 1696 unsigned int tcp_keep_idle; /* set TCP_KEEPIDLE */ 1697 unsigned int tcp_keep_intvl; /* set TCP_KEEPINTVL */ 1698 unsigned int tcp_keep_cnt; /* set TCP_KEEPCNT */ 1699 unsigned int max_keep_alive; /* maximum keep-alive session (default=100) */ 1700 const char *proxy_http_version;/* HTTP version of proxy "1.0" or "1.1" */ 1313 1701 const char *proxy_host; /* Proxy Server host name */ 1314 1702 int proxy_port; /* Proxy Server port (default = 8080) */ 1315 1703 const char *proxy_userid; /* Proxy Authorization user name */ 1316 1704 const char *proxy_passwd; /* Proxy Authorization password */ 1705 const char *proxy_from; /* X-Forwarding-For header returned by proxy */ 1317 1706 int status; /* -1 when request, else error code to be returned by server */ 1318 1707 int error; 1319 1708 int errmode; 1320 1709 int errnum; 1321 unsigned long idnum; 1322 unsigned long ip;1710 #ifndef WITH_LEANER 1711 struct soap_dom_element *dom; 1323 1712 struct soap_dime dime; 1324 1713 struct soap_mime mime; 1325 struct soap_dom_element *dom; 1714 struct soap_xlist *xlist; 1715 #endif 1326 1716 #if !defined(WITH_LEAN) || defined(SOAP_DEBUG) 1327 1717 const char *logfile[SOAP_MAXLOGS]; 1328 1718 FILE *fdebug[SOAP_MAXLOGS]; 1719 struct soap_mlist *mht[SOAP_PTRHASH]; 1329 1720 #endif 1330 1721 #ifndef WITH_LEAN 1722 const char *c14ninclude; 1723 const char *c14nexclude; 1331 1724 struct soap_cookie *cookies; 1332 1725 const char *cookie_domain; … … 1334 1727 int cookie_max; 1335 1728 #endif 1729 #ifndef WITH_NOIO 1730 int ipv6_multicast_if; /* always include this to keep the soap struct size the same in v4 and v6 */ 1731 char* ipv4_multicast_if; /* always include this to keep the soap struct size the same in v4 and v6 */ 1732 int ipv4_multicast_ttl; /* multicast scope */ 1733 #ifdef WITH_IPV6 1734 struct sockaddr_storage peer; /* IPv6: set by soap_accept and by UDP recv */ 1735 #else 1736 struct sockaddr_in peer; /* IPv4: set by soap_connect/soap_accept and by UDP recv */ 1737 #endif 1738 #endif 1739 size_t peerlen; 1336 1740 #ifdef WITH_OPENSSL 1337 1741 int (*fsslauth)(struct soap*); … … 1340 1744 SSL *ssl; 1341 1745 SSL_CTX *ctx; 1342 short require_server_auth; 1343 short require_client_auth; 1344 short rsa; /* when set, use RSA instead of DH */ 1746 SSL_SESSION *session; 1747 #else 1748 void *fsslauth; /* dummy members, to preserve struct size */ 1749 void *fsslverify; 1750 void *bio; 1751 void *ssl; 1752 void *ctx; 1753 void *session; 1754 #endif 1755 unsigned short ssl_flags; 1345 1756 const char *keyfile; 1346 1757 const char *password; … … 1348 1759 const char *cafile; 1349 1760 const char *capath; 1761 const char *crlfile; 1350 1762 const char *randfile; 1351 SSL_SESSION *session;1352 1763 char session_host[SOAP_TAGLEN]; 1353 1764 int session_port; 1765 #ifdef WITH_C_LOCALE 1766 locale_t c_locale; /* set to C locale by default */ 1767 #else 1768 void *c_locale; 1354 1769 #endif 1355 1770 #ifdef WITH_ZLIB 1771 z_stream *d_stream; /* decompression stream */ 1772 uLong z_crc; /* internal gzip crc */ 1773 #else 1774 void *d_stream; /* dummy members, to preserve struct size */ 1775 soap_int32 z_crc; 1776 #endif 1356 1777 short zlib_state; /* SOAP_ZLIB_NONE, SOAP_ZLIB_DEFLATE, or SOAP_ZLIB_INFLATE */ 1357 1778 short zlib_in; /* SOAP_ZLIB_NONE, SOAP_ZLIB_DEFLATE, or SOAP_ZLIB_GZIP */ 1358 1779 short zlib_out; /* SOAP_ZLIB_NONE, SOAP_ZLIB_DEFLATE, or SOAP_ZLIB_GZIP */ 1359 z_stream d_stream; /* decompression stream */ 1360 char z_buf[SOAP_BUFLEN]; /* buffer */ 1780 char *z_buf; /* buffer */ 1361 1781 size_t z_buflen; 1362 1782 unsigned short z_level; /* compression level to be used (0=none, 1=fast to 9=best) */ 1363 uLong z_crc; /* internal gzip crc */1364 1783 float z_ratio_in; /* detected compression ratio compressed_length/length of inbound message */ 1365 1784 float z_ratio_out; /* detected compression ratio compressed_length/length of outbound message */ 1366 #endif1367 /* WR[ */1368 1785 #ifdef WMW_RPM_IO 1369 1786 void *rpmreqid; 1370 #endif /* WMW_RPM_IO */ 1371 /* ]WR */ 1787 #endif 1788 #ifdef __cplusplus 1789 soap(); 1790 soap(soap_mode); 1791 soap(soap_mode, soap_mode); 1792 soap(struct soap&); 1793 virtual ~soap(); 1794 #else 1795 void (*dummy)(); 1796 #endif 1372 1797 }; 1373 1798 … … 1383 1808 void *ptr; 1384 1809 unsigned int level; 1385 void (*fcopy)(struct soap*, int, int, void*, const void*, size_t); 1810 size_t len; 1811 void (*fcopy)(struct soap*, int, int, void*, size_t, const void*, size_t); 1386 1812 }; 1387 1813 … … 1411 1837 #endif 1412 1838 1839 #ifndef WITH_LEAN 1840 # define soap_get0(soap) (((soap)->bufidx>=(soap)->buflen && soap_recv(soap)) ? EOF : (unsigned char)(soap)->buf[(soap)->bufidx]) 1841 # define soap_get1(soap) (((soap)->bufidx>=(soap)->buflen && soap_recv(soap)) ? EOF : (unsigned char)(soap)->buf[(soap)->bufidx++]) 1842 #else 1843 soap_wchar soap_get0(struct soap*); 1844 soap_wchar soap_get1(struct soap*); 1845 #endif 1846 1847 #define soap_revget1(soap) ((soap)->bufidx--) 1848 #define soap_unget(soap, c) ((soap)->ahead = c) 1849 #define soap_register_plugin(soap, plugin) soap_register_plugin_arg(soap, plugin, NULL) 1850 #define soap_imode(soap, n) ((soap)->mode = (soap)->imode = (n)) 1851 #define soap_set_imode(soap, n) ((soap)->imode |= (n)) 1852 #define soap_clr_imode(soap, n) ((soap)->imode &= ~(n)) 1853 #define soap_omode(soap, n) ((soap)->mode = (soap)->omode = (n)) 1854 #define soap_set_omode(soap, n) ((soap)->omode |= (n)) 1855 #define soap_clr_omode(soap, n) ((soap)->omode &= ~(n)) 1856 #define soap_set_mode(soap, n) ((soap)->imode |= (n), (soap)->omode |= (n)) 1857 #define soap_clr_mode(soap, n) ((soap)->imode &= ~(n), (soap)->omode &= ~(n)) 1858 #define soap_destroy(soap) soap_delete((soap), NULL) 1859 1413 1860 #ifdef HAVE_STRRCHR 1414 1861 # define soap_strrchr(s, t) strrchr(s, t) … … 1429 1876 #endif 1430 1877 1878 #if defined(WITH_OPENSSL) 1879 # define soap_random soap_rand() 1880 SOAP_FMAC1 int SOAP_FMAC2 soap_rand(void); 1881 #elif defined(HAVE_RANDOM) 1882 # define soap_random (int)random() 1883 #else 1884 # define soap_random rand() 1885 #endif 1886 1887 #ifdef WITH_NOIDREF 1888 # define soap_embedded(s, p, t) (0) 1889 # define soap_id_lookup(s, i, p, t, n, k) (p) 1890 # define soap_id_forward(s, h, p, len, st, tt, n, k, fc) (p) 1891 # define soap_reference(s, a, t) (1) 1892 # define soap_array_reference(s, p, a, n, t) (1) 1893 # define soap_embed(s, p, a, n, t, pp) (0) 1894 # define soap_embedded_id(s, i, p, t) (i) 1895 # define soap_is_embedded(s, p) (0) 1896 # define soap_is_single(s, p) (1) 1897 # define soap_lookup_type(s, i) (0) 1898 # define soap_getindependent(s) (0) 1899 # define soap_putindependent(s) (0) 1900 # define soap_getelement(s, n) (n) 1901 # define soap_putelement(s, p, t, i, n) (0) 1902 # define soap_markelement(s, p, n) (0) 1903 #endif 1904 1905 SOAP_FMAC1 void SOAP_FMAC2 soap_header(struct soap*); 1431 1906 SOAP_FMAC1 void SOAP_FMAC2 soap_fault(struct soap*); 1432 1907 SOAP_FMAC1 const char** SOAP_FMAC2 soap_faultcode(struct soap*); 1908 SOAP_FMAC1 const char** SOAP_FMAC2 soap_faultsubcode(struct soap*); 1433 1909 SOAP_FMAC1 const char** SOAP_FMAC2 soap_faultstring(struct soap*); 1434 1910 SOAP_FMAC1 const char** SOAP_FMAC2 soap_faultdetail(struct soap*); … … 1440 1916 SOAP_FMAC1 int SOAP_FMAC2 soap_getfault(struct soap*); 1441 1917 1918 SOAP_FMAC1 void SOAP_FMAC2 soap_ssl_init(); 1442 1919 SOAP_FMAC1 int SOAP_FMAC2 soap_poll(struct soap*); 1443 1920 SOAP_FMAC1 int SOAP_FMAC2 soap_connect_command(struct soap*, int, const char*, const char*); 1444 1921 SOAP_FMAC1 int SOAP_FMAC2 soap_connect(struct soap*, const char*, const char*); 1445 SOAP_FMAC1 intSOAP_FMAC2 soap_bind(struct soap*, const char*, int, int);1446 SOAP_FMAC1 intSOAP_FMAC2 soap_accept(struct soap*);1922 SOAP_FMAC1 SOAP_SOCKET SOAP_FMAC2 soap_bind(struct soap*, const char*, int, int); 1923 SOAP_FMAC1 SOAP_SOCKET SOAP_FMAC2 soap_accept(struct soap*); 1447 1924 SOAP_FMAC1 int SOAP_FMAC2 soap_ssl_accept(struct soap*); 1925 SOAP_FMAC1 const char * SOAP_FMAC2 soap_ssl_error(struct soap*, int); 1448 1926 1449 1927 SOAP_FMAC1 int SOAP_FMAC2 soap_ssl_server_context(struct soap*, unsigned short, const char*, const char*, const char*, const char*, const char*, const char*, const char*); … … 1465 1943 SOAP_FMAC1 void SOAP_FMAC2 soap_set_fault(struct soap*); 1466 1944 SOAP_FMAC1 int SOAP_FMAC2 soap_sender_fault(struct soap*, const char*, const char*); 1945 SOAP_FMAC1 int SOAP_FMAC2 soap_sender_fault_subcode(struct soap*, const char*, const char*, const char*); 1467 1946 SOAP_FMAC1 int SOAP_FMAC2 soap_receiver_fault(struct soap*, const char*, const char*); 1947 SOAP_FMAC1 int SOAP_FMAC2 soap_receiver_fault_subcode(struct soap*, const char*, const char*, const char*); 1468 1948 SOAP_FMAC1 int SOAP_FMAC2 soap_set_sender_error(struct soap*, const char*, const char*, int); 1469 1949 SOAP_FMAC1 int SOAP_FMAC2 soap_set_receiver_error(struct soap*, const char*, const char*, int); … … 1484 1964 SOAP_FMAC1 unsigned char* SOAP_FMAC2 soap_gethex(struct soap*, int*); 1485 1965 1486 1487 SOAP_FMAC1 struct soap_ilist* SOAP_FMAC2 soap_lookup(struct soap*, const char*); 1488 SOAP_FMAC1 struct soap_ilist* SOAP_FMAC2 soap_enter(struct soap*, const char*); 1489 SOAP_FMAC1 int SOAP_FMAC2 soap_resolve(struct soap*); 1490 1966 #ifndef WITH_LEANER 1967 SOAP_FMAC1 int SOAP_FMAC2 soap_xop_forward(struct soap*, unsigned char**, int*, char**, char**, char**); 1968 SOAP_FMAC1 int SOAP_FMAC2 soap_dime_forward(struct soap*, unsigned char**, int*, char**, char**, char**); 1969 #endif 1970 1971 #ifndef WITH_NOIDREF 1491 1972 SOAP_FMAC1 int SOAP_FMAC2 soap_pointer_lookup_id(struct soap*, void *p, int t, struct soap_plist**); 1492 1973 SOAP_FMAC1 int SOAP_FMAC2 soap_pointer_lookup(struct soap*, const void *p, int t, struct soap_plist**); 1493 1974 SOAP_FMAC1 int SOAP_FMAC2 soap_pointer_enter(struct soap*, const void *p, const struct soap_array *a, int n, int t, struct soap_plist**); 1494 1975 SOAP_FMAC1 int SOAP_FMAC2 soap_array_pointer_lookup(struct soap*, const void *p, const struct soap_array *a, int n, int t, struct soap_plist**); 1495 1496 1976 SOAP_FMAC1 int SOAP_FMAC2 soap_embed(struct soap *soap, const void *p, const struct soap_array *a, int n, const char *tag, int type); 1497 1498 SOAP_FMAC1 void SOAP_FMAC2 soap_begin_count(struct soap*); 1499 SOAP_FMAC1 int SOAP_FMAC2 soap_begin_send(struct soap*); 1500 SOAP_FMAC1 int SOAP_FMAC2 soap_end_send(struct soap*); 1501 1977 SOAP_FMAC1 struct soap_ilist* SOAP_FMAC2 soap_lookup(struct soap*, const char*); 1978 SOAP_FMAC1 struct soap_ilist* SOAP_FMAC2 soap_enter(struct soap*, const char*); 1979 SOAP_FMAC1 int SOAP_FMAC2 soap_resolve(struct soap*); 1502 1980 SOAP_FMAC1 void SOAP_FMAC2 soap_embedded(struct soap*, const void *p, int t); 1503 1981 SOAP_FMAC1 int SOAP_FMAC2 soap_reference(struct soap*, const void *p, int t); … … 1507 1985 SOAP_FMAC1 int SOAP_FMAC2 soap_is_single(struct soap*, struct soap_plist*); 1508 1986 SOAP_FMAC1 void SOAP_FMAC2 soap_set_embedded(struct soap*, struct soap_plist*); 1509 1510 SOAP_FMAC1 const struct soap_code_map* SOAP_FMAC2 soap_code(const struct soap_code_map*, const char *str); 1511 SOAP_FMAC1 long SOAP_FMAC2 soap_int_code(const struct soap_code_map*, const char *str, long other); 1512 SOAP_FMAC1 const char* SOAP_FMAC2 soap_str_code(const struct soap_code_map*, long code); 1987 #endif 1988 1989 SOAP_FMAC1 int SOAP_FMAC2 soap_begin_count(struct soap*); 1990 SOAP_FMAC1 int SOAP_FMAC2 soap_end_count(struct soap*); 1991 SOAP_FMAC1 int SOAP_FMAC2 soap_begin_send(struct soap*); 1992 SOAP_FMAC1 int SOAP_FMAC2 soap_end_send(struct soap*); 1993 1994 SOAP_FMAC1 const struct soap_code_map* SOAP_FMAC2 soap_code(const struct soap_code_map*, const char*); 1995 SOAP_FMAC1 long SOAP_FMAC2 soap_code_int(const struct soap_code_map*, const char*, long); 1996 SOAP_FMAC1 const char* SOAP_FMAC2 soap_code_str(const struct soap_code_map*, long); 1997 SOAP_FMAC1 long SOAP_FMAC2 soap_code_bits(const struct soap_code_map*, const char*); 1998 SOAP_FMAC1 const char* SOAP_FMAC2 soap_code_list(struct soap*, const struct soap_code_map*, long); 1513 1999 1514 2000 SOAP_FMAC1 int SOAP_FMAC2 soap_getline(struct soap*, char*, int); … … 1518 2004 SOAP_FMAC1 void* SOAP_FMAC2 soap_malloc(struct soap*, size_t); 1519 2005 SOAP_FMAC1 void SOAP_FMAC2 soap_dealloc(struct soap*, void*); 1520 SOAP_FMAC1 struct soap_clist * SOAP_FMAC2 soap_link(struct soap*, void*, int, int, void(*fdelete)(struct soap_clist*));2006 SOAP_FMAC1 struct soap_clist * SOAP_FMAC2 soap_link(struct soap*, void*, int, int, int (*fdelete)(struct soap_clist*)); 1521 2007 SOAP_FMAC1 void SOAP_FMAC2 soap_unlink(struct soap*, const void*); 1522 SOAP_FMAC1 void SOAP_FMAC2 soap_free(struct soap*); 1523 2008 SOAP_FMAC1 void SOAP_FMAC2 soap_free_temp(struct soap*); 2009 SOAP_FMAC1 void SOAP_FMAC2 soap_del(struct soap*); 2010 2011 SOAP_FMAC1 void* SOAP_FMAC2 soap_track_malloc(struct soap*, const char*, int, size_t); 2012 SOAP_FMAC1 void SOAP_FMAC2 soap_track_free(struct soap*, const char*, int, void*); 2013 2014 #ifndef WITH_NOIDREF 1524 2015 SOAP_FMAC1 int SOAP_FMAC2 soap_lookup_type(struct soap*, const char *id); 1525 1526 2016 SOAP_FMAC1 void* SOAP_FMAC2 soap_id_lookup(struct soap*, const char *id, void **p, int t, size_t n, unsigned int k); 1527 SOAP_FMAC1 void* SOAP_FMAC2 soap_id_forward(struct soap*, const char *id, void *p, int st, int tt, size_t n, unsigned int k, void(*fcopy)(struct soap*, int, int, void*, const void*, size_t)); 2017 SOAP_FMAC1 void* SOAP_FMAC2 soap_id_forward(struct soap*, const char *id, 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)); 2018 #endif 1528 2019 SOAP_FMAC1 void* SOAP_FMAC2 soap_id_enter(struct 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*)); 1529 SOAP_FMAC1 void SOAP_FMAC2 soap_fcopy(struct soap *soap, int st, int tt, void *p, const void *q, size_t n);2020 SOAP_FMAC1 void SOAP_FMAC2 soap_fcopy(struct soap *soap, int st, int tt, void *p, size_t, const void *q, size_t n); 1530 2021 1531 2022 SOAP_FMAC1 int SOAP_FMAC2 soap_size(const int *, int); … … 1544 2035 1545 2036 SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_new(void); 1546 SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_new1(int); 1547 SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_new2(int, int); 1548 SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_copy(struct soap*); 1549 SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_copy_context(struct soap*,struct soap*); 2037 SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_new1(soap_mode); 2038 SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_new2(soap_mode, soap_mode); 2039 SOAP_FMAC1 void SOAP_FMAC2 soap_free(struct soap*); 2040 SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_copy(const struct soap*); 2041 SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_copy_context(struct soap*, const struct soap*); 2042 SOAP_FMAC1 void SOAP_FMAC2 soap_copy_stream(struct soap*, struct soap*); 1550 2043 SOAP_FMAC1 void SOAP_FMAC2 soap_init(struct soap*); 1551 SOAP_FMAC1 void SOAP_FMAC2 soap_init1(struct soap*, int);1552 SOAP_FMAC1 void SOAP_FMAC2 soap_init2(struct soap*, int, int);2044 SOAP_FMAC1 void SOAP_FMAC2 soap_init1(struct soap*, soap_mode); 2045 SOAP_FMAC1 void SOAP_FMAC2 soap_init2(struct soap*, soap_mode, soap_mode); 1553 2046 SOAP_FMAC1 void SOAP_FMAC2 soap_done(struct soap*); 1554 2047 SOAP_FMAC1 void SOAP_FMAC2 soap_cleanup(struct soap*); … … 1566 2059 1567 2060 SOAP_FMAC1 const char* SOAP_FMAC2 soap_value(struct soap*); 1568 1569 SOAP_FMAC1 soap_wchar SOAP_FMAC2 soap_advance(struct soap*);1570 SOAP_FMAC1 soap_wchar SOAP_FMAC2 soap_skip(struct soap*);1571 2061 1572 2062 SOAP_FMAC1 int SOAP_FMAC2 soap_match_tag(struct soap*, const char*, const char *); … … 1581 2071 SOAP_FMAC1 int SOAP_FMAC2 soap_element_id(struct soap*, const char *tag, int id, const void *p, const struct soap_array *a, int d, const char *type, int n); 1582 2072 SOAP_FMAC1 int SOAP_FMAC2 soap_element_result(struct soap*, const char *tag); 2073 SOAP_FMAC1 void SOAP_FMAC2 soap_check_result(struct soap*, const char *tag); 1583 2074 SOAP_FMAC1 int SOAP_FMAC2 soap_element_end_out(struct soap*, const char *tag); 1584 2075 SOAP_FMAC1 int SOAP_FMAC2 soap_element_start_end_out(struct soap*, const char *tag); … … 1586 2077 SOAP_FMAC1 int SOAP_FMAC2 soap_attribute(struct soap*, const char*, const char*); 1587 2078 1588 SOAP_FMAC1 int SOAP_FMAC2 soap_element_begin_in(struct soap*, const char *tag, int nillable );2079 SOAP_FMAC1 int SOAP_FMAC2 soap_element_begin_in(struct soap*, const char *tag, int nillable, const char *type); 1589 2080 1590 2081 SOAP_FMAC1 int SOAP_FMAC2 soap_element_end_in(struct soap*, const char *tag); … … 1596 2087 1597 2088 SOAP_FMAC1 char* SOAP_FMAC2 soap_strdup(struct soap*, const char*); 2089 SOAP_FMAC1 wchar_t* SOAP_FMAC2 soap_wstrdup(struct soap*, const wchar_t*); 2090 SOAP_FMAC1 const char * SOAP_FMAC2 soap_strsearch(const char *big, const char *little); 1598 2091 1599 2092 SOAP_FMAC1 int SOAP_FMAC2 soap_string_out(struct soap*, const char *s, int flag); 1600 2093 SOAP_FMAC1 char* SOAP_FMAC2 soap_string_in(struct soap*, int, long, long); 2094 2095 #ifndef WITH_LEANER 1601 2096 SOAP_FMAC1 int SOAP_FMAC2 soap_wstring_out(struct soap*, const wchar_t *s, int flag); 1602 2097 SOAP_FMAC1 wchar_t* SOAP_FMAC2 soap_wstring_in(struct soap*, int, long, long); 1603 1604 SOAP_FMAC1 int SOAP_FMAC2 soap_match_namespace(struct soap*, const char *, const char*, int n1, int n2); 1605 1606 SOAP_FMAC1 int SOAP_FMAC2 soap_set_namespaces(struct soap*, struct Namespace*); 2098 #endif 2099 2100 SOAP_FMAC1 int SOAP_FMAC2 soap_match_namespace(struct soap*, const char *, const char*, size_t n1, size_t n2); 2101 2102 SOAP_FMAC1 int SOAP_FMAC2 soap_set_namespaces(struct soap*, const struct Namespace*); 2103 SOAP_FMAC1 void SOAP_FMAC2 soap_set_local_namespaces(struct soap*); 1607 2104 1608 2105 SOAP_FMAC1 void SOAP_FMAC2 soap_pop_namespace(struct soap*); 1609 2106 SOAP_FMAC1 int SOAP_FMAC2 soap_push_namespace(struct soap*, const char *,const char *); 1610 1611 SOAP_FMAC1 int SOAP_FMAC2 soap_new_block(struct soap*); 1612 SOAP_FMAC1 void* SOAP_FMAC2 soap_push_block(struct soap*, size_t); 1613 SOAP_FMAC1 void SOAP_FMAC2 soap_pop_block(struct soap*); 1614 SOAP_FMAC1 size_t SOAP_FMAC2 soap_size_block(struct soap*, size_t); 1615 SOAP_FMAC1 char* SOAP_FMAC2 soap_first_block(struct soap*); 1616 SOAP_FMAC1 char* SOAP_FMAC2 soap_next_block(struct soap*); 1617 SOAP_FMAC1 size_t SOAP_FMAC2 soap_block_size(struct soap*); 1618 SOAP_FMAC1 char* SOAP_FMAC2 soap_save_block(struct soap*, char*, int); 1619 SOAP_FMAC1 void SOAP_FMAC2 soap_end_block(struct soap*); 2107 SOAP_FMAC1 const char* SOAP_FMAC2 soap_current_namespace(struct soap *soap, const char *tag); 2108 2109 SOAP_FMAC1 struct soap_nlist* SOAP_FMAC2 soap_lookup_ns(struct soap *soap, const char *tag, size_t n); 2110 2111 SOAP_FMAC1 int SOAP_FMAC2 soap_store_lab(struct soap*, const char*, size_t); 2112 SOAP_FMAC1 int SOAP_FMAC2 soap_append_lab(struct soap*, const char*, size_t); 2113 2114 SOAP_FMAC1 struct soap_blist* SOAP_FMAC2 soap_new_block(struct soap*); 2115 SOAP_FMAC1 void* SOAP_FMAC2 soap_push_block(struct soap*, struct soap_blist*, size_t); 2116 SOAP_FMAC1 void SOAP_FMAC2 soap_pop_block(struct soap*, struct soap_blist*); 2117 SOAP_FMAC1 size_t SOAP_FMAC2 soap_size_block(struct soap*, struct soap_blist*, size_t); 2118 SOAP_FMAC1 char* SOAP_FMAC2 soap_first_block(struct soap*, struct soap_blist*); 2119 SOAP_FMAC1 char* SOAP_FMAC2 soap_next_block(struct soap*, struct soap_blist*); 2120 SOAP_FMAC1 size_t SOAP_FMAC2 soap_block_size(struct soap*, struct soap_blist*); 2121 SOAP_FMAC1 char* SOAP_FMAC2 soap_save_block(struct soap*, struct soap_blist*, char*, int); 2122 SOAP_FMAC1 void SOAP_FMAC2 soap_end_block(struct soap*, struct soap_blist*); 1620 2123 1621 2124 SOAP_FMAC1 int SOAP_FMAC2 soap_envelope_begin_out(struct soap*); … … 1635 2138 SOAP_FMAC1 int SOAP_FMAC2 soap_response(struct soap*, int); 1636 2139 2140 SOAP_FMAC1 int SOAP_FMAC2 soap_send_empty_response(struct soap*, int status); 2141 SOAP_FMAC1 int SOAP_FMAC2 soap_recv_empty_response(struct soap*); 2142 1637 2143 SOAP_FMAC1 int SOAP_FMAC2 soap_send_fault(struct soap*); 1638 1639 2144 SOAP_FMAC1 int SOAP_FMAC2 soap_recv_fault(struct soap*); 1640 2145 2146 #ifndef WITH_NOSTDLIB 1641 2147 SOAP_FMAC1 void SOAP_FMAC2 soap_print_fault(struct soap*, FILE*); 1642 2148 SOAP_FMAC1 void SOAP_FMAC2 soap_print_fault_location(struct soap*, FILE*); 2149 # ifndef WITH_LEAN 2150 # ifdef __cplusplus 2151 SOAP_FMAC1 void SOAP_FMAC2 soap_stream_fault(struct soap*, std::ostream&); 2152 # endif 2153 SOAP_FMAC1 char* SOAP_FMAC2 soap_sprint_fault(struct soap*, char*, size_t); 2154 # endif 2155 #endif 1643 2156 1644 2157 SOAP_FMAC1 int SOAP_FMAC2 soap_s2byte(struct soap*, const char*, char*); … … 1654 2167 SOAP_FMAC1 int SOAP_FMAC2 soap_s2unsignedLong(struct soap*, const char*, unsigned long*); 1655 2168 SOAP_FMAC1 int SOAP_FMAC2 soap_s2ULONG64(struct soap*, const char*, ULONG64*); 1656 SOAP_FMAC1 int SOAP_FMAC2 soap_s2dateTime(struct soap*, const char*, time_t*);1657 2169 SOAP_FMAC1 int SOAP_FMAC2 soap_s2string(struct soap*, const char*, char**); 1658 2170 SOAP_FMAC1 int SOAP_FMAC2 soap_s2QName(struct soap*, const char*, char**); 1659 2171 1660 SOAP_FMAC1 char* SOAP_FMAC2 soap_s2base64(struct soap*, const unsigned char*, char*, size_t); 2172 #ifndef WITH_LEAN 2173 SOAP_FMAC1 int SOAP_FMAC2 soap_s2wchar(struct soap*, const char*, wchar_t**); 2174 SOAP_FMAC1 int SOAP_FMAC2 soap_s2dateTime(struct soap*, const char*, time_t*); 2175 SOAP_FMAC1 char* SOAP_FMAC2 soap_s2base64(struct soap*, const unsigned char*, char*, int); 2176 SOAP_FMAC1 char* SOAP_FMAC2 soap_s2hex(struct soap*, const unsigned char*, char*, int); 2177 #endif 1661 2178 1662 2179 SOAP_FMAC1 const char* SOAP_FMAC2 soap_byte2s(struct soap*, char); … … 1672 2189 SOAP_FMAC1 const char* SOAP_FMAC2 soap_unsignedLong2s(struct soap*, unsigned long); 1673 2190 SOAP_FMAC1 const char* SOAP_FMAC2 soap_ULONG642s(struct soap*, ULONG64); 2191 SOAP_FMAC1 const char* SOAP_FMAC2 soap_QName2s(struct soap*, const char*); 2192 2193 #ifndef WITH_LEAN 2194 SOAP_FMAC1 const char* SOAP_FMAC2 soap_wchar2s(struct soap*, const wchar_t*); 1674 2195 SOAP_FMAC1 const char* SOAP_FMAC2 soap_dateTime2s(struct soap*, time_t); 1675 SOAP_FMAC1 const char* SOAP_FMAC2 soap_QName2s(struct soap*, const char*); 1676 1677 SOAP_FMAC1 const char* SOAP_FMAC2 soap_base642s(struct soap*, const char*, char*, size_t, size_t*); 2196 SOAP_FMAC1 const char* SOAP_FMAC2 soap_base642s(struct soap*, const char*, char*, size_t, int*); 2197 SOAP_FMAC1 const char* SOAP_FMAC2 soap_hex2s(struct soap*, const char*, char*, size_t, int*); 2198 #endif 2199 1678 2200 1679 2201 SOAP_FMAC1 int* SOAP_FMAC2 soap_inint(struct soap*, const char *tag, int *p, const char *, int); … … 1689 2211 SOAP_FMAC1 unsigned long* SOAP_FMAC2 soap_inunsignedLong(struct soap*, const char *tag, unsigned long *p, const char *, int); 1690 2212 SOAP_FMAC1 ULONG64* SOAP_FMAC2 soap_inULONG64(struct soap*, const char *tag, ULONG64 *p, const char *, int); 2213 SOAP_FMAC1 char** SOAP_FMAC2 soap_instring(struct soap*, const char *tag, char **p, const char *, int, int, long, long); 2214 SOAP_FMAC1 char** SOAP_FMAC2 soap_inliteral(struct soap*, const char *tag, char **p); 2215 2216 #ifndef WITH_LEAN 1691 2217 SOAP_FMAC1 time_t* SOAP_FMAC2 soap_indateTime(struct soap*, const char *tag, time_t *p, const char *, int); 1692 SOAP_FMAC1 char** SOAP_FMAC2 soap_instring(struct soap*, const char *tag, char **p, const char *, int, int, long, long); 2218 SOAP_FMAC1 time_t SOAP_FMAC2 soap_timegm(struct tm*); 2219 #endif 2220 2221 #ifndef WITH_LEANER 1693 2222 SOAP_FMAC1 wchar_t** SOAP_FMAC2 soap_inwstring(struct soap*, const char *tag, wchar_t **p, const char *, int, long, long); 1694 SOAP_FMAC1 char** SOAP_FMAC2 soap_inliteral(struct soap*, const char *tag, char **p);1695 2223 SOAP_FMAC1 wchar_t** SOAP_FMAC2 soap_inwliteral(struct soap*, const char *tag, wchar_t **p); 2224 #endif 1696 2225 1697 2226 SOAP_FMAC1 int SOAP_FMAC2 soap_outbyte(struct soap*, const char *tag, int id, const char *p, const char *, int); … … 1707 2236 SOAP_FMAC1 int SOAP_FMAC2 soap_outunsignedLong(struct soap*, const char *tag, int id, const unsigned long *p, const char *, int); 1708 2237 SOAP_FMAC1 int SOAP_FMAC2 soap_outULONG64(struct soap*, const char *tag, int id, const ULONG64 *p, const char *, int); 2238 SOAP_FMAC1 int SOAP_FMAC2 soap_outstring(struct soap*, const char *tag, int id, char *const*p, const char *, int); 2239 SOAP_FMAC1 int SOAP_FMAC2 soap_outliteral(struct soap*, const char *tag, char *const*p, const char *type); 2240 2241 #ifndef WITH_LEAN 1709 2242 SOAP_FMAC1 int SOAP_FMAC2 soap_outdateTime(struct soap*, const char *tag, int id, const time_t *p, const char *, int); 1710 SOAP_FMAC1 int SOAP_FMAC2 soap_outstring(struct soap*, const char *tag, int id, char *const*p, const char *, int); 2243 #endif 2244 2245 #ifndef WITH_LEANER 1711 2246 SOAP_FMAC1 int SOAP_FMAC2 soap_outwstring(struct soap*, const char *tag, int id, wchar_t *const*p, const char *, int); 1712 SOAP_FMAC1 int SOAP_FMAC2 soap_out literal(struct soap*, const char *tag, char *const*p);1713 SOAP_FMAC1 int SOAP_FMAC2 soap_outwliteral(struct soap*, const char *tag, wchar_t *const*p); 2247 SOAP_FMAC1 int SOAP_FMAC2 soap_outwliteral(struct soap*, const char *tag, wchar_t *const*p, const char *type); 2248 #endif 1714 2249 1715 2250 #ifndef WITH_LEANER 1716 SOAP_FMAC1 int SOAP_FMAC2 soap_ element_dime(struct soap *, const char*, int, const void*, const struct soap_array*, const char*, const char*, const char*, int, const char*, int);2251 SOAP_FMAC1 int SOAP_FMAC2 soap_attachment(struct soap *, const char*, int, const void*, const struct soap_array*, const char*, const char*, const char*, int, const char*, int); 1717 2252 SOAP_FMAC1 int SOAP_FMAC2 soap_move(struct soap*, long); 1718 2253 SOAP_FMAC1 size_t SOAP_FMAC2 soap_tell(struct soap*); … … 1732 2267 SOAP_FMAC1 int SOAP_FMAC2 soap_set_dime_attachment(struct soap*, char *ptr, size_t size, const char *type, const char *id, unsigned short optype, const char *option); 1733 2268 SOAP_FMAC1 int SOAP_FMAC2 soap_set_mime_attachment(struct soap*, char *ptr, size_t size, enum soap_mime_encoding encoding, const char *type, const char *id, const char *location, const char *description); 2269 SOAP_FMAC1 void SOAP_FMAC2 soap_post_check_mime_attachments(struct soap *soap); 2270 SOAP_FMAC1 int SOAP_FMAC2 soap_check_mime_attachments(struct soap *soap); 2271 SOAP_FMAC1 struct soap_multipart* SOAP_FMAC2 soap_get_mime_attachment(struct soap *soap, void *handle); 1734 2272 SOAP_FMAC1 struct soap_multipart* SOAP_FMAC2 soap_next_multipart(struct soap_multipart*); 2273 SOAP_FMAC1 int SOAP_FMAC2 soap_match_cid(struct soap*, const char*, const char*); 1735 2274 #endif 1736 2275 … … 1743 2282 1744 2283 #ifdef WITH_COOKIES 2284 SOAP_FMAC1 void SOAP_FMAC2 soap_getcookies(struct soap *soap, const char *val); 1745 2285 SOAP_FMAC1 size_t SOAP_FMAC2 soap_encode_cookie(const char*, char*, size_t); 1746 2286 SOAP_FMAC1 extern struct soap_cookie* SOAP_FMAC2 soap_set_cookie(struct soap*, const char*, const char*, const char*, const char*); 1747 2287 SOAP_FMAC1 extern struct soap_cookie* SOAP_FMAC2 soap_cookie(struct soap*, const char*, const char*, const char*); 1748 2288 SOAP_FMAC1 extern char* SOAP_FMAC2 soap_cookie_value(struct soap*, const char*, const char*, const char*); 1749 SOAP_FMAC1 extern long SOAP_FMAC2 soap_cookie_expire(struct soap*, const char*, const char*, const char*); 2289 SOAP_FMAC1 extern char* SOAP_FMAC2 soap_env_cookie_value(struct soap*, const char*, const char*, const char*); 2290 SOAP_FMAC1 extern time_t SOAP_FMAC2 soap_cookie_expire(struct soap*, const char*, const char*, const char*); 1750 2291 SOAP_FMAC1 extern int SOAP_FMAC2 soap_set_cookie_expire(struct soap*, const char*, long, const char*, const char*); 1751 2292 SOAP_FMAC1 extern int SOAP_FMAC2 soap_set_cookie_session(struct soap*, const char*, const char*, const char*); … … 1753 2294 SOAP_FMAC1 extern void SOAP_FMAC2 soap_clr_cookie(struct soap*, const char*, const char*, const char*); 1754 2295 SOAP_FMAC1 extern int SOAP_FMAC2 soap_getenv_cookies(struct soap*); 1755 SOAP_FMAC1 extern struct soap_cookie* SOAP_FMAC2 soap_copy_cookies(struct soap* );2296 SOAP_FMAC1 extern struct soap_cookie* SOAP_FMAC2 soap_copy_cookies(struct soap*, const struct soap*); 1756 2297 SOAP_FMAC1 extern void SOAP_FMAC2 soap_free_cookies(struct soap*); 1757 2298 #endif 1758 2299 1759 2300 #ifdef __cplusplus 1760 } 1761 #endif 1762 1763 #endif 1764 2301 } /* extern "C" */ 2302 #endif 2303 2304 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
