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

#include <errno.h>
#include <stdio.h>
#include <string.h>
#include "stdsoap2.h"
#include "rmcH.h"
#include "edg_replica_metadata_catalogSoapBinding+.nsmap"
#include "rmcC.c"
#include "rmcClient.c"

Go to the source code of this file.

Defines

#define SOAP_FMAC3   static
#define SOAP_FMAC5   static

Functions

static int rmc_init (struct soap *soap, char *errbuf, int errbufsz)
char * rmc_guidfromlfn (const char *lfn, char *errbuf, int errbufsz)
char ** rmc_lfnsforguid (const char *guid, char *errbuf, int errbufsz)
 rmc_create_alias (const char *guid, const char *lfn, char *errbuf, int errbufsz)
 rmc_register_alias (const char *guid, const char *lfn, char *errbuf, int errbufsz)
 rmc_unregister_alias (const char *guid, const char *lfn, char *errbuf, int errbufsz)

Variables

char * lrc_endpoint
char * rmc_endpoint


Define Documentation

#define SOAP_FMAC3   static
 

Definition at line 14 of file rmc_ifce.c.

#define SOAP_FMAC5   static
 

Definition at line 16 of file rmc_ifce.c.


Function Documentation

rmc_create_alias const char *  guid,
const char *  lfn,
char *  errbuf,
int  errbufsz
 

Definition at line 136 of file rmc_ifce.c.

References rmc_register_alias().

00137 {
00138         return (rmc_register_alias (guid, lfn));
00139 }

char* rmc_guidfromlfn const char *  lfn,
char *  errbuf,
int  errbufsz
 

Definition at line 52 of file rmc_ifce.c.

References gfal_errmsg(), rmc_endpoint, and rmc_init().

Referenced by guidfromlfn().

00053 {
00054         struct ns3__guidForAliasResponse out;
00055         char *p;
00056         int ret;
00057         int sav_errno;
00058         struct soap soap;
00059 
00060         if (rmc_init (&soap, errbuf, errbufsz) < 0)
00061                 return (NULL);
00062 
00063         if (ret = soap_call_ns3__guidForAlias (&soap, rmc_endpoint, "",
00064             (char *) lfn, &out)) {
00065                 if (ret == SOAP_FAULT) {
00066                         if (strstr (soap.fault->faultcode, "NOSUCHALIAS"))
00067                                 sav_errno = ENOENT;
00068                         else {
00069                 gfal_errmsg(errbuf, errbufsz, soap.fault->faultstring);
00070                                 sav_errno = ECOMM;
00071                         }
00072                 } else {
00073                         gfal_errmsg(errbuf, errbufsz, soap.fault->faultstring);
00074                         sav_errno = ECOMM;
00075                 }
00076                 soap_end (&soap);
00077                 soap_done (&soap);
00078                 errno = sav_errno;
00079                 return (NULL);
00080         } else {
00081                 p = strdup (out._guidForAliasReturn);
00082                 soap_end (&soap);
00083                 soap_done (&soap);
00084                 return (p);
00085         }
00086 }

static int rmc_init struct soap *  soap,
char *  errbuf,
int  errbufsz
[static]
 

Definition at line 28 of file rmc_ifce.c.

References get_rls_endpointsx(), lrc_endpoint, and rmc_endpoint.

Referenced by rmc_guidfromlfn(), rmc_lfnsforguid(), rmc_register_alias(), and rmc_unregister_alias().

00029 {
00030         int flags;
00031 
00032         soap_init (soap);
00033         soap->namespaces = namespaces_rmc;
00034 
00035         if (rmc_endpoint == NULL &&
00036             (rmc_endpoint = getenv ("RMC_ENDPOINT")) == NULL &&
00037             get_rls_endpointsx (&lrc_endpoint, &rmc_endpoint, errbuf, errbufsz)) {
00038                 errno = EINVAL;
00039                 return (-1);
00040         }
00041 
00042 #ifdef GFAL_SECURE
00043         if (strncmp (rmc_endpoint, "https", 5) == 0) {
00044                 flags = CGSI_OPT_SSL_COMPATIBLE;
00045                 soap_register_plugin_arg (soap, client_cgsi_plugin, &flags);
00046         }
00047 #endif
00048         return (0);
00049 }

char** rmc_lfnsforguid const char *  guid,
char *  errbuf,
int  errbufsz
 

Definition at line 89 of file rmc_ifce.c.

References gfal_errmsg(), rmc_endpoint, and rmc_init().

Referenced by lfnsforguid().

00090 {
00091         int i;
00092         int j;
00093         char **lfnarray;
00094         struct ns3__getAliasesResponse out;
00095         char *p;
00096         int ret;
00097         int sav_errno;
00098         struct soap soap;
00099 
00100         if (rmc_init (&soap, errbuf, errbufsz) < 0)
00101                 return (NULL);
00102 
00103         if (ret = soap_call_ns3__getAliases (&soap, rmc_endpoint, "",
00104             (char *) guid, &out)) {
00105                 if (ret == SOAP_FAULT) {
00106                         if (strstr (soap.fault->faultcode, "NOSUCHGUID"))
00107                                 sav_errno = ENOENT;
00108                         else {
00109                           gfal_errmsg(errbuf, errbufsz, soap.fault->faultstring);
00110                                 sav_errno = ECOMM;
00111                         }
00112                 } else {
00113                         gfal_errmsg(errbuf, errbufsz, soap.fault->faultstring);
00114                         sav_errno = ECOMM;
00115                 }
00116                 soap_end (&soap);
00117                 soap_done (&soap);
00118                 errno = sav_errno;
00119                 return (NULL);
00120         }
00121         if ((lfnarray = calloc (out._getAliasesReturn->__size + 1, sizeof(char *))) == NULL) 
00122                 return (NULL);
00123         for (i = 0; i < out._getAliasesReturn->__size; i++) {
00124                 if ((lfnarray[i] = strdup (out._getAliasesReturn->__ptr[i])) == NULL) {
00125                         for (j = 0; j < i; j++)
00126                                 free (lfnarray[j]);
00127                         free (lfnarray);
00128                         return (NULL); 
00129                 }
00130         }
00131         soap_end (&soap);
00132         soap_done (&soap);
00133         return (lfnarray);
00134 }

rmc_register_alias const char *  guid,
const char *  lfn,
char *  errbuf,
int  errbufsz
 

Definition at line 141 of file rmc_ifce.c.

References gfal_errmsg(), rmc_endpoint, and rmc_init().

Referenced by create_alias(), register_alias(), and rmc_create_alias().

00142 {
00143         struct ns3__addAliasResponse out;
00144         int ret;
00145         int sav_errno;
00146         struct soap soap;
00147 
00148         if (rmc_init (&soap, errbuf, errbufsz) < 0)
00149                 return (-1);
00150 
00151         if (ret = soap_call_ns3__addAlias (&soap, rmc_endpoint, "",
00152             (char *) guid, (char *) lfn, &out)) {
00153                 if (ret == SOAP_FAULT) {
00154                         if (strstr (soap.fault->faultcode, "ALIASEXISTS"))
00155                                 sav_errno = EEXIST;
00156                         else if (strstr (soap.fault->faultcode, "VALUETOOLONG"))
00157                                 sav_errno = ENAMETOOLONG;
00158                         else {
00159                         gfal_errmsg(errbuf, errbufsz, soap.fault->faultstring);
00160                                 sav_errno = ECOMM;
00161                         }
00162                 } else {
00163                         gfal_errmsg(errbuf, errbufsz, soap.fault->faultstring);
00164                         sav_errno = ECOMM;
00165                 }
00166                 soap_end (&soap);
00167                 soap_done (&soap);
00168                 errno = sav_errno;
00169                 return (-1);
00170         }
00171         soap_end (&soap);
00172         soap_done (&soap);
00173         return (0);
00174 }

rmc_unregister_alias const char *  guid,
const char *  lfn,
char *  errbuf,
int  errbufsz
 

Definition at line 176 of file rmc_ifce.c.

References gfal_errmsg(), rmc_endpoint, and rmc_init().

Referenced by unregister_alias().

00177 {
00178         struct ns3__removeAliasResponse out;
00179         int ret;
00180         struct soap soap;
00181 
00182         if (rmc_init (&soap, errbuf, errbufsz) < 0)
00183                 return (-1);
00184 
00185         if (ret = soap_call_ns3__removeAlias (&soap, rmc_endpoint, "",
00186             (char *) guid, (char *) lfn, &out)) {
00187                 gfal_errmsg(errbuf, errbufsz, soap.fault->faultstring);
00188                 soap_end (&soap);
00189                 soap_done (&soap);
00190                 errno = ECOMM;
00191                 return (-1);
00192         }
00193         soap_end (&soap);
00194         soap_done (&soap);
00195         return (0);
00196 }


Variable Documentation

char* lrc_endpoint
 

Definition at line 23 of file lrc_ifce.c.

Referenced by lrc_get_catalog_endpoint(), lrc_guid_exists(), lrc_guidforpfn(), lrc_init(), lrc_register_pfn(), lrc_replica_exists(), lrc_setfilesize(), lrc_surlfromguid(), lrc_surlsfromguid(), lrc_unregister_pfn(), and rmc_init().

char* rmc_endpoint
 

Definition at line 25 of file rmc_ifce.c.

Referenced by lrc_init(), rmc_guidfromlfn(), rmc_init(), rmc_lfnsforguid(), rmc_register_alias(), and rmc_unregister_alias().


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