xref: /onnv-gate/usr/src/cmd/dtrace/test/tst/common/funcs/tst.inet_ntop.d (revision 4291:2650d270ece9)
1*4291Sbrendan /*
2*4291Sbrendan  * CDDL HEADER START
3*4291Sbrendan  *
4*4291Sbrendan  * The contents of this file are subject to the terms of the
5*4291Sbrendan  * Common Development and Distribution License (the "License").
6*4291Sbrendan  * You may not use this file except in compliance with the License.
7*4291Sbrendan  *
8*4291Sbrendan  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*4291Sbrendan  * or http://www.opensolaris.org/os/licensing.
10*4291Sbrendan  * See the License for the specific language governing permissions
11*4291Sbrendan  * and limitations under the License.
12*4291Sbrendan  *
13*4291Sbrendan  * When distributing Covered Code, include this CDDL HEADER in each
14*4291Sbrendan  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*4291Sbrendan  * If applicable, add the following below this CDDL HEADER, with the
16*4291Sbrendan  * fields enclosed by brackets "[]" replaced with your own identifying
17*4291Sbrendan  * information: Portions Copyright [yyyy] [name of copyright owner]
18*4291Sbrendan  *
19*4291Sbrendan  * CDDL HEADER END
20*4291Sbrendan  */
21*4291Sbrendan 
22*4291Sbrendan /*
23*4291Sbrendan  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24*4291Sbrendan  * Use is subject to license terms.
25*4291Sbrendan  */
26*4291Sbrendan 
27*4291Sbrendan #pragma ident	"%Z%%M%	%I%	%E% SMI"
28*4291Sbrendan 
29*4291Sbrendan #pragma D option quiet
30*4291Sbrendan 
31*4291Sbrendan ipaddr_t *ip4a;
32*4291Sbrendan ipaddr_t *ip4b;
33*4291Sbrendan ipaddr_t *ip4c;
34*4291Sbrendan ipaddr_t *ip4d;
35*4291Sbrendan struct in6_addr *ip6a;
36*4291Sbrendan struct in6_addr *ip6b;
37*4291Sbrendan struct in6_addr *ip6c;
38*4291Sbrendan struct in6_addr *ip6d;
39*4291Sbrendan struct in6_addr *ip6e;
40*4291Sbrendan struct in6_addr *ip6f;
41*4291Sbrendan struct in6_addr *ip6g;
42*4291Sbrendan struct in6_addr *ip6h;
43*4291Sbrendan 
44*4291Sbrendan BEGIN
45*4291Sbrendan {
46*4291Sbrendan 	this->buf4a = alloca(sizeof (ipaddr_t));
47*4291Sbrendan 	this->buf4b = alloca(sizeof (ipaddr_t));
48*4291Sbrendan 	this->buf4c = alloca(sizeof (ipaddr_t));
49*4291Sbrendan 	this->buf4d = alloca(sizeof (ipaddr_t));
50*4291Sbrendan 	this->buf6a = alloca(sizeof (struct in6_addr));
51*4291Sbrendan 	this->buf6b = alloca(sizeof (struct in6_addr));
52*4291Sbrendan 	this->buf6c = alloca(sizeof (struct in6_addr));
53*4291Sbrendan 	this->buf6d = alloca(sizeof (struct in6_addr));
54*4291Sbrendan 	this->buf6e = alloca(sizeof (struct in6_addr));
55*4291Sbrendan 	this->buf6f = alloca(sizeof (struct in6_addr));
56*4291Sbrendan 	this->buf6g = alloca(sizeof (struct in6_addr));
57*4291Sbrendan 	this->buf6h = alloca(sizeof (struct in6_addr));
58*4291Sbrendan 	ip4a = this->buf4a;
59*4291Sbrendan 	ip4b = this->buf4b;
60*4291Sbrendan 	ip4c = this->buf4c;
61*4291Sbrendan 	ip4d = this->buf4d;
62*4291Sbrendan 	ip6a = this->buf6a;
63*4291Sbrendan 	ip6b = this->buf6b;
64*4291Sbrendan 	ip6c = this->buf6c;
65*4291Sbrendan 	ip6d = this->buf6d;
66*4291Sbrendan 	ip6e = this->buf6e;
67*4291Sbrendan 	ip6f = this->buf6f;
68*4291Sbrendan 	ip6g = this->buf6g;
69*4291Sbrendan 	ip6h = this->buf6h;
70*4291Sbrendan 
71*4291Sbrendan 	*ip4a = htonl(0xc0a80117);
72*4291Sbrendan 	*ip4b = htonl(0x7f000001);
73*4291Sbrendan 	*ip4c = htonl(0xffffffff);
74*4291Sbrendan 	*ip4d = htonl(0x00000000);
75*4291Sbrendan 	ip6a->_S6_un._S6_u8[0] = 0xfe;
76*4291Sbrendan 	ip6a->_S6_un._S6_u8[1] = 0x80;
77*4291Sbrendan 	ip6a->_S6_un._S6_u8[8] = 0x02;
78*4291Sbrendan 	ip6a->_S6_un._S6_u8[9] = 0x14;
79*4291Sbrendan 	ip6a->_S6_un._S6_u8[10] = 0x4f;
80*4291Sbrendan 	ip6a->_S6_un._S6_u8[11] = 0xff;
81*4291Sbrendan 	ip6a->_S6_un._S6_u8[12] = 0xfe;
82*4291Sbrendan 	ip6a->_S6_un._S6_u8[13] = 0x0b;
83*4291Sbrendan 	ip6a->_S6_un._S6_u8[14] = 0x76;
84*4291Sbrendan 	ip6a->_S6_un._S6_u8[15] = 0xc8;
85*4291Sbrendan 	ip6b->_S6_un._S6_u8[0] = 0x10;
86*4291Sbrendan 	ip6b->_S6_un._S6_u8[1] = 0x80;
87*4291Sbrendan 	ip6b->_S6_un._S6_u8[10] = 0x08;
88*4291Sbrendan 	ip6b->_S6_un._S6_u8[11] = 0x08;
89*4291Sbrendan 	ip6b->_S6_un._S6_u8[13] = 0x20;
90*4291Sbrendan 	ip6b->_S6_un._S6_u8[13] = 0x0c;
91*4291Sbrendan 	ip6b->_S6_un._S6_u8[14] = 0x41;
92*4291Sbrendan 	ip6b->_S6_un._S6_u8[15] = 0x7a;
93*4291Sbrendan 	ip6c->_S6_un._S6_u8[15] = 0x01;
94*4291Sbrendan 	ip6e->_S6_un._S6_u8[12] = 0x7f;
95*4291Sbrendan 	ip6e->_S6_un._S6_u8[15] = 0x01;
96*4291Sbrendan 	ip6f->_S6_un._S6_u8[10] = 0xff;
97*4291Sbrendan 	ip6f->_S6_un._S6_u8[11] = 0xff;
98*4291Sbrendan 	ip6f->_S6_un._S6_u8[12] = 0x7f;
99*4291Sbrendan 	ip6f->_S6_un._S6_u8[15] = 0x01;
100*4291Sbrendan 	ip6g->_S6_un._S6_u8[10] = 0xff;
101*4291Sbrendan 	ip6g->_S6_un._S6_u8[11] = 0xfe;
102*4291Sbrendan 	ip6g->_S6_un._S6_u8[12] = 0x7f;
103*4291Sbrendan 	ip6g->_S6_un._S6_u8[15] = 0x01;
104*4291Sbrendan 	ip6h->_S6_un._S6_u8[0] = 0xff;
105*4291Sbrendan 	ip6h->_S6_un._S6_u8[1] = 0xff;
106*4291Sbrendan 	ip6h->_S6_un._S6_u8[2] = 0xff;
107*4291Sbrendan 	ip6h->_S6_un._S6_u8[3] = 0xff;
108*4291Sbrendan 	ip6h->_S6_un._S6_u8[4] = 0xff;
109*4291Sbrendan 	ip6h->_S6_un._S6_u8[5] = 0xff;
110*4291Sbrendan 	ip6h->_S6_un._S6_u8[6] = 0xff;
111*4291Sbrendan 	ip6h->_S6_un._S6_u8[7] = 0xff;
112*4291Sbrendan 	ip6h->_S6_un._S6_u8[8] = 0xff;
113*4291Sbrendan 	ip6h->_S6_un._S6_u8[9] = 0xff;
114*4291Sbrendan 	ip6h->_S6_un._S6_u8[10] = 0xff;
115*4291Sbrendan 	ip6h->_S6_un._S6_u8[11] = 0xff;
116*4291Sbrendan 	ip6h->_S6_un._S6_u8[12] = 0xff;
117*4291Sbrendan 	ip6h->_S6_un._S6_u8[13] = 0xff;
118*4291Sbrendan 	ip6h->_S6_un._S6_u8[14] = 0xff;
119*4291Sbrendan 	ip6h->_S6_un._S6_u8[15] = 0xff;
120*4291Sbrendan 
121*4291Sbrendan 	printf("%s\n", inet_ntop(AF_INET, ip4a));
122*4291Sbrendan 	printf("%s\n", inet_ntop(AF_INET, ip4b));
123*4291Sbrendan 	printf("%s\n", inet_ntop(AF_INET, ip4c));
124*4291Sbrendan 	printf("%s\n", inet_ntop(AF_INET, ip4d));
125*4291Sbrendan 	printf("%s\n", inet_ntop(AF_INET6, ip6a));
126*4291Sbrendan 	printf("%s\n", inet_ntop(AF_INET6, ip6b));
127*4291Sbrendan 	printf("%s\n", inet_ntop(AF_INET6, ip6c));
128*4291Sbrendan 	printf("%s\n", inet_ntop(AF_INET6, ip6d));
129*4291Sbrendan 	printf("%s\n", inet_ntop(AF_INET6, ip6e));
130*4291Sbrendan 	printf("%s\n", inet_ntop(AF_INET6, ip6f));
131*4291Sbrendan 	printf("%s\n", inet_ntop(AF_INET6, ip6g));
132*4291Sbrendan 	printf("%s\n", inet_ntop(AF_INET6, ip6h));
133*4291Sbrendan 
134*4291Sbrendan 	exit(0);
135*4291Sbrendan }
136