Sync
[ntk/apt.git] / apt-pkg / acquire-worker.h
CommitLineData
0118833a
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
0a8a80e5 3// $Id: acquire-worker.h,v 1.3 1998/10/22 04:56:42 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
22class 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;
3b5421b4
AL
36 MethodConfig *Config;
37 string Access;
38
39 // This is the subprocess IPC setup
40 pid_t Process;
41 int InFd;
42 int OutFd;
0a8a80e5
AL
43 bool InReady;
44 bool OutReady;
0118833a 45
3b5421b4
AL
46 // Various internal things
47 bool Debug;
48 vector<string> MessageQueue;
0a8a80e5
AL
49 string OutQueue;
50
3b5421b4
AL
51 // Private constructor helper
52 void Construct();
53
54 // Message handling things
55 bool ReadMessages();
56 bool RunMessages();
0a8a80e5
AL
57 bool InFdReady();
58 bool OutFdReady();
3b5421b4
AL
59
60 // The message handlers
61 bool Capabilities(string Message);
0a8a80e5
AL
62 bool SendConfiguration();
63
64 bool MethodFailure();
0118833a
AL
65
66 public:
67
0a8a80e5
AL
68 pkgAcquire::Queue::QItem *CurrentItem;
69
70 string Status;
71
3b5421b4 72 // Load the method and do the startup
0a8a80e5 73 bool QueueItem(pkgAcquire::Queue::QItem *Item);
3b5421b4 74 bool Start();
0118833a 75
0a8a80e5 76 Worker(Queue *OwnerQ,MethodConfig *Config);
0118833a
AL
77 Worker(MethodConfig *Config);
78 ~Worker();
79};
80
81#endif