Options.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_ICAPOPTIONS_H
10#define SQUID_ICAPOPTIONS_H
11
13
14class HttpHeader;
15class wordlist;
16
17namespace Adaptation
18{
19namespace Icap
20{
21
22/* Maintains options supported by a given ICAP service.
23 * See RFC 3507, Section "4.10.2 OPTIONS Response". */
24
26{
27
28public:
29 typedef void GetCallback(void *data, Options *options);
30 static void Get(ServiceRep::Pointer &service, GetCallback *cb, void *data);
31
32public:
33 Options();
34 ~Options();
35
36 void configure(const HttpReply *reply);
37
38 bool valid() const;
39 bool fresh() const;
40 int ttl() const;
41 time_t expire() const;
42 time_t timestamp() const { return theTimestamp; };
43
45 TransferKind transferKind(const SBuf &urlPath) const;
46
47public:
48 const char *error; // human-readable information; set iff !valid()
49
50 // ICAP server MUST supply this info
51 std::vector<ICAP::Method> methods;
53
54 // ICAP server MAY supply this info. If not, Squid supplies defaults.
61
62protected:
63 // Transfer-* extension list representation
64 // maintains wordlist and does parsing/matching
66 {
67 public:
70
71 bool matches(const SBuf &urlPath) const;
72
73 void parse(const String &buf, bool &foundStar);
74 void add(const char *extension);
75 void report(int level, const char *prefix) const;
76
77 public:
78 wordlist *extensions; // TODO: optimize with a hash of some sort
79 const char *name; // header name, mostly for debugging
80 TransferKind kind; // to simplify caller's life
81 };
82
83 // varios Transfer-* lists
84 struct Transfers {
88 TransferList *byDefault; // Transfer-X that has '*'
90
91 int theTTL;
93
94private:
95 void cfgMethod(ICAP::Method m);
96 void cfgIntHeader(const HttpHeader *h, const char *fname, int &value);
97 void cfgTransferList(const HttpHeader *h, TransferList &l);
98};
99
100} // namespace Icap
101} // namespace Adaptation
102
103#endif /* SQUID_ICAPOPTIONS_H */
104
void parse(const String &buf, bool &foundStar)
Definition: Options.cc:208
void add(const char *extension)
Definition: Options.cc:182
void report(int level, const char *prefix) const
Definition: Options.cc:226
bool matches(const SBuf &urlPath) const
Definition: Options.cc:187
time_t expire() const
Definition: Options.cc:78
bool fresh() const
Definition: Options.cc:67
struct Adaptation::Icap::Options::Transfers theTransfers
std::vector< ICAP::Method > methods
Definition: Options.h:51
void cfgIntHeader(const HttpHeader *h, const char *fname, int &value)
Definition: Options.cc:144
void GetCallback(void *data, Options *options)
Definition: Options.h:29
time_t timestamp() const
Definition: Options.h:42
bool valid() const
Definition: Options.cc:62
void cfgTransferList(const HttpHeader *h, TransferList &l)
Definition: Options.cc:156
void configure(const HttpReply *reply)
Definition: Options.cc:84
const char * error
Definition: Options.h:48
void cfgMethod(ICAP::Method m)
Definition: Options.cc:137
TransferKind transferKind(const SBuf &urlPath) const
Definition: Options.cc:46
static void Get(ServiceRep::Pointer &service, GetCallback *cb, void *data)
Definition: SBuf.h:94

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors