21c21
< * $FreeBSD: head/cddl/lib/libdtrace/tcp.d 255604 2013-09-15 21:38:46Z markj $
---
> * $FreeBSD: head/cddl/lib/libdtrace/tcp.d 255993 2013-10-02 17:14:12Z markj $
143a144,162
> /*
> * A clone of tcpinfo_t used to handle the fact that the TCP input path
> * overwrites some fields of the TCP header with their host-order equivalents.
> * Unfortunately, DTrace doesn't let us simply typedef a new name for struct
> * tcpinfo and define a separate translator for it.
> */
> typedef struct tcpinfoh {
> uint16_t tcp_sport; /* source port */
> uint16_t tcp_dport; /* destination port */
> uint32_t tcp_seq; /* sequence number */
> uint32_t tcp_ack; /* acknowledgment number */
> uint8_t tcp_offset; /* data offset, in bytes */
> uint8_t tcp_flags; /* flags */
> uint16_t tcp_window; /* window size */
> uint16_t tcp_checksum; /* checksum */
> uint16_t tcp_urgent; /* urgent data pointer */
> struct tcphdr *tcp_hdr; /* raw TCP header */
> } tcpinfoh_t;
>
183c202
< tcps_retransmit = -1; /* XXX */
---
> tcps_retransmit = p == NULL ? -1 : p->t_rxtshift > 0 ? 1 : 0;
199a219,223
> /*
> * This translator differs from the one for tcpinfo_t in that the sequence
> * number, acknowledgement number, window size and urgent pointer are already
> * in host order and thus don't need to be converted.
> */
200a225,238
> translator tcpinfoh_t < struct tcphdr *p > {
> tcp_sport = p == NULL ? 0 : ntohs(p->th_sport);
> tcp_dport = p == NULL ? 0 : ntohs(p->th_dport);
> tcp_seq = p == NULL ? -1 : p->th_seq;
> tcp_ack = p == NULL ? -1 : p->th_ack;
> tcp_offset = p == NULL ? -1 : (p->th_off >> 2);
> tcp_flags = p == NULL ? 0 : p->th_flags;
> tcp_window = p == NULL ? 0 : (p->th_win);
> tcp_checksum = p == NULL ? 0 : ntohs(p->th_sum);
> tcp_urgent = p == NULL ? 0 : p->th_urp;
> tcp_hdr = (struct tcphdr *)p;
> };
>
> #pragma D binding "1.0" translator
< * $FreeBSD: head/cddl/lib/libdtrace/tcp.d 255604 2013-09-15 21:38:46Z markj $
---
> * $FreeBSD: head/cddl/lib/libdtrace/tcp.d 255993 2013-10-02 17:14:12Z markj $
143a144,162
> /*
> * A clone of tcpinfo_t used to handle the fact that the TCP input path
> * overwrites some fields of the TCP header with their host-order equivalents.
> * Unfortunately, DTrace doesn't let us simply typedef a new name for struct
> * tcpinfo and define a separate translator for it.
> */
> typedef struct tcpinfoh {
> uint16_t tcp_sport; /* source port */
> uint16_t tcp_dport; /* destination port */
> uint32_t tcp_seq; /* sequence number */
> uint32_t tcp_ack; /* acknowledgment number */
> uint8_t tcp_offset; /* data offset, in bytes */
> uint8_t tcp_flags; /* flags */
> uint16_t tcp_window; /* window size */
> uint16_t tcp_checksum; /* checksum */
> uint16_t tcp_urgent; /* urgent data pointer */
> struct tcphdr *tcp_hdr; /* raw TCP header */
> } tcpinfoh_t;
>
183c202
< tcps_retransmit = -1; /* XXX */
---
> tcps_retransmit = p == NULL ? -1 : p->t_rxtshift > 0 ? 1 : 0;
199a219,223
> /*
> * This translator differs from the one for tcpinfo_t in that the sequence
> * number, acknowledgement number, window size and urgent pointer are already
> * in host order and thus don't need to be converted.
> */
200a225,238
> translator tcpinfoh_t < struct tcphdr *p > {
> tcp_sport = p == NULL ? 0 : ntohs(p->th_sport);
> tcp_dport = p == NULL ? 0 : ntohs(p->th_dport);
> tcp_seq = p == NULL ? -1 : p->th_seq;
> tcp_ack = p == NULL ? -1 : p->th_ack;
> tcp_offset = p == NULL ? -1 : (p->th_off >> 2);
> tcp_flags = p == NULL ? 0 : p->th_flags;
> tcp_window = p == NULL ? 0 : (p->th_win);
> tcp_checksum = p == NULL ? 0 : ntohs(p->th_sum);
> tcp_urgent = p == NULL ? 0 : p->th_urp;
> tcp_hdr = (struct tcphdr *)p;
> };
>
> #pragma D binding "1.0" translator