• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * netlink/netfilter/queue.h	Netfilter Queue
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_H_
13 #define NETLINK_QUEUE_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;
24 
25 extern struct nl_object_ops queue_obj_ops;
26 
27 enum nfnl_queue_copy_mode {
28 	NFNL_QUEUE_COPY_NONE,
29 	NFNL_QUEUE_COPY_META,
30 	NFNL_QUEUE_COPY_PACKET,
31 };
32 
33 /* General */
34 extern struct nl_sock *		nfnl_queue_socket_alloc(void);
35 
36 extern struct nfnl_queue *	nfnl_queue_alloc(void);
37 
38 extern void			nfnl_queue_get(struct nfnl_queue *);
39 extern void			nfnl_queue_put(struct nfnl_queue *);
40 
41 /* Attributes */
42 extern void			nfnl_queue_set_group(struct nfnl_queue *, uint16_t);
43 extern int			nfnl_queue_test_group(const struct nfnl_queue *);
44 extern uint16_t			nfnl_queue_get_group(const struct nfnl_queue *);
45 
46 extern void			nfnl_queue_set_maxlen(struct nfnl_queue *, uint32_t);
47 extern int			nfnl_queue_test_maxlen(const struct nfnl_queue *);
48 extern uint32_t			nfnl_queue_get_maxlen(const struct nfnl_queue *);
49 
50 extern void			nfnl_queue_set_copy_mode(struct nfnl_queue *,
51 							 enum nfnl_queue_copy_mode);
52 extern int			nfnl_queue_test_copy_mode(const struct nfnl_queue *);
53 extern enum nfnl_queue_copy_mode nfnl_queue_get_copy_mode(const struct nfnl_queue *);
54 
55 extern char *			nfnl_queue_copy_mode2str(enum nfnl_queue_copy_mode,
56 							 char *, size_t);
57 extern enum nfnl_queue_copy_mode nfnl_queue_str2copy_mode(const char *);
58 
59 extern void			nfnl_queue_set_copy_range(struct nfnl_queue *,
60 							  uint32_t);
61 extern int			nfnl_queue_test_copy_range(const struct nfnl_queue *);
62 extern uint32_t			nfnl_queue_get_copy_range(const struct nfnl_queue *);
63 
64 extern int	nfnl_queue_build_pf_bind(uint8_t, struct nl_msg **);
65 extern int	nfnl_queue_pf_bind(struct nl_sock *, uint8_t);
66 
67 extern int	nfnl_queue_build_pf_unbind(uint8_t, struct nl_msg **);
68 extern int	nfnl_queue_pf_unbind(struct nl_sock *, uint8_t);
69 
70 extern int	nfnl_queue_build_create_request(const struct nfnl_queue *,
71 						struct nl_msg **);
72 extern int	nfnl_queue_create(struct nl_sock *,
73 				  const struct nfnl_queue *);
74 
75 extern int	nfnl_queue_build_change_request(const struct nfnl_queue *,
76 						struct nl_msg **);
77 extern int	nfnl_queue_change(struct nl_sock *,
78 				  const struct nfnl_queue *);
79 
80 extern int	nfnl_queue_build_delete_request(const struct nfnl_queue *,
81 						struct nl_msg **);
82 extern int	nfnl_queue_delete(struct nl_sock *,
83 				  const struct nfnl_queue *);
84 
85 #ifdef __cplusplus
86 }
87 #endif
88 
89 #endif
90 
91