Make the resolution for time values be nanoseconds rather than

microseconds.

Fix some "signed vs. unsigned" comparison warnings.

svn path=/trunk/; revision=3934
This commit is contained in:
Guy Harris 2001-09-14 07:10:13 +00:00
parent e32028f6cd
commit 1d42c94b05
25 changed files with 263 additions and 241 deletions

View File

@ -1,4 +1,4 @@
$Id: README.developer,v 1.35 2001/08/31 09:04:36 guy Exp $ $Id: README.developer,v 1.36 2001/09/14 07:10:09 guy Exp $
This file is a HOWTO for Ethereal developers. It describes how to start coding This file is a HOWTO for Ethereal developers. It describes how to start coding
a Ethereal protocol dissector and the use some of the important functions and a Ethereal protocol dissector and the use some of the important functions and
@ -85,7 +85,7 @@ code inside
is needed only if you are using the "snprintf()" function. is needed only if you are using the "snprintf()" function.
The "$Id: README.developer,v 1.35 2001/08/31 09:04:36 guy Exp $" The "$Id: README.developer,v 1.36 2001/09/14 07:10:09 guy Exp $"
in the comment will be updated by CVS when the file is in the comment will be updated by CVS when the file is
checked in; it will allow the RCS "ident" command to report which checked in; it will allow the RCS "ident" command to report which
version of the file is currently checked out. version of the file is currently checked out.
@ -95,7 +95,7 @@ version of the file is currently checked out.
* Routines for PROTONAME dissection * Routines for PROTONAME dissection
* Copyright 2000, YOUR_NAME <YOUR_EMAIL_ADDRESS> * Copyright 2000, YOUR_NAME <YOUR_EMAIL_ADDRESS>
* *
* $Id: README.developer,v 1.35 2001/08/31 09:04:36 guy Exp $ * $Id: README.developer,v 1.36 2001/09/14 07:10:09 guy Exp $
* *
* Ethereal - Network traffic analyzer * Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com> * By Gerald Combs <gerald@ethereal.com>
@ -1091,9 +1091,14 @@ the protocol tree when the dissector routines wants complete control
over how the field and value will be represented on the GUI tree. over how the field and value will be represented on the GUI tree.
For "proto_tree_add_time_format", the "value_ptr" argument is a pointer For "proto_tree_add_time_format", the "value_ptr" argument is a pointer
to a "struct timeval" containing the time to be added; for those other to an "nstime_t", which is a structure containing the time to be added;
functions that take a "value_ptr" argument, that argument is a pointer it has "secs" and "nsecs" members, giving the integral part and the
to the first byte of the value to be added. fractional part of a time in seconds, with "nsecs" being the number of
nanoseconds. For absolute times, "secs" is a UNIX-style seconds since
January 1, 1970, 00:00:00 GMT value.
For the other functions that take a "value_ptr" argument, that argument
is a pointer to the first byte of the value to be added.
For the other functions, the "value" argument is a 32-bit integral value For the other functions, the "value" argument is a 32-bit integral value
to be added. to be added.

View File

@ -1,7 +1,7 @@
/* column-utils.c /* column-utils.c
* Routines for column utilities. * Routines for column utilities.
* *
* $Id: column-utils.c,v 1.4 2001/07/15 19:14:02 guy Exp $ * $Id: column-utils.c,v 1.5 2001/09/14 07:10:10 guy Exp $
* *
* Ethereal - Network traffic analyzer * Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org> * By Gerald Combs <gerald@zing.org>
@ -268,7 +268,7 @@ static void
col_set_rel_time(frame_data *fd, int col) col_set_rel_time(frame_data *fd, int col)
{ {
display_signed_time(fd->cinfo->col_buf[col], COL_MAX_LEN, display_signed_time(fd->cinfo->col_buf[col], COL_MAX_LEN,
fd->rel_secs, fd->rel_usecs); fd->rel_secs, fd->rel_usecs, USECS);
fd->cinfo->col_data[col] = fd->cinfo->col_buf[col]; fd->cinfo->col_data[col] = fd->cinfo->col_buf[col];
} }
@ -276,7 +276,7 @@ static void
col_set_delta_time(frame_data *fd, int col) col_set_delta_time(frame_data *fd, int col)
{ {
display_signed_time(fd->cinfo->col_buf[col], COL_MAX_LEN, display_signed_time(fd->cinfo->col_buf[col], COL_MAX_LEN,
fd->del_secs, fd->del_usecs); fd->del_secs, fd->del_usecs, USECS);
fd->cinfo->col_data[col] = fd->cinfo->col_buf[col]; fd->cinfo->col_data[col] = fd->cinfo->col_buf[col];
} }

View File

@ -1,5 +1,5 @@
/* /*
* $Id: ftype-time.c,v 1.10 2001/07/13 00:55:56 guy Exp $ * $Id: ftype-time.c,v 1.11 2001/09/14 07:10:13 guy Exp $
* *
* Ethereal - Network traffic analyzer * Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com> * By Gerald Combs <gerald@ethereal.com>
@ -46,62 +46,62 @@
static gboolean static gboolean
cmp_eq(fvalue_t *a, fvalue_t *b) cmp_eq(fvalue_t *a, fvalue_t *b)
{ {
return ((a->value.time.tv_sec) ==(b->value.time.tv_sec)) return ((a->value.time.secs) ==(b->value.time.secs))
&&((a->value.time.tv_usec)==(b->value.time.tv_usec)); &&((a->value.time.nsecs)==(b->value.time.nsecs));
} }
static gboolean static gboolean
cmp_ne(fvalue_t *a, fvalue_t *b) cmp_ne(fvalue_t *a, fvalue_t *b)
{ {
return (a->value.time.tv_sec !=b->value.time.tv_sec) return (a->value.time.secs !=b->value.time.secs)
||(a->value.time.tv_usec!=b->value.time.tv_usec); ||(a->value.time.nsecs!=b->value.time.nsecs);
} }
static gboolean static gboolean
cmp_gt(fvalue_t *a, fvalue_t *b) cmp_gt(fvalue_t *a, fvalue_t *b)
{ {
if (a->value.time.tv_sec > b->value.time.tv_sec) { if (a->value.time.secs > b->value.time.secs) {
return TRUE; return TRUE;
} }
if (a->value.time.tv_sec < b->value.time.tv_sec) { if (a->value.time.secs < b->value.time.secs) {
return FALSE; return FALSE;
} }
return a->value.time.tv_usec > b->value.time.tv_usec; return a->value.time.nsecs > b->value.time.nsecs;
} }
static gboolean static gboolean
cmp_ge(fvalue_t *a, fvalue_t *b) cmp_ge(fvalue_t *a, fvalue_t *b)
{ {
if (a->value.time.tv_sec > b->value.time.tv_sec) { if (a->value.time.secs > b->value.time.secs) {
return TRUE; return TRUE;
} }
if (a->value.time.tv_sec < b->value.time.tv_sec) { if (a->value.time.secs < b->value.time.secs) {
return FALSE; return FALSE;
} }
return a->value.time.tv_usec >= b->value.time.tv_usec; return a->value.time.nsecs >= b->value.time.nsecs;
} }
static gboolean static gboolean
cmp_lt(fvalue_t *a, fvalue_t *b) cmp_lt(fvalue_t *a, fvalue_t *b)
{ {
if (a->value.time.tv_sec < b->value.time.tv_sec) { if (a->value.time.secs < b->value.time.secs) {
return TRUE; return TRUE;
} }
if (a->value.time.tv_sec > b->value.time.tv_sec) { if (a->value.time.secs > b->value.time.secs) {
return FALSE; return FALSE;
} }
return a->value.time.tv_usec < b->value.time.tv_usec; return a->value.time.nsecs < b->value.time.nsecs;
} }
static gboolean static gboolean
cmp_le(fvalue_t *a, fvalue_t *b) cmp_le(fvalue_t *a, fvalue_t *b)
{ {
if (a->value.time.tv_sec < b->value.time.tv_sec) { if (a->value.time.secs < b->value.time.secs) {
return TRUE; return TRUE;
} }
if (a->value.time.tv_sec > b->value.time.tv_sec) { if (a->value.time.secs > b->value.time.secs) {
return FALSE; return FALSE;
} }
return a->value.time.tv_usec <= b->value.time.tv_usec; return a->value.time.nsecs <= b->value.time.nsecs;
} }
@ -120,7 +120,7 @@ relative_val_from_string(fvalue_t *fv, char *s, LogFunc log)
/* /*
* Get the seconds value. * Get the seconds value.
*/ */
fv->value.time.tv_sec = strtoul(curptr, &endptr, 10); fv->value.time.secs = strtoul(curptr, &endptr, 10);
if (endptr == curptr || (*endptr != '\0' && *endptr != '.')) if (endptr == curptr || (*endptr != '\0' && *endptr != '.'))
goto fail; goto fail;
curptr = endptr; curptr = endptr;
@ -130,26 +130,26 @@ relative_val_from_string(fvalue_t *fv, char *s, LogFunc log)
/* /*
* No seconds value - it's 0. * No seconds value - it's 0.
*/ */
fv->value.time.tv_sec = 0; fv->value.time.secs = 0;
curptr++; /* skip the decimal point */ curptr++; /* skip the decimal point */
} }
/* /*
* If there's more stuff left in the string, it should be the * If there's more stuff left in the string, it should be the
* microseconds value. * nanoseconds value.
*/ */
if (*endptr != '\0') { if (*endptr != '\0') {
/* /*
* Get the microseconds value. * Get the nanoseconds value.
*/ */
fv->value.time.tv_usec = strtoul(curptr, &endptr, 10); fv->value.time.nsecs = strtoul(curptr, &endptr, 10);
if (endptr == curptr || *endptr != '\0') if (endptr == curptr || *endptr != '\0')
goto fail; goto fail;
} else { } else {
/* /*
* No microseconds value - it's 0. * No nanoseconds value - it's 0.
*/ */
fv->value.time.tv_usec = 0; fv->value.time.nsecs = 0;
} }
/* /*
@ -174,28 +174,28 @@ absolute_val_from_string(fvalue_t *fv, char *s, LogFunc log)
if (curptr == NULL) if (curptr == NULL)
goto fail; goto fail;
tm.tm_isdst = -1; /* let the computer figure out if it's DST */ tm.tm_isdst = -1; /* let the computer figure out if it's DST */
fv->value.time.tv_sec = mktime(&tm); fv->value.time.secs = mktime(&tm);
if (*curptr != '\0') { if (*curptr != '\0') {
/* /*
* Something came after the seconds field; it must be * Something came after the seconds field; it must be
* a microseconds field. * a nanoseconds field.
*/ */
if (*curptr != '.') if (*curptr != '.')
goto fail; /* it's not */ goto fail; /* it's not */
curptr++; /* skip the "." */ curptr++; /* skip the "." */
if (!isdigit((unsigned char)*curptr)) if (!isdigit((unsigned char)*curptr))
goto fail; /* not a digit, so not valid */ goto fail; /* not a digit, so not valid */
fv->value.time.tv_usec = strtoul(curptr, &endptr, 10); fv->value.time.nsecs = strtoul(curptr, &endptr, 10);
if (endptr == curptr || *endptr != '\0') if (endptr == curptr || *endptr != '\0')
goto fail; goto fail;
} else { } else {
/* /*
* No microseconds value - it's 0. * No nanoseconds value - it's 0.
*/ */
fv->value.time.tv_usec = 0; fv->value.time.nsecs = 0;
} }
if (fv->value.time.tv_sec == -1) { if (fv->value.time.secs == -1) {
/* /*
* XXX - should we supply an error message that mentions * XXX - should we supply an error message that mentions
* that the time specified might be syntactically valid * that the time specified might be syntactically valid
@ -221,15 +221,15 @@ fail:
static void static void
time_fvalue_new(fvalue_t *fv) time_fvalue_new(fvalue_t *fv)
{ {
fv->value.time.tv_sec = 0; fv->value.time.secs = 0;
fv->value.time.tv_usec = 0; fv->value.time.nsecs = 0;
} }
static void static void
time_fvalue_set(fvalue_t *fv, gpointer value, gboolean already_copied) time_fvalue_set(fvalue_t *fv, gpointer value, gboolean already_copied)
{ {
g_assert(!already_copied); g_assert(!already_copied);
memcpy(&(fv->value.time), value, sizeof(struct timeval)); memcpy(&(fv->value.time), value, sizeof(nstime_t));
} }
static gpointer static gpointer

View File

@ -1,7 +1,7 @@
/* ftypes.h /* ftypes.h
* Definitions for field types * Definitions for field types
* *
* $Id: ftypes.h,v 1.3 2001/08/12 11:46:23 sharpe Exp $ * $Id: ftypes.h,v 1.4 2001/09/14 07:10:13 guy Exp $
* *
* Ethereal - Network traffic analyzer * Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org> * By Gerald Combs <gerald@zing.org>
@ -122,6 +122,7 @@ ftype_can_le(enum ftenum ftype);
#endif #endif
#include "tvbuff.h" #include "tvbuff.h"
#include "nstime.h"
#include "dfilter/drange.h" #include "dfilter/drange.h"
typedef struct { typedef struct {
@ -135,7 +136,7 @@ typedef struct {
GByteArray *bytes; GByteArray *bytes;
ipv4_addr ipv4; ipv4_addr ipv4;
guint8 ipv6[16]; guint8 ipv6[16];
struct timeval time; nstime_t time;
tvbuff_t *tvb; tvbuff_t *tvb;
} value; } value;
} fvalue_t; } fvalue_t;

View File

@ -1,7 +1,7 @@
/* proto.c /* proto.c
* Routines for protocol tree * Routines for protocol tree
* *
* $Id: proto.c,v 1.34 2001/08/29 00:51:08 guy Exp $ * $Id: proto.c,v 1.35 2001/09/14 07:10:10 guy Exp $
* *
* Ethereal - Network traffic analyzer * Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com> * By Gerald Combs <gerald@ethereal.com>
@ -85,7 +85,7 @@ proto_tree_set_bytes(field_info *fi, const guint8* start_ptr, gint length);
static void static void
proto_tree_set_bytes_tvb(field_info *fi, tvbuff_t *tvb, gint offset, gint length); proto_tree_set_bytes_tvb(field_info *fi, tvbuff_t *tvb, gint offset, gint length);
static void static void
proto_tree_set_time(field_info *fi, struct timeval *value_ptr); proto_tree_set_time(field_info *fi, nstime_t *value_ptr);
static void static void
proto_tree_set_string(field_info *fi, const char* value); proto_tree_set_string(field_info *fi, const char* value);
static void static void
@ -725,7 +725,7 @@ proto_tree_set_bytes_tvb(field_info *fi, tvbuff_t *tvb, gint offset, gint length
/* Add a FT_*TIME to a proto_tree */ /* Add a FT_*TIME to a proto_tree */
proto_item * proto_item *
proto_tree_add_time(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gint length, proto_tree_add_time(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gint length,
struct timeval *value_ptr) nstime_t *value_ptr)
{ {
proto_item *pi; proto_item *pi;
field_info *new_fi; field_info *new_fi;
@ -746,7 +746,7 @@ proto_tree_add_time(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gi
proto_item * proto_item *
proto_tree_add_time_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gint length, proto_tree_add_time_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gint length,
struct timeval *value_ptr) nstime_t *value_ptr)
{ {
proto_item *pi; proto_item *pi;
field_info *fi; field_info *fi;
@ -763,7 +763,7 @@ proto_tree_add_time_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint st
proto_item * proto_item *
proto_tree_add_time_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gint length, proto_tree_add_time_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gint length,
struct timeval *value_ptr, const char *format, ...) nstime_t *value_ptr, const char *format, ...)
{ {
proto_item *pi; proto_item *pi;
va_list ap; va_list ap;
@ -781,7 +781,7 @@ proto_tree_add_time_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint st
/* Set the FT_*TIME value */ /* Set the FT_*TIME value */
static void static void
proto_tree_set_time(field_info *fi, struct timeval *value_ptr) proto_tree_set_time(field_info *fi, nstime_t *value_ptr)
{ {
fvalue_set(fi->value, value_ptr, FALSE); fvalue_set(fi->value, value_ptr, FALSE);
} }
@ -2980,7 +2980,7 @@ proto_alloc_dfilter_string(field_info *finfo, guint8 *pd)
case FT_ABSOLUTE_TIME: case FT_ABSOLUTE_TIME:
value_str = value_str =
abs_time_to_str((struct timeval *)fvalue_get(finfo->value)); abs_time_to_str((nstime_t *)fvalue_get(finfo->value));
dfilter_len = abbrev_len + strlen(value_str) + 7; dfilter_len = abbrev_len + strlen(value_str) + 7;
buf = g_malloc0(dfilter_len); buf = g_malloc0(dfilter_len);
snprintf(buf, dfilter_len, "%s == \"%s\"", snprintf(buf, dfilter_len, "%s == \"%s\"",
@ -2989,7 +2989,7 @@ proto_alloc_dfilter_string(field_info *finfo, guint8 *pd)
case FT_RELATIVE_TIME: case FT_RELATIVE_TIME:
value_str = value_str =
rel_time_to_secs_str((struct timeval *)fvalue_get(finfo->value)); rel_time_to_secs_str((nstime_t *)fvalue_get(finfo->value));
dfilter_len = abbrev_len + strlen(value_str) + 4; dfilter_len = abbrev_len + strlen(value_str) + 4;
buf = g_malloc0(dfilter_len); buf = g_malloc0(dfilter_len);
snprintf(buf, dfilter_len, "%s == %s", snprintf(buf, dfilter_len, "%s == %s",

View File

@ -1,7 +1,7 @@
/* proto.h /* proto.h
* Definitions for protocol display * Definitions for protocol display
* *
* $Id: proto.h,v 1.16 2001/08/29 00:51:08 guy Exp $ * $Id: proto.h,v 1.17 2001/09/14 07:10:10 guy Exp $
* *
* Ethereal - Network traffic analyzer * Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com> * By Gerald Combs <gerald@ethereal.com>
@ -26,10 +26,6 @@
#ifndef __PROTO_H__ #ifndef __PROTO_H__
#define __PROTO_H__ #define __PROTO_H__
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#ifdef HAVE_STDARG_H #ifdef HAVE_STDARG_H
# include <stdarg.h> # include <stdarg.h>
#else #else
@ -41,6 +37,7 @@
#endif #endif
#include "ipv4.h" #include "ipv4.h"
#include "nstime.h"
#include "tvbuff.h" #include "tvbuff.h"
#include "ftypes/ftypes.h" #include "ftypes/ftypes.h"
@ -241,21 +238,21 @@ proto_tree_add_bytes_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint s
/* Add a FT_*TIME to a proto_tree */ /* Add a FT_*TIME to a proto_tree */
proto_item * proto_item *
proto_tree_add_time(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, proto_tree_add_time(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, struct timeval* value_ptr); gint length, nstime_t* value_ptr);
proto_item * proto_item *
proto_tree_add_time_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, proto_tree_add_time_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, struct timeval* value_ptr); gint length, nstime_t* value_ptr);
#if __GNUC__ >= 2 #if __GNUC__ >= 2
proto_item * proto_item *
proto_tree_add_time_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, proto_tree_add_time_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, struct timeval* value_ptr, const char *format, ...) gint length, nstime_t* value_ptr, const char *format, ...)
__attribute__((format (printf, 7, 8))); __attribute__((format (printf, 7, 8)));
#else #else
proto_item * proto_item *
proto_tree_add_time_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, proto_tree_add_time_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, struct timeval* value_ptr, const char *format, ...); gint length, nstime_t* value_ptr, const char *format, ...);
#endif #endif
/* Add a FT_IPXNET to a proto_tree */ /* Add a FT_IPXNET to a proto_tree */

View File

@ -1,7 +1,7 @@
/* to_str.c /* to_str.c
* Routines for utilities to convert various other types to strings. * Routines for utilities to convert various other types to strings.
* *
* $Id: to_str.c,v 1.11 2001/08/01 08:27:00 guy Exp $ * $Id: to_str.c,v 1.12 2001/09/14 07:10:10 guy Exp $
* *
* Ethereal - Network traffic analyzer * Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com> * By Gerald Combs <gerald@ethereal.com>
@ -38,7 +38,7 @@
#endif #endif
#ifdef HAVE_WINSOCK_H #ifdef HAVE_WINSOCK_H
# include <winsock.h> /* for "struct timeval" and "u_char" */ # include <winsock.h> /* for "u_char" */
#endif #endif
#ifdef NEED_SNPRINTF_H #ifdef NEED_SNPRINTF_H
@ -277,11 +277,11 @@ vines_addr_to_str(const guint8 *addrp)
* Convert a value in seconds and fractions of a second to a string, * Convert a value in seconds and fractions of a second to a string,
* giving time in days, hours, minutes, and seconds, and put the result * giving time in days, hours, minutes, and seconds, and put the result
* into a buffer. * into a buffer.
* "is_usecs" says that "frac" is microseconds if true and milliseconds * "is_nsecs" says that "frac" is microseconds if true and milliseconds
* if false. * if false.
*/ */
static void static void
time_secs_to_str_buf(guint32 time, guint32 frac, gboolean is_usecs, time_secs_to_str_buf(guint32 time, guint32 frac, gboolean is_nsecs,
gchar *buf) gchar *buf)
{ {
static gchar *p; static gchar *p;
@ -316,8 +316,8 @@ time_secs_to_str_buf(guint32 time, guint32 frac, gboolean is_usecs,
do_comma = 0; do_comma = 0;
if (secs != 0 || frac != 0) { if (secs != 0 || frac != 0) {
if (frac != 0) { if (frac != 0) {
if (is_usecs) if (is_nsecs)
sprintf(p, "%s%u.%06u seconds", COMMA(do_comma), secs, frac); sprintf(p, "%s%u.%09u seconds", COMMA(do_comma), secs, frac);
else else
sprintf(p, "%s%u.%03u seconds", COMMA(do_comma), secs, frac); sprintf(p, "%s%u.%03u seconds", COMMA(do_comma), secs, frac);
} else } else
@ -391,7 +391,7 @@ static const char *mon_names[12] = {
}; };
gchar * gchar *
abs_time_to_str(struct timeval *abs_time) abs_time_to_str(nstime_t *abs_time)
{ {
struct tm *tmp; struct tm *tmp;
static gchar *cur; static gchar *cur;
@ -405,16 +405,16 @@ abs_time_to_str(struct timeval *abs_time)
cur = &str[0][0]; cur = &str[0][0];
} }
tmp = localtime(&abs_time->tv_sec); tmp = localtime(&abs_time->secs);
if (tmp) { if (tmp) {
sprintf(cur, "%s %2d, %d %02d:%02d:%02d.%06ld", sprintf(cur, "%s %2d, %d %02d:%02d:%02d.%09ld",
mon_names[tmp->tm_mon], mon_names[tmp->tm_mon],
tmp->tm_mday, tmp->tm_mday,
tmp->tm_year + 1900, tmp->tm_year + 1900,
tmp->tm_hour, tmp->tm_hour,
tmp->tm_min, tmp->tm_min,
tmp->tm_sec, tmp->tm_sec,
(long)abs_time->tv_usec); (long)abs_time->nsecs);
} else { } else {
strncpy(cur, "Not representable", sizeof(str[0])); strncpy(cur, "Not representable", sizeof(str[0]));
} }
@ -422,35 +422,49 @@ abs_time_to_str(struct timeval *abs_time)
} }
void void
display_signed_time(gchar *buf, int buflen, gint32 sec, gint32 usec) display_signed_time(gchar *buf, int buflen, gint32 sec, gint32 frac,
time_res_t units)
{ {
char *sign; char *sign;
/* If the microseconds part of the time stamp is negative, /* If the fractional part of the time stamp is negative,
print its absolute value and, if the seconds part isn't print its absolute value and, if the seconds part isn't
(the seconds part should be zero in that case), stick (the seconds part should be zero in that case), stick
a "-" in front of the entire time stamp. */ a "-" in front of the entire time stamp. */
sign = ""; sign = "";
if (usec < 0) { if (frac < 0) {
usec = -usec; frac = -frac;
if (sec >= 0) if (sec >= 0)
sign = "-"; sign = "-";
} }
snprintf(buf, buflen, "%s%d.%06d", sign, sec, usec); switch (units) {
case MSECS:
snprintf(buf, buflen, "%s%d.%03d", sign, sec, frac);
break;
case USECS:
snprintf(buf, buflen, "%s%d.%06d", sign, sec, frac);
break;
case NSECS:
snprintf(buf, buflen, "%s%d.%09d", sign, sec, frac);
break;
}
} }
/* /*
* Display a relative time as days/hours/minutes/seconds. * Display a relative time as days/hours/minutes/seconds.
*/ */
gchar * gchar *
rel_time_to_str(struct timeval *rel_time) rel_time_to_str(nstime_t *rel_time)
{ {
static gchar *cur; static gchar *cur;
static char str[3][1+TIME_SECS_LEN+1+6+1]; static char str[3][1+TIME_SECS_LEN+1+6+1];
char *p; char *p;
char *sign; char *sign;
guint32 time; guint32 time;
gint32 usec; gint32 nsec;
if (cur == &str[0][0]) { if (cur == &str[0][0]) {
cur = &str[1][0]; cur = &str[1][0];
@ -461,40 +475,40 @@ rel_time_to_str(struct timeval *rel_time)
} }
p = cur; p = cur;
/* If the microseconds part of the time stamp is negative, /* If the nanoseconds part of the time stamp is negative,
print its absolute value and, if the seconds part isn't print its absolute value and, if the seconds part isn't
(the seconds part should be zero in that case), stick (the seconds part should be zero in that case), stick
a "-" in front of the entire time stamp. */ a "-" in front of the entire time stamp. */
sign = ""; sign = "";
time = rel_time->tv_sec; time = rel_time->secs;
usec = rel_time->tv_usec; nsec = rel_time->nsecs;
if (time == 0 && usec == 0) { if (time == 0 && nsec == 0) {
sprintf(cur, "0.000000 seconds"); sprintf(cur, "0.000000000 seconds");
return cur; return cur;
} }
if (usec < 0) { if (nsec < 0) {
usec = -usec; nsec = -nsec;
*p++ = '-'; *p++ = '-';
/* /*
* We assume here that "rel_time->tv_sec" is negative * We assume here that "rel_time->secs" is negative
* or zero; if it's not, the time stamp is bogus, * or zero; if it's not, the time stamp is bogus,
* with a positive seconds and negative microseconds. * with a positive seconds and negative microseconds.
*/ */
time = -rel_time->tv_sec; time = -rel_time->secs;
} }
time_secs_to_str_buf(time, usec, TRUE, p); time_secs_to_str_buf(time, nsec, TRUE, p);
return cur; return cur;
} }
#define REL_TIME_SECS_LEN (1+10+1+6+1) #define REL_TIME_SECS_LEN (1+10+1+9+1)
/* /*
* Display a relative time as seconds. * Display a relative time as seconds.
*/ */
gchar * gchar *
rel_time_to_secs_str(struct timeval *rel_time) rel_time_to_secs_str(nstime_t *rel_time)
{ {
static gchar *cur; static gchar *cur;
static char str[3][REL_TIME_SECS_LEN]; static char str[3][REL_TIME_SECS_LEN];
@ -507,8 +521,8 @@ rel_time_to_secs_str(struct timeval *rel_time)
cur = &str[0][0]; cur = &str[0][0];
} }
display_signed_time(cur, REL_TIME_SECS_LEN, rel_time->tv_sec, display_signed_time(cur, REL_TIME_SECS_LEN, rel_time->secs,
rel_time->tv_usec); rel_time->nsecs, NSECS);
return cur; return cur;
} }

View File

@ -1,7 +1,7 @@
/* to_str.h /* to_str.h
* Definitions for utilities to convert various other types to strings. * Definitions for utilities to convert various other types to strings.
* *
* $Id: to_str.h,v 1.4 2001/08/01 08:27:00 guy Exp $ * $Id: to_str.h,v 1.5 2001/09/14 07:10:10 guy Exp $
* *
* Ethereal - Network traffic analyzer * Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com> * By Gerald Combs <gerald@ethereal.com>
@ -25,7 +25,7 @@
#ifndef __TO_STR_H__ #ifndef __TO_STR_H__
#define __TO_STR_H__ #define __TO_STR_H__
#include "glib.h" #include <glib.h>
#ifdef HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
# include <sys/types.h> # include <sys/types.h>
@ -35,6 +35,17 @@
# include <netinet/in.h> # include <netinet/in.h>
#endif #endif
#include "nstime.h"
/*
* Resolution of a time stamp.
*/
typedef enum {
MSECS, /* milliseconds */
USECS, /* microseconds */
NSECS /* nanoseconds */
} time_res_t;
/* /*
* These are utility functions which convert various types to strings, * These are utility functions which convert various types to strings,
* but for which no more specific module applies. * but for which no more specific module applies.
@ -52,10 +63,10 @@ gchar* ipxnet_to_str_punct(const guint32 ad, char punct);
gchar* vines_addr_to_str(const guint8 *addrp); gchar* vines_addr_to_str(const guint8 *addrp);
gchar* time_secs_to_str(guint32); gchar* time_secs_to_str(guint32);
gchar* time_msecs_to_str(guint32); gchar* time_msecs_to_str(guint32);
gchar* abs_time_to_str(struct timeval*); gchar* abs_time_to_str(nstime_t*);
void display_signed_time(gchar *, int, gint32, gint32); void display_signed_time(gchar *, int, gint32, gint32, time_res_t);
gchar* rel_time_to_str(struct timeval*); gchar* rel_time_to_str(nstime_t*);
gchar* rel_time_to_secs_str(struct timeval*); gchar* rel_time_to_secs_str(nstime_t*);
char * decode_bitfield_value(char *buf, guint32 val, guint32 mask, int width); char * decode_bitfield_value(char *buf, guint32 val, guint32 mask, int width);

View File

@ -8,7 +8,7 @@
* Portions based on information/specs retrieved from the OpenAFS sources at * Portions based on information/specs retrieved from the OpenAFS sources at
* www.openafs.org, Copyright IBM. * www.openafs.org, Copyright IBM.
* *
* $Id: packet-afs-macros.h,v 1.11 2001/07/16 05:16:57 guy Exp $ * $Id: packet-afs-macros.h,v 1.12 2001/09/14 07:10:05 guy Exp $
* *
* Ethereal - Network traffic analyzer * Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com> * By Gerald Combs <gerald@ethereal.com>
@ -66,21 +66,22 @@
tvb_get_letohl(tvb, offset));\ tvb_get_letohl(tvb, offset));\
offset += 4; offset += 4;
/* Output a UNIX seconds/microseconds timestamp, after converting to a timeval */ /* Output a UNIX seconds/microseconds timestamp, after converting to an
nstime_t */
#define OUT_TIMESTAMP(field) \ #define OUT_TIMESTAMP(field) \
{ struct timeval tv; \ { nstime_t ts; \
tv.tv_sec = tvb_get_ntohl(tvb, offset); \ ts.secs = tvb_get_ntohl(tvb, offset); \
tv.tv_usec = tvb_get_ntohl(tvb, offset); \ ts.nsecs = tvb_get_ntohl(tvb, offset)*1000; \
proto_tree_add_time(tree,field, tvb,offset,2*sizeof(guint32),&tv); \ proto_tree_add_time(tree,field, tvb,offset,2*sizeof(guint32),&ts); \
offset += 8; \ offset += 8; \
} }
/* Output a UNIX seconds-only timestamp, after converting to a timeval */ /* Output a UNIX seconds-only timestamp, after converting to an nstime_t */
#define OUT_DATE(field) \ #define OUT_DATE(field) \
{ struct timeval tv; \ { nstime_t ts; \
tv.tv_sec = tvb_get_ntohl(tvb, offset); \ ts.secs = tvb_get_ntohl(tvb, offset); \
tv.tv_usec = 0; \ ts.nsecs = 0; \
proto_tree_add_time(tree,field, tvb,offset,sizeof(guint32),&tv); \ proto_tree_add_time(tree,field, tvb,offset,sizeof(guint32),&ts); \
offset += 4; \ offset += 4; \
} }
@ -466,20 +467,20 @@
#define OUT_UBIKVERSION(label) \ #define OUT_UBIKVERSION(label) \
{ proto_tree *save, *ti; \ { proto_tree *save, *ti; \
unsigned int epoch,counter; \ unsigned int epoch,counter; \
struct timeval tv; \ nstime_t ts; \
epoch = tvb_get_ntohl(tvb, offset); \ epoch = tvb_get_ntohl(tvb, offset); \
offset += 4; \ offset += 4; \
counter = tvb_get_ntohl(tvb, offset); \ counter = tvb_get_ntohl(tvb, offset); \
offset += 4; \ offset += 4; \
tv.tv_sec = epoch; \ ts.secs = epoch; \
tv.tv_usec = 0; \ ts.nsecs = 0; \
ti = proto_tree_add_text(tree, tvb, offset-8, 8, \ ti = proto_tree_add_text(tree, tvb, offset-8, 8, \
"UBIK Version (%s): %u.%u", label, epoch, counter ); \ "UBIK Version (%s): %u.%u", label, epoch, counter ); \
save = tree; \ save = tree; \
tree = proto_item_add_subtree(ti, ett_afs_ubikver); \ tree = proto_item_add_subtree(ti, ett_afs_ubikver); \
if ( epoch != 0 ) \ if ( epoch != 0 ) \
proto_tree_add_time(tree,hf_afs_ubik_version_epoch, tvb,offset-8, \ proto_tree_add_time(tree,hf_afs_ubik_version_epoch, tvb,offset-8, \
sizeof(guint32),&tv); \ sizeof(guint32),&ts); \
else \ else \
proto_tree_add_text(tree, tvb, offset-8, \ proto_tree_add_text(tree, tvb, offset-8, \
sizeof(guint32),"Epoch: 0"); \ sizeof(guint32),"Epoch: 0"); \

View File

@ -1,7 +1,7 @@
/* packet-dns.c /* packet-dns.c
* Routines for DNS packet disassembly * Routines for DNS packet disassembly
* *
* $Id: packet-dns.c,v 1.72 2001/08/29 00:51:06 guy Exp $ * $Id: packet-dns.c,v 1.73 2001/09/14 07:10:05 guy Exp $
* *
* Ethereal - Network traffic analyzer * Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com> * By Gerald Combs <gerald@ethereal.com>
@ -1071,7 +1071,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset,
{ {
int rr_len = data_len; int rr_len = data_len;
guint16 type_covered; guint16 type_covered;
struct timeval unixtime; nstime_t nstime;
char signer_name[MAXDNAME]; char signer_name[MAXDNAME];
int signer_name_len; int signer_name_len;
@ -1099,17 +1099,17 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset,
cur_offset += 4; cur_offset += 4;
rr_len -= 4; rr_len -= 4;
unixtime.tv_sec = tvb_get_ntohl(tvb, cur_offset); nstime.secs = tvb_get_ntohl(tvb, cur_offset);
unixtime.tv_usec = 0; nstime.nsecs = 0;
proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Signature expiration: %s", proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Signature expiration: %s",
abs_time_to_str(&unixtime)); abs_time_to_str(&nstime));
cur_offset += 4; cur_offset += 4;
rr_len -= 4; rr_len -= 4;
unixtime.tv_sec = tvb_get_ntohl(tvb, cur_offset); nstime.secs = tvb_get_ntohl(tvb, cur_offset);
unixtime.tv_usec = 0; nstime.nsecs = 0;
proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Time signed: %s", proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Time signed: %s",
abs_time_to_str(&unixtime)); abs_time_to_str(&nstime));
cur_offset += 4; cur_offset += 4;
rr_len -= 4; rr_len -= 4;
@ -1437,7 +1437,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset,
int tkey_algname_len; int tkey_algname_len;
guint16 tkey_mode, tkey_error, tkey_keylen, tkey_otherlen; guint16 tkey_mode, tkey_error, tkey_keylen, tkey_otherlen;
int rr_len = data_len; int rr_len = data_len;
struct timeval unixtime; nstime_t nstime;
static const value_string tkey_modes[] = { static const value_string tkey_modes[] = {
{ TKEYMODE_SERVERASSIGNED, "Server assigned" }, { TKEYMODE_SERVERASSIGNED, "Server assigned" },
{ TKEYMODE_DIFFIEHELLMAN, "Diffie Hellman" }, { TKEYMODE_DIFFIEHELLMAN, "Diffie Hellman" },
@ -1453,17 +1453,17 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset,
cur_offset += tkey_algname_len; cur_offset += tkey_algname_len;
rr_len -= tkey_algname_len; rr_len -= tkey_algname_len;
unixtime.tv_sec = tvb_get_ntohl(tvb, cur_offset); nstime.secs = tvb_get_ntohl(tvb, cur_offset);
unixtime.tv_usec = 0; nstime.nsecs = 0;
proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Signature inception: %s", proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Signature inception: %s",
abs_time_to_str(&unixtime)); abs_time_to_str(&nstime));
cur_offset += 4; cur_offset += 4;
rr_len -= 4; rr_len -= 4;
unixtime.tv_sec = tvb_get_ntohl(tvb, cur_offset); nstime.secs = tvb_get_ntohl(tvb, cur_offset);
unixtime.tv_usec = 0; nstime.nsecs = 0;
proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Signature expiration: %s", proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Signature expiration: %s",
abs_time_to_str(&unixtime)); abs_time_to_str(&nstime));
cur_offset += 4; cur_offset += 4;
rr_len -= 4; rr_len -= 4;
@ -1508,7 +1508,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset,
guint32 tsig_timelo; guint32 tsig_timelo;
char tsig_algname[MAXDNAME]; char tsig_algname[MAXDNAME];
int tsig_algname_len; int tsig_algname_len;
struct timeval unixtime; nstime_t nstime;
int rr_len = data_len; int rr_len = data_len;
if (dns_tree != NULL) { if (dns_tree != NULL) {
@ -1520,10 +1520,10 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset,
tsig_timehi = tvb_get_ntohs(tvb, cur_offset); tsig_timehi = tvb_get_ntohs(tvb, cur_offset);
tsig_timelo = tvb_get_ntohl(tvb, cur_offset + 2); tsig_timelo = tvb_get_ntohl(tvb, cur_offset + 2);
unixtime.tv_sec = tsig_timelo; nstime.secs = tsig_timelo;
unixtime.tv_usec = 0; nstime.nsecs = 0;
proto_tree_add_text(rr_tree, tvb, cur_offset, 6, "Time signed: %s%s", proto_tree_add_text(rr_tree, tvb, cur_offset, 6, "Time signed: %s%s",
abs_time_to_str(&unixtime), tsig_timehi == 0 ? "" : "(high bits set)"); abs_time_to_str(&nstime), tsig_timehi == 0 ? "" : "(high bits set)");
cur_offset += 6; cur_offset += 6;
rr_len -= 6; rr_len -= 6;

View File

@ -2,7 +2,7 @@
* *
* Top-most dissector. Decides dissector based on Wiretap Encapsulation Type. * Top-most dissector. Decides dissector based on Wiretap Encapsulation Type.
* *
* $Id: packet-frame.c,v 1.8 2001/06/18 02:17:46 guy Exp $ * $Id: packet-frame.c,v 1.9 2001/09/14 07:10:05 guy Exp $
* *
* Ethereal - Network traffic analyzer * Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org> * By Gerald Combs <gerald@zing.org>
@ -60,7 +60,7 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{ {
proto_tree *fh_tree; proto_tree *fh_tree;
proto_item *ti; proto_item *ti;
struct timeval tv; nstime_t ts;
int cap_len, pkt_len; int cap_len, pkt_len;
pinfo->current_proto = "Frame"; pinfo->current_proto = "Frame";
@ -82,23 +82,23 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
fh_tree = proto_item_add_subtree(ti, ett_frame); fh_tree = proto_item_add_subtree(ti, ett_frame);
tv.tv_sec = pinfo->fd->abs_secs; ts.secs = pinfo->fd->abs_secs;
tv.tv_usec = pinfo->fd->abs_usecs; ts.nsecs = pinfo->fd->abs_usecs*1000;
proto_tree_add_time(fh_tree, hf_frame_arrival_time, tvb, proto_tree_add_time(fh_tree, hf_frame_arrival_time, tvb,
0, 0, &tv); 0, 0, &ts);
tv.tv_sec = pinfo->fd->del_secs; ts.secs = pinfo->fd->del_secs;
tv.tv_usec = pinfo->fd->del_usecs; ts.nsecs = pinfo->fd->del_usecs*1000;
proto_tree_add_time(fh_tree, hf_frame_time_delta, tvb, proto_tree_add_time(fh_tree, hf_frame_time_delta, tvb,
0, 0, &tv); 0, 0, &ts);
tv.tv_sec = pinfo->fd->rel_secs; ts.secs = pinfo->fd->rel_secs;
tv.tv_usec = pinfo->fd->rel_usecs; ts.nsecs = pinfo->fd->rel_usecs*1000;
proto_tree_add_time(fh_tree, hf_frame_time_relative, tvb, proto_tree_add_time(fh_tree, hf_frame_time_relative, tvb,
0, 0, &tv); 0, 0, &ts);
proto_tree_add_uint(fh_tree, hf_frame_number, tvb, proto_tree_add_uint(fh_tree, hf_frame_number, tvb,
0, 0, pinfo->fd->num); 0, 0, pinfo->fd->num);

View File

@ -2,12 +2,11 @@
* Routines for Frame Relay Local Management Interface (LMI) disassembly * Routines for Frame Relay Local Management Interface (LMI) disassembly
* Copyright 2001, Jeffrey C. Foster <jfoste@woodward.com> * Copyright 2001, Jeffrey C. Foster <jfoste@woodward.com>
* *
* $Id: packet-lmi.c,v 1.5 2001/06/18 02:17:48 guy Exp $ * $Id: packet-lmi.c,v 1.6 2001/09/14 07:10:05 guy Exp $
* *
* Ethereal - Network traffic analyzer * Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org> * By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 * Copyright 1998
*
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -160,7 +159,7 @@ dissect_lmi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_uint(lmi_tree, hf_lmi_msg_type, tvb, 1, 1, tvb_get_guint8( tvb, 1)); proto_tree_add_uint(lmi_tree, hf_lmi_msg_type, tvb, 1, 1, tvb_get_guint8( tvb, 1));
/* Display the LMI elements */ /* Display the LMI elements */
while( offset < tvb_length( tvb)){ while (tvb_reported_length_remaining(tvb, offset) > 0) {
ele_id = tvb_get_guint8( tvb, offset); ele_id = tvb_get_guint8( tvb, offset);
len = tvb_get_guint8( tvb, offset + 1); len = tvb_get_guint8( tvb, offset + 1);

View File

@ -10,7 +10,7 @@
* *
* for information on Modbus/TCP. * for information on Modbus/TCP.
* *
* $Id: packet-mbtcp.c,v 1.4 2001/06/18 02:17:48 guy Exp $ * $Id: packet-mbtcp.c,v 1.5 2001/09/14 07:10:05 guy Exp $
* *
* Ethereal - Network traffic analyzer * Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com> * By Gerald Combs <gerald@ethereal.com>
@ -323,7 +323,7 @@ dissect_mbtcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
} }
offset = offset + sizeof(mbtcp_hdr) + (mh.len - sizeof(modbus_hdr)); offset = offset + sizeof(mbtcp_hdr) + (mh.len - sizeof(modbus_hdr));
packet_num++; packet_num++;
} while ( offset < tvb_length(tvb) ); } while ( tvb_reported_length_remaining(tvb, offset) > 0 );
/* Update entries in Info column on summary display */ /* Update entries in Info column on summary display */

View File

@ -2,7 +2,7 @@
* Routines for Mobile IP dissection * Routines for Mobile IP dissection
* Copyright 2000, Stefan Raab <sraab@cisco.com> * Copyright 2000, Stefan Raab <sraab@cisco.com>
* *
* $Id: packet-mip.c,v 1.18 2001/06/18 02:17:49 guy Exp $ * $Id: packet-mip.c,v 1.19 2001/09/14 07:10:05 guy Exp $
* *
* Ethereal - Network traffic analyzer * Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com> * By Gerald Combs <gerald@ethereal.com>
@ -141,8 +141,8 @@ dissect_mip( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_item *ti; proto_item *ti;
proto_tree *mip_tree=NULL, *ext_tree=NULL; proto_tree *mip_tree=NULL, *ext_tree=NULL;
guint8 type, code; guint8 type, code;
struct timeval ident_time; nstime_t ident_time;
int eoffset, elen; int eoffset, elen;
/* Make entries in Protocol column and Info column on summary display */ /* Make entries in Protocol column and Info column on summary display */
@ -177,12 +177,13 @@ dissect_mip( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_item(mip_tree, hf_mip_homeaddr, tvb, 4, 4, FALSE); proto_tree_add_item(mip_tree, hf_mip_homeaddr, tvb, 4, 4, FALSE);
proto_tree_add_item(mip_tree, hf_mip_haaddr, tvb, 8, 4, FALSE); proto_tree_add_item(mip_tree, hf_mip_haaddr, tvb, 8, 4, FALSE);
proto_tree_add_item(mip_tree, hf_mip_coa, tvb, 12, 4, FALSE); proto_tree_add_item(mip_tree, hf_mip_coa, tvb, 12, 4, FALSE);
ident_time.tv_sec = tvb_get_ntohl(tvb,16)-(guint32) NTP_BASETIME; ident_time.secs = tvb_get_ntohl(tvb,16)-(guint32) NTP_BASETIME;
ident_time.tv_usec = tvb_get_ntohl(tvb,20); ident_time.nsecs = tvb_get_ntohl(tvb,20)*1000;
proto_tree_add_time(mip_tree, hf_mip_ident, tvb, 16, 8, &ident_time); proto_tree_add_time(mip_tree, hf_mip_ident, tvb, 16, 8, &ident_time);
eoffset = 24; eoffset = 24;
while (eoffset < tvb_length(tvb)) { /* Registration Extensions */ while (tvb_reported_length_remaining(tvb, eoffset) > 0) {
/* Registration Extensions */
if (eoffset ==24) { if (eoffset ==24) {
ti = proto_tree_add_text(mip_tree, tvb, 24, tvb_length(tvb)-24, "Extensions"); ti = proto_tree_add_text(mip_tree, tvb, 24, tvb_length(tvb)-24, "Extensions");
ext_tree = proto_item_add_subtree(ti, ett_mip_ext); ext_tree = proto_item_add_subtree(ti, ett_mip_ext);
@ -232,12 +233,13 @@ dissect_mip( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_item(mip_tree, hf_mip_life, tvb, 2, 2, FALSE); proto_tree_add_item(mip_tree, hf_mip_life, tvb, 2, 2, FALSE);
proto_tree_add_item(mip_tree, hf_mip_homeaddr, tvb, 4, 4, FALSE); proto_tree_add_item(mip_tree, hf_mip_homeaddr, tvb, 4, 4, FALSE);
proto_tree_add_item(mip_tree, hf_mip_haaddr, tvb, 8, 4, FALSE); proto_tree_add_item(mip_tree, hf_mip_haaddr, tvb, 8, 4, FALSE);
ident_time.tv_sec = tvb_get_ntohl(tvb,12)-(guint32) NTP_BASETIME; ident_time.secs = tvb_get_ntohl(tvb,12)-(guint32) NTP_BASETIME;
ident_time.tv_usec = tvb_get_ntohl(tvb,16); ident_time.nsecs = tvb_get_ntohl(tvb,16)*1000;
proto_tree_add_time(mip_tree, hf_mip_ident, tvb, 12, 8, &ident_time); proto_tree_add_time(mip_tree, hf_mip_ident, tvb, 12, 8, &ident_time);
eoffset = 20; eoffset = 20;
while (eoffset < tvb_length(tvb)) { /* Registration Extensions */ while (tvb_reported_length_remaining(tvb, eoffset) > 0) {
/* Registration Extensions */
if (eoffset==20) { if (eoffset==20) {
ti = proto_tree_add_text(mip_tree, tvb, 20, tvb_length(tvb)-20, "Extensions"); ti = proto_tree_add_text(mip_tree, tvb, 20, tvb_length(tvb)-20, "Extensions");
ext_tree = proto_item_add_subtree(ti, ett_mip_ext); ext_tree = proto_item_add_subtree(ti, ett_mip_ext);

View File

@ -5,12 +5,11 @@
* *
* derived from the packet-nbns.c * derived from the packet-nbns.c
* *
* $Id: packet-netbios.c,v 1.34 2001/06/18 02:17:49 guy Exp $ * $Id: packet-netbios.c,v 1.35 2001/09/14 07:10:05 guy Exp $
* *
* Ethereal - Network traffic analyzer * Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org> * By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs * Copyright 1998 Gerald Combs
*
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -27,8 +26,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
@ -1037,10 +1034,11 @@ dissect_netbios(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
(dissect_netb[ command])( tvb, offset, netb_tree); (dissect_netb[ command])( tvb, offset, netb_tree);
} }
/* Test for SMB data */ offset += hdr_len; /* move past header */
if ( tvb_length(tvb)> ( hdr_len + 4)){ /* if enough data */
offset += hdr_len; /* move past header */ /* Test for SMB data */
if (tvb_bytes_exist(tvb, offset, 4)){ /* if enough data */
if (( tvb_get_guint8( tvb, offset) == 0xff) && /* if SMB marker */ if (( tvb_get_guint8( tvb, offset) == 0xff) && /* if SMB marker */
( tvb_get_guint8( tvb, offset + 1) == 'S') && ( tvb_get_guint8( tvb, offset + 1) == 'S') &&

View File

@ -1,7 +1,7 @@
/* packet-nisplus.c /* packet-nisplus.c
* 2001 Ronnie Sahlberg <rsahlber@bigpond.net.au> * 2001 Ronnie Sahlberg <rsahlber@bigpond.net.au>
* *
* $Id: packet-nisplus.c,v 1.7 2001/06/18 02:17:50 guy Exp $ * $Id: packet-nisplus.c,v 1.8 2001/09/14 07:10:05 guy Exp $
* *
* Ethereal - Network traffic analyzer * Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com> * By Gerald Combs <gerald@ethereal.com>
@ -26,7 +26,6 @@
#include "config.h" #include "config.h"
#endif #endif
#ifdef HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif #endif
@ -268,13 +267,13 @@ static const value_string ns_type[] = {
static int static int
dissect_nisplus_time(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hfindex) dissect_nisplus_time(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hfindex)
{ {
struct timeval tv; nstime_t ts;
tv.tv_usec = 0; ts.nsecs = 0;
tv.tv_sec = tvb_get_ntohl(tvb, offset); ts.secs = tvb_get_ntohl(tvb, offset);
offset += 4; offset += 4;
proto_tree_add_time(tree, hfindex, tvb, offset, 4, &tv); proto_tree_add_time(tree, hfindex, tvb, offset, 4, &ts);
return offset; return offset;
} }

View File

@ -2,7 +2,7 @@
* Routines for ISO/OSI network and transport protocol packet disassembly * Routines for ISO/OSI network and transport protocol packet disassembly
* Main entrance point and common functions * Main entrance point and common functions
* *
* $Id: packet-osi.c,v 1.45 2001/06/05 09:06:19 guy Exp $ * $Id: packet-osi.c,v 1.46 2001/09/14 07:10:05 guy Exp $
* Laurent Deniel <deniel@worldnet.fr> * Laurent Deniel <deniel@worldnet.fr>
* Ralf Schneider <Ralf.Schneider@t-online.de> * Ralf Schneider <Ralf.Schneider@t-online.de>
* *
@ -55,7 +55,7 @@ calc_checksum( tvbuff_t *tvb, int offset, u_int len, u_int checksum) {
const guint8 *p; const guint8 *p;
guint32 c0, c1; guint32 c0, c1;
u_int seglen; u_int seglen;
int i; u_int i;
if ( 0 == checksum ) if ( 0 == checksum )
return( NO_CKSUM ); return( NO_CKSUM );

View File

@ -2,12 +2,11 @@
* Routines for Q.2931 frame disassembly * Routines for Q.2931 frame disassembly
* Guy Harris <guy@alum.mit.edu> * Guy Harris <guy@alum.mit.edu>
* *
* $Id: packet-q2931.c,v 1.18 2001/06/18 02:17:50 guy Exp $ * $Id: packet-q2931.c,v 1.19 2001/09/14 07:10:05 guy Exp $
* *
* Ethereal - Network traffic analyzer * Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com> * By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 * Copyright 1998
*
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -1974,7 +1973,6 @@ static void
dissect_q2931(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissect_q2931(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{ {
int offset = 0; int offset = 0;
guint reported_length;
proto_tree *q2931_tree = NULL; proto_tree *q2931_tree = NULL;
proto_item *ti; proto_item *ti;
proto_tree *ext_tree; proto_tree *ext_tree;
@ -2045,8 +2043,7 @@ dissect_q2931(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*/ */
codeset = 0; /* start out in codeset 0 */ codeset = 0; /* start out in codeset 0 */
non_locking_shift = TRUE; non_locking_shift = TRUE;
reported_length = tvb_reported_length(tvb); while (tvb_reported_length_remaining(tvb, offset) > 0) {
while (offset < reported_length) {
info_element = tvb_get_guint8(tvb, offset); info_element = tvb_get_guint8(tvb, offset);
info_element_ext = tvb_get_guint8(tvb, offset + 1); info_element_ext = tvb_get_guint8(tvb, offset + 1);
info_element_len = tvb_get_ntohs(tvb, offset + 2); info_element_len = tvb_get_ntohs(tvb, offset + 2);

View File

@ -2,7 +2,7 @@
* Routines for Q.931 frame disassembly * Routines for Q.931 frame disassembly
* Guy Harris <guy@alum.mit.edu> * Guy Harris <guy@alum.mit.edu>
* *
* $Id: packet-q931.c,v 1.31 2001/07/03 04:56:45 guy Exp $ * $Id: packet-q931.c,v 1.32 2001/09/14 07:10:05 guy Exp $
* *
* Modified by Andreas Sikkema for possible use with H.323 * Modified by Andreas Sikkema for possible use with H.323
* *
@ -2099,7 +2099,6 @@ q931_dissector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
gboolean started_heuristic) gboolean started_heuristic)
{ {
int offset = 0; int offset = 0;
guint reported_length;
proto_tree *q931_tree = NULL; proto_tree *q931_tree = NULL;
proto_item *ti; proto_item *ti;
proto_tree *ie_tree; proto_tree *ie_tree;
@ -2260,8 +2259,7 @@ q931_dissector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
*/ */
codeset = 0; /* start out in codeset 0 */ codeset = 0; /* start out in codeset 0 */
non_locking_shift = TRUE; non_locking_shift = TRUE;
reported_length = tvb_reported_length(tvb); while (tvb_reported_length_remaining(tvb, offset) > 0) {
while (offset < reported_length) {
info_element = tvb_get_guint8(tvb, offset); info_element = tvb_get_guint8(tvb, offset);
/* /*

View File

@ -4,7 +4,7 @@
* Based on routines from tcpdump patches by * Based on routines from tcpdump patches by
* Ken Hornstein <kenh@cmf.nrl.navy.mil> * Ken Hornstein <kenh@cmf.nrl.navy.mil>
* *
* $Id: packet-rx.c,v 1.25 2001/08/20 02:11:13 guy Exp $ * $Id: packet-rx.c,v 1.26 2001/09/14 07:10:05 guy Exp $
* *
* Ethereal - Network traffic analyzer * Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com> * By Gerald Combs <gerald@ethereal.com>
@ -156,12 +156,12 @@ dissect_rx_response_encrypted(tvbuff_t *tvb, packet_info *pinfo, proto_tree *par
/* epoch : 4 bytes */ /* epoch : 4 bytes */
{ {
struct timeval tv; nstime_t ts;
tv.tv_sec = tvb_get_ntohl(tvb, offset); ts.secs = tvb_get_ntohl(tvb, offset);
tv.tv_usec = 0; ts.nsecs = 0;
proto_tree_add_time(tree, hf_rx_epoch, tvb, proto_tree_add_time(tree, hf_rx_epoch, tvb,
offset, 4, &tv); offset, 4, &ts);
offset += 4; offset += 4;
} }
@ -444,12 +444,12 @@ dissect_rx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
/* epoch : 4 bytes */ /* epoch : 4 bytes */
{ {
struct timeval tv; nstime_t ts;;
tv.tv_sec = tvb_get_ntohl(tvb, offset); ts.secs = tvb_get_ntohl(tvb, offset);
tv.tv_usec = 0; ts.nsecs = 0;
proto_tree_add_time(tree, hf_rx_epoch, tvb, proto_tree_add_time(tree, hf_rx_epoch, tvb,
offset, 4, &tv); offset, 4, &ts);
offset += 4; offset += 4;
} }

View File

@ -8,7 +8,7 @@ XXX Fixme : shouldnt show [malformed frame] for long packets
* significant rewrite to tvbuffify the dissector, Ronnie Sahlberg and * significant rewrite to tvbuffify the dissector, Ronnie Sahlberg and
* Guy Harris 2001 * Guy Harris 2001
* *
* $Id: packet-smb-pipe.c,v 1.34 2001/08/27 20:04:21 guy Exp $ * $Id: packet-smb-pipe.c,v 1.35 2001/09/14 07:10:05 guy Exp $
* *
* Ethereal - Network traffic analyzer * Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com> * By Gerald Combs <gerald@ethereal.com>
@ -419,13 +419,13 @@ static int
add_reltime(tvbuff_t *tvb, int offset, int count, packet_info *pinfo, add_reltime(tvbuff_t *tvb, int offset, int count, packet_info *pinfo,
proto_tree *tree, int convert, int hf_index) proto_tree *tree, int convert, int hf_index)
{ {
struct timeval timeval; nstime_t nstime;
timeval.tv_sec = tvb_get_letohl(tvb, offset); nstime.secs = tvb_get_letohl(tvb, offset);
timeval.tv_usec = 0; nstime.nsecs = 0;
proto_tree_add_time_format(tree, hf_index, tvb, offset, 4, proto_tree_add_time_format(tree, hf_index, tvb, offset, 4,
&timeval, "%s: %s", proto_registrar_get_name(hf_index), &nstime, "%s: %s", proto_registrar_get_name(hf_index),
time_secs_to_str(timeval.tv_sec)); time_secs_to_str(nstime.secs));
offset += 4; offset += 4;
return offset; return offset;
} }
@ -439,14 +439,14 @@ add_abstime_common(tvbuff_t *tvb, int offset, int count,
packet_info *pinfo, proto_tree *tree, int convert, int hf_index, packet_info *pinfo, proto_tree *tree, int convert, int hf_index,
const char *absent_name) const char *absent_name)
{ {
struct timeval timeval; nstime_t nstime;
struct tm *tmp; struct tm *tmp;
timeval.tv_sec = tvb_get_letohl(tvb, offset); nstime.secs = tvb_get_letohl(tvb, offset);
timeval.tv_usec = 0; nstime.nsecs = 0;
if (timeval.tv_sec == -1) { if (nstime.secs == -1) {
proto_tree_add_time_format(tree, hf_index, tvb, offset, 4, proto_tree_add_time_format(tree, hf_index, tvb, offset, 4,
&timeval, "%s: %s", proto_registrar_get_name(hf_index), &nstime, "%s: %s", proto_registrar_get_name(hf_index),
absent_name); absent_name);
} else { } else {
/* /*
@ -454,11 +454,11 @@ add_abstime_common(tvbuff_t *tvb, int offset, int count,
* run it through "mktime()" to put it back together * run it through "mktime()" to put it back together
* as UTC. * as UTC.
*/ */
tmp = gmtime(&timeval.tv_sec); tmp = gmtime(&nstime.secs);
tmp->tm_isdst = -1; /* we don't know if it's DST or not */ tmp->tm_isdst = -1; /* we don't know if it's DST or not */
timeval.tv_sec = mktime(tmp); nstime.secs = mktime(tmp);
proto_tree_add_time(tree, hf_index, tvb, offset, 4, proto_tree_add_time(tree, hf_index, tvb, offset, 4,
&timeval); &nstime);
} }
offset += 4; offset += 4;
return offset; return offset;

View File

@ -2,7 +2,7 @@
* Routines for ssl dissection * Routines for ssl dissection
* Copyright (c) 2000-2001, Scott Renfro <scott@renfro.org> * Copyright (c) 2000-2001, Scott Renfro <scott@renfro.org>
* *
* $Id: packet-ssl.c,v 1.6 2001/09/03 10:33:07 guy Exp $ * $Id: packet-ssl.c,v 1.7 2001/09/14 07:10:06 guy Exp $
* *
* Ethereal - Network traffic analyzer * Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com> * By Gerald Combs <gerald@ethereal.com>
@ -1117,14 +1117,14 @@ dissect_ssl3_hnd_hello_common(tvbuff_t *tvb, proto_tree *tree,
{ {
/* show the client's random challenge */ /* show the client's random challenge */
guint32 initial_offset = offset; guint32 initial_offset = offset;
struct timeval gmt_unix_time; nstime_t gmt_unix_time;
guint8 session_id_length = 0; guint8 session_id_length = 0;
if (tree) if (tree)
{ {
/* show the time */ /* show the time */
gmt_unix_time.tv_sec = tvb_get_ntohl(tvb, offset); gmt_unix_time.secs = tvb_get_ntohl(tvb, offset);
gmt_unix_time.tv_usec = 0; gmt_unix_time.nsecs = 0;
proto_tree_add_time(tree, hf_ssl_handshake_random_time, proto_tree_add_time(tree, hf_ssl_handshake_random_time,
tvb, offset, 4, &gmt_unix_time); tvb, offset, 4, &gmt_unix_time);
offset += 4; offset += 4;

View File

@ -2,7 +2,7 @@
* Routines for who protocol (see man rwhod) * Routines for who protocol (see man rwhod)
* Gilbert Ramirez <gram@xiexie.org> * Gilbert Ramirez <gram@xiexie.org>
* *
* $Id: packet-who.c,v 1.17 2001/06/18 02:17:54 guy Exp $ * $Id: packet-who.c,v 1.18 2001/09/14 07:10:06 guy Exp $
* *
* Ethereal - Network traffic analyzer * Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org> * By Gerald Combs <gerald@zing.org>
@ -102,7 +102,7 @@ dissect_who(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_item *who_ti = NULL; proto_item *who_ti = NULL;
gchar server_name[33]; gchar server_name[33];
double loadav_5 = 0.0, loadav_10 = 0.0, loadav_15 = 0.0; double loadav_5 = 0.0, loadav_10 = 0.0, loadav_15 = 0.0;
struct timeval tv; nstime_t ts;
/* Summary information */ /* Summary information */
if (check_col(pinfo->fd, COL_PROTOCOL)) if (check_col(pinfo->fd, COL_PROTOCOL))
@ -110,7 +110,7 @@ dissect_who(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (check_col(pinfo->fd, COL_INFO)) if (check_col(pinfo->fd, COL_INFO))
col_clear(pinfo->fd, COL_INFO); col_clear(pinfo->fd, COL_INFO);
tv.tv_usec = 0; ts.nsecs = 0;
if (tree) { if (tree) {
who_ti = proto_tree_add_item(tree, proto_who, tvb, offset, who_ti = proto_tree_add_item(tree, proto_who, tvb, offset,
@ -130,16 +130,16 @@ dissect_who(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset += 2; offset += 2;
if (tree) { if (tree) {
tv.tv_sec = tvb_get_ntohl(tvb, offset); ts.secs = tvb_get_ntohl(tvb, offset);
proto_tree_add_time(who_tree, hf_who_sendtime, tvb, offset, 4, proto_tree_add_time(who_tree, hf_who_sendtime, tvb, offset, 4,
&tv); &ts);
} }
offset += 4; offset += 4;
if (tree) { if (tree) {
tv.tv_sec = tvb_get_ntohl(tvb, offset); ts.secs = tvb_get_ntohl(tvb, offset);
proto_tree_add_time(who_tree, hf_who_recvtime, tvb, offset, 4, proto_tree_add_time(who_tree, hf_who_recvtime, tvb, offset, 4,
&tv); &ts);
} }
offset += 4; offset += 4;
@ -173,9 +173,9 @@ dissect_who(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
server_name, loadav_5, loadav_10, loadav_15); server_name, loadav_5, loadav_10, loadav_15);
if (tree) { if (tree) {
tv.tv_sec = tvb_get_ntohl(tvb, offset); ts.secs = tvb_get_ntohl(tvb, offset);
proto_tree_add_time(who_tree, hf_who_boottime, tvb, offset, 4, proto_tree_add_time(who_tree, hf_who_boottime, tvb, offset, 4,
&tv); &ts);
offset += 4; offset += 4;
dissect_whoent(tvb, offset, who_tree); dissect_whoent(tvb, offset, who_tree);
@ -195,11 +195,11 @@ dissect_whoent(tvbuff_t *tvb, int offset, proto_tree *tree)
int line_offset = offset; int line_offset = offset;
gchar out_line[9]; gchar out_line[9];
gchar out_name[9]; gchar out_name[9];
struct timeval tv; nstime_t ts;
int whoent_num = 0; int whoent_num = 0;
guint32 idle_secs; /* say that out loud... */ guint32 idle_secs; /* say that out loud... */
tv.tv_usec = 0; ts.nsecs = 0;
while (tvb_reported_length_remaining(tvb, line_offset) > 0 while (tvb_reported_length_remaining(tvb, line_offset) > 0
&& whoent_num < MAX_NUM_WHOENTS) { && whoent_num < MAX_NUM_WHOENTS) {
@ -217,9 +217,9 @@ dissect_whoent(tvbuff_t *tvb, int offset, proto_tree *tree)
8, out_name); 8, out_name);
line_offset += 8; line_offset += 8;
tv.tv_sec = tvb_get_ntohl(tvb, line_offset); ts.secs = tvb_get_ntohl(tvb, line_offset);
proto_tree_add_time(whoent_tree, hf_who_timeon, tvb, proto_tree_add_time(whoent_tree, hf_who_timeon, tvb,
line_offset, 4, &tv); line_offset, 4, &ts);
line_offset += 4; line_offset += 4;
idle_secs = tvb_get_ntohl(tvb, line_offset); idle_secs = tvb_get_ntohl(tvb, line_offset);

View File

@ -2,7 +2,7 @@
* *
* Routines to dissect WSP component of WAP traffic. * Routines to dissect WSP component of WAP traffic.
* *
* $Id: packet-wsp.c,v 1.34 2001/09/03 18:05:57 guy Exp $ * $Id: packet-wsp.c,v 1.35 2001/09/14 07:10:06 guy Exp $
* *
* Ethereal - Network traffic analyzer * Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com> * By Gerald Combs <gerald@ethereal.com>
@ -1611,7 +1611,7 @@ add_application_header (proto_tree *tree, tvbuff_t *tvb, int offset)
int subvalueLen; int subvalueLen;
int subvalueOffset; int subvalueOffset;
guint secs; guint secs;
struct timeval timeValue; nstime_t timeValue;
int asvOffset; int asvOffset;
guint stringSize; guint stringSize;
@ -1643,8 +1643,8 @@ add_application_header (proto_tree *tree, tvbuff_t *tvb, int offset)
* there weren't WAP phones or Web servers back in * there weren't WAP phones or Web servers back in
* late 1969/early 1970, they're unlikely to be used. * late 1969/early 1970, they're unlikely to be used.
*/ */
timeValue.tv_sec = secs; timeValue.secs = secs;
timeValue.tv_usec = 0; timeValue.nsecs = 0;
proto_tree_add_time (tree, hf_wsp_header_x_wap_tod, proto_tree_add_time (tree, hf_wsp_header_x_wap_tod,
tvb, startOffset, offset - startOffset, &timeValue); tvb, startOffset, offset - startOffset, &timeValue);
} }
@ -2727,7 +2727,7 @@ add_date_value_header (proto_tree *tree, tvbuff_t *header_buff,
int valueLen, int hf_time, guint8 headerType) int valueLen, int hf_time, guint8 headerType)
{ {
guint secs; guint secs;
struct timeval timeValue; nstime_t timeValue;
/* Attempt to get the date value from the buffer */ /* Attempt to get the date value from the buffer */
if (get_integer (value_buff, 0, valueLen, valueType, &secs) == 0) if (get_integer (value_buff, 0, valueLen, valueType, &secs) == 0)
@ -2741,8 +2741,8 @@ add_date_value_header (proto_tree *tree, tvbuff_t *header_buff,
* there weren't WAP phones or Web servers back in * there weren't WAP phones or Web servers back in
* late 1969/early 1970, they're unlikely to be used. * late 1969/early 1970, they're unlikely to be used.
*/ */
timeValue.tv_sec = secs; timeValue.secs = secs;
timeValue.tv_usec = 0; timeValue.nsecs = 0;
proto_tree_add_time (tree, hf_time, header_buff, 0, proto_tree_add_time (tree, hf_time, header_buff, 0,
headerLen, &timeValue); headerLen, &timeValue);
} }

View File

@ -2,10 +2,10 @@
* *
* Routines to dissect WTLS component of WAP traffic. * Routines to dissect WTLS component of WAP traffic.
* *
* $Id: packet-wtls.c,v 1.11 2001/07/20 09:10:16 guy Exp $ * $Id: packet-wtls.c,v 1.12 2001/09/14 07:10:06 guy Exp $
* *
* Ethereal - Network traffic analyzer * Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org> * By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Didier Jorand * Copyright 1998 Didier Jorand
* *
* WAP dissector based on original work by Ben Fowler * WAP dissector based on original work by Ben Fowler
@ -449,7 +449,7 @@ static void
dissect_wtls_handshake(proto_tree *tree, tvbuff_t *tvb, guint offset, guint count) dissect_wtls_handshake(proto_tree *tree, tvbuff_t *tvb, guint offset, guint count)
{ {
char pdu_msg_type; char pdu_msg_type;
struct timeval timeValue; nstime_t timeValue;
int client_size = 0; int client_size = 0;
guint value = 0; guint value = 0;
int size = 0; int size = 0;
@ -485,8 +485,8 @@ dissect_wtls_handshake(proto_tree *tree, tvbuff_t *tvb, guint offset, guint coun
ti = proto_tree_add_item (wtls_msg_type_item_tree, hf_wtls_hands_cli_hello_version, ti = proto_tree_add_item (wtls_msg_type_item_tree, hf_wtls_hands_cli_hello_version,
tvb,offset,1,bo_big_endian); tvb,offset,1,bo_big_endian);
offset++; offset++;
timeValue.tv_sec = tvb_get_ntohl (tvb, offset); timeValue.secs = tvb_get_ntohl (tvb, offset);
timeValue.tv_usec = 0; timeValue.nsecs = 0;
ti = proto_tree_add_time (wtls_msg_type_item_tree, hf_wtls_hands_cli_hello_gmt, tvb, ti = proto_tree_add_time (wtls_msg_type_item_tree, hf_wtls_hands_cli_hello_gmt, tvb,
offset, 4, &timeValue); offset, 4, &timeValue);
offset+=4; offset+=4;
@ -870,8 +870,8 @@ dissect_wtls_handshake(proto_tree *tree, tvbuff_t *tvb, guint offset, guint coun
ti = proto_tree_add_item (wtls_msg_type_item_tree, hf_wtls_hands_serv_hello_version, ti = proto_tree_add_item (wtls_msg_type_item_tree, hf_wtls_hands_serv_hello_version,
tvb,offset,1,bo_big_endian); tvb,offset,1,bo_big_endian);
offset++; offset++;
timeValue.tv_sec = tvb_get_ntohl (tvb, offset); timeValue.secs = tvb_get_ntohl (tvb, offset);
timeValue.tv_usec = 0; timeValue.nsecs = 0;
ti = proto_tree_add_time (wtls_msg_type_item_tree, hf_wtls_hands_serv_hello_gmt, tvb, ti = proto_tree_add_time (wtls_msg_type_item_tree, hf_wtls_hands_serv_hello_gmt, tvb,
offset, 4, &timeValue); offset, 4, &timeValue);
offset+=4; offset+=4;
@ -1008,15 +1008,15 @@ dissect_wtls_handshake(proto_tree *tree, tvbuff_t *tvb, guint offset, guint coun
case IDENTIFIER_X509 : case IDENTIFIER_X509 :
break; break;
} }
timeValue.tv_sec = tvb_get_ntohl (tvb, offset); timeValue.secs = tvb_get_ntohl (tvb, offset);
timeValue.tv_usec = 0; timeValue.nsecs = 0;
ti = proto_tree_add_time (wtls_msg_type_item_sub_tree, ti = proto_tree_add_time (wtls_msg_type_item_sub_tree,
hf_wtls_hands_certificate_wtls_valid_not_before, hf_wtls_hands_certificate_wtls_valid_not_before,
tvb, offset, 4, &timeValue); tvb, offset, 4, &timeValue);
offset+=4; offset+=4;
client_size+=4; client_size+=4;
timeValue.tv_sec = tvb_get_ntohl (tvb, offset); timeValue.secs = tvb_get_ntohl (tvb, offset);
timeValue.tv_usec = 0; timeValue.nsecs = 0;
ti = proto_tree_add_time (wtls_msg_type_item_sub_tree, ti = proto_tree_add_time (wtls_msg_type_item_sub_tree,
hf_wtls_hands_certificate_wtls_valid_not_after, hf_wtls_hands_certificate_wtls_valid_not_after,
tvb, offset, 4, &timeValue); tvb, offset, 4, &timeValue);