1 /* $OpenBSD: sdl.h,v 1.6 2007/11/03 19:16:07 beck 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 source list */ 26 struct sdlist { 27 char *tag; /* sdlist source name */ 28 char *string; /* Format (451) string with no smtp code or \r\n */ 29 struct sdentry *addrs; 30 size_t naddrs; 31 }; 32 33 /* yeah. Stolen from pf */ 34 struct sdaddr { 35 union { 36 struct in_addr v4; 37 struct in6_addr v6; 38 u_int8_t addr8[16]; 39 u_int16_t addr16[8]; 40 u_int32_t addr32[4]; 41 } _sda; /* 128-bit address */ 42 #define v4 _sda.v4 43 #define v6 _sda.v6 44 #define addr8 _sda.addr8 45 #define addr16 _sda.addr16 46 #define addr32 _sda.addr32 47 }; 48 49 /* spamd netblock (black) list */ 50 struct sdentry { 51 struct sdaddr sda; 52 struct sdaddr sdm; 53 }; 54 55 56 extern int sdl_add(char *, char *, char **, int); 57 extern void sdl_del(char *); 58 extern struct sdlist **sdl_lookup(struct sdlist *head, 59 int af, void * src); 60 61 #endif /* _SDL_H_ */ 62