xref: /freebsd/cddl/lib/libdtrace/siftr.d (revision b78ee15e9f04ae15c3e1200df974473167524d17)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  *
21  * $FreeBSD$
22  */
23 
24 #pragma D depends_on module siftr
25 #pragma D depends_on provider tcp
26 
27 /*
28  * Convert a SIFTR direction value to a string
29  */
30 #pragma D binding "1.12.1" SIFTR_IN
31 inline int SIFTR_IN =	1;
32 #pragma D binding "1.12.1" SIFTR_OUT
33 inline int SIFTR_OUT =	2;
34 
35 /* SIFTR direction strings. */
36 #pragma D binding "1.12.1" siftr_dir_string
37 inline string siftr_dir_string[uint8_t direction] =
38 	direction == SIFTR_IN ?	"in" :
39 	direction == SIFTR_OUT ? "out" :
40 	"unknown" ;
41 
42 typedef struct siftrinfo {
43 	struct timeval		tval;
44 	uint8_t			direction;
45 	uint8_t			ipver;
46 	uint32_t		hash;
47 	uint16_t		tcp_localport;
48 	uint16_t		tcp_foreignport;
49 	uint64_t		snd_cwnd;
50 	u_long			snd_wnd;
51 	u_long			rcv_wnd;
52 	u_long			snd_bwnd;
53 	u_long			snd_ssthresh;
54 	int			conn_state;
55 	u_int			max_seg_size;
56 	int			smoothed_rtt;
57 	u_char			sack_enabled;
58 	u_char			snd_scale;
59 	u_char			rcv_scale;
60 	u_int			flags;
61 	int			rxt_length;
62 	u_int			snd_buf_hiwater;
63 	u_int			snd_buf_cc;
64 	u_int			rcv_buf_hiwater;
65 	u_int			rcv_buf_cc;
66 	u_int			sent_inflight_bytes;
67 	int			t_segqlen;
68 	u_int			flowid;
69 	u_int			flowtype;
70 } siftrinfo_t;
71 
72 #pragma D binding "1.12.1" translator
73 translator siftrinfo_t < struct pkt_node *p > {
74 	direction = 		p == NULL ? 0 : p->direction;
75 	ipver =			p == NULL ? 0 : p->ipver;
76 	hash = 			p == NULL ? 0 : p->hash;
77 	tcp_localport =		p == NULL ? 0 : ntohs(p->tcp_localport);
78 	tcp_foreignport =	p == NULL ? 0 : ntohs(p->tcp_foreignport);
79 	snd_cwnd =		p == NULL ? 0 : p->snd_cwnd;
80 	snd_wnd =		p == NULL ? 0 : p->snd_wnd;
81 	rcv_wnd =		p == NULL ? 0 : p->rcv_wnd;
82 	snd_bwnd =		p == NULL ? 0 : p->snd_bwnd;
83 	snd_ssthresh =		p == NULL ? 0 : p->snd_ssthresh;
84 	conn_state =		p == NULL ? 0 : p->conn_state;
85 	max_seg_size = 		p == NULL ? 0 : p->max_seg_size;
86 	smoothed_rtt =		p == NULL ? 0 : p->smoothed_rtt;
87 	sack_enabled = 		p == NULL ? 0 : p->sack_enabled;
88 	snd_scale =		p == NULL ? 0 : p->snd_scale;
89 	rcv_scale =		p == NULL ? 0 : p->rcv_scale;
90 	flags =			p == NULL ? 0 : p->flags;
91 	rxt_length = 		p == NULL ? 0 : p->rxt_length;
92 	snd_buf_hiwater =	p == NULL ? 0 : p->snd_buf_hiwater;
93 	snd_buf_cc = 		p == NULL ? 0 : p->snd_buf_cc;
94 	rcv_buf_hiwater = 	p == NULL ? 0 : p->rcv_buf_hiwater;
95 	rcv_buf_cc = 		p == NULL ? 0 : p->rcv_buf_cc;
96 	sent_inflight_bytes = 	p == NULL ? 0 : p->sent_inflight_bytes;
97 	t_segqlen =		p == NULL ? 0 : p->t_segqlen;
98 	flowid = 		p == NULL ? 0 : p->flowid;
99 	flowtype = 		p == NULL ? 0 : p->flowtype;
100 };
101