]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-msnlb.c
Add printing support for vsockmon devices.
[tcpdump] / print-msnlb.c
index c28646f995f43b1dcb4f349e85cb18b8698e419d..5d25f568265c6c0df486bb846956640914f7ab28 100644 (file)
  * SUCH DAMAGE.
  */
 
-#define NETDISSECT_REWORKED
+/* \summary: MS Network Load Balancing's (NLB) heartbeat printer */
+
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
 #endif
 
-#include <tcpdump-stdinc.h>
+#include "netdissect-stdinc.h"
 
-#include "interface.h"
+#include "netdissect.h"
 #include "addrtoname.h"
 #include "extract.h"
 
 struct msnlb_heartbeat_pkt {
-       u_int32_t unknown1;
-       u_int32_t unknown2;
-       u_int32_t host_prio;    /* little-endian */
-       u_int32_t virtual_ip;
-       u_int32_t host_ip;
+       nd_byte     unknown1[4];
+       nd_byte     unknown2[4];
+       nd_uint32_t host_prio;  /* little-endian */
+       nd_ipv4     virtual_ip;
+       nd_ipv4     host_ip;
        /* the protocol is undocumented so we ignore the rest */
 };
 
@@ -51,14 +52,15 @@ msnlb_print(netdissect_options *ndo, const u_char *bp)
 {
        const struct msnlb_heartbeat_pkt *hb;
 
-       hb = (struct msnlb_heartbeat_pkt *)bp;
-       ND_TCHECK(*hb);
+       ndo->ndo_protocol = "msnlb";
+       hb = (const struct msnlb_heartbeat_pkt *)bp;
+       ND_TCHECK_SIZE(hb);
 
-       ND_PRINT((ndo, "MS NLB heartbeat, host priority: %u,",
-               EXTRACT_LE_32BITS(&(hb->host_prio))));
-       ND_PRINT((ndo, " cluster IP: %s,", ipaddr_string(&(hb->virtual_ip))));
-       ND_PRINT((ndo, " host IP: %s", ipaddr_string(&(hb->host_ip))));
+       ND_PRINT("MS NLB heartbeat, host priority: %u,",
+               GET_LE_U_4((hb->host_prio)));
+       ND_PRINT(" cluster IP: %s,", ipaddr_string(ndo, hb->virtual_ip));
+       ND_PRINT(" host IP: %s", ipaddr_string(ndo, hb->host_ip));
        return;
 trunc:
-       ND_PRINT((ndo, "[|MS NLB]"));
+       nd_print_trunc(ndo);
 }