]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/adaptation/Service.h
1 #ifndef SQUID_ADAPTATION__SERVICE_H
2 #define SQUID_ADAPTATION__SERVICE_H
4 #include "SquidString.h"
6 #include "adaptation/forward.h"
7 #include "adaptation/Elements.h"
8 #include "adaptation/ServiceConfig.h"
10 // TODO: Move src/ICAP/ICAPServiceRep.h API comments here and update them
18 // manages adaptation service configuration in squid.conf
19 // specific adaptation mechanisms extend this class
20 class Service
: public RefCountable
23 typedef RefCount
<Service
> Pointer
;
27 Service(const ServiceConfig
&aConfig
);
30 // call when the service is no longer needed or valid
31 virtual void invalidate() = 0;
33 virtual bool probed() const = 0; // see comments above
34 virtual bool broken() const;
35 virtual bool up() const = 0; // see comments above
37 virtual Initiate
*makeXactLauncher(Initiator
*, HttpMsg
*virginHeader
, HttpRequest
*virginCause
) = 0;
39 typedef void Callback(void *data
, Pointer
&service
);
40 void callWhenReady(Callback
*cb
, void *data
);
42 // the methods below can only be called on an up() service
43 virtual bool wantsUrl(const String
&urlPath
) const = 0;
45 // called by transactions to report service failure
46 virtual void noteFailure() = 0;
48 const ServiceConfig
&cfg() const { return theConfig
; }
50 virtual void finalize(); // called after creation
53 ServiceConfig
&writeableCfg() { return theConfig
; }
56 ServiceConfig theConfig
;
59 typedef Service::Pointer ServicePointer
;
61 typedef Vector
<Adaptation::ServicePointer
> Services
;
62 extern Services
&AllServices();
63 extern ServicePointer
FindService(const Service::Id
&key
);
65 } // namespace Adaptation
67 #endif /* SQUID_ADAPTATION__SERVICE_H */