From 18580d67036a93c7295787a9a1357a65b779e7c2 Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Wed, 2 Jan 2013 04:01:22 +0000 Subject: Allow pcap/pcapng format to be written to more than just a file (FILE*). Gives more flexibility if needed. WRITE_DATA macro replaced and applied consistently throughout pcapio.c svn path=/trunk/; revision=46891 --- dumpcap.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'dumpcap.c') diff --git a/dumpcap.c b/dumpcap.c index ed25708519..90571c4740 100644 --- a/dumpcap.c +++ b/dumpcap.c @@ -2838,7 +2838,7 @@ capture_loop_init_output(capture_options *capture_opts, loop_data *ld, char *err get_os_version_info(os_info_str); g_snprintf(appname, sizeof(appname), "Dumpcap " VERSION "%s", wireshark_svnversion); - successful = libpcap_write_session_header_block(ld->pdh, + successful = libpcap_write_session_header_block(libpcap_write_to_file, ld->pdh, NULL, /* Comment*/ NULL, /* HW*/ os_info_str->str, /* OS*/ @@ -2855,7 +2855,7 @@ capture_loop_init_output(capture_options *capture_opts, loop_data *ld, char *err } else { pcap_opts->snaplen = pcap_snapshot(pcap_opts->pcap_h); } - successful = libpcap_write_interface_description_block(global_ld.pdh, + successful = libpcap_write_interface_description_block(libpcap_write_to_file, global_ld.pdh, NULL, /* OPT_COMMENT 1 */ interface_opts.name, /* IDB_NAME 2 */ interface_opts.descr, /* IDB_DESCRIPTION 3 */ @@ -2878,7 +2878,7 @@ capture_loop_init_output(capture_options *capture_opts, loop_data *ld, char *err } else { pcap_opts->snaplen = pcap_snapshot(pcap_opts->pcap_h); } - successful = libpcap_write_file_header(ld->pdh, pcap_opts->linktype, pcap_opts->snaplen, + successful = libpcap_write_file_header(libpcap_write_to_file, ld->pdh, pcap_opts->linktype, pcap_opts->snaplen, pcap_opts->ts_nsec, &ld->bytes_written, &err); } if (!successful) { @@ -2940,7 +2940,7 @@ capture_loop_close_output(capture_options *capture_opts, loop_data *ld, int *err isb_ifrecv = G_MAXUINT64; isb_ifdrop = G_MAXUINT64; } - libpcap_write_interface_statistics_block(ld->pdh, + libpcap_write_interface_statistics_block(libpcap_write_to_file, ld->pdh, i, &ld->bytes_written, "Counters provided by dumpcap", @@ -3331,7 +3331,7 @@ do_file_switch_or_stop(capture_options *capture_opts, get_os_version_info(os_info_str); g_snprintf(appname, sizeof(appname), "Dumpcap " VERSION "%s", wireshark_svnversion); - successful = libpcap_write_session_header_block(global_ld.pdh, + successful = libpcap_write_session_header_block(libpcap_write_to_file, global_ld.pdh, NULL, /* Comment */ NULL, /* HW */ os_info_str->str, /* OS */ @@ -3343,7 +3343,7 @@ do_file_switch_or_stop(capture_options *capture_opts, for (i = 0; successful && (i < capture_opts->ifaces->len); i++) { interface_opts = g_array_index(capture_opts->ifaces, interface_options, i); pcap_opts = g_array_index(global_ld.pcaps, pcap_options *, i); - successful = libpcap_write_interface_description_block(global_ld.pdh, + successful = libpcap_write_interface_description_block(libpcap_write_to_file, global_ld.pdh, NULL, /* OPT_COMMENT 1 */ interface_opts.name, /* IDB_NAME 2 */ interface_opts.descr, /* IDB_DESCRIPTION 3 */ @@ -3361,7 +3361,7 @@ do_file_switch_or_stop(capture_options *capture_opts, } else { pcap_opts = g_array_index(global_ld.pcaps, pcap_options *, 0); - successful = libpcap_write_file_header(global_ld.pdh, pcap_opts->linktype, pcap_opts->snaplen, + successful = libpcap_write_file_header(libpcap_write_to_file, global_ld.pdh, pcap_opts->linktype, pcap_opts->snaplen, pcap_opts->ts_nsec, &global_ld.bytes_written, &global_ld.err); } if (!successful) { @@ -3982,7 +3982,7 @@ capture_loop_write_packet_cb(u_char *pcap_opts_p, const struct pcap_pkthdr *phdr If this fails, set "ld->go" to FALSE, to stop the capture, and set "ld->err" to the error. */ if (global_capture_opts.use_pcapng) { - successful = libpcap_write_enhanced_packet_block(global_ld.pdh, + successful = libpcap_write_enhanced_packet_block(libpcap_write_to_file, global_ld.pdh, NULL, phdr->ts.tv_sec, phdr->ts.tv_usec, phdr->caplen, phdr->len, @@ -3991,7 +3991,7 @@ capture_loop_write_packet_cb(u_char *pcap_opts_p, const struct pcap_pkthdr *phdr pd, 0, &global_ld.bytes_written, &err); } else { - successful = libpcap_write_packet(global_ld.pdh, + successful = libpcap_write_packet(libpcap_write_to_file, global_ld.pdh, phdr->ts.tv_sec, phdr->ts.tv_usec, phdr->caplen, phdr->len, pd, -- cgit v1.2.3