]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-zephyr.c
OpenFlow: Use bittok2str(), fix OF1.0 port status.
[tcpdump] / print-zephyr.c
index 2addd388cb3fd114a5dc85969ae6ba4292791506..8d199b56bdee0f2a9588acdeba85cdaac7b221c2 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Decode and print Zephyr packets.
  *
- *     http://web.mit.edu/zephyr/doc/protocol
+ *     https://web.mit.edu/zephyr/doc/protocol
  *
  * Copyright (c) 2001 Nickolai Zeldovich <[email protected]>
  * All rights reserved.
 /* \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>
 #include <stdlib.h>
 
+#include "netdissect-ctype.h"
+
 #include "netdissect.h"
 
 struct z_packet {
@@ -134,7 +136,7 @@ str_to_lower(const char *string)
 
     zb_string = z_buf;
     while (*zb_string) {
-       *zb_string = tolower((unsigned char)(*zb_string));
+       *zb_string = ND_ASCII_TOLOWER(*zb_string);
        zb_string++;
     }
 
@@ -144,22 +146,34 @@ str_to_lower(const char *string)
 void
 zephyr_print(netdissect_options *ndo, const u_char *cp, int length)
 {
-    struct z_packet z;
+    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 */
 
-    z.kind = 0;
-    z.class = 0;
-    z.inst = 0;
-    z.opcode = 0;
-    z.sender = 0;
-    z.recipient = 0;
-
 #define PARSE_STRING                                           \
        s = parse_field(ndo, &parse, &parselen, &truncated);    \
        if (truncated) goto trunc;                              \
@@ -331,6 +345,5 @@ zephyr_print(netdissect_options *ndo, const u_char *cp, int length)
     return;
 
 trunc:
-    ND_PRINT(" [|zephyr] (%d)", length);
-    return;
+    nd_print_trunc(ndo);
 }