First release of open-appsec source code

This commit is contained in:
roybarda
2022-10-26 19:33:19 +03:00
parent 3883109caf
commit a883352f79
1353 changed files with 276290 additions and 1 deletions

View File

@@ -0,0 +1,28 @@
#ifndef __CIDRS_DATA_H__
#define __CIDRS_DATA_H__
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <errno.h>
#include "maybe_res.h"
#include "connkey.h"
class CIDRSData
{
public:
CIDRSData(const std::string &str_cidr);
bool contains(const std::string &source_ip) const;
private:
bool matchCidr(const in_addr &address, const in_addr &net) const;
bool matchCidr(const in6_addr &address, const in6_addr &network) const;
IPAddr ip_addr;
uint8_t network_bits;
bool valid_cidr = false;
};
#endif // __CIDRS_DATA_H__