]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-zephyr.c
Merge pull request #704 from nmap/win32-isatty
[tcpdump] / print-zephyr.c
index 8bf7fb52de3c80fac20aa398ea8c994d996af117..bce7394b26ef0eb18e28306ae4b5a2be558b2d92 100644 (file)
 /* \summary: Zephyr printer */
 
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
 #endif
 
-#include <netdissect-stdinc.h>
+#include "netdissect-stdinc.h"
 
 #include <stdio.h>
 #include <string.h>
@@ -119,7 +119,7 @@ z_triple(const char *class, const char *inst, const char *recipient)
 {
     if (!*recipient)
        recipient = "*";
-    snprintf(z_buf, sizeof(z_buf), "<%s,%s,%s>", class, inst, recipient);
+    nd_snprintf(z_buf, sizeof(z_buf), "<%s,%s,%s>", class, inst, recipient);
     z_buf[sizeof(z_buf)-1] = '\0';
     return z_buf;
 }
@@ -144,13 +144,32 @@ str_to_lower(const char *string)
 void
 zephyr_print(netdissect_options *ndo, const u_char *cp, int length)
 {
-    struct z_packet z = {0};
+    struct z_packet z = {
+        NULL,  /* version */
+        0,     /* numfields */
+        0,     /* kind */
+        NULL,  /* uid */
+        0,     /* port */
+        0,     /* auth */
+        0,     /* authlen */
+        NULL,  /* authdata */
+        NULL,  /* class */
+        NULL,  /* inst */
+        NULL,  /* opcode */
+        NULL,  /* sender */
+        NULL,  /* recipient */
+        NULL,  /* format */
+        0,     /* cksum */
+        0,     /* multi */
+        NULL   /* multi_uid */
+    };
     const char *parse = (const char *) cp;
     int parselen = length;
     const char *s;
     int lose = 0;
     int truncated = 0;
 
+    ndo->ndo_protocol = "zephyr";
     /* squelch compiler warnings */
 
 #define PARSE_STRING                                           \
@@ -324,6 +343,6 @@ zephyr_print(netdissect_options *ndo, const u_char *cp, int length)
     return;
 
 trunc:
-    ND_PRINT(" [|zephyr] (%d)", length);
+    nd_print_trunc(ndo);
     return;
 }