]> git.ipfire.org Git - thirdparty/squid.git/blob - src/HttpHdrSc.h
Docs: Copyright updates for 2018 (#114)
[thirdparty/squid.git] / src / HttpHdrSc.h
1 /*
2 * Copyright (C) 1996-2018 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_HTTPHDRSURROGATECONTROL_H
10 #define SQUID_HTTPHDRSURROGATECONTROL_H
11
12 #include "dlink.h"
13 #include "mem/forward.h"
14 #include "SquidString.h"
15
16 class HttpHdrScTarget;
17 class Packable;
18 class StatHist;
19 class StoreEntry;
20
21 typedef enum {
22 SC_NO_STORE,
23 SC_NO_STORE_REMOTE,
24 SC_MAX_AGE,
25 SC_CONTENT,
26 SC_OTHER,
27 SC_ENUM_END /* also used to mean "invalid" */
28 } http_hdr_sc_type;
29
30 /* http surogate control header field */
31 class HttpHdrSc
32 {
33 MEMPROXY_CLASS(HttpHdrSc);
34
35 public:
36 HttpHdrSc(const HttpHdrSc &);
37 HttpHdrSc() {}
38 ~HttpHdrSc();
39
40 bool parse(const String *str);
41 void packInto(Packable * p) const;
42 void updateStats(StatHist *) const;
43 HttpHdrScTarget * getMergedTarget (const char *ourtarget); //todo: make const?
44 void setMaxAge(char const *target, int max_age);
45 void addTarget(HttpHdrScTarget *t);
46 void addTargetAtTail(HttpHdrScTarget *t);
47
48 dlink_list targets;
49 private:
50 HttpHdrScTarget * findTarget (const char *target);
51
52 };
53
54 /* Http Surrogate Control Header Field */
55 void httpHdrScStatDumper(StoreEntry * sentry, int idx, double val, double size, int count);
56 void httpHdrScInitModule (void);
57 HttpHdrSc *httpHdrScParseCreate(String const &);
58 void httpHdrScSetMaxAge(HttpHdrSc *, char const *, int);
59
60 #endif /* SQUID_HTTPHDRSURROGATECONTROL_H */
61