]> git.ipfire.org Git - thirdparty/squid.git/blob - src/acl/Ip.h
Fix clang (with its own libc++) build after 9865de7 (#661)
[thirdparty/squid.git] / src / acl / Ip.h
1 /*
2 * Copyright (C) 1996-2020 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_ACLIP_H
10 #define SQUID_ACLIP_H
11
12 #include "acl/Acl.h"
13 #include "acl/Data.h"
14 #include "ip/Address.h"
15 #include "splay.h"
16
17 class acl_ip_data
18 {
19 MEMPROXY_CLASS(acl_ip_data);
20
21 public:
22 static acl_ip_data *FactoryParse(char const *);
23 static int NetworkCompare(acl_ip_data * const & a, acl_ip_data * const &b);
24
25 acl_ip_data ();
26
27 acl_ip_data (Ip::Address const &, Ip::Address const &, Ip::Address const &, acl_ip_data *);
28 void toStr(char *buf, int len) const;
29 SBuf toSBuf() const;
30
31 Ip::Address addr1;
32
33 Ip::Address addr2;
34
35 Ip::Address mask; /**< \todo This should perhapse be stored as a CIDR range now instead of a full IP mask. */
36
37 acl_ip_data *next; /**< used for parsing, not for storing */
38
39 private:
40
41 static bool DecodeMask(const char *asc, Ip::Address &mask, int string_format_type);
42 };
43
44 class ACLIP : public ACL
45 {
46 public:
47 void *operator new(size_t);
48 void operator delete(void *);
49
50 ACLIP() : data(NULL) {}
51 ~ACLIP();
52
53 typedef Splay<acl_ip_data *> IPSplay;
54
55 virtual char const *typeString() const = 0;
56 virtual void parse();
57 // virtual bool isProxyAuth() const {return true;}
58 virtual int match(ACLChecklist *checklist) = 0;
59 virtual SBufList dump() const;
60 virtual bool empty () const;
61
62 protected:
63
64 int match(const Ip::Address &);
65 IPSplay *data;
66
67 };
68
69 #endif /* SQUID_ACLIP_H */
70