2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A
2N/A#pragma D depends_on module unix
2N/A#pragma D depends_on provider udp
2N/A
2N/Ainline int UDPH_SIZE = @UDPH_SIZE@;
2N/A#pragma D binding "1.6.3" UDPH_SIZE
2N/A
2N/A/*
2N/A * udpinfo is the UDP header fields.
2N/A */
2N/Atypedef struct udpinfo {
2N/A uint16_t udp_sport; /* source port */
2N/A uint16_t udp_dport; /* destination port */
2N/A uint16_t udp_length; /* total length */
2N/A uint16_t udp_checksum; /* headers + data checksum */
2N/A udpha_t *udp_hdr; /* raw UDP header */
2N/A} udpinfo_t;
2N/A
2N/A/*
2N/A * udpsinfo contains stable UDP details from udp_t.
2N/A */
2N/Atypedef struct udpsinfo {
2N/A uintptr_t udps_addr;
2N/A uint16_t udps_lport; /* local port */
2N/A uint16_t udps_rport; /* remote port */
2N/A string udps_laddr; /* local address, as a string */
2N/A string udps_raddr; /* remote address, as a string */
2N/A} udpsinfo_t;
2N/A
2N/A#pragma D binding "1.6.3" translator
2N/Atranslator udpinfo_t < udpha_t *U > {
2N/A udp_sport = ntohs(U->uha_src_port);
2N/A udp_dport = ntohs(U->uha_dst_port);
2N/A udp_length = ntohs(U->uha_length);
2N/A udp_checksum = ntohs(U->uha_checksum);
2N/A udp_hdr = U;
2N/A};
2N/A
2N/A#pragma D binding "1.6.3" translator
2N/Atranslator udpsinfo_t < udp_t *U > {
2N/A udps_addr = (uintptr_t)U;
2N/A udps_lport = U ?
2N/A ntohs(U->udp_connp->u_port.connu_ports.connu_lport) : 0;
2N/A udps_rport = U ?
2N/A ntohs(U->udp_connp->u_port.connu_ports.connu_fport) : 0;
2N/A udps_laddr = U ?
2N/A inet_ntoa6(&U->udp_connp->connua_v6addr.connua_laddr) : "<unknown>";
2N/A udps_raddr = U ?
2N/A inet_ntoa6(&U->udp_connp->connua_v6addr.connua_faddr) : "<unknown>";
2N/A};