]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - cddl/lib/libdtrace/siftr.d
dtrace: third update to the siftr probe
[FreeBSD/FreeBSD.git] / cddl / lib / libdtrace / siftr.d
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 kernel
25 #pragma D depends_on module siftr
26 #pragma D depends_on provider tcp
27
28 /*
29  * Convert a SIFTR direction value to a string
30  */
31 #pragma D binding "1.12.1" SIFTR_IN
32 inline int SIFTR_IN =   0;
33 #pragma D binding "1.12.1" SIFTR_OUT
34 inline int SIFTR_OUT =  1;
35
36 /* SIFTR direction strings. */
37 #pragma D binding "1.12.1" siftr_dir_string
38 inline string siftr_dir_string[uint8_t direction] =
39         direction == SIFTR_IN ? "in" :
40         direction == SIFTR_OUT ? "out" :
41         "unknown" ;
42
43 typedef struct siftrinfo {
44         struct timeval          tval;
45         uint8_t                 direction;
46         uint8_t                 ipver;
47         uint16_t                tcp_localport;
48         uint16_t                tcp_foreignport;
49         uint32_t                snd_cwnd;
50         uint32_t                snd_wnd;
51         uint32_t                rcv_wnd;
52         uint32_t                t_flags2;
53         uint32_t                snd_ssthresh;
54         int                     conn_state;
55         u_int                   max_seg_size;
56         uint32_t                srtt;
57         u_char                  sack_enabled;
58         u_char                  snd_scale;
59         u_char                  rcv_scale;
60         u_int                   flags;
61         uint32_t                rto;
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         tcp_localport =         p == NULL ? 0 : ntohs(p->tcp_localport);
77         tcp_foreignport =       p == NULL ? 0 : ntohs(p->tcp_foreignport);
78         snd_cwnd =              p == NULL ? 0 : p->snd_cwnd;
79         snd_wnd =               p == NULL ? 0 : p->snd_wnd;
80         rcv_wnd =               p == NULL ? 0 : p->rcv_wnd;
81         t_flags2 =              p == NULL ? 0 : p->t_flags2;
82         snd_ssthresh =          p == NULL ? 0 : p->snd_ssthresh;
83         conn_state =            p == NULL ? 0 : p->conn_state;
84         max_seg_size =          p == NULL ? 0 : p->max_seg_size;
85         srtt =                  p == NULL ? 0 : p->srtt;
86         sack_enabled =          p == NULL ? 0 : p->sack_enabled;
87         snd_scale =             p == NULL ? 0 : p->snd_scale;
88         rcv_scale =             p == NULL ? 0 : p->rcv_scale;
89         flags =                 p == NULL ? 0 : p->flags;
90         rto =                   p == NULL ? 0 : p->rto;
91         snd_buf_hiwater =       p == NULL ? 0 : p->snd_buf_hiwater;
92         snd_buf_cc =            p == NULL ? 0 : p->snd_buf_cc;
93         rcv_buf_hiwater =       p == NULL ? 0 : p->rcv_buf_hiwater;
94         rcv_buf_cc =            p == NULL ? 0 : p->rcv_buf_cc;
95         sent_inflight_bytes =   p == NULL ? 0 : p->sent_inflight_bytes;
96         t_segqlen =             p == NULL ? 0 : p->t_segqlen;
97         flowid =                p == NULL ? 0 : p->flowid;
98         flowtype =              p == NULL ? 0 : p->flowtype;
99 };