Aegis  4.25.D505
aetar/header.h
Go to the documentation of this file.
00001 //
00002 //      aegis - project change supervisor
00003 //      Copyright (C) 2002, 2004-2006, 2008 Peter Miller
00004 //
00005 //      This program is free software; you can redistribute it and/or modify
00006 //      it under the terms of the GNU General Public License as published by
00007 //      the Free Software Foundation; either version 3 of the License, or
00008 //      (at your option) any later version.
00009 //
00010 //      This program is distributed in the hope that it will be useful,
00011 //      but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 //      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 //      GNU General Public License for more details.
00014 //
00015 //      You should have received a copy of the GNU General Public License
00016 //      along with this program. If not, see
00017 //      <http://www.gnu.org/licenses/>.
00018 //
00019 
00020 #ifndef AETAR_HEADER_H
00021 #define AETAR_HEADER_H
00022 
00023 #include <common/nstring.h>
00024 
00025 #define TBLOCK 512
00026 #define NAMSIZ 100
00027 
00028 //
00029 // The magic field is filled with this if uname and gname are valid.
00030 //
00031 #define TMAGIC          "ustar  "       // 7 chars and a null
00032 
00033 //
00034 // The linkflag defines the type of file
00035 //
00036 #define LF_OLDNORMAL    '\0'            // Normal disk file, Unix compat
00037 #define LF_NORMAL       '0'             // Normal disk file
00038 #define LF_LINK         '1'             // Link to previously dumped file
00039 #define LF_SYMLINK      '2'             // Symbolic link
00040 #define LF_CHR          '3'             // Character special file
00041 #define LF_BLK          '4'             // Block special file
00042 #define LF_DIR          '5'             // Directory
00043 #define LF_FIFO         '6'             // FIFO special file
00044 #define LF_CONTIG       '7'             // Contiguous file
00045 #define LF_LONGNAME     'L'             // File is actually long name
00046                                         // for next file in the archive.
00047 #define LF_LONGLINK     'K'             // File is actually long link
00048                                         // for next file in the archive.
00049 // Further link types may be defined later.
00050 
00051 
00052 struct header_ty
00053 {
00054     char        name[NAMSIZ];
00055     char        mode[8];
00056     char        uid[8];
00057     char        gid[8];
00058     char        size[12];
00059     char        mtime[12];
00060     char        checksum[8];
00061     char        linkflag;
00062     char        linkname[NAMSIZ];
00063     char        magic[8];
00064     char        uname[32];
00065     char        gname[32];
00066     char        devmajor[8];
00067     char        devminor[8];
00068 };
00069 
00070 nstring header_name_get(header_ty *);
00071 void header_name_set(header_ty *hp, const nstring &arg);
00072 void header_name_set(header_ty *, const nstring &);
00073 long header_mode_get(header_ty *);
00074 void header_mode_set(header_ty *, long);
00075 long header_uid_get(header_ty *);
00076 void header_uid_set(header_ty *, long);
00077 long header_gid_get(header_ty *);
00078 void header_gid_set(header_ty *, long);
00079 long header_size_get(header_ty *);
00080 void header_size_set(header_ty *, long);
00081 long header_mtime_get(header_ty *);
00082 void header_mtime_set(header_ty *, long);
00083 long header_checksum_get(header_ty *);
00084 void header_checksum_set(header_ty *, long);
00085 int header_linkflag_get(header_ty *);
00086 void header_linkflag_set(header_ty *, int);
00087 nstring header_linkname_get(header_ty *);
00088 void header_linkname_set(header_ty *hp, const nstring &arg);
00089 nstring header_uname_get(header_ty *);
00090 void header_uname_set(header_ty *hp, const nstring &arg);
00091 nstring header_gname_get(header_ty *);
00092 void header_gname_set(header_ty *hp, const nstring &arg);
00093 long header_devmajor_get(header_ty *);
00094 void header_devmajor_set(header_ty *, long);
00095 long header_devminor_get(header_ty *);
00096 void header_devminor_set(header_ty *, long);
00097 long header_checksum_calculate(header_ty *);
00098 void header_dump(header_ty *);
00099 
00100 #endif // AETAR_HEADER_H