00001 00217 /****************************************************************************** 00218 * 00219 * File: securestorage_api.h 00220 * 00221 * Function: Secure Storage API header file 00222 * 00223 * Author(s): Giordano Scuderi and Nicola Dominante 00224 * 00225 * Copyright: Copyright (c) 2007 <Giordano Scuderi - gscuderi@unicosrl.it> 00226 * All Rights Reserved. 00227 * 00228 * 00229 * Notes: Redistributions of any form whatsoever must retain the following 00230 * acknowledgment: 00231 * "This product includes software developed by Giordano Scuderi 00232 * for Unico SRL" 00233 * 00234 * 00235 * ==================================================================== 00236 * Copyright (c) Giordano Scuderi, Unico SRL. All rights reserved. 00237 * 00238 * Redistribution and use in source and binary forms, with or without 00239 * modification, are permitted provided that the following conditions 00240 * are met: 00241 * 00242 * 1. Redistributions of source code must retain the above copyright 00243 * notice, this list of conditions and the following disclaimer. 00244 * 00245 * 2. Redistributions in binary form must reproduce the above copyright 00246 * notice, this list of conditions and the following disclaimer in 00247 * the documentation and/or other materials provided with the 00248 * distribution. 00249 * 00250 * 3. All advertising materials mentioning features or use of this 00251 * software must display the following acknowledgment: 00252 * "This product includes software developed by Giordano Scuderi 00253 * for Unico SRL" 00254 * 00255 * 4. The names "Secure Storage" must not be used to 00256 * endorse or promote products derived from this software without 00257 * prior written permission. For written permission, please contact 00258 * gscuderi@unicosrl.it. 00259 * 00260 * 5. Products derived from this software may not be called "Secure Storage" 00261 * nor may "Secure Storage" appear in their names without prior written 00262 * permission of Giordano Scuderi (Unico SRL). 00263 * 00264 * 6. Redistributions of any form whatsoever must retain the following 00265 * acknowledgment: 00266 * "This product includes software developed by Giordano Scuderi 00267 * for Unico SRL" 00268 * 00269 * THIS SOFTWARE IS PROVIDED BY UNICO SRL ``AS IS'' AND ANY 00270 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00271 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00272 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL UNICO SRL OR 00273 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00274 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 00275 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00276 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00277 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 00278 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00279 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 00280 * OF THE POSSIBILITY OF SUCH DAMAGE. 00281 * ==================================================================== 00282 * 00283 * "This product includes software developed by the OpenSSL Project 00284 * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 00285 * 00286 */ 00287 00288 00289 // \def Max number of open file with SecureStorage API. 00290 #define MAX_OPEN_FILES 1024 00291 // \def Default Catalog type. 00292 #define GFAL_DEFAULT_CATALOG_TYPE "lfc" 00293 00294 // \struct Used to store file-state information. 00295 struct ss_state { 00296 int fd; 00297 unsigned char hex_iv[HEX_IVSIZE]; 00298 unsigned char ivec[HEX_IVSIZE]; 00299 unsigned char ecount_buf[AES_BLOCK_SIZE]; 00300 unsigned int num; 00301 AES_KEY ctx; 00302 }; 00303 00304 #ifdef __cplusplus 00305 extern "C" 00306 { 00307 #endif 00308 00309 /****************************************************************************** 00310 * Alloc mem on ss_array struct and save file descriptor of open file on 00311 * remote SE 00312 * 00313 ******************************************************************************/ 00314 static struct ss_state *alloc_ss_state (int fd); 00315 00316 00317 /****************************************************************************** 00318 * Find correct position on ss_array struct with index (fd) 00319 * 00320 * 00321 ******************************************************************************/ 00322 static struct ss_state *find_ss_state (int fd); 00323 00324 00325 /****************************************************************************** 00326 * Free mem on ss_array struct 00327 * 00328 * 00329 ******************************************************************************/ 00330 static int free_ss_state (int fd); 00331 00332 00333 extern ss_DIR *lfc_opendirxg (char *server, const char *path, const char *guid); 00334 extern struct dirent *lfc_readdir (ss_DIR *dirp); 00335 extern int lfc_closedir (ss_DIR *dirp); 00336 extern int lfc_getreplica (const char *path, const char *guid, const char *se, 00337 int *nbentries, struct lfc_filereplica **rep_entries); 00338 extern int lfc_statg (const char *path, const char *guid, struct ss_filestatg 00339 *statbuf); 00340 extern int lfc_statr (const char *sfn, struct ss_filestatg *statbuf); 00341 extern int lfc_mkdir (const char *path, mode_t mode); 00342 extern int lfc_rmdir (const char *path); 00343 00344 #ifdef __cplusplus 00345 } /* closing brace for extern "C" */ 00346 #endif