]> git.ipfire.org Git - thirdparty/squid.git/blob - src/adaptation/ecap/ServiceRep.h
Merge from trunk. Remove dead files and fluff changes
[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 explicit ServiceRep(const ServiceConfigPointer &aConfig);
27 virtual ~ServiceRep();
28
29 typedef libecap::shared_ptr<libecap::adapter::Service> AdapterService;
30
31 /* Adaptation::Service API */
32 virtual void finalize();
33 virtual bool probed() const;
34 virtual bool up() const;
35 virtual Adaptation::Initiate *makeXactLauncher(HttpMsg *virginHeader, HttpRequest *virginCause);
36 virtual bool wantsUrl(const String &urlPath) const;
37 virtual void noteFailure();
38 virtual const char *status() const;
39 virtual void detach();
40 virtual bool detached() const;
41
42 protected:
43 void tryConfigureAndStart();
44 bool handleFinalizeFailure(const char *error);
45
46 private:
47 AdapterService theService; // the actual adaptation service we represent
48 bool isDetached;
49 };
50
51 /// register loaded eCAP module service
52 extern void RegisterAdapterService(const ServiceRep::AdapterService& adapterService);
53 /// unregister loaded eCAP module service by service uri
54 extern void UnregisterAdapterService(const String& serviceUri);
55
56 /// returns loaded eCAP module service by service uri
57 extern ServiceRep::AdapterService FindAdapterService(const String& serviceUri);
58
59 /// check for loaded eCAP services without matching ecap_service in squid.conf
60 extern void CheckUnusedAdapterServices(const Services& services);
61 } // namespace Ecap
62 } // namespace Adaptation
63
64 #endif /* SQUID_ECAP_SERVICE_REP_H */