Libpcap uses u_char; use it in our calls to libpcap routines and in our

libpcap callback routine (if it's not getting defined, <pcap.h> doesn't
work).

svn path=/trunk/; revision=15952
This commit is contained in:
Guy Harris 2005-09-22 02:00:38 +00:00
parent b093cc3697
commit 505e73ec39
2 changed files with 14 additions and 14 deletions

View File

@ -185,8 +185,8 @@ typedef struct _loop_data {
*/
#define CAP_READ_TIMEOUT 250
static void capture_loop_packet_cb(guchar *user, const struct pcap_pkthdr *phdr,
const guchar *pd);
static void capture_loop_packet_cb(u_char *user, const struct pcap_pkthdr *phdr,
const u_char *pd);
static void capture_loop_popup_errmsg(capture_options *capture_opts, const char *errmsg);
static void capture_loop_get_errmsg(char *errmsg, int errmsglen, const char *fname,
int err, gboolean is_close);
@ -489,7 +489,7 @@ cap_pipe_dispatch(int fd, loop_data *ld, struct pcap_hdr *hdr,
phdr.caplen = rechdr->hdr.incl_len;
phdr.len = rechdr->hdr.orig_len;
capture_loop_packet_cb((guchar *)ld, &phdr, data);
capture_loop_packet_cb((u_char *)ld, &phdr, data);
ld->cap_pipe_state = STATE_EXPECT_REC_HDR;
return 1;
@ -976,7 +976,7 @@ capture_loop_dispatch(capture_options *capture_opts, loop_data *ld,
* "select()" says we can read from it without blocking; go for
* it.
*/
inpkts = pcap_dispatch(ld->pcap_h, 1, capture_loop_packet_cb, (gchar *)ld);
inpkts = pcap_dispatch(ld->pcap_h, 1, capture_loop_packet_cb, (u_char *)ld);
if (inpkts < 0) {
ld->pcap_err = TRUE;
ld->go = FALSE;
@ -999,7 +999,7 @@ capture_loop_dispatch(capture_options *capture_opts, loop_data *ld,
#ifdef LOG_CAPTURE_VERBOSE
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "capture_loop_dispatch: from pcap_dispatch");
#endif
inpkts = pcap_dispatch(ld->pcap_h, 1, capture_loop_packet_cb, (gchar *) ld);
inpkts = pcap_dispatch(ld->pcap_h, 1, capture_loop_packet_cb, (u_char *) ld);
if (inpkts < 0) {
ld->pcap_err = TRUE;
ld->go = FALSE;
@ -1021,7 +1021,7 @@ capture_loop_dispatch(capture_options *capture_opts, loop_data *ld,
inpkts = 0;
while( (in = pcap_next_ex(ld->pcap_h, &pkt_header, &pkt_data)) == 1) {
capture_loop_packet_cb( (gchar *) ld, pkt_header, pkt_data);
capture_loop_packet_cb( (u_char *) ld, pkt_header, pkt_data);
inpkts++;
}
@ -1601,8 +1601,8 @@ capture_loop_popup_errmsg(capture_options *capture_opts _U_, const char *errmsg)
/* one packet was captured, process it */
static void
capture_loop_packet_cb(guchar *user, const struct pcap_pkthdr *phdr,
const guchar *pd)
capture_loop_packet_cb(u_char *user, const struct pcap_pkthdr *phdr,
const u_char *pd)
{
struct wtap_pkthdr whdr;
union wtap_pseudo_header pseudo_header;

View File

@ -170,8 +170,8 @@ static gboolean infoprint; /* if TRUE, print capture info after clearing infodel
static int capture(char *, int);
static void capture_pcap_cb(guchar *, const struct pcap_pkthdr *,
const guchar *);
static void capture_pcap_cb(u_char *, const struct pcap_pkthdr *,
const u_char *);
static void report_counts(void);
#ifdef _WIN32
static BOOL WINAPI capture_cleanup(DWORD);
@ -1807,7 +1807,7 @@ capture(char *save_file, int out_file_type)
errmsg, sizeof errmsg);
} else
#endif
inpkts = pcap_dispatch(ld.pch, pcap_cnt, capture_pcap_cb, (guchar *) &ld);
inpkts = pcap_dispatch(ld.pch, pcap_cnt, capture_pcap_cb, (u_char *) &ld);
if (inpkts < 0) {
/* Error from "pcap_dispatch()", or error or "no more packets" from
"pipe_dispatch(). */
@ -1951,8 +1951,8 @@ error:
}
static void
capture_pcap_cb(guchar *user, const struct pcap_pkthdr *phdr,
const guchar *pd)
capture_pcap_cb(u_char *user, const struct pcap_pkthdr *phdr,
const u_char *pd)
{
struct wtap_pkthdr whdr;
union wtap_pseudo_header pseudo_header;
@ -3293,7 +3293,7 @@ pipe_dispatch(int fd, loop_data *ldat, struct pcap_hdr *hdr,
phdr.caplen = rechdr->hdr.incl_len;
phdr.len = rechdr->hdr.orig_len;
capture_pcap_cb((guchar *)ldat, &phdr, data);
capture_pcap_cb((u_char *)ldat, &phdr, data);
ldat->pipe_state = STATE_EXPECT_REC_HDR;
return 1;