1 /* $OpenBSD: sdl.h,v 1.9 2017/10/18 17:31:01 millert Exp $ */ 2 3 /* 4 * Copyright (c) 2003-2007 Bob Beck. All rights reserved. 5 * 6 * Permission to use, copy, modify, and distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 #ifndef _SDL_H_ 20 #define _SDL_H_ 21 22 #include <sys/types.h> 23 #include <sys/socket.h> 24 25 /* spamd netblock (black) list entry (ipv4) */ 26 struct sdentry_v4 { 27 struct in_addr sda; 28 struct in_addr sdm; 29 }; 30 31 struct sdentries_v4 { 32 struct sdentry_v4 *addrs; 33 u_int naddrs; 34 }; 35 36 struct sdaddr_v6 { 37 union { 38 struct in6_addr addr; 39 u_int32_t addr32[4]; 40 } _sda; /* 128-bit address */ 41 #define addr32 _sda.addr32 42 }; 43 44 /* spamd netblock (black) list entry (ipv6) */ 45 struct sdentry_v6 { 46 struct sdaddr_v6 sda; 47 struct sdaddr_v6 sdm; 48 }; 49 50 struct sdentries_v6 { 51 struct sdentry_v6 *addrs; 52 u_int naddrs; 53 }; 54 55 /* spamd source list */ 56 struct sdlist { 57 char *tag; /* sdlist source name */ 58 char *string; /* Format (451) string with no smtp code or \r\n */ 59 struct sdentries_v4 v4; 60 struct sdentries_v6 v6; 61 }; 62 63 int sdl_add(char *, char *, char **, u_int, char **, u_int); 64 void sdl_del(char *); 65 int sdl_check(struct sdlist *, int, void *); 66 struct sdlist **sdl_lookup(struct sdlist *, int, void *); 67 68 #endif /* _SDL_H_ */ 69