]> The Tcpdump Group git mirrors - tcpdump/commitdiff
WHOIS: Add its own printer source file and printer function
authorFrancois-Xavier Le Bail <[email protected]>
Fri, 14 Jan 2022 12:23:28 +0000 (13:23 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Fri, 14 Jan 2022 12:34:49 +0000 (13:34 +0100)
Like all other text protocols.

This is a follow-up to 185b7ce04b182d2d7e490f23a3f0c7b9ea5916e4.

CMakeLists.txt
Makefile.in
netdissect.h
print-tcp.c
print-whois.c [new file with mode: 0644]

index ce4fe1a2608fcad07e0061fb62e9e02d416aa527..7f0792560186efc9c295ce2fdde9b1bd530f2049 100644 (file)
@@ -1146,6 +1146,7 @@ set(NETDISSECT_SOURCE_LIST_C
     print-vxlan-gpe.c
     print-vxlan.c
     print-wb.c
+    print-whois.c
     print-zep.c
     print-zephyr.c
     print-zeromq.c
index 508873f7ad107191443d0a875e38652348d80611..8bfcae40746f9d9d1f6e5d958cd8465d57de464f 100644 (file)
@@ -246,6 +246,7 @@ LIBNETDISSECT_SRC=\
        print-vxlan-gpe.c \
        print-vxlan.c \
        print-wb.c \
+       print-whois.c \
        print-zep.c \
        print-zephyr.c \
        print-zeromq.c \
index 5b104df6193ad776203ed4ce93789bb6481b57af..b509b432d41f20e4976c8e1776eb578c46d51ae8 100644 (file)
@@ -745,6 +745,7 @@ extern void vtp_print(netdissect_options *, const u_char *, const u_int);
 extern void vxlan_gpe_print(netdissect_options *, const u_char *, u_int);
 extern void vxlan_print(netdissect_options *, const u_char *, u_int);
 extern void wb_print(netdissect_options *, const u_char *, u_int);
+extern void whois_print(netdissect_options *, const u_char *, u_int);
 extern void zep_print(netdissect_options *, const u_char *, u_int);
 extern void zephyr_print(netdissect_options *, const u_char *, u_int);
 extern void zmtp1_datagram_print(netdissect_options *, const u_char *, const u_int);
index 0c250a07491d86fa62042a9ef49b480ab3c6b323..86b70511e63d2ee1808b507f5032b1db06f2d638 100644 (file)
@@ -753,8 +753,7 @@ tcp_print(netdissect_options *ndo,
                 smtp_print(ndo, bp, length);
         } else if (IS_SRC_OR_DST_PORT(WHOIS_PORT)) {
                 ND_PRINT(": ");
-                ndo->ndo_protocol = "whois";   /* needed by txtproto_print() */
-                txtproto_print(ndo, bp, length, NULL, 0); /* RFC 3912 */
+                whois_print(ndo, bp, length);
         } else if (IS_SRC_OR_DST_PORT(BGP_PORT))
                 bgp_print(ndo, bp, length);
         else if (IS_SRC_OR_DST_PORT(PPTP_PORT))
diff --git a/print-whois.c b/print-whois.c
new file mode 100644 (file)
index 0000000..30c254a
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that: (1) source code
+ * distributions retain the above copyright notice and this paragraph
+ * in its entirety, and (2) distributions including binary code include
+ * the above copyright notice and this paragraph in its entirety in
+ * the documentation or other materials provided with the distribution.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
+ * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
+ * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE.
+ */
+
+/* \summary: WHOIS Protocol printer */
+
+/* RFC 3912 */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "netdissect-stdinc.h"
+
+#include "netdissect.h"
+
+void
+whois_print(netdissect_options *ndo, const u_char *pptr, u_int len)
+{
+       ndo->ndo_protocol = "whois";
+       txtproto_print(ndo, pptr, len, NULL, 0);
+}