]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Add the nd_print_protocol_caps() function
authorFrancois-Xavier Le Bail <[email protected]>
Tue, 11 Jun 2019 15:52:07 +0000 (17:52 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Tue, 11 Jun 2019 16:06:48 +0000 (18:06 +0200)
Use the ndo->ndo_protocol field to print the protocol name in CAPS.

netdissect.h
util-print.c

index 020f58e4e1aad5b2c309912c905fb83d9b9b3a0d..c3621ffaf8a51deee8e7d58f3af9748147b2abb9 100644 (file)
@@ -744,6 +744,7 @@ extern uint16_t nextproto6_cksum(netdissect_options *, const struct ip6_hdr *, c
 /* Utilities */
 extern void nd_print_trunc(netdissect_options *);
 extern void nd_print_protocol(netdissect_options *);
+extern void nd_print_protocol_caps(netdissect_options *);
 extern void nd_print_invalid(netdissect_options *);
 
 extern int mask2plen(uint32_t);
index 6296821e6fd0f0fdc1bb32f2c08106186422f89c..9436711107f2bc0adf31689af9200b4eee343eb0 100644 (file)
@@ -451,6 +451,14 @@ void nd_print_protocol(netdissect_options *ndo)
        ND_PRINT("%s", ndo->ndo_protocol);
 }
 
+/* Print the protocol name in caps (uppercases) */
+void nd_print_protocol_caps(netdissect_options *ndo)
+{
+       const char *p;
+        for (p = ndo->ndo_protocol; *p != '\0'; p++)
+                ND_PRINT("%c", ND_TOUPPER((u_char)*p));
+}
+
 /* Print the invalid string */
 void nd_print_invalid(netdissect_options *ndo)
 {