Squid Web Cache master
Loading...
Searching...
No Matches
ServiceRep.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2025 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_SRC_ADAPTATION_ECAP_SERVICEREP_H
12#define SQUID_SRC_ADAPTATION_ECAP_SERVICEREP_H
13
14#include "adaptation/forward.h"
15#include "adaptation/Service.h"
16
17#if HAVE_LIBECAP_COMMON_FORWARD_H
18#include <libecap/common/forward.h>
19#endif
20#if HAVE_LIBECAP_COMMON_MEMORY_H
21#include <libecap/common/memory.h>
22#endif
23
24namespace Adaptation
25{
26namespace Ecap
27{
28
29/* The eCAP service representative maintains information about a single eCAP
30 service that Squid communicates with. One eCAP module may register many
31 eCAP services. */
32
34{
35public:
36 explicit ServiceRep(const ServiceConfigPointer &aConfig);
37 ~ServiceRep() override;
38
39 typedef libecap::shared_ptr<libecap::adapter::Service> AdapterService;
40
41 /* Adaptation::Service API */
42 void finalize() override;
43 bool probed() const override;
44 bool up() const override;
46 bool wantsUrl(const SBuf &urlPath) const override;
47 void noteFailure() override;
48 virtual const char *status() const;
49 void detach() override;
50 bool detached() const override;
51
52protected:
54 bool handleFinalizeFailure(const char *error);
55
56private:
57 AdapterService theService; // the actual adaptation service we represent
59};
60
62void RegisterAdapterService(const ServiceRep::AdapterService& adapterService);
64void UnregisterAdapterService(const String& serviceUri);
65
68
70void CheckUnusedAdapterServices(const Services& services);
71} // namespace Ecap
72} // namespace Adaptation
73
74#endif /* SQUID_SRC_ADAPTATION_ECAP_SERVICEREP_H */
75
void error(char *format,...)
bool probed() const override
void tryConfigureAndStart()
attempts to configure and start eCAP service; the caller handles exceptions
bool wantsUrl(const SBuf &urlPath) const override
Adaptation::Initiate * makeXactLauncher(Http::Message *virginHeader, HttpRequest *virginCause, AccessLogEntry::Pointer &alp) override
bool handleFinalizeFailure(const char *error)
bool up() const override
virtual const char * status() const
bool detached() const override
whether detached() was called
libecap::shared_ptr< libecap::adapter::Service > AdapterService
Definition ServiceRep.h:39
common parts of HttpRequest and HttpReply
Definition Message.h:26
Definition SBuf.h:94
void RegisterAdapterService(const ServiceRep::AdapterService &adapterService)
register loaded eCAP module service
void CheckUnusedAdapterServices(const Services &services)
check for loaded eCAP services without matching ecap_service in squid.conf
ServiceRep::AdapterService FindAdapterService(const String &serviceUri)
returns loaded eCAP module service by service uri
void UnregisterAdapterService(const String &serviceUri)
unregister loaded eCAP module service by service uri
std::vector< Adaptation::ServicePointer > Services
Definition Service.h:70