]> git.ipfire.org Git - thirdparty/squid.git/blame - src/adaptation/ecap/ServiceRep.h
Fix eCAP header includes (#1753)
[thirdparty/squid.git] / src / adaptation / ecap / ServiceRep.h
CommitLineData
fdc96a39 1/*
b8ae064d 2 * Copyright (C) 1996-2023 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
ff9d9458
FC
11#ifndef SQUID_SRC_ADAPTATION_ECAP_SERVICEREP_H
12#define SQUID_SRC_ADAPTATION_ECAP_SERVICEREP_H
fdc96a39 13
fdc96a39 14#include "adaptation/forward.h"
602d9612 15#include "adaptation/Service.h"
8800478b
AJ
16
17#if HAVE_LIBECAP_COMMON_FORWARD_H
fdc96a39 18#include <libecap/common/forward.h>
8800478b
AJ
19#endif
20#if HAVE_LIBECAP_COMMON_MEMORY_H
fdc96a39 21#include <libecap/common/memory.h>
8800478b 22#endif
fdc96a39 23
af6a12ee
AJ
24namespace Adaptation
25{
e1381638
AJ
26namespace Ecap
27{
fdc96a39
AR
28
29/* The eCAP service representative maintains information about a single eCAP
26ac0430 30 service that Squid communicates with. One eCAP module may register many
fdc96a39
AR
31 eCAP services. */
32
33class ServiceRep : public Adaptation::Service
34{
35public:
6666da11 36 explicit ServiceRep(const ServiceConfigPointer &aConfig);
337b9aa4 37 ~ServiceRep() override;
fdc96a39 38
f1a768b2 39 typedef libecap::shared_ptr<libecap::adapter::Service> AdapterService;
fdc96a39 40
8442a9b2 41 /* Adaptation::Service API */
337b9aa4
AR
42 void finalize() override;
43 bool probed() const override;
44 bool up() const override;
45 Adaptation::Initiate *makeXactLauncher(Http::Message *virginHeader, HttpRequest *virginCause, AccessLogEntry::Pointer &alp) override;
46 bool wantsUrl(const SBuf &urlPath) const override;
47 void noteFailure() override;
f1a768b2 48 virtual const char *status() const;
337b9aa4
AR
49 void detach() override;
50 bool detached() const override;
76fc7e57 51
45d2da8b
AR
52protected:
53 void tryConfigureAndStart();
54 bool handleFinalizeFailure(const char *error);
55
fdc96a39 56private:
f1a768b2 57 AdapterService theService; // the actual adaptation service we represent
76fc7e57 58 bool isDetached;
fdc96a39
AR
59};
60
76fc7e57 61/// register loaded eCAP module service
82afb125 62void RegisterAdapterService(const ServiceRep::AdapterService& adapterService);
76fc7e57 63/// unregister loaded eCAP module service by service uri
82afb125 64void UnregisterAdapterService(const String& serviceUri);
76fc7e57
AJ
65
66/// returns loaded eCAP module service by service uri
82afb125 67ServiceRep::AdapterService FindAdapterService(const String& serviceUri);
76fc7e57
AJ
68
69/// check for loaded eCAP services without matching ecap_service in squid.conf
82afb125 70void CheckUnusedAdapterServices(const Services& services);
fdc96a39 71} // namespace Ecap
574b508c 72} // namespace Adaptation
fdc96a39 73
ff9d9458 74#endif /* SQUID_SRC_ADAPTATION_ECAP_SERVICEREP_H */
f53969cc 75