extracttar.h 1.5 KB

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