Convert rawshark and tfshark to C99 types
Also a few lines that somehow got missed from capinfos Ping #19116
This commit is contained in:
parent
b75e9b696c
commit
3a1b36bca8
12
capinfos.c
12
capinfos.c
@ -423,7 +423,7 @@ relative_time_string(nstime_t *timer, int tsprecision, capture_info *cf_info, bo
|
|||||||
return time_string_buf;
|
return time_string_buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_value(const char *text_p1, gint width, const char *text_p2, double value)
|
static void print_value(const char *text_p1, int width, const char *text_p2, double value)
|
||||||
{
|
{
|
||||||
if (value > 0.0)
|
if (value > 0.0)
|
||||||
printf("%s%.*f%s\n", text_p1, width, value, text_p2);
|
printf("%s%.*f%s\n", text_p1, width, value, text_p2);
|
||||||
@ -647,7 +647,7 @@ print_stats(const char *filename, capture_info *cf_info)
|
|||||||
char *s = g_array_index(cf_info->idb_info_strings, char*, i);
|
char *s = g_array_index(cf_info->idb_info_strings, char*, i);
|
||||||
uint32_t packet_count = 0;
|
uint32_t packet_count = 0;
|
||||||
if (i < cf_info->interface_packet_counts->len)
|
if (i < cf_info->interface_packet_counts->len)
|
||||||
packet_count = g_array_index(cf_info->interface_packet_counts, guint32, i);
|
packet_count = g_array_index(cf_info->interface_packet_counts, uint32_t, i);
|
||||||
printf ("Interface #%u info:\n", i);
|
printf ("Interface #%u info:\n", i);
|
||||||
printf ("%s", s);
|
printf ("%s", s);
|
||||||
printf (" Number of packets = %u\n", packet_count);
|
printf (" Number of packets = %u\n", packet_count);
|
||||||
@ -694,7 +694,7 @@ print_stats_table_header(capture_info *cf_info)
|
|||||||
{
|
{
|
||||||
pkt_cmt *p;
|
pkt_cmt *p;
|
||||||
char *buf;
|
char *buf;
|
||||||
gsize buf_len;
|
size_t buf_len;
|
||||||
|
|
||||||
putquote();
|
putquote();
|
||||||
printf("File name");
|
printf("File name");
|
||||||
@ -914,7 +914,7 @@ print_stats_table(const char *filename, capture_info *cf_info)
|
|||||||
putquote();
|
putquote();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (guint section_number = 0;
|
for (unsigned section_number = 0;
|
||||||
section_number < wtap_file_get_num_shbs(cf_info->wth);
|
section_number < wtap_file_get_num_shbs(cf_info->wth);
|
||||||
section_number++) {
|
section_number++) {
|
||||||
wtap_block_t shb;
|
wtap_block_t shb;
|
||||||
@ -1248,7 +1248,7 @@ process_cap_file(const char *filename, bool need_separator)
|
|||||||
idb_info = NULL;
|
idb_info = NULL;
|
||||||
}
|
}
|
||||||
if (rec.rec_header.packet_header.interface_id < cf_info.num_interfaces) {
|
if (rec.rec_header.packet_header.interface_id < cf_info.num_interfaces) {
|
||||||
g_array_index(cf_info.interface_packet_counts, guint32,
|
g_array_index(cf_info.interface_packet_counts, uint32_t,
|
||||||
rec.rec_header.packet_header.interface_id) += 1;
|
rec.rec_header.packet_header.interface_id) += 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1258,7 +1258,7 @@ process_cap_file(const char *filename, bool need_separator)
|
|||||||
else {
|
else {
|
||||||
/* it's for interface_id 0 */
|
/* it's for interface_id 0 */
|
||||||
if (cf_info.num_interfaces != 0) {
|
if (cf_info.num_interfaces != 0) {
|
||||||
g_array_index(cf_info.interface_packet_counts, guint32, 0) += 1;
|
g_array_index(cf_info.interface_packet_counts, uint32_t, 0) += 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cf_info.pkt_interface_id_unknown += 1;
|
cf_info.pkt_interface_id_unknown += 1;
|
||||||
|
148
rawshark.c
148
rawshark.c
@ -102,7 +102,7 @@
|
|||||||
* This is the template for the decode as option; it is shared between the
|
* This is the template for the decode as option; it is shared between the
|
||||||
* various functions that output the usage for this parameter.
|
* various functions that output the usage for this parameter.
|
||||||
*/
|
*/
|
||||||
static const gchar decode_as_arg_template[] = "<layer_type>==<selector>,<decode_as_protocol>";
|
static const char decode_as_arg_template[] = "<layer_type>==<selector>,<decode_as_protocol>";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Additional exit codes */
|
/* Additional exit codes */
|
||||||
@ -111,7 +111,7 @@ static const gchar decode_as_arg_template[] = "<layer_type>==<selector>,<decode_
|
|||||||
|
|
||||||
capture_file cfile;
|
capture_file cfile;
|
||||||
|
|
||||||
static guint32 cum_bytes;
|
static uint32_t cum_bytes;
|
||||||
static frame_data ref_frame;
|
static frame_data ref_frame;
|
||||||
static frame_data prev_dis_frame;
|
static frame_data prev_dis_frame;
|
||||||
static frame_data prev_cap_frame;
|
static frame_data prev_cap_frame;
|
||||||
@ -125,21 +125,21 @@ typedef enum {
|
|||||||
/* Add CSV and the like here */
|
/* Add CSV and the like here */
|
||||||
} output_action_e;
|
} output_action_e;
|
||||||
|
|
||||||
static gboolean line_buffered;
|
static bool line_buffered;
|
||||||
static print_format_e print_format = PR_FMT_TEXT;
|
static print_format_e print_format = PR_FMT_TEXT;
|
||||||
|
|
||||||
static gboolean want_pcap_pkthdr;
|
static bool want_pcap_pkthdr;
|
||||||
|
|
||||||
cf_status_t raw_cf_open(capture_file *cf, const char *fname);
|
cf_status_t raw_cf_open(capture_file *cf, const char *fname);
|
||||||
static gboolean load_cap_file(capture_file *cf);
|
static bool load_cap_file(capture_file *cf);
|
||||||
static gboolean process_packet(capture_file *cf, epan_dissect_t *edt, gint64 offset,
|
static bool process_packet(capture_file *cf, epan_dissect_t *edt, int64_t offset,
|
||||||
wtap_rec *rec, Buffer *buf);
|
wtap_rec *rec, Buffer *buf);
|
||||||
static void show_print_file_io_error(int err);
|
static void show_print_file_io_error(int err);
|
||||||
|
|
||||||
static void rawshark_cmdarg_err(const char *fmt, va_list ap);
|
static void rawshark_cmdarg_err(const char *fmt, va_list ap);
|
||||||
static void rawshark_cmdarg_err_cont(const char *fmt, va_list ap);
|
static void rawshark_cmdarg_err_cont(const char *fmt, va_list ap);
|
||||||
static void protocolinfo_init(char *field);
|
static void protocolinfo_init(char *field);
|
||||||
static gboolean parse_field_string_format(char *format);
|
static bool parse_field_string_format(char *format);
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SF_NONE, /* No format (placeholder) */
|
SF_NONE, /* No format (placeholder) */
|
||||||
@ -149,7 +149,7 @@ typedef enum {
|
|||||||
} string_fmt_e;
|
} string_fmt_e;
|
||||||
|
|
||||||
typedef struct string_fmt_s {
|
typedef struct string_fmt_s {
|
||||||
gchar *plain;
|
char *plain;
|
||||||
string_fmt_e format; /* Valid if plain is NULL */
|
string_fmt_e format; /* Valid if plain is NULL */
|
||||||
} string_fmt_t;
|
} string_fmt_t;
|
||||||
|
|
||||||
@ -340,7 +340,7 @@ raw_pipe_open(const char *pipe_name)
|
|||||||
* a LINKTYPE_ value supported by Wiretap. "Proto name" must be
|
* a LINKTYPE_ value supported by Wiretap. "Proto name" must be
|
||||||
* a protocol name, e.g. "http".
|
* a protocol name, e.g. "http".
|
||||||
*/
|
*/
|
||||||
static gboolean
|
static bool
|
||||||
set_link_type(const char *lt_arg) {
|
set_link_type(const char *lt_arg) {
|
||||||
char *spec_ptr = strchr(lt_arg, ':');
|
char *spec_ptr = strchr(lt_arg, ':');
|
||||||
char *p;
|
char *p;
|
||||||
@ -351,7 +351,7 @@ set_link_type(const char *lt_arg) {
|
|||||||
char *errmsg = NULL;
|
char *errmsg = NULL;
|
||||||
|
|
||||||
if (!spec_ptr)
|
if (!spec_ptr)
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
spec_ptr++;
|
spec_ptr++;
|
||||||
|
|
||||||
@ -361,7 +361,7 @@ set_link_type(const char *lt_arg) {
|
|||||||
errno = 0;
|
errno = 0;
|
||||||
val = strtol(spec_ptr, &p, 10);
|
val = strtol(spec_ptr, &p, 10);
|
||||||
if (p == spec_ptr || *p != '\0' || errno != 0 || val > INT_MAX) {
|
if (p == spec_ptr || *p != '\0' || errno != 0 || val > INT_MAX) {
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
dlt_val = (int)val;
|
dlt_val = (int)val;
|
||||||
}
|
}
|
||||||
@ -377,9 +377,9 @@ set_link_type(const char *lt_arg) {
|
|||||||
*/
|
*/
|
||||||
encap = wtap_pcap_encap_to_wtap_encap(dlt_val);
|
encap = wtap_pcap_encap_to_wtap_encap(dlt_val);
|
||||||
if (encap == WTAP_ENCAP_UNKNOWN) {
|
if (encap == WTAP_ENCAP_UNKNOWN) {
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
} else if (strncmp(lt_arg, "proto:", strlen("proto:")) == 0) {
|
} else if (strncmp(lt_arg, "proto:", strlen("proto:")) == 0) {
|
||||||
dhandle = find_dissector(spec_ptr);
|
dhandle = find_dissector(spec_ptr);
|
||||||
if (dhandle) {
|
if (dhandle) {
|
||||||
@ -392,13 +392,13 @@ set_link_type(const char *lt_arg) {
|
|||||||
if (prefs_set_pref(pref_str->str, &errmsg) != PREFS_SET_OK) {
|
if (prefs_set_pref(pref_str->str, &errmsg) != PREFS_SET_OK) {
|
||||||
g_string_free(pref_str, TRUE);
|
g_string_free(pref_str, TRUE);
|
||||||
g_free(errmsg);
|
g_free(errmsg);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
g_string_free(pref_str, TRUE);
|
g_string_free(pref_str, TRUE);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -412,12 +412,12 @@ main(int argc, char *argv[])
|
|||||||
struct rlimit limit;
|
struct rlimit limit;
|
||||||
#endif /* !_WIN32 */
|
#endif /* !_WIN32 */
|
||||||
|
|
||||||
gchar *pipe_name = NULL;
|
char *pipe_name = NULL;
|
||||||
gchar *rfilters[64];
|
char *rfilters[64];
|
||||||
e_prefs *prefs_p;
|
e_prefs *prefs_p;
|
||||||
GPtrArray *disp_fields = g_ptr_array_new();
|
GPtrArray *disp_fields = g_ptr_array_new();
|
||||||
guint fc;
|
unsigned fc;
|
||||||
gboolean skip_pcap_header = FALSE;
|
bool skip_pcap_header = false;
|
||||||
int ret = EXIT_SUCCESS;
|
int ret = EXIT_SUCCESS;
|
||||||
static const struct ws_option long_options[] = {
|
static const struct ws_option long_options[] = {
|
||||||
{"help", ws_no_argument, NULL, 'h'},
|
{"help", ws_no_argument, NULL, 'h'},
|
||||||
@ -516,13 +516,13 @@ main(int argc, char *argv[])
|
|||||||
* file-type-dependent blocks can register using the file
|
* file-type-dependent blocks can register using the file
|
||||||
* type/subtype value for the file type.
|
* type/subtype value for the file type.
|
||||||
*/
|
*/
|
||||||
wtap_init(FALSE);
|
wtap_init(false);
|
||||||
|
|
||||||
/* Register all dissectors; we must do this before checking for the
|
/* Register all dissectors; we must do this before checking for the
|
||||||
"-G" flag, as the "-G" flag dumps information registered by the
|
"-G" flag, as the "-G" flag dumps information registered by the
|
||||||
dissectors, and we must do it before we read the preferences, in
|
dissectors, and we must do it before we read the preferences, in
|
||||||
case any dissectors register preferences. */
|
case any dissectors register preferences. */
|
||||||
if (!epan_init(NULL, NULL, TRUE)) {
|
if (!epan_init(NULL, NULL, true)) {
|
||||||
ret = WS_EXIT_INIT_FAILED;
|
ret = WS_EXIT_INIT_FAILED;
|
||||||
goto clean_exit;
|
goto clean_exit;
|
||||||
}
|
}
|
||||||
@ -579,7 +579,7 @@ main(int argc, char *argv[])
|
|||||||
make the standard output line-buffered (short version: in
|
make the standard output line-buffered (short version: in
|
||||||
Windows, "line-buffered" is the same as "fully-buffered",
|
Windows, "line-buffered" is the same as "fully-buffered",
|
||||||
and the output buffer is only flushed when it fills up). */
|
and the output buffer is only flushed when it fills up). */
|
||||||
line_buffered = TRUE;
|
line_buffered = true;
|
||||||
break;
|
break;
|
||||||
#if !defined(_WIN32) && defined(RLIMIT_AS)
|
#if !defined(_WIN32) && defined(RLIMIT_AS)
|
||||||
case 'm':
|
case 'm':
|
||||||
@ -626,7 +626,7 @@ main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'p': /* Expect pcap_pkthdr packet headers, which may have 64-bit timestamps */
|
case 'p': /* Expect pcap_pkthdr packet headers, which may have 64-bit timestamps */
|
||||||
want_pcap_pkthdr = TRUE;
|
want_pcap_pkthdr = true;
|
||||||
break;
|
break;
|
||||||
case 'r': /* Read capture file xxx */
|
case 'r': /* Read capture file xxx */
|
||||||
pipe_name = g_strdup(ws_optarg);
|
pipe_name = g_strdup(ws_optarg);
|
||||||
@ -644,7 +644,7 @@ main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 's': /* Skip PCAP header */
|
case 's': /* Skip PCAP header */
|
||||||
skip_pcap_header = TRUE;
|
skip_pcap_header = true;
|
||||||
break;
|
break;
|
||||||
case 'S': /* Print string representations */
|
case 'S': /* Print string representations */
|
||||||
if (!parse_field_string_format(ws_optarg)) {
|
if (!parse_field_string_format(ws_optarg)) {
|
||||||
@ -749,7 +749,7 @@ main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Build the column format array */
|
/* Build the column format array */
|
||||||
build_column_format_array(&cfile.cinfo, prefs_p->num_cols, TRUE);
|
build_column_format_array(&cfile.cinfo, prefs_p->num_cols, true);
|
||||||
|
|
||||||
if (n_rfilters != 0) {
|
if (n_rfilters != 0) {
|
||||||
for (i = 0; i < n_rfilters; i++) {
|
for (i = 0; i < n_rfilters; i++) {
|
||||||
@ -782,8 +782,8 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
/* Do we need to PCAP header and magic? */
|
/* Do we need to PCAP header and magic? */
|
||||||
if (skip_pcap_header) {
|
if (skip_pcap_header) {
|
||||||
unsigned int bytes_left = (unsigned int) sizeof(struct pcap_hdr) + sizeof(guint32);
|
unsigned int bytes_left = (unsigned int) sizeof(struct pcap_hdr) + sizeof(uint32_t);
|
||||||
gchar buf[sizeof(struct pcap_hdr) + sizeof(guint32)];
|
char buf[sizeof(struct pcap_hdr) + sizeof(uint32_t)];
|
||||||
while (bytes_left != 0) {
|
while (bytes_left != 0) {
|
||||||
ssize_t bytes = ws_read(fd, buf, bytes_left);
|
ssize_t bytes = ws_read(fd, buf, bytes_left);
|
||||||
if (bytes <= 0) {
|
if (bytes <= 0) {
|
||||||
@ -823,21 +823,21 @@ clean_exit:
|
|||||||
* @param err [OUT] Error indicator. Uses wiretap values.
|
* @param err [OUT] Error indicator. Uses wiretap values.
|
||||||
* @param err_info [OUT] Error message.
|
* @param err_info [OUT] Error message.
|
||||||
* @param data_offset [OUT] data offset in the pipe.
|
* @param data_offset [OUT] data offset in the pipe.
|
||||||
* @return TRUE on success, FALSE on failure.
|
* @return true on success, false on failure.
|
||||||
*/
|
*/
|
||||||
static gboolean
|
static bool
|
||||||
raw_pipe_read(wtap_rec *rec, Buffer *buf, int *err, gchar **err_info, gint64 *data_offset) {
|
raw_pipe_read(wtap_rec *rec, Buffer *buf, int *err, char **err_info, int64_t *data_offset) {
|
||||||
struct pcap_pkthdr mem_hdr;
|
struct pcap_pkthdr mem_hdr;
|
||||||
struct pcaprec_hdr disk_hdr;
|
struct pcaprec_hdr disk_hdr;
|
||||||
ssize_t bytes_read = 0;
|
ssize_t bytes_read = 0;
|
||||||
unsigned int bytes_needed = (unsigned int) sizeof(disk_hdr);
|
unsigned int bytes_needed = (unsigned int) sizeof(disk_hdr);
|
||||||
guchar *ptr = (guchar*) &disk_hdr;
|
unsigned char *ptr = (unsigned char*) &disk_hdr;
|
||||||
|
|
||||||
*err = 0;
|
*err = 0;
|
||||||
|
|
||||||
if (want_pcap_pkthdr) {
|
if (want_pcap_pkthdr) {
|
||||||
bytes_needed = sizeof(mem_hdr);
|
bytes_needed = sizeof(mem_hdr);
|
||||||
ptr = (guchar*) &mem_hdr;
|
ptr = (unsigned char*) &mem_hdr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -853,7 +853,7 @@ raw_pipe_read(wtap_rec *rec, Buffer *buf, int *err, gchar **err_info, gint64 *da
|
|||||||
if (fd == 0 && GetHandleInformation(GetStdHandle(STD_INPUT_HANDLE), &ghi_flags) == 0) {
|
if (fd == 0 && GetHandleInformation(GetStdHandle(STD_INPUT_HANDLE), &ghi_flags) == 0) {
|
||||||
*err = 0;
|
*err = 0;
|
||||||
*err_info = NULL;
|
*err_info = NULL;
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -863,11 +863,11 @@ raw_pipe_read(wtap_rec *rec, Buffer *buf, int *err, gchar **err_info, gint64 *da
|
|||||||
if (bytes_read == 0) {
|
if (bytes_read == 0) {
|
||||||
*err = 0;
|
*err = 0;
|
||||||
*err_info = NULL;
|
*err_info = NULL;
|
||||||
return FALSE;
|
return false;
|
||||||
} else if (bytes_read < 0) {
|
} else if (bytes_read < 0) {
|
||||||
*err = errno;
|
*err = errno;
|
||||||
*err_info = NULL;
|
*err_info = NULL;
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
bytes_needed -= (unsigned int)bytes_read;
|
bytes_needed -= (unsigned int)bytes_read;
|
||||||
*data_offset += bytes_read;
|
*data_offset += bytes_read;
|
||||||
@ -878,7 +878,7 @@ raw_pipe_read(wtap_rec *rec, Buffer *buf, int *err, gchar **err_info, gint64 *da
|
|||||||
rec->presence_flags = WTAP_HAS_TS|WTAP_HAS_CAP_LEN;
|
rec->presence_flags = WTAP_HAS_TS|WTAP_HAS_CAP_LEN;
|
||||||
if (want_pcap_pkthdr) {
|
if (want_pcap_pkthdr) {
|
||||||
rec->ts.secs = mem_hdr.ts.tv_sec;
|
rec->ts.secs = mem_hdr.ts.tv_sec;
|
||||||
rec->ts.nsecs = (gint32)mem_hdr.ts.tv_usec * 1000;
|
rec->ts.nsecs = (int32_t)mem_hdr.ts.tv_usec * 1000;
|
||||||
rec->rec_header.packet_header.caplen = mem_hdr.caplen;
|
rec->rec_header.packet_header.caplen = mem_hdr.caplen;
|
||||||
rec->rec_header.packet_header.len = mem_hdr.len;
|
rec->rec_header.packet_header.len = mem_hdr.len;
|
||||||
} else {
|
} else {
|
||||||
@ -902,7 +902,7 @@ raw_pipe_read(wtap_rec *rec, Buffer *buf, int *err, gchar **err_info, gint64 *da
|
|||||||
*err = WTAP_ERR_BAD_FILE;
|
*err = WTAP_ERR_BAD_FILE;
|
||||||
*err_info = ws_strdup_printf("Bad packet length: %lu",
|
*err_info = ws_strdup_printf("Bad packet length: %lu",
|
||||||
(unsigned long) bytes_needed);
|
(unsigned long) bytes_needed);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ws_buffer_assure_space(buf, bytes_needed);
|
ws_buffer_assure_space(buf, bytes_needed);
|
||||||
@ -912,25 +912,25 @@ raw_pipe_read(wtap_rec *rec, Buffer *buf, int *err, gchar **err_info, gint64 *da
|
|||||||
if (bytes_read == 0) {
|
if (bytes_read == 0) {
|
||||||
*err = WTAP_ERR_SHORT_READ;
|
*err = WTAP_ERR_SHORT_READ;
|
||||||
*err_info = NULL;
|
*err_info = NULL;
|
||||||
return FALSE;
|
return false;
|
||||||
} else if (bytes_read < 0) {
|
} else if (bytes_read < 0) {
|
||||||
*err = errno;
|
*err = errno;
|
||||||
*err_info = NULL;
|
*err_info = NULL;
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
bytes_needed -= (unsigned int)bytes_read;
|
bytes_needed -= (unsigned int)bytes_read;
|
||||||
*data_offset += bytes_read;
|
*data_offset += bytes_read;
|
||||||
ptr += bytes_read;
|
ptr += bytes_read;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static bool
|
||||||
load_cap_file(capture_file *cf)
|
load_cap_file(capture_file *cf)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
gchar *err_info = NULL;
|
char *err_info = NULL;
|
||||||
gint64 data_offset = 0;
|
int64_t data_offset = 0;
|
||||||
|
|
||||||
wtap_rec rec;
|
wtap_rec rec;
|
||||||
Buffer buf;
|
Buffer buf;
|
||||||
@ -939,7 +939,7 @@ load_cap_file(capture_file *cf)
|
|||||||
wtap_rec_init(&rec);
|
wtap_rec_init(&rec);
|
||||||
ws_buffer_init(&buf, 1514);
|
ws_buffer_init(&buf, 1514);
|
||||||
|
|
||||||
epan_dissect_init(&edt, cf->epan, TRUE, FALSE);
|
epan_dissect_init(&edt, cf->epan, true, false);
|
||||||
|
|
||||||
while (raw_pipe_read(&rec, &buf, &err, &err_info, &data_offset)) {
|
while (raw_pipe_read(&rec, &buf, &err, &err_info, &data_offset)) {
|
||||||
process_packet(cf, &edt, data_offset, &rec, &buf);
|
process_packet(cf, &edt, data_offset, &rec, &buf);
|
||||||
@ -952,18 +952,18 @@ load_cap_file(capture_file *cf)
|
|||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
/* Print a message noting that the read failed somewhere along the line. */
|
/* Print a message noting that the read failed somewhere along the line. */
|
||||||
cfile_read_failure_message(cf->filename, err, err_info);
|
cfile_read_failure_message(cf->filename, err, err_info);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static bool
|
||||||
process_packet(capture_file *cf, epan_dissect_t *edt, gint64 offset,
|
process_packet(capture_file *cf, epan_dissect_t *edt, int64_t offset,
|
||||||
wtap_rec *rec, Buffer *buf)
|
wtap_rec *rec, Buffer *buf)
|
||||||
{
|
{
|
||||||
frame_data fdata;
|
frame_data fdata;
|
||||||
gboolean passed;
|
bool passed;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if(rec->rec_header.packet_header.len == 0)
|
if(rec->rec_header.packet_header.len == 0)
|
||||||
@ -972,11 +972,11 @@ process_packet(capture_file *cf, epan_dissect_t *edt, gint64 offset,
|
|||||||
packets to process. We spit out a line with the timestamp and the text "void"
|
packets to process. We spit out a line with the timestamp and the text "void"
|
||||||
*/
|
*/
|
||||||
printf("%lu %" PRIu64 " %d void -\n", (unsigned long int)cf->count,
|
printf("%lu %" PRIu64 " %d void -\n", (unsigned long int)cf->count,
|
||||||
(guint64)rec->ts.secs, rec->ts.nsecs);
|
(uint64_t)rec->ts.secs, rec->ts.nsecs);
|
||||||
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Count this packet. */
|
/* Count this packet. */
|
||||||
@ -987,7 +987,7 @@ process_packet(capture_file *cf, epan_dissect_t *edt, gint64 offset,
|
|||||||
do a dissection and do so. */
|
do a dissection and do so. */
|
||||||
frame_data_init(&fdata, cf->count, rec, offset, cum_bytes);
|
frame_data_init(&fdata, cf->count, rec, offset, cum_bytes);
|
||||||
|
|
||||||
passed = TRUE;
|
passed = true;
|
||||||
|
|
||||||
/* If we're running a read filter, prime the epan_dissect_t with that
|
/* If we're running a read filter, prime the epan_dissect_t with that
|
||||||
filter. */
|
filter. */
|
||||||
@ -1026,7 +1026,7 @@ process_packet(capture_file *cf, epan_dissect_t *edt, gint64 offset,
|
|||||||
if (rfcodes[i])
|
if (rfcodes[i])
|
||||||
passed = dfilter_apply_edt(rfcodes[i], edt);
|
passed = dfilter_apply_edt(rfcodes[i], edt);
|
||||||
else
|
else
|
||||||
passed = TRUE;
|
passed = true;
|
||||||
|
|
||||||
/* Print a one-line summary */
|
/* Print a one-line summary */
|
||||||
printf(" %d", passed ? 1 : 0);
|
printf(" %d", passed ? 1 : 0);
|
||||||
@ -1113,19 +1113,19 @@ static void field_display_to_string(header_field_info *hfi, char* buf, int size)
|
|||||||
*/
|
*/
|
||||||
#define FIELD_STR_INIT_LEN 256
|
#define FIELD_STR_INIT_LEN 256
|
||||||
#define cVALS(x) (const value_string*)(x)
|
#define cVALS(x) (const value_string*)(x)
|
||||||
static gboolean print_field_value(field_info *finfo, int cmd_line_index)
|
static bool print_field_value(field_info *finfo, int cmd_line_index)
|
||||||
{
|
{
|
||||||
const header_field_info *hfinfo;
|
const header_field_info *hfinfo;
|
||||||
char *fs_buf;
|
char *fs_buf;
|
||||||
char *fs_ptr = NULL;
|
char *fs_ptr = NULL;
|
||||||
static GString *label_s = NULL;
|
static GString *label_s = NULL;
|
||||||
size_t fs_len;
|
size_t fs_len;
|
||||||
guint i;
|
unsigned i;
|
||||||
string_fmt_t *sf;
|
string_fmt_t *sf;
|
||||||
guint32 uvalue;
|
uint32_t uvalue;
|
||||||
gint32 svalue;
|
int32_t svalue;
|
||||||
guint64 uvalue64;
|
uint64_t uvalue64;
|
||||||
gint64 svalue64;
|
int64_t svalue64;
|
||||||
|
|
||||||
hfinfo = finfo->hfinfo;
|
hfinfo = finfo->hfinfo;
|
||||||
|
|
||||||
@ -1229,14 +1229,14 @@ static gboolean print_field_value(field_info *finfo, int cmd_line_index)
|
|||||||
}
|
}
|
||||||
printf(" %d=\"%s\"", cmd_line_index, label_s->str);
|
printf(" %d=\"%s\"", cmd_line_index, label_s->str);
|
||||||
wmem_free(NULL, fs_buf);
|
wmem_free(NULL, fs_buf);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(fs_buf)
|
if(fs_buf)
|
||||||
{
|
{
|
||||||
printf(" %d=\"%s\"", cmd_line_index, fs_ptr);
|
printf(" %d=\"%s\"", cmd_line_index, fs_ptr);
|
||||||
wmem_free(NULL, fs_buf);
|
wmem_free(NULL, fs_buf);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1245,7 +1245,7 @@ static gboolean print_field_value(field_info *finfo, int cmd_line_index)
|
|||||||
* We return n.a.
|
* We return n.a.
|
||||||
*/
|
*/
|
||||||
printf(" %d=\"n.a.\"", cmd_line_index);
|
printf(" %d=\"n.a.\"", cmd_line_index);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static tap_packet_status
|
static tap_packet_status
|
||||||
@ -1253,7 +1253,7 @@ protocolinfo_packet(void *prs, packet_info *pinfo _U_, epan_dissect_t *edt, cons
|
|||||||
{
|
{
|
||||||
pci_t *rs=(pci_t *)prs;
|
pci_t *rs=(pci_t *)prs;
|
||||||
GPtrArray *gp;
|
GPtrArray *gp;
|
||||||
guint i;
|
unsigned i;
|
||||||
|
|
||||||
gp=proto_get_finfo_ptr_array(edt->tree, rs->hf_index);
|
gp=proto_get_finfo_ptr_array(edt->tree, rs->hf_index);
|
||||||
if(!gp){
|
if(!gp){
|
||||||
@ -1322,7 +1322,7 @@ protocolinfo_init(char *field)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
add_string_fmt(string_fmt_e format, gchar *plain) {
|
add_string_fmt(string_fmt_e format, char *plain) {
|
||||||
string_fmt_t *sf = g_new(string_fmt_t, 1);
|
string_fmt_t *sf = g_new(string_fmt_t, 1);
|
||||||
|
|
||||||
sf->format = format;
|
sf->format = format;
|
||||||
@ -1331,13 +1331,13 @@ add_string_fmt(string_fmt_e format, gchar *plain) {
|
|||||||
g_ptr_array_add(string_fmts, sf);
|
g_ptr_array_add(string_fmts, sf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static bool
|
||||||
parse_field_string_format(gchar *format) {
|
parse_field_string_format(char *format) {
|
||||||
size_t len;
|
size_t len;
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
|
|
||||||
if (!format) {
|
if (!format) {
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
GString *plain_s = g_string_new("");
|
GString *plain_s = g_string_new("");
|
||||||
@ -1348,7 +1348,7 @@ parse_field_string_format(gchar *format) {
|
|||||||
while (pos < len) {
|
while (pos < len) {
|
||||||
if (format[pos] == '%') {
|
if (format[pos] == '%') {
|
||||||
if (pos >= (len-1)) { /* There should always be a following specifier character */
|
if (pos >= (len-1)) { /* There should always be a following specifier character */
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
pos++;
|
pos++;
|
||||||
if (plain_s->len > 0) {
|
if (plain_s->len > 0) {
|
||||||
@ -1369,7 +1369,7 @@ parse_field_string_format(gchar *format) {
|
|||||||
g_string_append_c(plain_s, '%');
|
g_string_append_c(plain_s, '%');
|
||||||
break;
|
break;
|
||||||
default: /* Invalid format */
|
default: /* Invalid format */
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
g_string_append_c(plain_s, format[pos]);
|
g_string_append_c(plain_s, format[pos]);
|
||||||
@ -1382,7 +1382,7 @@ parse_field_string_format(gchar *format) {
|
|||||||
}
|
}
|
||||||
g_string_free(plain_s, TRUE);
|
g_string_free(plain_s, TRUE);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
/****************************************************************************************
|
/****************************************************************************************
|
||||||
* END OF FIELD EXTRACTION ROUTINES
|
* END OF FIELD EXTRACTION ROUTINES
|
||||||
@ -1446,15 +1446,15 @@ raw_cf_open(capture_file *cf, const char *fname)
|
|||||||
cf->filename = g_strdup(fname);
|
cf->filename = g_strdup(fname);
|
||||||
|
|
||||||
/* Indicate whether it's a permanent or temporary file. */
|
/* Indicate whether it's a permanent or temporary file. */
|
||||||
cf->is_tempfile = FALSE;
|
cf->is_tempfile = false;
|
||||||
|
|
||||||
/* No user changes yet. */
|
/* No user changes yet. */
|
||||||
cf->unsaved_changes = FALSE;
|
cf->unsaved_changes = false;
|
||||||
|
|
||||||
cf->cd_t = WTAP_FILE_TYPE_SUBTYPE_UNKNOWN;
|
cf->cd_t = WTAP_FILE_TYPE_SUBTYPE_UNKNOWN;
|
||||||
cf->open_type = WTAP_TYPE_AUTO;
|
cf->open_type = WTAP_TYPE_AUTO;
|
||||||
cf->count = 0;
|
cf->count = 0;
|
||||||
cf->drops_known = FALSE;
|
cf->drops_known = false;
|
||||||
cf->drops = 0;
|
cf->drops = 0;
|
||||||
cf->snap = 0;
|
cf->snap = 0;
|
||||||
nstime_set_zero(&cf->elapsed_time);
|
nstime_set_zero(&cf->elapsed_time);
|
||||||
|
228
tfshark.c
228
tfshark.c
@ -77,14 +77,14 @@
|
|||||||
|
|
||||||
capture_file cfile;
|
capture_file cfile;
|
||||||
|
|
||||||
static guint32 cum_bytes;
|
static uint32_t cum_bytes;
|
||||||
static frame_data ref_frame;
|
static frame_data ref_frame;
|
||||||
static frame_data prev_dis_frame;
|
static frame_data prev_dis_frame;
|
||||||
static frame_data prev_cap_frame;
|
static frame_data prev_cap_frame;
|
||||||
|
|
||||||
static gboolean prefs_loaded;
|
static bool prefs_loaded;
|
||||||
|
|
||||||
static gboolean perform_two_pass_analysis;
|
static bool perform_two_pass_analysis;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The way the packet decode is to be written.
|
* The way the packet decode is to be written.
|
||||||
@ -97,13 +97,13 @@ typedef enum {
|
|||||||
} output_action_e;
|
} output_action_e;
|
||||||
|
|
||||||
static output_action_e output_action;
|
static output_action_e output_action;
|
||||||
static gboolean do_dissection; /* TRUE if we have to dissect each packet */
|
static bool do_dissection; /* true if we have to dissect each packet */
|
||||||
static gboolean print_packet_info; /* TRUE if we're to print packet information */
|
static bool print_packet_info; /* true if we're to print packet information */
|
||||||
static gint print_summary = -1; /* TRUE if we're to print packet summary information */
|
static int print_summary = -1; /* true if we're to print packet summary information */
|
||||||
static gboolean print_details; /* TRUE if we're to print packet details information */
|
static bool print_details; /* true if we're to print packet details information */
|
||||||
static gboolean print_hex; /* TRUE if we're to print hex/ascii information */
|
static bool print_hex; /* true if we're to print hex/ascii information */
|
||||||
static gboolean line_buffered;
|
static bool line_buffered;
|
||||||
static gboolean really_quiet;
|
static bool really_quiet;
|
||||||
|
|
||||||
static print_format_e print_format = PR_FMT_TEXT;
|
static print_format_e print_format = PR_FMT_TEXT;
|
||||||
static print_stream_t *print_stream;
|
static print_stream_t *print_stream;
|
||||||
@ -113,14 +113,14 @@ static output_fields_t* output_fields;
|
|||||||
/* The line separator used between packets, changeable via the -S option */
|
/* The line separator used between packets, changeable via the -S option */
|
||||||
static const char *separator = "";
|
static const char *separator = "";
|
||||||
|
|
||||||
static gboolean process_file(capture_file *, int, gint64);
|
static bool process_file(capture_file *, int, int64_t);
|
||||||
static gboolean process_packet_single_pass(capture_file *cf,
|
static bool process_packet_single_pass(capture_file *cf,
|
||||||
epan_dissect_t *edt, gint64 offset, wtap_rec *rec,
|
epan_dissect_t *edt, int64_t offset, wtap_rec *rec,
|
||||||
const guchar *pd);
|
const unsigned char *pd);
|
||||||
static void show_print_file_io_error(int err);
|
static void show_print_file_io_error(int err);
|
||||||
static gboolean write_preamble(capture_file *cf);
|
static bool write_preamble(capture_file *cf);
|
||||||
static gboolean print_packet(capture_file *cf, epan_dissect_t *edt);
|
static bool print_packet(capture_file *cf, epan_dissect_t *edt);
|
||||||
static gboolean write_finale(void);
|
static bool write_finale(void);
|
||||||
|
|
||||||
static void tfshark_cmdarg_err(const char *msg_format, va_list ap);
|
static void tfshark_cmdarg_err(const char *msg_format, va_list ap);
|
||||||
static void tfshark_cmdarg_err_cont(const char *msg_format, va_list ap);
|
static void tfshark_cmdarg_err_cont(const char *msg_format, va_list ap);
|
||||||
@ -133,7 +133,7 @@ struct string_elem {
|
|||||||
const char *lstr; /* The long string */
|
const char *lstr; /* The long string */
|
||||||
};
|
};
|
||||||
|
|
||||||
static gint
|
static int
|
||||||
string_compare(const void *a, const void *b)
|
string_compare(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
return strcmp(((const struct string_elem *)a)->sstr,
|
return strcmp(((const struct string_elem *)a)->sstr,
|
||||||
@ -245,7 +245,7 @@ glossary_option_help(void)
|
|||||||
static void
|
static void
|
||||||
print_current_user(void)
|
print_current_user(void)
|
||||||
{
|
{
|
||||||
gchar *cur_user, *cur_group;
|
char *cur_user, *cur_group;
|
||||||
|
|
||||||
if (started_with_special_privs()) {
|
if (started_with_special_privs()) {
|
||||||
cur_user = get_cur_username();
|
cur_user = get_cur_username();
|
||||||
@ -271,20 +271,20 @@ main(int argc, char *argv[])
|
|||||||
{"version", ws_no_argument, NULL, 'v'},
|
{"version", ws_no_argument, NULL, 'v'},
|
||||||
{0, 0, 0, 0 }
|
{0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
gboolean arg_error = FALSE;
|
bool arg_error = false;
|
||||||
|
|
||||||
int err;
|
int err;
|
||||||
volatile gboolean success;
|
volatile bool success;
|
||||||
volatile int exit_status = 0;
|
volatile int exit_status = 0;
|
||||||
gboolean quiet = FALSE;
|
bool quiet = false;
|
||||||
gchar *volatile cf_name = NULL;
|
char *volatile cf_name = NULL;
|
||||||
gchar *rfilter = NULL;
|
char *rfilter = NULL;
|
||||||
gchar *dfilter = NULL;
|
char *dfilter = NULL;
|
||||||
dfilter_t *rfcode = NULL;
|
dfilter_t *rfcode = NULL;
|
||||||
dfilter_t *dfcode = NULL;
|
dfilter_t *dfcode = NULL;
|
||||||
df_error_t *df_err;
|
df_error_t *df_err;
|
||||||
e_prefs *prefs_p;
|
e_prefs *prefs_p;
|
||||||
gchar *output_only = NULL;
|
char *output_only = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The leading + ensures that getopt_long() does not permute the argv[]
|
* The leading + ensures that getopt_long() does not permute the argv[]
|
||||||
@ -389,9 +389,9 @@ main(int argc, char *argv[])
|
|||||||
while ((opt = ws_getopt_long(argc, argv, optstring, long_options, NULL)) != -1) {
|
while ((opt = ws_getopt_long(argc, argv, optstring, long_options, NULL)) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'C': /* Configuration Profile */
|
case 'C': /* Configuration Profile */
|
||||||
if (profile_exists (ws_optarg, FALSE)) {
|
if (profile_exists (ws_optarg, false)) {
|
||||||
set_profile_name (ws_optarg);
|
set_profile_name (ws_optarg);
|
||||||
} else if (profile_exists (ws_optarg, TRUE)) {
|
} else if (profile_exists (ws_optarg, true)) {
|
||||||
char *pf_dir_path, *pf_dir_path2, *pf_filename;
|
char *pf_dir_path, *pf_dir_path2, *pf_filename;
|
||||||
/* Copy from global profile */
|
/* Copy from global profile */
|
||||||
if (create_persconffile_profile(ws_optarg, &pf_dir_path) == -1) {
|
if (create_persconffile_profile(ws_optarg, &pf_dir_path) == -1) {
|
||||||
@ -402,7 +402,7 @@ main(int argc, char *argv[])
|
|||||||
exit_status = WS_EXIT_INVALID_FILE;
|
exit_status = WS_EXIT_INVALID_FILE;
|
||||||
goto clean_exit;
|
goto clean_exit;
|
||||||
}
|
}
|
||||||
if (copy_persconffile_profile(ws_optarg, ws_optarg, TRUE, &pf_filename,
|
if (copy_persconffile_profile(ws_optarg, ws_optarg, true, &pf_filename,
|
||||||
&pf_dir_path, &pf_dir_path2) == -1) {
|
&pf_dir_path, &pf_dir_path2) == -1) {
|
||||||
cmdarg_err("Can't copy file \"%s\" in directory\n\"%s\" to\n\"%s\":\n%s.",
|
cmdarg_err("Can't copy file \"%s\" in directory\n\"%s\" to\n\"%s\":\n%s.",
|
||||||
pf_filename, pf_dir_path2, pf_dir_path, g_strerror(errno));
|
pf_filename, pf_dir_path2, pf_dir_path, g_strerror(errno));
|
||||||
@ -423,15 +423,15 @@ main(int argc, char *argv[])
|
|||||||
output_only = g_strdup(ws_optarg);
|
output_only = g_strdup(ws_optarg);
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
case 'V': /* Verbose */
|
case 'V': /* Verbose */
|
||||||
print_details = TRUE;
|
print_details = true;
|
||||||
print_packet_info = TRUE;
|
print_packet_info = true;
|
||||||
break;
|
break;
|
||||||
case 'x': /* Print packet data in hex (and ASCII) */
|
case 'x': /* Print packet data in hex (and ASCII) */
|
||||||
print_hex = TRUE;
|
print_hex = true;
|
||||||
/* The user asked for hex output, so let's ensure they get it,
|
/* The user asked for hex output, so let's ensure they get it,
|
||||||
* even if they're writing to a file.
|
* even if they're writing to a file.
|
||||||
*/
|
*/
|
||||||
print_packet_info = TRUE;
|
print_packet_info = true;
|
||||||
break;
|
break;
|
||||||
case 'X':
|
case 'X':
|
||||||
ex_opt_add(ws_optarg);
|
ex_opt_add(ws_optarg);
|
||||||
@ -448,7 +448,7 @@ main(int argc, char *argv[])
|
|||||||
* necessarily requiring that either the summary or details be printed too.
|
* necessarily requiring that either the summary or details be printed too.
|
||||||
*/
|
*/
|
||||||
if (print_summary == -1)
|
if (print_summary == -1)
|
||||||
print_summary = (print_details || print_hex) ? FALSE : TRUE;
|
print_summary = (print_details || print_hex) ? false : true;
|
||||||
|
|
||||||
init_report_message("tfshark", &tfshark_report_routines);
|
init_report_message("tfshark", &tfshark_report_routines);
|
||||||
|
|
||||||
@ -468,13 +468,13 @@ main(int argc, char *argv[])
|
|||||||
* capture files, but that mechanism should support plugins for
|
* capture files, but that mechanism should support plugins for
|
||||||
* other files, too, if *their* formats are extensible.
|
* other files, too, if *their* formats are extensible.
|
||||||
*/
|
*/
|
||||||
wtap_init(TRUE);
|
wtap_init(true);
|
||||||
|
|
||||||
/* Register all dissectors; we must do this before checking for the
|
/* Register all dissectors; we must do this before checking for the
|
||||||
"-G" flag, as the "-G" flag dumps information registered by the
|
"-G" flag, as the "-G" flag dumps information registered by the
|
||||||
dissectors, and we must do it before we read the preferences, in
|
dissectors, and we must do it before we read the preferences, in
|
||||||
case any dissectors register preferences. */
|
case any dissectors register preferences. */
|
||||||
if (!epan_init(NULL, NULL, TRUE)) {
|
if (!epan_init(NULL, NULL, true)) {
|
||||||
exit_status = WS_EXIT_INIT_FAILED;
|
exit_status = WS_EXIT_INIT_FAILED;
|
||||||
goto clean_exit;
|
goto clean_exit;
|
||||||
}
|
}
|
||||||
@ -550,7 +550,7 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
/* Load libwireshark settings from the current profile. */
|
/* Load libwireshark settings from the current profile. */
|
||||||
prefs_p = epan_load_settings();
|
prefs_p = epan_load_settings();
|
||||||
prefs_loaded = TRUE;
|
prefs_loaded = true;
|
||||||
|
|
||||||
cap_file_init(&cfile);
|
cap_file_init(&cfile);
|
||||||
|
|
||||||
@ -573,7 +573,7 @@ main(int argc, char *argv[])
|
|||||||
while ((opt = ws_getopt_long(argc, argv, optstring, long_options, NULL)) != -1) {
|
while ((opt = ws_getopt_long(argc, argv, optstring, long_options, NULL)) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case '2': /* Perform two-pass analysis */
|
case '2': /* Perform two-pass analysis */
|
||||||
perform_two_pass_analysis = TRUE;
|
perform_two_pass_analysis = true;
|
||||||
break;
|
break;
|
||||||
case 'C':
|
case 'C':
|
||||||
/* already processed; just ignore it now */
|
/* already processed; just ignore it now */
|
||||||
@ -622,7 +622,7 @@ main(int argc, char *argv[])
|
|||||||
anything to happen, it should be as good as line-buffered
|
anything to happen, it should be as good as line-buffered
|
||||||
mode if we're printing protocol trees - arguably even
|
mode if we're printing protocol trees - arguably even
|
||||||
better, as it may do fewer writes. */
|
better, as it may do fewer writes. */
|
||||||
line_buffered = TRUE;
|
line_buffered = true;
|
||||||
break;
|
break;
|
||||||
case 'o': /* Override preference from command line */
|
case 'o': /* Override preference from command line */
|
||||||
{
|
{
|
||||||
@ -656,11 +656,11 @@ main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'q': /* Quiet */
|
case 'q': /* Quiet */
|
||||||
quiet = TRUE;
|
quiet = true;
|
||||||
break;
|
break;
|
||||||
case 'Q': /* Really quiet */
|
case 'Q': /* Really quiet */
|
||||||
quiet = TRUE;
|
quiet = true;
|
||||||
really_quiet = TRUE;
|
really_quiet = true;
|
||||||
break;
|
break;
|
||||||
case 'r': /* Read capture file x */
|
case 'r': /* Read capture file x */
|
||||||
cf_name = g_strdup(ws_optarg);
|
cf_name = g_strdup(ws_optarg);
|
||||||
@ -680,16 +680,16 @@ main(int argc, char *argv[])
|
|||||||
print_format = PR_FMT_PS;
|
print_format = PR_FMT_PS;
|
||||||
} else if (strcmp(ws_optarg, "pdml") == 0) {
|
} else if (strcmp(ws_optarg, "pdml") == 0) {
|
||||||
output_action = WRITE_XML;
|
output_action = WRITE_XML;
|
||||||
print_details = TRUE; /* Need details */
|
print_details = true; /* Need details */
|
||||||
print_summary = FALSE; /* Don't allow summary */
|
print_summary = false; /* Don't allow summary */
|
||||||
} else if (strcmp(ws_optarg, "psml") == 0) {
|
} else if (strcmp(ws_optarg, "psml") == 0) {
|
||||||
output_action = WRITE_XML;
|
output_action = WRITE_XML;
|
||||||
print_details = FALSE; /* Don't allow details */
|
print_details = false; /* Don't allow details */
|
||||||
print_summary = TRUE; /* Need summary */
|
print_summary = true; /* Need summary */
|
||||||
} else if (strcmp(ws_optarg, "fields") == 0) {
|
} else if (strcmp(ws_optarg, "fields") == 0) {
|
||||||
output_action = WRITE_FIELDS;
|
output_action = WRITE_FIELDS;
|
||||||
print_details = TRUE; /* Need full tree info */
|
print_details = true; /* Need full tree info */
|
||||||
print_summary = FALSE; /* Don't allow summary */
|
print_summary = false; /* Don't allow summary */
|
||||||
} else {
|
} else {
|
||||||
cmdarg_err("Invalid -T parameter \"%s\"; it must be one of:", ws_optarg); /* x */
|
cmdarg_err("Invalid -T parameter \"%s\"; it must be one of:", ws_optarg); /* x */
|
||||||
cmdarg_err_cont("\t\"fields\" The values of fields specified with the -e option, in a form\n"
|
cmdarg_err_cont("\t\"fields\" The values of fields specified with the -e option, in a form\n"
|
||||||
@ -804,7 +804,7 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
/* if "-q" wasn't specified, we should print packet information */
|
/* if "-q" wasn't specified, we should print packet information */
|
||||||
if (!quiet)
|
if (!quiet)
|
||||||
print_packet_info = TRUE;
|
print_packet_info = true;
|
||||||
|
|
||||||
if (arg_error) {
|
if (arg_error) {
|
||||||
print_usage(stderr);
|
print_usage(stderr);
|
||||||
@ -856,7 +856,7 @@ main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Build the column format array */
|
/* Build the column format array */
|
||||||
build_column_format_array(&cfile.cinfo, prefs_p->num_cols, TRUE);
|
build_column_format_array(&cfile.cinfo, prefs_p->num_cols, true);
|
||||||
|
|
||||||
if (rfilter != NULL) {
|
if (rfilter != NULL) {
|
||||||
if (!dfilter_compile(rfilter, &rfcode, &df_err)) {
|
if (!dfilter_compile(rfilter, &rfcode, &df_err)) {
|
||||||
@ -941,7 +941,7 @@ main(int argc, char *argv[])
|
|||||||
"\n"
|
"\n"
|
||||||
"Some infos / workarounds can be found at:\n"
|
"Some infos / workarounds can be found at:\n"
|
||||||
WS_WIKI_URL("KnownBugs/OutOfMemory") "\n");
|
WS_WIKI_URL("KnownBugs/OutOfMemory") "\n");
|
||||||
success = FALSE;
|
success = false;
|
||||||
}
|
}
|
||||||
ENDTRY;
|
ENDTRY;
|
||||||
|
|
||||||
@ -958,7 +958,7 @@ main(int argc, char *argv[])
|
|||||||
cfile.provider.frames = NULL;
|
cfile.provider.frames = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
draw_tap_listeners(TRUE);
|
draw_tap_listeners(true);
|
||||||
funnel_dump_all_text_windows();
|
funnel_dump_all_text_windows();
|
||||||
|
|
||||||
clean_exit:
|
clean_exit:
|
||||||
@ -975,7 +975,7 @@ clean_exit:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
no_interface_name(struct packet_provider_data *prov _U_, guint32 interface_id _U_, unsigned section_number _U_)
|
no_interface_name(struct packet_provider_data *prov _U_, uint32_t interface_id _U_, unsigned section_number _U_)
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -994,14 +994,14 @@ tfshark_epan_new(capture_file *cf)
|
|||||||
return epan_new(&cf->provider, &funcs);
|
return epan_new(&cf->provider, &funcs);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static bool
|
||||||
process_packet_first_pass(capture_file *cf, epan_dissect_t *edt,
|
process_packet_first_pass(capture_file *cf, epan_dissect_t *edt,
|
||||||
gint64 offset, wtap_rec *rec,
|
int64_t offset, wtap_rec *rec,
|
||||||
const guchar *pd)
|
const unsigned char *pd)
|
||||||
{
|
{
|
||||||
frame_data fdlocal;
|
frame_data fdlocal;
|
||||||
guint32 framenum;
|
uint32_t framenum;
|
||||||
gboolean passed;
|
bool passed;
|
||||||
|
|
||||||
/* The frame number of this packet is one more than the count of
|
/* The frame number of this packet is one more than the count of
|
||||||
frames in this packet. */
|
frames in this packet. */
|
||||||
@ -1010,7 +1010,7 @@ process_packet_first_pass(capture_file *cf, epan_dissect_t *edt,
|
|||||||
/* If we're not running a display filter and we're not printing any
|
/* If we're not running a display filter and we're not printing any
|
||||||
packet information, we don't need to do a dissection. This means
|
packet information, we don't need to do a dissection. This means
|
||||||
that all packets can be marked as 'passed'. */
|
that all packets can be marked as 'passed'. */
|
||||||
passed = TRUE;
|
passed = true;
|
||||||
|
|
||||||
frame_data_init(&fdlocal, framenum, rec, offset, cum_bytes);
|
frame_data_init(&fdlocal, framenum, rec, offset, cum_bytes);
|
||||||
|
|
||||||
@ -1068,18 +1068,18 @@ process_packet_first_pass(capture_file *cf, epan_dissect_t *edt,
|
|||||||
return passed;
|
return passed;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static bool
|
||||||
process_packet_second_pass(capture_file *cf, epan_dissect_t *edt,
|
process_packet_second_pass(capture_file *cf, epan_dissect_t *edt,
|
||||||
frame_data *fdata, wtap_rec *rec,
|
frame_data *fdata, wtap_rec *rec,
|
||||||
Buffer *buf)
|
Buffer *buf)
|
||||||
{
|
{
|
||||||
column_info *cinfo;
|
column_info *cinfo;
|
||||||
gboolean passed;
|
bool passed;
|
||||||
|
|
||||||
/* If we're not running a display filter and we're not printing any
|
/* If we're not running a display filter and we're not printing any
|
||||||
packet information, we don't need to do a dissection. This means
|
packet information, we don't need to do a dissection. This means
|
||||||
that all packets can be marked as 'passed'. */
|
that all packets can be marked as 'passed'. */
|
||||||
passed = TRUE;
|
passed = true;
|
||||||
|
|
||||||
/* If we're going to print packet information, or we're going to
|
/* If we're going to print packet information, or we're going to
|
||||||
run a read filter, or we're going to process taps, set up to
|
run a read filter, or we're going to process taps, set up to
|
||||||
@ -1139,7 +1139,7 @@ process_packet_second_pass(capture_file *cf, epan_dissect_t *edt,
|
|||||||
|
|
||||||
if (ferror(stdout)) {
|
if (ferror(stdout)) {
|
||||||
show_print_file_io_error(errno);
|
show_print_file_io_error(errno);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cf->provider.prev_dis = fdata;
|
cf->provider.prev_dis = fdata;
|
||||||
@ -1152,13 +1152,13 @@ process_packet_second_pass(capture_file *cf, epan_dissect_t *edt,
|
|||||||
return passed || fdata->dependent_of_displayed;
|
return passed || fdata->dependent_of_displayed;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static bool
|
||||||
local_wtap_read(capture_file *cf, wtap_rec *file_rec _U_, int *err, gchar **err_info _U_, gint64 *data_offset _U_, guint8** data_buffer)
|
local_wtap_read(capture_file *cf, wtap_rec *file_rec _U_, int *err, char **err_info _U_, int64_t *data_offset _U_, uint8_t** data_buffer)
|
||||||
{
|
{
|
||||||
/* int bytes_read; */
|
/* int bytes_read; */
|
||||||
gint64 packet_size = wtap_file_size(cf->provider.wth, err);
|
int64_t packet_size = wtap_file_size(cf->provider.wth, err);
|
||||||
|
|
||||||
*data_buffer = (guint8*)g_malloc((gsize)packet_size);
|
*data_buffer = (uint8_t*)g_malloc((size_t)packet_size);
|
||||||
/* bytes_read =*/ file_read(*data_buffer, (unsigned int)packet_size, cf->provider.wth->fh);
|
/* bytes_read =*/ file_read(*data_buffer, (unsigned int)packet_size, cf->provider.wth->fh);
|
||||||
|
|
||||||
#if 0 /* no more filetap */
|
#if 0 /* no more filetap */
|
||||||
@ -1166,16 +1166,16 @@ local_wtap_read(capture_file *cf, wtap_rec *file_rec _U_, int *err, gchar **err_
|
|||||||
*err = file_error(cf->provider.wth->fh, err_info);
|
*err = file_error(cf->provider.wth->fh, err_info);
|
||||||
if (*err == 0)
|
if (*err == 0)
|
||||||
*err = FTAP_ERR_SHORT_READ;
|
*err = FTAP_ERR_SHORT_READ;
|
||||||
return FALSE;
|
return false;
|
||||||
} else if (bytes_read == 0) {
|
} else if (bytes_read == 0) {
|
||||||
/* Done with file, no error */
|
/* Done with file, no error */
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* XXX - SET FRAME SIZE EQUAL TO TOTAL FILE SIZE */
|
/* XXX - SET FRAME SIZE EQUAL TO TOTAL FILE SIZE */
|
||||||
file_rec->rec_header.packet_header.caplen = (guint32)packet_size;
|
file_rec->rec_header.packet_header.caplen = (uint32_t)packet_size;
|
||||||
file_rec->rec_header.packet_header.len = (guint32)packet_size;
|
file_rec->rec_header.packet_header.len = (uint32_t)packet_size;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set the packet encapsulation to the file's encapsulation
|
* Set the packet encapsulation to the file's encapsulation
|
||||||
@ -1199,7 +1199,7 @@ local_wtap_read(capture_file *cf, wtap_rec *file_rec _U_, int *err, gchar **err_
|
|||||||
*/
|
*/
|
||||||
if (*err == 0)
|
if (*err == 0)
|
||||||
*err = file_error(wth->fh, err_info);
|
*err = file_error(wth->fh, err_info);
|
||||||
return FALSE; /* failure */
|
return false; /* failure */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1218,22 +1218,22 @@ local_wtap_read(capture_file *cf, wtap_rec *file_rec _U_, int *err, gchar **err_
|
|||||||
ws_assert(wth->rec.rec_header.packet_header.pkt_encap != WTAP_ENCAP_PER_PACKET);
|
ws_assert(wth->rec.rec_header.packet_header.pkt_encap != WTAP_ENCAP_PER_PACKET);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return TRUE; /* success */
|
return true; /* success */
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static bool
|
||||||
process_file(capture_file *cf, int max_packet_count, gint64 max_byte_count)
|
process_file(capture_file *cf, int max_packet_count, int64_t max_byte_count)
|
||||||
{
|
{
|
||||||
guint32 framenum;
|
uint32_t framenum;
|
||||||
int err;
|
int err;
|
||||||
gchar *err_info = NULL;
|
char *err_info = NULL;
|
||||||
gint64 data_offset = 0;
|
int64_t data_offset = 0;
|
||||||
gboolean filtering_tap_listeners;
|
bool filtering_tap_listeners;
|
||||||
guint tap_flags;
|
unsigned tap_flags;
|
||||||
Buffer buf;
|
Buffer buf;
|
||||||
epan_dissect_t *edt = NULL;
|
epan_dissect_t *edt = NULL;
|
||||||
wtap_rec file_rec;
|
wtap_rec file_rec;
|
||||||
guint8* raw_data;
|
uint8_t* raw_data;
|
||||||
|
|
||||||
if (print_packet_info) {
|
if (print_packet_info) {
|
||||||
if (!write_preamble(cf)) {
|
if (!write_preamble(cf)) {
|
||||||
@ -1261,7 +1261,7 @@ process_file(capture_file *cf, int max_packet_count, gint64 max_byte_count)
|
|||||||
cf->provider.frames = new_frame_data_sequence();
|
cf->provider.frames = new_frame_data_sequence();
|
||||||
|
|
||||||
if (do_dissection) {
|
if (do_dissection) {
|
||||||
gboolean create_proto_tree;
|
bool create_proto_tree;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Determine whether we need to create a protocol tree.
|
* Determine whether we need to create a protocol tree.
|
||||||
@ -1277,7 +1277,7 @@ process_file(capture_file *cf, int max_packet_count, gint64 max_byte_count)
|
|||||||
|
|
||||||
/* We're not going to display the protocol tree on this pass,
|
/* We're not going to display the protocol tree on this pass,
|
||||||
so it's not going to be "visible". */
|
so it's not going to be "visible". */
|
||||||
edt = epan_dissect_new(cf->epan, create_proto_tree, FALSE);
|
edt = epan_dissect_new(cf->epan, create_proto_tree, false);
|
||||||
}
|
}
|
||||||
while (local_wtap_read(cf, &file_rec, &err, &err_info, &data_offset, &raw_data)) {
|
while (local_wtap_read(cf, &file_rec, &err, &err_info, &data_offset, &raw_data)) {
|
||||||
if (process_packet_first_pass(cf, edt, data_offset, &file_rec, raw_data)) {
|
if (process_packet_first_pass(cf, edt, data_offset, &file_rec, raw_data)) {
|
||||||
@ -1313,7 +1313,7 @@ process_file(capture_file *cf, int max_packet_count, gint64 max_byte_count)
|
|||||||
ws_buffer_init(&buf, 1514);
|
ws_buffer_init(&buf, 1514);
|
||||||
|
|
||||||
if (do_dissection) {
|
if (do_dissection) {
|
||||||
gboolean create_proto_tree;
|
bool create_proto_tree;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Determine whether we need to create a protocol tree.
|
* Determine whether we need to create a protocol tree.
|
||||||
@ -1348,7 +1348,7 @@ process_file(capture_file *cf, int max_packet_count, gint64 max_byte_count)
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (!process_packet_second_pass(cf, edt, fdata, &cf->rec, &buf))
|
if (!process_packet_second_pass(cf, edt, fdata, &cf->rec, &buf))
|
||||||
return FALSE;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1363,7 +1363,7 @@ process_file(capture_file *cf, int max_packet_count, gint64 max_byte_count)
|
|||||||
framenum = 0;
|
framenum = 0;
|
||||||
|
|
||||||
if (do_dissection) {
|
if (do_dissection) {
|
||||||
gboolean create_proto_tree;
|
bool create_proto_tree;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Determine whether we need to create a protocol tree.
|
* Determine whether we need to create a protocol tree.
|
||||||
@ -1404,7 +1404,7 @@ process_file(capture_file *cf, int max_packet_count, gint64 max_byte_count)
|
|||||||
if (!process_packet_single_pass(cf, edt, data_offset,
|
if (!process_packet_single_pass(cf, edt, data_offset,
|
||||||
&file_rec/*wtap_get_rec(cf->provider.wth)*/,
|
&file_rec/*wtap_get_rec(cf->provider.wth)*/,
|
||||||
raw_data))
|
raw_data))
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
/* Stop reading if we have the maximum number of packets;
|
/* Stop reading if we have the maximum number of packets;
|
||||||
* When the -c option has not been used, max_packet_count
|
* When the -c option has not been used, max_packet_count
|
||||||
@ -1508,13 +1508,13 @@ out:
|
|||||||
return (err != 0);
|
return (err != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static bool
|
||||||
process_packet_single_pass(capture_file *cf, epan_dissect_t *edt, gint64 offset,
|
process_packet_single_pass(capture_file *cf, epan_dissect_t *edt, int64_t offset,
|
||||||
wtap_rec *rec, const guchar *pd)
|
wtap_rec *rec, const unsigned char *pd)
|
||||||
{
|
{
|
||||||
frame_data fdata;
|
frame_data fdata;
|
||||||
column_info *cinfo;
|
column_info *cinfo;
|
||||||
gboolean passed;
|
bool passed;
|
||||||
|
|
||||||
/* Count this packet. */
|
/* Count this packet. */
|
||||||
cf->count++;
|
cf->count++;
|
||||||
@ -1522,7 +1522,7 @@ process_packet_single_pass(capture_file *cf, epan_dissect_t *edt, gint64 offset,
|
|||||||
/* If we're not running a display filter and we're not printing any
|
/* If we're not running a display filter and we're not printing any
|
||||||
packet information, we don't need to do a dissection. This means
|
packet information, we don't need to do a dissection. This means
|
||||||
that all packets can be marked as 'passed'. */
|
that all packets can be marked as 'passed'. */
|
||||||
passed = TRUE;
|
passed = true;
|
||||||
|
|
||||||
frame_data_init(&fdata, cf->count, rec, offset, cum_bytes);
|
frame_data_init(&fdata, cf->count, rec, offset, cum_bytes);
|
||||||
|
|
||||||
@ -1582,7 +1582,7 @@ process_packet_single_pass(capture_file *cf, epan_dissect_t *edt, gint64 offset,
|
|||||||
|
|
||||||
if (ferror(stdout)) {
|
if (ferror(stdout)) {
|
||||||
show_print_file_io_error(errno);
|
show_print_file_io_error(errno);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1601,7 +1601,7 @@ process_packet_single_pass(capture_file *cf, epan_dissect_t *edt, gint64 offset,
|
|||||||
return passed;
|
return passed;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static bool
|
||||||
write_preamble(capture_file *cf)
|
write_preamble(capture_file *cf)
|
||||||
{
|
{
|
||||||
switch (output_action) {
|
switch (output_action) {
|
||||||
@ -1622,7 +1622,7 @@ write_preamble(capture_file *cf)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
ws_assert_not_reached();
|
ws_assert_not_reached();
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1678,7 +1678,7 @@ put_string_spaces(char *dest, const char *str, size_t str_len, size_t str_with_s
|
|||||||
dest[str_with_spaces] = '\0';
|
dest[str_with_spaces] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static bool
|
||||||
print_columns(capture_file *cf)
|
print_columns(capture_file *cf)
|
||||||
{
|
{
|
||||||
char *line_bufp;
|
char *line_bufp;
|
||||||
@ -1696,7 +1696,7 @@ print_columns(capture_file *cf)
|
|||||||
/* Skip columns not marked as visible. */
|
/* Skip columns not marked as visible. */
|
||||||
if (!get_column_visible(i))
|
if (!get_column_visible(i))
|
||||||
continue;
|
continue;
|
||||||
const gchar* col_text = get_column_text(&cf->cinfo, i);
|
const char* col_text = get_column_text(&cf->cinfo, i);
|
||||||
switch (col_item->col_fmt) {
|
switch (col_item->col_fmt) {
|
||||||
case COL_NUMBER:
|
case COL_NUMBER:
|
||||||
column_len = col_len = strlen(col_text);
|
column_len = col_len = strlen(col_text);
|
||||||
@ -1902,12 +1902,12 @@ print_columns(capture_file *cf)
|
|||||||
return print_line(print_stream, 0, line_bufp);
|
return print_line(print_stream, 0, line_bufp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static bool
|
||||||
print_packet(capture_file *cf, epan_dissect_t *edt)
|
print_packet(capture_file *cf, epan_dissect_t *edt)
|
||||||
{
|
{
|
||||||
if (print_summary || output_fields_has_cols(output_fields)) {
|
if (print_summary || output_fields_has_cols(output_fields)) {
|
||||||
/* Just fill in the columns. */
|
/* Just fill in the columns. */
|
||||||
epan_dissect_fill_in_columns(edt, FALSE, TRUE);
|
epan_dissect_fill_in_columns(edt, false, true);
|
||||||
|
|
||||||
if (print_summary) {
|
if (print_summary) {
|
||||||
/* Now print them. */
|
/* Now print them. */
|
||||||
@ -1915,11 +1915,11 @@ print_packet(capture_file *cf, epan_dissect_t *edt)
|
|||||||
|
|
||||||
case WRITE_TEXT:
|
case WRITE_TEXT:
|
||||||
if (!print_columns(cf))
|
if (!print_columns(cf))
|
||||||
return FALSE;
|
return false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WRITE_XML:
|
case WRITE_XML:
|
||||||
write_psml_columns(edt, stdout, FALSE);
|
write_psml_columns(edt, stdout, false);
|
||||||
return !ferror(stdout);
|
return !ferror(stdout);
|
||||||
case WRITE_FIELDS: /*No non-verbose "fields" format */
|
case WRITE_FIELDS: /*No non-verbose "fields" format */
|
||||||
ws_assert_not_reached();
|
ws_assert_not_reached();
|
||||||
@ -1934,15 +1934,15 @@ print_packet(capture_file *cf, epan_dissect_t *edt)
|
|||||||
case WRITE_TEXT:
|
case WRITE_TEXT:
|
||||||
if (!proto_tree_print(print_details ? print_dissections_expanded : print_dissections_none,
|
if (!proto_tree_print(print_details ? print_dissections_expanded : print_dissections_none,
|
||||||
print_hex, edt, output_only_tables, print_stream))
|
print_hex, edt, output_only_tables, print_stream))
|
||||||
return FALSE;
|
return false;
|
||||||
if (!print_hex) {
|
if (!print_hex) {
|
||||||
if (!print_line(print_stream, 0, separator))
|
if (!print_line(print_stream, 0, separator))
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WRITE_XML:
|
case WRITE_XML:
|
||||||
write_pdml_proto_tree(NULL, edt, &cf->cinfo, stdout, FALSE);
|
write_pdml_proto_tree(NULL, edt, &cf->cinfo, stdout, false);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
return !ferror(stdout);
|
return !ferror(stdout);
|
||||||
case WRITE_FIELDS:
|
case WRITE_FIELDS:
|
||||||
@ -1954,17 +1954,17 @@ print_packet(capture_file *cf, epan_dissect_t *edt)
|
|||||||
if (print_hex) {
|
if (print_hex) {
|
||||||
if (print_summary || print_details) {
|
if (print_summary || print_details) {
|
||||||
if (!print_line(print_stream, 0, ""))
|
if (!print_line(print_stream, 0, ""))
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
if (!print_hex_data(print_stream, edt, HEXDUMP_SOURCE_MULTI | HEXDUMP_ASCII_INCLUDE))
|
if (!print_hex_data(print_stream, edt, HEXDUMP_SOURCE_MULTI | HEXDUMP_ASCII_INCLUDE))
|
||||||
return FALSE;
|
return false;
|
||||||
if (!print_line(print_stream, 0, separator))
|
if (!print_line(print_stream, 0, separator))
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static bool
|
||||||
write_finale(void)
|
write_finale(void)
|
||||||
{
|
{
|
||||||
switch (output_action) {
|
switch (output_action) {
|
||||||
@ -1985,7 +1985,7 @@ write_finale(void)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
ws_assert_not_reached();
|
ws_assert_not_reached();
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2010,12 +2010,12 @@ cf_open(capture_file *cf, const char *fname, unsigned int type, bool is_tempfile
|
|||||||
cf->is_tempfile = is_tempfile;
|
cf->is_tempfile = is_tempfile;
|
||||||
|
|
||||||
/* No user changes yet. */
|
/* No user changes yet. */
|
||||||
cf->unsaved_changes = FALSE;
|
cf->unsaved_changes = false;
|
||||||
|
|
||||||
cf->cd_t = 0; /**** XXX - DOESN'T WORK RIGHT NOW!!!! */
|
cf->cd_t = 0; /**** XXX - DOESN'T WORK RIGHT NOW!!!! */
|
||||||
cf->open_type = type;
|
cf->open_type = type;
|
||||||
cf->count = 0;
|
cf->count = 0;
|
||||||
cf->drops_known = FALSE;
|
cf->drops_known = false;
|
||||||
cf->drops = 0;
|
cf->drops = 0;
|
||||||
cf->snap = 0; /**** XXX - DOESN'T WORK RIGHT NOW!!!! */
|
cf->snap = 0; /**** XXX - DOESN'T WORK RIGHT NOW!!!! */
|
||||||
nstime_set_zero(&cf->elapsed_time);
|
nstime_set_zero(&cf->elapsed_time);
|
||||||
@ -2029,10 +2029,10 @@ cf_open(capture_file *cf, const char *fname, unsigned int type, bool is_tempfile
|
|||||||
|
|
||||||
/* fail: */
|
/* fail: */
|
||||||
/*
|
/*
|
||||||
gchar *err_info;
|
char *err_info;
|
||||||
char err_msg[2048+1];
|
char err_msg[2048+1];
|
||||||
snprintf(err_msg, sizeof err_msg,
|
snprintf(err_msg, sizeof err_msg,
|
||||||
cf_open_error_message(*err, err_info, FALSE, cf->cd_t), fname);
|
cf_open_error_message(*err, err_info, false, cf->cd_t), fname);
|
||||||
cmdarg_err("%s", err_msg);
|
cmdarg_err("%s", err_msg);
|
||||||
return CF_ERROR;
|
return CF_ERROR;
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user