From 027dc5fb9021ce3f814a345b17c56d899733569a Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Sat, 16 May 2009 21:10:02 +0200 Subject: ipset 3.0 release The main change is full bigendian and 64/32bit enviroment support - in consequence the kernel-userspace protocol version was bumped. --- ipset.h | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'ipset.h') diff --git a/ipset.h b/ipset.h index 2596dfa..e47a480 100644 --- a/ipset.h +++ b/ipset.h @@ -95,7 +95,7 @@ struct settype { */ /* Size of create data. Will be sent to kernel */ - size_t create_size; + u_int32_t create_size; /* Initialize the create. */ void (*create_init) (void *data); @@ -115,7 +115,7 @@ struct settype { */ /* Size of data. Will be sent to kernel */ - size_t adt_size; + u_int32_t adt_size; /* Function which parses command options */ ip_set_ip_t (*adt_parser) (int cmd, const char *optarg, void *data); @@ -125,7 +125,7 @@ struct settype { */ /* Size of header. */ - size_t header_size; + u_int32_t header_size; /* Initialize the type-header */ void (*initheader) (struct set *set, const void *data); @@ -134,16 +134,16 @@ struct settype { void (*printheader) (struct set *set, unsigned options); /* Pretty print all IPs */ - void (*printips) (struct set *set, void *data, size_t len, unsigned options); + void (*printips) (struct set *set, void *data, u_int32_t len, unsigned options); /* Pretty print all IPs sorted */ - void (*printips_sorted) (struct set *set, void *data, size_t len, unsigned options); + void (*printips_sorted) (struct set *set, void *data, u_int32_t len, unsigned options); /* Print save arguments for creating the set */ void (*saveheader) (struct set *set, unsigned options); /* Print save for all IPs */ - void (*saveips) (struct set *set, void *data, size_t len, unsigned options); + void (*saveips) (struct set *set, void *data, u_int32_t len, unsigned options); /* Conver a single IP (binding) to string */ char * (*bindip_tostring)(struct set *set, ip_set_ip_t ip, unsigned options); @@ -189,10 +189,13 @@ extern struct set *set_find_byid(ip_set_id_t id); extern unsigned warn_once; -#define BITSPERBYTE (8*sizeof(char)) -#define ID2BYTE(id) ((id)/BITSPERBYTE) -#define ID2MASK(id) (1 << ((id)%BITSPERBYTE)) -#define test_bit(id, heap) ((((char *)(heap))[ID2BYTE(id)] & ID2MASK(id)) != 0) +#define BITS_PER_LONG (8*sizeof(unsigned long)) +#define BIT_WORD(nr) ((nr) / BITS_PER_LONG) + +static inline int test_bit(int nr, const unsigned long *addr) +{ + return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1))); +} #define UNUSED __attribute__ ((unused)) #define CONSTRUCTOR(module) \ -- cgit v1.2.3