00001 #pragma once
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00027 #include <string.h>
00028 #include <regex.h>
00029
00030 #include <common/gfal_prototypes.h>
00031 #include <common/gfal_types.h>
00032 #include <common/gfal_constants.h>
00033 #include <externals/gsimplecache/gcachemain.h>
00034
00035
00036
00037 #define GFAL_PREFIX_SRM "srm://"
00038 #define GFAL_ENDPOINT_DEFAULT_PREFIX "httpg://"
00039
00040 #define SRM_XATTR_GETURL "user.replicas"
00041
00042 #define GFAL_SRM_LSTAT_PREFIX "lstat_"
00043
00044
00045 enum status_type {DEFAULT_STATUS = 0, MD_STATUS, PIN_STATUS};
00046
00047 enum se_type {TYPE_NONE = 0, TYPE_SRM, TYPE_SRMv2, TYPE_SE};
00048 enum gfal_srm_proto {PROTO_SRM=0, PROTO_SRMv2, PROTO_ERROR_UNKNOW};
00049
00050
00055 typedef struct _gfal_request_state{
00056 char * srmv2_token;
00057 struct srmv2_filestatus * srmv2_statuses;
00058 struct srmv2_pinfilestatus *srmv2_pinstatuses;
00059 enum gfal_srm_proto current_request_proto;
00060 char * request_endpoint;
00061 gboolean finished;
00062 int number;
00063 } gfal_request_state;
00064
00065
00066
00071 typedef struct _gfal_srmv2_opt{
00072 enum gfal_srm_proto srm_proto_type;
00073 int opt_srmv2_desiredpintime;
00074 char** opt_srmv2_protocols;
00075 char** opt_srmv2_tp3_protocols;
00076 char * opt_srmv2_spacetokendesc;
00077 regex_t rexurl;
00078 regex_t rex_full;
00079 gfal_handle handle;
00080 gint64 filesizes;
00081 gfal_request_state* last_request_state;
00082 GSimpleCache* cache;
00083 } gfal_srmv2_opt;
00084
00085 typedef gfal_srmv2_opt* gfal_srm_plugin_t;
00086
00087
00088
00089 typedef struct _gfal_srm_result{
00090 char turl[GFAL_URL_MAX_LEN+1];
00091 char *reqtoken;
00092 int err_code;
00093 char err_str[GFAL_ERRMSG_LEN+1];
00094 } gfal_srm_result;
00095
00096 typedef struct _gfal_srm_params{
00097 char** protocols;
00098 enum gfal_srm_proto proto_version;
00099 char * spacetokendesc;
00100 int desiredpintime;
00101 }* gfal_srm_params_t;
00102
00103 typedef void* srm_request_handle;
00104
00105 const char* gfal_srm_getName();
00106
00107 gfal_plugin_interface gfal_srm_initG(gfal_handle handle, GError** err);
00108
00109 void gfal_srm_destroyG(plugin_handle ch);
00110
00111 void gfal_srm_opt_initG(gfal_srmv2_opt* opts, gfal_handle handle);
00112
00113
00114 inline char* gfal_srm_construct_key(const char* url, const char* prefix, char* buff, const size_t s_buff);
00115 void gfal_set_default_storageG(gfal_srmv2_opt* opts, enum gfal_srm_proto proto);
00116
00117
00118 int gfal_srm_convert_filestatuses_to_GError(struct srmv2_filestatus* statuses, int n, GError** err);
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130