IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 25, 2009, 3:37:05 PM (17 years ago)
Author:
eugene
Message:

merging differences from trunk: ptest.pl was re-written; nebGetXattr, nebRemoveXattr, nebListXattr functions and tests added; updates to Doxyfile.in; Build.PL removes nebclient installation

Location:
branches/neb_distrib_20081210/Nebulous
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/neb_distrib_20081210/Nebulous

  • branches/neb_distrib_20081210/Nebulous/nebclient

    • Property svn:ignore set to
      Doxyfile
      Makefile
      Makefile.in
      aclocal.m4
      autom4te.cache
      compile
      config.guess
      config.h
      config.h.in
      config.log
      config.status
      config.sub
      configure
      depcomp
      docs
      install-sh
      libtool
      ltmain.sh
      missing
      nebclient.pc
      stamp-h1
  • branches/neb_distrib_20081210/Nebulous/nebclient/src/nebclient.c

    r20986 r23536  
    44 * Copyright (C) 2005  Joshua Hoblitt
    55 *
    6  * $Id: nebclient.c,v 1.54.6.1 2008-12-14 22:03:08 eugene Exp $
     6 * $Id: nebclient.c,v 1.57 2009-02-13 02:45:47 jhoblitt Exp $
    77 */
    88
     
    336336bool nebSetXattr(nebServer *server, const char *key, const char *name, const char *value, nebCR flag)
    337337{
    338 
    339338    REQUIRE_SERVER;
    340339
     
    363362    if (!response) {
    364363        nebSetErr(server, "can not set xattr");
     364        return false;
     365    }
     366
     367    return true;
     368}
     369
     370
     371char *nebGetXattr(nebServer *server, const char *key, const char *name)
     372{
     373    REQUIRE_SERVER;
     374
     375    if (!key) {
     376        nebSetErr(server, "parameter 'key' may not be NULL");
     377        return false;
     378    }
     379    if (!name) {
     380        nebSetErr(server, "parameter 'name' may not be NULL");
     381        return false;
     382    }
     383
     384    struct ns1__getxattr_USCOREobjectResponse response;
     385    if (soap_call_ns1__getxattr_USCOREobject(server->soap, server->endpoint,
     386        NULL, (char *)key, (char *)name, (char **)&response) != SOAP_OK) {
     387        nebSetServerErr(server);
     388        return false;
     389    }
     390
     391    if (!(char *)response.result) {
     392        nebSetErr(server, "server returned no result");
     393        return NULL;
     394    }
     395
     396    char *value = xmalloc(strlen((char *)response.result) + 1);
     397    strcpy(value, (char *)response.result);
     398
     399    return value;
     400}
     401
     402
     403int nebListXattr(nebServer *server, const char *key, char ***xattrs)
     404{
     405    REQUIRE_SERVER;
     406
     407    if (!key) {
     408        nebSetErr(server, "parameter 'key' may not be NULL");
     409        return false;
     410    }
     411
     412    struct ns1__listxattr_USCOREobjectResponse response;
     413    if (soap_call_ns1__listxattr_USCOREobject(server->soap, server->endpoint,
     414        NULL, (char *)key, &response) != SOAP_OK) {
     415        nebSetServerErr(server);
     416        return false;
     417    }
     418
     419    int resultElements = response.result->__size;
     420
     421    if (xattrs) {
     422        char **resultArray = response.result->__ptr;
     423        *xattrs = xmalloc(resultElements * sizeof(char *));
     424        if (resultElements) {
     425            for (int i = 0; i < resultElements; i++) {
     426                *xattrs[i] = xmalloc(strlen(resultArray[i]) + 1);
     427                strcpy(*xattrs[i], resultArray[i]);
     428            }
     429
     430        }
     431    }
     432
     433    return resultElements;
     434}
     435
     436
     437bool nebRemoveXattr(nebServer *server, const char *key, const char *name)
     438{
     439    REQUIRE_SERVER;
     440
     441    if (!key) {
     442        nebSetErr(server, "parameter 'key' may not be NULL");
     443        return false;
     444    }
     445    if (!name) {
     446        nebSetErr(server, "parameter 'name' may not be NULL");
     447        return false;
     448    }
     449
     450    int response;
     451    if (soap_call_ns1__removexattr_USCOREobject(server->soap, server->endpoint,
     452        NULL, (char *)key, (char *)name, &response) != SOAP_OK) {
     453        nebSetServerErr(server);
     454        return false;
     455    }
     456
     457    if (!response) {
     458        nebSetErr(server, "can not remove xattr");
    365459        return false;
    366460    }
     
    539633
    540634    for (int i = 0; i < locations->n; i++) {
    541         if (!nebDeleteInstance(server, key, locations->URI[i])) {
     635      if (!nebDeleteInstance(server, key, locations->URI[i])) {
    542636            nebSetErr(server, "can not delete instance");
    543637            nebObjectInstancesFree(locations);
     
    676770
    677771    if (soap_call_ns1__delete_USCOREinstance(server->soap, server->endpoint,
    678             NULL, (char *)key, (char *)URI, &response) != SOAP_OK) {
     772        NULL, (char *)key, (char *)URI, &response) != SOAP_OK) {
    679773        nebFree(filename);
    680774
Note: See TracChangeset for help on using the changeset viewer.