]> git.saurik.com Git - apt.git/blob - apt-inst/contrib/extracttar.h
e104417c12890fdff4b7b8d09b02dada51be5960
[apt.git] / apt-inst / contrib / extracttar.h
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 // $Id: extracttar.h,v 1.2 2001/02/20 07:03:17 jgg Exp $
4 /* ######################################################################
5
6 Extract a Tar - Tar Extractor
7
8 The tar extractor takes an ordinary gzip compressed tar stream from
9 the given file and explodes it, passing the individual items to the
10 given Directory Stream for processing.
11
12 ##################################################################### */
13 /*}}}*/
14 #ifndef PKGLIB_EXTRACTTAR_H
15 #define PKGLIB_EXTRACTTAR_H
16
17 #include <apt-pkg/fileutl.h>
18
19 #include <string>
20
21 #ifndef APT_8_CLEANER_HEADERS
22 using std::min;
23 #endif
24
25 class pkgDirStream;
26
27 class ExtractTar
28 {
29 protected:
30
31 struct TarHeader;
32
33 // The varios types items can be
34 enum ItemType {NormalFile0 = '\0',NormalFile = '0',HardLink = '1',
35 SymbolicLink = '2',CharacterDevice = '3',
36 BlockDevice = '4',Directory = '5',FIFO = '6',
37 GNU_LongLink = 'K',GNU_LongName = 'L'};
38
39 FileFd &File;
40 unsigned long MaxInSize;
41 int GZPid;
42 FileFd InFd;
43 bool Eof;
44 std::string DecompressProg;
45
46 // Fork and reap gzip
47 bool StartGzip();
48 bool Done(bool Force);
49
50 public:
51
52 bool Go(pkgDirStream &Stream);
53
54 ExtractTar(FileFd &Fd,unsigned long Max,std::string DecompressionProgram);
55 virtual ~ExtractTar();
56 };
57
58 #endif