2 #define _INET_DIAG_H_ 1
4 #include <linux/types.h>
6 /* Just some random number */
7 #define TCPDIAG_GETSOCK 18
8 #define DCCPDIAG_GETSOCK 19
10 #define INET_DIAG_GETSOCK_MAX 24
13 struct inet_diag_sockid {
19 __u32 idiag_cookie[2];
20 #define INET_DIAG_NOCOOKIE (~0U)
23 /* Request structure */
25 struct inet_diag_req {
26 __u8 idiag_family; /* Family of addresses. */
29 __u8 idiag_ext; /* Query extended information */
31 struct inet_diag_sockid id;
33 __u32 idiag_states; /* States to dump */
34 __u32 idiag_dbs; /* Tables to dump (NI) */
37 struct inet_diag_req_v2 {
43 struct inet_diag_sockid id;
48 INET_DIAG_REQ_BYTECODE,
51 #define INET_DIAG_REQ_MAX INET_DIAG_REQ_BYTECODE
53 /* Bytecode is sequence of 4 byte commands followed by variable arguments.
54 * All the commands identified by "code" are conditional jumps forward:
55 * to offset cc+"yes" or to offset cc+"no". "yes" is supposed to be
56 * length of the command and its arguments.
59 struct inet_diag_bc_op {
77 struct inet_diag_hostcond {
84 /* Base info structure. It contains socket identity (addrs/ports/cookie)
85 * and, alas, the information shown by netstat. */
86 struct inet_diag_msg {
92 struct inet_diag_sockid id;
114 #define INET_DIAG_MAX INET_DIAG_SKMEMINFO
119 struct inet_diag_meminfo {
126 /* INET_DIAG_VEGASINFO */
128 struct tcpvegas_info {
137 struct inet_hashinfo;
141 struct netlink_callback;
143 struct inet_diag_handler {
144 void (*dump)(struct sk_buff *skb,
145 struct netlink_callback *cb,
146 struct inet_diag_req_v2 *r,
149 int (*dump_one)(struct sk_buff *in_skb,
150 const struct nlmsghdr *nlh,
151 struct inet_diag_req_v2 *req);
153 void (*idiag_get_info)(struct sock *sk,
154 struct inet_diag_msg *r,
159 struct inet_connection_sock;
160 int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
161 struct sk_buff *skb, struct inet_diag_req_v2 *req,
162 u32 pid, u32 seq, u16 nlmsg_flags,
163 const struct nlmsghdr *unlh);
164 void inet_diag_dump_icsk(struct inet_hashinfo *h, struct sk_buff *skb,
165 struct netlink_callback *cb, struct inet_diag_req_v2 *r,
167 int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo,
168 struct sk_buff *in_skb, const struct nlmsghdr *nlh,
169 struct inet_diag_req_v2 *req);
171 int inet_diag_bc_sk(const struct nlattr *_bc, struct sock *sk);
173 extern int inet_diag_register(const struct inet_diag_handler *handler);
174 extern void inet_diag_unregister(const struct inet_diag_handler *handler);
175 #endif /* __KERNEL__ */
177 #endif /* _INET_DIAG_H_ */