Move the ignore entries for ps.c to epan.
[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 typedef gboolean (*libpcap_write_t) (void* write_data_info, const guint8* data,  long data_length,
29                                      guint64 *bytes_written, int *err);
30
31 /* Write libcap to file.  write_data_info will be a FILE* */
32 extern gboolean libpcap_write_to_file(void* write_data_info, 
33                                       const guint8* data, 
34                                       long data_length,
35                                       guint64 *bytes_written,
36                                       int *err);
37
38
39 /** Write the file header to a dump file.
40    Returns TRUE on success, FALSE on failure.
41    Sets "*err" to an error code, or 0 for a short write, on failure*/
42 extern gboolean
43 libpcap_write_file_header(libpcap_write_t write_func, void* write_data_info, int linktype, int snaplen, 
44                           gboolean ts_nsecs, guint64 *bytes_written, int *err);
45
46 /** Write a record for a packet to a dump file.
47    Returns TRUE on success, FALSE on failure. */
48 extern gboolean
49 libpcap_write_packet(libpcap_write_t write_func, void* write_data_info, 
50                      time_t sec, guint32 usec,
51                      guint32 caplen, guint32 len,
52                      const guint8 *pd,
53                      guint64 *bytes_written, int *err);
54
55 /** Write a section header block (SHB)
56  *
57  */
58 extern gboolean
59 libpcap_write_session_header_block(libpcap_write_t write_func, void* write_data_info,  /**< Write information */
60                                    const char *comment,  /**< Comment on the section, Optinon 1 opt_comment
61                                                           * A UTF-8 string containing a comment that is associated to the current block.
62                                                           */
63                                    const char *hw,       /**< HW, Optinon 2 shb_hardware
64                                                           * An UTF-8 string containing the description of the hardware  used to create this section.
65                                                           */
66                                    const char *os,       /**< Operating system name, Optinon 3 shb_os
67                                                           * An UTF-8 string containing the name of the operating system used to create this section.
68                                                           */
69                                    const char *appname,  /**< Application name, Optinon 4 shb_userappl
70                                                           * An UTF-8 string containing the name of the application  used to create this section.
71                                                           */
72                                    guint64 section_length,
73                                    guint64 *bytes_written,
74                                    int *err);
75
76 extern gboolean
77 libpcap_write_interface_description_block(libpcap_write_t write_func, void* write_data_info,
78                                           const char *comment,  /* OPT_COMMENT           1 */
79                                           const char *name,     /* IDB_NAME              2 */
80                                           const char *descr,    /* IDB_DESCRIPTION       3 */
81                                           const char *filter,   /* IDB_FILTER           11 */
82                                           const char *os,       /* IDB_OS               12 */
83                                           int link_type,
84                                           int snap_len,
85                                           guint64 *bytes_written,
86                                           guint64 if_speed,     /* IDB_IF_SPEED          8 */
87                                           guint8 tsresol,       /* IDB_TSRESOL           9 */
88                                           int *err);
89
90 extern gboolean
91 libpcap_write_interface_statistics_block(libpcap_write_t write_func, void* write_data_info,
92                                          guint32 interface_id,
93                                          guint64 *bytes_written,
94                                          const char *comment,   /* OPT_COMMENT           1 */
95                                          guint64 isb_starttime, /* ISB_STARTTIME         2 */
96                                          guint64 isb_endtime,   /* ISB_ENDTIME           3 */
97                                          guint64 isb_ifrecv,    /* ISB_IFRECV            4 */
98                                          guint64 isb_ifdrop,    /* ISB_IFDROP            5 */
99                                          int *err);
100
101 extern gboolean
102 libpcap_write_enhanced_packet_block(libpcap_write_t write_func, void* write_data_info,
103                                     const char *comment,
104                                     time_t sec, guint32 usec,
105                                     guint32 caplen, guint32 len,
106                                     guint32 interface_id,
107                                     guint ts_mul,
108                                     const guint8 *pd,
109                                     guint32 flags,
110                                     guint64 *bytes_written,
111                                     int *err);