]>
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> | |
b9dadc24 DK |
20 | #ifndef APT_8_CLEANER_HEADERS |
21 | #include <apt-pkg/fileutl.h> | |
22 | #endif | |
472ff00e DK |
23 | |
24 | class FileFd; | |
b2e465d6 AL |
25 | |
26 | class ARArchive | |
27 | { | |
28 | struct MemberHeader; | |
29 | public: | |
30 | struct Member; | |
31 | ||
32 | protected: | |
33 | ||
34 | // Linked list of members | |
35 | Member *List; | |
36 | ||
37 | bool LoadHeaders(); | |
38 | ||
39 | public: | |
40 | ||
41 | // The stream file | |
42 | FileFd &File; | |
43 | ||
44 | // Locate a member by name | |
45 | const Member *FindMember(const char *Name) const; | |
d59a67ff | 46 | inline Member *Members() { return List; } |
b2e465d6 AL |
47 | |
48 | ARArchive(FileFd &File); | |
49 | ~ARArchive(); | |
50 | }; | |
51 | ||
52 | // A member of the archive | |
53 | struct ARArchive::Member | |
54 | { | |
55 | // Fields from the header | |
8f3ba4e8 | 56 | std::string Name; |
b2e465d6 AL |
57 | unsigned long MTime; |
58 | unsigned long UID; | |
59 | unsigned long GID; | |
60 | unsigned long Mode; | |
650faab0 | 61 | unsigned long long Size; |
b2e465d6 AL |
62 | |
63 | // Location of the data. | |
64 | unsigned long Start; | |
65 | Member *Next; | |
66 | ||
67 | Member() : Start(0), Next(0) {}; | |
68 | }; | |
69 | ||
70 | #endif |