You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

70 lines
1.4 KiB

  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. /* ######################################################################
  4. AR File - Handle an 'AR' archive
  5. This is a reader for the usual 4.4 BSD AR format. It allows raw
  6. stream access to a single member at a time. Basically all this class
  7. provides is header parsing and verification. It is up to the client
  8. to correctly make use of the stream start/stop points.
  9. ##################################################################### */
  10. /*}}}*/
  11. #ifndef PKGLIB_ARFILE_H
  12. #define PKGLIB_ARFILE_H
  13. #include <apt-pkg/macros.h>
  14. #include <string>
  15. #ifndef APT_8_CLEANER_HEADERS
  16. #include <apt-pkg/fileutl.h>
  17. #endif
  18. class FileFd;
  19. class ARArchive
  20. {
  21. struct MemberHeader;
  22. public:
  23. struct Member;
  24. protected:
  25. // Linked list of members
  26. Member *List;
  27. bool LoadHeaders();
  28. public:
  29. // The stream file
  30. FileFd &File;
  31. // Locate a member by name
  32. const Member *FindMember(const char *Name) const;
  33. inline Member *Members() { return List; }
  34. explicit ARArchive(FileFd &File);
  35. ~ARArchive();
  36. };
  37. // A member of the archive
  38. struct ARArchive::Member
  39. {
  40. // Fields from the header
  41. std::string Name;
  42. unsigned long MTime;
  43. unsigned long UID;
  44. unsigned long GID;
  45. unsigned long Mode;
  46. unsigned long long Size;
  47. // Location of the data.
  48. unsigned long long Start;
  49. Member *Next;
  50. Member() : Start(0), Next(0) {};
  51. };
  52. #endif