1 /* SPDX-License-Identifier: LGPL-2.1-only */ 2 /* 3 * Copyright (c) 2007, 2008 Patrick McHardy <kaber@trash.net> 4 */ 5 6 #ifndef NETLINK_QUEUE_MSG_H_ 7 #define NETLINK_QUEUE_MSG_H_ 8 9 #include <netlink/netlink.h> 10 11 #ifdef __cplusplus 12 extern "C" { 13 #endif 14 15 struct nl_sock; 16 struct nlmsghdr; 17 struct nfnl_queue_msg; 18 19 extern struct nl_object_ops queue_msg_obj_ops; 20 21 /* General */ 22 extern struct nfnl_queue_msg * nfnl_queue_msg_alloc(void); 23 extern int nfnlmsg_queue_msg_parse(struct nlmsghdr *, 24 struct nfnl_queue_msg **); 25 26 extern void nfnl_queue_msg_get(struct nfnl_queue_msg *); 27 extern void nfnl_queue_msg_put(struct nfnl_queue_msg *); 28 29 extern void nfnl_queue_msg_set_group(struct nfnl_queue_msg *, uint16_t); 30 extern int nfnl_queue_msg_test_group(const struct nfnl_queue_msg *); 31 extern uint16_t nfnl_queue_msg_get_group(const struct nfnl_queue_msg *); 32 33 extern void nfnl_queue_msg_set_family(struct nfnl_queue_msg *, uint8_t); 34 extern int nfnl_queue_msg_test_family(const struct nfnl_queue_msg *); 35 extern uint8_t nfnl_queue_msg_get_family(const struct nfnl_queue_msg *); 36 37 extern void nfnl_queue_msg_set_packetid(struct nfnl_queue_msg *, uint32_t); 38 extern int nfnl_queue_msg_test_packetid(const struct nfnl_queue_msg *); 39 extern uint32_t nfnl_queue_msg_get_packetid(const struct nfnl_queue_msg *); 40 41 extern void nfnl_queue_msg_set_hwproto(struct nfnl_queue_msg *, uint16_t); 42 extern int nfnl_queue_msg_test_hwproto(const struct nfnl_queue_msg *); 43 extern uint16_t nfnl_queue_msg_get_hwproto(const struct nfnl_queue_msg *); 44 45 extern void nfnl_queue_msg_set_hook(struct nfnl_queue_msg *, uint8_t); 46 extern int nfnl_queue_msg_test_hook(const struct nfnl_queue_msg *); 47 extern uint8_t nfnl_queue_msg_get_hook(const struct nfnl_queue_msg *); 48 49 extern void nfnl_queue_msg_set_mark(struct nfnl_queue_msg *, uint32_t); 50 extern int nfnl_queue_msg_test_mark(const struct nfnl_queue_msg *); 51 extern uint32_t nfnl_queue_msg_get_mark(const struct nfnl_queue_msg *); 52 53 extern void nfnl_queue_msg_set_timestamp(struct nfnl_queue_msg *, 54 struct timeval *); 55 extern int nfnl_queue_msg_test_timestamp(const struct nfnl_queue_msg *); 56 extern const struct timeval * nfnl_queue_msg_get_timestamp(const struct nfnl_queue_msg *); 57 58 extern void nfnl_queue_msg_set_indev(struct nfnl_queue_msg *, uint32_t); 59 extern int nfnl_queue_msg_test_indev(const struct nfnl_queue_msg *); 60 extern uint32_t nfnl_queue_msg_get_indev(const struct nfnl_queue_msg *); 61 62 extern void nfnl_queue_msg_set_outdev(struct nfnl_queue_msg *, uint32_t); 63 extern int nfnl_queue_msg_test_outdev(const struct nfnl_queue_msg *); 64 extern uint32_t nfnl_queue_msg_get_outdev(const struct nfnl_queue_msg *); 65 66 extern void nfnl_queue_msg_set_physindev(struct nfnl_queue_msg *, uint32_t); 67 extern int nfnl_queue_msg_test_physindev(const struct nfnl_queue_msg *); 68 extern uint32_t nfnl_queue_msg_get_physindev(const struct nfnl_queue_msg *); 69 70 extern void nfnl_queue_msg_set_physoutdev(struct nfnl_queue_msg *, uint32_t); 71 extern int nfnl_queue_msg_test_physoutdev(const struct nfnl_queue_msg *); 72 extern uint32_t nfnl_queue_msg_get_physoutdev(const struct nfnl_queue_msg *); 73 74 extern void nfnl_queue_msg_set_hwaddr(struct nfnl_queue_msg *, uint8_t *, int); 75 extern int nfnl_queue_msg_test_hwaddr(const struct nfnl_queue_msg *); 76 extern const uint8_t * nfnl_queue_msg_get_hwaddr(const struct nfnl_queue_msg *, int *); 77 78 extern int nfnl_queue_msg_set_payload(struct nfnl_queue_msg *, uint8_t *, int); 79 extern int nfnl_queue_msg_test_payload(const struct nfnl_queue_msg *); 80 extern const void * nfnl_queue_msg_get_payload(const struct nfnl_queue_msg *, int *); 81 82 extern void nfnl_queue_msg_set_verdict(struct nfnl_queue_msg *, 83 unsigned int); 84 extern int nfnl_queue_msg_test_verdict(const struct nfnl_queue_msg *); 85 extern unsigned int nfnl_queue_msg_get_verdict(const struct nfnl_queue_msg *); 86 87 extern struct nl_msg * nfnl_queue_msg_build_verdict(const struct nfnl_queue_msg *); 88 extern int nfnl_queue_msg_send_verdict(struct nl_sock *, 89 const struct nfnl_queue_msg *); 90 91 extern struct nl_msg * nfnl_queue_msg_build_verdict_batch(const struct nfnl_queue_msg *msg); 92 extern int nfnl_queue_msg_send_verdict_batch(struct nl_sock *, 93 const struct nfnl_queue_msg *); 94 extern int nfnl_queue_msg_send_verdict_payload(struct nl_sock *, 95 const struct nfnl_queue_msg *, 96 const void *, unsigned ); 97 #ifdef __cplusplus 98 } 99 #endif 100 101 #endif 102 103