]> git.saurik.com Git - apt.git/blame - apt-inst/contrib/extracttar.h
Merge branch 'debian/sid' into debian/experimental
[apt.git] / apt-inst / contrib / extracttar.h
CommitLineData
b2e465d6
AL
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
b2e465d6 17#include <apt-pkg/fileutl.h>
60b64ffc 18#include <apt-pkg/macros.h>
b2e465d6 19
472ff00e
DK
20#include <string>
21
a4f6bdc8 22#ifndef APT_8_CLEANER_HEADERS
b9dadc24
DK
23#include <apt-pkg/dirstream.h>
24#include <algorithm>
a4f6bdc8
DK
25using std::min;
26#endif
27
472ff00e 28class pkgDirStream;
42ab8223 29
b2e465d6
AL
30class 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;
60b64ffc 43#if APT_PKG_ABI >= 413
3621b1c7 44 unsigned long long MaxInSize;
60b64ffc
DK
45#else
46 unsigned long MaxInSize;
47#endif
b2e465d6
AL
48 int GZPid;
49 FileFd InFd;
50 bool Eof;
8f3ba4e8 51 std::string DecompressProg;
b2e465d6
AL
52
53 // Fork and reap gzip
54 bool StartGzip();
55 bool Done(bool Force);
56
57 public:
58
59 bool Go(pkgDirStream &Stream);
60b64ffc
DK
60
61#if APT_PKG_ABI >= 413
3621b1c7 62 ExtractTar(FileFd &Fd,unsigned long long Max,std::string DecompressionProgram);
60b64ffc
DK
63#else
64 ExtractTar(FileFd &Fd,unsigned long Max,std::string DecompressionProgram);
65#endif
b2e465d6
AL
66 virtual ~ExtractTar();
67};
68
69#endif