Squid Web Cache master
Loading...
Searching...
No Matches
Ip.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2025 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_SRC_ACL_IP_H
10#define SQUID_SRC_ACL_IP_H
11
12#include "acl/Data.h"
13#include "acl/Node.h"
14#include "ip/Address.h"
15#include "splay.h"
16
18{
20
21public:
22 static acl_ip_data *FactoryParse(char const *);
23
24 acl_ip_data ();
25
26 acl_ip_data (Ip::Address const &, Ip::Address const &, Ip::Address const &, acl_ip_data *);
27 void toStr(char *buf, int len) const;
28 SBuf toSBuf() const;
29
32
35
37
39
40 Ip::Address mask; // TODO: should use a CIDR range
41
44private:
45
46 static bool DecodeMask(const char *asc, Ip::Address &mask, int string_format_type);
47
48 bool containsVetted(const Ip::Address &needle) const;
49};
50
51class ACLIP : public Acl::Node
52{
53public:
54 void *operator new(size_t);
55 void operator delete(void *);
56
57 ACLIP() : data(nullptr) {}
58 ~ACLIP() override;
59
61
62 char const *typeString() const override = 0;
63 void parse() override;
64 // virtual bool isProxyAuth() const {return true;}
65 int match(ACLChecklist *checklist) override = 0;
66 SBufList dump() const override;
67 bool empty () const override;
68
69protected:
70
71 int match(const Ip::Address &);
73
74private:
75 bool parseGlobal(const char *);
76
78 bool matchAnyIpv4 = false;
79
81 bool matchAnyIpv6 = false;
82};
83
84#endif /* SQUID_SRC_ACL_IP_H */
85
Definition Ip.h:52
bool matchAnyIpv4
whether match() should return 1 for any IPv4 parameter
Definition Ip.h:78
ACLIP()
Definition Ip.h:57
SBufList dump() const override
Definition Ip.cc:509
Splay< acl_ip_data * > IPSplay
Definition Ip.h:60
char const * typeString() const override=0
bool parseGlobal(const char *)
Definition Ip.cc:426
void parse() override
parses node representation in squid.conf; dies on failures
Definition Ip.cc:472
~ACLIP() override
Definition Ip.cc:493
bool matchAnyIpv6
whether match() should return 1 for any IPv6 parameter
Definition Ip.h:81
bool empty() const override
Definition Ip.cc:525
IPSplay * data
Definition Ip.h:72
int match(ACLChecklist *checklist) override=0
Matches the actual data in checklist against this Acl::Node.
Definition SBuf.h:94
Definition splay.h:50
Ip::Address mask
Definition Ip.h:40
acl_ip_data()
Definition Ip.cc:567
Ip::Address lastAddress() const
maximum (masked) address that matches this configured ACL value
Definition Ip.cc:93
MEMPROXY_CLASS(acl_ip_data)
Ip::Address firstAddress() const
minimum (masked) address that matches this configured ACL value
Definition Ip.cc:84
SBuf toSBuf() const
Definition Ip.cc:75
static bool DecodeMask(const char *asc, Ip::Address &mask, int string_format_type)
Definition Ip.cc:176
bool containsVetted(const Ip::Address &needle) const
whether we have parsed and vetted an item with an addr1 field that matches the needle
Definition Ip.cc:219
Ip::Address addr1
Definition Ip.h:36
static acl_ip_data * FactoryParse(char const *)
Definition Ip.cc:244
void toStr(char *buf, int len) const
Definition Ip.cc:44
acl_ip_data * next
Definition Ip.h:42
Ip::Address addr2
Definition Ip.h:38
std::list< SBuf > SBufList
Definition forward.h:23
int const char size_t