1
// this is the "wrapper" header file for the zip/unzip functions to expose to BOINC clients
2
// CMC - 18/03/2004, Oxford University for BOINC project
3
// released under the BOINC license
5
// note that I've disabled zip encryption to try and simplify things
6
// (zip encryption is fairly weak and easy to break anyway)
8
// you will need to link against the library (boinc_zip.lib on Windows-Release,
9
// boinc_zipd.lib for Windows-Debug, or libboinc_zip.a on Unix & Mac OSX)
11
// also you will need to include filesys.C in your project
12
// (decided not to add that in the lib due to version problems that may arise)
18
#include <sys/types.h>
24
// bitmasks for sort type on the ZipFileList
25
// optional but CPDN SmallExecs likes reverse date order
26
#define SORT_ASCENDING 0x01
27
#define SORT_DESCENDING 0x02
29
#define SORT_TIME 0x10
30
#define SORT_NAME 0x20
35
typedef std::vector<std::string> ZipFileList;
37
// forward declarations for boinc_zip functions
38
// note it's basically like running zip/unzip, just comprise an argc/argv
39
// send in an input file or path wildcard, output filename, and basic options
41
// default options for zip (bZip = true) are "-j9q" which is
42
// DON'T recurse/list subdirectories, best compression, quiet operation
43
// call it with bZiptype = ZIP_IP to zip, bZip = UNZIP_IT to unzip (duh)
45
// note boinc_zip is overloaded for ease of use
46
// i.e. you can just send char filenames, or std::strings, or preferably
47
// a vector of std::string of filenames to add to the zip archive
49
// there is also a crude but handy wildcard matching function to build
50
// the vector of string's, and probably better than using wildcards in zip
53
bool boinc_filelist(const std::string directory,
54
const std::string pattern,
56
const unsigned char ucSort = SORT_NAME | SORT_DESCENDING,
57
const bool bClear = true);
58
int boinc_zip(int bZipType, const std::string szFileZip, const ZipFileList* pvectszFileIn);
59
int boinc_zip(int bZipType, const std::string szFileZip, const std::string szFileIn);
61
int boinc_UnzipToMemory ( char *zip, char *file, std::string &retstr );
66
int boinc_zip(int bZipType, const char* szFileZip, const char* szFileIn);