Ethereal-dev: [Ethereal-dev] Small type/include cleanups
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: Joerg Mayer <jmayer@xxxxxxxxx>
Date: Mon, 15 Jul 2002 01:24:37 +0200
see subject/changelog -- Joerg Mayer <jmayer@xxxxxxxxx> I found out that "pro" means "instead of" (as in proconsul). Now I know what proactive means.
Changelog: <jmayer@xxxxxxxxx>
- packet-ip.c: Change struct addr to guint32 which is the way it is
used anyway.
- packet-pflog.h, packet-pflog.c: Replace NTOHx by their glib.h
equivalents.
- text2pcap.c: Replace our own definitions of TRUE/FALSE by their
glib.h equivalents. Put sys/types.h into ifdefs.
Index: ethereal/packet-ip.c
===================================================================
RCS file: /cvsroot/ethereal/packet-ip.c,v
retrieving revision 1.170
diff -u -r1.170 packet-ip.c
--- packet-ip.c 2002/06/09 01:03:17 1.170
+++ packet-ip.c 2002/07/14 22:15:30
@@ -441,7 +433,7 @@
proto_item *tf;
int ptr;
int optoffset = 0;
- struct in_addr addr;
+ guint32 addr;
tf = proto_tree_add_text(opt_tree, tvb, offset, optlen, "%s (%u bytes)",
optp->name, optlen);
@@ -471,7 +463,7 @@
proto_tree_add_text(field_tree, tvb, offset + optoffset, 4,
"%s%s",
- ((addr.s_addr == 0) ? "-" : (char *)get_hostname(addr.s_addr)),
+ ((addr == 0) ? "-" : (char *)get_hostname(addr)),
((optoffset == ptr) ? " <- (current)" : ""));
optoffset += 4;
optlen -= 4;
@@ -502,7 +494,7 @@
{IPOPT_TS_TSANDADDR, "Time stamp and address" },
{IPOPT_TS_PRESPEC, "Time stamps for prespecified addresses"},
{0, NULL } };
- struct in_addr addr;
+ guint32 addr;
guint ts;
tf = proto_tree_add_text(opt_tree, tvb, offset, optlen, "%s:", optp->name);
@@ -541,7 +533,7 @@
optlen -= 8;
proto_tree_add_text(field_tree, tvb, offset + optoffset, 8,
"Address = %s, time stamp = %u",
- ((addr.s_addr == 0) ? "-" : (char *)get_hostname(addr.s_addr)),
+ ((addr == 0) ? "-" : (char *)get_hostname(addr)),
ts);
optoffset += 8;
} else {
@@ -848,10 +840,10 @@
/* Avoids alignment problems on many architectures. */
tvb_memcpy(tvb, (guint8 *)&iph, offset, sizeof(e_ip));
- iph.ip_len = ntohs(iph.ip_len);
- iph.ip_id = ntohs(iph.ip_id);
- iph.ip_off = ntohs(iph.ip_off);
- iph.ip_sum = ntohs(iph.ip_sum);
+ iph.ip_len = g_ntohs(iph.ip_len);
+ iph.ip_id = g_ntohs(iph.ip_id);
+ iph.ip_off = g_ntohs(iph.ip_off);
+ iph.ip_sum = g_ntohs(iph.ip_sum);
/* Length of IP datagram.
XXX - what if this is greater than the reported length of the
Index: ethereal/packet-pflog.c
===================================================================
RCS file: /cvsroot/ethereal/packet-pflog.c,v
retrieving revision 1.4
diff -u -r1.4 packet-pflog.c
--- packet-pflog.c 2002/04/08 02:02:27 1.4
+++ packet-pflog.c 2002/07/14 22:15:31
@@ -77,7 +73,7 @@
/* Copy out the pflog header to insure alignment */
memcpy(&pflogh, pd, sizeof(pflogh));
- NTOHL(pflogh.af);
+ g_ntohl(pflogh.af);
switch (pflogh.af) {
@@ -141,11 +137,11 @@
tvb_memcpy(tvb, (guint8 *)&pflogh, 0, sizeof(pflogh));
/* Byteswap the header now */
- NTOHL(pflogh.af);
- NTOHS(pflogh.rnr);
- NTOHS(pflogh.reason);
- NTOHS(pflogh.action);
- NTOHS(pflogh.dir);
+ g_ntohl(pflogh.af);
+ g_ntohs(pflogh.rnr);
+ g_ntohs(pflogh.reason);
+ g_ntohs(pflogh.action);
+ g_ntohs(pflogh.dir);
if (tree) {
ti = proto_tree_add_protocol_format(tree, proto_pflog, tvb, 0,
Index: ethereal/packet-pflog.h
===================================================================
RCS file: /cvsroot/ethereal/packet-pflog.h,v
retrieving revision 1.3
diff -u -r1.3 packet-pflog.h
--- packet-pflog.h 2002/02/05 00:43:59 1.3
+++ packet-pflog.h 2002/07/14 22:15:31
@@ -51,20 +51,6 @@
#define PF_IN 0
#define PF_OUT 1
-/* BSDisms */
-#ifndef NTOHL
-# define NTOHL(x) x = ntohl(x)
-#endif
-#ifndef NTOHS
-# define NTOHS(x) x = ntohs(x)
-#endif
-#ifndef HTONL
-# define HTONL(x) x = htonl(x)
-#endif
-#ifndef HTONS
-# define HTONS(x) x = htons(x)
-#endif
-
# define BSD_PF_INET 2
# define BSD_PF_INET6 24
Changelog: <jmayer@xxxxxxxxx>
- packet-ip.c: Replace struct in_addr by guint32, that's the way it is used
anyway.
- packet-pflog.h, packet-pflog.c: Replace NTOHx by their glib.h equivalents.
- text2pcap.c: Replace TRUE,FALSE by their glib equivalents.
Put include sys/types.h into #ifdefs
Index: ethereal/text2pcap.c
===================================================================
RCS file: /cvsroot/ethereal/text2pcap.c,v
retrieving revision 1.18
diff -u -r1.18 text2pcap.c
--- text2pcap.c 2002/06/30 20:28:54 1.18
+++ text2pcap.c 2002/07/14 22:30:36
@@ -93,17 +93,24 @@
#define __USE_XOPEN
#include <time.h>
+#include <glib.h>
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
+
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
+
#ifdef HAVE_WINSOCK2_H
# include <winsock2.h>
#endif
+
#include <errno.h>
#include <assert.h>
@@ -113,14 +120,6 @@
#ifdef NEED_STRPTIME_H
# include "strptime.h"
-#endif
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-
-#ifndef FALSE
-#define FALSE 0
#endif
#include "text2pcap.h"
- Follow-Ups:
- Re: [Ethereal-dev] Small type/include cleanups
- From: Guy Harris
- Re: [Ethereal-dev] Small type/include cleanups
- Prev by Date: Re: [Ethereal-dev] Ethereal coredump when it decodes the RSVP Bun dle message generat ed from Juniper router.
- Next by Date: [Ethereal-dev] Proper checking when saving captures ...
- Previous by thread: RE: [Ethereal-dev] Ethereal coredump when it decodes the RSVP Bun dle message generat ed from Juniper router.
- Next by thread: Re: [Ethereal-dev] Small type/include cleanups
- Index(es):