]> git.saurik.com Git - apt.git/blame - apt-inst/deb/debfile.h
restore ABI of pkgTagSection
[apt.git] / apt-inst / deb / debfile.h
CommitLineData
b2e465d6
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
3// $Id: debfile.h,v 1.2 2001/02/20 07:03:17 jgg Exp $
4/* ######################################################################
5
6 Debian Archive File (.deb)
7
8 This Class handles all the operations performed directly on .deb
9 files. It makes use of the AR and TAR classes to give the necessary
10 external interface.
11
12 There are only two things that can be done with a raw package,
13 extract it's control information and extract the contents itself.
14
15 This should probably subclass an as-yet unwritten super class to
16 produce a generic archive mechanism.
17
18 The memory control file extractor is useful to extract a single file
19 into memory from the control.tar.gz
20
21 ##################################################################### */
22 /*}}}*/
23#ifndef PKGLIB_DEBFILE_H
24#define PKGLIB_DEBFILE_H
25
b2e465d6
AL
26
27#include <apt-pkg/arfile.h>
b2e465d6
AL
28#include <apt-pkg/dirstream.h>
29#include <apt-pkg/tagfile.h>
60b64ffc 30#include <apt-pkg/macros.h>
453b82a3
DK
31
32#include <string>
472ff00e 33
4e1c86a6
DK
34#ifndef APT_8_CLEANER_HEADERS
35#include <apt-pkg/md5.h>
36#endif
453b82a3
DK
37#ifndef APT_10_CLEANER_HEADERS
38#include <apt-pkg/pkgcache.h>
39#endif
4e1c86a6 40
472ff00e 41class FileFd;
b2e465d6
AL
42
43class debDebFile
44{
45 protected:
46
47 FileFd &File;
48 ARArchive AR;
49
50 bool CheckMember(const char *Name);
51
52 public:
b2e465d6
AL
53 class ControlExtract;
54 class MemControlExtract;
9c257550 55
50b942e9 56 bool ExtractTarMember(pkgDirStream &Stream, const char *Name);
b2e465d6 57 bool ExtractArchive(pkgDirStream &Stream);
b2e465d6
AL
58 const ARArchive::Member *GotoMember(const char *Name);
59 inline FileFd &GetFile() {return File;};
60
61 debDebFile(FileFd &File);
62};
63
64class debDebFile::ControlExtract : public pkgDirStream
65{
66 public:
67
68 virtual bool DoItem(Item &Itm,int &Fd);
69};
70
71class debDebFile::MemControlExtract : public pkgDirStream
72{
73 bool IsControl;
74
75 public:
76
77 char *Control;
78 pkgTagSection Section;
79 unsigned long Length;
8f3ba4e8 80 std::string Member;
b2e465d6
AL
81
82 // Members from DirStream
83 virtual bool DoItem(Item &Itm,int &Fd);
84 virtual bool Process(Item &Itm,const unsigned char *Data,
60b64ffc 85#if APT_PKG_ABI >= 413
3621b1c7 86 unsigned long long Size,unsigned long long Pos);
60b64ffc
DK
87#else
88 unsigned long Size,unsigned long Pos);
89#endif
b2e465d6
AL
90
91 // Helpers
92 bool Read(debDebFile &Deb);
60b64ffc 93#if APT_PKG_ABI >= 413
3621b1c7 94 bool TakeControl(const void *Data,unsigned long long Size);
60b64ffc
DK
95#else
96 bool TakeControl(const void *Data,unsigned long Size);
97#endif
98
b2e465d6 99 MemControlExtract() : IsControl(false), Control(0), Length(0), Member("control") {};
8f3ba4e8 100 MemControlExtract(std::string Member) : IsControl(false), Control(0), Length(0), Member(Member) {};
b2e465d6
AL
101 ~MemControlExtract() {delete [] Control;};
102};
103 /*}}}*/
104
105#endif