Changeset 25027 for branches/pap/Nebulous/nebclient
- Timestamp:
- Aug 7, 2009, 4:08:25 PM (17 years ago)
- Location:
- branches/pap
- Files:
-
- 15 edited
-
. (modified) (1 prop)
-
Nebulous (modified) (1 prop)
-
Nebulous/nebclient (modified) (1 prop)
-
Nebulous/nebclient/configure.ac (modified) (1 diff)
-
Nebulous/nebclient/nebulous.wsdl (modified) (3 diffs)
-
Nebulous/nebclient/src/nebclient.c (modified) (52 diffs)
-
Nebulous/nebclient/src/nebclient.h (modified) (3 diffs)
-
Nebulous/nebclient/src/nebulous.h (modified) (3 diffs)
-
Nebulous/nebclient/src/soapC.c (modified) (6 diffs)
-
Nebulous/nebclient/src/soapClient.c (modified) (2 diffs)
-
Nebulous/nebclient/src/soapH.h (modified) (9 diffs)
-
Nebulous/nebclient/src/soapServer.c (modified) (3 diffs)
-
Nebulous/nebclient/src/soapStub.h (modified) (8 diffs)
-
Nebulous/nebclient/tests/tap (modified) (1 prop)
-
Nebulous/nebclient/tests/tests.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/pap
- Property svn:mergeinfo changed
-
branches/pap/Nebulous
- Property svn:mergeinfo deleted
-
branches/pap/Nebulous/nebclient
- Property svn:mergeinfo deleted
-
branches/pap/Nebulous/nebclient/configure.ac
r20208 r25027 5 5 AC_PREREQ(2.61) 6 6 7 AC_INIT([nebclient], [0. 08], [jhoblitt@cpan.org])7 AC_INIT([nebclient], [0.17], [jhoblitt@cpan.org]) 8 8 AC_CONFIG_SRCDIR([nebulous.wsdl]) 9 9 -
branches/pap/Nebulous/nebclient/nebulous.wsdl
r23935 r25027 140 140 </message> 141 141 142 <message name="chmod_objectRequest"> 143 <part name="key" type="xsd:string" /> 144 <part name="mode" type="xsd:int" /> 145 </message> 146 <message name="chmod_objectResponse"> 147 <!-- fixme --> 148 <part name="result" type="xsd:int" /> 149 </message> 150 151 <message name="prune_objectRequest"> 152 <part name="key" type="xsd:string" /> 153 </message> 154 <message name="prune_objectResponse"> 155 <!-- fixme --> 156 <part name="result" type="xsd:int" /> 157 </message> 158 142 159 143 160 <portType name="Nebulous/Server/SOAPPort"> … … 240 257 --> 241 258 </operation> 259 <operation name="chmod_object"> 260 <input message="tns:chmod_objectRequest" /> 261 <output message="tns:chmod_objectResponse" /> 262 <!-- 263 <fault name="" message="" /> 264 --> 265 </operation> 266 <operation name="prune_object"> 267 <input message="tns:prune_objectRequest" /> 268 <output message="tns:prune_objectResponse" /> 269 <!-- 270 <fault name="" message="" /> 271 --> 272 </operation> 242 273 </portType> 243 274 … … 390 421 <operation name="stat_object"> 391 422 <soap:operation soapAction="urn:Nebulous/Server/SOAP#stat_object" /> 423 <input> 424 <soap:body use="encoded" namespace="urn:Nebulous/Server/SOAP" 425 encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> 426 </input> 427 <output> 428 <soap:body use="encoded" namespace="urn:Nebulous/Server/SOAP" 429 encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> 430 </output> 431 </operation> 432 <operation name="chmod_object"> 433 <soap:operation soapAction="urn:Nebulous/Server/SOAP#chmod_object" /> 434 <input> 435 <soap:body use="encoded" namespace="urn:Nebulous/Server/SOAP" 436 encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> 437 </input> 438 <output> 439 <soap:body use="encoded" namespace="urn:Nebulous/Server/SOAP" 440 encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> 441 </output> 442 </operation> 443 <operation name="prune_object"> 444 <soap:operation soapAction="urn:Nebulous/Server/SOAP#prune_object" /> 392 445 <input> 393 446 <soap:body use="encoded" namespace="urn:Nebulous/Server/SOAP" -
branches/pap/Nebulous/nebclient/src/nebclient.c
r23935 r25027 51 51 static char *nullstrncpy(char *dest, const char *src, size_t n); 52 52 53 53 54 nebServer *nebServerAlloc(const char *endpoint) 54 55 { 55 nebServer *server; 56 57 server = xmalloc(sizeof(nebServer)); 56 nebServer *server = xmalloc(sizeof(nebServer)); 58 57 59 58 if (endpoint) { … … 77 76 } 78 77 78 79 79 void nebServerFree(nebServer *server) 80 80 { … … 92 92 } 93 93 94 94 95 char *nebCreate(nebServer *server, const char *key, const char *volume, char **URI) 95 96 { 97 REQUIRE_SERVER; 98 99 if (!key) { 100 nebSetErr(server, "parameter 'key' may not be NULL"); 101 102 return NULL; 103 } 104 96 105 struct ns1__create_USCOREobjectResponse response; 97 char *filename;98 99 REQUIRE_SERVER;100 101 if (!key) {102 nebSetErr(server, "parameter 'key' may not be NULL");103 104 return NULL;105 }106 107 106 if (soap_call_ns1__create_USCOREobject(server->soap, server->endpoint, NULL, 108 107 (char *)key, (char *)volume, (char **)&response) != SOAP_OK) { … … 117 116 } 118 117 118 char *filename; 119 119 if (!nebParseURI(server, (char *)response.result, &filename)) { 120 120 nebSetErr(server, "can not parse URI"); 121 nebFree(filename); 122 121 123 return NULL; 122 124 } … … 131 133 } 132 134 135 133 136 int nebOpenCreate(nebServer *server, const char *key, const char *volume, char **URI) 134 137 { 135 char *filename;136 int file; 137 138 REQUIRE_SERVER;139 140 if (!key) {141 nebSetErr(server, "parameter 'key' may not be NULL");142 143 return -1;144 }145 146 filename = nebCreate(server, key, volume, URI);147 148 file = open(filename, O_RDWR|O_TRUNC, 0660);138 REQUIRE_SERVER; 139 140 if (!key) { 141 nebSetErr(server, "parameter 'key' may not be NULL"); 142 143 return -1; 144 } 145 146 char *filename = nebCreate(server, key, volume, URI); 147 if (!filename) { 148 return -1; 149 } 150 151 int file = open(filename, O_RDWR|O_TRUNC, 0660); 149 152 if (file == -1) { 150 153 nebSetErr(server, "can not open %s: %s", filename, strerror(errno)); … … 159 162 } 160 163 164 161 165 bool nebReplicate(nebServer *server, const char *key, const char *volume, char **URI) 162 166 { 163 struct ns1__replicate_USCOREobjectResponse response;164 char *filename;165 int sourceFH, destFH;166 167 167 REQUIRE_SERVER; 168 168 … … 177 177 // we don't do this, it's possible that open will find & open the new 178 178 // instance that we're in the process of creating 179 sourceFH = nebOpen(server, (char *)key, NEB_READ);179 int sourceFH = nebOpen(server, (char *)key, NEB_READ); 180 180 if (sourceFH == -1) { 181 181 nebSetErr(server, "can not open key %s", key); 182 nebFree(filename);183 182 184 183 return false; … … 186 185 187 186 // ask the server for a new instance attached to our key 187 struct ns1__replicate_USCOREobjectResponse response; 188 188 if (soap_call_ns1__replicate_USCOREobject(server->soap, server->endpoint, 189 189 NULL, (char *)key, (char *)volume, (char **)&response) != SOAP_OK) { … … 193 193 } 194 194 195 char *filename = NULL; 195 196 if (!nebParseURI(server, (char *)response.result, &filename)) { 196 197 nebSetErr(server, "can not parse URI"); … … 199 200 } 200 201 201 destFH = open(filename, O_RDWR|O_TRUNC, 0660);202 int destFH = open(filename, O_RDWR|O_TRUNC, 0660); 202 203 if (destFH == -1) { 203 204 nebSetErr(server, "can not open %s: %s\n", filename, strerror(errno)); … … 234 235 } 235 236 237 236 238 bool nebCull(nebServer *server, const char *key) 237 239 { 238 nebObjectInstances *locations; 239 240 REQUIRE_SERVER; 241 242 if (!key) { 243 nebSetErr(server, "parameter 'key' may not be NULL"); 244 245 return false; 246 } 247 248 locations = nebFindInstances(server, key, NULL); 240 REQUIRE_SERVER; 241 242 if (!key) { 243 nebSetErr(server, "parameter 'key' may not be NULL"); 244 245 return false; 246 } 247 248 nebObjectInstances *locations = nebFindInstances(server, key, NULL); 249 249 if (!locations || locations->n <= 1) { 250 250 nebSetErr(server, "can not cull - not enough instances"); 251 if (locations) { 252 nebObjectInstancesFree(locations); 253 } 251 254 252 255 return false; … … 264 267 } 265 268 269 266 270 bool nebLock(nebServer *server, const char *key, nebRW flag) 267 271 { 268 time_t endtime; 269 char *type; 270 int response; 271 272 REQUIRE_SERVER; 273 274 if (!key) { 275 nebSetErr(server, "parameter 'key' may not be NULL"); 276 277 return false; 278 } 279 280 type = flag == NEB_READ ? "read" : "write"; 281 282 endtime = time(NULL) + LOCK_TIMEOUT; 272 REQUIRE_SERVER; 273 274 if (!key) { 275 nebSetErr(server, "parameter 'key' may not be NULL"); 276 277 return false; 278 } 279 280 char *type = flag == NEB_READ ? "read" : "write"; 281 282 time_t endtime = time(NULL) + LOCK_TIMEOUT; 283 283 284 284 while (time(NULL) < endtime) { 285 int response; 285 286 if (soap_call_ns1__lock_USCOREobject(server->soap, server->endpoint, 286 287 NULL, (char *)key, type, &response) != SOAP_OK) { … … 302 303 } 303 304 305 304 306 bool nebUnlock(nebServer *server, const char *key, nebRW flag) 305 307 { 306 char *type; 307 int response; 308 309 REQUIRE_SERVER; 310 311 if (!key) { 312 nebSetErr(server, "parameter 'key' may not be NULL"); 313 314 return false; 315 } 316 317 type = flag == NEB_READ ? "read" : "write"; 318 308 REQUIRE_SERVER; 309 310 if (!key) { 311 nebSetErr(server, "parameter 'key' may not be NULL"); 312 313 return false; 314 } 315 316 char *type = flag == NEB_READ ? "read" : "write"; 317 318 int response; 319 319 if (soap_call_ns1__unlock_USCOREobject(server->soap, server->endpoint, 320 320 NULL, (char *)key, type, &response) != SOAP_OK) { … … 466 466 nebObjectInstances *nebFindInstances(nebServer *server, const char *key, const char *volume) 467 467 { 468 REQUIRE_SERVER; 469 470 if (!key) { 471 nebSetErr(server, "parameter 'key' may not be NULL"); 472 473 return NULL; 474 } 475 468 476 struct ns1__find_USCOREinstancesResponse response; 469 int resultElements = 0;470 char **resultArray;471 nebObjectInstances *locations = NULL;472 473 REQUIRE_SERVER;474 475 if (!key) {476 nebSetErr(server, "parameter 'key' may not be NULL");477 478 return NULL;479 }480 481 477 // FIXME is this leaking memory when response goes out of scope? the gsoap 482 478 // manual seems to 'suggest' that this is temporary data that gets cleaed … … 488 484 } 489 485 490 resultElements = response.result->__size; 491 486 int resultElements = response.result->__size; 487 488 nebObjectInstances *locations = NULL; 492 489 if (resultElements) { 493 490 locations = xmalloc(sizeof(nebObjectInstances)); 494 491 locations->n = resultElements; 495 492 496 resultArray= response.result->__ptr;493 char **resultArray = response.result->__ptr; 497 494 498 495 locations->URI = xmalloc(sizeof(char*) * resultElements); … … 508 505 } 509 506 507 510 508 void nebObjectInstancesFree(nebObjectInstances *locations) 511 509 { … … 521 519 } 522 520 521 523 522 char *nebFind(nebServer *server, const char *key) 524 523 { 525 nebObjectInstances *locations;526 char *filename;527 528 524 REQUIRE_SERVER; 529 525 … … 534 530 } 535 531 536 locations = nebFindInstances(server, key, NULL);532 nebObjectInstances *locations = nebFindInstances(server, key, NULL); 537 533 if (!locations) { 538 534 if (!strstr(nebErr(server), "no instances on storage volume")) { … … 548 544 } 549 545 546 char *filename; 550 547 if (!nebParseURI(server, locations->URI[0], &filename)) { 551 548 nebSetErr(server, "can not parse URI"); … … 560 557 } 561 558 559 562 560 int nebOpen(nebServer *server, const char *key, nebRW flag) 563 561 { 564 nebObjectInstances *locations; 565 char *filename; 566 int fh; 567 568 REQUIRE_SERVER; 569 570 if (!key) { 571 nebSetErr(server, "parameter 'key' may not be NULL"); 572 573 return -1; 574 } 575 576 locations = nebFindInstances(server, key, NULL); 562 REQUIRE_SERVER; 563 564 if (!key) { 565 nebSetErr(server, "parameter 'key' may not be NULL"); 566 567 return -1; 568 } 569 570 nebObjectInstances *locations = nebFindInstances(server, key, NULL); 577 571 if (!locations) { 578 572 nebSetErr(server, "no instances found"); … … 581 575 } 582 576 577 char *filename; 583 578 if (!nebParseURI(server, locations->URI[0], &filename)) { 584 579 nebSetErr(server, "can not parse URI"); … … 588 583 } 589 584 585 int fh = 0; 590 586 if (flag == NEB_WRITE) { 591 587 if (locations->n > 1) { … … 613 609 } 614 610 611 615 612 bool nebDelete(nebServer *server, const char *key) 616 613 { 617 nebObjectInstances *locations; 618 619 REQUIRE_SERVER; 620 621 if (!key) { 622 nebSetErr(server, "parameter 'key' may not be NULL"); 623 624 return false; 625 } 626 627 locations = nebFindInstances(server, key, "any"); 614 REQUIRE_SERVER; 615 616 if (!key) { 617 nebSetErr(server, "parameter 'key' may not be NULL"); 618 619 return false; 620 } 621 622 nebObjectInstances *locations = nebFindInstances(server, key, "any"); 628 623 if (!locations) { 629 624 nebSetErr(server, "no instances found"); … … 646 641 } 647 642 643 648 644 bool nebCopy(nebServer *server, const char *key, const char *newKey) 649 645 { 650 int sourceFH;651 int destFH;652 653 646 REQUIRE_SERVER; 654 647 … … 665 658 } 666 659 667 sourceFH = nebOpen(server, (char *)key, NEB_READ);660 int sourceFH = nebOpen(server, (char *)key, NEB_READ); 668 661 if (sourceFH < 0) { 669 662 // propigate nebOpen() error … … 672 665 } 673 666 674 destFH = nebOpenCreate(server, newKey, NULL, NULL);667 int destFH = nebOpenCreate(server, newKey, NULL, NULL); 675 668 if (destFH < 0) { 676 669 // propigate nebCreate() error … … 696 689 } 697 690 691 698 692 bool nebMove(nebServer *server, const char *key, const char *newKey) 699 693 { … … 723 717 } 724 718 719 725 720 bool nebSwap(nebServer *server, const char *key1, const char *key2) 726 721 { 727 struct ns1__create_USCOREobjectResponse response;728 729 722 REQUIRE_SERVER; 730 723 … … 741 734 } 742 735 736 struct ns1__create_USCOREobjectResponse response; 743 737 if (soap_call_ns1__swap_USCOREobjects(server->soap, server->endpoint, 744 738 NULL, (char *)key1, (char *)key2, (char **)&response) != SOAP_OK) { … … 749 743 } 750 744 745 751 746 bool nebDeleteInstance(nebServer *server, const char *key, const char *URI) 752 747 { 753 int response;754 char *filename;755 bool status;756 757 748 REQUIRE_SERVER; 758 749 … … 763 754 } 764 755 756 char *filename; 765 757 if (!nebParseURI(server, URI, &filename)) { 766 758 nebSetErr(server, "can not parse URI"); … … 769 761 } 770 762 763 int response; 771 764 if (soap_call_ns1__delete_USCOREinstance(server->soap, server->endpoint, 772 765 NULL, (char *)key, (char *)URI, &response) != SOAP_OK) { … … 776 769 } 777 770 771 bool status; 778 772 if (response > 0) { 779 773 status = nebNukeFile(server, filename); … … 787 781 } 788 782 783 789 784 nebObjectStat *nebStat(nebServer *server, const char *key) 790 785 { 791 struct ns1__stat_USCOREobjectResponse response;792 nebObjectStat *stat;793 int resultElements = 0;794 char **resultArray = NULL;795 796 786 REQUIRE_SERVER; 797 787 … … 802 792 } 803 793 804 stat = xmalloc(sizeof(nebObjectStat));794 nebObjectStat *stat = xmalloc(sizeof(nebObjectStat)); 805 795 806 796 // FIXME is this leaking memory when response goes out of scope? the gsoap 807 797 // manual seems to 'suggest' that this is temporary data that gets cleaed 808 798 // up on the next soap function call 799 struct ns1__stat_USCOREobjectResponse response; 809 800 if (soap_call_ns1__stat_USCOREobject(server->soap, server->endpoint, 810 801 NULL, (char *)key, &response) != SOAP_OK) { … … 813 804 } 814 805 815 resultElements = response.result->__size;816 resultArray = response.result->__ptr;817 818 if (resultElements != 7) {806 int resultElements = response.result->__size; 807 char **resultArray = response.result->__ptr; 808 809 if (resultElements != 8) { 819 810 nebSetErr(server, "server didn't return the proper number of stat elements"); 820 811 return NULL; 821 812 } 822 813 823 nullstrncpy(stat->so_id, resultArray[0], 256);824 nullstrncpy(stat->ext_id, resultArray[1], 256);825 nullstrncpy(stat->read_lock, resultArray[2], 256);814 stat->so_id = atol(resultArray[0]); 815 stat->ext_id = atol(resultArray[1]); 816 stat->read_lock = atoi(resultArray[2]); 826 817 nullstrncpy(stat->write_lock, resultArray[3], 256); 827 818 nullstrncpy(stat->epoch, resultArray[4], 256); 828 819 nullstrncpy(stat->mtime, resultArray[5], 256); 829 stat->instances = atoi(resultArray[6]); 820 stat->available = atoi(resultArray[6]); 821 stat->instances = atoi(resultArray[7]); 830 822 831 823 return stat; 832 824 } 833 825 826 827 void nebObjectStatFree(nebObjectStat *stat) 828 { 829 if (!stat) { 830 return; 831 } 832 833 nebFree(stat); 834 } 835 836 837 int nebChmod(nebServer *server, const char *key, mode_t mode) 838 { 839 REQUIRE_SERVER; 840 841 if (!key) { 842 nebSetErr(server, "parameter 'key' may not be NULL"); 843 844 return -1; 845 } 846 847 // FIXME is this leaking memory when response goes out of scope? the gsoap 848 // manual seems to 'suggest' that this is temporary data that gets cleaed 849 // up on the next soap function call 850 int response; 851 if (soap_call_ns1__chmod_USCOREobject(server->soap, server->endpoint, 852 NULL, (char *)key, mode, &response) != SOAP_OK) { 853 nebSetServerErr(server); 854 return -1; 855 } 856 857 return 0; 858 } 859 860 861 int nebPrune(nebServer *server, const char *key) 862 { 863 REQUIRE_SERVER; 864 865 if (!key) { 866 nebSetErr(server, "parameter 'key' may not be NULL"); 867 868 return -1; 869 } 870 871 // FIXME is this leaking memory when response goes out of scope? the gsoap 872 // manual seems to 'suggest' that this is temporary data that gets cleaed 873 // up on the next soap function call 874 int response; 875 if (soap_call_ns1__prune_USCOREobject(server->soap, server->endpoint, 876 NULL, (char *)key, &response) != SOAP_OK) { 877 nebSetServerErr(server); 878 return -1; 879 } 880 881 return response; 882 } 883 884 885 int nebThereCanBeOnlyOne(nebServer *server, const char *key, const char *volume) 886 { 887 REQUIRE_SERVER; 888 889 if (!key) { 890 nebSetErr(server, "parameter 'key' may not be NULL"); 891 892 return -1; 893 } 894 895 // first - strip off any inaccesible instances 896 if (nebPrune(server, key) < 0 ) { 897 // use the prune() method to also determine if $key is valid 898 return -1; 899 } 900 901 // check to see if there is an instance on $vol_name that should be the 902 // sole survivor 903 nebObjectInstances *locations = NULL; 904 if (volume) { 905 locations = nebFindInstances(server, key, NULL); 906 } 907 908 long removed = 0; 909 if (locations && locations->n) { 910 nebObjectInstances *instances = nebFindInstances(server, key, NULL); 911 for (long i = 0; i < instances->n; i++) { 912 if (strcmp(locations->URI[0], instances->URI[i]) == 0) { 913 continue; 914 } 915 if (!nebDeleteInstance(server, key, instances->URI[i])) { 916 nebObjectInstancesFree(instances); 917 nebObjectInstancesFree(locations); 918 return -1; 919 } 920 removed++; 921 } 922 nebObjectInstancesFree(instances); 923 nebObjectInstancesFree(locations); 924 } else { 925 nebObjectInstancesFree(locations); 926 // nuke whatever 927 nebObjectStat *stat = nebStat(server, key); 928 if (!stat) { 929 return -1; 930 } 931 932 int available = stat->available; 933 nebObjectStatFree(stat); 934 935 // start at one so cull() is called one less time then the # of 936 // instances 937 for (long i = 1; i < available; i++) { 938 if (!nebCull(server, key)) { 939 return -1; 940 } 941 removed++; 942 } 943 } 944 945 return removed; 946 } 947 948 834 949 char *nebErr(nebServer *server) 835 950 { … … 837 952 } 838 953 954 839 955 void nebFree(void *ptr) { 956 if (!ptr) { return; } 840 957 xfree(ptr); 841 958 } … … 844 961 static void p_nebSetErr(const char * filename, unsigned long lineno, const char *function, nebServer *server, const char *format, ...) 845 962 { 846 va_list args; 847 size_t err_size; 848 char err_location[ERRBUF_SIZE]; 849 size_t err_location_size; 850 851 err_location_size = snprintf(err_location, ERRBUF_SIZE, "%s:%lu %s() - ", 963 char err_location[ERRBUF_SIZE]; 964 size_t err_location_size = snprintf(err_location, ERRBUF_SIZE, "%s:%lu %s() - ", 852 965 filename, lineno, function); 853 966 … … 862 975 863 976 while (1) { 977 va_list args; 864 978 va_start(args, format); 865 979 // append error string after error location info 866 err_size = vsnprintf(980 size_t err_size = vsnprintf( 867 981 server->err_buf + err_location_size, 868 982 server->err_buf_size - err_location_size, … … 888 1002 } 889 1003 1004 890 1005 static void nebSetServerErr(nebServer *server) 891 1006 { 892 const char **code; 893 const char **string; 894 895 REQUIRE_SERVER; 896 897 code = soap_faultcode(server->soap); 898 string = soap_faultstring(server->soap); 1007 REQUIRE_SERVER; 1008 1009 const char **code = soap_faultcode(server->soap); 1010 const char **string = soap_faultstring(server->soap); 899 1011 900 1012 nebSetErr(server, "%s - %s", *code, *string); 901 1013 } 1014 902 1015 903 1016 #if NEBCOPYFILE 904 1017 static off_t nebCopyFile(nebServer *server, const char *source, const char *dest) 905 1018 { 906 int sourceFH; 907 int destFH; 908 off_t bytesCopied; 909 910 REQUIRE_SERVER; 911 912 sourceFH = open(source, O_RDONLY); 1019 REQUIRE_SERVER; 1020 1021 int sourceFH = open(source, O_RDONLY); 913 1022 if (sourceFH == -1) { 914 1023 nebSetErr(server, "can not open %s: %s", source, strerror(errno)); … … 917 1026 } 918 1027 919 destFH = open(dest, O_WRONLY|O_CREAT|O_CREAT, 0600);1028 int destFH = open(dest, O_WRONLY|O_CREAT|O_CREAT, 0600); 920 1029 if (destFH == -1) { 921 1030 nebSetErr(server, "can not open %s: %s", dest, strerror(errno)); … … 924 1033 } 925 1034 926 bytesCopied = nebCopyFilehandle(server, sourceFH, destFH);1035 off_t bytesCopied = nebCopyFilehandle(server, sourceFH, destFH); 927 1036 if (bytesCopied < 0) { 928 1037 return -1; … … 945 1054 #endif 946 1055 1056 947 1057 static off_t nebCopyFilehandle(nebServer *server, int sourceFH, int destFH) 948 1058 { 949 off_t bytesTotal; 950 off_t bytesRemaining; 951 off_t writeSize; 952 char writeBuf[64 * 1024]; 1059 REQUIRE_SERVER; 1060 953 1061 struct stat sourceStat; 954 955 REQUIRE_SERVER;956 957 1062 if(fstat(sourceFH, &sourceStat)) { 958 1063 nebSetErr(server, "can not stat filehandles: %s", strerror(errno)); … … 962 1067 963 1068 // the size of the file to copied 964 bytesTotal = sourceStat.st_size;1069 off_t bytesTotal = sourceStat.st_size; 965 1070 966 1071 /* … … 970 1075 */ 971 1076 972 bytesRemaining = bytesTotal;1077 off_t bytesRemaining = bytesTotal; 973 1078 974 1079 while (bytesRemaining) { 1080 off_t writeSize; 1081 char writeBuf[64 * 1024]; 975 1082 if (bytesRemaining <= sizeof(writeBuf)) { 976 1083 writeSize = bytesRemaining; … … 997 1104 } 998 1105 1106 999 1107 static size_t nebParseURI(nebServer *server, const char *URI, char **filename) 1000 1108 { 1001 regex_t myregex;1002 regmatch_t mymatch[2];1003 char errbuf[ERRBUF_SIZE];1004 char *pattern = "^file://(.*)$";1005 int status;1006 size_t matchStart, matchEnd;1007 size_t matchLength;1008 size_t filename_size;1009 1010 1109 REQUIRE_SERVER; 1011 1110 … … 1022 1121 } 1023 1122 1024 status = regcomp(&myregex, pattern, REG_EXTENDED); 1123 regex_t myregex; 1124 regmatch_t mymatch[2]; 1125 char *pattern = "^file://(.*)$"; 1126 char errbuf[ERRBUF_SIZE]; 1127 1128 int status = regcomp(&myregex, pattern, REG_EXTENDED); 1025 1129 if (status != 0) { 1026 1130 regerror(status, &myregex, errbuf, ERRBUF_SIZE); … … 1040 1144 regfree(&myregex); 1041 1145 1042 matchStart = (size_t)mymatch[1].rm_so;1043 matchEnd = (size_t)mymatch[1].rm_eo;1044 matchLength = matchEnd - matchStart;1146 size_t matchStart = (size_t)mymatch[1].rm_so; 1147 size_t matchEnd = (size_t)mymatch[1].rm_eo; 1148 size_t matchLength = matchEnd - matchStart; 1045 1149 1046 1150 if (matchStart == -1) { … … 1048 1152 } 1049 1153 1050 filename_size = matchLength + 1;1154 size_t filename_size = matchLength + 1; 1051 1155 *filename = xmalloc(filename_size); 1052 1156 … … 1055 1159 return strlen(*filename); 1056 1160 } 1161 1057 1162 1058 1163 static bool nebNukeFile(nebServer *server, const char *filename) … … 1074 1179 return true; 1075 1180 } 1181 1076 1182 1077 1183 static char *nullstrncpy(char *dest, const char *src, size_t n) { … … 1081 1187 } 1082 1188 1189 if (!dest) { 1190 dest = xmalloc(n + 1); 1191 } 1192 1083 1193 return strncpy(dest, src, n); 1084 1194 } -
branches/pap/Nebulous/nebclient/src/nebclient.h
r23935 r25027 11 11 #ifndef NEBCLIENT_H 12 12 #define NEBCLIENT_H 1 13 14 // #include <sys/stat.h> 13 15 14 16 #ifdef __cplusplus … … 36 38 37 39 typedef struct { 38 char so_id[256];///< storage object ID39 char ext_id[256];///< storage object key (name)40 char read_lock[256];///< read lock value40 long so_id; ///< storage object ID 41 long ext_id; ///< storage object key (name) 42 int read_lock; ///< read lock value 41 43 char write_lock[256]; ///< write lock value 42 44 char epoch[256]; ///< creation time stamp 43 45 char mtime[256]; ///< modification time stamp 44 int instances; ///< number of instances 46 int available; ///< number of available instances 47 int instances; ///< total number of instances 45 48 } nebObjectStat; 46 49 … … 293 296 nebObjectStat *nebStat( 294 297 nebServer *server, ///< nebServer object 295 const char *key /// storage object key (name) 298 const char *key ///< storage object key (name) 299 ); 300 301 302 /** Deallocates a stat object 303 */ 304 void nebObjectStatFree( 305 nebObjectStat *stat ///< nebObjectStat object 306 ); 307 308 /** Change permissions of a storage objects 309 * 310 * This function will change the file permissions of all currently on disk 311 * instances of a storage object. 312 * 313 * @return the new mode or NULL on failure. 314 */ 315 316 int nebChmod( 317 nebServer *server, ///< nebServer object 318 const char *key, ///< storage object key (name) 319 mode_t mode ///< chmod(2) compatible mode (mode_t) 320 ); 321 322 /** Removes all of the inaccessible instances from an object 323 * 324 * @return the number of inaccessible instances removed 325 */ 326 327 int nebPrune( 328 nebServer *server, ///< nebServer object 329 const char *key ///< storage object key (name) 330 ); 331 332 /** Removes all but one instances of an object 333 * 334 * @return the number of available instances removed 335 */ 336 337 int nebThereCanBeOnlyOne( 338 nebServer *server, ///< nebServer object 339 const char *key, ///< storage object key (name) 340 const char *volume ///< leave remain instance on this volume 296 341 ); 297 342 -
branches/pap/Nebulous/nebclient/src/nebulous.h
r23935 r25027 1 1 /* src/nebulous.h 2 2 Generated by wsdl2h 1.2.12 from nebulous.wsdl and typemap.dat 3 2009-0 4-20 22:15:21GMT3 2009-07-25 01:30:29 GMT 4 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: … … 119 119 - @ref ns1__delete_USCOREinstance 120 120 - @ref ns1__stat_USCOREobject 121 - @ref ns1__chmod_USCOREobject 122 - @ref ns1__prune_USCOREobject 121 123 122 124 @section SOAP_ports Endpoints of Binding "SOAP" … … 893 895 ); 894 896 897 /******************************************************************************\ 898 * * 899 * ns1__chmod_USCOREobject * 900 * * 901 \******************************************************************************/ 902 903 904 /// Operation "ns1__chmod_USCOREobject" of service binding "SOAP" 905 906 /** 907 908 Operation details: 909 910 - SOAP RPC encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 911 - SOAP action="urn:Nebulous/Server/SOAP#chmod_object" 912 913 C stub function (defined in soapClient.c[pp] generated by soapcpp2): 914 @code 915 int soap_call_ns1__chmod_USCOREobject( 916 struct soap *soap, 917 NULL, // char *endpoint = NULL selects default endpoint for this operation 918 NULL, // char *action = NULL selects default action for this operation 919 // request parameters: 920 char* key, 921 int mode, 922 // response parameters: 923 int *result 924 ); 925 @endcode 926 927 C server function (called from the service dispatcher defined in soapServer.c[pp]): 928 @code 929 int ns1__chmod_USCOREobject( 930 struct soap *soap, 931 // request parameters: 932 char* key, 933 int mode, 934 // response parameters: 935 int *result 936 ); 937 @endcode 938 939 */ 940 941 //gsoap ns1 service method-style: chmod_USCOREobject rpc 942 //gsoap ns1 service method-encoding: chmod_USCOREobject http://schemas.xmlsoap.org/soap/encoding/ 943 //gsoap ns1 service method-action: chmod_USCOREobject urn:Nebulous/Server/SOAP#chmod_object 944 int ns1__chmod_USCOREobject( 945 char* key, ///< Request parameter 946 int mode, ///< Request parameter 947 int *result ///< Response parameter 948 ); 949 950 /******************************************************************************\ 951 * * 952 * ns1__prune_USCOREobject * 953 * * 954 \******************************************************************************/ 955 956 957 /// Operation "ns1__prune_USCOREobject" of service binding "SOAP" 958 959 /** 960 961 Operation details: 962 963 - SOAP RPC encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 964 - SOAP action="urn:Nebulous/Server/SOAP#prune_object" 965 966 C stub function (defined in soapClient.c[pp] generated by soapcpp2): 967 @code 968 int soap_call_ns1__prune_USCOREobject( 969 struct soap *soap, 970 NULL, // char *endpoint = NULL selects default endpoint for this operation 971 NULL, // char *action = NULL selects default action for this operation 972 // request parameters: 973 char* key, 974 // response parameters: 975 int *result 976 ); 977 @endcode 978 979 C server function (called from the service dispatcher defined in soapServer.c[pp]): 980 @code 981 int ns1__prune_USCOREobject( 982 struct soap *soap, 983 // request parameters: 984 char* key, 985 // response parameters: 986 int *result 987 ); 988 @endcode 989 990 */ 991 992 //gsoap ns1 service method-style: prune_USCOREobject rpc 993 //gsoap ns1 service method-encoding: prune_USCOREobject http://schemas.xmlsoap.org/soap/encoding/ 994 //gsoap ns1 service method-action: prune_USCOREobject urn:Nebulous/Server/SOAP#prune_object 995 int ns1__prune_USCOREobject( 996 char* key, ///< Request parameter 997 int *result ///< Response parameter 998 ); 999 895 1000 /* End of src/nebulous.h */ -
branches/pap/Nebulous/nebclient/src/soapC.c
r23935 r25027 12 12 #endif 13 13 14 SOAP_SOURCE_STAMP("@(#) soapC.c ver 2.7.12 2009-0 4-20 22:15:22GMT")14 SOAP_SOURCE_STAMP("@(#) soapC.c ver 2.7.12 2009-07-25 01:30:29 GMT") 15 15 16 16 … … 161 161 case SOAP_TYPE_int: 162 162 return soap_in_int(soap, NULL, NULL, "xsd:int"); 163 case SOAP_TYPE_ns1__prune_USCOREobject: 164 return soap_in_ns1__prune_USCOREobject(soap, NULL, NULL, "ns1:prune_object"); 165 case SOAP_TYPE_ns1__prune_USCOREobjectResponse: 166 return soap_in_ns1__prune_USCOREobjectResponse(soap, NULL, NULL, "ns1:prune_objectResponse"); 167 case SOAP_TYPE_ns1__chmod_USCOREobject: 168 return soap_in_ns1__chmod_USCOREobject(soap, NULL, NULL, "ns1:chmod_object"); 169 case SOAP_TYPE_ns1__chmod_USCOREobjectResponse: 170 return soap_in_ns1__chmod_USCOREobjectResponse(soap, NULL, NULL, "ns1:chmod_objectResponse"); 163 171 case SOAP_TYPE_ns1__stat_USCOREobject: 164 172 return soap_in_ns1__stat_USCOREobject(soap, NULL, NULL, "ns1:stat_object"); … … 250 258 return soap_in_int(soap, NULL, NULL, NULL); 251 259 } 260 if (!soap_match_tag(soap, t, "ns1:prune_object")) 261 { *type = SOAP_TYPE_ns1__prune_USCOREobject; 262 return soap_in_ns1__prune_USCOREobject(soap, NULL, NULL, NULL); 263 } 264 if (!soap_match_tag(soap, t, "ns1:prune_objectResponse")) 265 { *type = SOAP_TYPE_ns1__prune_USCOREobjectResponse; 266 return soap_in_ns1__prune_USCOREobjectResponse(soap, NULL, NULL, NULL); 267 } 268 if (!soap_match_tag(soap, t, "ns1:chmod_object")) 269 { *type = SOAP_TYPE_ns1__chmod_USCOREobject; 270 return soap_in_ns1__chmod_USCOREobject(soap, NULL, NULL, NULL); 271 } 272 if (!soap_match_tag(soap, t, "ns1:chmod_objectResponse")) 273 { *type = SOAP_TYPE_ns1__chmod_USCOREobjectResponse; 274 return soap_in_ns1__chmod_USCOREobjectResponse(soap, NULL, NULL, NULL); 275 } 252 276 if (!soap_match_tag(soap, t, "ns1:stat_object")) 253 277 { *type = SOAP_TYPE_ns1__stat_USCOREobject; … … 440 464 case SOAP_TYPE_int: 441 465 return soap_out_int(soap, tag, id, (const int *)ptr, "xsd:int"); 466 case SOAP_TYPE_ns1__prune_USCOREobject: 467 return soap_out_ns1__prune_USCOREobject(soap, tag, id, (const struct ns1__prune_USCOREobject *)ptr, "ns1:prune_object"); 468 case SOAP_TYPE_ns1__prune_USCOREobjectResponse: 469 return soap_out_ns1__prune_USCOREobjectResponse(soap, tag, id, (const struct ns1__prune_USCOREobjectResponse *)ptr, "ns1:prune_objectResponse"); 470 case SOAP_TYPE_ns1__chmod_USCOREobject: 471 return soap_out_ns1__chmod_USCOREobject(soap, tag, id, (const struct ns1__chmod_USCOREobject *)ptr, "ns1:chmod_object"); 472 case SOAP_TYPE_ns1__chmod_USCOREobjectResponse: 473 return soap_out_ns1__chmod_USCOREobjectResponse(soap, tag, id, (const struct ns1__chmod_USCOREobjectResponse *)ptr, "ns1:chmod_objectResponse"); 442 474 case SOAP_TYPE_ns1__stat_USCOREobject: 443 475 return soap_out_ns1__stat_USCOREobject(soap, tag, id, (const struct ns1__stat_USCOREobject *)ptr, "ns1:stat_object"); … … 527 559 switch (type) 528 560 { 561 case SOAP_TYPE_ns1__prune_USCOREobject: 562 soap_serialize_ns1__prune_USCOREobject(soap, (const struct ns1__prune_USCOREobject *)ptr); 563 break; 564 case SOAP_TYPE_ns1__prune_USCOREobjectResponse: 565 soap_serialize_ns1__prune_USCOREobjectResponse(soap, (const struct ns1__prune_USCOREobjectResponse *)ptr); 566 break; 567 case SOAP_TYPE_ns1__chmod_USCOREobject: 568 soap_serialize_ns1__chmod_USCOREobject(soap, (const struct ns1__chmod_USCOREobject *)ptr); 569 break; 570 case SOAP_TYPE_ns1__chmod_USCOREobjectResponse: 571 soap_serialize_ns1__chmod_USCOREobjectResponse(soap, (const struct ns1__chmod_USCOREobjectResponse *)ptr); 572 break; 529 573 case SOAP_TYPE_ns1__stat_USCOREobject: 530 574 soap_serialize_ns1__stat_USCOREobject(soap, (const struct ns1__stat_USCOREobject *)ptr); … … 1195 1239 #endif 1196 1240 1241 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__prune_USCOREobject(struct soap *soap, struct ns1__prune_USCOREobject *a) 1242 { 1243 (void)soap; (void)a; /* appease -Wall -Werror */ 1244 soap_default_string(soap, &a->key); 1245 } 1246 1247 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__prune_USCOREobject(struct soap *soap, const struct ns1__prune_USCOREobject *a) 1248 { 1249 (void)soap; (void)a; /* appease -Wall -Werror */ 1250 soap_serialize_string(soap, &a->key); 1251 } 1252 1253 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__prune_USCOREobject(struct soap *soap, const struct ns1__prune_USCOREobject *a, const char *tag, const char *type) 1254 { 1255 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__prune_USCOREobject); 1256 if (soap_out_ns1__prune_USCOREobject(soap, tag, id, a, type)) 1257 return soap->error; 1258 return soap_putindependent(soap); 1259 } 1260 1261 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__prune_USCOREobject(struct soap *soap, const char *tag, int id, const struct ns1__prune_USCOREobject *a, const char *type) 1262 { 1263 if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__prune_USCOREobject), type)) 1264 return soap->error; 1265 if (soap_out_string(soap, "key", -1, &a->key, "")) 1266 return soap->error; 1267 return soap_element_end_out(soap, tag); 1268 } 1269 1270 SOAP_FMAC3 struct ns1__prune_USCOREobject * SOAP_FMAC4 soap_get_ns1__prune_USCOREobject(struct soap *soap, struct ns1__prune_USCOREobject *p, const char *tag, const char *type) 1271 { 1272 if ((p = soap_in_ns1__prune_USCOREobject(soap, tag, p, type))) 1273 if (soap_getindependent(soap)) 1274 return NULL; 1275 return p; 1276 } 1277 1278 SOAP_FMAC3 struct ns1__prune_USCOREobject * SOAP_FMAC4 soap_in_ns1__prune_USCOREobject(struct soap *soap, const char *tag, struct ns1__prune_USCOREobject *a, const char *type) 1279 { 1280 size_t soap_flag_key = 1; 1281 if (soap_element_begin_in(soap, tag, 0, type)) 1282 return NULL; 1283 a = (struct ns1__prune_USCOREobject *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__prune_USCOREobject, sizeof(struct ns1__prune_USCOREobject), 0, NULL, NULL, NULL); 1284 if (!a) 1285 return NULL; 1286 soap_default_ns1__prune_USCOREobject(soap, a); 1287 if (soap->body && !*soap->href) 1288 { 1289 for (;;) 1290 { soap->error = SOAP_TAG_MISMATCH; 1291 if (soap_flag_key && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 1292 if (soap_in_string(soap, "key", &a->key, "xsd:string")) 1293 { soap_flag_key--; 1294 continue; 1295 } 1296 if (soap->error == SOAP_TAG_MISMATCH) 1297 soap->error = soap_ignore_element(soap); 1298 if (soap->error == SOAP_NO_TAG) 1299 break; 1300 if (soap->error) 1301 return NULL; 1302 } 1303 if (soap_element_end_in(soap, tag)) 1304 return NULL; 1305 } 1306 else 1307 { a = (struct ns1__prune_USCOREobject *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__prune_USCOREobject, 0, sizeof(struct ns1__prune_USCOREobject), 0, NULL); 1308 if (soap->body && soap_element_end_in(soap, tag)) 1309 return NULL; 1310 } 1311 return a; 1312 } 1313 1314 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__prune_USCOREobjectResponse(struct soap *soap, struct ns1__prune_USCOREobjectResponse *a) 1315 { 1316 (void)soap; (void)a; /* appease -Wall -Werror */ 1317 a->result = NULL; 1318 } 1319 1320 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__prune_USCOREobjectResponse(struct soap *soap, const struct ns1__prune_USCOREobjectResponse *a) 1321 { 1322 (void)soap; (void)a; /* appease -Wall -Werror */ 1323 soap_serialize_PointerToint(soap, &a->result); 1324 } 1325 1326 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__prune_USCOREobjectResponse(struct soap *soap, const struct ns1__prune_USCOREobjectResponse *a, const char *tag, const char *type) 1327 { 1328 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__prune_USCOREobjectResponse); 1329 if (soap_out_ns1__prune_USCOREobjectResponse(soap, tag, id, a, type)) 1330 return soap->error; 1331 return soap_putindependent(soap); 1332 } 1333 1334 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__prune_USCOREobjectResponse(struct soap *soap, const char *tag, int id, const struct ns1__prune_USCOREobjectResponse *a, const char *type) 1335 { 1336 if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__prune_USCOREobjectResponse), type)) 1337 return soap->error; 1338 if (soap_out_PointerToint(soap, "result", -1, &a->result, "")) 1339 return soap->error; 1340 return soap_element_end_out(soap, tag); 1341 } 1342 1343 SOAP_FMAC3 struct ns1__prune_USCOREobjectResponse * SOAP_FMAC4 soap_get_ns1__prune_USCOREobjectResponse(struct soap *soap, struct ns1__prune_USCOREobjectResponse *p, const char *tag, const char *type) 1344 { 1345 if ((p = soap_in_ns1__prune_USCOREobjectResponse(soap, tag, p, type))) 1346 if (soap_getindependent(soap)) 1347 return NULL; 1348 return p; 1349 } 1350 1351 SOAP_FMAC3 struct ns1__prune_USCOREobjectResponse * SOAP_FMAC4 soap_in_ns1__prune_USCOREobjectResponse(struct soap *soap, const char *tag, struct ns1__prune_USCOREobjectResponse *a, const char *type) 1352 { 1353 size_t soap_flag_result = 1; 1354 if (soap_element_begin_in(soap, tag, 0, type)) 1355 return NULL; 1356 a = (struct ns1__prune_USCOREobjectResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__prune_USCOREobjectResponse, sizeof(struct ns1__prune_USCOREobjectResponse), 0, NULL, NULL, NULL); 1357 if (!a) 1358 return NULL; 1359 soap_default_ns1__prune_USCOREobjectResponse(soap, a); 1360 if (soap->body && !*soap->href) 1361 { 1362 for (;;) 1363 { soap->error = SOAP_TAG_MISMATCH; 1364 if (soap_flag_result && soap->error == SOAP_TAG_MISMATCH) 1365 if (soap_in_PointerToint(soap, "result", &a->result, "xsd:int")) 1366 { soap_flag_result--; 1367 continue; 1368 } 1369 if (soap->error == SOAP_TAG_MISMATCH) 1370 soap->error = soap_ignore_element(soap); 1371 if (soap->error == SOAP_NO_TAG) 1372 break; 1373 if (soap->error) 1374 return NULL; 1375 } 1376 if (soap_element_end_in(soap, tag)) 1377 return NULL; 1378 } 1379 else 1380 { a = (struct ns1__prune_USCOREobjectResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__prune_USCOREobjectResponse, 0, sizeof(struct ns1__prune_USCOREobjectResponse), 0, NULL); 1381 if (soap->body && soap_element_end_in(soap, tag)) 1382 return NULL; 1383 } 1384 return a; 1385 } 1386 1387 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__chmod_USCOREobject(struct soap *soap, struct ns1__chmod_USCOREobject *a) 1388 { 1389 (void)soap; (void)a; /* appease -Wall -Werror */ 1390 soap_default_string(soap, &a->key); 1391 soap_default_int(soap, &a->mode); 1392 } 1393 1394 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__chmod_USCOREobject(struct soap *soap, const struct ns1__chmod_USCOREobject *a) 1395 { 1396 (void)soap; (void)a; /* appease -Wall -Werror */ 1397 soap_serialize_string(soap, &a->key); 1398 soap_embedded(soap, &a->mode, SOAP_TYPE_int); 1399 } 1400 1401 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__chmod_USCOREobject(struct soap *soap, const struct ns1__chmod_USCOREobject *a, const char *tag, const char *type) 1402 { 1403 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__chmod_USCOREobject); 1404 if (soap_out_ns1__chmod_USCOREobject(soap, tag, id, a, type)) 1405 return soap->error; 1406 return soap_putindependent(soap); 1407 } 1408 1409 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__chmod_USCOREobject(struct soap *soap, const char *tag, int id, const struct ns1__chmod_USCOREobject *a, const char *type) 1410 { 1411 if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__chmod_USCOREobject), type)) 1412 return soap->error; 1413 if (soap_out_string(soap, "key", -1, &a->key, "")) 1414 return soap->error; 1415 if (soap_out_int(soap, "mode", -1, &a->mode, "")) 1416 return soap->error; 1417 return soap_element_end_out(soap, tag); 1418 } 1419 1420 SOAP_FMAC3 struct ns1__chmod_USCOREobject * SOAP_FMAC4 soap_get_ns1__chmod_USCOREobject(struct soap *soap, struct ns1__chmod_USCOREobject *p, const char *tag, const char *type) 1421 { 1422 if ((p = soap_in_ns1__chmod_USCOREobject(soap, tag, p, type))) 1423 if (soap_getindependent(soap)) 1424 return NULL; 1425 return p; 1426 } 1427 1428 SOAP_FMAC3 struct ns1__chmod_USCOREobject * SOAP_FMAC4 soap_in_ns1__chmod_USCOREobject(struct soap *soap, const char *tag, struct ns1__chmod_USCOREobject *a, const char *type) 1429 { 1430 size_t soap_flag_key = 1; 1431 size_t soap_flag_mode = 1; 1432 if (soap_element_begin_in(soap, tag, 0, type)) 1433 return NULL; 1434 a = (struct ns1__chmod_USCOREobject *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__chmod_USCOREobject, sizeof(struct ns1__chmod_USCOREobject), 0, NULL, NULL, NULL); 1435 if (!a) 1436 return NULL; 1437 soap_default_ns1__chmod_USCOREobject(soap, a); 1438 if (soap->body && !*soap->href) 1439 { 1440 for (;;) 1441 { soap->error = SOAP_TAG_MISMATCH; 1442 if (soap_flag_key && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) 1443 if (soap_in_string(soap, "key", &a->key, "xsd:string")) 1444 { soap_flag_key--; 1445 continue; 1446 } 1447 if (soap_flag_mode && soap->error == SOAP_TAG_MISMATCH) 1448 if (soap_in_int(soap, "mode", &a->mode, "xsd:int")) 1449 { soap_flag_mode--; 1450 continue; 1451 } 1452 if (soap->error == SOAP_TAG_MISMATCH) 1453 soap->error = soap_ignore_element(soap); 1454 if (soap->error == SOAP_NO_TAG) 1455 break; 1456 if (soap->error) 1457 return NULL; 1458 } 1459 if (soap_element_end_in(soap, tag)) 1460 return NULL; 1461 } 1462 else 1463 { a = (struct ns1__chmod_USCOREobject *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__chmod_USCOREobject, 0, sizeof(struct ns1__chmod_USCOREobject), 0, NULL); 1464 if (soap->body && soap_element_end_in(soap, tag)) 1465 return NULL; 1466 } 1467 if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_mode > 0)) 1468 { soap->error = SOAP_OCCURS; 1469 return NULL; 1470 } 1471 return a; 1472 } 1473 1474 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__chmod_USCOREobjectResponse(struct soap *soap, struct ns1__chmod_USCOREobjectResponse *a) 1475 { 1476 (void)soap; (void)a; /* appease -Wall -Werror */ 1477 a->result = NULL; 1478 } 1479 1480 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__chmod_USCOREobjectResponse(struct soap *soap, const struct ns1__chmod_USCOREobjectResponse *a) 1481 { 1482 (void)soap; (void)a; /* appease -Wall -Werror */ 1483 soap_serialize_PointerToint(soap, &a->result); 1484 } 1485 1486 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__chmod_USCOREobjectResponse(struct soap *soap, const struct ns1__chmod_USCOREobjectResponse *a, const char *tag, const char *type) 1487 { 1488 register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__chmod_USCOREobjectResponse); 1489 if (soap_out_ns1__chmod_USCOREobjectResponse(soap, tag, id, a, type)) 1490 return soap->error; 1491 return soap_putindependent(soap); 1492 } 1493 1494 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__chmod_USCOREobjectResponse(struct soap *soap, const char *tag, int id, const struct ns1__chmod_USCOREobjectResponse *a, const char *type) 1495 { 1496 if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__chmod_USCOREobjectResponse), type)) 1497 return soap->error; 1498 if (soap_out_PointerToint(soap, "result", -1, &a->result, "")) 1499 return soap->error; 1500 return soap_element_end_out(soap, tag); 1501 } 1502 1503 SOAP_FMAC3 struct ns1__chmod_USCOREobjectResponse * SOAP_FMAC4 soap_get_ns1__chmod_USCOREobjectResponse(struct soap *soap, struct ns1__chmod_USCOREobjectResponse *p, const char *tag, const char *type) 1504 { 1505 if ((p = soap_in_ns1__chmod_USCOREobjectResponse(soap, tag, p, type))) 1506 if (soap_getindependent(soap)) 1507 return NULL; 1508 return p; 1509 } 1510 1511 SOAP_FMAC3 struct ns1__chmod_USCOREobjectResponse * SOAP_FMAC4 soap_in_ns1__chmod_USCOREobjectResponse(struct soap *soap, const char *tag, struct ns1__chmod_USCOREobjectResponse *a, const char *type) 1512 { 1513 size_t soap_flag_result = 1; 1514 if (soap_element_begin_in(soap, tag, 0, type)) 1515 return NULL; 1516 a = (struct ns1__chmod_USCOREobjectResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__chmod_USCOREobjectResponse, sizeof(struct ns1__chmod_USCOREobjectResponse), 0, NULL, NULL, NULL); 1517 if (!a) 1518 return NULL; 1519 soap_default_ns1__chmod_USCOREobjectResponse(soap, a); 1520 if (soap->body && !*soap->href) 1521 { 1522 for (;;) 1523 { soap->error = SOAP_TAG_MISMATCH; 1524 if (soap_flag_result && soap->error == SOAP_TAG_MISMATCH) 1525 if (soap_in_PointerToint(soap, "result", &a->result, "xsd:int")) 1526 { soap_flag_result--; 1527 continue; 1528 } 1529 if (soap->error == SOAP_TAG_MISMATCH) 1530 soap->error = soap_ignore_element(soap); 1531 if (soap->error == SOAP_NO_TAG) 1532 break; 1533 if (soap->error) 1534 return NULL; 1535 } 1536 if (soap_element_end_in(soap, tag)) 1537 return NULL; 1538 } 1539 else 1540 { a = (struct ns1__chmod_USCOREobjectResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__chmod_USCOREobjectResponse, 0, sizeof(struct ns1__chmod_USCOREobjectResponse), 0, NULL); 1541 if (soap->body && soap_element_end_in(soap, tag)) 1542 return NULL; 1543 } 1544 return a; 1545 } 1546 1197 1547 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__stat_USCOREobject(struct soap *soap, struct ns1__stat_USCOREobject *a) 1198 1548 { -
branches/pap/Nebulous/nebclient/src/soapClient.c
r23935 r25027 10 10 #endif 11 11 12 SOAP_SOURCE_STAMP("@(#) soapClient.c ver 2.7.12 2009-0 4-20 22:15:21GMT")12 SOAP_SOURCE_STAMP("@(#) soapClient.c ver 2.7.12 2009-07-25 01:30:29 GMT") 13 13 14 14 … … 812 812 } 813 813 814 SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__chmod_USCOREobject(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *key, int mode, int *result) 815 { struct ns1__chmod_USCOREobject soap_tmp_ns1__chmod_USCOREobject; 816 struct ns1__chmod_USCOREobjectResponse *soap_tmp_ns1__chmod_USCOREobjectResponse; 817 if (!soap_endpoint) 818 soap_endpoint = "http://localhost:80/nebulous"; 819 if (!soap_action) 820 soap_action = "urn:Nebulous/Server/SOAP#chmod_object"; 821 soap->encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/"; 822 soap_tmp_ns1__chmod_USCOREobject.key = key; 823 soap_tmp_ns1__chmod_USCOREobject.mode = mode; 824 soap_begin(soap); 825 soap_serializeheader(soap); 826 soap_serialize_ns1__chmod_USCOREobject(soap, &soap_tmp_ns1__chmod_USCOREobject); 827 if (soap_begin_count(soap)) 828 return soap->error; 829 if (soap->mode & SOAP_IO_LENGTH) 830 { if (soap_envelope_begin_out(soap) 831 || soap_putheader(soap) 832 || soap_body_begin_out(soap) 833 || soap_put_ns1__chmod_USCOREobject(soap, &soap_tmp_ns1__chmod_USCOREobject, "ns1:chmod_object", "") 834 || soap_body_end_out(soap) 835 || soap_envelope_end_out(soap)) 836 return soap->error; 837 } 838 if (soap_end_count(soap)) 839 return soap->error; 840 if (soap_connect(soap, soap_endpoint, soap_action) 841 || soap_envelope_begin_out(soap) 842 || soap_putheader(soap) 843 || soap_body_begin_out(soap) 844 || soap_put_ns1__chmod_USCOREobject(soap, &soap_tmp_ns1__chmod_USCOREobject, "ns1:chmod_object", "") 845 || soap_body_end_out(soap) 846 || soap_envelope_end_out(soap) 847 || soap_end_send(soap)) 848 return soap_closesock(soap); 849 if (!result) 850 return soap_closesock(soap); 851 soap_default_int(soap, result); 852 if (soap_begin_recv(soap) 853 || soap_envelope_begin_in(soap) 854 || soap_recv_header(soap) 855 || soap_body_begin_in(soap)) 856 return soap_closesock(soap); 857 soap_tmp_ns1__chmod_USCOREobjectResponse = soap_get_ns1__chmod_USCOREobjectResponse(soap, NULL, "ns1:chmod_objectResponse", ""); 858 if (soap->error) 859 { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) 860 return soap_recv_fault(soap); 861 return soap_closesock(soap); 862 } 863 if (soap_body_end_in(soap) 864 || soap_envelope_end_in(soap) 865 || soap_end_recv(soap)) 866 return soap_closesock(soap); 867 if (result && soap_tmp_ns1__chmod_USCOREobjectResponse->result) 868 *result = *soap_tmp_ns1__chmod_USCOREobjectResponse->result; 869 return soap_closesock(soap); 870 } 871 872 SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__prune_USCOREobject(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *key, int *result) 873 { struct ns1__prune_USCOREobject soap_tmp_ns1__prune_USCOREobject; 874 struct ns1__prune_USCOREobjectResponse *soap_tmp_ns1__prune_USCOREobjectResponse; 875 if (!soap_endpoint) 876 soap_endpoint = "http://localhost:80/nebulous"; 877 if (!soap_action) 878 soap_action = "urn:Nebulous/Server/SOAP#prune_object"; 879 soap->encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/"; 880 soap_tmp_ns1__prune_USCOREobject.key = key; 881 soap_begin(soap); 882 soap_serializeheader(soap); 883 soap_serialize_ns1__prune_USCOREobject(soap, &soap_tmp_ns1__prune_USCOREobject); 884 if (soap_begin_count(soap)) 885 return soap->error; 886 if (soap->mode & SOAP_IO_LENGTH) 887 { if (soap_envelope_begin_out(soap) 888 || soap_putheader(soap) 889 || soap_body_begin_out(soap) 890 || soap_put_ns1__prune_USCOREobject(soap, &soap_tmp_ns1__prune_USCOREobject, "ns1:prune_object", "") 891 || soap_body_end_out(soap) 892 || soap_envelope_end_out(soap)) 893 return soap->error; 894 } 895 if (soap_end_count(soap)) 896 return soap->error; 897 if (soap_connect(soap, soap_endpoint, soap_action) 898 || soap_envelope_begin_out(soap) 899 || soap_putheader(soap) 900 || soap_body_begin_out(soap) 901 || soap_put_ns1__prune_USCOREobject(soap, &soap_tmp_ns1__prune_USCOREobject, "ns1:prune_object", "") 902 || soap_body_end_out(soap) 903 || soap_envelope_end_out(soap) 904 || soap_end_send(soap)) 905 return soap_closesock(soap); 906 if (!result) 907 return soap_closesock(soap); 908 soap_default_int(soap, result); 909 if (soap_begin_recv(soap) 910 || soap_envelope_begin_in(soap) 911 || soap_recv_header(soap) 912 || soap_body_begin_in(soap)) 913 return soap_closesock(soap); 914 soap_tmp_ns1__prune_USCOREobjectResponse = soap_get_ns1__prune_USCOREobjectResponse(soap, NULL, "ns1:prune_objectResponse", ""); 915 if (soap->error) 916 { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) 917 return soap_recv_fault(soap); 918 return soap_closesock(soap); 919 } 920 if (soap_body_end_in(soap) 921 || soap_envelope_end_in(soap) 922 || soap_end_recv(soap)) 923 return soap_closesock(soap); 924 if (result && soap_tmp_ns1__prune_USCOREobjectResponse->result) 925 *result = *soap_tmp_ns1__prune_USCOREobjectResponse->result; 926 return soap_closesock(soap); 927 } 928 814 929 #ifdef __cplusplus 815 930 } -
branches/pap/Nebulous/nebclient/src/soapH.h
r23198 r25027 42 42 43 43 #ifndef SOAP_TYPE_SOAP_ENV__Fault 44 #define SOAP_TYPE_SOAP_ENV__Fault ( 64)44 #define SOAP_TYPE_SOAP_ENV__Fault (70) 45 45 #endif 46 46 SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Fault(struct soap*, struct SOAP_ENV__Fault *); … … 56 56 57 57 #ifndef SOAP_TYPE_SOAP_ENV__Reason 58 #define SOAP_TYPE_SOAP_ENV__Reason (6 3)58 #define SOAP_TYPE_SOAP_ENV__Reason (69) 59 59 #endif 60 60 SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *); … … 70 70 71 71 #ifndef SOAP_TYPE_SOAP_ENV__Detail 72 #define SOAP_TYPE_SOAP_ENV__Detail (6 0)72 #define SOAP_TYPE_SOAP_ENV__Detail (66) 73 73 #endif 74 74 SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *); … … 84 84 85 85 #ifndef SOAP_TYPE_SOAP_ENV__Code 86 #define SOAP_TYPE_SOAP_ENV__Code ( 58)86 #define SOAP_TYPE_SOAP_ENV__Code (64) 87 87 #endif 88 88 SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *); … … 98 98 99 99 #ifndef SOAP_TYPE_SOAP_ENV__Header 100 #define SOAP_TYPE_SOAP_ENV__Header ( 57)100 #define SOAP_TYPE_SOAP_ENV__Header (63) 101 101 #endif 102 102 SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Header(struct soap*, struct SOAP_ENV__Header *); … … 109 109 #endif 110 110 111 #ifndef SOAP_TYPE_ns1__prune_USCOREobject 112 #define SOAP_TYPE_ns1__prune_USCOREobject (62) 113 #endif 114 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__prune_USCOREobject(struct soap*, struct ns1__prune_USCOREobject *); 115 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__prune_USCOREobject(struct soap*, const struct ns1__prune_USCOREobject *); 116 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__prune_USCOREobject(struct soap*, const struct ns1__prune_USCOREobject *, const char*, const char*); 117 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__prune_USCOREobject(struct soap*, const char*, int, const struct ns1__prune_USCOREobject *, const char*); 118 SOAP_FMAC3 struct ns1__prune_USCOREobject * SOAP_FMAC4 soap_get_ns1__prune_USCOREobject(struct soap*, struct ns1__prune_USCOREobject *, const char*, const char*); 119 SOAP_FMAC3 struct ns1__prune_USCOREobject * SOAP_FMAC4 soap_in_ns1__prune_USCOREobject(struct soap*, const char*, struct ns1__prune_USCOREobject *, const char*); 120 121 #ifndef SOAP_TYPE_ns1__prune_USCOREobjectResponse 122 #define SOAP_TYPE_ns1__prune_USCOREobjectResponse (61) 123 #endif 124 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__prune_USCOREobjectResponse(struct soap*, struct ns1__prune_USCOREobjectResponse *); 125 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__prune_USCOREobjectResponse(struct soap*, const struct ns1__prune_USCOREobjectResponse *); 126 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__prune_USCOREobjectResponse(struct soap*, const struct ns1__prune_USCOREobjectResponse *, const char*, const char*); 127 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__prune_USCOREobjectResponse(struct soap*, const char*, int, const struct ns1__prune_USCOREobjectResponse *, const char*); 128 SOAP_FMAC3 struct ns1__prune_USCOREobjectResponse * SOAP_FMAC4 soap_get_ns1__prune_USCOREobjectResponse(struct soap*, struct ns1__prune_USCOREobjectResponse *, const char*, const char*); 129 SOAP_FMAC3 struct ns1__prune_USCOREobjectResponse * SOAP_FMAC4 soap_in_ns1__prune_USCOREobjectResponse(struct soap*, const char*, struct ns1__prune_USCOREobjectResponse *, const char*); 130 131 #ifndef SOAP_TYPE_ns1__chmod_USCOREobject 132 #define SOAP_TYPE_ns1__chmod_USCOREobject (59) 133 #endif 134 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__chmod_USCOREobject(struct soap*, struct ns1__chmod_USCOREobject *); 135 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__chmod_USCOREobject(struct soap*, const struct ns1__chmod_USCOREobject *); 136 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__chmod_USCOREobject(struct soap*, const struct ns1__chmod_USCOREobject *, const char*, const char*); 137 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__chmod_USCOREobject(struct soap*, const char*, int, const struct ns1__chmod_USCOREobject *, const char*); 138 SOAP_FMAC3 struct ns1__chmod_USCOREobject * SOAP_FMAC4 soap_get_ns1__chmod_USCOREobject(struct soap*, struct ns1__chmod_USCOREobject *, const char*, const char*); 139 SOAP_FMAC3 struct ns1__chmod_USCOREobject * SOAP_FMAC4 soap_in_ns1__chmod_USCOREobject(struct soap*, const char*, struct ns1__chmod_USCOREobject *, const char*); 140 141 #ifndef SOAP_TYPE_ns1__chmod_USCOREobjectResponse 142 #define SOAP_TYPE_ns1__chmod_USCOREobjectResponse (58) 143 #endif 144 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__chmod_USCOREobjectResponse(struct soap*, struct ns1__chmod_USCOREobjectResponse *); 145 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__chmod_USCOREobjectResponse(struct soap*, const struct ns1__chmod_USCOREobjectResponse *); 146 SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__chmod_USCOREobjectResponse(struct soap*, const struct ns1__chmod_USCOREobjectResponse *, const char*, const char*); 147 SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__chmod_USCOREobjectResponse(struct soap*, const char*, int, const struct ns1__chmod_USCOREobjectResponse *, const char*); 148 SOAP_FMAC3 struct ns1__chmod_USCOREobjectResponse * SOAP_FMAC4 soap_get_ns1__chmod_USCOREobjectResponse(struct soap*, struct ns1__chmod_USCOREobjectResponse *, const char*, const char*); 149 SOAP_FMAC3 struct ns1__chmod_USCOREobjectResponse * SOAP_FMAC4 soap_in_ns1__chmod_USCOREobjectResponse(struct soap*, const char*, struct ns1__chmod_USCOREobjectResponse *, const char*); 150 111 151 #ifndef SOAP_TYPE_ns1__stat_USCOREobject 112 152 #define SOAP_TYPE_ns1__stat_USCOREobject (56) … … 402 442 403 443 #ifndef SOAP_TYPE_PointerToSOAP_ENV__Reason 404 #define SOAP_TYPE_PointerToSOAP_ENV__Reason ( 66)444 #define SOAP_TYPE_PointerToSOAP_ENV__Reason (72) 405 445 #endif 406 446 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *const*); … … 415 455 416 456 #ifndef SOAP_TYPE_PointerToSOAP_ENV__Detail 417 #define SOAP_TYPE_PointerToSOAP_ENV__Detail ( 65)457 #define SOAP_TYPE_PointerToSOAP_ENV__Detail (71) 418 458 #endif 419 459 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *const*); … … 428 468 429 469 #ifndef SOAP_TYPE_PointerToSOAP_ENV__Code 430 #define SOAP_TYPE_PointerToSOAP_ENV__Code ( 59)470 #define SOAP_TYPE_PointerToSOAP_ENV__Code (65) 431 471 #endif 432 472 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *const*); -
branches/pap/Nebulous/nebclient/src/soapServer.c
r23935 r25027 10 10 #endif 11 11 12 SOAP_SOURCE_STAMP("@(#) soapServer.c ver 2.7.12 2009-0 4-20 22:15:21GMT")12 SOAP_SOURCE_STAMP("@(#) soapServer.c ver 2.7.12 2009-07-25 01:30:29 GMT") 13 13 14 14 … … 105 105 if (!soap_match_tag(soap, soap->tag, "ns1:stat_object")) 106 106 return soap_serve_ns1__stat_USCOREobject(soap); 107 if (!soap_match_tag(soap, soap->tag, "ns1:chmod_object")) 108 return soap_serve_ns1__chmod_USCOREobject(soap); 109 if (!soap_match_tag(soap, soap->tag, "ns1:prune_object")) 110 return soap_serve_ns1__prune_USCOREobject(soap); 107 111 return soap->error = SOAP_NO_METHOD; 108 112 } … … 713 717 } 714 718 719 SOAP_FMAC5 int SOAP_FMAC6 soap_serve_ns1__chmod_USCOREobject(struct soap *soap) 720 { struct ns1__chmod_USCOREobject soap_tmp_ns1__chmod_USCOREobject; 721 struct ns1__chmod_USCOREobjectResponse soap_tmp_ns1__chmod_USCOREobjectResponse; 722 int soap_tmp_int; 723 soap_default_ns1__chmod_USCOREobjectResponse(soap, &soap_tmp_ns1__chmod_USCOREobjectResponse); 724 soap_default_int(soap, &soap_tmp_int); 725 soap_tmp_ns1__chmod_USCOREobjectResponse.result = &soap_tmp_int; 726 soap_default_ns1__chmod_USCOREobject(soap, &soap_tmp_ns1__chmod_USCOREobject); 727 soap->encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/"; 728 if (!soap_get_ns1__chmod_USCOREobject(soap, &soap_tmp_ns1__chmod_USCOREobject, "ns1:chmod_object", NULL)) 729 return soap->error; 730 if (soap_body_end_in(soap) 731 || soap_envelope_end_in(soap) 732 || soap_end_recv(soap)) 733 return soap->error; 734 soap->error = ns1__chmod_USCOREobject(soap, soap_tmp_ns1__chmod_USCOREobject.key, soap_tmp_ns1__chmod_USCOREobject.mode, &soap_tmp_int); 735 if (soap->error) 736 return soap->error; 737 soap_serializeheader(soap); 738 soap_serialize_ns1__chmod_USCOREobjectResponse(soap, &soap_tmp_ns1__chmod_USCOREobjectResponse); 739 if (soap_begin_count(soap)) 740 return soap->error; 741 if (soap->mode & SOAP_IO_LENGTH) 742 { if (soap_envelope_begin_out(soap) 743 || soap_putheader(soap) 744 || soap_body_begin_out(soap) 745 || soap_put_ns1__chmod_USCOREobjectResponse(soap, &soap_tmp_ns1__chmod_USCOREobjectResponse, "ns1:chmod_objectResponse", "") 746 || soap_body_end_out(soap) 747 || soap_envelope_end_out(soap)) 748 return soap->error; 749 }; 750 if (soap_end_count(soap) 751 || soap_response(soap, SOAP_OK) 752 || soap_envelope_begin_out(soap) 753 || soap_putheader(soap) 754 || soap_body_begin_out(soap) 755 || soap_put_ns1__chmod_USCOREobjectResponse(soap, &soap_tmp_ns1__chmod_USCOREobjectResponse, "ns1:chmod_objectResponse", "") 756 || soap_body_end_out(soap) 757 || soap_envelope_end_out(soap) 758 || soap_end_send(soap)) 759 return soap->error; 760 return soap_closesock(soap); 761 } 762 763 SOAP_FMAC5 int SOAP_FMAC6 soap_serve_ns1__prune_USCOREobject(struct soap *soap) 764 { struct ns1__prune_USCOREobject soap_tmp_ns1__prune_USCOREobject; 765 struct ns1__prune_USCOREobjectResponse soap_tmp_ns1__prune_USCOREobjectResponse; 766 int soap_tmp_int; 767 soap_default_ns1__prune_USCOREobjectResponse(soap, &soap_tmp_ns1__prune_USCOREobjectResponse); 768 soap_default_int(soap, &soap_tmp_int); 769 soap_tmp_ns1__prune_USCOREobjectResponse.result = &soap_tmp_int; 770 soap_default_ns1__prune_USCOREobject(soap, &soap_tmp_ns1__prune_USCOREobject); 771 soap->encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/"; 772 if (!soap_get_ns1__prune_USCOREobject(soap, &soap_tmp_ns1__prune_USCOREobject, "ns1:prune_object", NULL)) 773 return soap->error; 774 if (soap_body_end_in(soap) 775 || soap_envelope_end_in(soap) 776 || soap_end_recv(soap)) 777 return soap->error; 778 soap->error = ns1__prune_USCOREobject(soap, soap_tmp_ns1__prune_USCOREobject.key, &soap_tmp_int); 779 if (soap->error) 780 return soap->error; 781 soap_serializeheader(soap); 782 soap_serialize_ns1__prune_USCOREobjectResponse(soap, &soap_tmp_ns1__prune_USCOREobjectResponse); 783 if (soap_begin_count(soap)) 784 return soap->error; 785 if (soap->mode & SOAP_IO_LENGTH) 786 { if (soap_envelope_begin_out(soap) 787 || soap_putheader(soap) 788 || soap_body_begin_out(soap) 789 || soap_put_ns1__prune_USCOREobjectResponse(soap, &soap_tmp_ns1__prune_USCOREobjectResponse, "ns1:prune_objectResponse", "") 790 || soap_body_end_out(soap) 791 || soap_envelope_end_out(soap)) 792 return soap->error; 793 }; 794 if (soap_end_count(soap) 795 || soap_response(soap, SOAP_OK) 796 || soap_envelope_begin_out(soap) 797 || soap_putheader(soap) 798 || soap_body_begin_out(soap) 799 || soap_put_ns1__prune_USCOREobjectResponse(soap, &soap_tmp_ns1__prune_USCOREobjectResponse, "ns1:prune_objectResponse", "") 800 || soap_body_end_out(soap) 801 || soap_envelope_end_out(soap) 802 || soap_end_send(soap)) 803 return soap->error; 804 return soap_closesock(soap); 805 } 806 715 807 #ifdef __cplusplus 716 808 } -
branches/pap/Nebulous/nebclient/src/soapStub.h
r23935 r25027 306 306 #endif 307 307 308 #ifndef SOAP_TYPE_ns1__chmod_USCOREobjectResponse 309 #define SOAP_TYPE_ns1__chmod_USCOREobjectResponse (58) 310 /* ns1:chmod_objectResponse */ 311 struct ns1__chmod_USCOREobjectResponse 312 { 313 int *result; /* SOAP 1.2 RPC return element (when namespace qualified) */ /* optional element of type xsd:int */ 314 }; 315 #endif 316 317 #ifndef SOAP_TYPE_ns1__chmod_USCOREobject 318 #define SOAP_TYPE_ns1__chmod_USCOREobject (59) 319 /* ns1:chmod_object */ 320 struct ns1__chmod_USCOREobject 321 { 322 char *key; /* optional element of type xsd:string */ 323 int mode; /* required element of type xsd:int */ 324 }; 325 #endif 326 327 #ifndef SOAP_TYPE_ns1__prune_USCOREobjectResponse 328 #define SOAP_TYPE_ns1__prune_USCOREobjectResponse (61) 329 /* ns1:prune_objectResponse */ 330 struct ns1__prune_USCOREobjectResponse 331 { 332 int *result; /* SOAP 1.2 RPC return element (when namespace qualified) */ /* optional element of type xsd:int */ 333 }; 334 #endif 335 336 #ifndef SOAP_TYPE_ns1__prune_USCOREobject 337 #define SOAP_TYPE_ns1__prune_USCOREobject (62) 338 /* ns1:prune_object */ 339 struct ns1__prune_USCOREobject 340 { 341 char *key; /* optional element of type xsd:string */ 342 }; 343 #endif 344 308 345 #ifndef SOAP_TYPE_SOAP_ENV__Header 309 #define SOAP_TYPE_SOAP_ENV__Header ( 57)346 #define SOAP_TYPE_SOAP_ENV__Header (63) 310 347 /* SOAP Header: */ 311 348 struct SOAP_ENV__Header … … 318 355 319 356 #ifndef SOAP_TYPE_SOAP_ENV__Code 320 #define SOAP_TYPE_SOAP_ENV__Code ( 58)357 #define SOAP_TYPE_SOAP_ENV__Code (64) 321 358 /* SOAP Fault Code: */ 322 359 struct SOAP_ENV__Code … … 328 365 329 366 #ifndef SOAP_TYPE_SOAP_ENV__Detail 330 #define SOAP_TYPE_SOAP_ENV__Detail (6 0)367 #define SOAP_TYPE_SOAP_ENV__Detail (66) 331 368 /* SOAP-ENV:Detail */ 332 369 struct SOAP_ENV__Detail … … 339 376 340 377 #ifndef SOAP_TYPE_SOAP_ENV__Reason 341 #define SOAP_TYPE_SOAP_ENV__Reason (6 3)378 #define SOAP_TYPE_SOAP_ENV__Reason (69) 342 379 /* SOAP-ENV:Reason */ 343 380 struct SOAP_ENV__Reason … … 348 385 349 386 #ifndef SOAP_TYPE_SOAP_ENV__Fault 350 #define SOAP_TYPE_SOAP_ENV__Fault ( 64)387 #define SOAP_TYPE_SOAP_ENV__Fault (70) 351 388 /* SOAP Fault: */ 352 389 struct SOAP_ENV__Fault … … 437 474 SOAP_FMAC5 int SOAP_FMAC6 ns1__stat_USCOREobject(struct soap*, char *key, struct ns1__stat_USCOREobjectResponse *_param_4); 438 475 476 SOAP_FMAC5 int SOAP_FMAC6 ns1__chmod_USCOREobject(struct soap*, char *key, int mode, int *result); 477 478 SOAP_FMAC5 int SOAP_FMAC6 ns1__prune_USCOREobject(struct soap*, char *key, int *result); 479 439 480 /******************************************************************************\ 440 481 * * … … 472 513 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_4); 473 514 515 SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__chmod_USCOREobject(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *key, int mode, int *result); 516 517 SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__prune_USCOREobject(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *key, int *result); 518 474 519 /******************************************************************************\ 475 520 * * … … 509 554 510 555 SOAP_FMAC5 int SOAP_FMAC6 soap_serve_ns1__stat_USCOREobject(struct soap*); 556 557 SOAP_FMAC5 int SOAP_FMAC6 soap_serve_ns1__chmod_USCOREobject(struct soap*); 558 559 SOAP_FMAC5 int SOAP_FMAC6 soap_serve_ns1__prune_USCOREobject(struct soap*); 511 560 512 561 #ifdef __cplusplus -
branches/pap/Nebulous/nebclient/tests/tap
- Property svn:mergeinfo deleted
-
branches/pap/Nebulous/nebclient/tests/tests.c
r21461 r25027 20 20 char *key = "foobarbaz"; 21 21 22 plan_tests( 28);22 plan_tests(31); 23 23 24 24 if (getenv("NEB_SERVER")) { … … 98 98 99 99 char *copies = nebGetXattr(server, key, "user.copies"); 100 neb_ok(server, strcmp(copies, "2") == 0, "get user.copies xattr");100 neb_ok(server, copies != NULL && strcmp(copies, "2") == 0, "get user.copies xattr"); 101 101 char **xattrs = NULL; 102 102 int n_xattrs = nebListXattr(server, key, &xattrs); 103 printf("# %s\n\n", xattrs[0]); 104 neb_ok(server, n_xattrs == 1, "count of xattrs"); 105 neb_ok(server, strcmp(xattrs[0], "user.copies") == 0, "user.copies xattr exists"); 103 neb_ok(server, xattrs != NULL && n_xattrs == 1, "count of xattrs"); 104 neb_ok(server, xattrs != NULL && strcmp(xattrs[0], "user.copies") == 0, "user.copies xattr exists"); 106 105 neb_ok(server, nebRemoveXattr(server, key, "user.copies"), "remove user.copies xattr"); 107 106 … … 136 135 neb_ok(server, nebMove(server, "copyiedfile", "movedfile"), "move object"); 137 136 137 neb_ok(server, nebChmod(server, "movedfile", 0440) == 0, "chmod object"); 138 139 // no dead instances to remove 140 neb_ok(server, nebPrune(server, "movedfile") == 0, "prune object"); 141 142 nebReplicate(server, key, NULL, NULL); 143 neb_ok(server, nebThereCanBeOnlyOne(server, "movedfile", NULL) == 0, "reduce instances to only 1"); 144 138 145 if (!nebDelete(server, "movedfile")) { 139 146 diag( "cleanup failed %s\n", nebErr(server));
Note:
See TracChangeset
for help on using the changeset viewer.
