]> The Tcpdump Group git mirrors - tcpdump/blobdiff - token.h
Fix the pointer tests in the non-ndoified TTEST2() macro as well.
[tcpdump] / token.h
diff --git a/token.h b/token.h
index f69cdf49d8eb5bfa708f23be1d41a03b5202b47d..73a82711544c4b508faebea6129fe2b9e4dd40e0 100644 (file)
--- a/token.h
+++ b/token.h
@@ -1,3 +1,4 @@
+/* @(#) $Header: /tcpdump/master/tcpdump/token.h,v 1.6 2002-12-11 07:14:12 guy Exp $ (LBL) */
 /*
  * Copyright (c) 1998, Larry Lile
  * All rights reserved.
 #define FRAME_TYPE(trp)                (((trp)->token_fc & 0xC0) >> 6)
 #define TOKEN_FC_LLC           1
 
-#define BROADCAST(trp)         ((ntohs((trp)->token_rcf) & 0xE000) >> 13)
-#define RIF_LENGTH(trp)                ((ntohs((trp)->token_rcf) & 0x1f00) >> 8)
-#define DIRECTION(trp)         ((ntohs((trp)->token_rcf) & 0x0080) >> 7)
-#define LARGEST_FRAME(trp)     ((ntohs((trp)->token_rcf) & 0x0070) >> 4)
-#define RING_NUMBER(trp, x)    ((ntohs((trp)->token_rseg[x]) & 0xfff0) >> 4)
-#define BRIDGE_NUMBER(trp, x)  ((ntohs((trp)->token_rseg[x]) & 0x000f))
-#define SEGMENT_COUNT(trp)     ((RIF_LENGTH(trp) - 2) / 2)
+#define BROADCAST(trp)         ((EXTRACT_16BITS(&(trp)->token_rcf) & 0xE000) >> 13)
+#define RIF_LENGTH(trp)                ((EXTRACT_16BITS(&(trp)->token_rcf) & 0x1f00) >> 8)
+#define DIRECTION(trp)         ((EXTRACT_16BITS(&(trp)->token_rcf) & 0x0080) >> 7)
+#define LARGEST_FRAME(trp)     ((EXTRACT_16BITS(&(trp)->token_rcf) & 0x0070) >> 4)
+#define RING_NUMBER(trp, x)    ((EXTRACT_16BITS(&(trp)->token_rseg[x]) & 0xfff0) >> 4)
+#define BRIDGE_NUMBER(trp, x)  ((EXTRACT_16BITS(&(trp)->token_rseg[x]) & 0x000f))
+#define SEGMENT_COUNT(trp)     ((int)((RIF_LENGTH(trp) - 2) / 2))
 
 struct token_header {
-       u_char  token_ac;
-       u_char  token_fc;
-       u_char  token_dhost[TOKEN_RING_MAC_LEN];
-       u_char  token_shost[TOKEN_RING_MAC_LEN];
-       u_short token_rcf;
-       u_short token_rseg[ROUTING_SEGMENT_MAX];
+       u_int8_t  token_ac;
+       u_int8_t  token_fc;
+       u_int8_t  token_dhost[TOKEN_RING_MAC_LEN];
+       u_int8_t  token_shost[TOKEN_RING_MAC_LEN];
+       u_int16_t token_rcf;
+       u_int16_t token_rseg[ROUTING_SEGMENT_MAX];
 };