ServiceRep.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 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 
24 namespace Adaptation
25 {
26 namespace 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 {
35 public:
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;
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;
48  virtual const char *status() const;
49  void detach() override;
50  bool detached() const override;
51 
52 protected:
53  void tryConfigureAndStart();
54  bool handleFinalizeFailure(const char *error);
55 
56 private:
57  AdapterService theService; // the actual adaptation service we represent
58  bool isDetached;
59 };
60 
62 void RegisterAdapterService(const ServiceRep::AdapterService& adapterService);
64 void UnregisterAdapterService(const String& serviceUri);
65 
68 
70 void CheckUnusedAdapterServices(const Services& services);
71 } // namespace Ecap
72 } // namespace Adaptation
73 
74 #endif /* SQUID_SRC_ADAPTATION_ECAP_SERVICEREP_H */
75 
common parts of HttpRequest and HttpReply
Definition: Message.h:25
ServiceRep(const ServiceConfigPointer &aConfig)
Definition: ServiceRep.cc:163
AdapterService theService
Definition: ServiceRep.h:57
bool wantsUrl(const SBuf &urlPath) const override
Definition: ServiceRep.cc:251
bool probed() const override
Definition: ServiceRep.cc:241
void error(char *format,...)
void UnregisterAdapterService(const String &serviceUri)
unregister loaded eCAP module service by service uri
Definition: ServiceRep.cc:333
Definition: SBuf.h:93
ServiceRep::AdapterService FindAdapterService(const String &serviceUri)
returns loaded eCAP module service by service uri
Definition: ServiceRep.cc:314
void tryConfigureAndStart()
attempts to configure and start eCAP service; the caller handles exceptions
Definition: ServiceRep.cc:204
bool handleFinalizeFailure(const char *error)
Definition: ServiceRep.cc:222
void noteFailure() override
Definition: ServiceRep.cc:173
void RegisterAdapterService(const ServiceRep::AdapterService &adapterService)
register loaded eCAP module service
Definition: ServiceRep.cc:325
virtual const char * status() const
Definition: ServiceRep.cc:281
bool detached() const override
whether detached() was called
Definition: ServiceRep.cc:308
void CheckUnusedAdapterServices(const Services &services)
check for loaded eCAP services without matching ecap_service in squid.conf
Definition: ServiceRep.cc:344
Adaptation::Initiate * makeXactLauncher(Http::Message *virginHeader, HttpRequest *virginCause, AccessLogEntry::Pointer &alp) override
Definition: ServiceRep.cc:260
libecap::shared_ptr< libecap::adapter::Service > AdapterService
Definition: ServiceRep.h:39
std::vector< Adaptation::ServicePointer > Services
Definition: Service.h:70
bool up() const override
Definition: ServiceRep.cc:246

 

Introduction

Documentation

Support

Miscellaneous