Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
73c1f4a0 ACM |
2 | #ifndef _INET_DIAG_H_ |
3 | #define _INET_DIAG_H_ 1 | |
1da177e4 | 4 | |
607ca46e | 5 | #include <uapi/linux/inet_diag.h> |
2df005b7 | 6 | |
b613f56e | 7 | struct net; |
4f5736c4 ACM |
8 | struct sock; |
9 | struct inet_hashinfo; | |
8d07d151 | 10 | struct nlattr; |
3c4d05c8 PE |
11 | struct nlmsghdr; |
12 | struct sk_buff; | |
1942c518 | 13 | struct netlink_callback; |
4f5736c4 ACM |
14 | |
15 | struct inet_diag_handler { | |
34160ea3 ED |
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); | |
6eb5d2e0 | 28 | |
b37e8840 ID |
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 | ||
6eb5d2e0 LC |
36 | int (*destroy)(struct sk_buff *in_skb, |
37 | const struct inet_diag_req_v2 *req); | |
38 | ||
34160ea3 | 39 | __u16 idiag_type; |
3fd22af8 | 40 | __u16 idiag_info_size; |
4f5736c4 ACM |
41 | }; |
42 | ||
3c4d05c8 PE |
43 | struct inet_connection_sock; |
44 | int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, | |
34160ea3 ED |
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, | |
d545caca | 48 | const struct nlmsghdr *unlh, bool net_admin); |
1942c518 | 49 | void inet_diag_dump_icsk(struct inet_hashinfo *h, struct sk_buff *skb, |
34160ea3 ED |
50 | struct netlink_callback *cb, |
51 | const struct inet_diag_req_v2 *r, | |
52 | struct nlattr *bc); | |
1942c518 | 53 | int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo, |
34160ea3 ED |
54 | struct sk_buff *in_skb, const struct nlmsghdr *nlh, |
55 | const struct inet_diag_req_v2 *req); | |
1942c518 | 56 | |
b613f56e LC |
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 | ||
8d07d151 | 61 | int inet_diag_bc_sk(const struct nlattr *_bc, struct sock *sk); |
b005ab4e | 62 | |
c3ec5e5c BD |
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, | |
d545caca | 67 | struct user_namespace *user_ns, bool net_admin); |
c3ec5e5c | 68 | |
4f5736c4 ACM |
69 | extern int inet_diag_register(const struct inet_diag_handler *handler); |
70 | extern void inet_diag_unregister(const struct inet_diag_handler *handler); | |
73c1f4a0 | 71 | #endif /* _INET_DIAG_H_ */ |