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