1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define _INET_DIAG_H_ 1
5 #include <uapi/linux/inet_diag.h>
13 struct netlink_callback
;
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
,
21 int (*dump_one
)(struct sk_buff
*in_skb
,
22 const struct nlmsghdr
*nlh
,
23 const struct inet_diag_req_v2
*req
);
25 void (*idiag_get_info
)(struct sock
*sk
,
26 struct inet_diag_msg
*r
,
29 int (*idiag_get_aux
)(struct sock
*sk
,
33 size_t (*idiag_get_aux_size
)(struct sock
*sk
,
36 int (*destroy
)(struct sk_buff
*in_skb
,
37 const struct inet_diag_req_v2
*req
);
40 __u16 idiag_info_size
;
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
,
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
);
57 struct sock
*inet_diag_find_one_icsk(struct net
*net
,
58 struct inet_hashinfo
*hashinfo
,
59 const struct inet_diag_req_v2
*req
);
61 int inet_diag_bc_sk(const struct nlattr
*_bc
, struct sock
*sk
);
63 void inet_diag_msg_common_fill(struct inet_diag_msg
*r
, struct sock
*sk
);
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
);
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_ */