summaryrefslogtreecommitdiffstats
path: root/lib/util/xpcapng.h
blob: 1590a4cbbf396574aaf3f2cc43dea2daaa8fd3bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* SPDX-License-Identifier: GPL-2.0 */

/*****************************************************************************
 * Multiple include protection
 *****************************************************************************/
#ifndef __XPCAPNG_H_
#define __XPCAPNG_H_

/*****************************************************************************
 * Handle
 *****************************************************************************/
struct xpcapng_dumper;

/*****************************************************************************
 * Flag variables
 *****************************************************************************/
enum xpcapng_epb_flags {
	PCAPNG_EPB_FLAG_INBOUND  = 0x1,
	PCAPNG_EPB_FLAG_OUTBOUND = 0x2
};

/*****************************************************************************
 * EPB options structure
 *****************************************************************************/
struct xpcapng_epb_options_s {
	enum xpcapng_epb_flags  flags;
	uint64_t                dropcount;
	uint64_t               *packetid;
	uint32_t               *queue;
	int64_t                *xdp_verdict;
	const char             *comment;
};

/*****************************************************************************
 * APIs
 *****************************************************************************/
extern struct xpcapng_dumper *xpcapng_dump_open(const char *file,
						const char *comment,
						const char *hardware,
						const char *os,
						const char *user_application);
extern void xpcapng_dump_close(struct xpcapng_dumper *pd);
extern int xpcapng_dump_flush(struct xpcapng_dumper *pd);
extern int xpcapng_dump_add_interface(struct xpcapng_dumper *pd,
				      uint16_t snap_len,
				      const char *name, const char *description,
				      const uint8_t *mac, uint64_t speed,
				      uint8_t ts_resolution,
				      const char *hardware);
extern bool xpcapng_dump_enhanced_pkt(struct xpcapng_dumper *pd, uint32_t ifid,
				      const uint8_t *pkt, uint32_t len,
				      uint32_t caplen, uint64_t timestamp,
				      struct xpcapng_epb_options_s *options);

/*****************************************************************************
 * End-of include file
 *****************************************************************************/
#endif /* __XPCAPNG_H_ */