acl.h
Go to the documentation of this file.
/*
* Copyright (c) 2011 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef WIRE_ACL_H
#define WIRE_ACL_H
#include "config.h"
#include "status.h"
#include "wire/listener.h"
#include "wire/tsig.h"
enum acl_range_enum {
ACL_RANGE_SINGLE = 0, /* single adress */
ACL_RANGE_MASK = 1, /* 10.20.30.40&255.255.255.0 */
ACL_RANGE_SUBNET = 2, /* 10.20.30.40/28 */
ACL_RANGE_MINMAX = 3 /* 10.20.30.40-10.20.30.60 (mask=max) */
};
typedef enum acl_range_enum acl_range_type;
typedef struct acl_struct acl_type;
struct acl_struct {
acl_type* next;
/* address */
char* address;
unsigned int port;
int family;
union acl_addr_storage addr;
union acl_addr_storage range_mask;
acl_range_type range_type;
/* tsig */
const char* tsig_name;
tsig_type* tsig;
/* cache */
time_t ixfr_disabled;
};
extern acl_type* acl_create(char* address,
char* port, char* tsig_name, tsig_type* tsig);
extern acl_type* acl_find(acl_type* acl, struct sockaddr_storage* addr,
tsig_rr_type* tsig);
extern int acl_parse_family(const char* a);
extern int addr2ip(struct sockaddr_storage addr, char* ip, size_t len);
extern void acl_cleanup(acl_type* acl);
#endif /* WIRE_ACL_H */
acl_create
acl_type * acl_create(char *address, char *port, char *tsig_name, tsig_type *tsig)
Definition acl.c:126
acl_type
struct acl_struct acl_type
Definition acl.h:57
acl_cleanup
void acl_cleanup(acl_type *acl)
Definition acl.c:456
acl_find
acl_type * acl_find(acl_type *acl, struct sockaddr_storage *addr, tsig_rr_type *tsig)
Definition acl.c:437
addr2ip
int addr2ip(struct sockaddr_storage addr, char *ip, size_t len)
Definition acl.c:416
acl_parse_family
int acl_parse_family(const char *a)
Definition acl.c:104
acl_range_enum
acl_range_enum
Definition acl.h:45
ACL_RANGE_SINGLE
@ ACL_RANGE_SINGLE
Definition acl.h:46
ACL_RANGE_MASK
@ ACL_RANGE_MASK
Definition acl.h:47
ACL_RANGE_SUBNET
@ ACL_RANGE_SUBNET
Definition acl.h:48
ACL_RANGE_MINMAX
@ ACL_RANGE_MINMAX
Definition acl.h:49
acl_range_type
enum acl_range_enum acl_range_type
Definition acl.h:51
listener.h
acl_struct
Definition acl.h:58
acl_struct::family
int family
Definition acl.h:63
acl_struct::range_mask
union acl_addr_storage range_mask
Definition acl.h:65
acl_struct::ixfr_disabled
time_t ixfr_disabled
Definition acl.h:71
acl_struct::tsig_name
const char * tsig_name
Definition acl.h:68
acl_struct::next
acl_type * next
Definition acl.h:59
acl_struct::address
char * address
Definition acl.h:61
acl_struct::range_type
acl_range_type range_type
Definition acl.h:66
acl_struct::tsig
tsig_type * tsig
Definition acl.h:69
acl_struct::addr
union acl_addr_storage addr
Definition acl.h:64
acl_struct::port
unsigned int port
Definition acl.h:62
tsig.h
tsig_type
struct tsig_struct tsig_type
Definition tsig.h:109
tsig_rr_type
struct tsig_rr_struct tsig_rr_type
Definition tsig.h:122
acl_addr_storage
Definition listener.h:59
acl_addr_storage::addr
struct in_addr addr
Definition listener.h:60