XRootD
Loading...
Searching...
No Matches
XrdZip::Extra Struct Reference

#include <XrdZipExtra.hh>

+ Collaboration diagram for XrdZip::Extra:

Public Types

enum  Ovrflw {
  NONE = 0 ,
  UCMPSIZE = 1 ,
  CPMSIZE = 2 ,
  OFFSET = 4 ,
  NBDISK = 8
}
 

Public Member Functions

 Extra ()
 Default constructor.
 
 Extra (Extra *extra, uint64_t offset)
 Constructor from another extra + offset.
 
 Extra (uint64_t fileSize)
 Constructor from file size.
 
void FromBuffer (const char *&buffer, uint16_t exsize, uint8_t flags)
 Constructor from buffer.
 
void Serialize (buffer_t &buffer)
 Serialize the extra field into a buffer.
 

Static Public Member Functions

static const char * Find (const char *buffer, uint16_t length)
 

Public Attributes

uint64_t compressedSize
 
uint16_t dataSize
 
uint32_t nbDisk
 
uint64_t offset
 
uint16_t totalSize
 
uint64_t uncompressedSize
 

Static Public Attributes

static const uint16_t headerID = 0x0001
 The extra field marker.
 

Detailed Description

Definition at line 38 of file XrdZipExtra.hh.

Member Enumeration Documentation

◆ Ovrflw

Enumerator
NONE 
UCMPSIZE 
CPMSIZE 
OFFSET 
NBDISK 

Definition at line 160 of file XrdZipExtra.hh.

161 {
162 NONE = 0,
163 UCMPSIZE = 1,
164 CPMSIZE = 2,
165 OFFSET = 4,
166 NBDISK = 8
167 };

Constructor & Destructor Documentation

◆ Extra() [1/3]

XrdZip::Extra::Extra ( uint64_t fileSize)
inline

Constructor from file size.

Definition at line 43 of file XrdZipExtra.hh.

44 {
45 offset = 0;
46 nbDisk = 0;
47 if ( fileSize >= ovrflw<uint32_t>::value )
48 {
49 dataSize = 16;
50 uncompressedSize = fileSize;
51 compressedSize = fileSize;
52 totalSize = dataSize + 4;
53 }
54 else
55 {
56 dataSize = 0;
59 totalSize = 0;
60 }
61 }
uint16_t totalSize
uint64_t offset
uint64_t uncompressedSize
uint16_t dataSize
uint64_t compressedSize
uint32_t nbDisk
static const UINT value

References compressedSize, dataSize, nbDisk, offset, totalSize, uncompressedSize, and XrdZip::ovrflw< UINT >::value.

Referenced by Extra().

+ Here is the caller graph for this function:

◆ Extra() [2/3]

XrdZip::Extra::Extra ( Extra * extra,
uint64_t offset )
inline

Constructor from another extra + offset.

Definition at line 66 of file XrdZipExtra.hh.

67 {
68 nbDisk = 0;
69 uncompressedSize = extra->uncompressedSize;
70 compressedSize = extra->compressedSize;
71 dataSize = extra->dataSize;
72 totalSize = extra->totalSize;
74 {
75 this->offset = offset;
76 dataSize += 8;
77 totalSize = dataSize + 4;
78 }
79 else
80 this->offset = 0;
81 }
int extra
Definition XrdAccTest.cc:63

References Extra(), compressedSize, dataSize, extra, nbDisk, offset, totalSize, uncompressedSize, and XrdZip::ovrflw< UINT >::value.

+ Here is the call graph for this function:

◆ Extra() [3/3]

XrdZip::Extra::Extra ( )
inline

Default constructor.

Definition at line 86 of file XrdZipExtra.hh.

86 : dataSize( 0 ),
88 compressedSize( 0 ),
89 offset( 0 ),
90 nbDisk( 0 ),
91 totalSize( 0 )
92 {
93 }

References compressedSize, dataSize, nbDisk, offset, totalSize, and uncompressedSize.

Member Function Documentation

◆ Find()

static const char * XrdZip::Extra::Find ( const char * buffer,
uint16_t length )
inlinestatic

Finds the Zip64 extended information extra field

Returns
: pointer to the buffer holding ZIP64 extra field, nullptr on failure

Definition at line 101 of file XrdZipExtra.hh.

102 {
103 const char *end = buffer + length;
104 while( buffer < end )
105 {
106 uint16_t signature = to<uint16_t>( buffer );
107 uint16_t datasize = to<uint16_t>( buffer + 2 );
108 if( signature == headerID ) return buffer;
109 buffer += 2 * sizeof( uint16_t ) + datasize;
110 }
111 return nullptr;
112 }
static INT to(const char *buffer)
static const uint16_t headerID
The extra field marker.

References headerID, and XrdZip::to().

Referenced by XrdZip::CDFH::ParseExtra(), and XrdZip::LFH::ParseExtra().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FromBuffer()

void XrdZip::Extra::FromBuffer ( const char *& buffer,
uint16_t exsize,
uint8_t flags )
inline

Constructor from buffer.

Definition at line 117 of file XrdZipExtra.hh.

118 {
119 uint16_t signature = 0;
120 from_buffer( signature, buffer );
121 if( signature != headerID ) throw bad_data();
122
123 from_buffer( dataSize, buffer );
124 if( dataSize != exsize ) throw bad_data();
125
126 if( UCMPSIZE & flags )
127 from_buffer( uncompressedSize, buffer );
128
129 if( CPMSIZE & flags )
130 from_buffer( compressedSize, buffer );
131
132 if( OFFSET & flags )
133 from_buffer( offset, buffer );
134
135 if( NBDISK & flags )
136 from_buffer( nbDisk, buffer );
137 }
static void from_buffer(INT &var, const char *&buffer)

References compressedSize, CPMSIZE, dataSize, XrdZip::from_buffer(), headerID, NBDISK, nbDisk, OFFSET, offset, UCMPSIZE, and uncompressedSize.

+ Here is the call graph for this function:

◆ Serialize()

void XrdZip::Extra::Serialize ( buffer_t & buffer)
inline

Serialize the extra field into a buffer.

Definition at line 142 of file XrdZipExtra.hh.

143 {
144 if( totalSize > 0 )
145 {
146 copy_bytes( headerID, buffer );
147 copy_bytes( dataSize, buffer );
148 if ( uncompressedSize > 0)
149 {
150 copy_bytes( uncompressedSize, buffer );
151 copy_bytes( compressedSize, buffer );
152 if ( offset > 0 )
153 copy_bytes( offset, buffer );
154 }
155 else if( offset > 0 )
156 copy_bytes( offset, buffer );
157 }
158 }
static void copy_bytes(const INT value, buffer_t &buffer)

References compressedSize, XrdZip::copy_bytes(), dataSize, headerID, offset, totalSize, and uncompressedSize.

+ Here is the call graph for this function:

Member Data Documentation

◆ compressedSize

uint64_t XrdZip::Extra::compressedSize

Definition at line 176 of file XrdZipExtra.hh.

Referenced by Extra(), Extra(), Extra(), FromBuffer(), and Serialize().

◆ dataSize

uint16_t XrdZip::Extra::dataSize

Definition at line 174 of file XrdZipExtra.hh.

Referenced by Extra(), Extra(), Extra(), FromBuffer(), and Serialize().

◆ headerID

const uint16_t XrdZip::Extra::headerID = 0x0001
static

The extra field marker.

Definition at line 172 of file XrdZipExtra.hh.

Referenced by Find(), FromBuffer(), and Serialize().

◆ nbDisk

uint32_t XrdZip::Extra::nbDisk

Definition at line 178 of file XrdZipExtra.hh.

Referenced by Extra(), Extra(), Extra(), and FromBuffer().

◆ offset

uint64_t XrdZip::Extra::offset

Definition at line 177 of file XrdZipExtra.hh.

Referenced by Extra(), Extra(), Extra(), FromBuffer(), and Serialize().

◆ totalSize

uint16_t XrdZip::Extra::totalSize

Definition at line 179 of file XrdZipExtra.hh.

Referenced by Extra(), Extra(), Extra(), and Serialize().

◆ uncompressedSize

uint64_t XrdZip::Extra::uncompressedSize

Definition at line 175 of file XrdZipExtra.hh.

Referenced by Extra(), Extra(), Extra(), FromBuffer(), and Serialize().


The documentation for this struct was generated from the following file: