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