2 * Declarations of our own routins for writing libpcap files.
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * Derived from code in the Wiretap Library
11 * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28 /** Write the file header to a dump file.
29 Returns TRUE on success, FALSE on failure.
30 Sets "*err" to an error code, or 0 for a short write, on failure*/
32 libpcap_write_file_header(FILE* pfile, int linktype, int snaplen,
33 gboolean ts_nsecs, guint64 *bytes_written, int *err);
35 /** Write a record for a packet to a dump file.
36 Returns TRUE on success, FALSE on failure. */
38 libpcap_write_packet(FILE* pfile,
39 time_t sec, guint32 usec,
40 guint32 caplen, guint32 len,
42 guint64 *bytes_written, int *err);
44 /** Write a section header block (SHB)
48 libpcap_write_session_header_block(FILE* pfile, /**< Write information */
49 const char *comment, /**< Comment on the section, Optinon 1 opt_comment
50 * A UTF-8 string containing a comment that is associated to the current block.
52 const char *hw, /**< HW, Optinon 2 shb_hardware
53 * An UTF-8 string containing the description of the hardware used to create this section.
55 const char *os, /**< Operating system name, Optinon 3 shb_os
56 * An UTF-8 string containing the name of the operating system used to create this section.
58 const char *appname, /**< Application name, Optinon 4 shb_userappl
59 * An UTF-8 string containing the name of the application used to create this section.
61 guint64 section_length,
62 guint64 *bytes_written,
66 libpcap_write_interface_description_block(FILE* pfile,
67 const char *comment, /* OPT_COMMENT 1 */
68 const char *name, /* IDB_NAME 2 */
69 const char *descr, /* IDB_DESCRIPTION 3 */
70 const char *filter, /* IDB_FILTER 11 */
71 const char *os, /* IDB_OS 12 */
74 guint64 *bytes_written,
75 guint64 if_speed, /* IDB_IF_SPEED 8 */
76 guint8 tsresol, /* IDB_TSRESOL 9 */
80 libpcap_write_interface_statistics_block(FILE* pfile,
82 guint64 *bytes_written,
83 const char *comment, /* OPT_COMMENT 1 */
84 guint64 isb_starttime, /* ISB_STARTTIME 2 */
85 guint64 isb_endtime, /* ISB_ENDTIME 3 */
86 guint64 isb_ifrecv, /* ISB_IFRECV 4 */
87 guint64 isb_ifdrop, /* ISB_IFDROP 5 */
91 libpcap_write_enhanced_packet_block(FILE* pfile,
93 time_t sec, guint32 usec,
94 guint32 caplen, guint32 len,
99 guint64 *bytes_written,