summaryrefslogtreecommitdiffstats
path: root/apt-pkg/contrib/arfile.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:00:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:00:48 +0000
commit851b6a097165af4d51c0db01b5e05256e5006896 (patch)
tree5f7c388ec894a7806c49a99f3bdb605d0b299a7c /apt-pkg/contrib/arfile.h
parentInitial commit. (diff)
downloadapt-upstream.tar.xz
apt-upstream.zip
Adding upstream version 2.6.1.upstream/2.6.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'apt-pkg/contrib/arfile.h')
-rw-r--r--apt-pkg/contrib/arfile.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/apt-pkg/contrib/arfile.h b/apt-pkg/contrib/arfile.h
new file mode 100644
index 0000000..9b13ed9
--- /dev/null
+++ b/apt-pkg/contrib/arfile.h
@@ -0,0 +1,66 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+/* ######################################################################
+
+ AR File - Handle an 'AR' archive
+
+ This is a reader for the usual 4.4 BSD AR format. It allows raw
+ stream access to a single member at a time. Basically all this class
+ provides is header parsing and verification. It is up to the client
+ to correctly make use of the stream start/stop points.
+
+ ##################################################################### */
+ /*}}}*/
+#ifndef PKGLIB_ARFILE_H
+#define PKGLIB_ARFILE_H
+
+#include <apt-pkg/macros.h>
+#include <string>
+
+class FileFd;
+
+class APT_PUBLIC ARArchive
+{
+ struct MemberHeader;
+ public:
+ struct Member;
+
+ protected:
+
+ // Linked list of members
+ Member *List;
+
+ bool LoadHeaders();
+
+ public:
+
+ // The stream file
+ FileFd &File;
+
+ // Locate a member by name
+ const Member *FindMember(const char *Name) const;
+ inline Member *Members() { return List; }
+
+ APT_PUBLIC explicit ARArchive(FileFd &File);
+ APT_PUBLIC ~ARArchive();
+};
+
+// A member of the archive
+struct ARArchive::Member
+{
+ // Fields from the header
+ std::string Name;
+ unsigned long MTime;
+ unsigned long UID;
+ unsigned long GID;
+ unsigned long Mode;
+ unsigned long long Size;
+
+ // Location of the data.
+ unsigned long long Start;
+ Member *Next;
+
+ Member() : Start(0), Next(0) {};
+};
+
+#endif