blob: 46da02410a09691c5e624df266cfc0c105fce6d9 [file] [log] [blame]
Arnaldo Carvalho de Melo73c1f4a2005-08-12 12:51:49 -03001#ifndef _INET_DIAG_H_
2#define _INET_DIAG_H_ 1
Linus Torvalds1da177e2005-04-16 15:20:36 -07003
David Howells607ca462012-10-13 10:46:48 +01004#include <uapi/linux/inet_diag.h>
Jaswinder Singh Rajput2df005b2009-01-30 21:42:47 +05305
Arnaldo Carvalho de Melo4f5736c2005-08-12 09:27:49 -03006struct sock;
7struct inet_hashinfo;
Pavel Emelyanov8d07d152011-12-09 06:22:44 +00008struct nlattr;
Pavel Emelyanov3c4d05c2011-12-09 06:23:00 +00009struct nlmsghdr;
10struct sk_buff;
Pavel Emelyanov1942c512011-12-09 06:23:18 +000011struct netlink_callback;
Arnaldo Carvalho de Melo4f5736c2005-08-12 09:27:49 -030012
13struct inet_diag_handler {
Pavel Emelyanov1942c512011-12-09 06:23:18 +000014 void (*dump)(struct sk_buff *skb,
15 struct netlink_callback *cb,
Pavel Emelyanovc8991362012-01-10 22:36:35 +000016 struct inet_diag_req_v2 *r,
Pavel Emelyanov1942c512011-12-09 06:23:18 +000017 struct nlattr *bc);
18
19 int (*dump_one)(struct sk_buff *in_skb,
20 const struct nlmsghdr *nlh,
Pavel Emelyanovc8991362012-01-10 22:36:35 +000021 struct inet_diag_req_v2 *req);
Pavel Emelyanov1942c512011-12-09 06:23:18 +000022
Arnaldo Carvalho de Melo4f5736c2005-08-12 09:27:49 -030023 void (*idiag_get_info)(struct sock *sk,
Arnaldo Carvalho de Melo73c1f4a2005-08-12 12:51:49 -030024 struct inet_diag_msg *r,
Arnaldo Carvalho de Melo4f5736c2005-08-12 09:27:49 -030025 void *info);
Arnaldo Carvalho de Melo4f5736c2005-08-12 09:27:49 -030026 __u16 idiag_type;
27};
28
Pavel Emelyanov3c4d05c2011-12-09 06:23:00 +000029struct inet_connection_sock;
30int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
Pavel Emelyanovc8991362012-01-10 22:36:35 +000031 struct sk_buff *skb, struct inet_diag_req_v2 *req,
Eric W. Biedermand06ca952012-05-24 17:58:08 -060032 struct user_namespace *user_ns,
Pavel Emelyanov3c4d05c2011-12-09 06:23:00 +000033 u32 pid, u32 seq, u16 nlmsg_flags,
34 const struct nlmsghdr *unlh);
Pavel Emelyanov1942c512011-12-09 06:23:18 +000035void inet_diag_dump_icsk(struct inet_hashinfo *h, struct sk_buff *skb,
Pavel Emelyanovc8991362012-01-10 22:36:35 +000036 struct netlink_callback *cb, struct inet_diag_req_v2 *r,
Pavel Emelyanov1942c512011-12-09 06:23:18 +000037 struct nlattr *bc);
38int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo,
39 struct sk_buff *in_skb, const struct nlmsghdr *nlh,
Pavel Emelyanovc8991362012-01-10 22:36:35 +000040 struct inet_diag_req_v2 *req);
Pavel Emelyanov1942c512011-12-09 06:23:18 +000041
Pavel Emelyanov8d07d152011-12-09 06:22:44 +000042int inet_diag_bc_sk(const struct nlattr *_bc, struct sock *sk);
Pavel Emelyanovb005ab42011-12-09 06:21:53 +000043
Arnaldo Carvalho de Melo4f5736c2005-08-12 09:27:49 -030044extern int inet_diag_register(const struct inet_diag_handler *handler);
45extern void inet_diag_unregister(const struct inet_diag_handler *handler);
Arnaldo Carvalho de Melo73c1f4a2005-08-12 12:51:49 -030046#endif /* _INET_DIAG_H_ */