From: Martin Mares Date: Wed, 26 Apr 2006 09:48:47 +0000 (+0200) Subject: The addrmask type has its own dumper now. X-Git-Tag: holmes-import~645^2~11^2~30 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=ac9299abd0f9df15d52f19cf5c670ea88ba8e05c;p=libucw.git The addrmask type has its own dumper now. --- diff --git a/lib/ipaccess.c b/lib/ipaccess.c index 3323d0a7..b152136c 100644 --- a/lib/ipaccess.c +++ b/lib/ipaccess.c @@ -10,6 +10,7 @@ #include "lib/lib.h" #include "lib/clists.h" #include "lib/conf2.h" +#include "lib/fastbuf.h" #include "lib/ipaccess.h" #include @@ -25,7 +26,8 @@ struct ipaccess_entry { struct addrmask addr; }; -static byte *addrmask_parser(byte *c, void *ptr) +static byte * +addrmask_parser(byte *c, void *ptr) { /* * This is tricky: addrmasks will be compared by memcmp(), so we must ensure @@ -53,9 +55,17 @@ static byte *addrmask_parser(byte *c, void *ptr) return NULL; } +static void +addrmask_dumper(struct fastbuf *fb, void *ptr) +{ + struct addrmask *am = ptr; + bprintf(fb, "%08x/%08x ", am->addr, am->mask); +} + static struct cf_user_type addrmask_type = { .size = sizeof(struct addrmask), - .parser = addrmask_parser + .parser = addrmask_parser, + .dumper = addrmask_dumper }; struct cf_section ipaccess_cf = {