]>
Commit | Line | Data |
---|---|---|
0118833a AL |
1 | // -*- mode: cpp; mode: fold -*- |
2 | // Description /*{{{*/ | |
c46824ce | 3 | // $Id: acquire-worker.h,v 1.9 1999/01/20 05:11:25 jgg Exp $ |
0118833a AL |
4 | /* ###################################################################### |
5 | ||
6 | Acquire Worker - Worker process manager | |
7 | ||
3b5421b4 AL |
8 | Each worker class is associated with exaclty one subprocess. |
9 | ||
0118833a AL |
10 | ##################################################################### */ |
11 | /*}}}*/ | |
12 | #ifndef PKGLIB_ACQUIRE_WORKER_H | |
13 | #define PKGLIB_ACQUIRE_WORKER_H | |
14 | ||
15 | #include <apt-pkg/acquire.h> | |
16 | ||
17 | #ifdef __GNUG__ | |
18 | #pragma interface "apt-pkg/acquire-worker.h" | |
19 | #endif | |
20 | ||
21 | // Interfacing to the method process | |
22 | class pkgAcquire::Worker | |
23 | { | |
0a8a80e5 AL |
24 | friend pkgAcquire; |
25 | ||
0118833a | 26 | protected: |
3b5421b4 AL |
27 | friend Queue; |
28 | ||
0a8a80e5 AL |
29 | /* Linked list starting at a Queue and a linked list starting |
30 | at Acquire */ | |
31 | Worker *NextQueue; | |
32 | Worker *NextAcquire; | |
0118833a | 33 | |
3b5421b4 | 34 | // The access association |
0118833a | 35 | Queue *OwnerQ; |
8267fe24 | 36 | pkgAcquireStatus *Log; |
3b5421b4 AL |
37 | MethodConfig *Config; |
38 | string Access; | |
c46824ce | 39 | |
3b5421b4 AL |
40 | // This is the subprocess IPC setup |
41 | pid_t Process; | |
42 | int InFd; | |
43 | int OutFd; | |
0a8a80e5 AL |
44 | bool InReady; |
45 | bool OutReady; | |
0118833a | 46 | |
3b5421b4 AL |
47 | // Various internal things |
48 | bool Debug; | |
49 | vector<string> MessageQueue; | |
0a8a80e5 AL |
50 | string OutQueue; |
51 | ||
3b5421b4 AL |
52 | // Private constructor helper |
53 | void Construct(); | |
54 | ||
55 | // Message handling things | |
56 | bool ReadMessages(); | |
57 | bool RunMessages(); | |
0a8a80e5 AL |
58 | bool InFdReady(); |
59 | bool OutFdReady(); | |
3b5421b4 AL |
60 | |
61 | // The message handlers | |
62 | bool Capabilities(string Message); | |
0a8a80e5 | 63 | bool SendConfiguration(); |
542ec555 AL |
64 | bool MediaChange(string Message); |
65 | ||
0a8a80e5 | 66 | bool MethodFailure(); |
8267fe24 | 67 | void ItemDone(); |
0118833a AL |
68 | |
69 | public: | |
70 | ||
c88edf1d | 71 | // The curent method state |
0a8a80e5 | 72 | pkgAcquire::Queue::QItem *CurrentItem; |
0a8a80e5 | 73 | string Status; |
c88edf1d AL |
74 | unsigned long CurrentSize; |
75 | unsigned long TotalSize; | |
8267fe24 | 76 | |
3b5421b4 | 77 | // Load the method and do the startup |
0a8a80e5 | 78 | bool QueueItem(pkgAcquire::Queue::QItem *Item); |
8267fe24 AL |
79 | bool Start(); |
80 | void Pulse(); | |
0118833a | 81 | |
8267fe24 | 82 | Worker(Queue *OwnerQ,MethodConfig *Config,pkgAcquireStatus *Log); |
0118833a AL |
83 | Worker(MethodConfig *Config); |
84 | ~Worker(); | |
85 | }; | |
86 | ||
87 | #endif |