1*9cd928feSAlan Maguire/* 2*9cd928feSAlan Maguire * CDDL HEADER START 3*9cd928feSAlan Maguire * 4*9cd928feSAlan Maguire * The contents of this file are subject to the terms of the 5*9cd928feSAlan Maguire * Common Development and Distribution License (the "License"). 6*9cd928feSAlan Maguire * You may not use this file except in compliance with the License. 7*9cd928feSAlan Maguire * 8*9cd928feSAlan Maguire * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*9cd928feSAlan Maguire * or http://www.opensolaris.org/os/licensing. 10*9cd928feSAlan Maguire * See the License for the specific language governing permissions 11*9cd928feSAlan Maguire * and limitations under the License. 12*9cd928feSAlan Maguire * 13*9cd928feSAlan Maguire * When distributing Covered Code, include this CDDL HEADER in each 14*9cd928feSAlan Maguire * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*9cd928feSAlan Maguire * If applicable, add the following below this CDDL HEADER, with the 16*9cd928feSAlan Maguire * fields enclosed by brackets "[]" replaced with your own identifying 17*9cd928feSAlan Maguire * information: Portions Copyright [yyyy] [name of copyright owner] 18*9cd928feSAlan Maguire * 19*9cd928feSAlan Maguire * CDDL HEADER END 20*9cd928feSAlan Maguire */ 21*9cd928feSAlan Maguire/* 22*9cd928feSAlan Maguire * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 23*9cd928feSAlan Maguire */ 24*9cd928feSAlan Maguire 25*9cd928feSAlan Maguire#pragma D depends_on module unix 26*9cd928feSAlan Maguire#pragma D depends_on provider udp 27*9cd928feSAlan Maguire 28*9cd928feSAlan Maguireinline int UDPH_SIZE = @UDPH_SIZE@; 29*9cd928feSAlan Maguire#pragma D binding "1.6.3" UDPH_SIZE 30*9cd928feSAlan Maguire 31*9cd928feSAlan Maguire/* 32*9cd928feSAlan Maguire * udpinfo is the UDP header fields. 33*9cd928feSAlan Maguire */ 34*9cd928feSAlan Maguiretypedef struct udpinfo { 35*9cd928feSAlan Maguire uint16_t udp_sport; /* source port */ 36*9cd928feSAlan Maguire uint16_t udp_dport; /* destination port */ 37*9cd928feSAlan Maguire uint16_t udp_length; /* total length */ 38*9cd928feSAlan Maguire uint16_t udp_checksum; /* headers + data checksum */ 39*9cd928feSAlan Maguire udpha_t *udp_hdr; /* raw UDP header */ 40*9cd928feSAlan Maguire} udpinfo_t; 41*9cd928feSAlan Maguire 42*9cd928feSAlan Maguire/* 43*9cd928feSAlan Maguire * udpsinfo contains stable UDP details from udp_t. 44*9cd928feSAlan Maguire */ 45*9cd928feSAlan Maguiretypedef struct udpsinfo { 46*9cd928feSAlan Maguire uintptr_t udps_addr; 47*9cd928feSAlan Maguire uint16_t udps_lport; /* local port */ 48*9cd928feSAlan Maguire uint16_t udps_rport; /* remote port */ 49*9cd928feSAlan Maguire string udps_laddr; /* local address, as a string */ 50*9cd928feSAlan Maguire string udps_raddr; /* remote address, as a string */ 51*9cd928feSAlan Maguire} udpsinfo_t; 52*9cd928feSAlan Maguire 53*9cd928feSAlan Maguire#pragma D binding "1.6.3" translator 54*9cd928feSAlan Maguiretranslator udpinfo_t < udpha_t *U > { 55*9cd928feSAlan Maguire udp_sport = ntohs(U->uha_src_port); 56*9cd928feSAlan Maguire udp_dport = ntohs(U->uha_dst_port); 57*9cd928feSAlan Maguire udp_length = ntohs(U->uha_length); 58*9cd928feSAlan Maguire udp_checksum = ntohs(U->uha_checksum); 59*9cd928feSAlan Maguire udp_hdr = U; 60*9cd928feSAlan Maguire}; 61*9cd928feSAlan Maguire 62*9cd928feSAlan Maguire#pragma D binding "1.6.3" translator 63*9cd928feSAlan Maguiretranslator udpsinfo_t < udp_t *U > { 64*9cd928feSAlan Maguire udps_addr = (uintptr_t)U; 65*9cd928feSAlan Maguire udps_lport = U ? 66*9cd928feSAlan Maguire ntohs(U->udp_connp->u_port.connu_ports.connu_lport) : 0; 67*9cd928feSAlan Maguire udps_rport = U ? 68*9cd928feSAlan Maguire ntohs(U->udp_connp->u_port.connu_ports.connu_fport) : 0; 69*9cd928feSAlan Maguire udps_laddr = U ? 70*9cd928feSAlan Maguire inet_ntoa6(&U->udp_connp->connua_v6addr.connua_laddr) : "<unknown>"; 71*9cd928feSAlan Maguire udps_raddr = U ? 72*9cd928feSAlan Maguire inet_ntoa6(&U->udp_connp->connua_v6addr.connua_faddr) : "<unknown>"; 73*9cd928feSAlan Maguire}; 74