Service.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2022 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_ADAPTATION__SERVICE_H
10#define SQUID_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
22namespace Adaptation
23{
24
25// manages adaptation service configuration in squid.conf
26// specific adaptation mechanisms extend this class
27class Service: public RefCountable
28{
29public:
31 typedef String Id;
32
33public:
34 explicit Service(const ServiceConfigPointer &aConfig);
35 virtual ~Service();
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
61protected:
63
64private:
66};
67
69
70typedef std::vector<Adaptation::ServicePointer> Services;
73
75void DetachServices();
76
77} // namespace Adaptation
78
79#endif /* SQUID_ADAPTATION__SERVICE_H */
80
#define RefCountable
The locking interface for use on Reference-Counted classes.
Definition: Lock.h:66
information used to search for adaptation services
Definition: ServiceFilter.h:23
ServiceConfigPointer theConfig
Definition: Service.h:65
virtual bool wantsUrl(const SBuf &urlPath) const =0
virtual bool broken() const
Definition: Service.cc:30
bool wants(const ServiceFilter &filter) const
Definition: Service.cc:36
ServiceConfig & writeableCfg()
Definition: Service.h:62
virtual bool detached() const =0
whether detached() was called
virtual ~Service()
Definition: Service.cc:22
virtual void detach()=0
const ServiceConfig & cfg() const
Definition: Service.h:51
virtual void noteFailure()=0
virtual Initiate * makeXactLauncher(Http::Message *virginHeader, HttpRequest *virginCause, AccessLogEntry::Pointer &alp)=0
virtual bool up() const =0
RefCount< Service > Pointer
Definition: Service.h:30
virtual bool probed() const =0
Service(const ServiceConfigPointer &aConfig)
Definition: Service.cc:16
virtual void finalize()
Definition: Service.cc:26
common parts of HttpRequest and HttpReply
Definition: Message.h:26
Definition: SBuf.h:94
Services & AllServices()
Definition: Service.cc:61
std::vector< Adaptation::ServicePointer > Services
Definition: Service.h:70
void DetachServices()
detach all adaptation services from current configuration
Definition: Service.cc:78
ServicePointer FindService(const Service::Id &key)
Definition: Service.cc:68
RefCount< Service > ServicePointer
Definition: forward.h:34

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors