Arnaldo Carvalho de Melo | 73c1f4a | 2005-08-12 12:51:49 -0300 | [diff] [blame] | 1 | #ifndef _INET_DIAG_H_ |
| 2 | #define _INET_DIAG_H_ 1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 4 | #include <uapi/linux/inet_diag.h> |
Jaswinder Singh Rajput | 2df005b | 2009-01-30 21:42:47 +0530 | [diff] [blame] | 5 | |
Lorenzo Colitti | b613f56 | 2015-12-16 12:30:02 +0900 | [diff] [blame] | 6 | struct net; |
Arnaldo Carvalho de Melo | 4f5736c | 2005-08-12 09:27:49 -0300 | [diff] [blame] | 7 | struct sock; |
| 8 | struct inet_hashinfo; |
Pavel Emelyanov | 8d07d15 | 2011-12-09 06:22:44 +0000 | [diff] [blame] | 9 | struct nlattr; |
Pavel Emelyanov | 3c4d05c | 2011-12-09 06:23:00 +0000 | [diff] [blame] | 10 | struct nlmsghdr; |
| 11 | struct sk_buff; |
Pavel Emelyanov | 1942c51 | 2011-12-09 06:23:18 +0000 | [diff] [blame] | 12 | struct netlink_callback; |
Arnaldo Carvalho de Melo | 4f5736c | 2005-08-12 09:27:49 -0300 | [diff] [blame] | 13 | |
| 14 | struct inet_diag_handler { |
Eric Dumazet | 34160ea | 2015-03-10 07:15:54 -0700 | [diff] [blame] | 15 | void (*dump)(struct sk_buff *skb, |
| 16 | struct netlink_callback *cb, |
| 17 | const struct inet_diag_req_v2 *r, |
| 18 | struct nlattr *bc); |
Pavel Emelyanov | 1942c51 | 2011-12-09 06:23:18 +0000 | [diff] [blame] | 19 | |
Eric Dumazet | 34160ea | 2015-03-10 07:15:54 -0700 | [diff] [blame] | 20 | int (*dump_one)(struct sk_buff *in_skb, |
| 21 | const struct nlmsghdr *nlh, |
| 22 | const struct inet_diag_req_v2 *req); |
Pavel Emelyanov | 1942c51 | 2011-12-09 06:23:18 +0000 | [diff] [blame] | 23 | |
Eric Dumazet | 34160ea | 2015-03-10 07:15:54 -0700 | [diff] [blame] | 24 | void (*idiag_get_info)(struct sock *sk, |
| 25 | struct inet_diag_msg *r, |
| 26 | void *info); |
Lorenzo Colitti | 6eb5d2e | 2015-12-16 12:30:04 +0900 | [diff] [blame] | 27 | |
Ivan Delalande | b37e884 | 2017-08-31 09:59:38 -0700 | [diff] [blame] | 28 | int (*idiag_get_aux)(struct sock *sk, |
| 29 | bool net_admin, |
| 30 | struct sk_buff *skb); |
| 31 | |
| 32 | size_t (*idiag_get_aux_size)(struct sock *sk, |
| 33 | bool net_admin); |
| 34 | |
Lorenzo Colitti | 6eb5d2e | 2015-12-16 12:30:04 +0900 | [diff] [blame] | 35 | int (*destroy)(struct sk_buff *in_skb, |
| 36 | const struct inet_diag_req_v2 *req); |
| 37 | |
Eric Dumazet | 34160ea | 2015-03-10 07:15:54 -0700 | [diff] [blame] | 38 | __u16 idiag_type; |
Craig Gallek | 3fd22af | 2015-06-15 11:26:19 -0400 | [diff] [blame] | 39 | __u16 idiag_info_size; |
Arnaldo Carvalho de Melo | 4f5736c | 2005-08-12 09:27:49 -0300 | [diff] [blame] | 40 | }; |
| 41 | |
Pavel Emelyanov | 3c4d05c | 2011-12-09 06:23:00 +0000 | [diff] [blame] | 42 | struct inet_connection_sock; |
| 43 | int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, |
Eric Dumazet | 34160ea | 2015-03-10 07:15:54 -0700 | [diff] [blame] | 44 | struct sk_buff *skb, const struct inet_diag_req_v2 *req, |
| 45 | struct user_namespace *user_ns, |
| 46 | u32 pid, u32 seq, u16 nlmsg_flags, |
Lorenzo Colitti | d545cac | 2016-09-08 00:42:25 +0900 | [diff] [blame] | 47 | const struct nlmsghdr *unlh, bool net_admin); |
Pavel Emelyanov | 1942c51 | 2011-12-09 06:23:18 +0000 | [diff] [blame] | 48 | void inet_diag_dump_icsk(struct inet_hashinfo *h, struct sk_buff *skb, |
Eric Dumazet | 34160ea | 2015-03-10 07:15:54 -0700 | [diff] [blame] | 49 | struct netlink_callback *cb, |
| 50 | const struct inet_diag_req_v2 *r, |
| 51 | struct nlattr *bc); |
Pavel Emelyanov | 1942c51 | 2011-12-09 06:23:18 +0000 | [diff] [blame] | 52 | int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo, |
Eric Dumazet | 34160ea | 2015-03-10 07:15:54 -0700 | [diff] [blame] | 53 | struct sk_buff *in_skb, const struct nlmsghdr *nlh, |
| 54 | const struct inet_diag_req_v2 *req); |
Pavel Emelyanov | 1942c51 | 2011-12-09 06:23:18 +0000 | [diff] [blame] | 55 | |
Lorenzo Colitti | b613f56 | 2015-12-16 12:30:02 +0900 | [diff] [blame] | 56 | struct sock *inet_diag_find_one_icsk(struct net *net, |
| 57 | struct inet_hashinfo *hashinfo, |
| 58 | const struct inet_diag_req_v2 *req); |
| 59 | |
Pavel Emelyanov | 8d07d15 | 2011-12-09 06:22:44 +0000 | [diff] [blame] | 60 | int inet_diag_bc_sk(const struct nlattr *_bc, struct sock *sk); |
Pavel Emelyanov | b005ab4 | 2011-12-09 06:21:53 +0000 | [diff] [blame] | 61 | |
Ben Dooks | c3ec5e5 | 2016-06-09 18:05:09 +0100 | [diff] [blame] | 62 | void inet_diag_msg_common_fill(struct inet_diag_msg *r, struct sock *sk); |
| 63 | |
| 64 | int inet_diag_msg_attrs_fill(struct sock *sk, struct sk_buff *skb, |
| 65 | struct inet_diag_msg *r, int ext, |
Lorenzo Colitti | d545cac | 2016-09-08 00:42:25 +0900 | [diff] [blame] | 66 | struct user_namespace *user_ns, bool net_admin); |
Ben Dooks | c3ec5e5 | 2016-06-09 18:05:09 +0100 | [diff] [blame] | 67 | |
Arnaldo Carvalho de Melo | 4f5736c | 2005-08-12 09:27:49 -0300 | [diff] [blame] | 68 | extern int inet_diag_register(const struct inet_diag_handler *handler); |
| 69 | extern void inet_diag_unregister(const struct inet_diag_handler *handler); |
Arnaldo Carvalho de Melo | 73c1f4a | 2005-08-12 12:51:49 -0300 | [diff] [blame] | 70 | #endif /* _INET_DIAG_H_ */ |