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