]> git.ipfire.org Git - thirdparty/squid.git/blob - src/adaptation/ecap/ServiceRep.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / adaptation / ecap / ServiceRep.h
1 /*
2 * DEBUG: section 93 eCAP Interface
3 */
4
5 #ifndef SQUID_ECAP_SERVICE_REP_H
6 #define SQUID_ECAP_SERVICE_REP_H
7
8 #include "adaptation/forward.h"
9 #include "adaptation/Service.h"
10 #include <libecap/common/forward.h>
11 #include <libecap/common/memory.h>
12
13 namespace Adaptation
14 {
15 namespace Ecap
16 {
17
18 /* The eCAP service representative maintains information about a single eCAP
19 service that Squid communicates with. One eCAP module may register many
20 eCAP services. */
21
22 class ServiceRep : public Adaptation::Service
23 {
24 public:
25 explicit ServiceRep(const ServiceConfigPointer &aConfig);
26 virtual ~ServiceRep();
27
28 typedef libecap::shared_ptr<libecap::adapter::Service> AdapterService;
29
30 /* Adaptation::Service API */
31 virtual void finalize();
32 virtual bool probed() const;
33 virtual bool up() const;
34 virtual Adaptation::Initiate *makeXactLauncher(HttpMsg *virginHeader, HttpRequest *virginCause);
35 virtual bool wantsUrl(const String &urlPath) const;
36 virtual void noteFailure();
37 virtual const char *status() const;
38 virtual void detach();
39 virtual bool detached() const;
40
41 protected:
42 void tryConfigureAndStart();
43 bool handleFinalizeFailure(const char *error);
44
45 private:
46 AdapterService theService; // the actual adaptation service we represent
47 bool isDetached;
48 };
49
50 /// register loaded eCAP module service
51 void RegisterAdapterService(const ServiceRep::AdapterService& adapterService);
52 /// unregister loaded eCAP module service by service uri
53 void UnregisterAdapterService(const String& serviceUri);
54
55 /// returns loaded eCAP module service by service uri
56 ServiceRep::AdapterService FindAdapterService(const String& serviceUri);
57
58 /// check for loaded eCAP services without matching ecap_service in squid.conf
59 void CheckUnusedAdapterServices(const Services& services);
60 } // namespace Ecap
61 } // namespace Adaptation
62
63 #endif /* SQUID_ECAP_SERVICE_REP_H */