1 | /* SPDX-License-Identifier: GPL-2.0 */ |
2 | #ifndef _INET_DIAG_H_ |
3 | #define _INET_DIAG_H_ 1 |
4 | |
5 | #include <uapi/linux/inet_diag.h> |
6 | |
7 | struct net; |
8 | struct sock; |
9 | struct inet_hashinfo; |
10 | struct nlattr; |
11 | struct nlmsghdr; |
12 | struct sk_buff; |
13 | struct netlink_callback; |
14 | |
15 | struct inet_diag_handler { |
16 | void (*dump)(struct sk_buff *skb, |
17 | struct netlink_callback *cb, |
18 | const struct inet_diag_req_v2 *r, |
19 | struct nlattr *bc); |
20 | |
21 | int (*dump_one)(struct sk_buff *in_skb, |
22 | const struct nlmsghdr *nlh, |
23 | const struct inet_diag_req_v2 *req); |
24 | |
25 | void (*idiag_get_info)(struct sock *sk, |
26 | struct inet_diag_msg *r, |
27 | void *info); |
28 | |
29 | int (*idiag_get_aux)(struct sock *sk, |
30 | bool net_admin, |
31 | struct sk_buff *skb); |
32 | |
33 | size_t (*idiag_get_aux_size)(struct sock *sk, |
34 | bool net_admin); |
35 | |
36 | int (*destroy)(struct sk_buff *in_skb, |
37 | const struct inet_diag_req_v2 *req); |
38 | |
39 | __u16 idiag_type; |
40 | __u16 idiag_info_size; |
41 | }; |
42 | |
43 | struct inet_connection_sock; |
44 | int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, |
45 | struct sk_buff *skb, const struct inet_diag_req_v2 *req, |
46 | struct user_namespace *user_ns, |
47 | u32 pid, u32 seq, u16 nlmsg_flags, |
48 | const struct nlmsghdr *unlh, bool net_admin); |
49 | void inet_diag_dump_icsk(struct inet_hashinfo *h, struct sk_buff *skb, |
50 | struct netlink_callback *cb, |
51 | const struct inet_diag_req_v2 *r, |
52 | struct nlattr *bc); |
53 | int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo, |
54 | struct sk_buff *in_skb, const struct nlmsghdr *nlh, |
55 | const struct inet_diag_req_v2 *req); |
56 | |
57 | struct sock *inet_diag_find_one_icsk(struct net *net, |
58 | struct inet_hashinfo *hashinfo, |
59 | const struct inet_diag_req_v2 *req); |
60 | |
61 | int inet_diag_bc_sk(const struct nlattr *_bc, struct sock *sk); |
62 | |
63 | void inet_diag_msg_common_fill(struct inet_diag_msg *r, struct sock *sk); |
64 | |
65 | int inet_diag_msg_attrs_fill(struct sock *sk, struct sk_buff *skb, |
66 | struct inet_diag_msg *r, int ext, |
67 | struct user_namespace *user_ns, bool net_admin); |
68 | |
69 | extern int inet_diag_register(const struct inet_diag_handler *handler); |
70 | extern void inet_diag_unregister(const struct inet_diag_handler *handler); |
71 | #endif /* _INET_DIAG_H_ */ |
72 | |