3 #ifndef _CIDR_MATCH_H_INCLUDED_
4 #define _CIDR_MATCH_H_INCLUDED_
10 /* CIDR-style pattern matching
12 /* #include <cidr_match.h>
19 #include <limits.h> /* CHAR_BIT */
24 #include <myaddrinfo.h> /* MAI_V6ADDR_BYTES etc. */
30 * Address length is protocol dependent. Find out how large our address byte
34 # define CIDR_MATCH_ABYTES MAI_V6ADDR_BYTES
36 # define CIDR_MATCH_ABYTES MAI_V4ADDR_BYTES
40 * Each parsed CIDR pattern can be member of a linked list.
42 typedef struct CIDR_MATCH
{
43 unsigned char net_bytes
[CIDR_MATCH_ABYTES
]; /* network portion */
44 unsigned char mask_bytes
[CIDR_MATCH_ABYTES
]; /* network mask */
45 unsigned char addr_family
; /* AF_XXX */
46 unsigned char addr_byte_count
; /* typically, 4 or 16 */
47 unsigned char addr_bit_count
; /* optimization */
48 unsigned char mask_shift
; /* optimization */
49 struct CIDR_MATCH
*next
; /* next entry */
52 extern VSTRING
*cidr_match_parse(CIDR_MATCH
*, char *, VSTRING
*);
53 extern CIDR_MATCH
*cidr_match_execute(CIDR_MATCH
*, const char *);
58 /* The Secure Mailer license must be distributed with this software.
61 /* IBM T.J. Watson Research
63 /* Yorktown Heights, NY 10598, USA