2014-05-24 20:57:11 +00:00
|
|
|
/* pcap_module.h
|
|
|
|
*
|
|
|
|
* Wiretap Library
|
|
|
|
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
|
|
|
|
*
|
2018-02-07 11:26:45 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2014-05-24 20:57:11 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __PCAP_MODULE_H__
|
|
|
|
#define __PCAP_MODULE_H__
|
|
|
|
|
2018-02-04 00:41:13 +00:00
|
|
|
/*
|
|
|
|
* These are the officially registered block types, from the pcapng
|
|
|
|
* specification.
|
|
|
|
*
|
|
|
|
* XXX - Dear Sysdig People: please add your blocks to the spec!
|
|
|
|
*/
|
2018-09-10 23:49:36 +00:00
|
|
|
#define BLOCK_TYPE_SHB 0x0A0D0D0A /* Section Header Block */
|
|
|
|
#define BLOCK_TYPE_IDB 0x00000001 /* Interface Description Block */
|
|
|
|
#define BLOCK_TYPE_PB 0x00000002 /* Packet Block (obsolete) */
|
|
|
|
#define BLOCK_TYPE_SPB 0x00000003 /* Simple Packet Block */
|
|
|
|
#define BLOCK_TYPE_NRB 0x00000004 /* Name Resolution Block */
|
|
|
|
#define BLOCK_TYPE_ISB 0x00000005 /* Interface Statistics Block */
|
|
|
|
#define BLOCK_TYPE_EPB 0x00000006 /* Enhanced Packet Block */
|
|
|
|
#define BLOCK_TYPE_IRIG_TS 0x00000007 /* IRIG Timestamp Block */
|
|
|
|
#define BLOCK_TYPE_ARINC_429 0x00000008 /* ARINC 429 in AFDX Encapsulation Information Block */
|
|
|
|
#define BLOCK_TYPE_SYSTEMD_JOURNAL 0x00000009 /* systemd journal entry */
|
|
|
|
#define BLOCK_TYPE_SYSDIG_EVENT 0x00000204 /* Sysdig Event Block */
|
|
|
|
#define BLOCK_TYPE_SYSDIG_EVF 0x00000208 /* Sysdig Event Block with flags */
|
2018-02-04 00:41:13 +00:00
|
|
|
|
|
|
|
/* TODO: the following are not yet well defined in the draft spec,
|
|
|
|
* and do not yet have block type values assigned to them:
|
2015-07-20 14:35:06 +00:00
|
|
|
* Compression Block
|
|
|
|
* Encryption Block
|
|
|
|
* Fixed Length Block
|
|
|
|
* Directory Block
|
|
|
|
* Traffic Statistics and Monitoring Blocks
|
|
|
|
* Event/Security Block
|
|
|
|
*/
|
|
|
|
|
2018-02-05 04:33:02 +00:00
|
|
|
/* Block data to be passed between functions during reading */
|
|
|
|
typedef struct wtapng_block_s {
|
2018-02-09 00:19:12 +00:00
|
|
|
guint32 type; /* block_type as defined by pcapng */
|
|
|
|
gboolean internal; /* TRUE if this block type shouldn't be returned from pcapng_read() */
|
|
|
|
wtap_block_t block;
|
|
|
|
wtap_rec *rec;
|
|
|
|
Buffer *frame_buffer;
|
2018-02-05 04:33:02 +00:00
|
|
|
} wtapng_block_t;
|
|
|
|
|
2014-05-24 20:57:11 +00:00
|
|
|
/*
|
2018-01-09 00:38:10 +00:00
|
|
|
* Reader and writer routines for pcapng block types.
|
2014-05-24 20:57:11 +00:00
|
|
|
*/
|
2018-02-05 04:33:02 +00:00
|
|
|
typedef gboolean (*block_reader)(FILE_T, guint32, gboolean, wtapng_block_t *,
|
|
|
|
int *, gchar **);
|
2018-02-09 00:19:12 +00:00
|
|
|
typedef gboolean (*block_writer)(wtap_dumper *, const wtap_rec *,
|
2014-05-24 20:57:11 +00:00
|
|
|
const guint8 *, int *);
|
|
|
|
|
|
|
|
/*
|
2018-01-09 00:38:10 +00:00
|
|
|
* Register a handler for a pcapng block type.
|
2014-05-24 20:57:11 +00:00
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC
|
|
|
|
void register_pcapng_block_type_handler(guint block_type, block_reader read,
|
|
|
|
block_writer write);
|
|
|
|
|
2014-12-01 00:30:19 +00:00
|
|
|
/*
|
2018-01-09 00:38:10 +00:00
|
|
|
* Handler routine for pcapng option type.
|
2014-12-01 00:30:19 +00:00
|
|
|
*/
|
2015-11-26 01:29:36 +00:00
|
|
|
typedef gboolean (*option_handler_fn)(gboolean, guint, guint8 *, int *, gchar **);
|
2014-12-01 00:30:19 +00:00
|
|
|
|
|
|
|
/*
|
2018-01-09 00:38:10 +00:00
|
|
|
* Register a handler for a pcapng option code for a particular block
|
2014-12-01 00:30:19 +00:00
|
|
|
* type.
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC
|
|
|
|
void register_pcapng_option_handler(guint block_type, guint option_code,
|
2015-11-26 01:29:36 +00:00
|
|
|
option_handler_fn hfunc);
|
2014-12-01 00:30:19 +00:00
|
|
|
|
2014-05-24 20:57:11 +00:00
|
|
|
#endif /* __PCAP_MODULE_H__ */
|