Pass struct tcpinfo into all TCP subdissectors instead of through pinfo->private_data.
[metze/wireshark/wip.git] / pcapio.h
1 /* pcapio.h
2  * Declarations of our own routins for writing libpcap files.
3  *
4  * $Id$
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
8  * Copyright 1998 Gerald Combs
9  *
10  * Derived from code in the Wiretap Library
11  * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
12  *
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.
17  *
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.
22  *
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.
26  */
27
28 /* Writing pcap files */
29
30 /** Write the file header to a dump file.
31    Returns TRUE on success, FALSE on failure.
32    Sets "*err" to an error code, or 0 for a short write, on failure*/
33 extern gboolean
34 libpcap_write_file_header(FILE* pfile, int linktype, int snaplen, 
35                           gboolean ts_nsecs, guint64 *bytes_written, int *err);
36
37 /** Write a record for a packet to a dump file.
38    Returns TRUE on success, FALSE on failure. */
39 extern gboolean
40 libpcap_write_packet(FILE* pfile, 
41                      time_t sec, guint32 usec,
42                      guint32 caplen, guint32 len,
43                      const guint8 *pd,
44                      guint64 *bytes_written, int *err);
45
46 /* Writing pcap-ng files */
47
48 /** Write a section header block (SHB)
49  *
50  */
51 extern gboolean
52 pcapng_write_session_header_block(FILE* pfile,  /**< Write information */
53                                   const char *comment,  /**< Comment on the section, Optinon 1 opt_comment
54                                                          * A UTF-8 string containing a comment that is associated to the current block.
55                                                          */
56                                   const char *hw,       /**< HW, Optinon 2 shb_hardware
57                                                          * An UTF-8 string containing the description of the hardware  used to create this section.
58                                                          */
59                                   const char *os,       /**< Operating system name, Optinon 3 shb_os
60                                                          * An UTF-8 string containing the name of the operating system used to create this section.
61                                                          */
62                                   const char *appname,  /**< Application name, Optinon 4 shb_userappl
63                                                          * An UTF-8 string containing the name of the application  used to create this section.
64                                                          */
65                                   guint64 section_length,
66                                   guint64 *bytes_written,
67                                   int *err);
68
69 extern gboolean
70 pcapng_write_interface_description_block(FILE* pfile,
71                                          const char *comment,  /* OPT_COMMENT           1 */
72                                          const char *name,     /* IDB_NAME              2 */
73                                          const char *descr,    /* IDB_DESCRIPTION       3 */
74                                          const char *filter,   /* IDB_FILTER           11 */
75                                          const char *os,       /* IDB_OS               12 */
76                                          int link_type,
77                                          int snap_len,
78                                          guint64 *bytes_written,
79                                          guint64 if_speed,     /* IDB_IF_SPEED          8 */
80                                          guint8 tsresol,       /* IDB_TSRESOL           9 */
81                                          int *err);
82
83 extern gboolean
84 pcapng_write_interface_statistics_block(FILE* pfile,
85                                         guint32 interface_id,
86                                         guint64 *bytes_written,
87                                         const char *comment,   /* OPT_COMMENT           1 */
88                                         guint64 isb_starttime, /* ISB_STARTTIME         2 */
89                                         guint64 isb_endtime,   /* ISB_ENDTIME           3 */
90                                         guint64 isb_ifrecv,    /* ISB_IFRECV            4 */
91                                         guint64 isb_ifdrop,    /* ISB_IFDROP            5 */
92                                         int *err);
93
94 extern gboolean
95 pcapng_write_enhanced_packet_block(FILE* pfile,
96                                    const char *comment,
97                                    time_t sec, guint32 usec,
98                                    guint32 caplen, guint32 len,
99                                    guint32 interface_id,
100                                    guint ts_mul,
101                                    const guint8 *pd,
102                                    guint32 flags,
103                                    guint64 *bytes_written,
104                                    int *err);