]>
Commit | Line | Data |
---|---|---|
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 | #include <apt-pkg/macros.h> | |
19 | ||
20 | #include <string> | |
21 | ||
22 | #ifndef APT_8_CLEANER_HEADERS | |
23 | #include <apt-pkg/dirstream.h> | |
24 | #include <algorithm> | |
25 | using std::min; | |
26 | #endif | |
27 | ||
28 | class pkgDirStream; | |
29 | ||
30 | class ExtractTar | |
31 | { | |
32 | protected: | |
33 | ||
34 | struct TarHeader; | |
35 | ||
36 | // The varios types items can be | |
37 | enum ItemType {NormalFile0 = '\0',NormalFile = '0',HardLink = '1', | |
38 | SymbolicLink = '2',CharacterDevice = '3', | |
39 | BlockDevice = '4',Directory = '5',FIFO = '6', | |
40 | GNU_LongLink = 'K',GNU_LongName = 'L'}; | |
41 | ||
42 | FileFd &File; | |
43 | #if APT_PKG_ABI >= 413 | |
44 | unsigned long long MaxInSize; | |
45 | #else | |
46 | unsigned long MaxInSize; | |
47 | #endif | |
48 | int GZPid; | |
49 | FileFd InFd; | |
50 | bool Eof; | |
51 | std::string DecompressProg; | |
52 | ||
53 | // Fork and reap gzip | |
54 | bool StartGzip(); | |
55 | bool Done(bool Force); | |
56 | ||
57 | public: | |
58 | ||
59 | bool Go(pkgDirStream &Stream); | |
60 | ||
61 | #if APT_PKG_ABI >= 413 | |
62 | ExtractTar(FileFd &Fd,unsigned long long Max,std::string DecompressionProgram); | |
63 | #else | |
64 | ExtractTar(FileFd &Fd,unsigned long Max,std::string DecompressionProgram); | |
65 | #endif | |
66 | virtual ~ExtractTar(); | |
67 | }; | |
68 | ||
69 | #endif |