]> git.ipfire.org Git - thirdparty/squid.git/blame - src/adaptation/ecap/ServiceRep.h
Maintenance: automate header guards 2/3 (#1655)
[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"
fdc96a39
AR
16#include <libecap/common/forward.h>
17#include <libecap/common/memory.h>
18
af6a12ee
AJ
19namespace Adaptation
20{
e1381638
AJ
21namespace 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
28class ServiceRep : public Adaptation::Service
29{
30public:
6666da11 31 explicit ServiceRep(const ServiceConfigPointer &aConfig);
337b9aa4 32 ~ServiceRep() override;
fdc96a39 33
f1a768b2 34 typedef libecap::shared_ptr<libecap::adapter::Service> AdapterService;
fdc96a39 35
8442a9b2 36 /* Adaptation::Service API */
337b9aa4
AR
37 void finalize() override;
38 bool probed() const override;
39 bool up() const override;
40 Adaptation::Initiate *makeXactLauncher(Http::Message *virginHeader, HttpRequest *virginCause, AccessLogEntry::Pointer &alp) override;
41 bool wantsUrl(const SBuf &urlPath) const override;
42 void noteFailure() override;
f1a768b2 43 virtual const char *status() const;
337b9aa4
AR
44 void detach() override;
45 bool detached() const override;
76fc7e57 46
45d2da8b
AR
47protected:
48 void tryConfigureAndStart();
49 bool handleFinalizeFailure(const char *error);
50
fdc96a39 51private:
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 57void RegisterAdapterService(const ServiceRep::AdapterService& adapterService);
76fc7e57 58/// unregister loaded eCAP module service by service uri
82afb125 59void UnregisterAdapterService(const String& serviceUri);
76fc7e57
AJ
60
61/// returns loaded eCAP module service by service uri
82afb125 62ServiceRep::AdapterService FindAdapterService(const String& serviceUri);
76fc7e57
AJ
63
64/// check for loaded eCAP services without matching ecap_service in squid.conf
82afb125 65void CheckUnusedAdapterServices(const Services& services);
fdc96a39 66} // namespace Ecap
574b508c 67} // namespace Adaptation
fdc96a39 68
ff9d9458 69#endif /* SQUID_SRC_ADAPTATION_ECAP_SERVICEREP_H */
f53969cc 70