libnl 3.7.0
log.h
1/* SPDX-License-Identifier: LGPL-2.1-only */
2/*
3 * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
4 * Copyright (c) 2007 Philip Craig <philipc@snapgear.com>
5 * Copyright (c) 2007 Secure Computing Corporation
6 * Copyright (c) 2008 Patrick McHardy <kaber@trash.net>
7 */
8
9#ifndef NETLINK_LOG_H_
10#define NETLINK_LOG_H_
11
12#include <netlink/netlink.h>
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18struct nl_sock;
19struct nlmsghdr;
20struct nfnl_log;
21
22extern struct nl_object_ops log_obj_ops;
23
24enum nfnl_log_copy_mode {
25 NFNL_LOG_COPY_NONE,
26 NFNL_LOG_COPY_META,
27 NFNL_LOG_COPY_PACKET,
28};
29
30enum nfnl_log_flags {
31 NFNL_LOG_FLAG_SEQ = 0x1,
32 NFNL_LOG_FLAG_SEQ_GLOBAL = 0x2,
33 NFNL_LOG_FLAG_CONNTRACK = 0x4,
34};
35
36/* General */
37extern struct nfnl_log * nfnl_log_alloc(void);
38extern int nfnlmsg_log_parse(struct nlmsghdr *,
39 struct nfnl_log **);
40
41extern void nfnl_log_get(struct nfnl_log *);
42extern void nfnl_log_put(struct nfnl_log *);
43
44/* Attributes */
45extern void nfnl_log_set_group(struct nfnl_log *, uint16_t);
46extern int nfnl_log_test_group(const struct nfnl_log *);
47extern uint16_t nfnl_log_get_group(const struct nfnl_log *);
48
49extern void nfnl_log_set_copy_mode(struct nfnl_log *,
50 enum nfnl_log_copy_mode);
51extern int nfnl_log_test_copy_mode(const struct nfnl_log *);
52extern enum nfnl_log_copy_mode nfnl_log_get_copy_mode(const struct nfnl_log *);
53
54extern char * nfnl_log_copy_mode2str(enum nfnl_log_copy_mode,
55 char *, size_t);
56extern int nfnl_log_str2copy_mode(const char *);
57
58extern void nfnl_log_set_copy_range(struct nfnl_log *, uint32_t);
59extern int nfnl_log_test_copy_range(const struct nfnl_log *);
60extern uint32_t nfnl_log_get_copy_range(const struct nfnl_log *);
61
62extern void nfnl_log_set_flush_timeout(struct nfnl_log *, uint32_t);
63extern int nfnl_log_test_flush_timeout(const struct nfnl_log *);
64extern uint32_t nfnl_log_get_flush_timeout(const struct nfnl_log *);
65
66extern void nfnl_log_set_alloc_size(struct nfnl_log *, uint32_t);
67extern int nfnl_log_test_alloc_size(const struct nfnl_log *);
68extern uint32_t nfnl_log_get_alloc_size(const struct nfnl_log *);
69
70extern void nfnl_log_set_queue_threshold(struct nfnl_log *, uint32_t);
71extern int nfnl_log_test_queue_threshold(const struct nfnl_log *);
72extern uint32_t nfnl_log_get_queue_threshold(const struct nfnl_log *);
73
74extern void nfnl_log_set_flags(struct nfnl_log *, unsigned int);
75extern void nfnl_log_unset_flags(struct nfnl_log *, unsigned int);
76extern unsigned int nfnl_log_get_flags(const struct nfnl_log *);
77
78extern char * nfnl_log_flags2str(unsigned int, char *, size_t);
79extern unsigned int nfnl_log_str2flags(const char *);
80
81extern int nfnl_log_build_pf_bind(uint8_t, struct nl_msg **);
82extern int nfnl_log_pf_bind(struct nl_sock *, uint8_t);
83
84extern int nfnl_log_build_pf_unbind(uint8_t, struct nl_msg **);
85extern int nfnl_log_pf_unbind(struct nl_sock *, uint8_t);
86
87extern int nfnl_log_build_create_request(const struct nfnl_log *,
88 struct nl_msg **);
89extern int nfnl_log_create(struct nl_sock *, const struct nfnl_log *);
90
91extern int nfnl_log_build_change_request(const struct nfnl_log *,
92 struct nl_msg **);
93extern int nfnl_log_change(struct nl_sock *, const struct nfnl_log *);
94
95extern int nfnl_log_build_delete_request(const struct nfnl_log *,
96 struct nl_msg **);
97extern int nfnl_log_delete(struct nl_sock *, const struct nfnl_log *);
98
99#ifdef __cplusplus
100}
101#endif
102
103#endif
104