]> git.ipfire.org Git - thirdparty/squid.git/blame - src/adaptation/Service.h
removed many SQUIDCEXTERN declarations
[thirdparty/squid.git] / src / adaptation / Service.h
CommitLineData
a68cf076
AR
1#ifndef SQUID_ADAPTATION__SERVICE_H
2#define SQUID_ADAPTATION__SERVICE_H
3
4#include "SquidString.h"
d81a31f1
AR
5#include "RefCount.h"
6#include "adaptation/forward.h"
a68cf076 7#include "adaptation/Elements.h"
d81a31f1
AR
8#include "adaptation/ServiceConfig.h"
9
10// TODO: Move src/ICAP/ICAPServiceRep.h API comments here and update them
11
12class HttpMsg;
13class HttpRequest;
a68cf076 14
26ac0430
AJ
15namespace Adaptation
16{
a68cf076
AR
17
18// manages adaptation service configuration in squid.conf
19// specific adaptation mechanisms extend this class
d81a31f1 20class Service: public RefCountable
a68cf076
AR
21{
22public:
d81a31f1 23 typedef RefCount<Service> Pointer;
62c7f90e 24 typedef String Id;
d81a31f1
AR
25
26public:
6666da11 27 explicit Service(const ServiceConfigPointer &aConfig);
a68cf076
AR
28 virtual ~Service();
29
d81a31f1 30 virtual bool probed() const = 0; // see comments above
201438ac 31 virtual bool broken() const;
d81a31f1 32 virtual bool up() const = 0; // see comments above
a68cf076 33
4299f876 34 virtual Initiate *makeXactLauncher(HttpMsg *virginHeader, HttpRequest *virginCause) = 0;
a68cf076 35
a22e6cd3
AR
36 bool wants(const ServiceFilter &filter) const;
37
d81a31f1
AR
38 // the methods below can only be called on an up() service
39 virtual bool wantsUrl(const String &urlPath) const = 0;
40
41 // called by transactions to report service failure
42 virtual void noteFailure() = 0;
43
e1e90d26 44 const ServiceConfig &cfg() const { return *theConfig; }
a68cf076 45
62c7f90e
AR
46 virtual void finalize(); // called after creation
47
76fc7e57
AJ
48 /// called when removed from the config; the service will be
49 /// auto-destroyed when the last refcounting user leaves
50 virtual void detach() = 0;
51 /// whether detached() was called
52 virtual bool detached() const = 0;
53
a68cf076 54protected:
e1e90d26 55 ServiceConfig &writeableCfg() { return *theConfig; }
d81a31f1
AR
56
57private:
e1e90d26 58 ServiceConfigPointer theConfig;
a68cf076
AR
59};
60
d81a31f1
AR
61typedef Service::Pointer ServicePointer;
62
62c7f90e
AR
63typedef Vector<Adaptation::ServicePointer> Services;
64extern Services &AllServices();
65extern ServicePointer FindService(const Service::Id &key);
66
76fc7e57
AJ
67/// detach all adaptation services from current configuration
68extern void DetachServices();
69
a68cf076
AR
70} // namespace Adaptation
71
72#endif /* SQUID_ADAPTATION__SERVICE_H */