Static Public Member Functions | Public Attributes

nitro::TARFileHeader Class Reference

File header. More...

#include <system/tar_abstraction.h>

List of all members.

Static Public Member Functions

static std::size_t GetCheckSum (const TARFileHeader &Header)
static void SetCheckSum (TARFileHeader &Header)

Public Attributes

char FileName [100]
char FileMode [8]
char OwnerId [8]
char GroupId [8]
char FileSize [12]
char LastModificationTime [12]
char CheckSum [8]
char LinkType
char LinkedFileName [100]
char Format [6]
char Version [2]
char OwnerUserName [32]
char OwnerGroupName [32]
char DevMajor [8]
char DevMinor [8]
char Appendix [167]

Detailed Description

File header.

Author:
Dodonov A.A.

Definition at line 46 of file tar_abstraction.h.


Member Function Documentation

std::size_t nitro::TARFileHeader::GetCheckSum ( const TARFileHeader Header  )  [static]

Finction calculates control sum.

Parameters:
Header - Header wich will be used for the calculations.
Returns:
Control sum.
Exceptions:
nitro::exception - An exception of that type is thrown. Contains error description.
Author:
Dodonov A.A.

Definition at line 8 of file tar_abstraction.cpp.

References CheckSum, nitro::exception::code(), and nitro::exception::what().

Referenced by SetCheckSum().

        {
                try
                {
                        TARFileHeader   LocalHeader;
                        memcpy( ( void * ) & LocalHeader , ( void * ) & Header , sizeof( TARFileHeader ) );
                        memset( LocalHeader.CheckSum , ' ' , 8 );

                        std::size_t             CheckSum( 0 );
                        for( std::size_t i( 0 ) ; i < sizeof( TARFileHeader ) ; i++ )
                        {
                                CheckSum += ( ( unsigned char * ) & LocalHeader )[ i ];
                        }

                        return( CheckSum );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "TARFileHeader::GetCheckSum( const TARFileHeader & Header )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "TARFileHeader::GetCheckSum( const TARFileHeader & Header )::An error occured while opening file" ) , 1 ) );
                }
        }

Here is the call graph for this function:

void nitro::TARFileHeader::SetCheckSum ( TARFileHeader Header  )  [static]

Finction sets control sum.

Parameters:
Header - Header wich will be used for the calculations.
Exceptions:
nitro::exception - An exception of that type is thrown. Contains error description.
Author:
Dodonov A.A.

Definition at line 34 of file tar_abstraction.cpp.

References CheckSum, nitro::exception::code(), GetCheckSum(), and nitro::exception::what().

        {
                try
                {
                        std::size_t                     CheckSum( GetCheckSum( Header ) );

                        memset( Header.CheckSum , 0 , 8 );

                        sprintf( Header.CheckSum , "%08o" , CheckSum );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "TARFileHeader::SetCheckSum( TARFileHeader & Header )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "TARFileHeader::SetCheckSum( TARFileHeader & Header )::An error occured while opening file" ) , 1 ) );
                }
        }

Here is the call graph for this function:


Member Data Documentation

Definition at line 63 of file tar_abstraction.h.

Definition at line 54 of file tar_abstraction.h.

Referenced by GetCheckSum(), and SetCheckSum().

Definition at line 61 of file tar_abstraction.h.

Definition at line 62 of file tar_abstraction.h.

Definition at line 49 of file tar_abstraction.h.

Definition at line 57 of file tar_abstraction.h.

Definition at line 51 of file tar_abstraction.h.

Definition at line 53 of file tar_abstraction.h.

Definition at line 56 of file tar_abstraction.h.

Definition at line 55 of file tar_abstraction.h.

Referenced by nitro::UnTARAbstraction::ExtractFile().

Definition at line 60 of file tar_abstraction.h.

Definition at line 50 of file tar_abstraction.h.

Definition at line 59 of file tar_abstraction.h.

Definition at line 58 of file tar_abstraction.h.


The documentation for this class was generated from the following files:

Generated by  doxygen 1.6.1