freebsd-dev/sbin/ipf/libipf/printaddr.c
Cy Schubert efeb8bffe3 ipflter: ANSIfy userland function declarations
Convert ipfilter userland function declarations from K&R to ANSI. This
syncs our function declarations with NetBSD hg commit 75edcd7552a0
(apply our changes). Though not copied from NetBSD, this change was
partially inspired by NetBSD's work and inspired by style(9).

Reviewed by:		glebius (for #network)
MFC after:		1 month
Differential Revision:	https://reviews.freebsd.org/D33595
2022-01-03 18:06:42 -08:00

74 lines
1.1 KiB
C

/*
* Copyright (C) 2012 by Darren Reed.
*
* See the IPFILTER.LICENCE file for details on licencing.
*
* $Id$
*/
#include "ipf.h"
void
printaddr(int family, int type, char *base, int ifidx, u_32_t *addr,
u_32_t *mask)
{
char *suffix;
switch (type)
{
case FRI_BROADCAST :
suffix = "bcast";
break;
case FRI_DYNAMIC :
PRINTF("%s", base + ifidx);
printmask(family, mask);
suffix = NULL;
break;
case FRI_NETWORK :
suffix = "net";
break;
case FRI_NETMASKED :
suffix = "netmasked";
break;
case FRI_PEERADDR :
suffix = "peer";
break;
case FRI_LOOKUP :
suffix = NULL;
printlookup(base, (i6addr_t *)addr, (i6addr_t *)mask);
break;
case FRI_NONE :
case FRI_NORMAL :
printhostmask(family, addr, mask);
suffix = NULL;
break;
case FRI_RANGE :
printhost(family, addr);
putchar('-');
printhost(family, mask);
suffix = NULL;
break;
case FRI_SPLIT :
printhost(family, addr);
putchar(',');
printhost(family, mask);
suffix = NULL;
break;
default :
PRINTF("<%d>", type);
printmask(family, mask);
suffix = NULL;
break;
}
if (suffix != NULL) {
PRINTF("%s/%s", base + ifidx, suffix);
}
}