<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package IO::Compress::Gzip::Constants;

use strict ;
use warnings;
use bytes;

require Exporter;

our ($VERSION, @ISA, @EXPORT, %GZIP_OS_Names);
our ($GZIP_FNAME_INVALID_CHAR_RE, $GZIP_FCOMMENT_INVALID_CHAR_RE);

$VERSION = '2.204';

@ISA = qw(Exporter);

@EXPORT= qw(

    GZIP_ID_SIZE
    GZIP_ID1
    GZIP_ID2

    GZIP_FLG_DEFAULT
    GZIP_FLG_FTEXT
    GZIP_FLG_FHCRC
    GZIP_FLG_FEXTRA
    GZIP_FLG_FNAME
    GZIP_FLG_FCOMMENT
    GZIP_FLG_RESERVED

    GZIP_CM_DEFLATED

    GZIP_MIN_HEADER_SIZE
    GZIP_TRAILER_SIZE

    GZIP_MTIME_DEFAULT
    GZIP_XFL_DEFAULT
    GZIP_FEXTRA_HEADER_SIZE
    GZIP_FEXTRA_MAX_SIZE
    GZIP_FEXTRA_SUBFIELD_HEADER_SIZE
    GZIP_FEXTRA_SUBFIELD_ID_SIZE
    GZIP_FEXTRA_SUBFIELD_LEN_SIZE
    GZIP_FEXTRA_SUBFIELD_MAX_SIZE

    $GZIP_FNAME_INVALID_CHAR_RE
    $GZIP_FCOMMENT_INVALID_CHAR_RE

    GZIP_FHCRC_SIZE

    GZIP_ISIZE_MAX
    GZIP_ISIZE_MOD_VALUE


    GZIP_NULL_BYTE

    GZIP_OS_DEFAULT

    %GZIP_OS_Names

    GZIP_MINIMUM_HEADER

    );

# Constant names derived from RFC 1952

use constant GZIP_ID_SIZE                     =&gt; 2 ;
use constant GZIP_ID1                         =&gt; 0x1F;
use constant GZIP_ID2                         =&gt; 0x8B;

use constant GZIP_MIN_HEADER_SIZE             =&gt; 10 ;# minimum gzip header size
use constant GZIP_TRAILER_SIZE                =&gt; 8 ;


use constant GZIP_FLG_DEFAULT                 =&gt; 0x00 ;
use constant GZIP_FLG_FTEXT                   =&gt; 0x01 ;
use constant GZIP_FLG_FHCRC                   =&gt; 0x02 ; # called CONTINUATION in gzip
use constant GZIP_FLG_FEXTRA                  =&gt; 0x04 ;
use constant GZIP_FLG_FNAME                   =&gt; 0x08 ;
use constant GZIP_FLG_FCOMMENT                =&gt; 0x10 ;
#use constant GZIP_FLG_ENCRYPTED              =&gt; 0x20 ; # documented in gzip sources
use constant GZIP_FLG_RESERVED                =&gt; (0x20 | 0x40 | 0x80) ;

use constant GZIP_XFL_DEFAULT                 =&gt; 0x00 ;

use constant GZIP_MTIME_DEFAULT               =&gt; 0x00 ;

use constant GZIP_FEXTRA_HEADER_SIZE          =&gt; 2 ;
use constant GZIP_FEXTRA_MAX_SIZE             =&gt; 0xFFFF ;
use constant GZIP_FEXTRA_SUBFIELD_ID_SIZE     =&gt; 2 ;
use constant GZIP_FEXTRA_SUBFIELD_LEN_SIZE    =&gt; 2 ;
use constant GZIP_FEXTRA_SUBFIELD_HEADER_SIZE =&gt; GZIP_FEXTRA_SUBFIELD_ID_SIZE +
                                                 GZIP_FEXTRA_SUBFIELD_LEN_SIZE;
use constant GZIP_FEXTRA_SUBFIELD_MAX_SIZE    =&gt; GZIP_FEXTRA_MAX_SIZE -
                                                 GZIP_FEXTRA_SUBFIELD_HEADER_SIZE ;


if (ord('A') == 193)
{
    # EBCDIC
    $GZIP_FNAME_INVALID_CHAR_RE = '[\x00-\x3f\xff]';
    $GZIP_FCOMMENT_INVALID_CHAR_RE = '[\x00-\x0a\x11-\x14\x16-\x3f\xff]';

}
else
{
    $GZIP_FNAME_INVALID_CHAR_RE       =  '[\x00-\x1F\x7F-\x9F]';
    $GZIP_FCOMMENT_INVALID_CHAR_RE    =  '[\x00-\x09\x11-\x1F\x7F-\x9F]';
}

use constant GZIP_FHCRC_SIZE        =&gt; 2 ; # aka CONTINUATION in gzip

use constant GZIP_CM_DEFLATED       =&gt; 8 ;

use constant GZIP_NULL_BYTE         =&gt; "\x00";
use constant GZIP_ISIZE_MAX         =&gt; 0xFFFFFFFF ;
use constant GZIP_ISIZE_MOD_VALUE   =&gt; GZIP_ISIZE_MAX + 1 ;

# OS Names sourced from http://www.gzip.org/format.txt

use constant GZIP_OS_DEFAULT=&gt; 0xFF ;
%GZIP_OS_Names = (
    0   =&gt; 'MS-DOS',
    1   =&gt; 'Amiga',
    2   =&gt; 'VMS',
    3   =&gt; 'Unix',
    4   =&gt; 'VM/CMS',
    5   =&gt; 'Atari TOS',
    6   =&gt; 'HPFS (OS/2, NT)',
    7   =&gt; 'Macintosh',
    8   =&gt; 'Z-System',
    9   =&gt; 'CP/M',
    10  =&gt; 'TOPS-20',
    11  =&gt; 'NTFS (NT)',
    12  =&gt; 'SMS QDOS',
    13  =&gt; 'Acorn RISCOS',
    14  =&gt; 'VFAT file system (Win95, NT)',
    15  =&gt; 'MVS',
    16  =&gt; 'BeOS',
    17  =&gt; 'Tandem/NSK',
    18  =&gt; 'THEOS',
    GZIP_OS_DEFAULT()   =&gt; 'Unknown',
    ) ;

use constant GZIP_MINIMUM_HEADER =&gt;   pack("C4 V C C",
        GZIP_ID1, GZIP_ID2, GZIP_CM_DEFLATED, GZIP_FLG_DEFAULT,
        GZIP_MTIME_DEFAULT, GZIP_XFL_DEFAULT, GZIP_OS_DEFAULT) ;


1;
</pre></body></html>