Service.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 #ifndef SQUID_SRC_ADAPTATION_SERVICE_H
10 #define SQUID_SRC_ADAPTATION_SERVICE_H
11 
12 #include "AccessLogEntry.h"
13 #include "adaptation/Elements.h"
14 #include "adaptation/forward.h"
16 #include "base/RefCount.h"
17 #include "http/forward.h"
18 #include "SquidString.h"
19 
20 // TODO: Move src/ICAP/ICAPServiceRep.h API comments here and update them
21 
22 namespace Adaptation
23 {
24 
25 // manages adaptation service configuration in squid.conf
26 // specific adaptation mechanisms extend this class
27 class Service: public RefCountable
28 {
29 public:
31  typedef String Id;
32 
33 public:
34  explicit Service(const ServiceConfigPointer &aConfig);
35  ~Service() override;
36 
37  virtual bool probed() const = 0; // see comments above
38  virtual bool broken() const;
39  virtual bool up() const = 0; // see comments above
40 
41  virtual Initiate *makeXactLauncher(Http::Message *virginHeader, HttpRequest *virginCause, AccessLogEntry::Pointer &alp) = 0;
42 
43  bool wants(const ServiceFilter &filter) const;
44 
45  // the methods below can only be called on an up() service
46  virtual bool wantsUrl(const SBuf &urlPath) const = 0;
47 
48  // called by transactions to report service failure
49  virtual void noteFailure() = 0;
50 
51  const ServiceConfig &cfg() const { return *theConfig; }
52 
53  virtual void finalize(); // called after creation
54 
57  virtual void detach() = 0;
59  virtual bool detached() const = 0;
60 
61 protected:
63 
64 private:
66 };
67 
69 
70 typedef std::vector<Adaptation::ServicePointer> Services;
73 
75 void DetachServices();
76 
77 } // namespace Adaptation
78 
79 #endif /* SQUID_SRC_ADAPTATION_SERVICE_H */
80 
virtual void detach()=0
common parts of HttpRequest and HttpReply
Definition: Message.h:25
virtual bool up() const =0
bool wants(const ServiceFilter &filter) const
Definition: Service.cc:36
information used to search for adaptation services
Definition: ServiceFilter.h:22
virtual void finalize()
Definition: Service.cc:26
virtual bool broken() const
Definition: Service.cc:30
Definition: SBuf.h:93
virtual bool probed() const =0
virtual void noteFailure()=0
ServiceConfig & writeableCfg()
Definition: Service.h:62
ServiceConfigPointer theConfig
Definition: Service.h:65
Services & AllServices()
Definition: Service.cc:61
ServicePointer FindService(const Service::Id &key)
Definition: Service.cc:68
~Service() override
Definition: Service.cc:22
Service(const ServiceConfigPointer &aConfig)
Definition: Service.cc:16
RefCount< Service > Pointer
Definition: Service.h:30
virtual bool detached() const =0
whether detached() was called
void DetachServices()
detach all adaptation services from current configuration
Definition: Service.cc:78
RefCount< Service > ServicePointer
Definition: forward.h:32
virtual bool wantsUrl(const SBuf &urlPath) const =0
std::vector< Adaptation::ServicePointer > Services
Definition: Service.h:70
const ServiceConfig & cfg() const
Definition: Service.h:51
virtual Initiate * makeXactLauncher(Http::Message *virginHeader, HttpRequest *virginCause, AccessLogEntry::Pointer &alp)=0

 

Introduction

Documentation

Support

Miscellaneous