]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Get rid of private unaligned little-endian and big-endian fetch macros;
authorguy <guy>
Wed, 11 Dec 2002 05:40:09 +0000 (05:40 +0000)
committerguy <guy>
Wed, 11 Dec 2002 05:40:09 +0000 (05:40 +0000)
use EXTRACT_LE_16BITS and EXTRACT_16BITS instead.

print-krb.c

index e419e90704aa90f792f74bbf47cc3dedc501fd9d..444474a92bb2ad2fc8579bab92abd356ce1d0795 100644 (file)
@@ -23,7 +23,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-krb.c,v 1.19 2002-11-09 17:19:27 itojun Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-krb.c,v 1.20 2002-12-11 05:40:09 guy Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -36,6 +36,7 @@ static const char rcsid[] =
 
 #include "interface.h"
 #include "addrtoname.h"
+#include "extract.h"
 
 static const u_char *c_print(register const u_char *, register const u_char *);
 static const u_char *krb4_print_hdr(const u_char *);
@@ -98,25 +99,6 @@ static struct tok kerr2str[] = {
        { 0,                            NULL}
 };
 
-
-/* little endian (unaligned) to host byte order */
-/* XXX need to look at this... */
-#define vtohlp(x)          ((( ((char *)(x))[0] )      )  | \
-                            (( ((char *)(x))[1] ) <<  8)  | \
-                            (( ((char *)(x))[2] ) << 16)  | \
-                            (( ((char *)(x))[3] ) << 24))
-#define vtohsp(x)          ((( ((char *)(x))[0] )      )  | \
-                            (( ((char *)(x))[1] ) <<  8))
-/* network (big endian) (unaligned) to host byte order */
-#define ntohlp(x)          ((( ((char *)(x))[3] )      )  | \
-                            (( ((char *)(x))[2] ) <<  8)  | \
-                            (( ((char *)(x))[1] ) << 16)  | \
-                            (( ((char *)(x))[0] ) << 24))
-#define ntohsp(x)          ((( ((char *)(x))[1] )      )  | \
-                            (( ((char *)(x))[0] ) <<  8))
-
-
-
 static const u_char *
 c_print(register const u_char *s, register const u_char *ep)
 {
@@ -177,7 +159,7 @@ krb4_print(const u_char *cp)
 #define PRINT          if ((cp = c_print(cp, snapend)) == NULL) goto trunc
 /*  True if struct krb is little endian */
 #define IS_LENDIAN(kp) (((kp)->type & 0x01) != 0)
-#define KTOHSP(kp, cp) (IS_LENDIAN(kp) ? vtohsp(cp) : ntohsp(cp))
+#define KTOHSP(kp, cp) (IS_LENDIAN(kp) ? EXTRACT_LE_16BITS(cp) : EXTRACT_16BITS(cp))
 
        kp = (struct krb *)cp;