xref: /freebsd/sbin/ipf/libipf/printtcpflags.c (revision 81ad6265)
1 #include "ipf.h"
2 
3 
4 void
5 printtcpflags(u_32_t tcpf, u_32_t tcpfm)
6 {
7 	u_char *t;
8 	char *s;
9 
10 	if (tcpf & ~TCPF_ALL) {
11 		PRINTF("0x%x", tcpf);
12 	} else {
13 		for (s = flagset, t = flags; *s; s++, t++) {
14 			if (tcpf & *t)
15 				(void)putchar(*s);
16 		}
17 	}
18 
19 	if (tcpfm) {
20 		(void)putchar('/');
21 		if (tcpfm & ~TCPF_ALL) {
22 			PRINTF("0x%x", tcpfm);
23 		} else {
24 			for (s = flagset, t = flags; *s; s++, t++)
25 				if (tcpfm & *t)
26 					(void)putchar(*s);
27 		}
28 	}
29 }
30