summaryrefslogtreecommitdiff
path: root/usr.sbin/tcpdump/extract.h
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/tcpdump/extract.h')
-rw-r--r--usr.sbin/tcpdump/extract.h38
1 files changed, 19 insertions, 19 deletions
diff --git a/usr.sbin/tcpdump/extract.h b/usr.sbin/tcpdump/extract.h
index 22207110965..cecfb342759 100644
--- a/usr.sbin/tcpdump/extract.h
+++ b/usr.sbin/tcpdump/extract.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: extract.h,v 1.6 2000/10/03 14:31:54 ho Exp $ */
+/* $OpenBSD: extract.h,v 1.7 2002/09/03 12:21:12 ho Exp $ */
/*
* Copyright (c) 1992, 1993, 1994, 1995, 1996
@@ -20,40 +20,40 @@
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/extract.h,v 1.6 2000/10/03 14:31:54 ho Exp $ (LBL)
+ * @(#) $TCPDUMP: /tcpdump/master/tcpdump/extract.h,v 1.17 2001/09/17 21:57:52 fenner Exp $ (LBL)
*/
/* Network to host order macros */
#ifdef LBL_ALIGN
#define EXTRACT_16BITS(p) \
- ((u_short)*((u_char *)(p) + 0) << 8 | \
- (u_short)*((u_char *)(p) + 1))
+ ((u_int16_t)*((const u_int8_t *)(p) + 0) << 8 | \
+ (u_int16_t)*((const u_int8_t *)(p) + 1))
#define EXTRACT_32BITS(p) \
- ((u_int32_t)*((u_char *)(p) + 0) << 24 | \
- (u_int32_t)*((u_char *)(p) + 1) << 16 | \
- (u_int32_t)*((u_char *)(p) + 2) << 8 | \
- (u_int32_t)*((u_char *)(p) + 3))
+ ((u_int32_t)*((const u_int8_t *)(p) + 0) << 24 | \
+ (u_int32_t)*((const u_int8_t *)(p) + 1) << 16 | \
+ (u_int32_t)*((const u_int8_t *)(p) + 2) << 8 | \
+ (u_int32_t)*((const u_int8_t *)(p) + 3))
#else
#define EXTRACT_16BITS(p) \
- ((u_short)ntohs(*(u_short *)(p)))
+ ((u_int16_t)ntohs(*(const u_int16_t *)(p)))
#define EXTRACT_32BITS(p) \
- ((u_int32_t)ntohl(*(u_int32_t *)(p)))
+ ((u_int32_t)ntohl(*(const u_int32_t *)(p)))
#endif
#define EXTRACT_24BITS(p) \
- ((u_int32_t)*((u_char *)(p) + 0) << 16 | \
- (u_int32_t)*((u_char *)(p) + 1) << 8 | \
- (u_int32_t)*((u_char *)(p) + 2))
+ ((u_int32_t)*((const u_int8_t *)(p) + 0) << 16 | \
+ (u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \
+ (u_int32_t)*((const u_int8_t *)(p) + 2))
/* Little endian protocol host order macros */
#define EXTRACT_LE_8BITS(p) (*(p))
#define EXTRACT_LE_16BITS(p) \
- ((u_short)*((u_char *)(p) + 1) << 8 | \
- (u_short)*((u_char *)(p) + 0))
+ ((u_int16_t)*((const u_int8_t *)(p) + 1) << 8 | \
+ (u_int16_t)*((const u_int8_t *)(p) + 0))
#define EXTRACT_LE_32BITS(p) \
- ((u_int32_t)*((u_char *)(p) + 3) << 24 | \
- (u_int32_t)*((u_char *)(p) + 2) << 16 | \
- (u_int32_t)*((u_char *)(p) + 1) << 8 | \
- (u_int32_t)*((u_char *)(p) + 0))
+ ((u_int32_t)*((const u_int8_t *)(p) + 3) << 24 | \
+ (u_int32_t)*((const u_int8_t *)(p) + 2) << 16 | \
+ (u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \
+ (u_int32_t)*((const u_int8_t *)(p) + 0))