/Home/aooliver/work/stagersvc/org.glite.data.lcg_gfal/src/srm_ifce.c File Reference

#include <sys/types.h>
#include <errno.h>
#include <grp.h>
#include <pwd.h>
#include <stdio.h>
#include <sys/stat.h>
#include "gfal_api.h"
#include "srmH.h"
#include "ISRM.nsmap"

Go to the source code of this file.

Defines

#define DEFPOLLINT   10

Functions

static int srm_init (struct soap *soap, const char *surl, char *srm_endpoint, int srm_endpointsz, char *errbuf, int errbufsz)
 srm_deletesurl (const char *surl, char *errbuf, int errbufsz, int timeout)
 srm_get (int nbfiles, char **surls, int nbprotocols, char **protocols, int *reqid, char **token, struct srm_filestatus **filestatuses, int timeout)
 srm_getx (int nbfiles, char **surls, int nbprotocols, char **protocols, int *reqid, char **token, struct srm_filestatus **filestatuses, char *errbuf, int errbufsz, int timeout)
 srm_getstatus (int nbfiles, char **surls, int reqid, char *token, struct srm_filestatus **filestatuses, int timeout)
 srm_getstatusx (int nbfiles, char **surls, int reqid, char *token, struct srm_filestatus **filestatuses, char *errbuf, int errbufsz, int timeout)
 srm_turlsfromsurls (int nbfiles, const char **surls, LONG64 *filesizes, char **protocols, int oflag, int *reqid, int **fileids, char **token, char ***turls, char *errbuf, int errbufsz, int timeout)
char * srm_turlfromsurl (const char *surl, char **protocols, int oflag, int *reqid, int *fileid, char **token, char *errbuf, int errbufsz, int timeout)
 srm_getfilemd (const char *surl, struct stat64 *statbuf, char *errbuf, int errbufsz, int timeout)
 srm_set_xfer_done (const char *surl, int reqid, int fileid, char *token, int oflag, char *errbuf, int errbufsz, int timeout)
 srm_set_xfer_running (const char *surl, int reqid, int fileid, char *token, char *errbuf, int errbufsz, int timeout)


Define Documentation

#define DEFPOLLINT   10
 

Definition at line 21 of file srm_ifce.c.


Function Documentation

srm_deletesurl const char *  surl,
char *  errbuf,
int  errbufsz,
int  timeout
 

Definition at line 43 of file srm_ifce.c.

References gfal_errmsg(), and srm_init().

Referenced by deletesurl().

00044 {
00045         struct ns5__advisoryDeleteResponse out;
00046         int ret;
00047         struct soap soap;
00048         char srm_endpoint[256];
00049         struct ArrayOfstring surlarray;
00050 
00051 
00052         if (srm_init (&soap, surl, srm_endpoint, sizeof(srm_endpoint),
00053             errbuf, errbufsz) < 0)
00054                 return (-1);
00055         soap.send_timeout = timeout ;
00056         soap.recv_timeout = timeout ;
00057 
00058 
00059         /* issue "advisoryDelete" request */
00060 
00061         surlarray.__ptr = (char **)&surl;
00062         surlarray.__size = 1;
00063 
00064         if (ret = soap_call_ns5__advisoryDelete (&soap, srm_endpoint,
00065             "advisoryDelete", &surlarray, &out)) {
00066                 if (soap.error == SOAP_EOF) {
00067                         gfal_errmsg(errbuf, errbufsz, "connection fails or timeout");
00068                         soap_end (&soap);
00069                         soap_done (&soap);
00070                         return (-1);
00071                 }
00072                 if(ret == SOAP_FAULT || ret == SOAP_CLI_FAULT)
00073                         gfal_errmsg(errbuf, errbufsz, soap.fault->faultstring);
00074                 soap_end (&soap);
00075                 soap_done (&soap);
00076                 return (-1);
00077         }
00078         soap_end (&soap);
00079         soap_done (&soap);
00080         return (0);
00081 }

srm_get int  nbfiles,
char **  surls,
int  nbprotocols,
char **  protocols,
int *  reqid,
char **  token,
struct srm_filestatus **  filestatuses,
int  timeout
 

Definition at line 83 of file srm_ifce.c.

References srm_getx().

Referenced by main().

00085 {
00086         return (srm_getx (nbfiles, surls, nbprotocols, protocols, reqid, token,
00087                           filestatuses, NULL, 0, timeout));
00088 }

srm_getfilemd const char *  surl,
struct stat64 *  statbuf,
char *  errbuf,
int  errbufsz,
int  timeout
 

Definition at line 445 of file srm_ifce.c.

References gfal_errmsg(), and srm_init().

Referenced by getfilemd().

00446 {
00447         struct group *gr;
00448         struct ns5__getFileMetaDataResponse out;
00449         struct passwd *pw;
00450         int ret;
00451         int sav_errno;
00452         struct soap soap;
00453         char srm_endpoint[256];
00454         struct ArrayOfstring surlarray;
00455 
00456         if (srm_init (&soap, surl, srm_endpoint, sizeof(srm_endpoint),
00457             errbuf, errbufsz) < 0)
00458                 return (-1);
00459         soap.send_timeout = timeout ;
00460         soap.recv_timeout = timeout ;
00461 
00462 
00463         /* issue "getFileMetaData" request */
00464 
00465         surlarray.__ptr = (char **)&surl;
00466         surlarray.__size = 1;
00467 
00468         if ((ret = soap_call_ns5__getFileMetaData (&soap, srm_endpoint,
00469             "getFileMetaData", &surlarray, &out))) {
00470                 if (soap.error == SOAP_EOF) {
00471                         gfal_errmsg(errbuf, errbufsz, "connection fails or timeout");
00472                         soap_end (&soap);
00473                         soap_done (&soap);
00474                         return (-1);
00475                 }
00476                 if (ret == SOAP_FAULT || ret == SOAP_CLI_FAULT) {
00477                         if (strstr (soap.fault->faultstring, "No such file") ||
00478                             strstr (soap.fault->faultstring, "could not get storage info by path"))
00479                                 sav_errno = ENOENT;
00480                         else {
00481                                 sav_errno = ECOMM;
00482                                 gfal_errmsg(errbuf, errbufsz, soap.fault->faultstring);
00483                         }                               
00484                 } else {
00485                         sav_errno = ECOMM;
00486                         gfal_errmsg(errbuf, errbufsz, "Error calling getFileMetaData on SRM, but no error message returned");
00487                 }
00488                 soap_end (&soap);
00489                 soap_done (&soap);
00490                 errno = sav_errno;
00491                 return (-1);
00492         }
00493         if (out._Result->__size == 0 || out._Result->__ptr[0]->SURL == NULL) {
00494                 soap_end (&soap);
00495                 soap_done (&soap);
00496                 errno = ENOENT;
00497                 return (-1);
00498         }
00499         memset (statbuf, 0, sizeof(struct stat64));
00500         statbuf->st_mode = out._Result->__ptr[0]->permMode;
00501         if ((statbuf->st_mode & S_IFMT) == 0)
00502                 statbuf->st_mode |= S_IFREG;
00503         statbuf->st_nlink = 1;
00504         if (out._Result->__ptr[0]->owner && (pw = getpwnam (out._Result->__ptr[0]->owner)))
00505                 statbuf->st_uid = pw->pw_uid;
00506         else
00507                 statbuf->st_uid = 2;
00508         if (out._Result->__ptr[0]->group && (gr = getgrnam (out._Result->__ptr[0]->group)))
00509                 statbuf->st_gid = gr->gr_gid;
00510         else
00511                 statbuf->st_gid = 2;
00512         statbuf->st_size = out._Result->__ptr[0]->size;
00513         soap_end (&soap);
00514         soap_done (&soap);
00515         return (0);
00516 }

srm_getstatus int  nbfiles,
char **  surls,
int  reqid,
char *  token,
struct srm_filestatus **  filestatuses,
int  timeout
 

Definition at line 176 of file srm_ifce.c.

References srm_getstatusx().

Referenced by main().

00178 {
00179         return (srm_getstatusx (nbfiles, surls, reqid, token, filestatuses,
00180             NULL, 0, timeout));
00181 }

srm_getstatusx int  nbfiles,
char **  surls,
int  reqid,
char *  token,
struct srm_filestatus **  filestatuses,
char *  errbuf,
int  errbufsz,
int  timeout
 

Definition at line 183 of file srm_ifce.c.

References gfal_errmsg(), srm_init(), srm_filestatus::status, and srm_filestatus::surl.

Referenced by srm_getstatus().

00185 {
00186         int errflag = 0;
00187         struct ns1__RequestFileStatus *f;
00188         struct srm_filestatus *fs;
00189         int i;
00190         int n;
00191         struct ns5__getRequestStatusResponse outq;
00192         char *p;
00193         struct ns1__RequestStatus *reqstatp;
00194         int ret;
00195         int sav_errno;
00196         struct soap soap;
00197         char srm_endpoint[256];
00198         struct ArrayOfstring surlarray;
00199 
00200         if (srm_init (&soap, surls[0], srm_endpoint, sizeof(srm_endpoint),
00201             errbuf, errbufsz) < 0)
00202                 return (-1);
00203         soap.send_timeout = timeout;
00204         soap.recv_timeout = timeout;
00205 
00206 
00207         if (ret = soap_call_ns5__getRequestStatus (&soap, srm_endpoint,
00208             "getRequestStatus", reqid, &outq)) {
00209                 if (soap.error == SOAP_EOF) {
00210                         gfal_errmsg(errbuf, errbufsz, "connection fails or timeout");
00211                         soap_end (&soap);
00212                         soap_done (&soap);
00213                         return (-1);
00214                 }
00215                 if(ret == SOAP_FAULT || ret == SOAP_CLI_FAULT)
00216                         gfal_errmsg(errbuf, errbufsz, soap.fault->faultstring);
00217                 soap_end (&soap);
00218                 soap_done (&soap);
00219                 return (-1);
00220         }
00221         reqstatp = outq._Result;
00222         n = reqstatp->fileStatuses->__size;
00223         if ((*filestatuses = calloc (n, sizeof(struct srm_filestatus))) == NULL) {
00224                 soap_end (&soap);
00225                 soap_done (&soap);
00226                 errno = ENOMEM;
00227                 return (-1);
00228         }
00229         fs = *filestatuses;
00230         for (i = 0; i < n; i++) {
00231                 f = reqstatp->fileStatuses->__ptr[i];
00232                 if (f->SURL && (fs->surl = strdup (f->SURL)) == NULL)
00233                         errflag++;
00234                 if (f->state) {
00235                         if (strcmp (f->state, "Pending") == 0 ||
00236                             strcmp (f->state, "pending") == 0)
00237                                 fs->status = 0;
00238                         else if (strcmp (f->state, "Failed") == 0 ||
00239                             strcmp (f->state, "failed") == 0)
00240                                 fs->status = -1;
00241                         else
00242                                 fs->status = 1;
00243                 }
00244                 fs->fileid = f->fileId;
00245                 if (f->TURL && (fs->turl = strdup (f->TURL)) == NULL)
00246                         errflag++;
00247                 fs++;
00248         }
00249         soap_end (&soap);
00250         soap_done (&soap);
00251         return (n);
00252 }

srm_getx int  nbfiles,
char **  surls,
int  nbprotocols,
char **  protocols,
int *  reqid,
char **  token,
struct srm_filestatus **  filestatuses,
char *  errbuf,
int  errbufsz,
int  timeout
 

Definition at line 90 of file srm_ifce.c.

References gfal_errmsg(), srm_init(), srm_filestatus::status, and srm_filestatus::surl.

Referenced by srm_get().

00093 {
00094         int errflag = 0;
00095         struct ns1__RequestFileStatus *f;
00096         struct srm_filestatus *fs;
00097         int i;
00098         int n;
00099         struct ns5__getResponse outg;
00100         char *p;
00101         struct ArrayOfstring protoarray;
00102         struct ns1__RequestStatus *reqstatp;
00103         int ret;
00104         int sav_errno;
00105         struct soap soap;
00106         char srm_endpoint[256];
00107         struct ArrayOfstring surlarray;
00108 
00109         if (srm_init (&soap, surls[0], srm_endpoint, sizeof(srm_endpoint),
00110             errbuf, errbufsz) < 0)
00111                 return (-1);
00112         soap.send_timeout = timeout ;
00113         soap.recv_timeout = timeout ;
00114 
00115         surlarray.__ptr = (char **)surls;
00116         surlarray.__size = nbfiles;
00117         protoarray.__ptr = protocols;
00118         protoarray.__size = nbprotocols;
00119 
00120         if (ret = soap_call_ns5__get (&soap, srm_endpoint, "get", &surlarray,
00121             &protoarray, &outg)) {
00122                 if (soap.error == SOAP_EOF) {
00123                         gfal_errmsg(errbuf, errbufsz, "connection fails or timeout");
00124                         soap_end (&soap);
00125                         soap_done (&soap);
00126                         return (-1);
00127                 }
00128                 if(ret == SOAP_FAULT || ret == SOAP_CLI_FAULT)
00129                         gfal_errmsg(errbuf, errbufsz, soap.fault->faultstring);
00130                 soap_end (&soap);
00131                 soap_done (&soap);
00132                 return (-1);
00133         }
00134         reqstatp = outg._Result;
00135         if (reqstatp->fileStatuses == NULL) {
00136                 soap_end (&soap);
00137                 soap_done (&soap);
00138                 errno = EPROTONOSUPPORT;
00139                 return (-1);
00140         }
00141         *reqid = reqstatp->requestId;
00142         if (token)
00143                 *token = NULL;
00144         n = reqstatp->fileStatuses->__size;
00145         if ((*filestatuses = calloc (n, sizeof(struct srm_filestatus))) == NULL) {
00146                 soap_end (&soap);
00147                 soap_done (&soap);
00148                 errno = ENOMEM;
00149                 return (-1);
00150         }
00151         fs = *filestatuses;
00152         for (i = 0; i < n; i++) {
00153                 f = reqstatp->fileStatuses->__ptr[i];
00154                 if (f->SURL && (fs->surl = strdup (f->SURL)) == NULL)
00155                         errflag++;
00156                 if (f->state) {
00157                         if (strcmp (f->state, "Pending") == 0 ||
00158                             strcmp (f->state, "pending") == 0)
00159                                 fs->status = 0;
00160                         else if (strcmp (f->state, "Failed") == 0 ||
00161                             strcmp (f->state, "failed") == 0)
00162                                 fs->status = -1;
00163                         else
00164                                 fs->status = 1;
00165                 }
00166                 fs->fileid = f->fileId;
00167                 if (f->TURL && (fs->turl = strdup (f->TURL)) == NULL)
00168                         errflag++;
00169                 fs++;
00170         }
00171         soap_end (&soap);
00172         soap_done (&soap);
00173         return (n);
00174 }

static int srm_init struct soap *  soap,
const char *  surl,
char *  srm_endpoint,
int  srm_endpointsz,
char *  errbuf,
int  errbufsz
[static]
 

Definition at line 24 of file srm_ifce.c.

References parsesurl().

Referenced by srm_deletesurl(), srm_getfilemd(), srm_getstatusx(), srm_getx(), srm_set_xfer_done(), srm_set_xfer_running(), and srm_turlsfromsurls().

00026 {
00027         int flags;
00028         char *sfn;
00029 
00030         if (parsesurl (surl, srm_endpoint, srm_endpointsz, &sfn, errbuf, errbufsz) < 0)
00031                 return (-1);
00032 
00033         soap_init (soap);
00034         
00035 
00036 #ifdef GFAL_SECURE
00037         flags = CGSI_OPT_DISABLE_NAME_CHECK;
00038         soap_register_plugin_arg (soap, client_cgsi_plugin, &flags);
00039 #endif
00040         return (0);
00041 }

srm_set_xfer_done const char *  surl,
int  reqid,
int  fileid,
char *  token,
int  oflag,
char *  errbuf,
int  errbufsz,
int  timeout
 

Definition at line 518 of file srm_ifce.c.

References gfal_errmsg(), and srm_init().

Referenced by set_xfer_done().

00519 {
00520         struct ns5__setFileStatusResponse out;
00521         int ret;
00522         struct soap soap;
00523         char srm_endpoint[256];
00524 
00525         if (srm_init (&soap, surl, srm_endpoint, sizeof(srm_endpoint),
00526             errbuf, errbufsz) < 0)
00527                 return (-1);
00528         soap.send_timeout = timeout ;
00529         soap.recv_timeout = timeout ;
00530 
00531 
00532         if (ret = soap_call_ns5__setFileStatus (&soap, srm_endpoint,
00533             "setFileStatus", reqid, fileid, "Done", &out)) {
00534                 if (soap.error == SOAP_EOF) {
00535                         gfal_errmsg(errbuf, errbufsz, "connection fails or timeout");
00536                         soap_end (&soap);
00537                         soap_done (&soap);
00538                         return (-1);
00539                 }
00540                 if(ret == SOAP_FAULT || ret == SOAP_CLI_FAULT)
00541                         gfal_errmsg(errbuf, errbufsz, soap.fault->faultstring);
00542                 soap_end (&soap);
00543                 soap_done (&soap);
00544                 return (-1);
00545         }
00546         soap_end (&soap);
00547         soap_done (&soap);
00548         return (0);
00549 }

srm_set_xfer_running const char *  surl,
int  reqid,
int  fileid,
char *  token,
char *  errbuf,
int  errbufsz,
int  timeout
 

Definition at line 551 of file srm_ifce.c.

References gfal_errmsg(), and srm_init().

Referenced by set_xfer_running().

00552 {
00553         struct ns5__setFileStatusResponse out;
00554         int ret;
00555         struct soap soap;
00556         char srm_endpoint[256];
00557 
00558         if (srm_init (&soap, surl, srm_endpoint, sizeof(srm_endpoint),
00559             errbuf, errbufsz) < 0)
00560                 return (-1);
00561         soap.send_timeout = timeout ;
00562         soap.recv_timeout = timeout ;
00563 
00564 
00565         if (ret = soap_call_ns5__setFileStatus (&soap, srm_endpoint,
00566             "setFileStatus", reqid, fileid, "Running", &out)) {
00567                 if (soap.error == SOAP_EOF) {
00568                         gfal_errmsg(errbuf, errbufsz, "connection fails or timeout");
00569                         soap_end (&soap);
00570                         soap_done (&soap);
00571                         return (-1);
00572                 }
00573                 if(ret == SOAP_FAULT || ret == SOAP_CLI_FAULT)
00574                         gfal_errmsg(errbuf, errbufsz, soap.fault->faultstring);
00575                 soap_end (&soap);
00576                 soap_done (&soap);
00577                 return (-1);
00578         }
00579         soap_end (&soap);
00580         soap_done (&soap);
00581         return (0);
00582 }

char* srm_turlfromsurl const char *  surl,
char **  protocols,
int  oflag,
int *  reqid,
int *  fileid,
char **  token,
char *  errbuf,
int  errbufsz,
int  timeout
 

Definition at line 427 of file srm_ifce.c.

References srm_turlsfromsurls().

00429 {
00430         int *fileids;
00431         char *p;
00432         char **turls;
00433         LONG64 zero = 0;
00434 
00435         if (srm_turlsfromsurls (1, &surl, &zero, protocols, oflag,
00436             reqid, &fileids, token, &turls, errbuf, errbufsz, timeout) <= 0)
00437                 return (NULL);
00438         *fileid = fileids[0];
00439         p = turls[0];
00440         free (fileids);
00441         free (turls);
00442         return (p);
00443 }

srm_turlsfromsurls int  nbfiles,
const char **  surls,
LONG64 *  filesizes,
char **  protocols,
int  oflag,
int *  reqid,
int **  fileids,
char **  token,
char ***  turls,
char *  errbuf,
int  errbufsz,
int  timeout
 

Definition at line 254 of file srm_ifce.c.

References gfal_errmsg(), and srm_init().

00256 {
00257         int *f;
00258         int i;
00259         int n;
00260         int nbproto = 0;
00261         struct ns5__getResponse outg;
00262         struct ns5__putResponse outp;
00263         struct ns5__getRequestStatusResponse outq;
00264         char *p;
00265         struct ArrayOfboolean permarray;
00266         struct ArrayOfstring protoarray;
00267         int r = 0;
00268         struct ns1__RequestStatus *reqstatp;
00269         int ret;
00270         int sav_errno;
00271         struct ArrayOflong sizearray;
00272         struct soap soap;
00273         struct ArrayOfstring srcarray;
00274         char srm_endpoint[256];
00275         struct ArrayOfstring surlarray;
00276         char **t;
00277 
00278         if (srm_init (&soap, surls[0], srm_endpoint, sizeof(srm_endpoint),
00279             errbuf, errbufsz) < 0)
00280                 return (-1);
00281         soap.send_timeout = timeout ;
00282         soap.recv_timeout = timeout ;
00283 
00284 
00285         while (*protocols[nbproto]) nbproto++;
00286 
00287         /* issue "get" or the "put" request */
00288 
00289         surlarray.__ptr = (char **)surls;
00290         surlarray.__size = nbfiles;
00291         protoarray.__ptr = protocols;
00292         protoarray.__size = nbproto;
00293 
00294         if ((oflag & O_ACCMODE) == 0) {
00295                 if (ret = soap_call_ns5__get (&soap, srm_endpoint, "get", &surlarray,
00296                     &protoarray, &outg)) {
00297                         if (soap.error == SOAP_EOF) {
00298                                 gfal_errmsg(errbuf, errbufsz, "connection fails or timeout");
00299                                 soap_end (&soap);
00300                                 soap_done (&soap);
00301                                 return (-1);
00302                         }
00303                         if(ret == SOAP_FAULT || ret == SOAP_CLI_FAULT)
00304                                 gfal_errmsg(errbuf, errbufsz, soap.fault->faultstring);
00305                         soap_end (&soap);
00306                         soap_done (&soap);
00307                         return (-1);
00308                 }
00309                 reqstatp = outg._Result;
00310         } else {
00311                 srcarray.__ptr = (char **)surls;
00312                 srcarray.__size = nbfiles;
00313                 sizearray.__ptr = filesizes;
00314                 sizearray.__size = nbfiles;
00315                 if ((permarray.__ptr =
00316                     soap_malloc (&soap, nbfiles * sizeof(enum xsd__boolean))) == NULL) {
00317                         soap_end (&soap);
00318                         soap_done (&soap);
00319                         errno = ENOMEM;
00320                         return (-1);
00321                 }
00322                 for (i = 0; i< nbfiles; i++)
00323                         permarray.__ptr[i] = true_;
00324                 permarray.__size = nbfiles;
00325                 if (ret = soap_call_ns5__put (&soap, srm_endpoint, "put", &srcarray,
00326                     &surlarray, &sizearray, &permarray, &protoarray, &outp)) {
00327                         if (soap.error == SOAP_EOF) {
00328                                 gfal_errmsg(errbuf, errbufsz, "connection fails or timeout");
00329                                 soap_end (&soap);
00330                                 soap_done (&soap);
00331                                 return (-1);
00332                         }
00333                         if(ret == SOAP_FAULT || ret == SOAP_CLI_FAULT)
00334                                 gfal_errmsg(errbuf, errbufsz, soap.fault->faultstring);
00335                         soap_end (&soap);
00336                         soap_done (&soap);
00337                         return (-1);
00338                 }
00339                 reqstatp = outp._Result;
00340         }
00341         if (reqstatp->fileStatuses == NULL) {
00342                 soap_end (&soap);
00343                 soap_done (&soap);
00344                 errno = EPROTONOSUPPORT;
00345                 return (-1);
00346         }
00347         *reqid = reqstatp->requestId;
00348 
00349         /* wait for file "ready" */
00350 
00351         while (strcmp (reqstatp->state, "pending") == 0 ||
00352             strcmp (reqstatp->state, "Pending") == 0) {
00353                 sleep ((r++ == 0) ? 1 : (reqstatp->retryDeltaTime > 0) ?
00354                     reqstatp->retryDeltaTime : DEFPOLLINT);
00355                 if (ret = soap_call_ns5__getRequestStatus (&soap, srm_endpoint,
00356                     "getRequestStatus", *reqid, &outq)) {
00357                         if (soap.error == SOAP_EOF) {
00358                                 gfal_errmsg(errbuf, errbufsz, "connection fails or timeout");
00359                                 soap_end (&soap);
00360                                 soap_done (&soap);
00361                                 return (-1);
00362                         }
00363                         if(ret == SOAP_FAULT || ret == SOAP_CLI_FAULT)
00364                                 gfal_errmsg(errbuf, errbufsz, soap.fault->faultstring);
00365                         soap_end (&soap);
00366                         soap_done (&soap);
00367                         return (-1);
00368                 }
00369                 reqstatp = outq._Result;
00370         }
00371         if (strcmp (reqstatp->state, "failed") == 0 ||
00372             strcmp (reqstatp->state, "Failed") == 0) {
00373                 if (reqstatp->errorMessage) {
00374                         if (strstr (reqstatp->errorMessage, "ile exists"))
00375                                 sav_errno = EEXIST;
00376                         else if (strstr (reqstatp->errorMessage, "does not exist") ||
00377                             strstr (reqstatp->errorMessage, "GetStorageInfoFailed"))
00378                                 sav_errno = ENOENT;
00379                         else if (strstr (reqstatp->errorMessage, "o such file or directory"))
00380                                 sav_errno = ENOENT;
00381                         else if (strstr (reqstatp->errorMessage, "ermission denied"))
00382                                 sav_errno = EACCES;
00383                         else if (strstr (reqstatp->errorMessage, "nvalid arg"))
00384                                 sav_errno = EINVAL;
00385                         else if (strstr (reqstatp->errorMessage, "rotocol"))
00386                                 sav_errno = EPROTONOSUPPORT;
00387                         else if (strstr (reqstatp->errorMessage, "o space left on device"))
00388                                 sav_errno = ENOSPC;
00389                         else {
00390                                 gfal_errmsg(errbuf, errbufsz, reqstatp->errorMessage);
00391                                 sav_errno = ECOMM;
00392                         }
00393                 } else  {
00394                   gfal_errmsg(errbuf, errbufsz, "SRM Get request failed, but no errorMessage supplied");
00395                   sav_errno = ECOMM;
00396                 }
00397                 soap_end (&soap);
00398                 soap_done (&soap);
00399                 errno = sav_errno;
00400                 return (-1);
00401         }
00402         n = reqstatp->fileStatuses->__size;
00403         if ((f = malloc (n * sizeof(int))) == NULL ||
00404             (t = malloc (n * sizeof(char *))) == NULL) {
00405                 soap_end (&soap);
00406                 soap_done (&soap);
00407                 errno = ENOMEM;
00408                 return (-1);
00409         }
00410         for (i = 0; i < n; i++) {
00411                 f[i] = (reqstatp->fileStatuses->__ptr[i])->fileId;
00412                 if (strcmp ((reqstatp->fileStatuses->__ptr[i])->state, "ready") &&
00413                     strcmp ((reqstatp->fileStatuses->__ptr[i])->state, "Ready"))
00414                         t[i] = NULL;
00415                 else
00416                         t[i] = strdup ((reqstatp->fileStatuses->__ptr[i])->TURL);
00417         }
00418         *fileids = f;
00419         *token = NULL;
00420         *turls = t;
00421         soap_end (&soap);
00422         soap_done (&soap);
00423         return (n);
00424 }


Generated on Fri Sep 8 20:20:48 2006 for GFAL by  doxygen 1.4.6