-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathacl.h
45 lines (38 loc) · 924 Bytes
/
acl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef WINDOWS
#include <netinet/in.h>
#include <sys/socket.h> /* for sockaddr_storage */
#else
#include <winsock2.h>
#include <ws2ipdef.h>
#ifndef INET6_ADDRSTRLEN
#define INET6_ADDRSTRLEN 46
#endif
#endif
#define ACLS_MAX 10 /* max acls */
typedef struct {
unsigned int ip, mask;
} ace_ipv4;
typedef struct {
struct in6_addr ip;
unsigned char len;
} ace_ipv6;
typedef struct {
char country[2];
} ace_geo;
typedef struct {
unsigned char class;
unsigned char permit;
union {
ace_ipv4 ipv4;
ace_ipv6 ipv6;
ace_geo geo;
} ace;
} acl;
extern int client_acl;
extern void add_acl_ipv4(int, unsigned int, unsigned int, unsigned char);
extern void add_acl_ipv6(int, unsigned char *, unsigned char, unsigned char);
extern void add_acl_geo(int, char *, unsigned char);
extern void del_acl(int);
extern int match_acl(int, struct sockaddr_storage *);
extern void save_acls(FILE *fp);
extern void acl_init(void);