source: squid-ssl/trunk/fuentes/src/RemovalPolicy.h @ 5495

Last change on this file since 5495 was 5495, checked in by Juanma, 2 years ago

Initial release

File size: 2.0 KB
Line 
1/*
2 * Copyright (C) 1996-2015 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
14class RemovalPolicyWalker;
15class RemovalPurgeWalker;
16
17class RemovalPolicySettings
18{
19
20public:
21    RemovalPolicySettings() : type(NULL), args(NULL) {};
22
23    char *type;
24    wordlist *args;
25};
26
27class RemovalPolicyNode
28{
29
30public:
31    RemovalPolicyNode() : data(NULL) {}
32
33    void *data;
34};
35
36class RemovalPolicy
37{
38public:
39    const char *_type;
40    void *_data;
41    void (*Free) (RemovalPolicy * policy);
42    void (*Add) (RemovalPolicy * policy, StoreEntry * entry, RemovalPolicyNode * node);
43    void (*Remove) (RemovalPolicy * policy, StoreEntry * entry, RemovalPolicyNode * node);
44    void (*Referenced) (RemovalPolicy * policy, const StoreEntry * entry, RemovalPolicyNode * node);
45    void (*Dereferenced) (RemovalPolicy * policy, const StoreEntry * entry, RemovalPolicyNode * node);
46    RemovalPolicyWalker *(*WalkInit) (RemovalPolicy * policy);
47    RemovalPurgeWalker *(*PurgeInit) (RemovalPolicy * policy, int max_scan);
48    void (*Stats) (RemovalPolicy * policy, StoreEntry * entry);
49private:
50    CBDATA_CLASS2(RemovalPolicy);
51};
52
53class RemovalPolicyWalker
54{
55public:
56    RemovalPolicy *_policy;
57    void *_data;
58    const StoreEntry *(*Next) (RemovalPolicyWalker * walker);
59    void (*Done) (RemovalPolicyWalker * walker);
60private:
61    CBDATA_CLASS2(RemovalPolicyWalker);
62};
63
64class RemovalPurgeWalker
65{
66public:
67    RemovalPolicy *_policy;
68    void *_data;
69    int scanned, max_scan, locked;
70    StoreEntry *(*Next) (RemovalPurgeWalker * walker);
71    void (*Done) (RemovalPurgeWalker * walker);
72private:
73    CBDATA_CLASS2(RemovalPurgeWalker);
74};
75
76RemovalPolicy *createRemovalPolicy(RemovalPolicySettings * settings);
77
78typedef RemovalPolicy *REMOVALPOLICYCREATE(wordlist * args);
79
80#endif /* SQUID_REMOVALPOLICY_H */
81
Note: See TracBrowser for help on using the repository browser.