]>
Commit | Line | Data |
---|---|---|
fdc96a39 | 1 | /* |
4ac4a490 | 2 | * Copyright (C) 1996-2017 The Squid Software Foundation and contributors |
bbc27441 AJ |
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. | |
fdc96a39 AR |
7 | */ |
8 | ||
bbc27441 AJ |
9 | /* DEBUG: section 93 eCAP Interface */ |
10 | ||
fdc96a39 AR |
11 | #ifndef SQUID_ECAP_SERVICE_REP_H |
12 | #define SQUID_ECAP_SERVICE_REP_H | |
13 | ||
fdc96a39 | 14 | #include "adaptation/forward.h" |
602d9612 | 15 | #include "adaptation/Service.h" |
fdc96a39 AR |
16 | #include <libecap/common/forward.h> |
17 | #include <libecap/common/memory.h> | |
18 | ||
af6a12ee AJ |
19 | namespace Adaptation |
20 | { | |
e1381638 AJ |
21 | namespace Ecap |
22 | { | |
fdc96a39 AR |
23 | |
24 | /* The eCAP service representative maintains information about a single eCAP | |
26ac0430 | 25 | service that Squid communicates with. One eCAP module may register many |
fdc96a39 AR |
26 | eCAP services. */ |
27 | ||
28 | class ServiceRep : public Adaptation::Service | |
29 | { | |
30 | public: | |
6666da11 | 31 | explicit ServiceRep(const ServiceConfigPointer &aConfig); |
fdc96a39 AR |
32 | virtual ~ServiceRep(); |
33 | ||
f1a768b2 | 34 | typedef libecap::shared_ptr<libecap::adapter::Service> AdapterService; |
fdc96a39 | 35 | |
8442a9b2 | 36 | /* Adaptation::Service API */ |
fdc96a39 | 37 | virtual void finalize(); |
fdc96a39 AR |
38 | virtual bool probed() const; |
39 | virtual bool up() const; | |
af0ded40 | 40 | virtual Adaptation::Initiate *makeXactLauncher(HttpMsg *virginHeader, HttpRequest *virginCause, AccessLogEntry::Pointer &alp); |
51b5dcf5 | 41 | virtual bool wantsUrl(const SBuf &urlPath) const; |
fdc96a39 | 42 | virtual void noteFailure(); |
f1a768b2 | 43 | virtual const char *status() const; |
76fc7e57 AJ |
44 | virtual void detach(); |
45 | virtual bool detached() const; | |
46 | ||
45d2da8b AR |
47 | protected: |
48 | void tryConfigureAndStart(); | |
49 | bool handleFinalizeFailure(const char *error); | |
50 | ||
fdc96a39 | 51 | private: |
f1a768b2 | 52 | AdapterService theService; // the actual adaptation service we represent |
76fc7e57 | 53 | bool isDetached; |
fdc96a39 AR |
54 | }; |
55 | ||
76fc7e57 | 56 | /// register loaded eCAP module service |
82afb125 | 57 | void RegisterAdapterService(const ServiceRep::AdapterService& adapterService); |
76fc7e57 | 58 | /// unregister loaded eCAP module service by service uri |
82afb125 | 59 | void UnregisterAdapterService(const String& serviceUri); |
76fc7e57 AJ |
60 | |
61 | /// returns loaded eCAP module service by service uri | |
82afb125 | 62 | ServiceRep::AdapterService FindAdapterService(const String& serviceUri); |
76fc7e57 AJ |
63 | |
64 | /// check for loaded eCAP services without matching ecap_service in squid.conf | |
82afb125 | 65 | void CheckUnusedAdapterServices(const Services& services); |
fdc96a39 | 66 | } // namespace Ecap |
574b508c | 67 | } // namespace Adaptation |
fdc96a39 AR |
68 | |
69 | #endif /* SQUID_ECAP_SERVICE_REP_H */ | |
f53969cc | 70 |