]> git.ipfire.org Git - thirdparty/squid.git/blob - src/RemovalPolicy.h
Simplified MSNT basic auth helper
[thirdparty/squid.git] / src / RemovalPolicy.h
1 /*
2 * Copyright (C) 1996-2014 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_REMOVALPOLICY_H
10 #define SQUID_REMOVALPOLICY_H
11
12 #include "cbdata.h"
13
14 class RemovalPolicyWalker;
15 class RemovalPurgeWalker;
16
17 class RemovalPolicySettings
18 {
19
20 public:
21 RemovalPolicySettings() : type(NULL), args(NULL) {};
22
23 char *type;
24 wordlist *args;
25 };
26
27 class RemovalPolicyNode
28 {
29
30 public:
31 RemovalPolicyNode() : data(NULL) {}
32
33 void *data;
34 };
35
36 class RemovalPolicy
37 {
38 CBDATA_CLASS(RemovalPolicy);
39
40 public:
41 const char *_type;
42 void *_data;
43 void (*Free) (RemovalPolicy * policy);
44 void (*Add) (RemovalPolicy * policy, StoreEntry * entry, RemovalPolicyNode * node);
45 void (*Remove) (RemovalPolicy * policy, StoreEntry * entry, RemovalPolicyNode * node);
46 void (*Referenced) (RemovalPolicy * policy, const StoreEntry * entry, RemovalPolicyNode * node);
47 void (*Dereferenced) (RemovalPolicy * policy, const StoreEntry * entry, RemovalPolicyNode * node);
48 RemovalPolicyWalker *(*WalkInit) (RemovalPolicy * policy);
49 RemovalPurgeWalker *(*PurgeInit) (RemovalPolicy * policy, int max_scan);
50 void (*Stats) (RemovalPolicy * policy, StoreEntry * entry);
51 };
52
53 class RemovalPolicyWalker
54 {
55 CBDATA_CLASS(RemovalPolicyWalker);
56
57 public:
58 RemovalPolicy *_policy;
59 void *_data;
60 const StoreEntry *(*Next) (RemovalPolicyWalker * walker);
61 void (*Done) (RemovalPolicyWalker * walker);
62 };
63
64 class RemovalPurgeWalker
65 {
66 CBDATA_CLASS(RemovalPurgeWalker);
67
68 public:
69 RemovalPolicy *_policy;
70 void *_data;
71 int scanned, max_scan, locked;
72 StoreEntry *(*Next) (RemovalPurgeWalker * walker);
73 void (*Done) (RemovalPurgeWalker * walker);
74 };
75
76 RemovalPolicy *createRemovalPolicy(RemovalPolicySettings * settings);
77
78 typedef RemovalPolicy *REMOVALPOLICYCREATE(wordlist * args);
79
80 #endif /* SQUID_REMOVALPOLICY_H */
81