summaryrefslogtreecommitdiff
path: root/libexec/spamd/sdl.h
blob: aef0093f1fee2a8618708e075326a6c15f532fa9 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*	$OpenBSD: sdl.h,v 1.9 2017/10/18 17:31:01 millert Exp $ */

/*
 * Copyright (c) 2003-2007 Bob Beck.  All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#ifndef _SDL_H_
#define _SDL_H_

#include <sys/types.h>
#include <sys/socket.h>

/* spamd netblock (black) list entry (ipv4) */
struct sdentry_v4 {
	struct in_addr sda;
	struct in_addr sdm;
};

struct sdentries_v4 {
	struct sdentry_v4 *addrs;
	u_int naddrs;
};

struct sdaddr_v6 {
	union {
		struct in6_addr		addr;
		u_int32_t		addr32[4];
	} _sda;		    /* 128-bit address */
#define addr32  _sda.addr32
};

/* spamd netblock (black) list entry (ipv6) */
struct sdentry_v6 {
	struct sdaddr_v6 sda;
	struct sdaddr_v6 sdm;
};

struct sdentries_v6 {
	struct sdentry_v6 *addrs;
	u_int naddrs;
};

/* spamd source list */
struct sdlist {
	char *tag;	/* sdlist source name */
	char *string;	/* Format (451) string with no smtp code or \r\n */
	struct sdentries_v4 v4;
	struct sdentries_v6 v6;
};

int	sdl_add(char *, char *, char **, u_int, char **, u_int);
void	sdl_del(char *);
int	sdl_check(struct sdlist *, int, void *);
struct sdlist **sdl_lookup(struct sdlist *, int, void *);

#endif	/* _SDL_H_ */