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 --- 4 unchanged lines hidden (view full) --- 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: head/cddl/lib/libdtrace/tcp.d 255993 2013-10-02 17:14:12Z markj $ |
22 */ 23/* 24 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 25 * Copyright (c) 2013 Mark Johnston <markj@freebsd.org> 26 */ 27 28#pragma D depends_on library ip.d 29#pragma D depends_on provider tcp --- 106 unchanged lines hidden (view full) --- 136 uint8_t tcp_offset; /* data offset, in bytes */ 137 uint8_t tcp_flags; /* flags */ 138 uint16_t tcp_window; /* window size */ 139 uint16_t tcp_checksum; /* checksum */ 140 uint16_t tcp_urgent; /* urgent data pointer */ 141 struct tcphdr *tcp_hdr; /* raw TCP header */ 142} tcpinfo_t; 143 |
144/* 145 * A clone of tcpinfo_t used to handle the fact that the TCP input path 146 * overwrites some fields of the TCP header with their host-order equivalents. 147 * Unfortunately, DTrace doesn't let us simply typedef a new name for struct 148 * tcpinfo and define a separate translator for it. 149 */ 150typedef struct tcpinfoh { 151 uint16_t tcp_sport; /* source port */ 152 uint16_t tcp_dport; /* destination port */ 153 uint32_t tcp_seq; /* sequence number */ 154 uint32_t tcp_ack; /* acknowledgment number */ 155 uint8_t tcp_offset; /* data offset, in bytes */ 156 uint8_t tcp_flags; /* flags */ 157 uint16_t tcp_window; /* window size */ 158 uint16_t tcp_checksum; /* checksum */ 159 uint16_t tcp_urgent; /* urgent data pointer */ 160 struct tcphdr *tcp_hdr; /* raw TCP header */ 161} tcpinfoh_t; 162 |
163#pragma D binding "1.0" translator 164translator csinfo_t < struct tcpcb *p > { 165 cs_addr = NULL; 166 cs_cid = (uint64_t)(p == NULL ? 0 : p->t_inpcb); 167 cs_pid = 0; 168 cs_zoneid = 0; 169}; 170 --- 23 unchanged lines hidden (view full) --- 194 tcps_rwnd = p == NULL ? -1 : p->rcv_wnd; 195 tcps_rcv_ws = p == NULL ? -1 : p->rcv_scale; 196 tcps_cwnd = p == NULL ? -1 : p->snd_cwnd; 197 tcps_cwnd_ssthresh = p == NULL ? -1 : p->snd_ssthresh; 198 tcps_sack_fack = p == NULL ? 0 : p->snd_fack; 199 tcps_sack_snxt = p == NULL ? 0 : p->sack_newdata; 200 tcps_rto = p == NULL ? -1 : p->t_rxtcur / 1000; /* XXX */ 201 tcps_mss = p == NULL ? -1 : p->t_maxseg; |
202 tcps_retransmit = p == NULL ? -1 : p->t_rxtshift > 0 ? 1 : 0; |
203}; 204 205#pragma D binding "1.0" translator 206translator tcpinfo_t < struct tcphdr *p > { 207 tcp_sport = p == NULL ? 0 : ntohs(p->th_sport); 208 tcp_dport = p == NULL ? 0 : ntohs(p->th_dport); 209 tcp_seq = p == NULL ? -1 : ntohl(p->th_seq); 210 tcp_ack = p == NULL ? -1 : ntohl(p->th_ack); 211 tcp_offset = p == NULL ? -1 : (p->th_off >> 2); 212 tcp_flags = p == NULL ? 0 : p->th_flags; 213 tcp_window = p == NULL ? 0 : ntohs(p->th_win); 214 tcp_checksum = p == NULL ? 0 : ntohs(p->th_sum); 215 tcp_urgent = p == NULL ? 0 : ntohs(p->th_urp); 216 tcp_hdr = (struct tcphdr *)p; 217}; 218 |
219/* 220 * This translator differs from the one for tcpinfo_t in that the sequence 221 * number, acknowledgement number, window size and urgent pointer are already 222 * in host order and thus don't need to be converted. 223 */ |
224#pragma D binding "1.0" translator |
225translator tcpinfoh_t < struct tcphdr *p > { 226 tcp_sport = p == NULL ? 0 : ntohs(p->th_sport); 227 tcp_dport = p == NULL ? 0 : ntohs(p->th_dport); 228 tcp_seq = p == NULL ? -1 : p->th_seq; 229 tcp_ack = p == NULL ? -1 : p->th_ack; 230 tcp_offset = p == NULL ? -1 : (p->th_off >> 2); 231 tcp_flags = p == NULL ? 0 : p->th_flags; 232 tcp_window = p == NULL ? 0 : (p->th_win); 233 tcp_checksum = p == NULL ? 0 : ntohs(p->th_sum); 234 tcp_urgent = p == NULL ? 0 : p->th_urp; 235 tcp_hdr = (struct tcphdr *)p; 236}; 237 238#pragma D binding "1.0" translator |
239translator tcplsinfo_t < int s > { 240 tcps_state = s; 241}; |