# include <sys/stat.h>
#endif
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#ifdef NEED_STRERROR_H
#include "strerror.h"
#endif
#include "getopt.h"
#endif
-#include "svnversion.h"
-
#include <glib.h>
#include <epan/epan.h>
#include <epan/filesystem.h>
#include "capture_ui_utils.h"
#include <epan/epan_dissect.h>
#include <epan/tap.h>
+#include <epan/stat_cmd_args.h>
#include <epan/timestamp.h>
#ifdef HAVE_LIBPCAP
*/
static const gchar decode_as_arg_template[] = "<layer_type>==<selector>,<decode_as_protocol>";
-static guint32 firstsec, firstusec;
-static guint32 prevsec, prevusec;
+static nstime_t first_ts;
+static nstime_t prev_ts;
static GString *comp_info_str, *runtime_info_str;
static gboolean print_packet_info; /* TRUE if we're to print packet information */
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);
if (print_ver) {
output = stdout;
- fprintf(output, "This is GNU t" PACKAGE " " VERSION
-#ifdef SVNVERSION
- " (" SVNVERSION ")"
-#endif
+ fprintf(output, "This is t" PACKAGE " " VERSION "%s"
"\n (C) 1998-2005 Gerald Combs <gerald@ethereal.com>"
"\n%s\n%s\n",
- comp_info_str->str, runtime_info_str->str);
+ svnversion, comp_info_str->str, runtime_info_str->str);
} else {
output = stderr;
}
PACKAGE);
fprintf(output, "\t[ -b <capture ring buffer option> ] ... [ -c <capture packet count> ]\n");
fprintf(output, "\t[ -d %s ] ...\n", decode_as_arg_template);
- fprintf(output, "\t[ -f <capture filter> ] [ -F <output file type> ] [ -i <capture interface> ]\n");
- fprintf(output, "\t[ -N <name resolving flags> ] [ -o <preference setting> ] ... [ -r <infile> ]\n");
- fprintf(output, "\t[ -R <read (display) filter> ] [ -s <capture snaplen> ] [ -t <time stamp format> ]\n");
- fprintf(output, "\t[ -T pdml|ps|psml|text ] [ -w <savefile> ] [ -y <capture link type> ]\n");
- fprintf(output, "\t[ -z <statistics ]\n");
+ fprintf(output, "\t[ -f <capture filter> ] [ -F <output file type> ]\n");
+ fprintf(output, "\t[ -i <capture interface> ] [ -N <name resolving flags> ]\n");
+ fprintf(output, "\t[ -o <preference setting> ] ... [ -r <infile> ]\n");
+ fprintf(output, "\t[ -R <read (display) filter> ] [ -s <capture snaplen> ]\n");
+ fprintf(output, "\t[ -t <time stamp format> ] [ -T pdml|ps|psml|text ]\n");
+ fprintf(output, "\t[ -w <savefile> ] [ -y <capture link type> ] [ -z <statistics> ]\n");
#else
fprintf(output, "\nt%s [ -vh ] [ -lnVx ]\n", PACKAGE);
fprintf(output, "\t[ -d %s ] ...\n", decode_as_arg_template);
fprintf(output, "\t[ -F <output file type> ] [ -N <name resolving flags> ]\n");
- fprintf(output, "\t[ -o <preference setting> ] ... [ -r <infile> ] [ -R <read (display) filter> ]\n");
- fprintf(output, "\t[ -t <time stamp format> ] [ -T pdml|ps|psml|text ] [ -w <savefile> ]\n");
- fprintf(output, "\t[ -z <statistics ]\n");
+ fprintf(output, "\t[ -o <preference setting> ] ... [ -r <infile> ]\n");
+ fprintf(output, "\t[ -R <read (display) filter> ] \t[ -t <time stamp format> ]\n");
+ fprintf(output, "\t[ -T pdml|ps|psml|text ] [ -w <savefile> ] [ -z <statistics ]\n");
#endif
fprintf(output, "Valid file type arguments to the \"-F\" flag:\n");
for (i = 0; i < WTAP_NUM_FILE_TYPES; i++) {
* name for the protocol that corresponds to this handle.
*/
static void
-display_dissector_names(gchar *table _U_, gpointer handle, gpointer output)
+display_dissector_names(const gchar *table _U_, gpointer handle, gpointer output)
{
int proto_id;
const gchar* proto_filter_name;
* whole list of dissectors.
*/
static void
-find_protocol_name_func(gchar *table _U_, gpointer handle, gpointer user_data)
+find_protocol_name_func(const gchar *table _U_, gpointer handle, gpointer user_data)
{
int proto_id;
/* initialize memory allocation subsystem */
ep_init_chunk();
+ se_init_chunk();
#ifdef HAVE_LIBPCAP
capture_opts_init(&capture_opts, NULL /* cfile */);
#endif
- set_timestamp_setting(TS_RELATIVE);
+ timestamp_set_type(TS_RELATIVE);
+ timestamp_set_precision(TS_PREC_AUTO);
/* Register all dissectors; we must do this before checking for the
"-G" flag, as the "-G" flag dumps information registered by the
break;
case 't': /* Time stamp type */
if (strcmp(optarg, "r") == 0)
- set_timestamp_setting(TS_RELATIVE);
+ timestamp_set_type(TS_RELATIVE);
else if (strcmp(optarg, "a") == 0)
- set_timestamp_setting(TS_ABSOLUTE);
+ timestamp_set_type(TS_ABSOLUTE);
else if (strcmp(optarg, "ad") == 0)
- set_timestamp_setting(TS_ABSOLUTE_WITH_DATE);
+ timestamp_set_type(TS_ABSOLUTE_WITH_DATE);
else if (strcmp(optarg, "d") == 0)
- set_timestamp_setting(TS_DELTA);
+ timestamp_set_type(TS_DELTA);
else {
fprintf(stderr, "tethereal: Invalid time stamp type \"%s\"\n",
optarg);
}
break;
case 'v': /* Show version and exit */
- printf("t" PACKAGE " " VERSION
-#ifdef SVNVERSION
- " (" SVNVERSION ")"
-#endif
- "\n%s\n%s\n",
- comp_info_str->str, runtime_info_str->str);
+ printf("t" PACKAGE " " VERSION "%s\n%s\n%s\n",
+ svnversion, comp_info_str->str, runtime_info_str->str);
exit(0);
break;
case 'w': /* Write to capture file xxx */
print_hex = TRUE;
break;
case 'z':
- /* We won't call the init function for the tap this soon
+ /* We won't call the init function for the stat this soon
as it would disallow MATE's fields (which are registered
by the preferences set callback) from being used as
part of a tap filter. Instead, we just add the argument
- to a list of tap arguments. */
- if (!process_tap_cmd_arg(optarg)) {
+ to a list of stat arguments. */
+ if (!process_stat_cmd_arg(optarg)) {
fprintf(stderr,"tethereal: invalid -z argument.\n");
fprintf(stderr," -z argument must be one of :\n");
- list_tap_cmd_args();
+ list_stat_cmd_args();
exit(1);
}
break;
prefs_apply_all();
/* At this point MATE will have registered its field array so we can
- have a filter with one of MATE's late-registered fields as part
- of the tap's filter. We can now process all the "-z" arguments. */
- start_requested_taps();
+ have a tap filter with one of MATE's late-registered fields as part
+ of the filter. We can now process all the "-z" arguments. */
+ start_requested_stats();
/* disabled protocols as per configuration file */
if (gdp_path == NULL && dp_path == NULL) {
epan_cleanup();
exit(2);
}
+
+ /* Set timestamp precision; there should arguably be a command-line
+ option to let the user set this. */
+ switch(wtap_file_tsprecision(cfile.wth)) {
+ case(WTAP_FILE_TSPREC_SEC):
+ timestamp_set_precision(TS_PREC_AUTO_SEC);
+ break;
+ case(WTAP_FILE_TSPREC_DSEC):
+ timestamp_set_precision(TS_PREC_AUTO_DSEC);
+ break;
+ case(WTAP_FILE_TSPREC_CSEC):
+ timestamp_set_precision(TS_PREC_AUTO_CSEC);
+ break;
+ case(WTAP_FILE_TSPREC_MSEC):
+ timestamp_set_precision(TS_PREC_AUTO_MSEC);
+ break;
+ case(WTAP_FILE_TSPREC_USEC):
+ timestamp_set_precision(TS_PREC_AUTO_USEC);
+ break;
+ case(WTAP_FILE_TSPREC_NSEC):
+ timestamp_set_precision(TS_PREC_AUTO_NSEC);
+ break;
+ default:
+ g_assert_not_reached();
+ }
+
+ /* Process the packets in the file */
err = load_cap_file(&cfile, save_file, out_file_type);
if (err != 0) {
epan_cleanup();
#ifdef _WIN32
if (!has_wpcap) {
- fprintf(stderr, "tethereal: Could not load wpcap.dll.\n");
- exit(2);
+ fprintf(stderr, "tethereal: Could not load wpcap.dll.\n");
+ exit(2);
}
#endif
/* Yes; did the user specify an interface to use? */
if (capture_opts.iface == NULL) {
- /* No - is a default specified in the preferences file? */
- if (prefs->capture_device != NULL) {
- /* Yes - use it. */
- if_text = strrchr(prefs->capture_device, ' ');
- if (if_text == NULL) {
- capture_opts.iface = g_strdup(prefs->capture_device);
- } else {
- capture_opts.iface = g_strdup(if_text + 1); /* Skip over space */
- }
- } else {
- /* No - pick the first one from the list of interfaces. */
- if_list = get_interface_list(&err, err_str);
- if (if_list == NULL) {
- switch (err) {
-
- case CANT_GET_INTERFACE_LIST:
- cant_get_if_list_errstr =
- cant_get_if_list_error_message(err_str);
- fprintf(stderr, "tethereal: %s\n", cant_get_if_list_errstr);
- g_free(cant_get_if_list_errstr);
- break;
-
- case NO_INTERFACES_FOUND:
- fprintf(stderr, "tethereal: There are no interfaces on which a capture can be done\n");
- break;
- }
- exit(2);
- }
- if_info = if_list->data; /* first interface */
- capture_opts.iface = g_strdup(if_info->name);
- free_interface_list(if_list);
- }
+ /* No - is a default specified in the preferences file? */
+ if (prefs->capture_device != NULL) {
+ /* Yes - use it. */
+ if_text = strrchr(prefs->capture_device, ' ');
+ if (if_text == NULL) {
+ capture_opts.iface = g_strdup(prefs->capture_device);
+ } else {
+ capture_opts.iface = g_strdup(if_text + 1); /* Skip over space */
+ }
+ } else {
+ /* No - pick the first one from the list of interfaces. */
+ if_list = get_interface_list(&err, err_str);
+ if (if_list == NULL) {
+ switch (err) {
+
+ case CANT_GET_INTERFACE_LIST:
+ cant_get_if_list_errstr = cant_get_if_list_error_message(err_str);
+ fprintf(stderr, "tethereal: %s\n", cant_get_if_list_errstr);
+ g_free(cant_get_if_list_errstr);
+ break;
+
+ case NO_INTERFACES_FOUND:
+ fprintf(stderr, "tethereal: There are no interfaces on which a capture can be done\n");
+ break;
+ }
+ exit(2);
+ }
+ if_info = if_list->data; /* first interface */
+ capture_opts.iface = g_strdup(if_info->name);
+ free_interface_list(if_list);
+ }
}
if (list_link_layer_types) {
print_packet_counts = TRUE;
}
+ /* For now, assume libpcap gives microsecond precision. */
+ timestamp_set_precision(TS_PREC_AUTO_USEC);
+
capture(save_file, out_file_type);
if (capture_opts.multi_files_on) {
set_linktype_err_str = set_pcap_linktype(ld.pch, capture_opts.iface,
capture_opts.linktype);
if (set_linktype_err_str != NULL) {
- snprintf(errmsg, sizeof errmsg, "Unable to set data link type (%s).",
+ g_snprintf(errmsg, sizeof errmsg, "Unable to set data link type (%s).",
set_linktype_err_str);
goto error;
}
users; don't warn about permissions problems.
Do, however, warn that WAN devices aren't supported. */
- snprintf(errmsg, sizeof errmsg,
- "The capture session could not be initiated (%s).\n"
- "Please check that you have the proper interface specified.\n"
- "\n"
- "Note that the WinPcap 2.x version of the driver Ethereal uses for packet\n"
- "capture on Windows doesn't support capturing on PPP/WAN interfaces in\n"
- "Windows NT/2000/XP/2003 Server, and that the WinPcap 3.0 and later versions\n"
- "don't support capturing on PPP/WAN interfaces at all.\n",
+ g_snprintf(errmsg, sizeof errmsg,
+"The capture session could not be initiated (%s).\n"
+"Please check that you have the proper interface specified.\n"
+"\n"
+"Note that version 3.0 of WinPcap, and earlier versions of WinPcap, don't\n"
+"support capturing on PPP/WAN interfaces on Windows NT 4.0 / 2000 / XP /\n"
+"Server 2003.\n"
+"WinPcap 3.1 has support for it on Windows 2000 / XP / Server 2003, but has no\n"
+"support for it on Windows NT 4.0 or Windows Vista (Beta 1).\n",
open_err_str);
goto error;
#else
"at the URL lists a number of mirror sites.";
else
libpcap_warn = "";
- snprintf(errmsg, sizeof errmsg,
+ g_snprintf(errmsg, sizeof errmsg,
"The capture session could not be initiated (%s).\n"
"Please check to make sure you have sufficient permissions, and that\n"
"you have the proper interface or pipe specified.%s", open_err_str,
}
if (pcap_compile(ld.pch, &fcode, capture_opts.cfilter, 1, netmask) < 0) {
if (dfilter_compile(capture_opts.cfilter, &rfcode)) {
- snprintf(errmsg, sizeof errmsg,
+ g_snprintf(errmsg, sizeof errmsg,
"Unable to parse capture filter string (%s).\n"
" Interestingly enough, this looks like a valid display filter\n"
" Are you sure you didn't mix them up?",
pcap_geterr(ld.pch));
} else {
- snprintf(errmsg, sizeof errmsg,
+ g_snprintf(errmsg, sizeof errmsg,
"Unable to parse capture filter string (%s).",
pcap_geterr(ld.pch));
}
goto error;
}
if (pcap_setfilter(ld.pch, &fcode) < 0) {
- snprintf(errmsg, sizeof errmsg, "Can't install filter (%s).",
+ g_snprintf(errmsg, sizeof errmsg, "Can't install filter (%s).",
pcap_geterr(ld.pch));
#ifdef HAVE_PCAP_FREECODE
pcap_freecode(&fcode);
}
} else {
ld.pdh = wtap_dump_open(save_file, out_file_type,
- ld.linktype, file_snaplen, &err);
+ ld.linktype, file_snaplen, FALSE /* compress */, &err);
}
if (ld.pdh == NULL) {
- snprintf(errmsg, sizeof errmsg,
+ g_snprintf(errmsg, sizeof errmsg,
cf_open_error_message(err, NULL, TRUE, out_file_type),
*save_file == '\0' ? "stdout" : save_file);
goto error;
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(). */
}
if (ld.output_to_pipe) {
if (ld.packet_count > packet_count_prev) {
- if (fflush(wtap_dump_file(ld.pdh))) {
- volatile_err = errno;
- ld.go = FALSE;
- }
+ wtap_dump_flush(ld.pdh);
packet_count_prev = ld.packet_count;
}
}
}
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;
snapshot_length = WTAP_MAX_PACKET_SIZE;
}
pdh = wtap_dump_open(save_file, out_file_type,
- linktype, snapshot_length, &err);
+ linktype, snapshot_length, FALSE /* compressed */, &err);
if (pdh == NULL) {
/* We couldn't set up to write to the capture file. */
fdata->cap_len = phdr->caplen;
fdata->file_off = offset;
fdata->lnk_t = phdr->pkt_encap;
- fdata->abs_secs = phdr->ts.tv_sec;
- fdata->abs_usecs = phdr->ts.tv_usec;
+ fdata->abs_ts = *((nstime_t *) &phdr->ts);
fdata->flags.passed_dfilter = 0;
fdata->flags.encoding = CHAR_ASCII;
fdata->flags.visited = 0;
/* If we don't have the time stamp of the first packet in the
capture, it's because this is the first packet. Save the time
stamp of this packet as the time stamp of the first packet. */
- if (!firstsec && !firstusec) {
- firstsec = fdata->abs_secs;
- firstusec = fdata->abs_usecs;
+ if (nstime_is_zero(&first_ts)) {
+ first_ts = fdata->abs_ts;
}
/* If we don't have the time stamp of the previous displayed packet,
it's because this is the first displayed packet. Save the time
stamp of this packet as the time stamp of the previous displayed
packet. */
- if (!prevsec && !prevusec) {
- prevsec = fdata->abs_secs;
- prevusec = fdata->abs_usecs;
+ if (nstime_is_zero(&prev_ts)) {
+ prev_ts = fdata->abs_ts;
}
/* Get the time elapsed between the first packet and this packet. */
- compute_timestamp_diff(&fdata->rel_secs, &fdata->rel_usecs,
- fdata->abs_secs, fdata->abs_usecs, firstsec, firstusec);
+ nstime_delta(&fdata->rel_ts, &fdata->abs_ts, &first_ts);
/* If it's greater than the current elapsed time, set the elapsed time
to it (we check for "greater than" so as not to be confused by
time moving backwards). */
- if ((gint32)cf->esec < fdata->rel_secs
- || ((gint32)cf->esec == fdata->rel_secs && (gint32)cf->eusec < fdata->rel_usecs)) {
- cf->esec = fdata->rel_secs;
- cf->eusec = fdata->rel_usecs;
+ if ((gint32)cf->elapsed_time.secs < fdata->rel_ts.secs
+ || ((gint32)cf->elapsed_time.secs == fdata->rel_ts.secs && (gint32)cf->elapsed_time.nsecs < fdata->rel_ts.nsecs)) {
+ cf->elapsed_time = fdata->rel_ts;
}
/* Get the time elapsed between the previous displayed packet and
this packet. */
- compute_timestamp_diff(&fdata->del_secs, &fdata->del_usecs,
- fdata->abs_secs, fdata->abs_usecs, prevsec, prevusec);
- prevsec = fdata->abs_secs;
- prevusec = fdata->abs_usecs;
+ nstime_delta(&fdata->del_ts, &fdata->abs_ts, &prev_ts);
+ prev_ts = fdata->abs_ts;
}
/* Free up all data attached to a "frame_data" structure. */
case WTAP_ERR_UNSUPPORTED:
/* Seen only when opening a capture file for reading. */
- snprintf(errmsg_errno, sizeof(errmsg_errno),
+ g_snprintf(errmsg_errno, sizeof(errmsg_errno),
"The file \"%%s\" isn't a capture file in a format Tethereal understands.\n"
"(%s)", err_info);
g_free(err_info);
case WTAP_ERR_CANT_WRITE_TO_PIPE:
/* Seen only when opening a capture file for writing. */
- snprintf(errmsg_errno, sizeof(errmsg_errno),
+ g_snprintf(errmsg_errno, sizeof(errmsg_errno),
"The file \"%%s\" is a pipe, and %s capture files can't be "
"written to a pipe.", wtap_file_type_string(file_type));
errmsg = errmsg_errno;
if (for_writing)
errmsg = "Tethereal can't save this capture in that format.";
else {
- snprintf(errmsg_errno, sizeof(errmsg_errno),
+ g_snprintf(errmsg_errno, sizeof(errmsg_errno),
"The file \"%%s\" is a capture for a network type that Tethereal doesn't support.\n"
"(%s)", err_info);
g_free(err_info);
case WTAP_ERR_BAD_RECORD:
/* Seen only when opening a capture file for reading. */
- snprintf(errmsg_errno, sizeof(errmsg_errno),
+ g_snprintf(errmsg_errno, sizeof(errmsg_errno),
"The file \"%%s\" appears to be damaged or corrupt.\n"
"(%s)", err_info);
g_free(err_info);
break;
default:
- snprintf(errmsg_errno, sizeof(errmsg_errno),
+ g_snprintf(errmsg_errno, sizeof(errmsg_errno),
"The file \"%%s\" could not be %s: %s.",
for_writing ? "created" : "opened",
wtap_strerror(err));
init_dissection();
cf->wth = wth;
- cf->filed = -1; /* not used, but set it anyway */
- cf->f_len = 0; /* not used, but set it anyway */
+ cf->f_datalen = 0; /* not used, but set it anyway */
/* Set the file name because we need it to set the follow stream filter.
XXX - is that still true? We need it for other reasons, though,
cf->count = 0;
cf->drops_known = FALSE;
cf->drops = 0;
- cf->esec = 0;
- cf->eusec = 0;
cf->snap = wtap_snapshot_length(cf->wth);
if (cf->snap == 0) {
/* Snapshot length not known. */
cf->snap = WTAP_MAX_PACKET_SIZE;
} else
cf->has_snap = TRUE;
- firstsec = 0, firstusec = 0;
- prevsec = 0, prevusec = 0;
+ nstime_set_zero(&cf->elapsed_time);
+ nstime_set_zero(&first_ts);
+ nstime_set_zero(&prev_ts);
return CF_OK;
fail:
- snprintf(err_msg, sizeof err_msg,
+ g_snprintf(err_msg, sizeof err_msg,
cf_open_error_message(*err, err_info, FALSE, 0), fname);
fprintf(stderr, "tethereal: %s\n", err_msg);
return CF_ERROR;
if (errno == ENOENT || errno == ENOTDIR)
ldat->pipe_err = PIPNEXIST;
else {
- snprintf(errmsg, errmsgl,
+ g_snprintf(errmsg, errmsgl,
"The capture session could not be initiated "
"due to error on pipe: %s", strerror(errno));
ldat->pipe_err = PIPERR;
*/
ldat->pipe_err = PIPNEXIST;
} else {
- snprintf(errmsg, errmsgl,
+ g_snprintf(errmsg, errmsgl,
"The capture session could not be initiated because\n"
"\"%s\" is neither an interface nor a pipe", pipename);
ldat->pipe_err = PIPERR;
}
fd = open(pipename, O_RDONLY);
if (fd == -1) {
- snprintf(errmsg, errmsgl,
+ g_snprintf(errmsg, errmsgl,
"The capture session could not be initiated "
"due to error on pipe open: %s", strerror(errno));
ldat->pipe_err = PIPERR;
b = read(fd, ((char *)&magic)+bytes_read, sizeof magic-bytes_read);
if (b <= 0) {
if (b == 0)
- snprintf(errmsg, errmsgl, "End of file on pipe during open");
+ g_snprintf(errmsg, errmsgl, "End of file on pipe during open");
else
- snprintf(errmsg, errmsgl, "Error on pipe during open: %s",
+ g_snprintf(errmsg, errmsgl, "Error on pipe during open: %s",
strerror(errno));
goto error;
}
break;
default:
/* Not a "libpcap" type we know about. */
- snprintf(errmsg, errmsgl, "Unrecognized libpcap format");
+ g_snprintf(errmsg, errmsgl, "Unrecognized libpcap format");
goto error;
}
sizeof(struct pcap_hdr) - bytes_read);
if (b <= 0) {
if (b == 0)
- snprintf(errmsg, errmsgl, "End of file on pipe during open");
+ g_snprintf(errmsg, errmsgl, "End of file on pipe during open");
else
- snprintf(errmsg, errmsgl, "Error on pipe during open: %s",
+ g_snprintf(errmsg, errmsgl, "Error on pipe during open: %s",
strerror(errno));
goto error;
}
}
if (hdr->version_major < 2) {
- snprintf(errmsg, errmsgl, "Unable to read old libpcap format");
+ g_snprintf(errmsg, errmsgl, "Unable to read old libpcap format");
goto error;
}
break;
default:
- snprintf(errmsg, errmsgl, "pipe_dispatch: invalid state");
+ g_snprintf(errmsg, errmsgl, "pipe_dispatch: invalid state");
result = PD_ERR;
} /* switch (ldat->pipe_state) */
/* We've read the header. Take care of byte order. */
adjust_header(ldat, hdr, &rechdr->hdr);
if (rechdr->hdr.incl_len > WTAP_MAX_PACKET_SIZE) {
- snprintf(errmsg, errmsgl, "Frame %u too long (%d bytes)",
+ g_snprintf(errmsg, errmsgl, "Frame %u too long (%d bytes)",
ldat->packet_count+1, rechdr->hdr.incl_len);
break;
}
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;
return -1;
case PD_PIPE_ERR:
- snprintf(errmsg, errmsgl, "Error reading from pipe: %s",
+ g_snprintf(errmsg, errmsgl, "Error reading from pipe: %s",
strerror(errno));
/* Fall through */
case PD_ERR: