2005-08-12 19:51:49 +04:00
|
|
|
#ifndef _INET_DIAG_H_
|
|
|
|
#define _INET_DIAG_H_ 1
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
/* Just some random number */
|
|
|
|
#define TCPDIAG_GETSOCK 18
|
2005-08-10 12:54:28 +04:00
|
|
|
#define DCCPDIAG_GETSOCK 19
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2005-08-12 16:27:49 +04:00
|
|
|
#define INET_DIAG_GETSOCK_MAX 24
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
/* Socket identity */
|
2005-08-12 19:51:49 +04:00
|
|
|
struct inet_diag_sockid {
|
2006-09-28 05:44:30 +04:00
|
|
|
__be16 idiag_sport;
|
|
|
|
__be16 idiag_dport;
|
|
|
|
__be32 idiag_src[4];
|
|
|
|
__be32 idiag_dst[4];
|
2005-08-12 19:51:49 +04:00
|
|
|
__u32 idiag_if;
|
|
|
|
__u32 idiag_cookie[2];
|
|
|
|
#define INET_DIAG_NOCOOKIE (~0U)
|
2005-04-17 02:20:36 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Request structure */
|
|
|
|
|
2005-08-12 19:51:49 +04:00
|
|
|
struct inet_diag_req {
|
|
|
|
__u8 idiag_family; /* Family of addresses. */
|
|
|
|
__u8 idiag_src_len;
|
|
|
|
__u8 idiag_dst_len;
|
|
|
|
__u8 idiag_ext; /* Query extended information */
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2005-08-12 19:51:49 +04:00
|
|
|
struct inet_diag_sockid id;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2005-08-12 19:51:49 +04:00
|
|
|
__u32 idiag_states; /* States to dump */
|
|
|
|
__u32 idiag_dbs; /* Tables to dump (NI) */
|
2005-04-17 02:20:36 +04:00
|
|
|
};
|
|
|
|
|
2005-08-12 19:51:49 +04:00
|
|
|
enum {
|
|
|
|
INET_DIAG_REQ_NONE,
|
|
|
|
INET_DIAG_REQ_BYTECODE,
|
2005-04-17 02:20:36 +04:00
|
|
|
};
|
|
|
|
|
2005-08-12 19:51:49 +04:00
|
|
|
#define INET_DIAG_REQ_MAX INET_DIAG_REQ_BYTECODE
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
/* Bytecode is sequence of 4 byte commands followed by variable arguments.
|
|
|
|
* All the commands identified by "code" are conditional jumps forward:
|
|
|
|
* to offset cc+"yes" or to offset cc+"no". "yes" is supposed to be
|
|
|
|
* length of the command and its arguments.
|
|
|
|
*/
|
|
|
|
|
2005-08-12 19:51:49 +04:00
|
|
|
struct inet_diag_bc_op {
|
2005-04-17 02:20:36 +04:00
|
|
|
unsigned char code;
|
|
|
|
unsigned char yes;
|
|
|
|
unsigned short no;
|
|
|
|
};
|
|
|
|
|
2005-08-12 19:51:49 +04:00
|
|
|
enum {
|
|
|
|
INET_DIAG_BC_NOP,
|
|
|
|
INET_DIAG_BC_JMP,
|
|
|
|
INET_DIAG_BC_S_GE,
|
|
|
|
INET_DIAG_BC_S_LE,
|
|
|
|
INET_DIAG_BC_D_GE,
|
|
|
|
INET_DIAG_BC_D_LE,
|
|
|
|
INET_DIAG_BC_AUTO,
|
|
|
|
INET_DIAG_BC_S_COND,
|
|
|
|
INET_DIAG_BC_D_COND,
|
2005-04-17 02:20:36 +04:00
|
|
|
};
|
|
|
|
|
2005-08-12 19:51:49 +04:00
|
|
|
struct inet_diag_hostcond {
|
2005-04-17 02:20:36 +04:00
|
|
|
__u8 family;
|
|
|
|
__u8 prefix_len;
|
|
|
|
int port;
|
2006-09-28 05:44:30 +04:00
|
|
|
__be32 addr[0];
|
2005-04-17 02:20:36 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Base info structure. It contains socket identity (addrs/ports/cookie)
|
|
|
|
* and, alas, the information shown by netstat. */
|
2005-08-12 19:51:49 +04:00
|
|
|
struct inet_diag_msg {
|
|
|
|
__u8 idiag_family;
|
|
|
|
__u8 idiag_state;
|
|
|
|
__u8 idiag_timer;
|
|
|
|
__u8 idiag_retrans;
|
|
|
|
|
|
|
|
struct inet_diag_sockid id;
|
|
|
|
|
|
|
|
__u32 idiag_expires;
|
|
|
|
__u32 idiag_rqueue;
|
|
|
|
__u32 idiag_wqueue;
|
|
|
|
__u32 idiag_uid;
|
|
|
|
__u32 idiag_inode;
|
2005-04-17 02:20:36 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Extensions */
|
|
|
|
|
2005-08-12 19:51:49 +04:00
|
|
|
enum {
|
|
|
|
INET_DIAG_NONE,
|
|
|
|
INET_DIAG_MEMINFO,
|
|
|
|
INET_DIAG_INFO,
|
|
|
|
INET_DIAG_VEGASINFO,
|
|
|
|
INET_DIAG_CONG,
|
2005-04-17 02:20:36 +04:00
|
|
|
};
|
|
|
|
|
2005-08-12 19:51:49 +04:00
|
|
|
#define INET_DIAG_MAX INET_DIAG_CONG
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
|
2005-08-12 19:51:49 +04:00
|
|
|
/* INET_DIAG_MEM */
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2005-08-12 19:51:49 +04:00
|
|
|
struct inet_diag_meminfo {
|
|
|
|
__u32 idiag_rmem;
|
|
|
|
__u32 idiag_wmem;
|
|
|
|
__u32 idiag_fmem;
|
|
|
|
__u32 idiag_tmem;
|
2005-04-17 02:20:36 +04:00
|
|
|
};
|
|
|
|
|
2005-08-12 19:51:49 +04:00
|
|
|
/* INET_DIAG_VEGASINFO */
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
struct tcpvegas_info {
|
|
|
|
__u32 tcpv_enabled;
|
|
|
|
__u32 tcpv_rttcnt;
|
|
|
|
__u32 tcpv_rtt;
|
|
|
|
__u32 tcpv_minrtt;
|
|
|
|
};
|
|
|
|
|
2005-08-12 16:27:49 +04:00
|
|
|
#ifdef __KERNEL__
|
|
|
|
struct sock;
|
|
|
|
struct inet_hashinfo;
|
|
|
|
|
|
|
|
struct inet_diag_handler {
|
|
|
|
struct inet_hashinfo *idiag_hashinfo;
|
|
|
|
void (*idiag_get_info)(struct sock *sk,
|
2005-08-12 19:51:49 +04:00
|
|
|
struct inet_diag_msg *r,
|
2005-08-12 16:27:49 +04:00
|
|
|
void *info);
|
|
|
|
__u16 idiag_info_size;
|
|
|
|
__u16 idiag_type;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern int inet_diag_register(const struct inet_diag_handler *handler);
|
|
|
|
extern void inet_diag_unregister(const struct inet_diag_handler *handler);
|
|
|
|
#endif /* __KERNEL__ */
|
|
|
|
|
2005-08-12 19:51:49 +04:00
|
|
|
#endif /* _INET_DIAG_H_ */
|