/* column-utils.c
* Routines for column utilities.
*
- * $Id: column-utils.c,v 1.16 2002/06/29 21:27:39 guy Exp $
+ * $Id: column-utils.c,v 1.17 2002/08/02 21:29:39 jmayer Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
#include <string.h>
#include <time.h>
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
#ifdef NEED_SNPRINTF_H
# include "snprintf.h"
#endif
/* conversation.c
* Routines for building lists of packets that are part of a "conversation"
*
- * $Id: conversation.c,v 1.18 2002/05/09 12:10:06 sahlberg Exp $
+ * $Id: conversation.c,v 1.19 2002/08/02 21:29:39 jmayer Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
#include <stdio.h>
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#ifdef HAVE_NETINET_IN_H
-# include <netinet/in.h>
-#endif
-
#include <string.h>
#include <glib.h>
#include "packet.h"
/* filesystem.c
* Filesystem utility routines
*
- * $Id: filesystem.c,v 1.18 2002/06/23 21:33:09 guy Exp $
+ * $Id: filesystem.c,v 1.19 2002/08/02 21:29:39 jmayer Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
#include <unistd.h>
#endif
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
/* frame_data.c
* Routines for packet disassembly
*
- * $Id: frame_data.c,v 1.1 2001/04/01 04:11:50 hagbard Exp $
+ * $Id: frame_data.c,v 1.2 2002/08/02 21:29:39 jmayer Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
# include "config.h"
#endif
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
#include "frame_data.h"
#include "packet.h"
/* ftypes.h
* Definitions for field types
*
- * $Id: ftypes.h,v 1.11 2002/06/23 10:32:35 guy Exp $
+ * $Id: ftypes.h,v 1.12 2002/08/02 21:29:45 jmayer Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
#include <epan/ipv4.h>
-#ifdef HAVE_WINSOCK2_H
-#include <winsock2.h>
-#endif
-
#include <epan/tvbuff.h>
#include <epan/nstime.h>
#include <epan/dfilter/drange.h>
#include <sys/param.h>
#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-
-#ifdef HAVE_WINSOCK2_H
-#include <winsock2.h>
-#endif
-
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
const char *cp_arg;
struct in_addr *addr;
{
- register const u_char *cp = cp_arg;
- register u_long val;
+ register const guchar *cp = cp_arg;
+ register gulong val;
register int base, n;
- register u_char c;
- u_int parts[4];
- register u_int *pp = parts;
+ register guchar c;
+ guint parts[4];
+ register guint *pp = parts;
for (;;) {
/*
break;
}
if (addr)
- addr->s_addr = htonl(val);
+ addr->s_addr = g_htonl(val);
return (1);
}
#endif
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$Id: inet_ntop.c,v 1.3 2002/06/23 10:32:32 guy Exp $";
+static char rcsid[] = "$Id: inet_ntop.c,v 1.4 2002/08/02 21:29:39 jmayer Exp $";
#endif /* LIBC_SCCS and not lint */
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#define EAFNOSUPPORT WSAEAFNOSUPPORT
#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
*/
-static const char *inet_ntop4 __P((const u_char *src, char *dst, size_t size));
-static const char *inet_ntop6 __P((const u_char *src, char *dst, size_t size));
+static const char *inet_ntop4 __P((const guchar *src, char *dst, size_t size));
+static const char *inet_ntop6 __P((const guchar *src, char *dst, size_t size));
/* char *
* inet_ntop(af, src, dst, size)
* `dst' (as a const)
* notes:
* (1) uses no statics
- * (2) takes a u_char* not an in_addr as input
+ * (2) takes a guchar* not an in_addr as input
* author:
* Paul Vixie, 1996.
*/
static const char *
inet_ntop4(src, dst, size)
- const u_char *src;
+ const guchar *src;
char *dst;
size_t size;
{
*/
static const char *
inet_ntop6(src, dst, size)
- const u_char *src;
+ const guchar *src;
char *dst;
size_t size;
{
*/
char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp;
struct { int base, len; } best, cur;
- u_int words[NS_IN6ADDRSZ / NS_INT16SZ];
+ guint words[NS_IN6ADDRSZ / NS_INT16SZ];
int i;
/*
#endif
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$Id: inet_pton.c,v 1.2 2002/06/23 10:32:32 guy Exp $";
+static char rcsid[] = "$Id: inet_pton.c,v 1.3 2002/08/02 21:29:39 jmayer Exp $";
#endif /* LIBC_SCCS and not lint */
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#define EAFNOSUPPORT WSAEAFNOSUPPORT
#include <sys/socket.h>
#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
*/
#ifdef AF_INET
-static int inet_pton4 __P((const char *src, u_char *dst));
+static int inet_pton4 __P((const char *src, guchar *dst));
#endif
#ifdef AF_INET6
-static int inet_pton6 __P((const char *src, u_char *dst));
+static int inet_pton6 __P((const char *src, guchar *dst));
#endif
/* int
static int
inet_pton4(src, dst)
const char *src;
- u_char *dst;
+ guchar *dst;
{
static const char digits[] = "0123456789";
int saw_digit, octets, ch;
- u_char tmp[NS_INADDRSZ], *tp;
+ guchar tmp[NS_INADDRSZ], *tp;
saw_digit = 0;
octets = 0;
const char *pch;
if ((pch = strchr(digits, ch)) != NULL) {
- u_int new = *tp * 10 + (pch - digits);
+ guint new = *tp * 10 + (pch - digits);
if (new > 255)
return (0);
static int
inet_pton6(src, dst)
const char *src;
- u_char *dst;
+ guchar *dst;
{
static const char xdigits_l[] = "0123456789abcdef",
xdigits_u[] = "0123456789ABCDEF";
- u_char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp;
+ guchar tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp;
const char *xdigits, *curtok;
int ch, saw_xdigit;
- u_int val;
+ guint val;
memset((tp = tmp), '\0', NS_IN6ADDRSZ);
endp = tp + NS_IN6ADDRSZ;
}
if (tp + NS_INT16SZ > endp)
return (0);
- *tp++ = (u_char) (val >> 8) & 0xff;
- *tp++ = (u_char) val & 0xff;
+ *tp++ = (guchar) (val >> 8) & 0xff;
+ *tp++ = (guchar) val & 0xff;
saw_xdigit = 0;
val = 0;
continue;
if (saw_xdigit) {
if (tp + NS_INT16SZ > endp)
return (0);
- *tp++ = (u_char) (val >> 8) & 0xff;
- *tp++ = (u_char) val & 0xff;
+ *tp++ = (guchar) (val >> 8) & 0xff;
+ *tp++ = (guchar) val & 0xff;
}
if (colonp != NULL) {
/*
*
* Gilbert Ramirez <gram@alumni.rice.edu>
*
- * $Id: ipv4.c,v 1.2 2001/11/13 23:55:37 gram Exp $
+ * $Id: ipv4.c,v 1.3 2002/08/02 21:29:39 jmayer Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
#include <glib.h>
#include <stdio.h>
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#ifdef HAVE_NETINET_IN_H
-# include <netinet/in.h>
-#endif
-
#include "ipv4.h"
#include "packet.h" /* for ip_to_str */
void
ipv4_addr_set_net_order_addr(ipv4_addr *ipv4, guint32 new_addr)
{
- ipv4->addr = ntohl(new_addr);
+ ipv4->addr = g_ntohl(new_addr);
}
void
guint32
ipv4_get_net_order_addr(ipv4_addr *ipv4)
{
- return htonl(ipv4->addr);
+ return g_htonl(ipv4->addr);
}
guint32
gchar*
ipv4_addr_str(ipv4_addr *ipv4)
{
- guint32 ipv4_host_order = htonl(ipv4->addr);
+ guint32 ipv4_host_order = g_htonl(ipv4->addr);
return ip_to_str((gchar*)&ipv4_host_order);
}
* Routines for ISO/OSI network and transport protocol packet disassembly
* Main entrance point and common functions
*
- * $Id: osi-utils.c,v 1.6 2002/07/17 00:42:51 guy Exp $
+ * $Id: osi-utils.c,v 1.7 2002/08/02 21:29:39 jmayer Exp $
* Laurent Deniel <deniel@worldnet.fr>
* Ralf Schneider <Ralf.Schneider@t-online.de>
*
# include "config.h"
#endif
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
#include <stdio.h>
#include <glib.h>
/* packet.c
* Routines for packet disassembly
*
- * $Id: packet.c,v 1.74 2002/07/17 00:42:51 guy Exp $
+ * $Id: packet.c,v 1.75 2002/08/02 21:29:39 jmayer Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
# include "config.h"
#endif
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
-#ifdef HAVE_WINSOCK2_H
-#include <winsock2.h>
-#endif
-
#include <glib.h>
#include <stdio.h>
#include <ctype.h>
#include <time.h>
-#ifdef HAVE_NETINET_IN_H
-# include <netinet/in.h>
-#endif
-
-#ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-
#ifdef NEED_INET_V6DEFS_H
# include "inet_v6defs.h"
#endif
/* Creates the top-most tvbuff and calls dissect_frame() */
void
dissect_packet(epan_dissect_t *edt, union wtap_pseudo_header *pseudo_header,
- const u_char *pd, frame_data *fd, column_info *cinfo)
+ const guchar *pd, frame_data *fd, column_info *cinfo)
{
int i;
/* packet.h
* Definitions for packet disassembly structures and routines
*
- * $Id: packet.h,v 1.57 2002/06/04 07:03:54 guy Exp $
+ * $Id: packet.h,v 1.58 2002/08/02 21:29:39 jmayer Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Dissectors should never modify the packet data.
*/
extern void dissect_packet(epan_dissect_t *edt,
- union wtap_pseudo_header *pseudo_header, const u_char *pd,
+ union wtap_pseudo_header *pseudo_header, const guchar *pd,
frame_data *fd, column_info *cinfo);
/* These functions are in packet-ethertype.c */
-extern void capture_ethertype(guint16 etype, const u_char *pd, int offset,
+extern void capture_ethertype(guint16 etype, const guchar *pd, int offset,
int len, packet_counts *ld);
extern void ethertype(guint16 etype, tvbuff_t *tvb, int offset_after_ethertype,
packet_info *pinfo, proto_tree *tree, proto_tree *fh_tree,
* Definitions for extracting and translating integers safely and portably
* via pointers.
*
- * $Id: pint.h,v 1.4 2001/10/29 21:56:48 guy Exp $
+ * $Id: pint.h,v 1.5 2002/08/02 21:29:39 jmayer Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
#include <glib.h>
-/* Pointer versions of ntohs and ntohl. Given a pointer to a member of a
+/* Pointer versions of g_ntohs and g_ntohl. Given a pointer to a member of a
* byte array, returns the value of the two or four bytes at the pointer.
* The pletoh[sl] versions return the little-endian representation.
*/
/* plugins.c
* plugin routines
*
- * $Id: plugins.c,v 1.56 2002/07/16 22:50:48 guy Exp $
+ * $Id: plugins.c,v 1.57 2002/08/02 21:29:39 jmayer Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
#include <sys/stat.h>
#endif
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
/* proto.c
* Routines for protocol tree
*
- * $Id: proto.c,v 1.70 2002/06/19 19:21:15 guy Exp $
+ * $Id: proto.c,v 1.71 2002/08/02 21:29:39 jmayer Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
# include "config.h"
#endif
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
#include <stdio.h>
#include <string.h>
#include <glib.h>
/* proto.h
* Definitions for protocol display
*
- * $Id: proto.h,v 1.33 2002/06/23 10:32:32 guy Exp $
+ * $Id: proto.h,v 1.34 2002/08/02 21:29:39 jmayer Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
# include <varargs.h>
#endif
-#ifdef HAVE_WINSOCK2_H
-# include <winsock2.h>
-#endif
-
#include <glib.h>
#include "ipv4.h"
/* resolv.c
* Routines for network object lookup
*
- * $Id: resolv.c,v 1.23 2002/03/03 21:42:54 guy Exp $
+ * $Id: resolv.c,v 1.24 2002/08/02 21:29:40 jmayer Exp $
*
* Laurent Deniel <deniel@worldnet.fr>
*
#include <unistd.h>
#endif
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
tp->next = NULL;
if (!(g_resolv_flags & RESOLV_TRANSPORT) ||
- (servp = getservbyport(htons(port), serv_proto)) == NULL) {
+ (servp = getservbyport(g_htons(port), serv_proto)) == NULL) {
/* unknown port */
sprintf(tp->name, "%d", port);
} else {
return FALSE;
}
- *addrp = ntohl(ipaddr.s_addr);
+ *addrp = g_ntohl(ipaddr.s_addr);
return TRUE;
}
/* strutil.c
* String utility routines
*
- * $Id: strutil.c,v 1.7 2000/12/22 12:05:36 gram Exp $
+ * $Id: strutil.c,v 1.8 2002/08/02 21:29:40 jmayer Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
* buffer.
* Return a pointer to the EOL character(s) in "*eol".
*/
-const u_char *
-find_line_end(const u_char *data, const u_char *dataend, const u_char **eol)
+const guchar *
+find_line_end(const guchar *data, const guchar *dataend, const guchar **eol)
{
- const u_char *lineend;
+ const guchar *lineend;
lineend = memchr(data, '\n', dataend - data);
if (lineend == NULL) {
* Return 0 if there is no next token.
*/
int
-get_token_len(const u_char *linep, const u_char *lineend,
- const u_char **next_token)
+get_token_len(const guchar *linep, const guchar *lineend,
+ const guchar **next_token)
{
- const u_char *tokenp;
+ const guchar *tokenp;
int token_len;
tokenp = linep;
* characters as C-style escapes, and return a pointer to it.
*/
gchar *
-format_text(const u_char *string, int len)
+format_text(const guchar *string, int len)
{
static gchar *fmtbuf;
static int fmtbuf_len;
int column;
- const u_char *stringend = string + len;
- u_char c;
+ const guchar *stringend = string + len;
+ guchar c;
int i;
/*
/* strutil.h
* String utility definitions
*
- * $Id: strutil.h,v 1.7 2002/06/23 10:32:32 guy Exp $
+ * $Id: strutil.h,v 1.8 2002/08/02 21:29:40 jmayer Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
/* ... thus, config.h needs to be #included */
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h> /* for u_char */
-#endif
-
-#ifdef HAVE_WINSOCK2_H
-# include <winsock2.h> /* for u_char */
-#endif
-
-const u_char *find_line_end(const u_char *data, const u_char *dataend,
- const u_char **eol);
-int get_token_len(const u_char *linep, const u_char *lineend,
- const u_char **next_token);
-gchar* format_text(const u_char *line, int len);
+const guchar *find_line_end(const guchar *data, const guchar *dataend,
+ const guchar **eol);
+int get_token_len(const guchar *linep, const guchar *lineend,
+ const guchar **next_token);
+gchar* format_text(const guchar *line, int len);
gchar* bytes_to_str(const guint8 *, int);
gchar* bytes_to_str_punct(const guint8 *, int, gchar punct);
#endif /* __STRUTIL_H__ */
/* to_str.c
* Routines for utilities to convert various other types to strings.
*
- * $Id: to_str.c,v 1.14 2002/06/23 10:32:32 guy Exp $
+ * $Id: to_str.c,v 1.15 2002/08/02 21:29:40 jmayer Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
#include <stdlib.h>
#include <string.h>
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#ifdef HAVE_WINSOCK2_H
-# include <winsock2.h> /* for "u_char" */
-#endif
-
#ifdef NEED_SNPRINTF_H
# include "snprintf.h"
#endif
-#ifdef HAVE_NETINET_IN_H
-# include <netinet/in.h>
-#endif
-
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#endif
static gchar buf[INET6_ADDRSTRLEN];
- inet_ntop(AF_INET6, (u_char*)ad, (gchar*)buf, sizeof(buf));
+ inet_ntop(AF_INET6, (guchar*)ad, (gchar*)buf, sizeof(buf));
return buf;
}
/* to_str.h
* Definitions for utilities to convert various other types to strings.
*
- * $Id: to_str.h,v 1.6 2002/05/05 00:16:34 guy Exp $
+ * $Id: to_str.h,v 1.7 2002/08/02 21:29:40 jmayer Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
#include <glib.h>
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#ifdef HAVE_NETINET_IN_H
-# include <netinet/in.h>
-#endif
-
#include "nstime.h"
/*
* the data of a backing tvbuff, or can be a composite of
* other tvbuffs.
*
- * $Id: tvbuff.c,v 1.38 2002/07/17 06:55:24 guy Exp $
+ * $Id: tvbuff.c,v 1.39 2002/08/02 21:29:40 jmayer Exp $
*
* Copyright (c) 2000 by Gilbert Ramirez <gram@alumni.rice.edu>
*
{
gint cur_offset, char_offset;
gboolean is_quoted;
- u_char c;
+ guchar c;
gint eob_offset;
int linelen;