acquire-worker.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: acquire-worker.h,v 1.6 1998/10/30 07:53:36 jgg Exp $
  4. /* ######################################################################
  5. Acquire Worker - Worker process manager
  6. Each worker class is associated with exaclty one subprocess.
  7. ##################################################################### */
  8. /*}}}*/
  9. #ifndef PKGLIB_ACQUIRE_WORKER_H
  10. #define PKGLIB_ACQUIRE_WORKER_H
  11. #include <apt-pkg/acquire.h>
  12. #ifdef __GNUG__
  13. #pragma interface "apt-pkg/acquire-worker.h"
  14. #endif
  15. // Interfacing to the method process
  16. class pkgAcquire::Worker
  17. {
  18. friend pkgAcquire;
  19. protected:
  20. friend Queue;
  21. /* Linked list starting at a Queue and a linked list starting
  22. at Acquire */
  23. Worker *NextQueue;
  24. Worker *NextAcquire;
  25. // The access association
  26. Queue *OwnerQ;
  27. MethodConfig *Config;
  28. string Access;
  29. // This is the subprocess IPC setup
  30. pid_t Process;
  31. int InFd;
  32. int OutFd;
  33. bool InReady;
  34. bool OutReady;
  35. // Various internal things
  36. bool Debug;
  37. vector<string> MessageQueue;
  38. string OutQueue;
  39. // Private constructor helper
  40. void Construct();
  41. // Message handling things
  42. bool ReadMessages();
  43. bool RunMessages();
  44. bool InFdReady();
  45. bool OutFdReady();
  46. // The message handlers
  47. bool Capabilities(string Message);
  48. bool SendConfiguration();
  49. bool MethodFailure();
  50. public:
  51. // The curent method state
  52. pkgAcquire::Queue::QItem *CurrentItem;
  53. string Status;
  54. unsigned long CurrentSize;
  55. unsigned long TotalSize;
  56. // Load the method and do the startup
  57. bool QueueItem(pkgAcquire::Queue::QItem *Item);
  58. bool Start();
  59. Worker(Queue *OwnerQ,MethodConfig *Config);
  60. Worker(MethodConfig *Config);
  61. ~Worker();
  62. };
  63. #endif