summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/extracttar.h
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2019-05-06 13:42:03 +0200
committerJulian Andres Klode <julian.klode@canonical.com>2019-05-06 13:42:03 +0200
commitdb36c35a351a76825ae00628b74c160bc418683c (patch)
treeb0f31e19e45775f9a0880c0d4801e87077696036 /apt-pkg/contrib/extracttar.h
parent7f0508ecc442705ac9fcbc3c2b5ac74ead18fff8 (diff)
parent6089a4b17c61ef30b2efc00e270b0907f51f352a (diff)
Merge branch 'pu/merge-libraries'
Diffstat (limited to 'apt-pkg/contrib/extracttar.h')
-rw-r--r--apt-pkg/contrib/extracttar.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/apt-pkg/contrib/extracttar.h b/apt-pkg/contrib/extracttar.h
new file mode 100644
index 000000000..adde21352
--- /dev/null
+++ b/apt-pkg/contrib/extracttar.h
@@ -0,0 +1,60 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+/* ######################################################################
+
+ Extract a Tar - Tar Extractor
+
+ The tar extractor takes an ordinary gzip compressed tar stream from
+ the given file and explodes it, passing the individual items to the
+ given Directory Stream for processing.
+
+ ##################################################################### */
+ /*}}}*/
+#ifndef PKGLIB_EXTRACTTAR_H
+#define PKGLIB_EXTRACTTAR_H
+
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/macros.h>
+
+#include <string>
+
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/dirstream.h>
+#include <algorithm>
+using std::min;
+#endif
+
+class pkgDirStream;
+
+class ExtractTar
+{
+ protected:
+
+ struct TarHeader;
+
+ // The varios types items can be
+ enum ItemType {NormalFile0 = '\0',NormalFile = '0',HardLink = '1',
+ SymbolicLink = '2',CharacterDevice = '3',
+ BlockDevice = '4',Directory = '5',FIFO = '6',
+ GNU_LongLink = 'K',GNU_LongName = 'L'};
+
+ FileFd &File;
+ unsigned long long MaxInSize;
+ int GZPid;
+ FileFd InFd;
+ bool Eof;
+ std::string DecompressProg;
+
+ // Fork and reap gzip
+ bool StartGzip();
+ bool Done();
+
+ public:
+
+ bool Go(pkgDirStream &Stream);
+
+ ExtractTar(FileFd &Fd,unsigned long long Max,std::string DecompressionProgram);
+ virtual ~ExtractTar();
+};
+
+#endif