package Zip.Headers is
type Data_descriptor is record -- PK78 -- 1 .. 4 crc_32 : Unsigned_32; -- 5 .. 8 compressed_size, uncompressed_size : Unsigned_32; end record;
type Local_File_Header is record -- PK34 -- 1 .. 4 needed_extract_version : Unsigned_16; -- 5 .. 6 bit_flag, zip_type : Unsigned_16; file_timedate : Time; dd : Data_descriptor; filename_length, extra_field_length : Unsigned_16; end record;
type Central_File_Header is record -- PK12 -- 1 .. 4 made_by_version : Unsigned_16; -- 5 .. 6 short_info : Local_File_Header; -- 7 .. 32 comment_length : Unsigned_16; -- 33 .. 34 disk_number_start : Unsigned_16; internal_attributes : Unsigned_16; -- internal properties of data external_attributes : Unsigned_32; -- 1st byte if MS - DOS : see below local_header_offset : Unsigned_32; end record;
type End_of_Central_Dir is record -- PK56 -- 1 .. 4 disknum : Unsigned_16; -- 5 .. 6 disknum_with_start : Unsigned_16; disk_total_entries : Unsigned_16; total_entries : Unsigned_16; central_dir_size : Unsigned_32; central_dir_offset : Unsigned_32; main_comment_length : Unsigned_16; -- The Zip archive may be appended to another file (for instance an -- executable for self - extracting purposes) of size N. -- Then, all offsets need to be shifted by N. -- N=0 if the Zip archive is on its own. -- The real offset of the end - of - central - dir -- will be N + central_dir_size + central_dir_offset. -- This way, we have an unique chance to determine N when reading the -- end - of - central - dir. N is stored in the field hereafter. offset_shifting : Unsigned_32; end record;
data_descriptor_length : constant := 16;
local_header_length : constant := 30;
bad_local_header : exception;
central_header_length : constant := 46;
end_of_central_dir_length : constant := 22;
bad_end : exception;
procedure Copy_and_check
( | buffer | : Byte_Buffer; |
the_data_desc | : out Data_descriptor); |
procedure Read_and_check
( | stream | : Zipstream_Class; |
the_data_desc | : out Data_descriptor); |
procedure Write
( | stream | : Zipstream_Class; |
the_data_desc | : Data_descriptor); |
procedure Read_and_check
( | stream | : Zipstream_Class; |
header | : out Local_File_Header); |
procedure Write
( | stream | : Zipstream_Class; |
header | : Local_File_Header); |
procedure Read_and_check
( | stream | : Zipstream_Class; |
header | : out Central_File_Header); |
procedure Write
( | stream | : Zipstream_Class; |
header | : Central_File_Header); |
procedure Copy_and_check
( | buffer | : Byte_Buffer; |
the_end | : out End_of_Central_Dir); |
procedure Read_and_check
( | stream | : Zipstream_Class; |
the_end | : out End_of_Central_Dir); |
procedure Load
( | stream | : Zipstream_Class; |
the_end | : out End_of_Central_Dir); |
procedure Write
( | stream | : Zipstream_Class; |
the_end | : End_of_Central_Dir); |