Stop using "tvb_get_ntohll()" and "%llX" in the BOOTP dissector, as the
former depends on having "guint64" and the latter depends on "%ll[douxX]" being what's used to print 64-bit integers, and there are platforms on which Etheeal runs that don't have "guint64" or that don't use "%ll[douxX]" to print 64-bit integers. Get rid of the routines to extract 64-bit integers into "gint64"s and "guint64"s, as per Ronnie Sahlberg's suggestion, to discourage people from writing code that won't work on all platforms; they should be using FT_UINT64, or the routines in "int-64bit.c", instead. svn path=/trunk/; revision=4102
This commit is contained in:
parent
d850e01b43
commit
62d224011d
26
epan/pint.h
26
epan/pint.h
|
@ -2,7 +2,7 @@
|
|||
* Definitions for extracting and translating integers safely and portably
|
||||
* via pointers.
|
||||
*
|
||||
* $Id: pint.h,v 1.3 2000/11/11 10:23:43 guy Exp $
|
||||
* $Id: pint.h,v 1.4 2001/10/29 21:56:48 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -32,10 +32,6 @@
|
|||
/* Pointer versions of ntohs and ntohl. Given a pointer to a member of a
|
||||
* byte array, returns the value of the two or four bytes at the pointer.
|
||||
* The pletoh[sl] versions return the little-endian representation.
|
||||
*
|
||||
* If G_HAVE_GINT64 is defined, so we can use "gint64" and "guint64" to
|
||||
* refer to 64-bit integral quantities, we also provide pntohll and
|
||||
* phtolell, which extract 64-bit integral quantities.
|
||||
*/
|
||||
|
||||
#define pntohs(p) ((guint16) \
|
||||
|
@ -51,16 +47,6 @@
|
|||
(guint32)*((guint8 *)(p)+2)<<8| \
|
||||
(guint32)*((guint8 *)(p)+3)<<0)
|
||||
|
||||
#ifdef G_HAVE_GINT64
|
||||
#define pntohll(p) ((guint64)*((guint8 *)(p)+0)<<56| \
|
||||
(guint64)*((guint8 *)(p)+1)<<48| \
|
||||
(guint64)*((guint8 *)(p)+2)<<40| \
|
||||
(guint64)*((guint8 *)(p)+3)<<32| \
|
||||
(guint64)*((guint8 *)(p)+4)<<24| \
|
||||
(guint64)*((guint8 *)(p)+5)<<16| \
|
||||
(guint64)*((guint8 *)(p)+6)<<8| \
|
||||
(guint64)*((guint8 *)(p)+7)<<0)
|
||||
#endif
|
||||
|
||||
#define pletohs(p) ((guint16) \
|
||||
((guint16)*((guint8 *)(p)+1)<<8| \
|
||||
|
@ -75,16 +61,6 @@
|
|||
(guint32)*((guint8 *)(p)+1)<<8| \
|
||||
(guint32)*((guint8 *)(p)+0)<<0)
|
||||
|
||||
#ifdef G_HAVE_GINT64
|
||||
#define pletohll(p) ((guint64)*((guint8 *)(p)+7)<<56| \
|
||||
(guint64)*((guint8 *)(p)+6)<<48| \
|
||||
(guint64)*((guint8 *)(p)+5)<<40| \
|
||||
(guint64)*((guint8 *)(p)+4)<<32| \
|
||||
(guint64)*((guint8 *)(p)+3)<<24| \
|
||||
(guint64)*((guint8 *)(p)+2)<<16| \
|
||||
(guint64)*((guint8 *)(p)+1)<<8| \
|
||||
(guint64)*((guint8 *)(p)+0)<<0)
|
||||
#endif
|
||||
|
||||
|
||||
/* Macros to byte-swap 32-bit and 16-bit quantities. */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* plugins.c
|
||||
* plugin routines
|
||||
*
|
||||
* $Id: plugins.c,v 1.37 2001/10/24 07:18:37 guy Exp $
|
||||
* $Id: plugins.c,v 1.38 2001/10/29 21:56:48 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -367,16 +367,10 @@ init_plugins(const char *plugin_dir)
|
|||
patable.p_tvb_get_ntohs = tvb_get_ntohs;
|
||||
patable.p_tvb_get_ntoh24 = tvb_get_ntoh24;
|
||||
patable.p_tvb_get_ntohl = tvb_get_ntohl;
|
||||
#ifdef G_HAVE_GINT64
|
||||
patable.p_tvb_get_ntohll = tvb_get_ntohll;
|
||||
#endif
|
||||
|
||||
patable.p_tvb_get_letohs = tvb_get_letohs;
|
||||
patable.p_tvb_get_letoh24 = tvb_get_letoh24;
|
||||
patable.p_tvb_get_letohl = tvb_get_letohl;
|
||||
#ifdef G_HAVE_GINT64
|
||||
patable.p_tvb_get_letohll = tvb_get_letohll;
|
||||
#endif
|
||||
|
||||
patable.p_tvb_memcpy = tvb_memcpy;
|
||||
patable.p_tvb_memdup = tvb_memdup;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
* the data of a backing tvbuff, or can be a composite of
|
||||
* other tvbuffs.
|
||||
*
|
||||
* $Id: tvbuff.c,v 1.19 2001/10/26 17:29:09 gram Exp $
|
||||
* $Id: tvbuff.c,v 1.20 2001/10/29 21:56:48 guy Exp $
|
||||
*
|
||||
* Copyright (c) 2000 by Gilbert Ramirez <gram@xiexie.org>
|
||||
*
|
||||
|
@ -982,17 +982,6 @@ tvb_get_ntohl(tvbuff_t *tvb, gint offset)
|
|||
return pntohl(ptr);
|
||||
}
|
||||
|
||||
#ifdef G_HAVE_GINT64
|
||||
guint64
|
||||
tvb_get_ntohll(tvbuff_t *tvb, gint offset)
|
||||
{
|
||||
guint8* ptr;
|
||||
|
||||
ptr = ensure_contiguous(tvb, offset, sizeof(guint64));
|
||||
return pntohll(ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
guint16
|
||||
tvb_get_letohs(tvbuff_t *tvb, gint offset)
|
||||
{
|
||||
|
@ -1020,18 +1009,6 @@ tvb_get_letohl(tvbuff_t *tvb, gint offset)
|
|||
return pletohl(ptr);
|
||||
}
|
||||
|
||||
#ifdef G_HAVE_GINT64
|
||||
guint64
|
||||
tvb_get_letohll(tvbuff_t *tvb, gint offset)
|
||||
{
|
||||
guint8* ptr;
|
||||
|
||||
ptr = ensure_contiguous(tvb, offset, sizeof(guint64));
|
||||
return pletohll(ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Find first occurence of needle in tvbuff, starting at offset. Searches
|
||||
* at most maxlength number of bytes; if maxlength is -1, searches to
|
||||
* end of tvbuff.
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
* the data of a backing tvbuff, or can be a composite of
|
||||
* other tvbuffs.
|
||||
*
|
||||
* $Id: tvbuff.h,v 1.15 2001/10/26 17:29:09 gram Exp $
|
||||
* $Id: tvbuff.h,v 1.16 2001/10/29 21:56:48 guy Exp $
|
||||
*
|
||||
* Copyright (c) 2000 by Gilbert Ramirez <gram@xiexie.org>
|
||||
*
|
||||
|
@ -227,16 +227,10 @@ guint8 tvb_get_guint8(tvbuff_t*, gint offset);
|
|||
guint16 tvb_get_ntohs(tvbuff_t*, gint offset);
|
||||
guint32 tvb_get_ntoh24(tvbuff_t*, gint offset);
|
||||
guint32 tvb_get_ntohl(tvbuff_t*, gint offset);
|
||||
#ifdef G_HAVE_GINT64
|
||||
guint64 tvb_get_ntohll(tvbuff_t*, gint offset);
|
||||
#endif
|
||||
|
||||
guint16 tvb_get_letohs(tvbuff_t*, gint offset);
|
||||
guint32 tvb_get_letoh24(tvbuff_t*, gint offset);
|
||||
guint32 tvb_get_letohl(tvbuff_t*, gint offset);
|
||||
#ifdef G_HAVE_GINT64
|
||||
guint64 tvb_get_letohll(tvbuff_t*, gint offset);
|
||||
#endif
|
||||
|
||||
/* Returns target for convenience. Does not suffer from possible
|
||||
* expense of tvb_get_ptr(), since this routine is smart enough
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Routines for BOOTP/DHCP packet disassembly
|
||||
* Gilbert Ramirez <gram@xiexie.org>
|
||||
*
|
||||
* $Id: packet-bootp.c,v 1.54 2001/06/18 02:17:45 guy Exp $
|
||||
* $Id: packet-bootp.c,v 1.55 2001/10/29 21:56:47 guy Exp $
|
||||
*
|
||||
* The information used comes from:
|
||||
* RFC 951: Bootstrap Protocol
|
||||
|
@ -15,9 +15,8 @@
|
|||
* http://www.isi.edu/in-notes/iana/assignments/bootp-dhcp-parameters
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
* Copyright 1998 Gerald Combs
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -44,6 +43,7 @@
|
|||
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
#include "int-64bit.h"
|
||||
#include "packet.h"
|
||||
#include "packet-arp.h"
|
||||
|
||||
|
@ -587,26 +587,8 @@ bootp_option(tvbuff_t *tvb, proto_tree *bp_tree, int voff, int eoff,
|
|||
tvb_get_guint8(tvb, voff+3));
|
||||
proto_tree_add_text(v_tree, tvb, voff+4, 1, "Replay Detection Method: %d",
|
||||
tvb_get_guint8(tvb, voff+4));
|
||||
/*
|
||||
* XXX:
|
||||
*
|
||||
* 1) this won't compile if you have a compiler that
|
||||
* doesn't support 64-bit integral quantities;
|
||||
*
|
||||
* 2) there is no standard for the printf format to
|
||||
* be used for 64-bit integral quantities, so
|
||||
* this may not display correctly.
|
||||
*
|
||||
* We need to figure out how to handle 64-bit integral
|
||||
* quantities portably, with some form of fallback if
|
||||
* the compiler doesn't support it, and some way of
|
||||
* handling "%ll{d,o,x}" (most platforms) vs. "%q{d,o.x}"
|
||||
* (FreeBSD, perhaps some versions of other BSDs) vs.
|
||||
* "sorry, we're an LP64 platform, %l{d,o,x} is good enough
|
||||
* for you" (Digital UNIX).
|
||||
*/
|
||||
proto_tree_add_text(v_tree, tvb, voff+5, 8, "Replay Detection Value: %0llX",
|
||||
tvb_get_ntohll(tvb, voff+5));
|
||||
proto_tree_add_text(v_tree, tvb, voff+5, 8, "Replay Detection Value: %s",
|
||||
u64toh(tvb_get_ptr(tvb, voff+5, 8)));
|
||||
if (vlen > 11) {
|
||||
proto_tree_add_text(v_tree, tvb, voff+13, 4, "Secret ID: %0X",
|
||||
tvb_get_ntohl(tvb, voff+13));
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* plugin_api.c
|
||||
* Routines for Ethereal plugins.
|
||||
*
|
||||
* $Id: plugin_api.c,v 1.24 2001/10/17 19:27:42 gram Exp $
|
||||
* $Id: plugin_api.c,v 1.25 2001/10/29 21:56:50 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* Copyright 2000 by Gilbert Ramirez <gram@xiexie.org>
|
||||
|
@ -108,15 +108,9 @@ plugin_address_table_init(plugin_address_table_t *pat)
|
|||
p_tvb_get_ntohs = pat->p_tvb_get_ntohs;
|
||||
p_tvb_get_ntoh24 = pat->p_tvb_get_ntoh24;
|
||||
p_tvb_get_ntohl = pat->p_tvb_get_ntohl;
|
||||
#ifdef G_HAVE_GINT64
|
||||
p_tvb_get_ntohll = pat->p_tvb_get_ntohll;
|
||||
#endif
|
||||
p_tvb_get_letohs = pat->p_tvb_get_letohs;
|
||||
p_tvb_get_letoh24 = pat->p_tvb_get_letoh24;
|
||||
p_tvb_get_letohl = pat->p_tvb_get_letohl;
|
||||
#ifdef G_HAVE_GINT64
|
||||
p_tvb_get_letohll = pat->p_tvb_get_letohll;
|
||||
#endif
|
||||
p_tvb_memcpy = pat->p_tvb_memcpy;
|
||||
p_tvb_memdup = pat->p_tvb_memdup;
|
||||
p_tvb_get_ptr = pat->p_tvb_get_ptr;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* plugin_api.h
|
||||
* Routines for Ethereal plugins.
|
||||
*
|
||||
* $Id: plugin_api.h,v 1.24 2001/10/17 19:27:42 gram Exp $
|
||||
* $Id: plugin_api.h,v 1.25 2001/10/29 21:56:50 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* Copyright 2000 by Gilbert Ramirez <gram@xiexie.org>
|
||||
|
@ -114,16 +114,10 @@
|
|||
#define tvb_get_ntohs (*p_tvb_get_ntohs)
|
||||
#define tvb_get_ntoh24 (*p_tvb_get_ntoh24)
|
||||
#define tvb_get_ntohl (*p_tvb_get_ntohl)
|
||||
#ifdef G_HAVE_GINT64
|
||||
#define tvb_get_ntohll (*p_tvb_get_ntohll)
|
||||
#endif
|
||||
|
||||
#define tvb_get_letohs (*p_tvb_get_letohs)
|
||||
#define tvb_get_letoh24 (*p_tvb_get_letoh24)
|
||||
#define tvb_get_letohl (*p_tvb_get_letohl)
|
||||
#ifdef G_HAVE_GINT64
|
||||
#define tvb_get_letohll (*p_tvb_get_letohll)
|
||||
#endif
|
||||
|
||||
#define tvb_memcpy (*p_tvb_memcpy)
|
||||
#define tvb_memdup (*p_tvb_memdup)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* plugin_table.h
|
||||
* Table of exported addresses for Ethereal plugins.
|
||||
*
|
||||
* $Id: plugin_table.h,v 1.26 2001/10/17 19:27:42 gram Exp $
|
||||
* $Id: plugin_table.h,v 1.27 2001/10/29 21:56:50 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* Copyright 2000 by Gilbert Ramirez <gram@xiexie.org>
|
||||
|
@ -123,16 +123,10 @@ typedef guint8 (*addr_tvb_get_guint8)(tvbuff_t*, gint);
|
|||
typedef guint16 (*addr_tvb_get_ntohs)(tvbuff_t*, gint);
|
||||
typedef guint32 (*addr_tvb_get_ntoh24)(tvbuff_t*, gint);
|
||||
typedef guint32 (*addr_tvb_get_ntohl)(tvbuff_t*, gint);
|
||||
#ifdef G_HAVE_GINT64
|
||||
typedef guint64 (*addr_tvb_get_ntohll)(tvbuff_t*, gint);
|
||||
#endif
|
||||
|
||||
typedef guint16 (*addr_tvb_get_letohs)(tvbuff_t*, gint);
|
||||
typedef guint32 (*addr_tvb_get_letoh24)(tvbuff_t*, gint);
|
||||
typedef guint32 (*addr_tvb_get_letohl)(tvbuff_t*, gint);
|
||||
#ifdef G_HAVE_GINT64
|
||||
typedef guint64 (*addr_tvb_get_letohll)(tvbuff_t*, gint);
|
||||
#endif
|
||||
|
||||
typedef guint8* (*addr_tvb_memcpy)(tvbuff_t*, guint8* target, gint, gint);
|
||||
typedef guint8* (*addr_tvb_memdup)(tvbuff_t*, gint, gint);
|
||||
|
@ -286,16 +280,10 @@ typedef struct {
|
|||
addr_tvb_get_ntohs p_tvb_get_ntohs;
|
||||
addr_tvb_get_ntoh24 p_tvb_get_ntoh24;
|
||||
addr_tvb_get_ntohl p_tvb_get_ntohl;
|
||||
#ifdef G_HAVE_GINT64
|
||||
addr_tvb_get_ntohll p_tvb_get_ntohll;
|
||||
#endif
|
||||
|
||||
addr_tvb_get_letohs p_tvb_get_letohs;
|
||||
addr_tvb_get_letoh24 p_tvb_get_letoh24;
|
||||
addr_tvb_get_letohl p_tvb_get_letohl;
|
||||
#ifdef G_HAVE_GINT64
|
||||
addr_tvb_get_letohll p_tvb_get_letohll;
|
||||
#endif
|
||||
|
||||
addr_tvb_memcpy p_tvb_memcpy;
|
||||
addr_tvb_memdup p_tvb_memdup;
|
||||
|
|
Loading…
Reference in New Issue