xref: /freebsd/sbin/ipf/libipf/printdstlistdata.c (revision efeb8bffe34422937c7f8df836afb5b817366d16)
141edb306SCy Schubert /*
241edb306SCy Schubert  * Copyright (C) 2012 by Darren Reed.
341edb306SCy Schubert  *
441edb306SCy Schubert  * See the IPFILTER.LICENCE file for details on licencing.
541edb306SCy Schubert  */
641edb306SCy Schubert 
741edb306SCy Schubert #include "ipf.h"
841edb306SCy Schubert #include <ctype.h>
941edb306SCy Schubert 
1041edb306SCy Schubert 
1141edb306SCy Schubert void
printdstlistdata(ippool_dst_t * pool,int opts)12*efeb8bffSCy Schubert printdstlistdata( ippool_dst_t *pool, int opts)
1341edb306SCy Schubert {
1441edb306SCy Schubert 
1541edb306SCy Schubert 	if ((opts & OPT_DEBUG) == 0) {
1641edb306SCy Schubert 		if ((pool->ipld_flags & IPDST_DELETE) != 0)
1741edb306SCy Schubert 			PRINTF("# ");
1841edb306SCy Schubert 		PRINTF("pool ");
1941edb306SCy Schubert 	} else {
2041edb306SCy Schubert 		if ((pool->ipld_flags & IPDST_DELETE) != 0)
2141edb306SCy Schubert 			PRINTF("# ");
2241edb306SCy Schubert 		PRINTF("Name: %s\tRole: ", pool->ipld_name);
2341edb306SCy Schubert 	}
2441edb306SCy Schubert 
2541edb306SCy Schubert 	printunit(pool->ipld_unit);
2641edb306SCy Schubert 
2741edb306SCy Schubert 	if ((opts & OPT_DEBUG) == 0) {
2841edb306SCy Schubert 		PRINTF("/dstlist (name %s;", pool->ipld_name);
2941edb306SCy Schubert 		if (pool->ipld_policy != IPLDP_NONE) {
3041edb306SCy Schubert 			PRINTF(" policy ");
3141edb306SCy Schubert 			printdstlistpolicy(pool->ipld_policy);
3241edb306SCy Schubert 			putchar(';');
3341edb306SCy Schubert 		}
3441edb306SCy Schubert 		PRINTF(")\n");
3541edb306SCy Schubert 	} else {
3641edb306SCy Schubert 		putchar(' ');
3741edb306SCy Schubert 
3841edb306SCy Schubert 		PRINTF("\tReferences: %d\n", pool->ipld_ref);
3941edb306SCy Schubert 		if ((pool->ipld_flags & IPDST_DELETE) != 0)
4041edb306SCy Schubert 			PRINTF("# ");
4141edb306SCy Schubert 		PRINTF("Policy: \n");
4241edb306SCy Schubert 		printdstlistpolicy(pool->ipld_policy);
4341edb306SCy Schubert 		PRINTF("\n\tNodes Starting at %p\n", pool->ipld_dests);
4441edb306SCy Schubert 	}
4541edb306SCy Schubert }
46