nagios-nrpe/include/acl.h

74 lines
2.0 KiB
C
Raw Normal View History

2017-11-02 09:55:48 +01:00
/****************************************************************************
*
* acl.h - header file for acl.c
*
* License: GPLv2
2016-06-24 12:21:25 +02:00
* Copyright (c) 2011 Kaspersky Lab ZAO
*
2017-11-02 09:55:48 +01:00
* License Notice:
2016-06-24 12:21:25 +02:00
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2017-11-02 09:55:48 +01:00
*
****************************************************************************/
2016-06-24 12:21:25 +02:00
#ifndef ACL_H_INCLUDED
#define ACL_H_INCLUDED 1
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <netdb.h>
#include <syslog.h>
#include <stdarg.h>
#define CHAR_TO_NUMBER(c) ((c) - '0')
struct ip_acl {
int family;
struct in_addr addr;
struct in_addr mask;
struct in6_addr addr6;
struct in6_addr mask6;
struct ip_acl *next;
};
struct dns_acl {
char domain[255];
struct dns_acl *next;
};
2017-05-13 13:05:54 +02:00
/* Pointers to head ACL structs */
2016-06-24 12:21:25 +02:00
static struct ip_acl *ip_acl_head, *ip_acl_prev;
static struct dns_acl *dns_acl_head, *dns_acl_prev;
/* Functions */
void parse_allowed_hosts(char *allowed_hosts);
int add_ipv4_to_acl(char *ipv4);
int add_ipv6_to_acl(char *ipv6);
int add_domain_to_acl(char *domain);
//int is_an_allowed_host(struct in_addr);
int is_an_allowed_host(int, void *);
unsigned int prefix_from_mask(struct in_addr mask);
void show_acl_lists(void);
#endif /* ACL_H_INCLUDED */