]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.inet_ntop.d
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / cddl / contrib / opensolaris / cmd / dtrace / test / tst / common / funcs / tst.inet_ntop.d
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 inline int AF_INET = 2;
32 inline int AF_INET6 = 28;
33
34 in_addr_t *ip4a;
35 in_addr_t *ip4b;
36 in_addr_t *ip4c;
37 in_addr_t *ip4d;
38 struct in6_addr *ip6a;
39 struct in6_addr *ip6b;
40 struct in6_addr *ip6c;
41 struct in6_addr *ip6d;
42 struct in6_addr *ip6e;
43 struct in6_addr *ip6f;
44 struct in6_addr *ip6g;
45 struct in6_addr *ip6h;
46
47 BEGIN
48 {
49         this->buf4a = alloca(sizeof (in_addr_t));
50         this->buf4b = alloca(sizeof (in_addr_t));
51         this->buf4c = alloca(sizeof (in_addr_t));
52         this->buf4d = alloca(sizeof (in_addr_t));
53         this->buf6a = alloca(sizeof (struct in6_addr));
54         this->buf6b = alloca(sizeof (struct in6_addr));
55         this->buf6c = alloca(sizeof (struct in6_addr));
56         this->buf6d = alloca(sizeof (struct in6_addr));
57         this->buf6e = alloca(sizeof (struct in6_addr));
58         this->buf6f = alloca(sizeof (struct in6_addr));
59         this->buf6g = alloca(sizeof (struct in6_addr));
60         this->buf6h = alloca(sizeof (struct in6_addr));
61         ip4a = this->buf4a;
62         ip4b = this->buf4b;
63         ip4c = this->buf4c;
64         ip4d = this->buf4d;
65         ip6a = this->buf6a;
66         ip6b = this->buf6b;
67         ip6c = this->buf6c;
68         ip6d = this->buf6d;
69         ip6e = this->buf6e;
70         ip6f = this->buf6f;
71         ip6g = this->buf6g;
72         ip6h = this->buf6h;
73
74         *ip4a = htonl(0xc0a80117);
75         *ip4b = htonl(0x7f000001);
76         *ip4c = htonl(0xffffffff);
77         *ip4d = htonl(0x00000000);
78         ip6a->__u6_addr.__u6_addr8[0] = 0xfe;
79         ip6a->__u6_addr.__u6_addr8[1] = 0x80;
80         ip6a->__u6_addr.__u6_addr8[8] = 0x02;
81         ip6a->__u6_addr.__u6_addr8[9] = 0x14;
82         ip6a->__u6_addr.__u6_addr8[10] = 0x4f;
83         ip6a->__u6_addr.__u6_addr8[11] = 0xff;
84         ip6a->__u6_addr.__u6_addr8[12] = 0xfe;
85         ip6a->__u6_addr.__u6_addr8[13] = 0x0b;
86         ip6a->__u6_addr.__u6_addr8[14] = 0x76;
87         ip6a->__u6_addr.__u6_addr8[15] = 0xc8;
88         ip6b->__u6_addr.__u6_addr8[0] = 0x10;
89         ip6b->__u6_addr.__u6_addr8[1] = 0x80;
90         ip6b->__u6_addr.__u6_addr8[10] = 0x08;
91         ip6b->__u6_addr.__u6_addr8[11] = 0x08;
92         ip6b->__u6_addr.__u6_addr8[13] = 0x20;
93         ip6b->__u6_addr.__u6_addr8[13] = 0x0c;
94         ip6b->__u6_addr.__u6_addr8[14] = 0x41;
95         ip6b->__u6_addr.__u6_addr8[15] = 0x7a;
96         ip6c->__u6_addr.__u6_addr8[15] = 0x01;
97         ip6e->__u6_addr.__u6_addr8[12] = 0x7f;
98         ip6e->__u6_addr.__u6_addr8[15] = 0x01;
99         ip6f->__u6_addr.__u6_addr8[10] = 0xff;
100         ip6f->__u6_addr.__u6_addr8[11] = 0xff;
101         ip6f->__u6_addr.__u6_addr8[12] = 0x7f;
102         ip6f->__u6_addr.__u6_addr8[15] = 0x01;
103         ip6g->__u6_addr.__u6_addr8[10] = 0xff;
104         ip6g->__u6_addr.__u6_addr8[11] = 0xfe;
105         ip6g->__u6_addr.__u6_addr8[12] = 0x7f;
106         ip6g->__u6_addr.__u6_addr8[15] = 0x01;
107         ip6h->__u6_addr.__u6_addr8[0] = 0xff;
108         ip6h->__u6_addr.__u6_addr8[1] = 0xff;
109         ip6h->__u6_addr.__u6_addr8[2] = 0xff;
110         ip6h->__u6_addr.__u6_addr8[3] = 0xff;
111         ip6h->__u6_addr.__u6_addr8[4] = 0xff;
112         ip6h->__u6_addr.__u6_addr8[5] = 0xff;
113         ip6h->__u6_addr.__u6_addr8[6] = 0xff;
114         ip6h->__u6_addr.__u6_addr8[7] = 0xff;
115         ip6h->__u6_addr.__u6_addr8[8] = 0xff;
116         ip6h->__u6_addr.__u6_addr8[9] = 0xff;
117         ip6h->__u6_addr.__u6_addr8[10] = 0xff;
118         ip6h->__u6_addr.__u6_addr8[11] = 0xff;
119         ip6h->__u6_addr.__u6_addr8[12] = 0xff;
120         ip6h->__u6_addr.__u6_addr8[13] = 0xff;
121         ip6h->__u6_addr.__u6_addr8[14] = 0xff;
122         ip6h->__u6_addr.__u6_addr8[15] = 0xff;
123
124         printf("%s\n", inet_ntop(AF_INET, ip4a));
125         printf("%s\n", inet_ntop(AF_INET, ip4b));
126         printf("%s\n", inet_ntop(AF_INET, ip4c));
127         printf("%s\n", inet_ntop(AF_INET, ip4d));
128         printf("%s\n", inet_ntop(AF_INET6, ip6a));
129         printf("%s\n", inet_ntop(AF_INET6, ip6b));
130         printf("%s\n", inet_ntop(AF_INET6, ip6c));
131         printf("%s\n", inet_ntop(AF_INET6, ip6d));
132         printf("%s\n", inet_ntop(AF_INET6, ip6e));
133         printf("%s\n", inet_ntop(AF_INET6, ip6f));
134         printf("%s\n", inet_ntop(AF_INET6, ip6g));
135         printf("%s\n", inet_ntop(AF_INET6, ip6h));
136
137         exit(0);
138 }