+/* POSIX tar Header Block, from POSIX 1003.1-1990 */
+struct TarHeader
+{
+ /* byte offset */
+ char name[100]; /* 0 */
+ char mode[8]; /* 100 */
+ char uid[8]; /* 108 */
+ char gid[8]; /* 116 */
+ char size[12]; /* 124 */
+ char mtime[12]; /* 136 */
+ char chksum[8]; /* 148 */
+ char typeflag; /* 156 */
+ char linkname[100]; /* 157 */
+ char magic[6]; /* 257 */
+ char version[2]; /* 263 */
+ char uname[32]; /* 265 */
+ char gname[32]; /* 297 */
+ char devmajor[8]; /* 329 */
+ char devminor[8]; /* 337 */
+ char prefix[155]; /* 345 */
+ /* padding 500 */
+};
+typedef struct TarHeader TarHeader;
+
+
+/* A few useful constants */
+#define TAR_MAGIC "ustar" /* ustar and a null */
+#define TAR_VERSION "00" /* 00 and no null */
+#define TAR_MAGIC_LEN 6
+#define TAR_VERSION_LEN 2
+#define TAR_NAME_LEN 100
+#define TAR_BLOCK_SIZE 512
+
+/* A nice enum with all the possible tar file content types */
+enum TarFileType
+{
+ REGTYPE = '0', /* regular file */
+ REGTYPE0 = '\0', /* regular file (ancient bug compat)*/
+ LNKTYPE = '1', /* hard link */
+ SYMTYPE = '2', /* symbolic link */
+ CHRTYPE = '3', /* character special */
+ BLKTYPE = '4', /* block special */
+ DIRTYPE = '5', /* directory */
+ FIFOTYPE = '6', /* FIFO special */
+ CONTTYPE = '7', /* reserved */
+};
+typedef enum TarFileType TarFileType;
+
+/* This struct ignores magic, non-numeric user name,
+ * non-numeric group name, and the checksum, since
+ * these are all ignored by BusyBox tar. */
+struct TarInfo
+{
+ int tarFd; /* An open file descriptor for reading from the tarball */
+ char * name; /* File name */
+ mode_t mode; /* Unix mode, including device bits. */
+ uid_t uid; /* Numeric UID */
+ gid_t gid; /* Numeric GID */
+ size_t size; /* Size of file */
+ time_t mtime; /* Last-modified time */
+ enum TarFileType type; /* Regular, directory, link, etc */
+ char * linkname; /* Name for symbolic and hard links */
+ long devmajor; /* Major number for special device */
+ long devminor; /* Minor number for special device */
+};
+typedef struct TarInfo TarInfo;