From Ronnie Sahlberg: FT_UINT64 support, code to handle 64-bit integers

without requiring compiler support for them, and updates to the
Diameter, L2TP, NFS, and NLM dissectors to use it and to the ONC RPC
dissector to allow ONC RPC subdissectors to use it.

svn path=/trunk/; revision=4099
This commit is contained in:
Guy Harris 2001-10-29 21:13:13 +00:00
parent e5eee0bd76
commit d82c74d757
14 changed files with 631 additions and 96 deletions

View File

@ -554,6 +554,10 @@ Ronnie Sahlberg <rsahlber[AT]bigpond.net.au> {
dissectors
Filterable fields for XoT and RIP
Times in NFS done as FT_ABSOLUTE_TIME and FT_RELATIVE_TIME
FT_UINT64 support, code to handle 64-bit integers without
requiring compiler support for them, and updates to the
Diameter, L2TP, NFS, and NLM dissectors to use it and to the
ONC RPC dissector to allow ONC RPC subdissectors to use it
}
Borosa Tomislav <tomislav.borosa[AT]SIEMENS.HR> {

View File

@ -1,7 +1,7 @@
# Makefile.am
# Automake file for Ethereal
#
# $Id: Makefile.am,v 1.371 2001/10/11 16:01:10 guy Exp $
# $Id: Makefile.am,v 1.372 2001/10/29 21:13:07 guy Exp $
#
# Ethereal - Network traffic analyzer
# By Gerald Combs <gerald@ethereal.com>
@ -422,6 +422,8 @@ ETHEREAL_COMMON_SRC = \
greproto.h \
in_cksum.c \
in_cksum.h \
int-64bit.c \
int-64bit.h \
ipproto.c \
ipproto.h \
llcsaps.h \

View File

@ -1,7 +1,7 @@
## Makefile for building ethereal.exe with Microsoft C and nmake
## Use: $(MAKE) /$(MAKEFLAGS) -f makefile.nmake
#
# $Id: Makefile.nmake,v 1.133 2001/10/11 16:01:10 guy Exp $
# $Id: Makefile.nmake,v 1.134 2001/10/29 21:13:07 guy Exp $
include config.nmake
include <win32.mak>
@ -237,6 +237,7 @@ ETHEREAL_COMMON_OBJECTS = \
follow.obj \
getopt.obj \
in_cksum.obj \
int-64bit.obj \
ipproto.obj \
prefs.obj \
print.obj \

View File

@ -1,5 +1,5 @@
/*
* $Id: semcheck.c,v 1.4 2001/03/02 17:04:23 gram Exp $
* $Id: semcheck.c,v 1.5 2001/10/29 21:13:12 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -53,6 +53,7 @@ compatible_ftypes(ftenum_t a, ftenum_t b)
case FT_IPv4:
case FT_IPv6:
case FT_IPXNET:
case FT_UINT64:
return a == b;
case FT_ETHER:

View File

@ -1,5 +1,5 @@
/*
* $Id: ftype-bytes.c,v 1.5 2001/03/03 00:33:24 guy Exp $
* $Id: ftype-bytes.c,v 1.6 2001/10/29 21:13:13 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -29,10 +29,11 @@
#include <string.h>
#include <ctype.h>
#include "resolv.h"
#include "../../int-64bit.h"
#define ETHER_LEN 6
#define IPv6_LEN 16
#define U64_LEN 8
static void
bytes_fvalue_new(fvalue_t *fv)
@ -45,6 +46,7 @@ bytes_fvalue_free(fvalue_t *fv)
{
if (fv->value.bytes) {
g_byte_array_free(fv->value.bytes, TRUE);
fv->value.bytes=NULL;
}
}
@ -77,6 +79,13 @@ ipv6_fvalue_set(fvalue_t *fv, gpointer value, gboolean already_copied)
common_fvalue_set(fv, value, IPv6_LEN);
}
static void
u64_fvalue_set(fvalue_t *fv, gpointer value, gboolean already_copied)
{
g_assert(!already_copied);
common_fvalue_set(fv, value, U64_LEN);
}
static gpointer
value_get(fvalue_t *fv)
{
@ -224,6 +233,20 @@ ipv6_from_string(fvalue_t *fv, char *s, LogFunc log)
return TRUE;
}
static gboolean
u64_from_string(fvalue_t *fv, char *s, LogFunc log)
{
guint8 buffer[8];
if (atou64(s, buffer) == NULL) {
log("\"%s\" is not a valid integer", s);
return FALSE;
}
u64_fvalue_set(fv, buffer, FALSE);
return TRUE;
}
static guint
len(fvalue_t *fv)
{
@ -422,7 +445,35 @@ ftype_register_bytes(void)
slice,
};
static ftype_t u64_type = {
"FT_UINT64",
"Unsigned 64-bit integer",
U64_LEN,
bytes_fvalue_new,
bytes_fvalue_free,
u64_from_string,
u64_fvalue_set,
NULL,
NULL,
value_get,
NULL,
NULL,
cmp_eq,
cmp_ne,
cmp_gt,
cmp_ge,
cmp_lt,
cmp_le,
len,
slice,
};
ftype_register(FT_BYTES, &bytes_type);
ftype_register(FT_ETHER, &ether_type);
ftype_register(FT_IPv6, &ipv6_type);
ftype_register(FT_UINT64, &u64_type);
}

View File

@ -1,7 +1,7 @@
/* ftypes.h
* Definitions for field types
*
* $Id: ftypes.h,v 1.5 2001/09/14 07:23:34 guy Exp $
* $Id: ftypes.h,v 1.6 2001/10/29 21:13:13 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -39,6 +39,7 @@ enum ftenum {
FT_UINT16,
FT_UINT24, /* really a UINT32, but displayed as 3 hex-digits if FD_HEX*/
FT_UINT32,
FT_UINT64,
FT_INT8,
FT_INT16,
FT_INT24,
@ -131,7 +132,6 @@ typedef struct {
gchar *string;
GByteArray *bytes;
ipv4_addr ipv4;
guint8 ipv6[16];
nstime_t time;
tvbuff_t *tvb;
} value;

View File

@ -1,7 +1,7 @@
/* proto.c
* Routines for protocol tree
*
* $Id: proto.c,v 1.37 2001/10/26 17:29:09 gram Exp $
* $Id: proto.c,v 1.38 2001/10/29 21:13:10 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -44,6 +44,7 @@
#include "plugins.h"
#include "ipv6-utils.h"
#include "proto.h"
#include "../int-64bit.h"
#define cVALS(x) (const value_string*)(x)
@ -52,6 +53,7 @@ proto_tree_free_node(GNode *node, gpointer data);
static void fill_label_boolean(field_info *fi, gchar *label_str);
static void fill_label_uint(field_info *fi, gchar *label_str);
static void fill_label_uint64(field_info *fi, gchar *label_str);
static void fill_label_enumerated_uint(field_info *fi, gchar *label_str);
static void fill_label_enumerated_bitfield(field_info *fi, gchar *label_str);
static void fill_label_numeric_bitfield(field_info *fi, gchar *label_str);
@ -81,6 +83,10 @@ proto_tree_set_representation(proto_item *pi, const char *format, va_list ap);
static void
proto_tree_set_protocol_tvb(field_info *fi, tvbuff_t *tvb);
static void
proto_tree_set_uint64b(field_info *fi, const guint8 *value_ptr, gboolean little_endian);
static void
proto_tree_set_uint64_tvb(field_info *fi, tvbuff_t *tvb, gint start, gboolean little_endian);
static void
proto_tree_set_bytes(field_info *fi, const guint8* start_ptr, gint length);
static void
proto_tree_set_bytes_tvb(field_info *fi, tvbuff_t *tvb, gint offset, gint length);
@ -485,6 +491,11 @@ proto_tree_add_item(proto_tree *tree, int hfindex, tvbuff_t *tvb,
get_uint_value(tvb, start, length, little_endian));
break;
case FT_UINT64:
g_assert(length == 8);
proto_tree_set_uint64_tvb(new_fi, tvb, start, little_endian);
break;
/* XXX - make these just FT_INT? */
case FT_INT8:
case FT_INT16:
@ -981,6 +992,30 @@ proto_tree_set_ipv6_tvb(field_info *fi, tvbuff_t *tvb, gint start)
proto_tree_set_ipv6(fi, tvb_get_ptr(tvb, start, 16));
}
static void
proto_tree_set_uint64(field_info *fi, const guint8 *value_ptr, gboolean little_endian)
{
if(little_endian){
unsigned char buffer[8];
int i;
for(i=0;i<8;i++){
buffer[i]=value_ptr[7-i];
}
fvalue_set(fi->value, (gpointer)buffer, FALSE);
} else {
fvalue_set(fi->value, (gpointer)value_ptr, FALSE);
}
}
static void
proto_tree_set_uint64_tvb(field_info *fi, tvbuff_t *tvb, gint start, gboolean little_endian)
{
/* XXX remove all this when last non-tvbuff dissector is removed*/
NullTVB;
proto_tree_set_uint64(fi, tvb_get_ptr(tvb, start, 8), little_endian);
}
/* Add a FT_STRING to a proto_tree */
proto_item *
proto_tree_add_string(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
@ -1954,6 +1989,10 @@ proto_item_fill_label(field_info *fi, gchar *label_str)
}
break;
case FT_UINT64:
fill_label_uint64(fi, label_str);
break;
case FT_INT8:
case FT_INT16:
case FT_INT24:
@ -2032,6 +2071,30 @@ proto_item_fill_label(field_info *fi, gchar *label_str)
}
}
static void
fill_label_uint64(field_info *fi, gchar *label_str)
{
unsigned char *bytes;
header_field_info *hfinfo = fi->hfinfo;
bytes=fvalue_get(fi->value);
switch(hfinfo->display){
case BASE_DEC:
snprintf(label_str, ITEM_LABEL_LENGTH,
"%s: %s", hfinfo->name,
u64toa(bytes));
break;
case BASE_HEX:
snprintf(label_str, ITEM_LABEL_LENGTH,
"%s: %s", hfinfo->name,
u64toh(bytes));
break;
default:
g_assert_not_reached();
;
}
}
static void
fill_label_boolean(field_info *fi, gchar *label_str)
{
@ -2875,6 +2938,7 @@ proto_can_match_selected(field_info *finfo)
case FT_UINT16:
case FT_UINT24:
case FT_UINT32:
case FT_UINT64:
case FT_INT8:
case FT_INT16:
case FT_INT24:
@ -2941,6 +3005,14 @@ proto_alloc_dfilter_string(field_info *finfo, guint8 *pd)
snprintf(buf, dfilter_len, format, hfinfo->abbrev, fvalue_get_integer(finfo->value));
break;
case FT_UINT64:
stringified = u64toa(fvalue_get(finfo->value));
dfilter_len = abbrev_len + 4 + strlen(stringified) +1;
buf = g_malloc0(dfilter_len);
snprintf(buf, dfilter_len, "%s == %s", hfinfo->abbrev,
stringified);
break;
case FT_IPv4:
dfilter_len = abbrev_len + 4 + 15 + 1;
buf = g_malloc0(dfilter_len);

383
int-64bit.c Normal file
View File

@ -0,0 +1,383 @@
/* int-64bit.c
* Routines for handling of 64bit integers
* 2001 Ronnie Sahlberg
*
* $Id: int-64bit.c,v 1.1 2001/10/29 21:13:07 guy Exp $
*
* Ethereal - Network traffic analyzer
* 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
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <string.h>
#include "int-64bit.h"
/* all functions take the 64bit integer parameter as a
pointer to a 64bit integer in network order.
that is ptr[0] is the most significant byte and
ptr[7] is the least significant byte.
*/
#define U64STRLEN 21
/* this must be signed. if it is not clear why, please dont
modify the functions in this file. it will break.
*/
static signed char u64val[64][U64STRLEN] =
{
/* 1 */ { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
/* 2 */ { 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
/* 3 */ { 4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
/* 4 */ { 8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
/* 5 */ { 6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
/* 6 */ { 2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
/* 7 */ { 4,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
/* 8 */ { 8,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
/* 9 */ { 6,5,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
/* 10 */ { 2,1,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
/* 11 */ { 4,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
/* 12 */ { 8,4,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
/* 13 */ { 6,9,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
/* 14 */ { 2,9,1,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
/* 15 */ { 4,8,3,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
/* 16 */ { 8,6,7,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
/* 17 */ { 6,3,5,5,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
/* 18 */ { 2,7,0,1,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
/* 19 */ { 4,4,1,2,6,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
/* 20 */ { 8,8,2,4,2,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
/* 21 */ { 6,7,5,8,4,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
/* 22 */ { 2,5,1,7,9,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
/* 23 */ { 4,0,3,4,9,1,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
/* 24 */ { 8,0,6,8,8,3,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
/* 25 */ { 6,1,2,7,7,7,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0 },
/* 26 */ { 2,3,4,4,5,5,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0 },
/* 27 */ { 4,6,8,8,0,1,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0 },
/* 28 */ { 8,2,7,7,1,2,4,3,1,0,0,0,0,0,0,0,0,0,0,0,0 },
/* 29 */ { 6,5,4,5,3,4,8,6,2,0,0,0,0,0,0,0,0,0,0,0,0 },
/* 30 */ { 2,1,9,0,7,8,6,3,5,0,0,0,0,0,0,0,0,0,0,0,0 },
/* 31 */ { 4,2,8,1,4,7,3,7,0,1,0,0,0,0,0,0,0,0,0,0,0 },
/* 32 */ { 8,4,6,3,8,4,7,4,1,2,0,0,0,0,0,0,0,0,0,0,0 },
/* 33 */ { 6,9,2,7,6,9,4,9,2,4,0,0,0,0,0,0,0,0,0,0,0 },
/* 34 */ { 2,9,5,4,3,9,9,8,5,8,0,0,0,0,0,0,0,0,0,0,0 },
/* 35 */ { 4,8,1,9,6,8,9,7,1,7,1,0,0,0,0,0,0,0,0,0,0 },
/* 36 */ { 8,6,3,8,3,7,9,5,3,4,3,0,0,0,0,0,0,0,0,0,0 },
/* 37 */ { 6,3,7,6,7,4,9,1,7,8,6,0,0,0,0,0,0,0,0,0,0 },
/* 38 */ { 2,7,4,3,5,9,8,3,4,7,3,1,0,0,0,0,0,0,0,0,0 },
/* 39 */ { 4,4,9,6,0,9,7,7,8,4,7,2,0,0,0,0,0,0,0,0,0 },
/* 40 */ { 8,8,8,3,1,8,5,5,7,9,4,5,0,0,0,0,0,0,0,0,0 },
/* 41 */ { 6,7,7,7,2,6,1,1,5,9,9,0,1,0,0,0,0,0,0,0,0 },
/* 42 */ { 2,5,5,5,5,2,3,2,0,9,9,1,2,0,0,0,0,0,0,0,0 },
/* 43 */ { 4,0,1,1,1,5,6,4,0,8,9,3,4,0,0,0,0,0,0,0,0 },
/* 44 */ { 8,0,2,2,2,0,3,9,0,6,9,7,8,0,0,0,0,0,0,0,0 },
/* 45 */ { 6,1,4,4,4,0,6,8,1,2,9,5,7,1,0,0,0,0,0,0,0 },
/* 46 */ { 2,3,8,8,8,0,2,7,3,4,8,1,5,3,0,0,0,0,0,0,0 },
/* 47 */ { 4,6,6,7,7,1,4,4,7,8,6,3,0,7,0,0,0,0,0,0,0 },
/* 48 */ { 8,2,3,5,5,3,8,8,4,7,3,7,0,4,1,0,0,0,0,0,0 },
/* 49 */ { 6,5,6,0,1,7,6,7,9,4,7,4,1,8,2,0,0,0,0,0,0 },
/* 50 */ { 2,1,3,1,2,4,3,5,9,9,4,9,2,6,5,0,0,0,0,0,0 },
/* 51 */ { 4,2,6,2,4,8,6,0,9,9,9,8,5,2,1,1,0,0,0,0,0 },
/* 52 */ { 8,4,2,5,8,6,3,1,8,9,9,7,1,5,2,2,0,0,0,0,0 },
/* 53 */ { 6,9,4,0,7,3,7,2,6,9,9,5,3,0,5,4,0,0,0,0,0 },
/* 54 */ { 2,9,9,0,4,7,4,5,2,9,9,1,7,0,0,9,0,0,0,0,0 },
/* 55 */ { 4,8,9,1,8,4,9,0,5,8,9,3,4,1,0,8,1,0,0,0,0 },
/* 56 */ { 8,6,9,3,6,9,8,1,0,7,9,7,8,2,0,6,3,0,0,0,0 },
/* 57 */ { 6,3,9,7,2,9,7,3,0,4,9,5,7,5,0,2,7,0,0,0,0 },
/* 58 */ { 2,7,8,5,5,8,5,7,0,8,8,1,5,1,1,4,4,1,0,0,0 },
/* 59 */ { 4,4,7,1,1,7,1,5,1,6,7,3,0,3,2,8,8,2,0,0,0 },
/* 60 */ { 8,8,4,3,2,4,3,0,3,2,5,7,0,6,4,6,7,5,0,0,0 },
/* 61 */ { 6,7,9,6,4,8,6,0,6,4,0,5,1,2,9,2,5,1,1,0,0 },
/* 62 */ { 2,5,9,3,9,6,3,1,2,9,0,0,3,4,8,5,0,3,2,0,0 },
/* 63 */ { 4,0,9,7,8,3,7,2,4,8,1,0,6,8,6,1,1,6,4,0,0 },
/* 64 */ { 8,0,8,5,7,7,4,5,8,6,3,0,2,7,3,3,2,2,9,0,0 }
};
/* convert an unsigned 64 bit integer into a string
it is important that this function is efficient
since it will be used for every 64bit integer in
any capture.
It is much less important that the inverse: atou64
be efficient since it is only called when
diplayfilters are entered.
*/
char *
u64toa(unsigned char *u64ptr)
{
unsigned char acc[U64STRLEN]; /* accumulator */
int i,j,k,pos;
static char str[U64STRLEN];
/* clear out the accumulator */
for(i=0;i<U64STRLEN-1;i++){
acc[i]=0;
}
pos=0;
/* loop over the 8 bytes of the 64bit integer,
lsb to msb */
for(i=7;i>=0;i--){
/* optimize, most of these bytes will be 0 ?*/
if(u64ptr[i]==0){
pos+=8;
continue;
}
for(j=0;j<8;j++,pos++){
if(u64ptr[i]&(1<<j)){
for(k=0;k<U64STRLEN-1;k++){
acc[k]+=u64val[pos][k];
}
}
}
/* we must handle carries inside this loop
since othevise the signed char in acc will
owerflow/wrap, but we dont need to do it
for every iteration. its enough if we
do it halfway through and at the end
and we will prevent any overflow.
*/
if((i%4)==0){
/* handle carries */
for(i=0;i<U64STRLEN-1;i++){
if(acc[i]>9){
int x;
x=acc[i]/10;
acc[i+1]+=x;
acc[i]-=x*10;
}
}
}
}
/* convert to a string */
str[U64STRLEN-1]=0;
for(i=0;i<U64STRLEN-1;i++){
str[U64STRLEN-2-i]='0'+acc[i];
}
/* skip the initial zeros */
for(i=0;i<U64STRLEN-2;i++){
if(str[i]>'0'){
break;
}
}
return str+i;
}
/* like memcmp but compares in reverse */
static int
revcmp(signed char *s1, signed char *s2, int len)
{
int i;
for(i=U64STRLEN-1;i>=0;i--){
if(s1[i]==s2[i]){
continue;
}
if(s1[i]>s2[i]){
return 1;
} else {
return -1;
}
}
return 0;
}
unsigned char *
atou64(char *u64str, unsigned char *u64int)
{
signed char res[U64STRLEN]; /* residual */
int i,j,len;
char *strp;
if(!u64str){
return NULL;
}
/* if it is a hex string */
if( (u64str[0]=='0')
&& (u64str[1]=='x') ){
return htou64(u64str, u64int);
}
/* verify that the string is ok */
for(strp=u64str;*strp;strp++){
if((*strp>='0')&&(*strp<='9')){
continue;
}
return NULL;
}
/* clear the result vector */
for(i=0;i<8;i++){
u64int[i]=0;
}
/* clear the residual string and copy the
original to it (subtracting '0')
*/
for(i=0;i<U64STRLEN;i++){
res[i]=0;
}
while(*u64str=='0'){ /* skip initial blanks */
u64str++;
}
len=strlen(u64str)-1;
for(i=0;len>=0;i++,len--){
res[i]=u64str[len]-'0';
}
/* go through all bits and subtract their
value */
for(i=63;i>=0;i--){
if(revcmp(u64val[i], res, U64STRLEN)<=0){
u64int[7-(i>>3)]|=(1<<(i&0x07));
for(j=0;j<U64STRLEN;j++){
res[j]-=u64val[i][j];
/*underflow*/
if(res[j]<0){
res[j]+=10;
res[j+1]-=1;
}
}
}
}
return u64int;
}
char *
u64toh(unsigned char *u64ptr)
{
static char str[19], *strp;
static char ntoh[] = {'0','1','2','3','4','5','6','7',
'8','9','A','B','C','D','E','F'};
int i;
str[0]='0';
str[1]='x';
strp=str+2;
for(i=0;i<8;i++){
*strp++ = ntoh[u64ptr[i]>>4];
*strp++ = ntoh[u64ptr[i]&0x0f];
}
*strp=0;
return str;
}
static unsigned int
ntoh(unsigned char h)
{
if((h>='0')&&(h<='9')){
return h-'0';
}
if((h>='A')&&(h<='F')){
return h+10-'A';
}
if((h>='a')&&(h<='f')){
return h+10-'a';
}
return 0;
}
unsigned char *
htou64(char *u64str, unsigned char *u64int)
{
int i,len;
char str[16], *strp;
if(!u64str){
return NULL;
}
/* verify that the string is ok */
if( (u64str[0]!='0')
|| (u64str[1]!='x') ){
return NULL;
}
for(strp=u64str+2;*strp;strp++){
if((*strp>='0')&&(*strp<='9')){
continue;
}
if((*strp>='A')&&(*strp<='F')){
continue;
}
if((*strp>='a')&&(*strp<='f')){
continue;
}
return NULL;
}
/* clear the result vector */
for(i=0;i<8;i++){
u64int[i]=0;
}
/* get len of input string */
for(len=0,strp=u64str+2;len<16;len++,strp++){
if((*strp>='0')&&(*strp<='9')){
continue;
}
if((*strp>='A')&&(*strp<='F')){
continue;
}
if((*strp>='a')&&(*strp<='f')){
continue;
}
break;
}
for(i=0;i<16;i++){
str[i]='0';
}
for(i=0;i<len;i++){
str[15-i]=u64str[len+1-i];
}
for(i=0;i<8;i++){
u64int[i]=(ntoh(str[i*2])<<4)
| ntoh(str[1+i*2]);
}
return u64int;
}
#ifdef TEST_DEBUG
int main(void)
{
char i[8] = {0,0,0,0,0x55,0x44,0x33,0x11};
char t[8];
printf("%s\n",u64toa(i));
printf("%s\n",u64toa(atou64("55443311",t)));
printf("%s\n",u64toh(i));
printf("%s\n",u64toh(htou64("0x55443311",t)));
return 0;
}
#endif

31
int-64bit.h Normal file
View File

@ -0,0 +1,31 @@
/* int-64bit.h
* Handling of 64bit integers
*
* $Id: int-64bit.h,v 1.1 2001/10/29 21:13:07 guy Exp $
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _INT_64BIT_H_
#define _INT_64BIT_H_
char *u64toa(unsigned char *u64ptr);
unsigned char *atou64(char *u64str, unsigned char *u64int);
char *u64toh(unsigned char *u64ptr);
unsigned char *htou64(char *u64str, unsigned char *u64int);
#endif

View File

@ -1,7 +1,7 @@
/* packet-diameter.c
* Routines for DIAMETER packet disassembly
*
* $Id: packet-diameter.c,v 1.26 2001/08/04 19:50:33 guy Exp $
* $Id: packet-diameter.c,v 1.27 2001/10/29 21:13:07 guy Exp $
*
* Copyright (c) 2001 by David Frascone <dave@frascone.com>
*
@ -753,14 +753,7 @@ static void dissect_avps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *avp_tree
}
break;
case DIAMETER_UNSIGNED64:
{
guint64 data;
memcpy(&data, dataBuffer, 8);
/* data = ntohll(data); */
proto_tree_add_int_format(avpi_tree, hf_diameter_avp_data_uint64,
tvb, offset, avpDataLength, data,
"Value: 0x%016llx (%llu)", data, data );
}
proto_tree_add_item(avpi_tree, hf_diameter_avp_data_uint64, tvb, offset, 8, FALSE);
break;
case DIAMETER_TIME:
@ -919,7 +912,7 @@ proto_register_diameter(void)
{ "AVP Vendor Id","diameter.avp.vendorId", FT_UINT32, BASE_DEC,
NULL, 0x0, "", HFILL }},
{ &hf_diameter_avp_data_uint64,
{ "AVP Data","diameter.avp.data.uint64", FT_UINT32, BASE_DEC,
{ "AVP Data","diameter.avp.data.uint64", FT_UINT64, BASE_DEC,
NULL, 0x0, "", HFILL }},
{ &hf_diameter_avp_data_int64,
{ "AVP Data","diameter.avp.data.int64", FT_INT32, BASE_DEC,

View File

@ -7,7 +7,7 @@
* Laurent Cazalet <laurent.cazalet@mailclub.net>
* Thomas Parvais <thomas.parvais@advalvas.be>
*
* $Id: packet-l2tp.c,v 1.26 2001/10/19 09:12:53 guy Exp $
* $Id: packet-l2tp.c,v 1.27 2001/10/29 21:13:07 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -47,6 +47,7 @@ static int hf_l2tp_avp_hidden = -1;
static int hf_l2tp_avp_length = -1;
static int hf_l2tp_avp_vendor_id = -1;
static int hf_l2tp_avp_type = -1;
static int hf_l2tp_tie_breaker = -1;
#ifdef HAVE_CONFIG_H
#include "config.h"
@ -617,17 +618,7 @@ dissect_l2tp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
case TIE_BREAKER:
/*
* XXX - 64-bit values aren't supported on
* platforms/compilers where "guint64" isn't
* supported, and, even on those platforms,
* there's no *printf standard for the format
* to use when printing those values, so we print it
* as a string of hex digits.
*/
proto_tree_add_text(l2tp_avp_tree, tvb, index, 8,
"Tie Breaker: %s",
tvb_bytes_to_str(tvb, index, 8));
proto_tree_add_item(l2tp_avp_tree, hf_l2tp_tie_breaker, tvb, index, 8, FALSE);
break;
case FIRMWARE_REVISION:
@ -1053,6 +1044,11 @@ proto_register_l2tp(void)
{ &hf_l2tp_avp_type,
{ "Type", "lt2p.avp.type", FT_UINT16, BASE_DEC, VALS(avp_type_vals), 0,
"AVP Type", HFILL }},
{ &hf_l2tp_tie_breaker,
{ "Tie Breaker", "lt2p.tie_breaker", FT_UINT64, BASE_HEX, NULL, 0,
"Tie Breaker", HFILL }},
};
static gint *ett[] = {

View File

@ -3,7 +3,7 @@
* Copyright 1999, Uwe Girlich <Uwe.Girlich@philosys.de>
* Copyright 2000-2001, Mike Frisch <frisch@hummingbird.com> (NFSv4 decoding)
*
* $Id: packet-nfs.c,v 1.58 2001/10/29 20:49:27 guy Exp $
* $Id: packet-nfs.c,v 1.59 2001/10/29 21:13:07 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -6080,7 +6080,7 @@ proto_register_nfs(void)
NULL, 0, "Directory Cookie", HFILL }},
{ &hf_nfs_readdir_entry3_fileid, {
"File ID", "nfs.readdir.entry3.fileid", FT_UINT32, BASE_DEC,
"File ID", "nfs.readdir.entry3.fileid", FT_UINT64, BASE_DEC,
NULL, 0, "File ID", HFILL }},
{ &hf_nfs_readdir_entry3_name, {
@ -6088,11 +6088,11 @@ proto_register_nfs(void)
NULL, 0, "Name", HFILL }},
{ &hf_nfs_readdir_entry3_cookie, {
"Cookie", "nfs.readdir.entry3.cookie", FT_UINT32, BASE_DEC,
"Cookie", "nfs.readdir.entry3.cookie", FT_UINT64, BASE_DEC,
NULL, 0, "Directory Cookie", HFILL }},
{ &hf_nfs_readdirplus_entry_fileid, {
"File ID", "nfs.readdirplus.entry.fileid", FT_UINT32, BASE_DEC,
"File ID", "nfs.readdirplus.entry.fileid", FT_UINT64, BASE_DEC,
NULL, 0, "Name", HFILL }},
{ &hf_nfs_readdirplus_entry_name, {
@ -6100,7 +6100,7 @@ proto_register_nfs(void)
NULL, 0, "Name", HFILL }},
{ &hf_nfs_readdirplus_entry_cookie, {
"Cookie", "nfs.readdirplus.entry.cookie", FT_UINT32, BASE_DEC,
"Cookie", "nfs.readdirplus.entry.cookie", FT_UINT64, BASE_DEC,
NULL, 0, "Directory Cookie", HFILL }},
{ &hf_nfs_readdir_eof, {
@ -6165,7 +6165,7 @@ proto_register_nfs(void)
"dtpref", "nfs.fsinfo.dtpref", FT_UINT32, BASE_DEC,
NULL, 0, "Preferred READDIR request", HFILL }},
{ &hf_nfs_fsinfo_maxfilesize, {
"maxfilesize", "nfs.fsinfo.maxfilesize", FT_UINT32, BASE_DEC,
"maxfilesize", "nfs.fsinfo.maxfilesize", FT_UINT64, BASE_DEC,
NULL, 0, "Maximum file size", HFILL }},
{ &hf_nfs_fsinfo_properties, {
"Properties", "nfs.fsinfo.propeties", FT_UINT32, BASE_HEX,
@ -6246,11 +6246,11 @@ proto_register_nfs(void)
NULL, 0, "nfs.fattr3.gid", HFILL }},
{ &hf_nfs_fattr3_size, {
"size", "nfs.fattr3.size", FT_UINT32, BASE_DEC,
"size", "nfs.fattr3.size", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.fattr3.size", HFILL }},
{ &hf_nfs_fattr3_used, {
"used", "nfs.fattr3.used", FT_UINT32, BASE_DEC,
"used", "nfs.fattr3.used", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.fattr3.used", HFILL }},
{ &hf_nfs_fattr3_rdev, {
@ -6258,19 +6258,19 @@ proto_register_nfs(void)
NULL, 0, "nfs.fattr3.rdev", HFILL }},
{ &hf_nfs_fattr3_fsid, {
"fsid", "nfs.fattr3.fsid", FT_UINT32, BASE_DEC,
"fsid", "nfs.fattr3.fsid", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.fattr3.fsid", HFILL }},
{ &hf_nfs_fattr3_fileid, {
"fileid", "nfs.fattr3.fileid", FT_UINT32, BASE_DEC,
"fileid", "nfs.fattr3.fileid", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.fattr3.fileid", HFILL }},
{ &hf_nfs_wcc_attr_size, {
"size", "nfs.wcc_attr.size", FT_UINT32, BASE_DEC,
"size", "nfs.wcc_attr.size", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.wcc_attr.size", HFILL }},
{ &hf_nfs_set_size3_size, {
"size", "nfs.set_size3.size", FT_UINT32, BASE_DEC,
"size", "nfs.set_size3.size", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.set_size3.size", HFILL }},
{ &hf_nfs_uid3, {
@ -6282,11 +6282,11 @@ proto_register_nfs(void)
NULL, 0, "nfs.gid3", HFILL }},
{ &hf_nfs_cookie3, {
"cookie", "nfs.cookie3", FT_UINT32, BASE_DEC,
"cookie", "nfs.cookie3", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.cookie3", HFILL }},
{ &hf_nfs_offset3, {
"offset", "nfs.offset3", FT_UINT32, BASE_DEC,
"offset", "nfs.offset3", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.offset3", HFILL }},
{ &hf_nfs_count3, {
@ -6302,27 +6302,27 @@ proto_register_nfs(void)
NULL, 0, "nfs.count3_dircount", HFILL }},
{ &hf_nfs_fsstat3_resok_tbytes, {
"tbytes", "nfs.fsstat3_resok.tbytes", FT_UINT32, BASE_DEC,
"tbytes", "nfs.fsstat3_resok.tbytes", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.fsstat3_resok.tbytes", HFILL }},
{ &hf_nfs_fsstat3_resok_fbytes, {
"fbytes", "nfs.fsstat3_resok.fbytes", FT_UINT32, BASE_DEC,
"fbytes", "nfs.fsstat3_resok.fbytes", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.fsstat3_resok.fbytes", HFILL }},
{ &hf_nfs_fsstat3_resok_abytes, {
"abytes", "nfs.fsstat3_resok.abytes", FT_UINT32, BASE_DEC,
"abytes", "nfs.fsstat3_resok.abytes", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.fsstat3_resok.abytes", HFILL }},
{ &hf_nfs_fsstat3_resok_tfiles, {
"tfiles", "nfs.fsstat3_resok.tfiles", FT_UINT32, BASE_DEC,
"tfiles", "nfs.fsstat3_resok.tfiles", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.fsstat3_resok.tfiles", HFILL }},
{ &hf_nfs_fsstat3_resok_ffiles, {
"ffiles", "nfs.fsstat3_resok.ffiles", FT_UINT32, BASE_DEC,
"ffiles", "nfs.fsstat3_resok.ffiles", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.fsstat3_resok.ffiles", HFILL }},
{ &hf_nfs_fsstat3_resok_afiles, {
"afiles", "nfs.fsstat3_resok.afiles", FT_UINT32, BASE_DEC,
"afiles", "nfs.fsstat3_resok.afiles", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.fsstat3_resok.afiles", HFILL }},
/* NFSv4 */
@ -6348,7 +6348,7 @@ proto_register_nfs(void)
NULL, 0, "Tag", HFILL }},
{ &hf_nfs_clientid4, {
"clientid", "nfs.clientid", FT_UINT32, BASE_DEC,
"clientid", "nfs.clientid", FT_UINT64, BASE_DEC,
NULL, 0, "Client ID", HFILL }},
{ &hf_nfs_ace4, {
@ -6504,11 +6504,11 @@ proto_register_nfs(void)
BASE_NONE, &yesno, 0, "nfs.data_follows", HFILL }},
{ &hf_nfs_stateid4, {
"stateid", "nfs.stateid4", FT_UINT32, BASE_DEC,
"stateid", "nfs.stateid4", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.stateid4", HFILL }},
{ &hf_nfs_offset4, {
"offset", "nfs.offset4", FT_UINT32, BASE_DEC,
"offset", "nfs.offset4", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.offset4", HFILL }},
{ &hf_nfs_specdata1, {
@ -6528,15 +6528,15 @@ proto_register_nfs(void)
NULL, 0, "nfs.reclaim4", HFILL }},
{ &hf_nfs_length4, {
"length", "nfs.length4", FT_UINT32, BASE_DEC,
"length", "nfs.length4", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.length4", HFILL }},
{ &hf_nfs_changeid4, {
"changeid", "nfs.changeid4", FT_UINT32, BASE_DEC,
"changeid", "nfs.changeid4", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.changeid4", HFILL }},
{ &hf_nfs_nfstime4_seconds, {
"seconds", "nfs.nfstime4.seconds", FT_UINT32, BASE_DEC,
"seconds", "nfs.nfstime4.seconds", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.nfstime4.seconds", HFILL }},
{ &hf_nfs_nfstime4_nseconds, {
@ -6544,11 +6544,11 @@ proto_register_nfs(void)
NULL, 0, "nfs.nfstime4.nseconds", HFILL }},
{ &hf_nfs_fsid4_major, {
"fsid4.major", "nfs.fsid4.major", FT_UINT32, BASE_DEC,
"fsid4.major", "nfs.fsid4.major", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.nfstime4.fsid4.major", HFILL }},
{ &hf_nfs_fsid4_minor, {
"fsid4.minor", "nfs.fsid4.minor", FT_UINT32, BASE_DEC,
"fsid4.minor", "nfs.fsid4.minor", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.fsid4.minor", HFILL }},
{ &hf_nfs_acetype4, {
@ -6564,7 +6564,7 @@ proto_register_nfs(void)
NULL, 0, "nfs.acemask4", HFILL }},
{ &hf_nfs_fattr4_size, {
"size", "nfs.fattr4.size", FT_UINT32, BASE_DEC,
"size", "nfs.fattr4.size", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.fattr4.size", HFILL }},
{ &hf_nfs_fattr4_lease_time, {
@ -6576,23 +6576,23 @@ proto_register_nfs(void)
NULL, 0, "nfs.fattr4.aclsupport", HFILL }},
{ &hf_nfs_fattr4_fileid, {
"fileid", "nfs.fattr4.fileid", FT_UINT32, BASE_DEC,
"fileid", "nfs.fattr4.fileid", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.fattr4.fileid", HFILL }},
{ &hf_nfs_fattr4_files_avail, {
"files_avail", "nfs.fattr4.files_avail", FT_UINT32, BASE_DEC,
"files_avail", "nfs.fattr4.files_avail", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.fattr4.files_avail", HFILL }},
{ &hf_nfs_fattr4_files_free, {
"files_free", "nfs.fattr4.files_free", FT_UINT32, BASE_DEC,
"files_free", "nfs.fattr4.files_free", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.fattr4.files_free", HFILL }},
{ &hf_nfs_fattr4_files_total, {
"files_total", "nfs.fattr4.files_total", FT_UINT32, BASE_DEC,
"files_total", "nfs.fattr4.files_total", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.fattr4.files_total", HFILL }},
{ &hf_nfs_fattr4_maxfilesize, {
"maxfilesize", "nfs.fattr4.maxfilesize", FT_UINT32, BASE_DEC,
"maxfilesize", "nfs.fattr4.maxfilesize", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.fattr4.maxfilesize", HFILL }},
{ &hf_nfs_fattr4_maxlink, {
@ -6628,55 +6628,55 @@ proto_register_nfs(void)
NULL, 0, "nfs.eof", HFILL }},
{ &hf_nfs_fattr4_maxread, {
"maxread", "nfs.fattr4.maxread", FT_UINT32, BASE_DEC,
"maxread", "nfs.fattr4.maxread", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.fattr4.maxread", HFILL }},
{ &hf_nfs_fattr4_maxwrite, {
"maxwrite", "nfs.fattr4.maxwrite", FT_UINT32, BASE_DEC,
"maxwrite", "nfs.fattr4.maxwrite", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.fattr4.maxwrite", HFILL }},
{ &hf_nfs_fattr4_quota_hard, {
"quota_hard", "nfs.fattr4.quota_hard", FT_UINT32, BASE_DEC,
"quota_hard", "nfs.fattr4.quota_hard", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.fattr4.quota_hard", HFILL }},
{ &hf_nfs_fattr4_quota_soft, {
"quota_soft", "nfs.fattr4.quota_soft", FT_UINT32, BASE_DEC,
"quota_soft", "nfs.fattr4.quota_soft", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.fattr4.quota_soft", HFILL }},
{ &hf_nfs_fattr4_quota_used, {
"quota_used", "nfs.fattr4.quota_used", FT_UINT32, BASE_DEC,
"quota_used", "nfs.fattr4.quota_used", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.fattr4.quota_used", HFILL }},
{ &hf_nfs_fattr4_space_avail, {
"space_avail", "nfs.fattr4.space_avail", FT_UINT32, BASE_DEC,
"space_avail", "nfs.fattr4.space_avail", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.fattr4.space_avail", HFILL }},
{ &hf_nfs_fattr4_space_free, {
"space_free", "nfs.fattr4.space_free", FT_UINT32, BASE_DEC,
"space_free", "nfs.fattr4.space_free", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.fattr4.space_free", HFILL }},
{ &hf_nfs_fattr4_space_total, {
"space_total", "nfs.fattr4.space_total", FT_UINT32, BASE_DEC,
"space_total", "nfs.fattr4.space_total", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.fattr4.space_total", HFILL }},
{ &hf_nfs_fattr4_space_used, {
"space_used", "nfs.fattr4.space_used", FT_UINT32, BASE_DEC,
"space_used", "nfs.fattr4.space_used", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.fattr4.space_used", HFILL }},
{ &hf_nfs_stateid4_delegate_stateid, {
"delegate_stateid", "nfs.delegate_stateid", FT_UINT32, BASE_DEC,
"delegate_stateid", "nfs.delegate_stateid", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.delegate_stateid", HFILL }},
{ &hf_nfs_verifier4, {
"verifier", "nfs.verifier4", FT_UINT32, BASE_DEC,
"verifier", "nfs.verifier4", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.verifier4", HFILL }},
{ &hf_nfs_cookie4, {
"cookie", "nfs.cookie4", FT_UINT32, BASE_DEC,
"cookie", "nfs.cookie4", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.cookie4", HFILL }},
{ &hf_nfs_cookieverf4, {
"cookieverf", "nfs.cookieverf4", FT_UINT32, BASE_DEC,
"cookieverf", "nfs.cookieverf4", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.cookieverf4", HFILL }},
{ &hf_nfs_cb_location, {
@ -6692,7 +6692,7 @@ proto_register_nfs(void)
BASE_NONE, &yesno, 0, "nfs.recall4", HFILL }},
{ &hf_nfs_filesize, {
"filesize", "nfs.filesize", FT_UINT32, BASE_DEC,
"filesize", "nfs.filesize", FT_UINT64, BASE_DEC,
NULL, 0, "nfs.filesize", HFILL }},
{ &hf_nfs_count4, {

View File

@ -1,7 +1,7 @@
/* packet-nlm.c
* Routines for nlm dissection
*
* $Id: packet-nlm.c,v 1.20 2001/09/14 06:48:30 guy Exp $
* $Id: packet-nlm.c,v 1.21 2001/10/29 21:13:08 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -68,7 +68,9 @@ static int hf_nlm_lock_caller_name = -1;
static int hf_nlm_lock_owner = -1;
static int hf_nlm_lock_svid = -1;
static int hf_nlm_lock_l_offset = -1;
static int hf_nlm_lock_l_offset64 = -1;
static int hf_nlm_lock_l_len = -1;
static int hf_nlm_lock_l_len64 = -1;
static int hf_nlm_reclaim = -1;
static int hf_nlm_stat = -1;
static int hf_nlm_state = -1;
@ -172,8 +174,8 @@ dissect_lock(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int version, i
offset = dissect_rpc_uint32(tvb, pinfo, lock_tree, hf_nlm_lock_svid, offset);
if (version == 4) {
offset = dissect_rpc_uint64(tvb, pinfo, lock_tree, hf_nlm_lock_l_offset, offset);
offset = dissect_rpc_uint64(tvb, pinfo, lock_tree, hf_nlm_lock_l_len, offset);
offset = dissect_rpc_uint64(tvb, pinfo, lock_tree, hf_nlm_lock_l_offset64, offset);
offset = dissect_rpc_uint64(tvb, pinfo, lock_tree, hf_nlm_lock_l_len64, offset);
}
else {
offset = dissect_rpc_uint32(tvb, pinfo, lock_tree, hf_nlm_lock_l_offset, offset);
@ -285,9 +287,9 @@ dissect_nlm_test_res(tvbuff_t *tvb, int offset, packet_info *pinfo,
if (version == 4) {
offset = dissect_rpc_uint64(tvb, pinfo, lock_tree,
hf_nlm_lock_l_offset, offset);
hf_nlm_lock_l_offset64, offset);
offset = dissect_rpc_uint64(tvb, pinfo, lock_tree,
hf_nlm_lock_l_len, offset);
hf_nlm_lock_l_len64, offset);
}
else {
offset = dissect_rpc_uint32(tvb, pinfo, lock_tree,
@ -708,9 +710,15 @@ proto_register_nlm(void)
{ &hf_nlm_lock_svid, {
"svid", "nlm.lock.svid", FT_UINT32, BASE_DEC,
NULL, 0, "svid", HFILL }},
{ &hf_nlm_lock_l_offset64, {
"l_offset", "nlm.lock.l_offset", FT_UINT64, BASE_DEC,
NULL, 0, "l_offset", HFILL }},
{ &hf_nlm_lock_l_offset, {
"l_offset", "nlm.lock.l_offset", FT_UINT32, BASE_DEC,
NULL, 0, "l_offset", HFILL }},
{ &hf_nlm_lock_l_len64, {
"l_len", "nlm.lock.l_len", FT_UINT64, BASE_DEC,
NULL, 0, "l_len", HFILL }},
{ &hf_nlm_lock_l_len, {
"l_len", "nlm.lock.l_len", FT_UINT32, BASE_DEC,
NULL, 0, "l_len", HFILL }},

View File

@ -2,7 +2,7 @@
* Routines for rpc dissection
* Copyright 1999, Uwe Girlich <Uwe.Girlich@philosys.de>
*
* $Id: packet-rpc.c,v 1.73 2001/10/29 20:49:28 guy Exp $
* $Id: packet-rpc.c,v 1.74 2001/10/29 21:13:08 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -456,19 +456,12 @@ int
dissect_rpc_uint64(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
int hfindex, int offset)
{
guint32 value_low;
guint32 value_high;
header_field_info *hfinfo;
value_high = tvb_get_ntohl(tvb, offset + 0);
value_low = tvb_get_ntohl(tvb, offset + 4);
if (tree) {
if (value_high)
proto_tree_add_text(tree, tvb, offset, 8,
"%s: 0x%x%08x", proto_registrar_get_name(hfindex), value_high, value_low);
else
proto_tree_add_uint(tree, hfindex, tvb, offset, 8, value_low);
}
hfinfo = proto_registrar_get_nth(hfindex);
g_assert(hfinfo->type == FT_UINT64);
if (tree)
proto_tree_add_item(tree, hfindex, tvb, offset, 8, FALSE);
return offset + 8;
}