4 * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
6 * SPDX-License-Identifier: GPL-2.0-or-later
9 #ifndef __PCAP_MODULE_H__
10 #define __PCAP_MODULE_H__
13 * These are the officially registered block types, from the pcapng
16 * XXX - Dear Sysdig People: please add your blocks to the spec!
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_SYSTEMD_JOURNAL 0x00000009 /* systemd journal entry */
28 #define BLOCK_TYPE_DSB 0x0000000A /* Decryption Secrets Block */
29 #define BLOCK_TYPE_SYSDIG_EVENT 0x00000204 /* Sysdig Event Block */
30 #define BLOCK_TYPE_SYSDIG_EVF 0x00000208 /* Sysdig Event Block with flags */
32 /* TODO: the following are not yet well defined in the draft spec,
33 * and do not yet have block type values assigned to them:
38 * Traffic Statistics and Monitoring Blocks
39 * Event/Security Block
42 /* Block data to be passed between functions during reading */
43 typedef struct wtapng_block_s {
44 guint32 type; /* block_type as defined by pcapng */
45 gboolean internal; /* TRUE if this block type shouldn't be returned from pcapng_read() */
52 * Reader and writer routines for pcapng block types.
54 typedef gboolean (*block_reader)(FILE_T, guint32, gboolean, wtapng_block_t *,
56 typedef gboolean (*block_writer)(wtap_dumper *, const wtap_rec *,
57 const guint8 *, int *);
60 * Register a handler for a pcapng block type.
63 void register_pcapng_block_type_handler(guint block_type, block_reader reader,
67 * Handler routine for pcapng option type.
69 typedef gboolean (*option_handler_fn)(gboolean, guint, guint8 *, int *, gchar **);
72 * Register a handler for a pcapng option code for a particular block
76 void register_pcapng_option_handler(guint block_type, guint option_code,
77 option_handler_fn hfunc);
79 #endif /* __PCAP_MODULE_H__ */