xref: /illumos-gate/usr/src/cmd/connstat/connstat_tcp.h (revision 13b136d3061155363c62c9f6568d25b8b27da8f6)
1 /*
2  * CDDL HEADER START
3  *
4  * This file and its contents are supplied under the terms of the
5  * Common Development and Distribution License ("CDDL"), version 1.0.
6  * You may only use this file in accordance with the terms of version
7  * 1.0 of the CDDL.
8  *
9  * A full copy of the text of the CDDL should have accompanied this
10  * source.  A copy of the CDDL is also available via the Internet at
11  * http://www.illumos.org/license/CDDL.
12  *
13  * CDDL HEADER END
14  */
15 /*
16  * Copyright (c) 2015, 2016 by Delphix. All rights reserved.
17  */
18 
19 #ifndef	_CONNSTAT_TCP_H
20 #define	_CONNSTAT_TCP_H
21 
22 #include <stddef.h>
23 #include "connstat.h"
24 
25 #ifdef	__cplusplus
26 extern "C" {
27 #endif
28 
29 int tcp_str2state(const char *state);
30 connstat_getfieldsfunc_t tcp_get_fields;
31 connstat_walkfunc_t tcp_walk_ipv4, tcp_walk_ipv6;
32 
33 /*
34  * Keep the default output to < 80 columns. For most interactive workflows,
35  * the user will run the command without arguments to get an idea of what
36  * connections exist before narrowing down the investigation to a single
37  * connection (with filtering) and specifying additional fields to output
38  * depending on what the user is interested in.
39  */
40 #define	TCP_DEFAULT_FIELDS	"laddr,lport,raddr,rport,state"
41 
42 #define	CONNSTAT_TCP_PROTO \
43 	{ "tcp", TCP_DEFAULT_FIELDS, MIB2_TCP, MIB2_TCP_CONN, MIB2_TCP6_CONN, \
44 	tcp_get_fields, tcp_walk_ipv4, tcp_walk_ipv6 }
45 
46 #ifdef	__cplusplus
47 }
48 #endif
49 
50 #endif	/* _CONNSTAT_TCP_H */
51