Ethereal-dev: [Ethereal-dev] types/include cleanup in wiretap/
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: Sun, 28 Jul 2002 03:26:43 +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> All files: - Replace types from sys/types.h by those from glib.h - Replace ntoh family of macros from netinet/in.h and winsock2.h by g_ntoh family from glib.h - Remove now unneeded includes of sys/types.h, netinet/in.h and winsock2.h wtap.h Move includes to the top Index: ethereal/wiretap/buffer.c =================================================================== RCS file: /cvsroot/ethereal/wiretap/buffer.c,v retrieving revision 1.12 diff -u -r1.12 buffer.c --- buffer.c 2001/11/13 23:55:43 1.12 +++ buffer.c 2002/07/28 01:09:58 @@ -29,16 +29,12 @@ #include <string.h> #include <glib.h> -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif - #include "buffer.h" /* Initializes a buffer with a certain amount of allocated space */ void buffer_init(Buffer* buffer, unsigned int space) { - buffer->data = (u_char*)g_malloc(space); + buffer->data = (guchar*)g_malloc(space); buffer->allocated = space; buffer->start = 0; buffer->first_free = 0; @@ -88,10 +84,10 @@ /* We'll allocate more space */ buffer->allocated += space + 1024; - buffer->data = (u_char*)g_realloc(buffer->data, buffer->allocated); + buffer->data = (guchar*)g_realloc(buffer->data, buffer->allocated); } -void buffer_append(Buffer* buffer, u_char *from, unsigned int bytes) +void buffer_append(Buffer* buffer, guchar *from, unsigned int bytes) { buffer_assure_space(buffer, bytes); memcpy(buffer->data + buffer->first_free, from, bytes); @@ -129,14 +125,14 @@ #endif #ifndef SOME_FUNCTIONS_ARE_DEFINES -u_char* buffer_start_ptr(Buffer* buffer) +guchar* buffer_start_ptr(Buffer* buffer) { return buffer->data + buffer->start; } #endif #ifndef SOME_FUNCTIONS_ARE_DEFINES -u_char* buffer_end_ptr(Buffer* buffer) +guchar* buffer_end_ptr(Buffer* buffer) { return buffer->data + buffer->first_free; } Index: ethereal/wiretap/buffer.h =================================================================== RCS file: /cvsroot/ethereal/wiretap/buffer.h,v retrieving revision 1.9 diff -u -r1.9 buffer.h --- buffer.h 2002/06/23 10:32:36 1.9 +++ buffer.h 2002/07/28 01:09:58 @@ -26,12 +26,8 @@ #define SOME_FUNCTIONS_ARE_DEFINES -#ifdef HAVE_WINSOCK2_H -#include <winsock2.h> /* to define u_char */ -#endif - typedef struct Buffer { - u_char *data; + guchar *data; unsigned int allocated; unsigned int start; unsigned int first_free; @@ -40,7 +36,7 @@ void buffer_init(Buffer* buffer, unsigned int space); void buffer_free(Buffer* buffer); void buffer_assure_space(Buffer* buffer, unsigned int space); -void buffer_append(Buffer* buffer, u_char *from, unsigned int bytes); +void buffer_append(Buffer* buffer, guchar *from, unsigned int bytes); void buffer_remove_start(Buffer* buffer, unsigned int bytes); #ifdef SOME_FUNCTIONS_ARE_DEFINES @@ -51,8 +47,8 @@ #else void buffer_increase_length(Buffer* buffer, unsigned int bytes); unsigned int buffer_length(Buffer* buffer); - u_char* buffer_start_ptr(Buffer* buffer); - u_char* buffer_end_ptr(Buffer* buffer); + guchar* buffer_start_ptr(Buffer* buffer); + guchar* buffer_end_ptr(Buffer* buffer); #endif #endif Index: ethereal/wiretap/etherpeek.c =================================================================== RCS file: /cvsroot/ethereal/wiretap/etherpeek.c,v retrieving revision 1.20 diff -u -r1.20 etherpeek.c --- etherpeek.c 2002/06/07 07:27:34 1.20 +++ etherpeek.c 2002/07/28 01:09:59 @@ -31,10 +31,6 @@ #include "file_wrappers.h" #include "buffer.h" #include "etherpeek.h" -#ifdef HAVE_NETINET_IN_H -#include <netinet/in.h> -#endif - /* CREDITS * * This file decoder could not have been writen without examining how @@ -142,7 +138,7 @@ static gboolean etherpeek_read_v7(wtap *wth, int *err, long *data_offset); static gboolean etherpeek_seek_read_v7(wtap *wth, long seek_off, - union wtap_pseudo_header *pseudo_header, u_char *pd, int length, int *err); + union wtap_pseudo_header *pseudo_header, guchar *pd, int length, int *err); static gboolean etherpeek_read_v56(wtap *wth, int *err, long *data_offset); static void etherpeek_close(wtap *wth); @@ -195,9 +191,9 @@ * we can get. */ ep_hdr.secondary.v567.mediaType = - ntohl(ep_hdr.secondary.v567.mediaType); + g_ntohl(ep_hdr.secondary.v567.mediaType); ep_hdr.secondary.v567.physMedium = - ntohl(ep_hdr.secondary.v567.physMedium); + g_ntohl(ep_hdr.secondary.v567.physMedium); switch (ep_hdr.secondary.v567.physMedium) { @@ -265,19 +261,19 @@ * uncompressed, but it might be compressed. */ ep_hdr.secondary.v567.filelength = - ntohl(ep_hdr.secondary.v567.filelength); + g_ntohl(ep_hdr.secondary.v567.filelength); ep_hdr.secondary.v567.numPackets = - ntohl(ep_hdr.secondary.v567.numPackets); + g_ntohl(ep_hdr.secondary.v567.numPackets); ep_hdr.secondary.v567.timeDate = - ntohl(ep_hdr.secondary.v567.timeDate); + g_ntohl(ep_hdr.secondary.v567.timeDate); ep_hdr.secondary.v567.timeStart = - ntohl(ep_hdr.secondary.v567.timeStart); + g_ntohl(ep_hdr.secondary.v567.timeStart); ep_hdr.secondary.v567.timeStop = - ntohl(ep_hdr.secondary.v567.timeStop); + g_ntohl(ep_hdr.secondary.v567.timeStop); ep_hdr.secondary.v567.appVers = - ntohl(ep_hdr.secondary.v567.appVers); + g_ntohl(ep_hdr.secondary.v567.appVers); ep_hdr.secondary.v567.linkSpeed = - ntohl(ep_hdr.secondary.v567.linkSpeed); + g_ntohl(ep_hdr.secondary.v567.linkSpeed); /* Get the reference time as a "struct timeval" */ reference_time.tv_sec = @@ -442,7 +438,7 @@ static gboolean etherpeek_seek_read_v7(wtap *wth, long seek_off, - union wtap_pseudo_header *pseudo_header, u_char *pd, int length, int *err) + union wtap_pseudo_header *pseudo_header, guchar *pd, int length, int *err) { airopeek_radio_hdr_t radio_hdr; Index: ethereal/wiretap/file.c =================================================================== RCS file: /cvsroot/ethereal/wiretap/file.c,v retrieving revision 1.94 diff -u -r1.94 file.c --- file.c 2002/07/16 07:15:08 1.94 +++ file.c 2002/07/28 01:09:59 @@ -646,7 +646,7 @@ } gboolean wtap_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const u_char *pd, int *err) + const union wtap_pseudo_header *pseudo_header, const guchar *pd, int *err) { return (wdh->subtype_write)(wdh, phdr, pseudo_header, pd, err); } Index: ethereal/wiretap/i4btrace.c =================================================================== RCS file: /cvsroot/ethereal/wiretap/i4btrace.c,v retrieving revision 1.21 diff -u -r1.21 i4btrace.c --- i4btrace.c 2002/06/07 07:27:34 1.21 +++ i4btrace.c 2002/07/28 01:09:59 @@ -34,10 +34,10 @@ static gboolean i4btrace_read(wtap *wth, int *err, long *data_offset); static gboolean i4btrace_seek_read(wtap *wth, long seek_off, - union wtap_pseudo_header *pseudo_header, u_char *pd, int length, int *err); + union wtap_pseudo_header *pseudo_header, guchar *pd, int length, int *err); static int i4b_read_rec_header(FILE_T fh, i4b_trace_hdr_t *hdr, int *err); static void i4b_byte_swap_header(wtap *wth, i4b_trace_hdr_t *hdr); -static gboolean i4b_read_rec_data(FILE_T fh, u_char *pd, int length, int *err); +static gboolean i4b_read_rec_data(FILE_T fh, guchar *pd, int length, int *err); static void i4b_set_pseudo_header(wtap *wth, i4b_trace_hdr_t *hdr, union wtap_pseudo_header *pseudo_header); static void i4btrace_close(wtap *wth); @@ -223,7 +223,7 @@ static gboolean i4btrace_seek_read(wtap *wth, long seek_off, - union wtap_pseudo_header *pseudo_header, u_char *pd, int length, int *err) + union wtap_pseudo_header *pseudo_header, guchar *pd, int length, int *err) { int ret; i4b_trace_hdr_t hdr; @@ -290,7 +290,7 @@ } static gboolean -i4b_read_rec_data(FILE_T fh, u_char *pd, int length, int *err) +i4b_read_rec_data(FILE_T fh, guchar *pd, int length, int *err) { int bytes_read; Index: ethereal/wiretap/iptrace.c =================================================================== RCS file: /cvsroot/ethereal/wiretap/iptrace.c,v retrieving revision 1.41 diff -u -r1.41 iptrace.c --- iptrace.c 2002/06/07 07:27:34 1.41 +++ iptrace.c 2002/07/28 01:10:00 @@ -34,12 +34,12 @@ static gboolean iptrace_read_1_0(wtap *wth, int *err, long *data_offset); static gboolean iptrace_seek_read_1_0(wtap *wth, long seek_off, - union wtap_pseudo_header *pseudo_header, u_char *pd, int packet_size, + union wtap_pseudo_header *pseudo_header, guchar *pd, int packet_size, int *err); static gboolean iptrace_read_2_0(wtap *wth, int *err, long *data_offset); static gboolean iptrace_seek_read_2_0(wtap *wth, long seek_off, - union wtap_pseudo_header *pseudo_header, u_char *pd, int packet_size, + union wtap_pseudo_header *pseudo_header, guchar *pd, int packet_size, int *err); static int iptrace_read_rec_header(FILE_T fh, guint8 *header, int header_len, @@ -166,7 +166,7 @@ } static gboolean iptrace_seek_read_1_0(wtap *wth, long seek_off, - union wtap_pseudo_header *pseudo_header, u_char *pd, int packet_size, + union wtap_pseudo_header *pseudo_header, guchar *pd, int packet_size, int *err) { int ret; @@ -287,7 +287,7 @@ } static gboolean iptrace_seek_read_2_0(wtap *wth, long seek_off, - union wtap_pseudo_header *pseudo_header, u_char *pd, int packet_size, + union wtap_pseudo_header *pseudo_header, guchar *pd, int packet_size, int *err) { int ret; Index: ethereal/wiretap/lanalyzer.c =================================================================== RCS file: /cvsroot/ethereal/wiretap/lanalyzer.c,v retrieving revision 1.35 diff -u -r1.35 lanalyzer.c --- lanalyzer.c 2002/07/16 07:15:08 1.35 +++ lanalyzer.c 2002/07/28 01:10:00 @@ -487,7 +487,7 @@ static gboolean lanalyzer_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, const union wtap_pseudo_header *pseudo_header _U_, - const u_char *pd, int *err) + const guchar *pd, int *err) { double x; int i; Index: ethereal/wiretap/libpcap.c =================================================================== RCS file: /cvsroot/ethereal/wiretap/libpcap.c,v retrieving revision 1.79 diff -u -r1.79 libpcap.c --- libpcap.c 2002/07/16 07:15:08 1.79 +++ libpcap.c 2002/07/28 01:10:01 @@ -23,6 +23,7 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif + #include <stdlib.h> #include <errno.h> #include "wtap-int.h" @@ -31,6 +33,9 @@ #include "libpcap.h" #ifdef HAVE_PCAP_H +# ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +# endif #include <pcap.h> #include "wtap-capture.h" #endif @@ -62,7 +67,7 @@ static gboolean libpcap_read(wtap *wth, int *err, long *data_offset); static gboolean libpcap_seek_read(wtap *wth, long seek_off, - union wtap_pseudo_header *pseudo_header, u_char *pd, int length, int *err); + union wtap_pseudo_header *pseudo_header, guchar *pd, int length, int *err); static int libpcap_read_header(wtap *wth, int *err, struct pcaprec_ss990915_hdr *hdr, gboolean silent); static void adjust_header(wtap *wth, struct pcaprec_hdr *hdr); @@ -70,11 +75,11 @@ union wtap_pseudo_header *pseudo_header); static gboolean libpcap_read_atm_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, int *err); -static gboolean libpcap_read_rec_data(FILE_T fh, u_char *pd, int length, +static gboolean libpcap_read_rec_data(FILE_T fh, guchar *pd, int length, int *err); static void libpcap_close(wtap *wth); static gboolean libpcap_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const u_char *pd, int *err); + const union wtap_pseudo_header *pseudo_header, const guchar *pd, int *err); /* * Either LBL NRG wasn't an adequate central registry (e.g., because of @@ -898,7 +903,7 @@ static gboolean libpcap_seek_read(wtap *wth, long seek_off, - union wtap_pseudo_header *pseudo_header, u_char *pd, int length, int *err) + union wtap_pseudo_header *pseudo_header, guchar *pd, int length, int *err) { if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) return FALSE; @@ -1138,7 +1143,7 @@ } static gboolean -libpcap_read_rec_data(FILE_T fh, u_char *pd, int length, int *err) +libpcap_read_rec_data(FILE_T fh, guchar *pd, int length, int *err) { int bytes_read; @@ -1187,9 +1192,9 @@ * fill in the Wiretap packet header, and return a pointer to the * beginning of the non-pseudo-header data in the packet. */ -const u_char * +const guchar * wtap_process_pcap_packet(gint linktype, const struct pcap_pkthdr *phdr, - const u_char *pd, union wtap_pseudo_header *pseudo_header, + const guchar *pd, union wtap_pseudo_header *pseudo_header, struct wtap_pkthdr *whdr, int *err) { /* "phdr->ts" may not necessarily be a "struct timeval" - it may @@ -1327,7 +1332,7 @@ static gboolean libpcap_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, const union wtap_pseudo_header *pseudo_header _U_, - const u_char *pd, int *err) + const guchar *pd, int *err) { struct pcaprec_ss990915_hdr rec_hdr; size_t hdr_size; Index: ethereal/wiretap/netmon.c =================================================================== RCS file: /cvsroot/ethereal/wiretap/netmon.c,v retrieving revision 1.57 diff -u -r1.57 netmon.c --- netmon.c 2002/07/16 07:15:08 1.57 +++ netmon.c 2002/07/28 01:10:01 @@ -29,10 +29,6 @@ #include "file_wrappers.h" #include "buffer.h" #include "netmon.h" -#ifdef HAVE_NETINET_IN_H -#include <netinet/in.h> -#endif - /* The file at * * ftp://ftp.microsoft.com/developr/drg/cifs/cifs/Bhfile.zip @@ -108,15 +104,15 @@ static gboolean netmon_read(wtap *wth, int *err, long *data_offset); static gboolean netmon_seek_read(wtap *wth, long seek_off, - union wtap_pseudo_header *pseudo_header, u_char *pd, int length, int *err); + union wtap_pseudo_header *pseudo_header, guchar *pd, int length, int *err); static gboolean netmon_read_atm_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, int *err); -static gboolean netmon_read_rec_data(FILE_T fh, u_char *pd, int length, +static gboolean netmon_read_rec_data(FILE_T fh, guchar *pd, int length, int *err); static void netmon_sequential_close(wtap *wth); static void netmon_close(wtap *wth); static gboolean netmon_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const u_char *pd, int *err); + const union wtap_pseudo_header *pseudo_header, const guchar *pd, int *err); static gboolean netmon_dump_close(wtap_dumper *wdh, int *err); int netmon_open(wtap *wth, int *err) @@ -447,7 +443,7 @@ static gboolean netmon_seek_read(wtap *wth, long seek_off, - union wtap_pseudo_header *pseudo_header, u_char *pd, int length, int *err) + union wtap_pseudo_header *pseudo_header, guchar *pd, int length, int *err) { if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) return FALSE; @@ -483,8 +479,8 @@ return FALSE; } - vpi = ntohs(atm_phdr.vpi); - vci = ntohs(atm_phdr.vci); + vpi = g_ntohs(atm_phdr.vpi); + vci = g_ntohs(atm_phdr.vci); /* * Assume it's AAL5, unless it's VPI 0 and VCI 5, in which case @@ -511,7 +507,7 @@ } static gboolean -netmon_read_rec_data(FILE_T fh, u_char *pd, int length, int *err) +netmon_read_rec_data(FILE_T fh, guchar *pd, int length, int *err) { int bytes_read; @@ -616,7 +612,7 @@ /* Write a record for a packet to a dump file. Returns TRUE on success, FALSE on failure. */ static gboolean netmon_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const u_char *pd, int *err) + const union wtap_pseudo_header *pseudo_header, const guchar *pd, int *err) { netmon_dump_t *netmon = wdh->dump.netmon; struct netmonrec_1_x_hdr rec_1_x_hdr; @@ -696,8 +692,8 @@ */ memset(&atm_hdr.dest, 0, sizeof atm_hdr.dest); memset(&atm_hdr.src, 0, sizeof atm_hdr.src); - atm_hdr.vpi = htons(pseudo_header->atm.vpi); - atm_hdr.vci = htons(pseudo_header->atm.vci); + atm_hdr.vpi = g_htons(pseudo_header->atm.vpi); + atm_hdr.vci = g_htons(pseudo_header->atm.vci); nwritten = fwrite(&atm_hdr, 1, sizeof atm_hdr, wdh->fh); if (nwritten != sizeof atm_hdr) { if (nwritten == 0 && ferror(wdh->fh)) Index: ethereal/wiretap/nettl.c =================================================================== RCS file: /cvsroot/ethereal/wiretap/nettl.c,v retrieving revision 1.29 diff -u -r1.29 nettl.c --- nettl.c 2002/06/07 07:27:35 1.29 +++ nettl.c 2002/07/28 01:10:03 @@ -32,10 +32,10 @@ #include "buffer.h" #include "nettl.h" -static u_char nettl_magic_hpux9[12] = { +static guchar nettl_magic_hpux9[12] = { 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xD0, 0x00 }; -static u_char nettl_magic_hpux10[12] = { +static guchar nettl_magic_hpux10[12] = { 0x54, 0x52, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80 }; @@ -125,12 +125,12 @@ static gboolean nettl_read(wtap *wth, int *err, long *data_offset); static gboolean nettl_seek_read(wtap *wth, long seek_off, - union wtap_pseudo_header *pseudo_header, u_char *pd, + union wtap_pseudo_header *pseudo_header, guchar *pd, int length, int *err); static int nettl_read_rec_header(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, union wtap_pseudo_header *pseudo_header, int *err); -static gboolean nettl_read_rec_data(FILE_T fh, u_char *pd, int length, +static gboolean nettl_read_rec_data(FILE_T fh, guchar *pd, int length, int *err); static void nettl_close(wtap *wth); @@ -212,7 +212,7 @@ static gboolean nettl_seek_read(wtap *wth, long seek_off, - union wtap_pseudo_header *pseudo_header, u_char *pd, + union wtap_pseudo_header *pseudo_header, guchar *pd, int length, int *err) { int ret; @@ -443,7 +443,7 @@ } static gboolean -nettl_read_rec_data(FILE_T fh, u_char *pd, int length, int *err) +nettl_read_rec_data(FILE_T fh, guchar *pd, int length, int *err) { int bytes_read; Index: ethereal/wiretap/netxray.c =================================================================== RCS file: /cvsroot/ethereal/wiretap/netxray.c,v retrieving revision 1.57 diff -u -r1.57 netxray.c --- netxray.c 2002/07/16 07:15:09 1.57 +++ netxray.c 2002/07/28 01:10:03 @@ -130,7 +130,7 @@ static gboolean netxray_read(wtap *wth, int *err, long *data_offset); static gboolean netxray_seek_read(wtap *wth, long seek_off, - union wtap_pseudo_header *pseudo_header, u_char *pd, int length, int *err); + union wtap_pseudo_header *pseudo_header, guchar *pd, int length, int *err); static int netxray_read_rec_header(wtap *wth, FILE_T fh, union netxrayrec_hdr *hdr, int *err); static void netxray_set_pseudo_header(wtap *wth, @@ -140,11 +140,11 @@ static void netxray_close(wtap *wth); static gboolean netxray_dump_1_1(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const u_char *pd, int *err); + const union wtap_pseudo_header *pseudo_header, const guchar *pd, int *err); static gboolean netxray_dump_close_1_1(wtap_dumper *wdh, int *err); static gboolean netxray_dump_2_0(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const u_char *pd, int *err); + const union wtap_pseudo_header *pseudo_header, const guchar *pd, int *err); static gboolean netxray_dump_close_2_0(wtap_dumper *wdh, int *err); int netxray_open(wtap *wth, int *err) @@ -404,7 +404,7 @@ static gboolean netxray_seek_read(wtap *wth, long seek_off, - union wtap_pseudo_header *pseudo_header, u_char *pd, int length, int *err) + union wtap_pseudo_header *pseudo_header, guchar *pd, int length, int *err) { union netxrayrec_hdr hdr; @@ -585,7 +585,7 @@ static gboolean netxray_dump_1_1(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, const union wtap_pseudo_header *pseudo_header _U_, - const u_char *pd, int *err) + const guchar *pd, int *err) { netxray_dump_t *netxray = wdh->dump.netxray; guint32 timestamp; @@ -732,7 +732,7 @@ static gboolean netxray_dump_2_0(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, const union wtap_pseudo_header *pseudo_header _U_, - const u_char *pd, int *err) + const guchar *pd, int *err) { netxray_dump_t *netxray = wdh->dump.netxray; guint32 timestamp; Index: ethereal/wiretap/ngsniffer.c =================================================================== RCS file: /cvsroot/ethereal/wiretap/ngsniffer.c,v retrieving revision 1.83 diff -u -r1.83 ngsniffer.c --- ngsniffer.c 2002/07/16 07:15:09 1.83 +++ ngsniffer.c 2002/07/28 01:10:06 @@ -286,7 +286,7 @@ static int skip_header_records(wtap *wth, int *err, gint16 version); static gboolean ngsniffer_read(wtap *wth, int *err, long *data_offset); static gboolean ngsniffer_seek_read(wtap *wth, long seek_off, - union wtap_pseudo_header *pseudo_header, u_char *pd, int packet_size, + union wtap_pseudo_header *pseudo_header, guchar *pd, int packet_size, int *err); static int ngsniffer_read_rec_header(wtap *wth, gboolean is_random, guint16 *typep, guint16 *lengthp, int *err); @@ -303,13 +303,13 @@ static void set_pseudo_header_frame6(union wtap_pseudo_header *pseudo_header, struct frame6_rec *frame6); static gboolean ngsniffer_read_rec_data(wtap *wth, gboolean is_random, - u_char *pd, int length, int *err); + guchar *pd, int length, int *err); static void fix_pseudo_header(wtap *wth, union wtap_pseudo_header *pseudo_header); static void ngsniffer_sequential_close(wtap *wth); static void ngsniffer_close(wtap *wth); static gboolean ngsniffer_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const u_char *pd, int *err); + const union wtap_pseudo_header *pseudo_header, const guchar *pd, int *err); static gboolean ngsniffer_dump_close(wtap_dumper *wdh, int *err); static int SnifferDecompress( unsigned char * inbuf, size_t inlen, unsigned char * outbuf, size_t outlen, int *err ); @@ -659,7 +659,7 @@ struct frame6_rec frame6; double t; guint16 time_low, time_med, time_high, true_size, size; - u_char *pd; + guchar *pd; for (;;) { /* @@ -870,7 +870,7 @@ } static gboolean ngsniffer_seek_read(wtap *wth, long seek_off, - union wtap_pseudo_header *pseudo_header, u_char *pd, int packet_size, + union wtap_pseudo_header *pseudo_header, guchar *pd, int packet_size, int *err) { int ret; @@ -1309,7 +1309,7 @@ } static gboolean ngsniffer_read_rec_data(wtap *wth, gboolean is_random, - u_char *pd, int length, int *err) + guchar *pd, int length, int *err) { int bytes_read; @@ -1438,7 +1438,7 @@ /* Write a record for a packet to a dump file. Returns TRUE on success, FALSE on failure. */ static gboolean ngsniffer_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const u_char *pd, int *err) + const union wtap_pseudo_header *pseudo_header, const guchar *pd, int *err) { ngsniffer_dump_t *priv = wdh->dump.ngsniffer; struct frame2_rec rec_hdr; Index: ethereal/wiretap/radcom.c =================================================================== RCS file: /cvsroot/ethereal/wiretap/radcom.c,v retrieving revision 1.37 diff -u -r1.37 radcom.c --- radcom.c 2002/06/07 07:27:35 1.37 +++ radcom.c 2002/07/28 01:10:07 @@ -69,11 +69,11 @@ static gboolean radcom_read(wtap *wth, int *err, long *data_offset); static gboolean radcom_seek_read(wtap *wth, long seek_off, - union wtap_pseudo_header *pseudo_header, u_char *pd, int length, + union wtap_pseudo_header *pseudo_header, guchar *pd, int length, int *err); static int radcom_read_rec_header(FILE_T fh, struct radcomrec_hdr *hdr, int *err); -static gboolean radcom_read_rec_data(FILE_T fh, u_char *pd, int length, +static gboolean radcom_read_rec_data(FILE_T fh, guchar *pd, int length, int *err); int radcom_open(wtap *wth, int *err) @@ -297,7 +297,7 @@ static gboolean radcom_seek_read(wtap *wth, long seek_off, - union wtap_pseudo_header *pseudo_header, u_char *pd, int length, int *err) + union wtap_pseudo_header *pseudo_header, guchar *pd, int length, int *err) { int ret; struct radcomrec_hdr hdr; @@ -345,7 +345,7 @@ } static gboolean -radcom_read_rec_data(FILE_T fh, u_char *pd, int length, int *err) +radcom_read_rec_data(FILE_T fh, guchar *pd, int length, int *err) { int bytes_read; Index: ethereal/wiretap/snoop.c =================================================================== RCS file: /cvsroot/ethereal/wiretap/snoop.c,v retrieving revision 1.53 diff -u -r1.53 snoop.c --- snoop.c 2002/07/16 07:15:09 1.53 +++ snoop.c 2002/07/28 01:10:07 @@ -30,10 +30,6 @@ #include "buffer.h" #include "atm.h" #include "snoop.h" -#ifdef HAVE_NETINET_IN_H -#include <netinet/in.h> -#endif - /* See RFC 1761 for a description of the "snoop" file format. */ /* Magic number in "snoop" files. */ @@ -68,13 +64,13 @@ static gboolean snoop_read(wtap *wth, int *err, long *data_offset); static gboolean snoop_seek_read(wtap *wth, long seek_off, - union wtap_pseudo_header *pseudo_header, u_char *pd, int length, int *err); + union wtap_pseudo_header *pseudo_header, guchar *pd, int length, int *err); static gboolean snoop_read_atm_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, int *err); -static gboolean snoop_read_rec_data(FILE_T fh, u_char *pd, int length, +static gboolean snoop_read_rec_data(FILE_T fh, guchar *pd, int length, int *err); static gboolean snoop_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const u_char *pd, int *err); + const union wtap_pseudo_header *pseudo_header, const guchar *pd, int *err); /* * See @@ -260,8 +256,8 @@ * only for padding, but if there's more, it's probably a Shomiti * tool, which uses the padding for additional information. */ - hdr.version = ntohl(hdr.version); - hdr.network = ntohl(hdr.network); + hdr.version = g_ntohl(hdr.version); + hdr.network = g_ntohl(hdr.network); switch (hdr.version) { case 2: /* Solaris 2.x and later snoop, and Shomiti @@ -328,9 +324,9 @@ } wth->data_offset += sizeof hdr; - rec_size = ntohl(hdr.rec_len); - orig_size = ntohl(hdr.orig_len); - packet_size = ntohl(hdr.incl_len); + rec_size = g_ntohl(hdr.rec_len); + orig_size = g_ntohl(hdr.orig_len); + packet_size = g_ntohl(hdr.incl_len); if (packet_size > WTAP_MAX_PACKET_SIZE) { /* * Probably a corrupt capture file; don't blow up trying @@ -380,8 +376,8 @@ return FALSE; /* Read error */ wth->data_offset += packet_size; - wth->phdr.ts.tv_sec = ntohl(hdr.ts_sec); - wth->phdr.ts.tv_usec = ntohl(hdr.ts_usec); + wth->phdr.ts.tv_sec = g_ntohl(hdr.ts_sec); + wth->phdr.ts.tv_usec = g_ntohl(hdr.ts_usec); wth->phdr.caplen = packet_size; wth->phdr.len = orig_size; wth->phdr.pkt_encap = wth->file_encap; @@ -425,7 +421,7 @@ static gboolean snoop_seek_read(wtap *wth, long seek_off, - union wtap_pseudo_header *pseudo_header, u_char *pd, int length, int *err) + union wtap_pseudo_header *pseudo_header, guchar *pd, int length, int *err) { if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) return FALSE; @@ -547,7 +543,7 @@ } static gboolean -snoop_read_rec_data(FILE_T fh, u_char *pd, int length, int *err) +snoop_read_rec_data(FILE_T fh, guchar *pd, int length, int *err) { int bytes_read; @@ -617,8 +613,8 @@ } /* current "snoop" format is 2 */ - file_hdr.version = htonl(2); - file_hdr.network = htonl(wtap_encap[wdh->encap]); + file_hdr.version = g_htonl(2); + file_hdr.network = g_htonl(wtap_encap[wdh->encap]); nwritten = fwrite(&file_hdr, 1, sizeof file_hdr, wdh->fh); if (nwritten != sizeof file_hdr) { if (nwritten == 0 && ferror(wdh->fh)) @@ -636,7 +632,7 @@ static gboolean snoop_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, const union wtap_pseudo_header *pseudo_header _U_, - const u_char *pd, int *err) + const guchar *pd, int *err) { struct snooprec_hdr rec_hdr; size_t nwritten; @@ -658,12 +654,12 @@ padlen = ((reclen + 3) & ~3) - reclen; reclen += padlen; - rec_hdr.orig_len = htonl(phdr->len + atm_hdrsize); - rec_hdr.incl_len = htonl(phdr->caplen + atm_hdrsize); - rec_hdr.rec_len = htonl(reclen); + rec_hdr.orig_len = g_htonl(phdr->len + atm_hdrsize); + rec_hdr.incl_len = g_htonl(phdr->caplen + atm_hdrsize); + rec_hdr.rec_len = g_htonl(reclen); rec_hdr.cum_drops = 0; - rec_hdr.ts_sec = htonl(phdr->ts.tv_sec); - rec_hdr.ts_usec = htonl(phdr->ts.tv_usec); + rec_hdr.ts_sec = g_htonl(phdr->ts.tv_sec); + rec_hdr.ts_usec = g_htonl(phdr->ts.tv_usec); nwritten = fwrite(&rec_hdr, 1, sizeof rec_hdr, wdh->fh); if (nwritten != sizeof rec_hdr) { if (nwritten == 0 && ferror(wdh->fh)) @@ -707,7 +703,7 @@ break; } atm_hdr.vpi = pseudo_header->atm.vpi; - atm_hdr.vci = htons(pseudo_header->atm.vci); + atm_hdr.vci = g_htons(pseudo_header->atm.vci); nwritten = fwrite(&atm_hdr, 1, sizeof atm_hdr, wdh->fh); if (nwritten != sizeof atm_hdr) { if (nwritten == 0 && ferror(wdh->fh)) Index: ethereal/wiretap/visual.c =================================================================== RCS file: /cvsroot/ethereal/wiretap/visual.c,v retrieving revision 1.9 diff -u -r1.9 visual.c --- visual.c 2002/07/16 07:15:09 1.9 +++ visual.c 2002/07/28 01:10:08 @@ -115,10 +115,10 @@ static gboolean visual_read(wtap *wth, int *err, long *data_offset); static void visual_close(wtap *wth); static gboolean visual_seek_read(wtap *wth, long seek_off, - union wtap_pseudo_header *pseudo_header, u_char *pd, int packet_size, + union wtap_pseudo_header *pseudo_header, guchar *pd, int packet_size, int *err); static gboolean visual_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const u_char *pd, int *err); + const union wtap_pseudo_header *pseudo_header, const guchar *pd, int *err); static gboolean visual_dump_close(wtap_dumper *wdh, int *err); static void visual_dump_free(wtap_dumper *wdh); @@ -451,7 +451,7 @@ /* Write a packet to a Visual dump file. Returns TRUE on success, FALSE on failure. */ static gboolean visual_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, - const union wtap_pseudo_header *pseudo_header, const u_char *pd, int *err) + const union wtap_pseudo_header *pseudo_header, const guchar *pd, int *err) { struct visual_write_info * visual = wdh->dump.opaque; struct visual_pkt_hdr vpkt_hdr; Index: ethereal/wiretap/wtap-capture.h =================================================================== RCS file: /cvsroot/ethereal/wiretap/wtap-capture.h,v retrieving revision 1.1 diff -u -r1.1 wtap-capture.h --- wtap-capture.h 2002/06/07 21:11:24 1.1 +++ wtap-capture.h 2002/07/28 01:10:08 @@ -25,8 +25,8 @@ /* XXX - needed until "wiretap" can do live packet captures */ int wtap_pcap_encap_to_wtap_encap(int encap); -const u_char *wtap_process_pcap_packet(gint linktype, - const struct pcap_pkthdr *phdr, const u_char *pd, +const guchar *wtap_process_pcap_packet(gint linktype, + const struct pcap_pkthdr *phdr, const guchar *pd, union wtap_pseudo_header *pseudo_header, struct wtap_pkthdr *whdr, int *err); Index: ethereal/wiretap/wtap-int.h =================================================================== RCS file: /cvsroot/ethereal/wiretap/wtap-int.h,v retrieving revision 1.25 diff -u -r1.25 wtap-int.h --- wtap-int.h 2002/06/23 10:32:36 1.25 +++ wtap-int.h 2002/07/28 01:10:08 @@ -23,18 +23,10 @@ #ifndef __WTAP_INT_H__ #define __WTAP_INT_H__ -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif - #ifdef HAVE_SYS_TIME_H #include <sys/time.h> #endif -#ifdef HAVE_WINSOCK2_H -#include <winsock2.h> -#endif - #include <glib.h> #include <stdio.h> #include <time.h> @@ -163,7 +155,7 @@ typedef gboolean (*subtype_write_func)(struct wtap_dumper*, const struct wtap_pkthdr*, const union wtap_pseudo_header*, - const u_char*, int*); + const guchar*, int*); typedef gboolean (*subtype_close_func)(struct wtap_dumper*, int*); typedef struct { Index: ethereal/wiretap/wtap.c =================================================================== RCS file: /cvsroot/ethereal/wiretap/wtap.c,v retrieving revision 1.67 diff -u -r1.67 wtap.c --- wtap.c 2002/07/16 07:15:09 1.67 +++ wtap.c 2002/07/28 01:10:08 @@ -291,7 +291,7 @@ } gboolean -wtap_loop(wtap *wth, int count, wtap_handler callback, u_char* user, int *err) +wtap_loop(wtap *wth, int count, wtap_handler callback, guchar* user, int *err) { long data_offset; int loop = 0; Index: ethereal/wiretap/wtap.h =================================================================== RCS file: /cvsroot/ethereal/wiretap/wtap.h,v retrieving revision 1.117 diff -u -r1.117 wtap.h --- wtap.h 2002/07/16 07:15:09 1.117 +++ wtap.h 2002/07/28 01:10:09 @@ -23,6 +23,13 @@ #ifndef __WTAP_H__ #define __WTAP_H__ +#ifdef HAVE_SYS_TIME_H +#include <sys/time.h> +#endif + +#include <glib.h> +#include <stdio.h> + /* Encapsulation types. Choose names that truly reflect * what is contained in the packet trace file. * @@ -155,21 +162,6 @@ */ #define WTAP_MAX_PACKET_SIZE 65535 -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif - -#ifdef HAVE_SYS_TIME_H -#include <sys/time.h> -#endif - -#ifdef HAVE_WINSOCK2_H -#include <winsock2.h> -#endif - -#include <glib.h> -#include <stdio.h> - /* * "Pseudo-headers" are used to supply to the clients of wiretap * per-packet information that's not part of the packet payload @@ -314,8 +306,8 @@ int pkt_encap; }; -typedef void (*wtap_handler)(u_char*, const struct wtap_pkthdr*, - long, union wtap_pseudo_header *pseudo_header, const u_char *); +typedef void (*wtap_handler)(guchar*, const struct wtap_pkthdr*, + long, union wtap_pseudo_header *pseudo_header, const guchar *); struct wtap; struct Buffer; @@ -336,7 +328,7 @@ /* Returns TRUE if entire loop-reading was successful. If read failure * happened, FALSE is returned and err is set. */ -gboolean wtap_loop(wtap *wth, int, wtap_handler, u_char*, int *err); +gboolean wtap_loop(wtap *wth, int, wtap_handler, guchar*, int *err); /* Returns TRUE if read was successful. FALSE if failure. data_offset is * set the the offset in the file where the data for the read packet is @@ -375,7 +367,7 @@ wtap_dumper* wtap_dump_fdopen(int fd, int filetype, int encap, int snaplen, int *err); gboolean wtap_dump(wtap_dumper *, const struct wtap_pkthdr *, - const union wtap_pseudo_header *pseudo_header, const u_char *, int *err); + const union wtap_pseudo_header *pseudo_header, const guchar *, int *err); FILE* wtap_dump_file(wtap_dumper *); gboolean wtap_dump_close(wtap_dumper *, int *); long wtap_get_bytes_dumped(wtap_dumper *);
- Follow-Ups:
- Re: [Ethereal-dev] types/include cleanup in wiretap/
- From: Guy Harris
- Re: [Ethereal-dev] types/include cleanup in wiretap/
- Prev by Date: [Ethereal-dev] packet-dsi.c, tcp_dissect_pdus and short frame
- Next by Date: [Ethereal-dev] [patch] new afp call
- Previous by thread: Re: [Ethereal-dev] packet-dsi.c, tcp_dissect_pdus and short frame
- Next by thread: Re: [Ethereal-dev] types/include cleanup in wiretap/
- Index(es):