xref: /freebsd/sbin/ipf/libipf/printdstlistdata.c (revision eee36ffa0d874f1c8aca912f7c2a8eba34509927)
1 /*
2  * Copyright (C) 2012 by Darren Reed.
3  *
4  * See the IPFILTER.LICENCE file for details on licencing.
5  */
6 
7 #include "ipf.h"
8 #include <ctype.h>
9 
10 
11 void
printdstlistdata(ippool_dst_t * pool,int opts)12 printdstlistdata( ippool_dst_t *pool, int opts)
13 {
14 	if ((opts & OPT_DEBUG) == 0 || opts & OPT_SAVEOUT) {
15 		if ((pool->ipld_flags & IPDST_DELETE) != 0)
16 			PRINTF("# ");
17 		PRINTF("pool ");
18 	} else {
19 		if ((pool->ipld_flags & IPDST_DELETE) != 0)
20 			PRINTF("# ");
21 		PRINTF("Name: %s\tRole: ", pool->ipld_name);
22 	}
23 
24 	printunit(pool->ipld_unit);
25 
26 	if ((opts & OPT_DEBUG) == 0 || opts & OPT_SAVEOUT) {
27 		PRINTF("/dstlist (name %s;", pool->ipld_name);
28 		if (pool->ipld_policy != IPLDP_NONE) {
29 			PRINTF(" policy ");
30 			printdstlistpolicy(pool->ipld_policy);
31 			putchar(';');
32 		}
33 		PRINTF(")\n");
34 	} else {
35 		putchar(' ');
36 
37 		PRINTF("\tReferences: %d\n", pool->ipld_ref);
38 		if ((pool->ipld_flags & IPDST_DELETE) != 0)
39 			PRINTF("# ");
40 		PRINTF("Policy: \n");
41 		printdstlistpolicy(pool->ipld_policy);
42 		PRINTF("\n\tNodes Starting at %p\n", pool->ipld_dests);
43 	}
44 }
45