]> git.saurik.com Git - apple/xnu.git/blob - bsd/dev/dtrace/scripts/mptcp.d
xnu-2422.115.4.tar.gz
[apple/xnu.git] / bsd / dev / dtrace / scripts / mptcp.d
1 /*
2 * Copyright (c) 2013 Apple Computer, Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 #pragma D depends_on library darwin.d
25 #pragma D depends_on library socket.d
26 #pragma D depends_on module mach_kernel
27 #pragma D depends_on provider mptcp
28 #pragma D depends_on provider ip
29
30 /*
31 * MPTCP Protocol Control Block.
32 */
33 inline int MPTCPS_CLOSED = 0;
34 #pragma D binding "1.0" MPTCPS_CLOSED
35 inline int MPTCPS_LISTEN = 1;
36 #pragma D binding "1.0" MPTCPS_LISTEN
37 inline int MPTCPS_ESTABLISHED = 2;
38 #pragma D binding "1.0" MPTCPS_ESTABLISHED
39 inline int MPTCPS_CLOSE_WAIT = 3;
40 #pragma D binding "1.0" MPTCPS_CLOSE_WAIT
41 inline int MPTCPS_FIN_WAIT_1 = 4;
42 #pragma D binding "1.0" MPTCPS_FIN_WAIT_1
43 inline int MPTCPS_CLOSING = 5;
44 #pragma D binding "1.0" MPTCPS_CLOSING
45 inline int MPTCPS_LAST_ACK = 6;
46 #pragma D binding "1.0" MPTCPS_LAST_ACK
47 inline int MPTCPS_FIN_WAIT_2 = 7;
48 #pragma D binding "1.0" MPTCPS_FIN_WAIT_2
49 inline int MPTCPS_TIME_WAIT = 8;
50 #pragma D binding "1.0" MPTCPS_TIME_WAIT
51 inline int MPTCPS_FASTCLOSE_WAIT = 9;
52 #pragma D binding "1.0" MPTCPS_FASTCLOSE_WAIT
53
54 typedef uint64_t mptcp_key_t;
55 typedef uint32_t mptcp_token_t;
56
57 typedef struct mptsinfo {
58 string state;
59 uint32_t flags;
60 uint32_t vers;
61 uint32_t error;
62 mptcp_key_t localkey;
63 mptcp_key_t remotekey;
64 mptcp_token_t localtoken;
65 mptcp_token_t remotetoken;
66 int rxtshift;
67 uint32_t rxtstart;
68 uint64_t rtseq;
69 uint32_t timervals;
70 uint32_t timewait;
71 uint64_t snduna;
72 uint64_t sndnxt;
73 uint64_t sndmax;
74 uint64_t local_idsn;
75 uint32_t sndwnd;
76 uint64_t rcvnxt;
77 uint64_t rcvatmark;
78 uint64_t remote_idsn;
79 uint32_t rcvwnd;
80 struct mptcb *mptcb;
81 } mptsinfo_t;
82
83 #pragma D binding "1.0" translator
84 translator mptsinfo_t < struct mptcb *T > {
85 state = T->mpt_state == MPTCPS_CLOSED ? "state-closed" :
86 T->mpt_state == MPTCPS_LISTEN ? "state-listen" :
87 T->mpt_state == MPTCPS_ESTABLISHED ?
88 "state-established" :
89 T->mpt_state == MPTCPS_CLOSE_WAIT ? "state-close-wait" :
90 T->mpt_state == MPTCPS_FIN_WAIT_1 ? "state-fin-wait-1" :
91 T->mpt_state == MPTCPS_CLOSING ? "state-closing" :
92 T->mpt_state == MPTCPS_LAST_ACK ? "state-last-ack" :
93 T->mpt_state == MPTCPS_FIN_WAIT_2 ? "state-fin-wait-2" :
94 T->mpt_state == MPTCPS_TIME_WAIT ? "state-time-wait" :
95 T->mpt_state == MPTCPS_FASTCLOSE_WAIT ?
96 "state-fastclose-wait" :
97 "<unknown>";
98 flags = T->mpt_flags;
99 vers = T->mpt_version;
100 error = T->mpt_softerror;
101 localkey = T->mpt_localkey ? *T->mpt_localkey : 0;
102 remotekey = T->mpt_remotekey;
103 localtoken = T->mpt_localtoken;
104 remotetoken = T->mpt_remotetoken;
105 rxtshift = T->mpt_rxtshift;
106 rxtstart = T->mpt_rxtstart;
107 rtseq = T->mpt_rtseq;
108 timervals = T->mpt_timer_vals;
109 timewait = T->mpt_timewait;
110 snduna = T->mpt_snduna;
111 sndnxt = T->mpt_sndnxt;
112 sndmax = T->mpt_sndmax;
113 local_idsn = T->mpt_local_idsn;
114 sndwnd = T->mpt_sndwnd;
115 rcvnxt = T->mpt_rcvnxt;
116 rcvatmark = T->mpt_rcvatmark;
117 remote_idsn = T->mpt_remote_idsn;
118 rcvwnd = T->mpt_rcvwnd;
119 mptcb = T;
120 };
121
122 /*
123 * Multipath Control Block.
124 */
125 inline int MPPCB_STATE_INUSE = 1;
126 #pragma D binding "1.0" MPPCB_STATE_INUSE
127 inline int MPPCB_STATE_DEAD = 2;
128 #pragma D binding "1.0" MPPCB_STATE_DEAD
129
130 typedef struct mppsinfo {
131 string state;
132 uint32_t flags;
133 struct mppcb *mppcb;
134 } mppsinfo_t;
135
136 #pragma D binding "1.0" translator
137 translator mppsinfo_t < struct mppcb *T> {
138 state = T ?
139 T->mpp_state == MPPCB_STATE_INUSE ? "state-inuse" :
140 T->mpp_state == MPPCB_STATE_DEAD ? "state-dead" :
141 "<unknown>" : "<null>";
142 flags = T->mpp_flags;
143 mppcb = T;
144 };
145
146 /*
147 * MPTCP Session.
148 */
149 typedef struct mptsesinfo {
150 uint16_t numflows;
151 uint16_t nummpcapflows;
152 connid_t connid_last;
153 uint8_t flags;
154 struct mptses *mptses;
155 } mptsesinfo_t;
156
157 #pragma D binding "1.0" translator
158 translator mptsesinfo_t < struct mptses *T > {
159 numflows = T->mpte_numflows;
160 nummpcapflows = T->mpte_nummpcapflows;
161 connid_last = T->mpte_connid_last;
162 flags = T->mpte_flags;
163 mptses = T;
164 };
165
166 /*
167 * MPTCP Subflow.
168 */
169 inline int MPTSF_ATTACHED = 0x00001;
170 #pragma D binding "1.0" MPTSF_ATTACHED
171 inline int MPTSF_CONNECTING = 0x00002;
172 #pragma D binding "1.0" MPTSF_CONNECTING
173 inline int MPTSF_CONNECT_PENDING= 0x00004;
174 #pragma D binding "1.0" MPTSF_CONNECT_PENDING
175 inline int MPTSF_CONNECTED = 0x00008;
176 #pragma D binding "1.0" MPTSF_CONNECTED
177 inline int MPTSF_DISCONNECTING = 0x00010;
178 #pragma D binding "1.0" MPTSF_DISCONNECTING
179 inline int MPTSF_DISCONNECTED = 0x00020;
180 #pragma D binding "1.0" MPTSF_DISCONNECTED
181 inline int MPTSF_MP_CAPABLE = 0x00040;
182 #pragma D binding "1.0" MPTSF_MP_CAPABLE
183 inline int MPTSF_MP_READY = 0x00080;
184 #pragma D binding "1.0" MPTSF_MP_READY
185 inline int MPTSF_MP_DEGRADED = 0x00100;
186 #pragma D binding "1.0" MPTSF_MP_DEGRADED
187 inline int MPTSF_SUSPENDED = 0x00200;
188 #pragma D binding "1.0" MPTSF_SUSPENDED
189 inline int MPTSF_BOUND_IF = 0x00400;
190 #pragma D binding "1.0" MPTSF_BOUND_IF
191 inline int MPTSF_BOUND_IP = 0x00800;
192 #pragma D binding "1.0" MPTSF_BOUND_IP
193 inline int MPTSF_BOUND_PORT = 0x01000;
194 #pragma D binding "1.0" MPTSF_BOUND_PORT
195 inline int MPTSF_PREFERRED = 0x02000;
196 #pragma D binding "1.0" MPTSF_PREFERRED
197 inline int MPTSF_SOPT_OLDVAL = 0x04000;
198 #pragma D binding "1.0" MPTSF_SOPT_OLDVAL
199 inline int MPTSF_SOPT_INPROG = 0x08000;
200 #pragma D binding "1.0" MPTSF_SOPT_INPROG
201 inline int MPTSF_DELETEOK = 0x10000;
202 #pragma D binding "1.0" MPTSF_DELETEOK
203 inline int MPTSF_FAILINGOVER = 0x20000;
204 #pragma D binding "1.0" MPTSF_FAILINGOVER
205 inline int MPTSF_ACTIVE = 0x40000;
206 #pragma D binding "1.0" MPTSF_ACTIVE
207 inline int MPTSF_MPCAP_CTRSET = 0x80000;
208 #pragma D binding "1.0" MPTSF_MPCAP_CTRSET
209
210 typedef struct mptsubinfo {
211 uint32_t flags;
212 uint32_t evctl;
213 uint32_t family;
214 connid_t connid;
215 uint32_t rank;
216 int32_t error;
217 uint64_t sndnxt;
218 struct mptsub *mptsub;
219 } mptsubinfo_t;
220
221 #pragma D binding "1.0" translator
222 translator mptsubinfo_t < struct mptsub *T > {
223 flags = T->mpts_flags;
224 evctl = T->mpts_evctl;
225 family = T->mpts_family;
226 connid = T->mpts_connid;
227 rank = T->mpts_rank;
228 error = T->mpts_soerror;
229 sndnxt = T->mpts_sndnxt;
230 mptsub = T;
231 };