CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/GeneratorInterface/SherpaInterface/interface/SherpackUtilities.h

Go to the documentation of this file.
00001 #ifndef SherpackUtilities_h
00002 #define SherpackUtilities_h
00003 
00004 /* Based on the zlib example code zpipe.c
00005  * Modified for the use of unzipping Sherpacks
00006  * Sebastian Thüer, Markus Merschmeyer
00007  * III. Phys. Inst. A, RWTH Aachen University
00008  * version 1.0, 1st August 2012
00009 */
00010 
00011 #include <stdlib.h>
00012 #include <stdio.h>
00013 #include <string>
00014 #include <string.h>
00015 #include <assert.h>
00016 #include <zlib.h>
00017 /* This is for mkdir(); this may need to be changed for some platforms. */
00018 #include <sys/stat.h>  /* For mkdir() */
00019 #include <openssl/md5.h>
00020 #include <fcntl.h>
00021 
00022 
00023 
00024 #define SET_BINARY_MODE(file)
00025 
00026 #define CHUNK 16384
00027 
00028 
00029 namespace spu {
00030 
00031 // functions for inflating (and deflating) -> (un)zipping the Sherpacks (taken from zlib and zpipe.c)
00032 int def(FILE*, FILE*, int);
00033 int inf(FILE*, FILE*);
00034 void zerr(int);
00035 int Unzip(std::string, std::string );
00036 
00037 // functions for untaring Sherpacks, based on
00038 // https://www.opensource.apple.com/source/libarchive/libarchive-23/libarchive/contrib/untar.c
00039 // ...but heavily modified for long path names...
00040 /* Parse an octal number, ignoring leading and trailing nonsense. */
00041 int parseoct(const char*, size_t);
00042 /* Returns true if this is 512 zero bytes. */
00043 int is_end_of_archive(const char*);
00044 /* Create a directory, including parent directories as necessary. */
00045 void create_dir(char*, int);
00046 /* Create a file, including parent directory as necessary. */
00047 FILE* create_file(char*, int);
00048 /* Verify the tar checksum. */
00049 int verify_checksum(const char*);
00050 /* Extract a tar archive. */
00051 void Untar(FILE*, const char*);
00052 
00053 // function for calculating the MD5 checksum of a file
00054 void md5_File(std::string, char*);
00055 
00056 
00057 } // End namespace spu
00058 #endif