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