#include <system/tar_abstraction.h>
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] |
File header.
Definition at line 46 of file tar_abstraction.h.
std::size_t nitro::TARFileHeader::GetCheckSum | ( | const TARFileHeader & | Header | ) | [static] |
Finction calculates control sum.
Header | - Header wich will be used for the calculations. |
nitro::exception | - An exception of that type is thrown. Contains error description. |
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 ) ); } }
void nitro::TARFileHeader::SetCheckSum | ( | TARFileHeader & | Header | ) | [static] |
Finction sets control sum.
Header | - Header wich will be used for the calculations. |
nitro::exception | - An exception of that type is thrown. Contains error description. |
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 ) ); } }
char nitro::TARFileHeader::Appendix[167] |
Definition at line 63 of file tar_abstraction.h.
char nitro::TARFileHeader::CheckSum[8] |
Definition at line 54 of file tar_abstraction.h.
Referenced by GetCheckSum(), and SetCheckSum().
char nitro::TARFileHeader::DevMajor[8] |
Definition at line 61 of file tar_abstraction.h.
char nitro::TARFileHeader::DevMinor[8] |
Definition at line 62 of file tar_abstraction.h.
char nitro::TARFileHeader::FileMode[8] |
Definition at line 49 of file tar_abstraction.h.
char nitro::TARFileHeader::FileName[100] |
Definition at line 48 of file tar_abstraction.h.
Referenced by nitro::UnTARAbstraction::ExtractFile(), and nitro::UnTARAbstraction::GetCountOfFiles().
char nitro::TARFileHeader::FileSize[12] |
Definition at line 52 of file tar_abstraction.h.
Referenced by nitro::UnTARAbstraction::ExtractFile(), nitro::UnTARAbstraction::GetCountOfFiles(), and nitro::UnTARAbstraction::SetReadCursor().
char nitro::TARFileHeader::Format[6] |
Definition at line 57 of file tar_abstraction.h.
char nitro::TARFileHeader::GroupId[8] |
Definition at line 51 of file tar_abstraction.h.
Definition at line 53 of file tar_abstraction.h.
char nitro::TARFileHeader::LinkedFileName[100] |
Definition at line 56 of file tar_abstraction.h.
Definition at line 55 of file tar_abstraction.h.
Referenced by nitro::UnTARAbstraction::ExtractFile().
char nitro::TARFileHeader::OwnerGroupName[32] |
Definition at line 60 of file tar_abstraction.h.
char nitro::TARFileHeader::OwnerId[8] |
Definition at line 50 of file tar_abstraction.h.
char nitro::TARFileHeader::OwnerUserName[32] |
Definition at line 59 of file tar_abstraction.h.
char nitro::TARFileHeader::Version[2] |
Definition at line 58 of file tar_abstraction.h.