]>
Commit | Line | Data |
---|---|---|
b2e465d6 AL |
1 | // -*- mode: cpp; mode: fold -*- |
2 | // Description /*{{{*/ | |
3 | // $Id: arfile.h,v 1.2 2001/02/20 07:03:16 jgg Exp $ | |
4 | /* ###################################################################### | |
5 | ||
6 | AR File - Handle an 'AR' archive | |
7 | ||
8 | This is a reader for the usual 4.4 BSD AR format. It allows raw | |
9 | stream access to a single member at a time. Basically all this class | |
10 | provides is header parsing and verification. It is up to the client | |
11 | to correctly make use of the stream start/stop points. | |
12 | ||
13 | ##################################################################### */ | |
14 | /*}}}*/ | |
15 | #ifndef PKGLIB_ARFILE_H | |
16 | #define PKGLIB_ARFILE_H | |
17 | ||
b2e465d6 AL |
18 | |
19 | #include <string> | |
60b64ffc | 20 | #include <apt-pkg/macros.h> |
b9dadc24 DK |
21 | #ifndef APT_8_CLEANER_HEADERS |
22 | #include <apt-pkg/fileutl.h> | |
23 | #endif | |
472ff00e DK |
24 | |
25 | class FileFd; | |
b2e465d6 AL |
26 | |
27 | class ARArchive | |
28 | { | |
29 | struct MemberHeader; | |
30 | public: | |
31 | struct Member; | |
32 | ||
33 | protected: | |
34 | ||
35 | // Linked list of members | |
36 | Member *List; | |
37 | ||
38 | bool LoadHeaders(); | |
39 | ||
40 | public: | |
41 | ||
42 | // The stream file | |
43 | FileFd &File; | |
44 | ||
45 | // Locate a member by name | |
46 | const Member *FindMember(const char *Name) const; | |
d59a67ff | 47 | inline Member *Members() { return List; } |
b2e465d6 AL |
48 | |
49 | ARArchive(FileFd &File); | |
50 | ~ARArchive(); | |
51 | }; | |
52 | ||
53 | // A member of the archive | |
54 | struct ARArchive::Member | |
55 | { | |
56 | // Fields from the header | |
8f3ba4e8 | 57 | std::string Name; |
b2e465d6 AL |
58 | unsigned long MTime; |
59 | unsigned long UID; | |
60 | unsigned long GID; | |
61 | unsigned long Mode; | |
650faab0 | 62 | unsigned long long Size; |
b2e465d6 AL |
63 | |
64 | // Location of the data. | |
60b64ffc | 65 | #if APT_PKG_ABI >= 413 |
3621b1c7 | 66 | unsigned long long Start; |
60b64ffc DK |
67 | #else |
68 | unsigned long Start; | |
69 | #endif | |
b2e465d6 AL |
70 | Member *Next; |
71 | ||
72 | Member() : Start(0), Next(0) {}; | |
73 | }; | |
74 | ||
75 | #endif |