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