summaryrefslogtreecommitdiffstats
path: root/contrib/ipfilter/lib/printtcpflags.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ipfilter/lib/printtcpflags.c')
-rw-r--r--contrib/ipfilter/lib/printtcpflags.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/contrib/ipfilter/lib/printtcpflags.c b/contrib/ipfilter/lib/printtcpflags.c
new file mode 100644
index 0000000..9860780
--- /dev/null
+++ b/contrib/ipfilter/lib/printtcpflags.c
@@ -0,0 +1,30 @@
+#include "ipf.h"
+
+
+void
+printtcpflags(tcpf, tcpfm)
+ u_32_t tcpf, tcpfm;
+{
+ u_char *t;
+ char *s;
+
+ if (tcpf & ~TCPF_ALL) {
+ PRINTF("0x%x", tcpf);
+ } else {
+ for (s = flagset, t = flags; *s; s++, t++) {
+ if (tcpf & *t)
+ (void)putchar(*s);
+ }
+ }
+
+ if (tcpfm) {
+ (void)putchar('/');
+ if (tcpfm & ~TCPF_ALL) {
+ PRINTF("0x%x", tcpfm);
+ } else {
+ for (s = flagset, t = flags; *s; s++, t++)
+ if (tcpfm & *t)
+ (void)putchar(*s);
+ }
+ }
+}
OpenPOWER on IntegriCloud