]> git.saurik.com Git - apt.git/blame - apt-inst/deb/debfile.h
apt-pkg/contrib/netrc.cc: use a slightly smaller login/password size
[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>
472ff00e
DK
30#include <apt-pkg/pkgcache.h>
31
b9dadc24
DK
32#ifndef APT_8_CLEANER_HEADERS
33#include <apt-pkg/database.h>
34#endif
35
472ff00e
DK
36class FileFd;
37class pkgDataBase;
b2e465d6
AL
38
39class debDebFile
40{
41 protected:
42
43 FileFd &File;
44 ARArchive AR;
45
46 bool CheckMember(const char *Name);
47
48 public:
49
50 class ControlExtract;
51 class MemControlExtract;
52
53 bool ExtractControl(pkgDataBase &DB);
54 bool ExtractArchive(pkgDirStream &Stream);
55 pkgCache::VerIterator MergeControl(pkgDataBase &DB);
56 const ARArchive::Member *GotoMember(const char *Name);
57 inline FileFd &GetFile() {return File;};
58
59 debDebFile(FileFd &File);
60};
61
62class debDebFile::ControlExtract : public pkgDirStream
63{
64 public:
65
66 virtual bool DoItem(Item &Itm,int &Fd);
67};
68
69class debDebFile::MemControlExtract : public pkgDirStream
70{
71 bool IsControl;
72
73 public:
74
75 char *Control;
76 pkgTagSection Section;
77 unsigned long Length;
8f3ba4e8 78 std::string Member;
b2e465d6
AL
79
80 // Members from DirStream
81 virtual bool DoItem(Item &Itm,int &Fd);
82 virtual bool Process(Item &Itm,const unsigned char *Data,
83 unsigned long Size,unsigned long Pos);
84
85
86 // Helpers
87 bool Read(debDebFile &Deb);
88 bool TakeControl(const void *Data,unsigned long Size);
89
90 MemControlExtract() : IsControl(false), Control(0), Length(0), Member("control") {};
8f3ba4e8 91 MemControlExtract(std::string Member) : IsControl(false), Control(0), Length(0), Member(Member) {};
b2e465d6
AL
92 ~MemControlExtract() {delete [] Control;};
93};
94 /*}}}*/
95
96#endif