Do a deep copy in wtap_block_add_custom_option().
[metze/wireshark/wip.git] / wiretap / pcapng_module.h
1 /* pcap_module.h
2  *
3  * Wiretap Library
4  * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20
21 #ifndef __PCAP_MODULE_H__
22 #define __PCAP_MODULE_H__
23
24 /* Block type codes in the file */
25 #define BLOCK_TYPE_IDB 0x00000001 /* Interface Description Block */
26 #define BLOCK_TYPE_PB  0x00000002 /* Packet Block (obsolete) */
27 #define BLOCK_TYPE_SPB 0x00000003 /* Simple Packet Block */
28 #define BLOCK_TYPE_NRB 0x00000004 /* Name Resolution Block */
29 #define BLOCK_TYPE_ISB 0x00000005 /* Interface Statistics Block */
30 #define BLOCK_TYPE_EPB 0x00000006 /* Enhanced Packet Block */
31 #define BLOCK_TYPE_SYSDIG_EVENT 0x00000204 /* Sysdig Event Block */
32 #define BLOCK_TYPE_SYSDIG_EVF   0x00000208 /* Sysdig Event Block with flags */
33 #define BLOCK_TYPE_SHB 0x0A0D0D0A /* Section Header Block */
34 /* TODO: the following are not yet well defined in the draft spec:
35  * Compression Block
36  * Encryption Block
37  * Fixed Length Block
38  * Directory Block
39  * Traffic Statistics and Monitoring Blocks
40  * Event/Security Block
41  */
42
43 /*
44  * Reader and writer routines for pcap-ng block types.
45  */
46 typedef gboolean (*block_reader)(FILE_T, guint32, gboolean, struct wtap_pkthdr *,
47                                  Buffer *, int *, gchar **);
48 typedef gboolean (*block_writer)(wtap_dumper *, const struct wtap_pkthdr *,
49                                  const guint8 *, int *);
50
51 /*
52  * Register a handler for a pcap-ng block type.
53  */
54 WS_DLL_PUBLIC
55 void register_pcapng_block_type_handler(guint block_type, block_reader read,
56                                         block_writer write);
57
58 /*
59  * Handler routine for pcap-ng option type.
60  */
61 typedef gboolean (*option_handler_fn)(gboolean, guint, guint8 *, int *, gchar **);
62
63 /*
64  * Register a handler for a pcap-ng option code for a particular block
65  * type.
66  */
67 WS_DLL_PUBLIC
68 void register_pcapng_option_handler(guint block_type, guint option_code,
69                                     option_handler_fn hfunc);
70
71 #endif /* __PCAP_MODULE_H__ */
72