ServiceRep.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 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_ECAP_SERVICE_REP_H
12 #define SQUID_ECAP_SERVICE_REP_H
13 
14 #include "adaptation/forward.h"
15 #include "adaptation/Service.h"
16 #include <libecap/common/forward.h>
17 #include <libecap/common/memory.h>
18 
19 namespace Adaptation
20 {
21 namespace Ecap
22 {
23 
24 /* The eCAP service representative maintains information about a single eCAP
25  service that Squid communicates with. One eCAP module may register many
26  eCAP services. */
27 
29 {
30 public:
31  explicit ServiceRep(const ServiceConfigPointer &aConfig);
32  virtual ~ServiceRep();
33 
34  typedef libecap::shared_ptr<libecap::adapter::Service> AdapterService;
35 
36  /* Adaptation::Service API */
37  virtual void finalize();
38  virtual bool probed() const;
39  virtual bool up() const;
41  virtual bool wantsUrl(const SBuf &urlPath) const;
42  virtual void noteFailure();
43  virtual const char *status() const;
44  virtual void detach();
45  virtual bool detached() const;
46 
47 protected:
48  void tryConfigureAndStart();
49  bool handleFinalizeFailure(const char *error);
50 
51 private:
52  AdapterService theService; // the actual adaptation service we represent
53  bool isDetached;
54 };
55 
57 void RegisterAdapterService(const ServiceRep::AdapterService& adapterService);
59 void UnregisterAdapterService(const String& serviceUri);
60 
63 
65 void CheckUnusedAdapterServices(const Services& services);
66 } // namespace Ecap
67 } // namespace Adaptation
68 
69 #endif /* SQUID_ECAP_SERVICE_REP_H */
70 
std::vector< Adaptation::ServicePointer > Services
Definition: Service.h:70
virtual const char * status() const
Definition: ServiceRep.cc:272
ServiceRep::AdapterService FindAdapterService(const String &serviceUri)
returns loaded eCAP module service by service uri
Definition: ServiceRep.cc:305
Definition: SBuf.h:87
virtual bool probed() const
Definition: ServiceRep.cc:232
void error(char *format,...)
void UnregisterAdapterService(const String &serviceUri)
unregister loaded eCAP module service by service uri
Definition: ServiceRep.cc:324
void CheckUnusedAdapterServices(const Services &services)
check for loaded eCAP services without matching ecap_service in squid.conf
Definition: ServiceRep.cc:335
void tryConfigureAndStart()
attempts to configure and start eCAP service; the caller handles exceptions
Definition: ServiceRep.cc:195
virtual bool up() const
Definition: ServiceRep.cc:237
common parts of HttpRequest and HttpReply
Definition: Message.h:24
AdapterService theService
Definition: ServiceRep.h:52
ServiceRep(const ServiceConfigPointer &aConfig)
Definition: ServiceRep.cc:154
libecap::shared_ptr< libecap::adapter::Service > AdapterService
Definition: ServiceRep.h:34
bool handleFinalizeFailure(const char *error)
Definition: ServiceRep.cc:213
virtual Adaptation::Initiate * makeXactLauncher(Http::Message *virginHeader, HttpRequest *virginCause, AccessLogEntry::Pointer &alp)
Definition: ServiceRep.cc:251
virtual bool detached() const
whether detached() was called
Definition: ServiceRep.cc:299
virtual bool wantsUrl(const SBuf &urlPath) const
Definition: ServiceRep.cc:242
void RegisterAdapterService(const ServiceRep::AdapterService &adapterService)
register loaded eCAP module service
Definition: ServiceRep.cc:316

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors