]>
Commit | Line | Data |
---|---|---|
8000a965 | 1 | /* |
4ac4a490 | 2 | * Copyright (C) 1996-2017 The Squid Software Foundation and contributors |
8000a965 | 3 | * |
bbc27441 AJ |
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. | |
8000a965 | 7 | */ |
8 | ||
9 | #ifndef SQUID_ACLIP_H | |
10 | #define SQUID_ACLIP_H | |
63be0a78 | 11 | |
3ad63615 | 12 | #include "acl/Acl.h" |
33810b1d | 13 | #include "acl/Data.h" |
96d89ea0 | 14 | #include "ip/Address.h" |
602d9612 | 15 | #include "splay.h" |
8000a965 | 16 | |
62e76326 | 17 | class acl_ip_data |
18 | { | |
741c2986 | 19 | MEMPROXY_CLASS(acl_ip_data); |
62e76326 | 20 | |
21 | public: | |
8000a965 | 22 | static acl_ip_data *FactoryParse(char const *); |
23 | static int NetworkCompare(acl_ip_data * const & a, acl_ip_data * const &b); | |
62e76326 | 24 | |
8000a965 | 25 | acl_ip_data (); |
62e76326 | 26 | |
b7ac5457 | 27 | acl_ip_data (Ip::Address const &, Ip::Address const &, Ip::Address const &, acl_ip_data *); |
8000a965 | 28 | void toStr(char *buf, int len) const; |
8966008b | 29 | SBuf toSBuf() const; |
62e76326 | 30 | |
b7ac5457 | 31 | Ip::Address addr1; |
62e76326 | 32 | |
b7ac5457 | 33 | Ip::Address addr2; |
cc192b50 | 34 | |
b7ac5457 | 35 | Ip::Address mask; /**< \todo This should perhapse be stored as a CIDR range now instead of a full IP mask. */ |
62e76326 | 36 | |
f53969cc | 37 | acl_ip_data *next; /**< used for parsing, not for storing */ |
62e76326 | 38 | |
39 | private: | |
40 | ||
b7ac5457 | 41 | static bool DecodeMask(const char *asc, Ip::Address &mask, int string_format_type); |
8000a965 | 42 | }; |
43 | ||
62e76326 | 44 | class ACLIP : public ACL |
45 | { | |
62e76326 | 46 | public: |
8000a965 | 47 | void *operator new(size_t); |
48 | void operator delete(void *); | |
8000a965 | 49 | |
26ac0430 | 50 | ACLIP() : data(NULL) {} |
33810b1d | 51 | explicit ACLIP(const ACLFlag flgs[]) : ACL(flgs), data(NULL) {} |
62e76326 | 52 | |
8000a965 | 53 | ~ACLIP(); |
62e76326 | 54 | |
6a32ab4f | 55 | typedef Splay<acl_ip_data *> IPSplay; |
8000a965 | 56 | |
57 | virtual char const *typeString() const = 0; | |
8000a965 | 58 | virtual void parse(); |
62e76326 | 59 | // virtual bool isProxyAuth() const {return true;} |
8000a965 | 60 | virtual int match(ACLChecklist *checklist) = 0; |
8966008b | 61 | virtual SBufList dump() const; |
4b0f5de8 | 62 | virtual bool empty () const; |
62e76326 | 63 | |
64 | protected: | |
65 | ||
5c51bffb | 66 | int match(const Ip::Address &); |
8000a965 | 67 | IPSplay *data; |
62e76326 | 68 | |
8000a965 | 69 | }; |
70 | ||
71 | #endif /* SQUID_ACLIP_H */ | |
f53969cc | 72 |