]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-m3ua.c
Translate UDP/1700 as RADIUS
[tcpdump] / print-m3ua.c
index 4e5d1413c396718d9484ed03cefe3a13381a6104..40e5238952843c2aebbc93e22d026d58a3fae91f 100644 (file)
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#define NETDISSECT_REWORKED
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-#include <tcpdump-stdinc.h>
+#include <netdissect-stdinc.h>
 
 
-#include "interface.h"
+#include "netdissect.h"
 #include "extract.h"
 
 static const char tstr[] = " [|m3ua]";
 #include "extract.h"
 
 static const char tstr[] = " [|m3ua]";
-static const char cstr[] = " (corrupt)";
+static const char istr[] = " (invalid)";
 
 /* RFC 4666 */
 
 #define M3UA_REL_1_0 1
 
 struct m3ua_common_header {
 
 /* RFC 4666 */
 
 #define M3UA_REL_1_0 1
 
 struct m3ua_common_header {
-  u_int8_t  v;
-  u_int8_t  reserved;
-  u_int8_t  msg_class;
-  u_int8_t  msg_type;
-  u_int32_t len;
+  uint8_t  v;
+  uint8_t  reserved;
+  uint8_t  msg_class;
+  uint8_t  msg_type;
+  uint32_t len;
 };
 
 struct m3ua_param_header {
 };
 
 struct m3ua_param_header {
-  u_int16_t tag;
-  u_int16_t len;
+  uint16_t tag;
+  uint16_t len;
 };
 
 /* message classes */
 };
 
 /* message classes */
@@ -210,7 +209,7 @@ static const struct tok ParamName[] = {
 
 static void
 tag_value_print(netdissect_options *ndo,
 
 static void
 tag_value_print(netdissect_options *ndo,
-                const u_char *buf, const u_int16_t tag, const u_int16_t size)
+                const u_char *buf, const uint16_t tag, const uint16_t size)
 {
   switch (tag) {
   case M3UA_PARAM_NETWORK_APPEARANCE:
 {
   switch (tag) {
   case M3UA_PARAM_NETWORK_APPEARANCE:
@@ -218,19 +217,19 @@ tag_value_print(netdissect_options *ndo,
   case M3UA_PARAM_CORR_ID:
     /* buf and size don't include the header */
     if (size < 4)
   case M3UA_PARAM_CORR_ID:
     /* buf and size don't include the header */
     if (size < 4)
-      goto corrupt;
+      goto invalid;
     ND_TCHECK2(*buf, size);
     ND_PRINT((ndo, "0x%08x", EXTRACT_32BITS(buf)));
     break;
   /* ... */
   default:
     ND_TCHECK2(*buf, size);
     ND_PRINT((ndo, "0x%08x", EXTRACT_32BITS(buf)));
     break;
   /* ... */
   default:
-    ND_PRINT((ndo, "(length %u)", size + sizeof(struct m3ua_param_header)));
+    ND_PRINT((ndo, "(length %u)", size + (u_int)sizeof(struct m3ua_param_header)));
     ND_TCHECK2(*buf, size);
   }
   return;
 
     ND_TCHECK2(*buf, size);
   }
   return;
 
-corrupt:
-  ND_PRINT((ndo, "%s", cstr));
+invalid:
+  ND_PRINT((ndo, "%s", istr));
   ND_TCHECK2(*buf, size);
   return;
 trunc:
   ND_TCHECK2(*buf, size);
   return;
 trunc:
@@ -259,7 +258,7 @@ m3ua_tags_print(netdissect_options *ndo,
 
   while (p < buf + size) {
     if (p + sizeof(struct m3ua_param_header) > buf + size)
 
   while (p < buf + size) {
     if (p + sizeof(struct m3ua_param_header) > buf + size)
-      goto corrupt;
+      goto invalid;
     ND_TCHECK2(*p, sizeof(struct m3ua_param_header));
     /* Parameter Tag */
     hdr_tag = EXTRACT_16BITS(p);
     ND_TCHECK2(*p, sizeof(struct m3ua_param_header));
     /* Parameter Tag */
     hdr_tag = EXTRACT_16BITS(p);
@@ -267,7 +266,7 @@ m3ua_tags_print(netdissect_options *ndo,
     /* Parameter Length */
     hdr_len = EXTRACT_16BITS(p + 2);
     if (hdr_len < sizeof(struct m3ua_param_header))
     /* Parameter Length */
     hdr_len = EXTRACT_16BITS(p + 2);
     if (hdr_len < sizeof(struct m3ua_param_header))
-      goto corrupt;
+      goto invalid;
     /* Parameter Value */
     align = (p + hdr_len - buf) % 4;
     align = align ? 4 - align : 0;
     /* Parameter Value */
     align = (p + hdr_len - buf) % 4;
     align = align ? 4 - align : 0;
@@ -277,8 +276,8 @@ m3ua_tags_print(netdissect_options *ndo,
   }
   return;
 
   }
   return;
 
-corrupt:
-  ND_PRINT((ndo, "%s", cstr));
+invalid:
+  ND_PRINT((ndo, "%s", istr));
   ND_TCHECK2(*buf, size);
   return;
 trunc:
   ND_TCHECK2(*buf, size);
   return;
 trunc:
@@ -305,7 +304,7 @@ m3ua_print(netdissect_options *ndo,
 
   /* size includes the header */
   if (size < sizeof(struct m3ua_common_header))
 
   /* size includes the header */
   if (size < sizeof(struct m3ua_common_header))
-    goto corrupt;
+    goto invalid;
   ND_TCHECK(*hdr);
   if (hdr->v != M3UA_REL_1_0)
     return;
   ND_TCHECK(*hdr);
   if (hdr->v != M3UA_REL_1_0)
     return;
@@ -329,8 +328,8 @@ m3ua_print(netdissect_options *ndo,
     m3ua_tags_print(ndo, buf + sizeof(struct m3ua_common_header), EXTRACT_32BITS(&hdr->len) - sizeof(struct m3ua_common_header));
   return;
 
     m3ua_tags_print(ndo, buf + sizeof(struct m3ua_common_header), EXTRACT_32BITS(&hdr->len) - sizeof(struct m3ua_common_header));
   return;
 
-corrupt:
-  ND_PRINT((ndo, "%s", cstr));
+invalid:
+  ND_PRINT((ndo, "%s", istr));
   ND_TCHECK2(*buf, size);
   return;
 trunc:
   ND_TCHECK2(*buf, size);
   return;
 trunc: