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