extracttar.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 <string>
  15. class pkgDirStream;
  16. class ExtractTar
  17. {
  18. protected:
  19. struct TarHeader;
  20. // The varios types items can be
  21. enum ItemType {NormalFile0 = '\0',NormalFile = '0',HardLink = '1',
  22. SymbolicLink = '2',CharacterDevice = '3',
  23. BlockDevice = '4',Directory = '5',FIFO = '6',
  24. GNU_LongLink = 'K',GNU_LongName = 'L'};
  25. FileFd &File;
  26. unsigned long MaxInSize;
  27. int GZPid;
  28. FileFd InFd;
  29. bool Eof;
  30. std::string DecompressProg;
  31. // Fork and reap gzip
  32. bool StartGzip();
  33. bool Done(bool Force);
  34. public:
  35. bool Go(pkgDirStream &Stream);
  36. ExtractTar(FileFd &Fd,unsigned long Max,std::string DecompressionProgram);
  37. virtual ~ExtractTar();
  38. };
  39. #endif