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 
21 public:
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 
31  Ip::Address firstAddress() const;
32 
34  Ip::Address lastAddress() const;
35 
37 
39 
40  Ip::Address mask; // TODO: should use a CIDR range
41 
44 private:
45 
46  static bool DecodeMask(const char *asc, Ip::Address &mask, int string_format_type);
47 };
48 
49 class ACLIP : public Acl::Node
50 {
51 public:
52  void *operator new(size_t);
53  void operator delete(void *);
54 
55  ACLIP() : data(nullptr) {}
56  ~ACLIP() override;
57 
59 
60  char const *typeString() const override = 0;
61  void parse() override;
62  // virtual bool isProxyAuth() const {return true;}
63  int match(ACLChecklist *checklist) override = 0;
64  SBufList dump() const override;
65  bool empty () const override;
66 
67 protected:
68 
69  int match(const Ip::Address &);
71 
72 private:
73  bool parseGlobal(const char *);
74 
76  bool matchAnyIpv4 = false;
77 
79  bool matchAnyIpv6 = false;
80 };
81 
82 #endif /* SQUID_SRC_ACL_IP_H */
83 
IPSplay * data
Definition: Ip.h:70
SBuf toSBuf() const
Definition: Ip.cc:75
bool empty() const override
Definition: Ip.cc:513
bool parseGlobal(const char *)
Definition: Ip.cc:414
std::list< SBuf > SBufList
Definition: forward.h:22
const char * typeString() const override=0
Definition: SBuf.h:93
Ip::Address mask
Definition: Ip.h:40
Ip::Address addr2
Definition: Ip.h:38
int const char size_t
Definition: stub_liblog.cc:83
ACLIP()
Definition: Ip.h:55
void toStr(char *buf, int len) const
Definition: Ip.cc:44
Definition: splay.h:49
Definition: Ip.h:49
Ip::Address lastAddress() const
maximum (masked) address that matches this configured ACL value
Definition: Ip.cc:93
bool matchAnyIpv6
whether match() should return 1 for any IPv6 parameter
Definition: Ip.h:79
Ip::Address addr1
Definition: Ip.h:36
Splay< acl_ip_data * > IPSplay
Definition: Ip.h:58
SBufList dump() const override
Definition: Ip.cc:497
int match(ACLChecklist *checklist) override=0
Matches the actual data in checklist against this Acl::Node.
static bool DecodeMask(const char *asc, Ip::Address &mask, int string_format_type)
Definition: Ip.cc:176
Definition: Node.h:25
~ACLIP() override
Definition: Ip.cc:481
Definition: Ip.h:17
Ip::Address firstAddress() const
minimum (masked) address that matches this configured ACL value
Definition: Ip.cc:84
bool matchAnyIpv4
whether match() should return 1 for any IPv4 parameter
Definition: Ip.h:76
acl_ip_data()
Definition: Ip.cc:555
acl_ip_data * next
Definition: Ip.h:42
static acl_ip_data * FactoryParse(char const *)
Definition: Ip.cc:229
void parse() override
parses node representation in squid.conf; dies on failures
Definition: Ip.cc:460
MEMPROXY_CLASS(acl_ip_data)

 

Introduction

Documentation

Support

Miscellaneous