acquire-method.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: acquire-method.h,v 1.1 1998/10/30 07:53:35 jgg Exp $
  4. /* ######################################################################
  5. Acquire Method - Method helper class + functions
  6. These functions are designed to be used within the method task to
  7. ease communication with APT.
  8. ##################################################################### */
  9. /*}}}*/
  10. #ifndef PKGLIB_ACQUIRE_METHOD_H
  11. #define PKGLIB_ACQUIRE_METHOD_H
  12. #include <apt-pkg/configuration.h>
  13. #include <strutl.h>
  14. #ifdef __GNUG__
  15. #pragma interface "apt-pkg/acquire-method.h"
  16. #endif
  17. class pkgAcqMethod
  18. {
  19. protected:
  20. string CurrentURI;
  21. string DestFile;
  22. time_t LastModified;
  23. vector<string> Messages;
  24. struct FetchResult
  25. {
  26. string MD5Sum;
  27. time_t LastModified;
  28. bool IMSHit;
  29. string Filename;
  30. unsigned long Size;
  31. FetchResult();
  32. };
  33. // Handlers for messages
  34. virtual bool Configuration(string Message);
  35. virtual bool Fetch(string Message,URI Get) {return true;};
  36. // Outgoing messages
  37. void Fail();
  38. void Fail(string Why);
  39. // void Log(const char *Format,...);
  40. void URIStart(FetchResult &Res,unsigned long Resume = 0);
  41. void URIDone(FetchResult &Res,FetchResult *Alt = 0);
  42. public:
  43. enum CnfFlags {SingleInstance = (1<<0), PreScan = (1<<1),
  44. Pipeline = (1<<2), SendConfig = (1<<3)};
  45. int Run();
  46. pkgAcqMethod(const char *Ver,unsigned long Flags = 0);
  47. virtual ~pkgAcqMethod() {};
  48. };
  49. #endif