wiretap: fix code according to clang-tidy.
[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  * 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_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 */
31
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:
34  * Compression Block
35  * Encryption Block
36  * Fixed Length Block
37  * Directory Block
38  * Traffic Statistics and Monitoring Blocks
39  * Event/Security Block
40  */
41
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() */
46     wtap_block_t block;
47     wtap_rec     *rec;
48     Buffer       *frame_buffer;
49 } wtapng_block_t;
50
51 /*
52  * Reader and writer routines for pcapng block types.
53  */
54 typedef gboolean (*block_reader)(FILE_T, guint32, gboolean, wtapng_block_t *,
55                                  int *, gchar **);
56 typedef gboolean (*block_writer)(wtap_dumper *, const wtap_rec *,
57                                  const guint8 *, int *);
58
59 /*
60  * Register a handler for a pcapng block type.
61  */
62 WS_DLL_PUBLIC
63 void register_pcapng_block_type_handler(guint block_type, block_reader reader,
64                                         block_writer writer);
65
66 /*
67  * Handler routine for pcapng option type.
68  */
69 typedef gboolean (*option_handler_fn)(gboolean, guint, guint8 *, int *, gchar **);
70
71 /*
72  * Register a handler for a pcapng option code for a particular block
73  * type.
74  */
75 WS_DLL_PUBLIC
76 void register_pcapng_option_handler(guint block_type, guint option_code,
77                                     option_handler_fn hfunc);
78
79 #endif /* __PCAP_MODULE_H__ */