Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
pcapng_module.h
1 /* pcap_module.h
2  *
3  * Wiretap Library
4  * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
5  *
6  * SPDX-License-Identifier: GPL-2.0-or-later
7  */
8 
9 #ifndef __PCAP_MODULE_H__
10 #define __PCAP_MODULE_H__
11 
12 /*
13  * These are the officially registered block types, from the pcapng
14  * specification.
15  *
16  * XXX - Dear Sysdig People: please add your blocks to the spec!
17  */
18 #define BLOCK_TYPE_SHB 0x0A0D0D0A /* Section Header Block */
19 #define BLOCK_TYPE_IDB 0x00000001 /* Interface Description Block */
20 #define BLOCK_TYPE_PB 0x00000002 /* Packet Block (obsolete) */
21 #define BLOCK_TYPE_SPB 0x00000003 /* Simple Packet Block */
22 #define BLOCK_TYPE_NRB 0x00000004 /* Name Resolution Block */
23 #define BLOCK_TYPE_ISB 0x00000005 /* Interface Statistics Block */
24 #define BLOCK_TYPE_EPB 0x00000006 /* Enhanced Packet Block */
25 #define BLOCK_TYPE_IRIG_TS 0x00000007 /* IRIG Timestamp Block */
26 #define BLOCK_TYPE_ARINC_429 0x00000008 /* ARINC 429 in AFDX Encapsulation Information Block */
27 #define BLOCK_TYPE_SYSDIG_EVENT 0x00000204 /* Sysdig Event Block */
28 #define BLOCK_TYPE_SYSDIG_EVF 0x00000208 /* Sysdig Event Block with flags */
29 
30 /* TODO: the following are not yet well defined in the draft spec,
31  * and do not yet have block type values assigned to them:
32  * Compression Block
33  * Encryption Block
34  * Fixed Length Block
35  * Directory Block
36  * Traffic Statistics and Monitoring Blocks
37  * Event/Security Block
38  */
39 
40 /* Block data to be passed between functions during reading */
41 typedef struct wtapng_block_s {
42  guint32 type; /* block_type as defined by pcapng */
43  gboolean internal; /* TRUE if this block type shouldn't be returned from pcapng_read() */
44  wtap_block_t block;
45  wtap_rec *rec;
46  Buffer *frame_buffer;
48 
49 /*
50  * Reader and writer routines for pcapng block types.
51  */
52 typedef gboolean (*block_reader)(FILE_T, guint32, gboolean, wtapng_block_t *,
53  int *, gchar **);
54 typedef gboolean (*block_writer)(wtap_dumper *, const wtap_rec *,
55  const guint8 *, int *);
56 
57 /*
58  * Register a handler for a pcapng block type.
59  */
60 WS_DLL_PUBLIC
61 void register_pcapng_block_type_handler(guint block_type, block_reader read,
62  block_writer write);
63 
64 /*
65  * Handler routine for pcapng option type.
66  */
67 typedef gboolean (*option_handler_fn)(gboolean, guint, guint8 *, int *, gchar **);
68 
69 /*
70  * Register a handler for a pcapng option code for a particular block
71  * type.
72  */
73 WS_DLL_PUBLIC
74 void register_pcapng_option_handler(guint block_type, guint option_code,
75  option_handler_fn hfunc);
76 
77 #endif /* __PCAP_MODULE_H__ */
Definition: wtap_opttypes.c:57
Definition: buffer.h:21
Definition: pcapng_module.h:41
Definition: wtap.h:1274
Definition: file_wrappers.c:78
Definition: wtap-int.h:86