Annotation of embedaddon/php/ext/phar/pharzip.h, revision 1.1

1.1     ! misho       1: /*
        !             2:   +----------------------------------------------------------------------+
        !             3:   | phar php single-file executable PHP extension                        |
        !             4:   +----------------------------------------------------------------------+
        !             5:   | Copyright (c) 2006-2012 The PHP Group                                |
        !             6:   +----------------------------------------------------------------------+
        !             7:   | This source file is subject to version 3.01 of the PHP license,      |
        !             8:   | that is bundled with this package in the file LICENSE, and is        |
        !             9:   | available through the world-wide-web at the following url:           |
        !            10:   | http://www.php.net/license/3_01.txt.                                 |
        !            11:   | If you did not receive a copy of the PHP license and are unable to   |
        !            12:   | obtain it through the world-wide-web, please send a note to          |
        !            13:   | license@php.net so we can mail you a copy immediately.               |
        !            14:   +----------------------------------------------------------------------+
        !            15:   | Authors: Gregory Beaver <cellog@php.net>                             |
        !            16:   |          Marcus Boerger <helly@php.net>                              |
        !            17:   +----------------------------------------------------------------------+
        !            18: */
        !            19: 
        !            20: /* $Id: pharzip.h 321634 2012-01-01 13:15:04Z felipe $ */
        !            21: 
        !            22: typedef struct _phar_zip_file_header {
        !            23:        char signature[4];       /* local file header signature     4 bytes  (0x04034b50) */
        !            24:        char zipversion[2];      /* version needed to extract       2 bytes */
        !            25:        char flags[2];        /* general purpose bit flag        2 bytes */
        !            26:        char compressed[2];   /* compression method              2 bytes */
        !            27:        char timestamp[2];    /* last mod file time              2 bytes */
        !            28:        char datestamp[2];    /* last mod file date              2 bytes */
        !            29:        char crc32[4];        /* crc-32                          4 bytes */
        !            30:        char compsize[4];     /* compressed size                 4 bytes */
        !            31:        char uncompsize[4];   /* uncompressed size               4 bytes */
        !            32:        char filename_len[2]; /* file name length                2 bytes */
        !            33:        char extra_len[2];    /* extra field length              2 bytes */
        !            34: /* file name (variable size) */
        !            35: /* extra field (variable size) */
        !            36: } phar_zip_file_header;
        !            37: 
        !            38: /* unused in this release */
        !            39: typedef struct _phar_zip_file_datadesc {
        !            40:        char signature[4];  /* signature (optional)            4 bytes */
        !            41:        char crc32[4];      /* crc-32                          4 bytes */
        !            42:        char compsize[4];   /* compressed size                 4 bytes */
        !            43:        char uncompsize[4]; /* uncompressed size               4 bytes */
        !            44: } phar_zip_data_desc;
        !            45: 
        !            46: /* unused in this release */
        !            47: typedef struct _phar_zip_file_datadesc_zip64 {
        !            48:        char crc32[4];       /* crc-32                          4 bytes */
        !            49:        char compsize[4];    /* compressed size                 8 bytes */
        !            50:        char compsize2[4];
        !            51:        char uncompsize[4];  /* uncompressed size               8 bytes */
        !            52:        char uncompsize2[4];
        !            53: } phar_zip_data_desc_zip64;
        !            54: 
        !            55: typedef struct _phar_zip_archive_extra_data_record {
        !            56:        char signature[4];   /* archive extra data signature    4 bytes  (0x08064b50) */
        !            57:        char len[4];      /* extra field length              4 bytes */
        !            58: /* extra field data                (variable size) */
        !            59: } phar_zip_archive_extra_data_record;
        !            60: 
        !            61: /* madeby/extractneeded value if bzip2 compression is used */
        !            62: #define PHAR_ZIP_BZIP2 "46"
        !            63: /* madeby/extractneeded value for other cases */
        !            64: #define PHAR_ZIP_NORM  "20"
        !            65: 
        !            66: #define PHAR_ZIP_FLAG_ENCRYPTED 0x0001
        !            67: /* data descriptor present for this file */
        !            68: #define PHAR_ZIP_FLAG_DATADESC  0x0008
        !            69: #define PHAR_ZIP_FLAG_UTF8      0x0400
        !            70: 
        !            71: /*
        !            72: 0 - The file is stored (no compression)
        !            73: 1 - The file is Shrunk
        !            74: 2 - The file is Reduced with compression factor 1
        !            75: 3 - The file is Reduced with compression factor 2
        !            76: 4 - The file is Reduced with compression factor 3
        !            77: 5 - The file is Reduced with compression factor 4
        !            78: 6 - The file is Imploded
        !            79: 7 - Reserved for Tokenizing compression algorithm
        !            80: 8 - The file is Deflated
        !            81: 9 - Enhanced Deflating using Deflate64(tm)
        !            82: 10 - PKWARE Data Compression Library Imploding (old IBM TERSE)
        !            83: 11 - Reserved by PKWARE
        !            84: 12 - File is compressed using BZIP2 algorithm
        !            85: 13 - Reserved by PKWARE
        !            86: 14 - LZMA (EFS)
        !            87: 15 - Reserved by PKWARE
        !            88: 16 - Reserved by PKWARE
        !            89: 17 - Reserved by PKWARE
        !            90: 18 - File is compressed using IBM TERSE (new)
        !            91: 19 - IBM LZ77 z Architecture (PFS)
        !            92: 97 - WavPack compressed data
        !            93: 98 - PPMd version I, Rev 1
        !            94: */
        !            95: #define PHAR_ZIP_COMP_NONE    0
        !            96: #define PHAR_ZIP_COMP_DEFLATE 8
        !            97: #define PHAR_ZIP_COMP_BZIP2   12
        !            98: 
        !            99: /*
        !           100:          -ASi Unix Extra Field:
        !           101:           ====================
        !           102: 
        !           103:           The following is the layout of the ASi extra block for Unix.  The
        !           104:           local-header and central-header versions are identical.
        !           105:           (Last Revision 19960916)
        !           106: 
        !           107:           Value         Size        Description
        !           108:           -----         ----        -----------
        !           109:   (Unix3) 0x756e        Short       tag for this extra block type ("nu")
        !           110:           TSize         Short       total data size for this block
        !           111:           CRC           Long        CRC-32 of the remaining data
        !           112:           Mode          Short       file permissions
        !           113:           SizDev        Long        symlink'd size OR major/minor dev num
        !           114:           UID           Short       user ID
        !           115:           GID           Short       group ID
        !           116:           (var.)        variable    symbolic link filename
        !           117: 
        !           118:           Mode is the standard Unix st_mode field from struct stat, containing
        !           119:           user/group/other permissions, setuid/setgid and symlink info, etc.
        !           120: 
        !           121:           If Mode indicates that this file is a symbolic link, SizDev is the
        !           122:           size of the file to which the link points.  Otherwise, if the file
        !           123:           is a device, SizDev contains the standard Unix st_rdev field from
        !           124:           struct stat (includes the major and minor numbers of the device).
        !           125:           SizDev is undefined in other cases.
        !           126: 
        !           127:           If Mode indicates that the file is a symbolic link, the final field
        !           128:           will be the name of the file to which the link points.  The file-
        !           129:           name length can be inferred from TSize.
        !           130: 
        !           131:           [Note that TSize may incorrectly refer to the data size not counting
        !           132:            the CRC; i.e., it may be four bytes too small.]
        !           133: */
        !           134: 
        !           135: typedef struct _phar_zip_extra_field_header {
        !           136:        char tag[2];
        !           137:        char size[2];
        !           138: } phar_zip_extra_field_header;
        !           139: 
        !           140: typedef struct _phar_zip_unix3 {
        !           141:        char tag[2];            /* 0x756e        Short       tag for this extra block type ("nu") */
        !           142:        char size[2];        /* TSize         Short       total data size for this block */
        !           143:        char crc32[4];       /* CRC           Long        CRC-32 of the remaining data */
        !           144:        char perms[2];       /* Mode          Short       file permissions */
        !           145:        char symlinksize[4]; /* SizDev        Long        symlink'd size OR major/minor dev num */
        !           146:        char uid[2];         /* UID           Short       user ID */
        !           147:        char gid[2];         /* GID           Short       group ID */
        !           148: /* (var.)        variable    symbolic link filename */
        !           149: } phar_zip_unix3;
        !           150: 
        !           151: typedef struct _phar_zip_central_dir_file {
        !           152:        char signature[4];            /* central file header signature   4 bytes  (0x02014b50) */
        !           153:        char madeby[2];               /* version made by                 2 bytes */
        !           154:        char zipversion[2];           /* version needed to extract       2 bytes */
        !           155:        char flags[2];             /* general purpose bit flag        2 bytes */
        !           156:        char compressed[2];        /* compression method              2 bytes */
        !           157:        char timestamp[2];         /* last mod file time              2 bytes */
        !           158:        char datestamp[2];         /* last mod file date              2 bytes */
        !           159:        char crc32[4];             /* crc-32                          4 bytes */
        !           160:        char compsize[4];          /* compressed size                 4 bytes */
        !           161:        char uncompsize[4];        /* uncompressed size               4 bytes */
        !           162:        char filename_len[2];      /* file name length                2 bytes */
        !           163:        char extra_len[2];         /* extra field length              2 bytes */
        !           164:        char comment_len[2];       /* file comment length             2 bytes */
        !           165:        char disknumber[2];        /* disk number start               2 bytes */
        !           166:        char internal_atts[2];     /* internal file attributes        2 bytes */
        !           167:        char external_atts[4];     /* external file attributes        4 bytes */
        !           168:        char offset[4];            /* relative offset of local header 4 bytes */
        !           169: 
        !           170: /* file name (variable size) */
        !           171: /* extra field (variable size) */
        !           172: /* file comment (variable size) */
        !           173: } phar_zip_central_dir_file;
        !           174: 
        !           175: typedef struct _phar_zip_dir_signature {
        !           176:        char signature[4];  /* header signature                4 bytes  (0x05054b50) */
        !           177:        char size[2];    /* size of data                    2 bytes */
        !           178: } phar_zip_dir_signature;
        !           179: 
        !           180: /* unused in this release */
        !           181: typedef struct _phar_zip64_dir_end {
        !           182:        char signature[4];        /* zip64 end of central dir 
        !           183:                                  signature                       4 bytes  (0x06064b50) */
        !           184:        char size1[4];         /* size of zip64 end of central
        !           185:                                  directory record                8 bytes */
        !           186:        char size2[4];
        !           187:        char madeby[2];           /* version made by                 2 bytes */
        !           188:        char extractneeded[2]; /* version needed to extract       2 bytes */
        !           189:        char disknum[4];       /* number of this disk             4 bytes */
        !           190:        char cdir_num[4];      /* number of the disk with the 
        !           191:                                  start of the central directory  4 bytes */
        !           192:        char entries1[4];      /* total number of entries in the
        !           193:                                  central directory on this disk  8 bytes */
        !           194:        char entries2[4];
        !           195:        char entriestotal1[4]; /* total number of entries in the
        !           196:                                  central directory               8 bytes */
        !           197:        char entriestotal2[4];
        !           198:        char cdirsize1[4];     /* size of the central directory   8 bytes */
        !           199:        char cdirsize2[4];
        !           200:        char offset1[4];       /* offset of start of central
        !           201:                                  directory with respect to
        !           202:                                  the starting disk number        8 bytes */
        !           203:        char offset2[4];
        !           204: /* zip64 extensible data sector    (variable size) */
        !           205: } phar_zip64_dir_end;
        !           206: 
        !           207: /* unused in this release */
        !           208: typedef struct _phar_zip64_dir_locator {
        !           209:        char signature[4];     /* zip64 end of central dir locator 
        !           210:                               signature                       4 bytes  (0x07064b50) */
        !           211:        char disknum[4];    /* number of the disk with the
        !           212:                               start of the zip64 end of 
        !           213:                               central directory               4 bytes */
        !           214:        char diroffset1[4]; /* relative offset of the zip64
        !           215:                               end of central directory record 8 bytes */
        !           216:        char diroffset2[4];
        !           217:        char totaldisks[4]; /* total number of disks           4 bytes */
        !           218: } phar_zip64_dir_locator;
        !           219: 
        !           220: typedef struct _phar_zip_dir_end {
        !           221:        char signature[4];           /* end of central dir signature    4 bytes  (0x06054b50) */
        !           222:        char disknumber[2];       /* number of this disk             2 bytes */
        !           223:        char centraldisk[2];      /* number of the disk with the
        !           224:                                     start of the central directory  2 bytes */
        !           225:        char counthere[2];        /* total number of entries in the
        !           226:                                     central directory on this disk  2 bytes */
        !           227:        char count[2];            /* total number of entries in
        !           228:                                     the central directory           2 bytes */
        !           229:        char cdir_size[4];        /* size of the central directory   4 bytes */
        !           230:        char cdir_offset[4];      /* offset of start of central
        !           231:                                     directory with respect to
        !           232:                                     the starting disk number        4 bytes */
        !           233:        char comment_len[2];      /* .ZIP file comment length        2 bytes */
        !           234: /* .ZIP file comment       (variable size) */
        !           235: } phar_zip_dir_end;
        !           236: /*
        !           237:  * Local variables:
        !           238:  * tab-width: 4
        !           239:  * c-basic-offset: 4
        !           240:  * End:
        !           241:  * vim600: noet sw=4 ts=4 fdm=marker
        !           242:  * vim<600: noet sw=4 ts=4
        !           243:  */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>