Main Page | Data Structures | File List | Data Fields | Globals

securestorage.h File Reference

Secure Storage API header file. More...

Go to the source code of this file.

Data Structures

struct  lfc_filereplica
struct  ss_DIR
struct  ss_filestatg

Defines

#define LCG_MAXPATHLEN   1023
#define MAXPATHLENGTH   255
#define VO   "LCG_GFAL_VO"
#define SS_MAXPOOLNAMELEN   15
#define SS_MAXHOSTNAMELEN   63
#define SS_MAXSFNLEN   1103
#define SS_MAXGUIDLEN   36

Typedefs

typedef unsigned long long u_signed64

Functions

int lcg_scr (char *src_file, char *dest_file, char *guid, char *lfn, char *vo, char *conf_file, int insecure, int verbose, char *actual_gid)
 secure copy and register

int lcg_scp (char *src_file, char *dest_file, char *vo, char *conf_file, int insecure, int verbose)
 secure copy

int lcg_sdel (char *src_file, int aflag, char *se, char *vo, char *conf_file, int insecure, int verbose, int timeout)
 secure delete

int securestorage_open_extended (char *lfn, int flags, mode_t mode, char *vo, char *guid, char *se)
 open remote file on Storage Element ( EXTENDED )

int securestorage_open_se (char *lfn, int flags, mode_t mode, char *se)
 open remote file on specified Storage Element

int securestorage_open (char *lfn, int flags, mode_t mode)
 open remote file on default Storage Element

int securestorage_close (int fd)
 close remote file

int securestorage_write (int fd, void *buffer, size_t size)
 encrypt and write

int securestorage_read (int fd, void *buffer, size_t size)
 read and decrypt

off_t securestorage_lseek (int fd, off_t offset, int whence)
 positions/repositions to offset

int securestorage_del_extended (char *lfn, int aflag, char *se, char *vo, char *conf_file, int insecure, int verbose, int timeout)
 delete remote file ( EXTENDED )

int securestorage_del (char *lfn, int aflag, char *se)
 delete remote file

ss_DIRsecurestorage_opendir (const char *name)
 open remote directory

dirent * securestorage_readdir (ss_DIR *dp)
 read remote directory

int securestorage_closedir (ss_DIR *dp)
 close remote directory

int securestorage_mkdir (const char *path, mode_t mode)
 Make remote directory.

int securestorage_rmdir (const char *path)
 Remove remote directory.

int securestorage_statg (const char *path, const char *guid, struct ss_filestatg *statbuf)
 Get information about a LFC file or directory.

const char * securestorage_error (int errnum)
 Return descriptive string of error.


Detailed Description

Secure Storage API header file.

Author:
Giordano Scuderi and Nicola Dominante
Date:
2007

Definition in file securestorage.h.


Define Documentation

#define LCG_MAXPATHLEN   1023
 

Definition at line 77 of file securestorage.h.

Referenced by lcg_scp(), lcg_scr(), lcg_sdel(), main(), securestorage_del_extended(), and ss_get_lfchome().

#define MAXPATHLENGTH   255
 

Definition at line 79 of file securestorage.h.

#define SS_MAXGUIDLEN   36
 

Definition at line 91 of file securestorage.h.

#define SS_MAXHOSTNAMELEN   63
 

Definition at line 87 of file securestorage.h.

#define SS_MAXPOOLNAMELEN   15
 

Definition at line 85 of file securestorage.h.

#define SS_MAXSFNLEN   1103
 

Definition at line 89 of file securestorage.h.

#define VO   "LCG_GFAL_VO"
 

Definition at line 81 of file securestorage.h.


Typedef Documentation

typedef unsigned long long u_signed64
 

Definition at line 83 of file securestorage.h.


Function Documentation

int lcg_scp char *  src_file,
char *  dest_file,
char *  vo,
char *  conf_file,
int  insecure,
int  verbose
 

secure copy

copy a Grid file into local destination and remove encryption (only LFN input file are allowed).

Author:
Giordano Scuderi
Parameters:
src_file Input LFN.
dest_file Destination file (is a local path).
vo Virtual Organization; if NULL it use LCG_GFAL_VO environment varianble.
conf_file Actually ignored.
insecure Actually ignored.
verbose if 1 output is more verbose.
Returns:
0 if success or < 0 if fail in this case errno is set appropriately.

Definition at line 97 of file lcg_scp.c.

References accept_lfn, accept_vo, AES_BLOCK_SIZE, AES_KEY, AES_set_encrypt_key(), errno, HEX_IVSIZE, HEX_KEYSIZE, insecure, LCG_MAXPATHLEN, lock_memory(), aes_key_st::rd_key, securestorage_AES_ctr(), securestorage_error(), SS_EACCES, SS_EENCINIT, SS_EEXIST, SS_EINVALDEST, SS_EINVALLFN, SS_EINVALVO, SS_ESOURCENAMETOOLONG, ss_get_key(), ss_get_lfchome(), ss_get_surl(), TRANSFERBLOCKSIZE, verbose, and VO.

Referenced by main().

int lcg_scr char *  src_file,
char *  dest_file,
char *  guid,
char *  lfn,
char *  vo,
char *  conf_file,
int  insecure,
int  verbose,
char *  actual_gid
 

secure copy and register

copy local file to Grid Storage Element in encrypted format, save KEY into keystore and register LFN into catalog.

Author:
Giordano Scuderi
Parameters:
src_file Input file path.
dest_file Destination Storage Element hostname (Fully qualified).
guid If NULL a new random GUID will be used.
lfn Logical File Name (LFN) to register.
vo Virtual Organization; if NULL it use LCG_GFAL_VO environment varianble.
conf_file Actually ignored.
insecure Actually ignored.
verbose if 1 output is more verbose.
actual_gid Generated GUID.
Returns:
0 if success or < 0 if fail in this case errno is set appropriately.

Definition at line 96 of file lcg_scr.c.

References accept_host, accept_lfn, accept_vo, AES_BLOCK_SIZE, AES_KEY, AES_set_encrypt_key(), errno, HEX_IVSIZE, HEX_KEYSIZE, insecure, LCG_MAXPATHLEN, lock_memory(), aes_key_st::rd_key, securestorage_AES_ctr(), securestorage_error(), ss_check_lfn(), ss_delete_key(), SS_EDESTNAMETOOLONG, SS_EENCINIT, SS_EEXIST, SS_EINVALGUID, SS_EINVALLFN, SS_EINVALSE, SS_EINVALVO, ss_generate_surl(), ss_get_lfchome(), ss_rand(), ss_send_key(), TRANSFERBLOCKSIZE, verbose, and VO.

Referenced by main().

int lcg_sdel char *  src_file,
int  aflag,
char *  se,
char *  vo,
char *  conf_file,
int  insecure,
int  verbose,
int  timeout
 

secure delete

delete a grid file and associated KEY if necessary.

Author:
Giordano Scuderi
Parameters:
src_file Input LFN.
aflag If specified all replica's and KEY will be deleted.
se Specify Storage Element that contain a replica to delete; (if -a doesn't specified). if NULL it use VO_<vo>_DEFAULT_SE environment variable.
vo Virtual Organization; if NULL it use LCG_GFAL_VO environment varianble.
conf_file Actually ignored.
insecure Actually ignored.
verbose if 1 output is more verbose.
timeout 
Returns:
0 if success or < 0 if fail in this case errno is set appropriately.

Definition at line 98 of file lcg_sdel.c.

References accept_host, accept_lfn, accept_vo, errno, insecure, LCG_MAXPATHLEN, ss_check_lfn(), ss_delete_key(), SS_EINVALLFN, SS_EINVALSE, SS_EINVALVO, SS_ENOENT, SS_ESOURCENAMETOOLONG, ss_get_lfchome(), and verbose.

Referenced by main().

int securestorage_close int  fd  ) 
 

close remote file

opened with securestorage_open or securestorage_open_extended.

Author:
Giordano Scuderi
Parameters:
fd Remote file descriptor.
Returns:
0 if success or < 0 if fail in this case errno is set appropriately.

Definition at line 440 of file securestorage_api.c.

References errno.

Referenced by main().

int securestorage_closedir ss_DIR dp  ) 
 

close remote directory

in LCG File Catalog.

Author:
Giordano Scuderi
Parameters:
dp ss_DIR pointer returned from securestorage_opendir function.
Returns:
0 if success or < 0 if fail in this case errno is set appropriately.

Definition at line 976 of file securestorage_api.c.

References errno, lfc_closedir(), serrno, and SS_EINVAL.

Referenced by main().

int securestorage_del char *  lfn,
int  aflag,
char *  se
 

delete remote file

from selected SE, or all SE if -a flag is set to 1; it delete the associated Key if -a flag was specified, or if last replica was deleted.

Author:
Giordano Scuderi
Parameters:
lfn Logical File name of file that will be deleted.
aflag If specified all replica's and KEY will be deleted.
se Specify Storage Element that contain a replica to delete; (if -a doesn't specified). if NULL it use VO_<vo>_DEFAULT_SE environment variable.
Returns:
0 if success or < 0 if fail in this case errno is set appropriately.

Definition at line 847 of file securestorage_api.c.

References errno, insecure, securestorage_del_extended(), SS_EINVALSE, SS_EINVALVO, verbose, and VO.

Referenced by main().

int securestorage_del_extended char *  lfn,
int  aflag,
char *  se,
char *  vo,
char *  conf_file,
int  insecure,
int  verbose,
int  timeout
 

delete remote file ( EXTENDED )

from selected SE, or all SE if -a flag is set to 1; it delete the associated Key if -a flag was specified, or if last replica was deleted; extended ( user could specify vo, conf_file, insecure,verbose and timeout ).

Author:
Giordano Scuderi
Parameters:
lfn Logical File name of file that will be deleted.
aflag If specified all replica's and KEY will be deleted.
se Specify Storage Element that contain a replica to delete; (if -a doesn't specified). if NULL it use VO_<vo>_DEFAULT_SE environment variable.
vo Virtual Organization; if NULL it use LCG_GFAL_VO environment varianble.
conf_file Actually ignored.
insecure Actually ignored.
verbose if 1 output is more verbose.
timeout 
Returns:
0 if success or < 0 if fail in this case errno is set appropriately.

Definition at line 690 of file securestorage_api.c.

References accept_host, accept_lfn, accept_vo, errno, insecure, LCG_MAXPATHLEN, ss_check_lfn(), ss_delete_key(), SS_EINVALLFN, SS_EINVALSE, SS_EINVALVO, SS_ENAMETOOLONG, SS_ENOENT, SS_ENOREPLICA, ss_get_lfchome(), verbose, and VO.

Referenced by securestorage_del().

const char* securestorage_error int  errnum  ) 
 

Return descriptive string of error.

for errnum provided

Author:
Giordano Scuderi
Parameters:
errnum is the Secure Storage error number
Returns:
A descriptive String of error number provided or "Unknown Error 'errnum'" if error number is wrong.

Definition at line 547 of file ss-util.c.

off_t securestorage_lseek int  fd,
off_t  offset,
int  whence
 

positions/repositions to offset

the file associated with the descriptor fd generated by a previous securestorage_open.

whence:
Indicates how to interpret the offset value:
SEEK_SET the offset is set from beginning of file.
SEEK_CUR the offset is added to current position.
SEEK_END the offset is added to current file size.
Author:
Giordano Scuderi, Nicola Dominante
Parameters:
fd Destination file descriptor.
offset The offset.
whence Indicates how to interpret the offset value.
Returns:
0 if success or < 0 if fail in this case errno is set appropriately.

Definition at line 546 of file securestorage_api.c.

References AES_BLOCK_SIZE, AES_encrypt(), errno, HEX_IVSIZE, ivec_dec(), ivec_inc(), securestorage_write(), SS_EOFFSET, SS_ESPIPE, and SS_EWHENCE.

Referenced by main().

int securestorage_mkdir const char *  path,
mode_t  mode
 

Make remote directory.

in LCG File Catalog.

Author:
Giordano Scuderi
Parameters:
path Remote directory path.
mode Octal permission used for directory creation (for example: 0644).
Returns:
0 if success or < 0 if fail in this case errno is set appropriately.

Definition at line 999 of file securestorage_api.c.

References accept_lfn, errno, lfc_mkdir(), serrno, SS_EINVAL, SS_EINVALLFN, and ss_get_lfchome().

Referenced by main().

int securestorage_open char *  lfn,
int  flags,
mode_t  mode
 

open remote file on default Storage Element

existing file will be opened for reading, new file will be opened for reading and writing.

flags:
Value is built by put in OR the bits defined in <fcntl.h> but one and only one of the first three flags below must be used:
O_RDONLY open for reading only
O_WRONLY open for writing only
O_RDWR open for reading and writing
O_CREAT create a new file
O_LARGEFILE allows files whose sizes cannot be represented in 31 bits to be opened.
mode:
Is used only if the file is created.
Author:
Giordano Scuderi
Parameters:
lfn New LFN to create, or existing LFN to read.
flags For example O_CREAT|O_WRONLY to create new file.
mode Octal permission used on file creation (for example: 0644).
Returns:
file descriptor if success or < 0 if fail in this case errno is set appropriately.

Definition at line 392 of file securestorage_api.c.

References errno, securestorage_open_extended(), SS_EINVALLFN, SS_EINVALSE, SS_EINVALVO, and VO.

Referenced by main().

int securestorage_open_extended char *  lfn,
int  flags,
mode_t  mode,
char *  vo,
char *  guid,
char *  se
 

open remote file on Storage Element ( EXTENDED )

existing file will be opened for reading, new file will be opened for reading and writing.
Extended version ( user could specify VO, GUID and destination SE ).

Author:
Giordano Scuderi
Parameters:
lfn Input LFN.
flags 
mode 
vo Virtual Organization; if NULL it use LCG_GFAL_VO environment varianble.
guid On file creation, if null this GUID will be used for the remote file; when file is opened for reading will be ignored.
se On file creation, it specify destination Storage Element; if NULL it use VO_<vo>_DEFAULT_SE environment variable.
Returns:
file descriptor if success or < 0 if fail in this case errno is set appropriately.

Definition at line 167 of file securestorage_api.c.

References accept_host, accept_lfn, accept_vo, AES_BLOCK_SIZE, AES_set_encrypt_key(), errno, HEX_IVSIZE, HEX_KEYSIZE, insecure, ss_check_lfn(), SS_EENCINIT, SS_EEXIST, SS_EINVALGUID, SS_EINVALLFN, SS_EINVALSE, SS_EINVALVO, ss_generate_surl(), ss_get_key(), ss_get_lfchome(), ss_get_surl(), ss_rand(), ss_send_key(), and verbose.

Referenced by securestorage_open(), and securestorage_open_se().

int securestorage_open_se char *  lfn,
int  flags,
mode_t  mode,
char *  se
 

open remote file on specified Storage Element

existing file will be opened for reading, new file will be opened for reading and writing.

flags:
Value is built by put in OR the bits defined in <fcntl.h> but one and only one of the first three flags below must be used:
O_RDONLY open for reading only
O_WRONLY open for writing only
O_RDWR open for reading and writing
O_CREAT create a new file
O_LARGEFILE allows files whose sizes cannot be represented in 31 bits to be opened.
mode:
Is used only if the file is created.
Author:
Giordano Scuderi, Nicola Dominante
Parameters:
lfn New LFN to create, or existing LFN to read.
flags For example O_CREAT|O_WRONLY to create new file.
mode Octal permission used on file creation (for example: 0644).
se On file creation, it specify destination Storage Element;
Returns:
file descriptor if success or < 0 if fail in this case errno is set appropriately.

Definition at line 355 of file securestorage_api.c.

References errno, securestorage_open_extended(), SS_EINVALLFN, SS_EINVALSE, SS_EINVALVO, and VO.

ss_DIR* securestorage_opendir const char *  name  ) 
 

open remote directory

from LCG File Catalog.

Author:
Giordano Scuderi
Parameters:
name Remote directory path.
Returns:
ss_DIR pointer if success or NULL if fail in this case errno is set appropriately.

Definition at line 893 of file securestorage_api.c.

References accept_host, accept_lfn, errno, lfc_opendirxg(), serrno, SS_EINVAL, SS_EINVALLFN, and ss_get_lfchome().

Referenced by main().

int securestorage_read int  fd,
void *  buffer,
size_t  size
 

read and decrypt

a file from remote Storage Element ( SE ).

Author:
Giordano Scuderi
Parameters:
fd File descriptor.
buffer Buffer that contains decrypted plain data.
size Size of data to read from remote file.
Returns:
0 if success or < 0 if fail in this case errno is set appropriately.

Definition at line 506 of file securestorage_api.c.

References errno, and securestorage_AES_ctr().

Referenced by main().

struct dirent* securestorage_readdir ss_DIR dp  ) 
 

read remote directory

from LCG File Catalog.

Author:
Giordano Scuderi
Parameters:
dp ss_DIR pointer returned from securestorage_opendir function.
Returns:
dirent struct pointer if success or NULL if fail in this case errno is set appropriately.

Definition at line 952 of file securestorage_api.c.

References errno, lfc_readdir(), serrno, and SS_EINVAL.

Referenced by main().

int securestorage_rmdir const char *  path  ) 
 

Remove remote directory.

from LCG File Catalog.

Author:
Giordano Scuderi
Parameters:
path Remote directory path.
Returns:
0 if success or < 0 if fail in this case errno is set appropriately.

Definition at line 1046 of file securestorage_api.c.

References accept_lfn, errno, lfc_rmdir(), serrno, SS_EINVALLFN, and ss_get_lfchome().

Referenced by main().

int securestorage_statg const char *  path,
const char *  guid,
struct ss_filestatg statbuf
 

Get information about a LFC file or directory.

from LCG File Catalog.

Author:
Giordano Scuderi
Parameters:
path Remote directory path.
guid File GUID (Global Unique Identifier).
statbuf LFC filestat structure that contains returned information.
Returns:
0 if success or < 0 if fail in this case errno is set appropriately.

Definition at line 1091 of file securestorage_api.c.

References accept_lfn, errno, lfc_statg(), serrno, SS_EINVALLFN, and ss_get_lfchome().

Referenced by main().

int securestorage_write int  fd,
void *  buffer,
size_t  size
 

encrypt and write

a file on remote Storage Element ( SE ).

Author:
Giordano Scuderi
Parameters:
fd File descriptor.
buffer Buffer that contains plain data to encrypt and write into remote SE.
size Size of data in buffer to write on remote file.
Returns:
0 if success or < 0 if fail in this case errno is set appropriately.

Definition at line 466 of file securestorage_api.c.

References errno, and securestorage_AES_ctr().

Referenced by main(), and securestorage_lseek().


Generated on Wed May 30 09:56:31 2007 for Secure Storage Service by doxygen 1.3.5