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.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
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]
22 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
25 #
pragma D depends_on
module unix
26 #
pragma D depends_on provider udp
28 inline
int UDPH_SIZE
= @UDPH_SIZE@
;
29 #
pragma D binding
"1.6.3" UDPH_SIZE
32 * udpinfo is the UDP header fields.
34 typedef struct udpinfo
{
35 uint16_t udp_sport
; /* source port */
36 uint16_t udp_dport
; /* destination port */
37 uint16_t udp_length
; /* total length */
38 uint16_t udp_checksum
; /* headers + data checksum */
39 udpha_t
*udp_hdr
; /* raw UDP header */
43 * udpsinfo contains stable UDP details from udp_t.
45 typedef struct udpsinfo
{
47 uint16_t udps_lport
; /* local port */
48 uint16_t udps_rport
; /* remote port */
49 string udps_laddr
; /* local address, as a string */
50 string udps_raddr
; /* remote address, as a string */
53 #
pragma D binding
"1.6.3" translator
54 translator udpinfo_t
< udpha_t
*U
> {
55 udp_sport
= ntohs(U
->uha_src_port
);
56 udp_dport
= ntohs(U
->uha_dst_port
);
57 udp_length
= ntohs(U
->uha_length
);
58 udp_checksum
= ntohs(U
->uha_checksum
);
62 #
pragma D binding
"1.6.3" translator
63 translator udpsinfo_t
< udp_t
*U
> {
64 udps_addr
= (uintptr_t
)U
;
66 ntohs(U
->udp_connp
->u_port
.connu_ports
.connu_lport
) : 0;
68 ntohs(U
->udp_connp
->u_port
.connu_ports
.connu_fport
) : 0;
70 inet_ntoa6(&U
->udp_connp
->connua_v6addr
.connua_laddr
) : "<unknown>";
72 inet_ntoa6(&U
->udp_connp
->connua_v6addr
.connua_faddr
) : "<unknown>";