aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--acinclude.m444
-rw-r--r--config.h.win3241
-rw-r--r--configure.in60
-rw-r--r--doc/README.developer29
-rw-r--r--epan/packet.h10
-rw-r--r--packet-rsvp.c4
6 files changed, 170 insertions, 18 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 5f474d3da3..26f7ba58e2 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -2,7 +2,7 @@ dnl Macros that test for specific features.
dnl This file is part of the Autoconf packaging for Ethereal.
dnl Copyright (C) 1998-2000 by Gerald Combs.
dnl
-dnl $Id: acinclude.m4,v 1.76 2004/05/18 11:11:37 jmayer Exp $
+dnl $Id: acinclude.m4,v 1.77 2004/06/19 00:07:22 guy Exp $
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
@@ -92,6 +92,48 @@ if test $ac_cv_ethereal_struct_sa_len = yes; then
fi
])
+
+dnl
+dnl Check whether a given format can be used to print 64-bit integers
+dnl
+AC_DEFUN(AC_ETHEREAL_CHECK_64BIT_FORMAT,
+[
+ AC_MSG_CHECKING([whether %$1x can be used to format 64-bit integers])
+ AC_RUN_IFELSE(
+ [
+ AC_LANG_SOURCE(
+ [[
+# ifdef HAVE_INTTYPES_H
+ #include <inttypes.h>
+# endif
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ main()
+ {
+ u_int64_t t = 1;
+ char strbuf[16+1];
+ sprintf(strbuf, "%016$1x", t << 32);
+ if (strcmp(strbuf, "0000000100000000") == 0)
+ exit(0);
+ else
+ exit(1);
+ }
+ ]])
+ ],
+ [
+ AC_DEFINE(PRId64, "$1d", [Format for printing 64-bit signed decimal numbers])
+ AC_DEFINE(PRIo64, "$1o", [Format for printing 64-bit unsigned octal numbers])
+ AC_DEFINE(PRIx64, "$1x", [Format for printing 64-bit unsigned hexadecimal numbers])
+ AC_DEFINE(PRIu64, "$1u", [Format for printing 64-bit unsigned decimal numbers])
+ AC_MSG_RESULT(yes)
+ ],
+ [
+ AC_MSG_RESULT(no)
+ $2
+ ])
+])
+
#
# AC_ETHEREAL_IPV6_STACK
#
diff --git a/config.h.win32 b/config.h.win32
index d84d9ccc31..c040e018f9 100644
--- a/config.h.win32
+++ b/config.h.win32
@@ -1,4 +1,4 @@
-/* $Id: config.h.win32,v 1.45 2004/05/09 10:03:36 guy Exp $ */
+/* $Id: config.h.win32,v 1.46 2004/06/19 00:07:22 guy Exp $ */
/* config.h.win32 Generated manually. :-) */
/* config.h. Generated automatically by configure. */
/* config.h.in. Generated automatically from configure.in by autoheader. */
@@ -118,6 +118,45 @@
/* Define if you have the <unistd.h> header file. */
/* #define HAVE_UNISTD_H 1 */
+/* Define if <inttypes.h> defines PRI[doxu]64 macros */
+/* #define INTTYPES_H_DEFINES_FORMATS */
+
+/* Format for printing 64-bit signed decimal numbers */
+#ifndef PRId64
+#ifdef _MSC_EXTENSIONS
+#define PRId64 "i64d"
+#else /* _MSC_EXTENSIONS */
+#define PRId64 "lld"
+#endif /* _MSC_EXTENSIONS */
+#endif /* PRId64 */
+
+/* Format for printing 64-bit unsigned octal numbers */
+#ifndef PRIo64
+#ifdef _MSC_EXTENSIONS
+#define PRIo64 "i64o"
+#else /* _MSC_EXTENSIONS */
+#define PRIo64 "llo"
+#endif /* _MSC_EXTENSIONS */
+#endif /* PRIo64 */
+
+/* Format for printing 64-bit unsigned decimal numbers */
+#ifndef PRIu64
+#ifdef _MSC_EXTENSIONS
+#define PRIu64 "i64u"
+#else /* _MSC_EXTENSIONS */
+#define PRIu64 "llu"
+#endif /* _MSC_EXTENSIONS */
+#endif /* PRIu64 */
+
+/* Format for printing 64-bit unsigned hexadecimal numbers */
+#ifndef PRIx64
+#ifdef _MSC_EXTENSIONS
+#define PRIx64 "i64x"
+#else /* _MSC_EXTENSIONS */
+#define PRIx64 "llx"
+#endif /* _MSC_EXTENSIONS */
+#endif /* PRIx64 */
+
/* Define if you have the z library (-lz). */
@HAVE_LIBZ@
diff --git a/configure.in b/configure.in
index f9903a56c6..b571e70e8f 100644
--- a/configure.in
+++ b/configure.in
@@ -1,4 +1,4 @@
-# $Id: configure.in,v 1.266 2004/06/17 14:37:43 jmayer Exp $
+# $Id: configure.in,v 1.267 2004/06/19 00:07:22 guy Exp $
#
AC_INIT(etypes.h)
@@ -230,6 +230,64 @@ if test "$HAVE_GNU_SED" = no ; then
esac
fi
+#
+# We can't just check for <inttypes.h> - some systems have one that
+# doesn't define all the PRI[doxu]64 macros.
+#
+AC_CHECK_HEADERS(inttypes.h,
+ [
+ #
+ # OK, we have inttypes.h, but does it define those macros?
+ #
+ AC_MSG_CHECKING([[whether inttypes.h defines the PRI[doxu]64 macros]])
+ AC_COMPILE_IFELSE(
+ [
+ AC_LANG_SOURCE(
+ [[
+ #include <inttypes.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ main()
+ {
+ printf("%" PRId64 "\n", (u_int64_t)1);
+ printf("%" PRIo64 "\n", (u_int64_t)1);
+ printf("%" PRIx64 "\n", (u_int64_t)1);
+ printf("%" PRIu64 "\n", (u_int64_t)1);
+ }
+ ]])
+ ],
+ [
+ AC_MSG_RESULT(yes)
+ ac_ethereal_inttypes_h_defines_formats=yes
+ ],
+ [
+ AC_MSG_RESULT(no)
+ ac_ethereal_inttypes_h_defines_formats=no
+ ])
+ ],
+ [
+ #
+ # We don't have inttypes.h, so it obviously can't define those
+ # macros.
+ #
+ ac_ethereal_inttypes_h_defines_formats=no
+ ])
+if test "$ac_ethereal_inttypes_h_defines_formats" = yes; then
+ AC_DEFINE(INTTYPES_H_DEFINES_FORMATS,,[Define if <inttypes.h> defines PRI[doxu]64 macros])
+else
+ AC_ETHEREAL_CHECK_64BIT_FORMAT(ll,
+ [
+ AC_ETHEREAL_CHECK_64BIT_FORMAT(L,
+ [
+ AC_ETHEREAL_CHECK_64BIT_FORMAT(q,
+ [
+ AC_MSG_ERROR([neither %llx nor %Lx nor %qx worked on a 64-bit integer])
+ ])
+ ])
+ ])
+fi
+
# Enable/disable tethereal
AC_ARG_ENABLE(ethereal,
diff --git a/doc/README.developer b/doc/README.developer
index 8820fd73a9..e1ba1f6f09 100644
--- a/doc/README.developer
+++ b/doc/README.developer
@@ -1,4 +1,4 @@
-$Id: README.developer,v 1.95 2004/05/24 02:25:20 guy Exp $
+$Id: README.developer,v 1.96 2004/06/19 00:07:23 guy Exp $
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
@@ -38,14 +38,6 @@ functions declared in header files; if it doesn't work, don't declare
the function in a header file, even if this requires that you not make
it inline on any platform.
-Don't use "long long"; use "gint64" or "guint64", and only do so if
-G_HAVE_GINT64 is defined. Make sure your code works even if
-G_HAVE_GINT64 isn't defined, even if that means treating 64-bit integral
-data types as opaque arrays of bytes on platforms where it's not
-defined. Also, don't assume you can use "%lld", "%llu", "%llx", or
-"%llo" to print 64-bit integral data types - not all platforms support
-"%ll" for printing them.
-
Don't use "uchar", "u_char", "ushort", "u_short", "uint", "u_int",
"ulong", or "u_long"; they aren't defined on all platforms. If you want
an 8-bit unsigned quantity, use "guint8"; if you want an 8-bit character
@@ -61,6 +53,19 @@ Don't use "long" to mean "signed 32-bit integer", and don't use
long on many platforms. Use "gint32" for signed 32-bit integers and use
"guint32" for unsigned 32-bit integers.
+Don't use "long" to mean "signed 64-bit integer" and don't use "unsigned
+long" to mean "unsigned 64-bit integer"; "long"s are 32 bits long on
+other many platforms. Also don't use "long long" or "unsigned long
+long", as not all platforms support them; use "gint64" or "guint64",
+which will be defined as the appropriate types for 64-bit signed and
+unsigned integers. Also, don't assume you can use "%lld", "%llu",
+"%llx", or "%llo" to print 64-bit integral data types - not all
+platforms support "%ll" for printing them. Instead, use PRId64, PRIu64,
+PRIx64, and PRIo64, for example
+
+ proto_tree_add_text(tree, tvb, offset, 8,
+ "Sequence Number: %" PRIu64, sequence_number);
+
Don't use a label without a statement following it. For example,
something such as
@@ -363,12 +368,12 @@ code inside
is needed only if you are using the "snprintf()" function.
-The "$Id: README.developer,v 1.95 2004/05/24 02:25:20 guy Exp $"
+The "$Id: README.developer,v 1.96 2004/06/19 00:07:23 guy Exp $"
in the comment will be updated by CVS when the file is
checked in; it will allow the RCS "ident" command to report which
version of the file is currently checked out.
-When creating a new file, it is fine to just write "$Id: README.developer,v 1.95 2004/05/24 02:25:20 guy Exp $" as RCS will
+When creating a new file, it is fine to just write "$Id: README.developer,v 1.96 2004/06/19 00:07:23 guy Exp $" as RCS will
automatically fill in the identifier at the time the file will be added to the
CVS repository (checked in).
@@ -377,7 +382,7 @@ CVS repository (checked in).
* Routines for PROTONAME dissection
* Copyright 2000, YOUR_NAME <YOUR_EMAIL_ADDRESS>
*
- * $Id: README.developer,v 1.95 2004/05/24 02:25:20 guy Exp $
+ * $Id: README.developer,v 1.96 2004/06/19 00:07:23 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
diff --git a/epan/packet.h b/epan/packet.h
index 62ada4f6b1..3476744e3a 100644
--- a/epan/packet.h
+++ b/epan/packet.h
@@ -1,7 +1,7 @@
/* packet.h
* Definitions for packet disassembly structures and routines
*
- * $Id: packet.h,v 1.73 2004/06/08 05:42:57 ulfl Exp $
+ * $Id: packet.h,v 1.74 2004/06/19 00:07:23 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -25,6 +25,14 @@
#ifndef __PACKET_H__
#define __PACKET_H__
+/*
+ * If <inttypes.h> defines formats to be used to print 64-bit integers,
+ * include it.
+ */
+#ifdef INTTYPES_H_DEFINES_FORMATS
+#include <inttypes.h>
+#endif
+
#include "wiretap/wtap.h"
#include "proto.h"
#include "tvbuff.h"
diff --git a/packet-rsvp.c b/packet-rsvp.c
index 247c0cc959..7a2b45206c 100644
--- a/packet-rsvp.c
+++ b/packet-rsvp.c
@@ -3,7 +3,7 @@
*
* (c) Copyright Ashok Narayanan <ashokn@cisco.com>
*
- * $Id: packet-rsvp.c,v 1.89 2004/05/19 17:45:04 ashokn Exp $
+ * $Id: packet-rsvp.c,v 1.90 2004/06/19 00:07:22 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -2574,7 +2574,7 @@ dissect_rsvp_integrity (proto_tree *ti, tvbuff_t *tvb,
sequence_number <<= 32;
sequence_number = tvb_get_ntohl(tvb, offset2+12);
proto_tree_add_text(rsvp_object_tree, tvb, offset2+8, 8,
- "Sequence Number: %llu", sequence_number);
+ "Sequence Number: %" PRIu64, sequence_number);
proto_tree_add_text(rsvp_object_tree, tvb, offset2+16, obj_length - 20,
"Hash: %s", tvb_bytes_to_str(tvb, offset2+16, obj_length - 20));
}