Navit SVN

/work/compile/navit/src/navit/zipfile.h

00001 
00020 #ifndef __ZIPFILE_H__
00021 #define __ZIPFILE_H__
00022 
00023 #ifdef HAVE_PRAGMA_PACK
00024 #pragma pack(push)
00025 #pragma pack(1)
00026 #endif
00027 
00028 #ifdef  __GNUC__
00029 #define ATTRIBUTE_PACKED __attribute__ ((packed))
00030 #else
00031 #define ATTRIBUTE_PACKED
00032 #endif
00033 
00034 #define zip_split_sig 0x08074b50
00035 #define zip_split_sig_rev 0x504b0708
00036 
00037 struct zip_split {
00038         int zipsplitsig;
00039 };
00040 
00041 #define zip_lfh_sig 0x04034b50
00042 #define zip_lfh_sig_rev 0x504b0304
00043 
00044 
00046 
00049 struct zip_lfh {
00050         int ziplocsig;             
00051         short zipver;              
00052         short zipgenfld;           
00053         short zipmthd;             
00054         short ziptime;             
00055         short zipdate;             
00056         int zipcrc;                
00057         unsigned int zipsize;      
00058         unsigned int zipuncmp;     
00059         unsigned short zipfnln;    
00060         unsigned short zipxtraln;  
00061         char zipname[0];           
00062 } ATTRIBUTE_PACKED;
00063 
00064 #define zip_cd_sig 0x02014b50
00065 #define zip_cd_sig_rev 0x504b0102
00066 
00068 
00071 struct zip_cd {
00072         int zipcensig;   
00073         char zipcver;    
00074         char zipcos;     
00075         char zipcvxt;    
00076         char zipcexos;   
00077         short zipcflg;   
00078         short zipcmthd;  
00079         short ziptim;    
00080         short zipdat;    
00081         int zipccrc;     
00082         unsigned int zipcsiz;   
00083         unsigned int zipcunc;   
00084         unsigned short zipcfnl; 
00085         unsigned short zipcxtl; 
00086         unsigned short zipccml; 
00087         unsigned short zipdsk;  
00088         unsigned short zipint;  
00089         unsigned int zipext;    
00090         unsigned int zipofst;   
00091         char zipcfn[0];         
00092 } ATTRIBUTE_PACKED;
00093 
00099 #define zip_size_64bit_placeholder 0xffffffff
00100 
00104 #define zip_extra_header_id_zip64 0x0001
00105 
00107 
00110 struct zip_cd_ext {
00111         short tag;                   
00112         short size;                  
00113         unsigned long long zipofst;  
00114 } ATTRIBUTE_PACKED;
00115 
00116 struct zip_enc {
00117         short efield_header;
00118         short efield_size;
00119         short version;
00120         char vendor_id1,vendor_id2;
00121         char encryption_strength;
00122         short compress_method; 
00123 } ATTRIBUTE_PACKED;
00124 
00125 #define zip_eoc_sig 0x6054b50
00126 #define zip_eoc_sig_rev 0x504b0506
00127 
00129 
00132 struct zip_eoc {
00133         int zipesig;            /* end of central dir signature */
00134         unsigned short zipedsk; /* number of this disk */
00135         unsigned short zipecen; /* number of the disk with the start of the central directory */
00136         unsigned short zipenum; /* total number of entries in the central directory on this disk */
00137         unsigned short zipecenn; /* total number of entries in the central directory */
00138         unsigned int zipecsz;   /* size of the central directory */
00139         unsigned int zipeofst;  /* offset of start of central directory with respect to the starting disk number */
00140         short zipecoml;         /* .ZIP file comment length */
00141         char zipecom[0];        /* .ZIP file comment */
00142 } ATTRIBUTE_PACKED;
00143 
00144 #define zip64_eoc_sig 0x6064b50
00145 #define zip64_eoc_sig_rev 0x504b0606
00146 
00147 struct zip64_eoc {
00148         int zip64esig;                  /* zip64 end of central dir signature */
00149         unsigned long long zip64esize;  /* size of zip64 end of central directory record */
00150         unsigned short zip64ever;       /* version made by */
00151         unsigned short zip64eneed;      /* version needed to extract */
00152         unsigned int zip64edsk;         /* number of this disk */
00153         unsigned int zip64ecen;         /* number of the disk with the start of the central directory */
00154         unsigned long long zip64enum;   /* total number of entries in the central directory on this disk */
00155         unsigned long long zip64ecenn;  /* total number of entries in the central directory */
00156         unsigned long long zip64ecsz;   /* size of the central directory */
00157         unsigned long long zip64eofst;  /* offset of start of central directory with respect to the starting disk number */
00158         char zip64ecom[0];              /* zip64 extensible data sector */
00159 } ATTRIBUTE_PACKED;
00160 
00161 #define zip64_eocl_sig 0x07064b50
00162 
00163 struct zip64_eocl {
00164         int zip64lsig;
00165         int zip64ldsk;
00166         long long zip64lofst;
00167         int zip74lnum;
00168 } ATTRIBUTE_PACKED;
00169 
00170 struct zip_alignment_check {
00171         int x[sizeof(struct zip_cd) == 46 ? 1:-1];
00172 };
00173 
00174 #ifdef HAVE_PRAGMA_PACK
00175 #pragma pack(pop)
00176 #endif
00177 #endif