]>
Commit | Line | Data |
---|---|---|
b2e465d6 AL |
1 | // -*- mode: cpp; mode: fold -*- |
2 | // Description /*{{{*/ | |
3 | // $Id: dirstream.h,v 1.2 2001/02/20 07:03:16 jgg Exp $ | |
4 | /* ###################################################################### | |
5 | ||
6 | Directory Stream | |
7 | ||
8 | When unpacking the contents of the archive are passed into a directory | |
9 | stream class for analysis and processing. The class controls all aspects | |
10 | of actually writing the directory stream from disk. The low level | |
11 | archive handlers are only responsible for decoding the archive format | |
12 | and sending events (via method calls) to the specified directory | |
13 | stream. | |
14 | ||
15 | When unpacking a real file the archive handler is passed back a file | |
16 | handle to write the data to, this is to support strange | |
17 | archives+unpacking methods. If that fd is -1 then the file data is | |
18 | simply ignored. | |
19 | ||
20 | The provided defaults do the 'Right Thing' for a normal unpacking | |
21 | process (ie 'tar') | |
22 | ||
23 | ##################################################################### */ | |
24 | /*}}}*/ | |
25 | #ifndef PKGLIB_DIRSTREAM_H | |
26 | #define PKGLIB_DIRSTREAM_H | |
27 | ||
60b64ffc | 28 | #include <apt-pkg/macros.h> |
b2e465d6 AL |
29 | |
30 | class pkgDirStream | |
31 | { | |
32 | public: | |
33 | ||
34 | // All possible information about a component | |
35 | struct Item | |
36 | { | |
37 | enum Type_t {File, HardLink, SymbolicLink, CharDevice, BlockDevice, | |
38 | Directory, FIFO} Type; | |
39 | char *Name; | |
40 | char *LinkTarget; | |
60b64ffc | 41 | #if APT_PKG_ABI >= 413 |
3621b1c7 | 42 | unsigned long long Size; |
60b64ffc | 43 | #endif |
b2e465d6 AL |
44 | unsigned long Mode; |
45 | unsigned long UID; | |
46 | unsigned long GID; | |
60b64ffc DK |
47 | #if APT_PKG_ABI < 413 |
48 | unsigned long Size; | |
49 | #endif | |
b2e465d6 AL |
50 | unsigned long MTime; |
51 | unsigned long Major; | |
52 | unsigned long Minor; | |
53 | }; | |
54 | ||
55 | virtual bool DoItem(Item &Itm,int &Fd); | |
56 | virtual bool Fail(Item &Itm,int Fd); | |
57 | virtual bool FinishedFile(Item &Itm,int Fd); | |
60b64ffc | 58 | #if APT_PKG_ABI >= 413 |
65512241 | 59 | virtual bool Process(Item &/*Itm*/,const unsigned char * /*Data*/, |
3621b1c7 | 60 | unsigned long long /*Size*/,unsigned long long /*Pos*/) {return true;}; |
60b64ffc DK |
61 | #else |
62 | virtual bool Process(Item &/*Itm*/,const unsigned char * /*Data*/, | |
63 | unsigned long /*Size*/,unsigned long /*Pos*/) {return true;}; | |
64 | #endif | |
b2e465d6 AL |
65 | virtual ~pkgDirStream() {}; |
66 | }; | |
67 | ||
68 | #endif |