IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 7, 2009, 4:08:25 PM (17 years ago)
Author:
Paul Price
Message:

Merging trunk (r25026) to get up-to-date on old branch.

Location:
branches/pap
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • branches/pap

  • branches/pap/Nebulous

    • Property svn:mergeinfo deleted
  • branches/pap/Nebulous/nebclient

    • Property svn:mergeinfo deleted
  • branches/pap/Nebulous/nebclient/configure.ac

    r20208 r25027  
    55AC_PREREQ(2.61)
    66
    7 AC_INIT([nebclient], [0.08], [jhoblitt@cpan.org])
     7AC_INIT([nebclient], [0.17], [jhoblitt@cpan.org])
    88AC_CONFIG_SRCDIR([nebulous.wsdl])
    99
  • branches/pap/Nebulous/nebclient/nebulous.wsdl

    r23935 r25027  
    140140    </message>
    141141
     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
    142159
    143160    <portType name="Nebulous/Server/SOAPPort">
     
    240257            -->
    241258        </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>
    242273    </portType>
    243274
     
    390421        <operation name="stat_object">
    391422            <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" />
    392445            <input>
    393446                <soap:body use="encoded" namespace="urn:Nebulous/Server/SOAP"
  • branches/pap/Nebulous/nebclient/src/nebclient.c

    r23935 r25027  
    5151static char *nullstrncpy(char *dest, const char *src, size_t n);
    5252
     53
    5354nebServer *nebServerAlloc(const char *endpoint)
    5455{
    55     nebServer       *server;
    56 
    57     server          = xmalloc(sizeof(nebServer));
     56    nebServer *server = xmalloc(sizeof(nebServer));
    5857
    5958    if (endpoint) {
     
    7776}
    7877
     78
    7979void nebServerFree(nebServer *server)
    8080{
     
    9292}
    9393
     94
    9495char *nebCreate(nebServer *server, const char *key, const char *volume, char **URI)
    9596{
     97    REQUIRE_SERVER;
     98
     99    if (!key) {
     100        nebSetErr(server, "parameter 'key' may not be NULL");
     101
     102        return NULL;
     103    }
     104
    96105    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 
    107106    if (soap_call_ns1__create_USCOREobject(server->soap, server->endpoint, NULL,
    108107            (char *)key, (char *)volume, (char **)&response) != SOAP_OK) {
     
    117116    }
    118117
     118    char *filename;
    119119    if (!nebParseURI(server, (char *)response.result, &filename)) {
    120120        nebSetErr(server, "can not parse URI");
     121        nebFree(filename);
     122
    121123        return NULL;
    122124    }
     
    131133}
    132134
     135
    133136int nebOpenCreate(nebServer *server, const char *key, const char *volume, char **URI)
    134137{
    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);
    149152    if (file == -1) {
    150153        nebSetErr(server, "can not open %s: %s", filename, strerror(errno));
     
    159162}
    160163
     164
    161165bool nebReplicate(nebServer *server, const char *key, const char *volume, char **URI)
    162166{
    163     struct ns1__replicate_USCOREobjectResponse response;
    164     char            *filename;
    165     int             sourceFH, destFH;
    166 
    167167    REQUIRE_SERVER;
    168168
     
    177177    // we don't do this, it's possible that open will find & open the new
    178178    // 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);
    180180    if (sourceFH == -1) {
    181181        nebSetErr(server, "can not open key %s", key);
    182         nebFree(filename);
    183182
    184183        return false;
     
    186185
    187186    // ask the server for a new instance attached to our key
     187    struct ns1__replicate_USCOREobjectResponse response;
    188188    if (soap_call_ns1__replicate_USCOREobject(server->soap, server->endpoint,
    189189            NULL, (char *)key, (char *)volume, (char **)&response) != SOAP_OK) {
     
    193193    }
    194194
     195    char *filename = NULL;
    195196    if (!nebParseURI(server, (char *)response.result, &filename)) {
    196197        nebSetErr(server, "can not parse URI");
     
    199200    }
    200201
    201     destFH = open(filename, O_RDWR|O_TRUNC, 0660);
     202    int destFH = open(filename, O_RDWR|O_TRUNC, 0660);
    202203    if (destFH == -1) {
    203204        nebSetErr(server, "can not open %s: %s\n", filename, strerror(errno));
     
    234235}
    235236
     237
    236238bool nebCull(nebServer *server, const char *key)
    237239{
    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);
    249249    if (!locations || locations->n <= 1) {
    250250        nebSetErr(server, "can not cull - not enough instances");
     251        if (locations) {
     252            nebObjectInstancesFree(locations);
     253        }
    251254
    252255        return false;
     
    264267}
    265268
     269
    266270bool nebLock(nebServer *server, const char *key, nebRW flag)
    267271{
    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;
    283283
    284284    while (time(NULL) < endtime) {
     285        int response;
    285286        if (soap_call_ns1__lock_USCOREobject(server->soap, server->endpoint,
    286287            NULL, (char *)key, type, &response) != SOAP_OK) {
     
    302303}
    303304
     305
    304306bool nebUnlock(nebServer *server, const char *key, nebRW flag)
    305307{
    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;
    319319    if (soap_call_ns1__unlock_USCOREobject(server->soap, server->endpoint,
    320320        NULL, (char *)key, type, &response) != SOAP_OK) {
     
    466466nebObjectInstances *nebFindInstances(nebServer *server, const char *key, const char *volume)
    467467{
     468    REQUIRE_SERVER;
     469
     470    if (!key) {
     471        nebSetErr(server, "parameter 'key' may not be NULL");
     472
     473        return NULL;
     474    }
     475
    468476    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 
    481477    // FIXME is this leaking memory when response goes out of scope?  the gsoap
    482478    // manual seems to 'suggest' that this is temporary data that gets cleaed
     
    488484    }
    489485
    490     resultElements = response.result->__size;
    491 
     486    int resultElements = response.result->__size;
     487
     488    nebObjectInstances *locations = NULL;
    492489    if (resultElements) {
    493490        locations = xmalloc(sizeof(nebObjectInstances));
    494491        locations->n = resultElements;
    495492       
    496         resultArray    = response.result->__ptr;
     493        char **resultArray = response.result->__ptr;
    497494
    498495        locations->URI = xmalloc(sizeof(char*) * resultElements);
     
    508505}
    509506
     507
    510508void nebObjectInstancesFree(nebObjectInstances *locations)
    511509{
     
    521519}
    522520
     521
    523522char *nebFind(nebServer *server, const char *key)
    524523{
    525     nebObjectInstances *locations;
    526     char            *filename;
    527 
    528524    REQUIRE_SERVER;
    529525
     
    534530    }
    535531   
    536     locations = nebFindInstances(server, key, NULL);
     532    nebObjectInstances *locations = nebFindInstances(server, key, NULL);
    537533    if (!locations) {
    538534        if (!strstr(nebErr(server), "no instances on storage volume")) {
     
    548544    }
    549545
     546    char *filename;
    550547    if (!nebParseURI(server, locations->URI[0], &filename)) {
    551548        nebSetErr(server, "can not parse URI");
     
    560557}
    561558
     559
    562560int nebOpen(nebServer *server, const char *key, nebRW flag)
    563561{
    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);
    577571    if (!locations) {
    578572        nebSetErr(server, "no instances found");
     
    581575    }
    582576
     577    char *filename;
    583578    if (!nebParseURI(server, locations->URI[0], &filename)) {
    584579        nebSetErr(server, "can not parse URI");
     
    588583    }
    589584
     585    int fh = 0;
    590586    if (flag == NEB_WRITE) {
    591587        if (locations->n > 1) {
     
    613609}
    614610
     611
    615612bool nebDelete(nebServer *server, const char *key)
    616613{
    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");
    628623    if (!locations) {
    629624        nebSetErr(server, "no instances found");
     
    646641}
    647642
     643
    648644bool nebCopy(nebServer *server, const char *key, const char *newKey)
    649645{
    650     int             sourceFH;
    651     int             destFH;
    652 
    653646    REQUIRE_SERVER;
    654647
     
    665658    }
    666659
    667     sourceFH = nebOpen(server, (char *)key, NEB_READ);
     660    int sourceFH = nebOpen(server, (char *)key, NEB_READ);
    668661    if (sourceFH < 0) {
    669662        // propigate nebOpen() error
     
    672665    }
    673666
    674     destFH = nebOpenCreate(server, newKey, NULL, NULL);
     667    int destFH = nebOpenCreate(server, newKey, NULL, NULL);
    675668    if (destFH < 0) {
    676669        // propigate nebCreate() error
     
    696689}
    697690
     691
    698692bool nebMove(nebServer *server, const char *key, const char *newKey)
    699693{
     
    723717}
    724718
     719
    725720bool nebSwap(nebServer *server, const char *key1, const char *key2)
    726721{
    727     struct ns1__create_USCOREobjectResponse response;
    728 
    729722    REQUIRE_SERVER;
    730723
     
    741734    }
    742735
     736    struct ns1__create_USCOREobjectResponse response;
    743737    if (soap_call_ns1__swap_USCOREobjects(server->soap, server->endpoint,
    744738            NULL, (char *)key1, (char *)key2, (char **)&response) != SOAP_OK) {
     
    749743}
    750744
     745
    751746bool nebDeleteInstance(nebServer *server, const char *key, const char *URI)
    752747{
    753     int             response;
    754     char            *filename;
    755     bool            status;
    756 
    757748    REQUIRE_SERVER;
    758749
     
    763754    }
    764755
     756    char *filename;
    765757    if (!nebParseURI(server, URI, &filename)) {
    766758        nebSetErr(server, "can not parse URI");
     
    769761    }
    770762
     763    int response;
    771764    if (soap_call_ns1__delete_USCOREinstance(server->soap, server->endpoint,
    772765        NULL, (char *)key, (char *)URI, &response) != SOAP_OK) {
     
    776769    }
    777770
     771    bool status;
    778772    if (response > 0) {
    779773        status = nebNukeFile(server, filename);
     
    787781}
    788782
     783
    789784nebObjectStat *nebStat(nebServer *server, const char *key)
    790785{
    791     struct ns1__stat_USCOREobjectResponse response;
    792     nebObjectStat   *stat;
    793     int             resultElements = 0;
    794     char            **resultArray = NULL;
    795 
    796786    REQUIRE_SERVER;
    797787
     
    802792    }
    803793
    804     stat = xmalloc(sizeof(nebObjectStat));
     794    nebObjectStat *stat = xmalloc(sizeof(nebObjectStat));
    805795
    806796    // FIXME is this leaking memory when response goes out of scope?  the gsoap
    807797    // manual seems to 'suggest' that this is temporary data that gets cleaed
    808798    // up on the next soap function call
     799    struct ns1__stat_USCOREobjectResponse response;
    809800    if (soap_call_ns1__stat_USCOREobject(server->soap, server->endpoint,
    810801            NULL, (char *)key, &response) != SOAP_OK) {
     
    813804    }
    814805
    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) {
    819810        nebSetErr(server, "server didn't return the proper number of stat elements");
    820811        return NULL;
    821812    }
    822813
    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]);
    826817    nullstrncpy(stat->write_lock, resultArray[3], 256);
    827818    nullstrncpy(stat->epoch, resultArray[4], 256);
    828819    nullstrncpy(stat->mtime, resultArray[5], 256);
    829     stat->instances = atoi(resultArray[6]);
     820    stat->available = atoi(resultArray[6]);
     821    stat->instances = atoi(resultArray[7]);
    830822
    831823    return stat;
    832824}
    833825
     826
     827void nebObjectStatFree(nebObjectStat *stat)
     828{
     829    if (!stat) {
     830        return;
     831    }
     832
     833    nebFree(stat);
     834}
     835
     836
     837int 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
     861int 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
     885int 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
    834949char *nebErr(nebServer *server)
    835950{
     
    837952}
    838953
     954
    839955void nebFree(void *ptr) {
     956    if (!ptr) { return; }
    840957    xfree(ptr);
    841958}
     
    844961static void p_nebSetErr(const char * filename, unsigned long lineno, const char *function, nebServer *server, const char *format, ...)
    845962{
    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() - ",
    852965            filename, lineno, function);
    853966
     
    862975
    863976    while (1) {
     977        va_list args;
    864978        va_start(args, format);
    865979        // append error string after error location info
    866         err_size = vsnprintf(
     980        size_t err_size = vsnprintf(
    867981                server->err_buf + err_location_size,
    868982                server->err_buf_size - err_location_size,
     
    8881002}
    8891003
     1004
    8901005static void nebSetServerErr(nebServer *server)
    8911006{
    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);
    8991011
    9001012    nebSetErr(server, "%s - %s", *code, *string);
    9011013}
     1014
    9021015
    9031016#if NEBCOPYFILE
    9041017static off_t nebCopyFile(nebServer *server, const char *source, const char *dest)
    9051018{
    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);
    9131022    if (sourceFH == -1) {
    9141023        nebSetErr(server, "can not open %s: %s", source, strerror(errno));
     
    9171026    }
    9181027
    919     destFH = open(dest, O_WRONLY|O_CREAT|O_CREAT, 0600);
     1028    int destFH = open(dest, O_WRONLY|O_CREAT|O_CREAT, 0600);
    9201029    if (destFH == -1) {
    9211030        nebSetErr(server, "can not open %s: %s", dest, strerror(errno));
     
    9241033    }
    9251034
    926     bytesCopied = nebCopyFilehandle(server, sourceFH, destFH);
     1035    off_t bytesCopied = nebCopyFilehandle(server, sourceFH, destFH);
    9271036    if (bytesCopied < 0) {
    9281037        return -1;
     
    9451054#endif
    9461055
     1056
    9471057static off_t nebCopyFilehandle(nebServer *server, int sourceFH, int destFH)
    9481058{
    949     off_t           bytesTotal;
    950     off_t           bytesRemaining;
    951     off_t           writeSize;
    952     char            writeBuf[64 * 1024];
     1059    REQUIRE_SERVER;
     1060
    9531061    struct stat     sourceStat;
    954 
    955     REQUIRE_SERVER;
    956 
    9571062    if(fstat(sourceFH, &sourceStat)) {
    9581063        nebSetErr(server, "can not stat filehandles: %s", strerror(errno));
     
    9621067
    9631068    // the size of the file to copied
    964     bytesTotal = sourceStat.st_size;
     1069    off_t bytesTotal = sourceStat.st_size;
    9651070
    9661071    /*
     
    9701075    */
    9711076
    972     bytesRemaining = bytesTotal;
     1077    off_t bytesRemaining = bytesTotal;
    9731078
    9741079    while (bytesRemaining) {
     1080        off_t writeSize;
     1081        char writeBuf[64 * 1024];
    9751082        if (bytesRemaining <= sizeof(writeBuf)) {
    9761083            writeSize = bytesRemaining;
     
    9971104}
    9981105
     1106
    9991107static size_t nebParseURI(nebServer *server, const char *URI, char **filename)
    10001108{
    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 
    10101109    REQUIRE_SERVER;
    10111110
     
    10221121    }
    10231122
    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);
    10251129    if (status != 0) {
    10261130        regerror(status, &myregex, errbuf, ERRBUF_SIZE);
     
    10401144    regfree(&myregex);
    10411145
    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;
    10451149
    10461150    if (matchStart == -1) {
     
    10481152    }
    10491153
    1050     filename_size = matchLength + 1;
     1154    size_t filename_size = matchLength + 1;
    10511155    *filename = xmalloc(filename_size);
    10521156
     
    10551159    return strlen(*filename);
    10561160}
     1161
    10571162
    10581163static bool nebNukeFile(nebServer *server, const char *filename)
     
    10741179    return true;
    10751180}
     1181
    10761182
    10771183static char *nullstrncpy(char *dest, const char *src, size_t n) {
     
    10811187    }
    10821188
     1189    if (!dest) {
     1190        dest = xmalloc(n + 1);
     1191    }
     1192
    10831193    return strncpy(dest, src, n);
    10841194}
  • branches/pap/Nebulous/nebclient/src/nebclient.h

    r23935 r25027  
    1111#ifndef NEBCLIENT_H
    1212#define NEBCLIENT_H 1
     13
     14// #include <sys/stat.h>
    1315
    1416#ifdef __cplusplus
     
    3638
    3739typedef struct {
    38     char            so_id[256];         ///< storage object ID
    39     char            ext_id[256];        ///< storage object key (name)
    40     char            read_lock[256];     ///< read lock value
     40    long            so_id;              ///< storage object ID
     41    long            ext_id;             ///< storage object key (name)
     42    int             read_lock;          ///< read lock value
    4143    char            write_lock[256];    ///< write lock value
    4244    char            epoch[256];         ///< creation time stamp
    4345    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
    4548} nebObjectStat;
    4649
     
    293296nebObjectStat *nebStat(
    294297    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 */
     304void 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
     316int 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
     327int 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
     337int nebThereCanBeOnlyOne(
     338    nebServer *server,                  ///< nebServer object
     339    const char *key,                    ///< storage object key (name)
     340    const char *volume                  ///< leave remain instance on this volume
    296341);
    297342
  • branches/pap/Nebulous/nebclient/src/nebulous.h

    r23935 r25027  
    11/* src/nebulous.h
    22   Generated by wsdl2h 1.2.12 from nebulous.wsdl and typemap.dat
    3    2009-04-20 22:15:21 GMT
     3   2009-07-25 01:30:29 GMT
    44   Copyright (C) 2001-2008 Robert van Engelen, Genivia Inc. All Rights Reserved.
    55   This part of the software is released under one of the following licenses:
     
    119119  - @ref ns1__delete_USCOREinstance
    120120  - @ref ns1__stat_USCOREobject
     121  - @ref ns1__chmod_USCOREobject
     122  - @ref ns1__prune_USCOREobject
    121123
    122124@section SOAP_ports Endpoints of Binding  "SOAP"
     
    893895);
    894896
     897/******************************************************************************\
     898 *                                                                            *
     899 * ns1__chmod_USCOREobject                                                    *
     900 *                                                                            *
     901\******************************************************************************/
     902
     903
     904/// Operation "ns1__chmod_USCOREobject" of service binding "SOAP"
     905
     906/**
     907
     908Operation details:
     909
     910  - SOAP RPC encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
     911  - SOAP action="urn:Nebulous/Server/SOAP#chmod_object"
     912
     913C 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
     927C 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
     944int 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
     961Operation details:
     962
     963  - SOAP RPC encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
     964  - SOAP action="urn:Nebulous/Server/SOAP#prune_object"
     965
     966C 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
     979C 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
     995int ns1__prune_USCOREobject(
     996    char*                               key,    ///< Request parameter
     997    int                                *result  ///< Response parameter
     998);
     999
    8951000/* End of src/nebulous.h */
  • branches/pap/Nebulous/nebclient/src/soapC.c

    r23935 r25027  
    1212#endif
    1313
    14 SOAP_SOURCE_STAMP("@(#) soapC.c ver 2.7.12 2009-04-20 22:15:22 GMT")
     14SOAP_SOURCE_STAMP("@(#) soapC.c ver 2.7.12 2009-07-25 01:30:29 GMT")
    1515
    1616
     
    161161        case SOAP_TYPE_int:
    162162                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");
    163171        case SOAP_TYPE_ns1__stat_USCOREobject:
    164172                return soap_in_ns1__stat_USCOREobject(soap, NULL, NULL, "ns1:stat_object");
     
    250258                        return soap_in_int(soap, NULL, NULL, NULL);
    251259                }
     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                }
    252276                if (!soap_match_tag(soap, t, "ns1:stat_object"))
    253277                {       *type = SOAP_TYPE_ns1__stat_USCOREobject;
     
    440464        case SOAP_TYPE_int:
    441465                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");
    442474        case SOAP_TYPE_ns1__stat_USCOREobject:
    443475                return soap_out_ns1__stat_USCOREobject(soap, tag, id, (const struct ns1__stat_USCOREobject *)ptr, "ns1:stat_object");
     
    527559        switch (type)
    528560        {
     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;
    529573        case SOAP_TYPE_ns1__stat_USCOREobject:
    530574                soap_serialize_ns1__stat_USCOREobject(soap, (const struct ns1__stat_USCOREobject *)ptr);
     
    11951239#endif
    11961240
     1241SOAP_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
     1247SOAP_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
     1253SOAP_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
     1261SOAP_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
     1270SOAP_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
     1278SOAP_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
     1314SOAP_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
     1320SOAP_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
     1326SOAP_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
     1334SOAP_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
     1343SOAP_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
     1351SOAP_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
     1387SOAP_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
     1394SOAP_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
     1401SOAP_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
     1409SOAP_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
     1420SOAP_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
     1428SOAP_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
     1474SOAP_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
     1480SOAP_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
     1486SOAP_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
     1494SOAP_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
     1503SOAP_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
     1511SOAP_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
    11971547SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__stat_USCOREobject(struct soap *soap, struct ns1__stat_USCOREobject *a)
    11981548{
  • branches/pap/Nebulous/nebclient/src/soapClient.c

    r23935 r25027  
    1010#endif
    1111
    12 SOAP_SOURCE_STAMP("@(#) soapClient.c ver 2.7.12 2009-04-20 22:15:21 GMT")
     12SOAP_SOURCE_STAMP("@(#) soapClient.c ver 2.7.12 2009-07-25 01:30:29 GMT")
    1313
    1414
     
    812812}
    813813
     814SOAP_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
     872SOAP_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
    814929#ifdef __cplusplus
    815930}
  • branches/pap/Nebulous/nebclient/src/soapH.h

    r23198 r25027  
    4242
    4343#ifndef SOAP_TYPE_SOAP_ENV__Fault
    44 #define SOAP_TYPE_SOAP_ENV__Fault (64)
     44#define SOAP_TYPE_SOAP_ENV__Fault (70)
    4545#endif
    4646SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Fault(struct soap*, struct SOAP_ENV__Fault *);
     
    5656
    5757#ifndef SOAP_TYPE_SOAP_ENV__Reason
    58 #define SOAP_TYPE_SOAP_ENV__Reason (63)
     58#define SOAP_TYPE_SOAP_ENV__Reason (69)
    5959#endif
    6060SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *);
     
    7070
    7171#ifndef SOAP_TYPE_SOAP_ENV__Detail
    72 #define SOAP_TYPE_SOAP_ENV__Detail (60)
     72#define SOAP_TYPE_SOAP_ENV__Detail (66)
    7373#endif
    7474SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *);
     
    8484
    8585#ifndef SOAP_TYPE_SOAP_ENV__Code
    86 #define SOAP_TYPE_SOAP_ENV__Code (58)
     86#define SOAP_TYPE_SOAP_ENV__Code (64)
    8787#endif
    8888SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *);
     
    9898
    9999#ifndef SOAP_TYPE_SOAP_ENV__Header
    100 #define SOAP_TYPE_SOAP_ENV__Header (57)
     100#define SOAP_TYPE_SOAP_ENV__Header (63)
    101101#endif
    102102SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Header(struct soap*, struct SOAP_ENV__Header *);
     
    109109#endif
    110110
     111#ifndef SOAP_TYPE_ns1__prune_USCOREobject
     112#define SOAP_TYPE_ns1__prune_USCOREobject (62)
     113#endif
     114SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__prune_USCOREobject(struct soap*, struct ns1__prune_USCOREobject *);
     115SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__prune_USCOREobject(struct soap*, const struct ns1__prune_USCOREobject *);
     116SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__prune_USCOREobject(struct soap*, const struct ns1__prune_USCOREobject *, const char*, const char*);
     117SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__prune_USCOREobject(struct soap*, const char*, int, const struct ns1__prune_USCOREobject *, const char*);
     118SOAP_FMAC3 struct ns1__prune_USCOREobject * SOAP_FMAC4 soap_get_ns1__prune_USCOREobject(struct soap*, struct ns1__prune_USCOREobject *, const char*, const char*);
     119SOAP_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
     124SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__prune_USCOREobjectResponse(struct soap*, struct ns1__prune_USCOREobjectResponse *);
     125SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__prune_USCOREobjectResponse(struct soap*, const struct ns1__prune_USCOREobjectResponse *);
     126SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__prune_USCOREobjectResponse(struct soap*, const struct ns1__prune_USCOREobjectResponse *, const char*, const char*);
     127SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__prune_USCOREobjectResponse(struct soap*, const char*, int, const struct ns1__prune_USCOREobjectResponse *, const char*);
     128SOAP_FMAC3 struct ns1__prune_USCOREobjectResponse * SOAP_FMAC4 soap_get_ns1__prune_USCOREobjectResponse(struct soap*, struct ns1__prune_USCOREobjectResponse *, const char*, const char*);
     129SOAP_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
     134SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__chmod_USCOREobject(struct soap*, struct ns1__chmod_USCOREobject *);
     135SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__chmod_USCOREobject(struct soap*, const struct ns1__chmod_USCOREobject *);
     136SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__chmod_USCOREobject(struct soap*, const struct ns1__chmod_USCOREobject *, const char*, const char*);
     137SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__chmod_USCOREobject(struct soap*, const char*, int, const struct ns1__chmod_USCOREobject *, const char*);
     138SOAP_FMAC3 struct ns1__chmod_USCOREobject * SOAP_FMAC4 soap_get_ns1__chmod_USCOREobject(struct soap*, struct ns1__chmod_USCOREobject *, const char*, const char*);
     139SOAP_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
     144SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__chmod_USCOREobjectResponse(struct soap*, struct ns1__chmod_USCOREobjectResponse *);
     145SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__chmod_USCOREobjectResponse(struct soap*, const struct ns1__chmod_USCOREobjectResponse *);
     146SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__chmod_USCOREobjectResponse(struct soap*, const struct ns1__chmod_USCOREobjectResponse *, const char*, const char*);
     147SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__chmod_USCOREobjectResponse(struct soap*, const char*, int, const struct ns1__chmod_USCOREobjectResponse *, const char*);
     148SOAP_FMAC3 struct ns1__chmod_USCOREobjectResponse * SOAP_FMAC4 soap_get_ns1__chmod_USCOREobjectResponse(struct soap*, struct ns1__chmod_USCOREobjectResponse *, const char*, const char*);
     149SOAP_FMAC3 struct ns1__chmod_USCOREobjectResponse * SOAP_FMAC4 soap_in_ns1__chmod_USCOREobjectResponse(struct soap*, const char*, struct ns1__chmod_USCOREobjectResponse *, const char*);
     150
    111151#ifndef SOAP_TYPE_ns1__stat_USCOREobject
    112152#define SOAP_TYPE_ns1__stat_USCOREobject (56)
     
    402442
    403443#ifndef SOAP_TYPE_PointerToSOAP_ENV__Reason
    404 #define SOAP_TYPE_PointerToSOAP_ENV__Reason (66)
     444#define SOAP_TYPE_PointerToSOAP_ENV__Reason (72)
    405445#endif
    406446SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *const*);
     
    415455
    416456#ifndef SOAP_TYPE_PointerToSOAP_ENV__Detail
    417 #define SOAP_TYPE_PointerToSOAP_ENV__Detail (65)
     457#define SOAP_TYPE_PointerToSOAP_ENV__Detail (71)
    418458#endif
    419459SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *const*);
     
    428468
    429469#ifndef SOAP_TYPE_PointerToSOAP_ENV__Code
    430 #define SOAP_TYPE_PointerToSOAP_ENV__Code (59)
     470#define SOAP_TYPE_PointerToSOAP_ENV__Code (65)
    431471#endif
    432472SOAP_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  
    1010#endif
    1111
    12 SOAP_SOURCE_STAMP("@(#) soapServer.c ver 2.7.12 2009-04-20 22:15:21 GMT")
     12SOAP_SOURCE_STAMP("@(#) soapServer.c ver 2.7.12 2009-07-25 01:30:29 GMT")
    1313
    1414
     
    105105        if (!soap_match_tag(soap, soap->tag, "ns1:stat_object"))
    106106                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);
    107111        return soap->error = SOAP_NO_METHOD;
    108112}
     
    713717}
    714718
     719SOAP_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
     763SOAP_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
    715807#ifdef __cplusplus
    716808}
  • branches/pap/Nebulous/nebclient/src/soapStub.h

    r23935 r25027  
    306306#endif
    307307
     308#ifndef SOAP_TYPE_ns1__chmod_USCOREobjectResponse
     309#define SOAP_TYPE_ns1__chmod_USCOREobjectResponse (58)
     310/* ns1:chmod_objectResponse */
     311struct 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 */
     320struct 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 */
     330struct 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 */
     339struct ns1__prune_USCOREobject
     340{
     341        char *key;      /* optional element of type xsd:string */
     342};
     343#endif
     344
    308345#ifndef SOAP_TYPE_SOAP_ENV__Header
    309 #define SOAP_TYPE_SOAP_ENV__Header (57)
     346#define SOAP_TYPE_SOAP_ENV__Header (63)
    310347/* SOAP Header: */
    311348struct SOAP_ENV__Header
     
    318355
    319356#ifndef SOAP_TYPE_SOAP_ENV__Code
    320 #define SOAP_TYPE_SOAP_ENV__Code (58)
     357#define SOAP_TYPE_SOAP_ENV__Code (64)
    321358/* SOAP Fault Code: */
    322359struct SOAP_ENV__Code
     
    328365
    329366#ifndef SOAP_TYPE_SOAP_ENV__Detail
    330 #define SOAP_TYPE_SOAP_ENV__Detail (60)
     367#define SOAP_TYPE_SOAP_ENV__Detail (66)
    331368/* SOAP-ENV:Detail */
    332369struct SOAP_ENV__Detail
     
    339376
    340377#ifndef SOAP_TYPE_SOAP_ENV__Reason
    341 #define SOAP_TYPE_SOAP_ENV__Reason (63)
     378#define SOAP_TYPE_SOAP_ENV__Reason (69)
    342379/* SOAP-ENV:Reason */
    343380struct SOAP_ENV__Reason
     
    348385
    349386#ifndef SOAP_TYPE_SOAP_ENV__Fault
    350 #define SOAP_TYPE_SOAP_ENV__Fault (64)
     387#define SOAP_TYPE_SOAP_ENV__Fault (70)
    351388/* SOAP Fault: */
    352389struct SOAP_ENV__Fault
     
    437474SOAP_FMAC5 int SOAP_FMAC6 ns1__stat_USCOREobject(struct soap*, char *key, struct ns1__stat_USCOREobjectResponse *_param_4);
    438475
     476SOAP_FMAC5 int SOAP_FMAC6 ns1__chmod_USCOREobject(struct soap*, char *key, int mode, int *result);
     477
     478SOAP_FMAC5 int SOAP_FMAC6 ns1__prune_USCOREobject(struct soap*, char *key, int *result);
     479
    439480/******************************************************************************\
    440481 *                                                                            *
     
    472513SOAP_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);
    473514
     515SOAP_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
     517SOAP_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
    474519/******************************************************************************\
    475520 *                                                                            *
     
    509554
    510555SOAP_FMAC5 int SOAP_FMAC6 soap_serve_ns1__stat_USCOREobject(struct soap*);
     556
     557SOAP_FMAC5 int SOAP_FMAC6 soap_serve_ns1__chmod_USCOREobject(struct soap*);
     558
     559SOAP_FMAC5 int SOAP_FMAC6 soap_serve_ns1__prune_USCOREobject(struct soap*);
    511560
    512561#ifdef __cplusplus
  • branches/pap/Nebulous/nebclient/tests/tap

    • Property svn:mergeinfo deleted
  • branches/pap/Nebulous/nebclient/tests/tests.c

    r21461 r25027  
    2020    char            *key = "foobarbaz";
    2121
    22     plan_tests(28);
     22    plan_tests(31);
    2323
    2424    if (getenv("NEB_SERVER")) {
     
    9898
    9999    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");
    101101    char **xattrs = NULL;
    102102    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");
    106105    neb_ok(server, nebRemoveXattr(server, key, "user.copies"), "remove user.copies xattr");
    107106
     
    136135    neb_ok(server, nebMove(server, "copyiedfile", "movedfile"), "move object");
    137136
     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
    138145    if (!nebDelete(server, "movedfile")) {
    139146        diag( "cleanup failed %s\n", nebErr(server));
Note: See TracChangeset for help on using the changeset viewer.