xref: /titanic_41/usr/src/cmd/dtrace/test/tst/common/funcs/tst.inet_ntop.d (revision 4edabff493bc4820f4297f981943f11de1cbf3be)
1 /*
2  * CDDL HEADER START
3  *
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.
7  *
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.
12  *
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]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 #pragma D option quiet
30 
31 ipaddr_t *ip4a;
32 ipaddr_t *ip4b;
33 ipaddr_t *ip4c;
34 ipaddr_t *ip4d;
35 struct in6_addr *ip6a;
36 struct in6_addr *ip6b;
37 struct in6_addr *ip6c;
38 struct in6_addr *ip6d;
39 struct in6_addr *ip6e;
40 struct in6_addr *ip6f;
41 struct in6_addr *ip6g;
42 struct in6_addr *ip6h;
43 
44 BEGIN
45 {
46 	this->buf4a = alloca(sizeof (ipaddr_t));
47 	this->buf4b = alloca(sizeof (ipaddr_t));
48 	this->buf4c = alloca(sizeof (ipaddr_t));
49 	this->buf4d = alloca(sizeof (ipaddr_t));
50 	this->buf6a = alloca(sizeof (struct in6_addr));
51 	this->buf6b = alloca(sizeof (struct in6_addr));
52 	this->buf6c = alloca(sizeof (struct in6_addr));
53 	this->buf6d = alloca(sizeof (struct in6_addr));
54 	this->buf6e = alloca(sizeof (struct in6_addr));
55 	this->buf6f = alloca(sizeof (struct in6_addr));
56 	this->buf6g = alloca(sizeof (struct in6_addr));
57 	this->buf6h = alloca(sizeof (struct in6_addr));
58 	ip4a = this->buf4a;
59 	ip4b = this->buf4b;
60 	ip4c = this->buf4c;
61 	ip4d = this->buf4d;
62 	ip6a = this->buf6a;
63 	ip6b = this->buf6b;
64 	ip6c = this->buf6c;
65 	ip6d = this->buf6d;
66 	ip6e = this->buf6e;
67 	ip6f = this->buf6f;
68 	ip6g = this->buf6g;
69 	ip6h = this->buf6h;
70 
71 	*ip4a = htonl(0xc0a80117);
72 	*ip4b = htonl(0x7f000001);
73 	*ip4c = htonl(0xffffffff);
74 	*ip4d = htonl(0x00000000);
75 	ip6a->_S6_un._S6_u8[0] = 0xfe;
76 	ip6a->_S6_un._S6_u8[1] = 0x80;
77 	ip6a->_S6_un._S6_u8[8] = 0x02;
78 	ip6a->_S6_un._S6_u8[9] = 0x14;
79 	ip6a->_S6_un._S6_u8[10] = 0x4f;
80 	ip6a->_S6_un._S6_u8[11] = 0xff;
81 	ip6a->_S6_un._S6_u8[12] = 0xfe;
82 	ip6a->_S6_un._S6_u8[13] = 0x0b;
83 	ip6a->_S6_un._S6_u8[14] = 0x76;
84 	ip6a->_S6_un._S6_u8[15] = 0xc8;
85 	ip6b->_S6_un._S6_u8[0] = 0x10;
86 	ip6b->_S6_un._S6_u8[1] = 0x80;
87 	ip6b->_S6_un._S6_u8[10] = 0x08;
88 	ip6b->_S6_un._S6_u8[11] = 0x08;
89 	ip6b->_S6_un._S6_u8[13] = 0x20;
90 	ip6b->_S6_un._S6_u8[13] = 0x0c;
91 	ip6b->_S6_un._S6_u8[14] = 0x41;
92 	ip6b->_S6_un._S6_u8[15] = 0x7a;
93 	ip6c->_S6_un._S6_u8[15] = 0x01;
94 	ip6e->_S6_un._S6_u8[12] = 0x7f;
95 	ip6e->_S6_un._S6_u8[15] = 0x01;
96 	ip6f->_S6_un._S6_u8[10] = 0xff;
97 	ip6f->_S6_un._S6_u8[11] = 0xff;
98 	ip6f->_S6_un._S6_u8[12] = 0x7f;
99 	ip6f->_S6_un._S6_u8[15] = 0x01;
100 	ip6g->_S6_un._S6_u8[10] = 0xff;
101 	ip6g->_S6_un._S6_u8[11] = 0xfe;
102 	ip6g->_S6_un._S6_u8[12] = 0x7f;
103 	ip6g->_S6_un._S6_u8[15] = 0x01;
104 	ip6h->_S6_un._S6_u8[0] = 0xff;
105 	ip6h->_S6_un._S6_u8[1] = 0xff;
106 	ip6h->_S6_un._S6_u8[2] = 0xff;
107 	ip6h->_S6_un._S6_u8[3] = 0xff;
108 	ip6h->_S6_un._S6_u8[4] = 0xff;
109 	ip6h->_S6_un._S6_u8[5] = 0xff;
110 	ip6h->_S6_un._S6_u8[6] = 0xff;
111 	ip6h->_S6_un._S6_u8[7] = 0xff;
112 	ip6h->_S6_un._S6_u8[8] = 0xff;
113 	ip6h->_S6_un._S6_u8[9] = 0xff;
114 	ip6h->_S6_un._S6_u8[10] = 0xff;
115 	ip6h->_S6_un._S6_u8[11] = 0xff;
116 	ip6h->_S6_un._S6_u8[12] = 0xff;
117 	ip6h->_S6_un._S6_u8[13] = 0xff;
118 	ip6h->_S6_un._S6_u8[14] = 0xff;
119 	ip6h->_S6_un._S6_u8[15] = 0xff;
120 
121 	printf("%s\n", inet_ntop(AF_INET, ip4a));
122 	printf("%s\n", inet_ntop(AF_INET, ip4b));
123 	printf("%s\n", inet_ntop(AF_INET, ip4c));
124 	printf("%s\n", inet_ntop(AF_INET, ip4d));
125 	printf("%s\n", inet_ntop(AF_INET6, ip6a));
126 	printf("%s\n", inet_ntop(AF_INET6, ip6b));
127 	printf("%s\n", inet_ntop(AF_INET6, ip6c));
128 	printf("%s\n", inet_ntop(AF_INET6, ip6d));
129 	printf("%s\n", inet_ntop(AF_INET6, ip6e));
130 	printf("%s\n", inet_ntop(AF_INET6, ip6f));
131 	printf("%s\n", inet_ntop(AF_INET6, ip6g));
132 	printf("%s\n", inet_ntop(AF_INET6, ip6h));
133 
134 	exit(0);
135 }
136