summaryrefslogtreecommitdiffhomepage
path: root/src/hostspec.h
blob: 9d1d7bfb2d942597dda215c6a10ae698a71c5def (plain)
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
#ifndef HOSTSPEC_H
#define HOSTSPEC_H

#define IPV6_LEN 16

enum hostspec_type {
	HST_NONE,
	HST_STRING,
	HST_NUMERIC,
};

struct hostspec {
	enum hostspec_type type;
	union {
                char *string;
                struct {
                        unsigned char network[IPV6_LEN];
                        unsigned char mask[IPV6_LEN];
                } ip;
	} address;
};

int hostspec_parse(char *domain, struct hostspec *h);
int hostspec_match(const char *ip, const struct hostspec *h);

#endif