xref: /freebsd/sbin/ipf/libipf/printtcpflags.c (revision 347dd0539f3a75fdf2128dd4620ca99e96f311e9)
141edb306SCy Schubert #include "ipf.h"
241edb306SCy Schubert 
341edb306SCy Schubert 
441edb306SCy Schubert void
printtcpflags(u_32_t tcpf,u_32_t tcpfm)5efeb8bffSCy Schubert printtcpflags(u_32_t tcpf, u_32_t tcpfm)
641edb306SCy Schubert {
7*347dd053SRichard Scheffenegger 	uint16_t *t;
841edb306SCy Schubert 	char *s;
941edb306SCy Schubert 
10*347dd053SRichard Scheffenegger 	if (tcpf & ~TH_FLAGS) {
1141edb306SCy Schubert 		PRINTF("0x%x", tcpf);
1241edb306SCy Schubert 	} else {
1341edb306SCy Schubert 		for (s = flagset, t = flags; *s; s++, t++) {
1441edb306SCy Schubert 			if (tcpf & *t)
1541edb306SCy Schubert 				(void)putchar(*s);
1641edb306SCy Schubert 		}
1741edb306SCy Schubert 	}
1841edb306SCy Schubert 
1941edb306SCy Schubert 	if (tcpfm) {
2041edb306SCy Schubert 		(void)putchar('/');
21*347dd053SRichard Scheffenegger 		if (tcpfm & ~TH_FLAGS) {
2241edb306SCy Schubert 			PRINTF("0x%x", tcpfm);
2341edb306SCy Schubert 		} else {
2441edb306SCy Schubert 			for (s = flagset, t = flags; *s; s++, t++)
2541edb306SCy Schubert 				if (tcpfm & *t)
2641edb306SCy Schubert 					(void)putchar(*s);
2741edb306SCy Schubert 		}
2841edb306SCy Schubert 	}
2941edb306SCy Schubert }
30