tst.inet_ntop.d revision 4edabff493bc4820f4297f981943f11de1cbf3be
c869993e79c1eafbec61a56bf6cea848fe754c71xy/*
c869993e79c1eafbec61a56bf6cea848fe754c71xy * CDDL HEADER START
c869993e79c1eafbec61a56bf6cea848fe754c71xy *
c869993e79c1eafbec61a56bf6cea848fe754c71xy * The contents of this file are subject to the terms of the
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Common Development and Distribution License (the "License").
c869993e79c1eafbec61a56bf6cea848fe754c71xy * You may not use this file except in compliance with the License.
c869993e79c1eafbec61a56bf6cea848fe754c71xy *
c869993e79c1eafbec61a56bf6cea848fe754c71xy * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
c869993e79c1eafbec61a56bf6cea848fe754c71xy * or http://www.opensolaris.org/os/licensing.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * See the License for the specific language governing permissions
c869993e79c1eafbec61a56bf6cea848fe754c71xy * and limitations under the License.
c869993e79c1eafbec61a56bf6cea848fe754c71xy *
c869993e79c1eafbec61a56bf6cea848fe754c71xy * When distributing Covered Code, include this CDDL HEADER in each
c869993e79c1eafbec61a56bf6cea848fe754c71xy * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * If applicable, add the following below this CDDL HEADER, with the
c869993e79c1eafbec61a56bf6cea848fe754c71xy * fields enclosed by brackets "[]" replaced with your own identifying
c869993e79c1eafbec61a56bf6cea848fe754c71xy * information: Portions Copyright [yyyy] [name of copyright owner]
c869993e79c1eafbec61a56bf6cea848fe754c71xy *
c869993e79c1eafbec61a56bf6cea848fe754c71xy * CDDL HEADER END
c869993e79c1eafbec61a56bf6cea848fe754c71xy */
c869993e79c1eafbec61a56bf6cea848fe754c71xy
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China/*
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Use is subject to license terms.
c869993e79c1eafbec61a56bf6cea848fe754c71xy */
c869993e79c1eafbec61a56bf6cea848fe754c71xy
c869993e79c1eafbec61a56bf6cea848fe754c71xy#pragma ident "%Z%%M% %I% %E% SMI"
c869993e79c1eafbec61a56bf6cea848fe754c71xy
c869993e79c1eafbec61a56bf6cea848fe754c71xy#pragma D option quiet
fa25784ca4b51c206177d891a654f1d36a25d41fxy
c869993e79c1eafbec61a56bf6cea848fe754c71xyipaddr_t *ip4a;
c869993e79c1eafbec61a56bf6cea848fe754c71xyipaddr_t *ip4b;
c869993e79c1eafbec61a56bf6cea848fe754c71xyipaddr_t *ip4c;
c869993e79c1eafbec61a56bf6cea848fe754c71xyipaddr_t *ip4d;
c869993e79c1eafbec61a56bf6cea848fe754c71xystruct in6_addr *ip6a;
c869993e79c1eafbec61a56bf6cea848fe754c71xystruct in6_addr *ip6b;
c869993e79c1eafbec61a56bf6cea848fe754c71xystruct in6_addr *ip6c;
c869993e79c1eafbec61a56bf6cea848fe754c71xystruct in6_addr *ip6d;
c869993e79c1eafbec61a56bf6cea848fe754c71xystruct in6_addr *ip6e;
c869993e79c1eafbec61a56bf6cea848fe754c71xystruct in6_addr *ip6f;
c869993e79c1eafbec61a56bf6cea848fe754c71xystruct in6_addr *ip6g;
c869993e79c1eafbec61a56bf6cea848fe754c71xystruct in6_addr *ip6h;
75eba5b6d79ed4d2ce3daf7b2806306b6b69a938Robert Mustacchi
c869993e79c1eafbec61a56bf6cea848fe754c71xyBEGIN
c869993e79c1eafbec61a56bf6cea848fe754c71xy{
c869993e79c1eafbec61a56bf6cea848fe754c71xy this->buf4a = alloca(sizeof (ipaddr_t));
c869993e79c1eafbec61a56bf6cea848fe754c71xy this->buf4b = alloca(sizeof (ipaddr_t));
c869993e79c1eafbec61a56bf6cea848fe754c71xy this->buf4c = alloca(sizeof (ipaddr_t));
c869993e79c1eafbec61a56bf6cea848fe754c71xy this->buf4d = alloca(sizeof (ipaddr_t));
c869993e79c1eafbec61a56bf6cea848fe754c71xy this->buf6a = alloca(sizeof (struct in6_addr));
c869993e79c1eafbec61a56bf6cea848fe754c71xy this->buf6b = alloca(sizeof (struct in6_addr));
c869993e79c1eafbec61a56bf6cea848fe754c71xy this->buf6c = alloca(sizeof (struct in6_addr));
75eba5b6d79ed4d2ce3daf7b2806306b6b69a938Robert Mustacchi this->buf6d = alloca(sizeof (struct in6_addr));
75eba5b6d79ed4d2ce3daf7b2806306b6b69a938Robert Mustacchi this->buf6e = alloca(sizeof (struct in6_addr));
75eba5b6d79ed4d2ce3daf7b2806306b6b69a938Robert Mustacchi this->buf6f = alloca(sizeof (struct in6_addr));
75eba5b6d79ed4d2ce3daf7b2806306b6b69a938Robert Mustacchi this->buf6g = alloca(sizeof (struct in6_addr));
7014882c6a3672fd0e5d60200af8643ae53c5928Richard Lowe this->buf6h = alloca(sizeof (struct in6_addr));
7014882c6a3672fd0e5d60200af8643ae53c5928Richard Lowe ip4a = this->buf4a;
75eba5b6d79ed4d2ce3daf7b2806306b6b69a938Robert Mustacchi ip4b = this->buf4b;
7014882c6a3672fd0e5d60200af8643ae53c5928Richard Lowe ip4c = this->buf4c;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip4d = this->buf4d;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6a = this->buf6a;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6b = this->buf6b;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6c = this->buf6c;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6d = this->buf6d;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6e = this->buf6e;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6f = this->buf6f;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6g = this->buf6g;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6h = this->buf6h;
c869993e79c1eafbec61a56bf6cea848fe754c71xy
75eba5b6d79ed4d2ce3daf7b2806306b6b69a938Robert Mustacchi *ip4a = htonl(0xc0a80117);
c869993e79c1eafbec61a56bf6cea848fe754c71xy *ip4b = htonl(0x7f000001);
c869993e79c1eafbec61a56bf6cea848fe754c71xy *ip4c = htonl(0xffffffff);
c869993e79c1eafbec61a56bf6cea848fe754c71xy *ip4d = htonl(0x00000000);
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6a->_S6_un._S6_u8[0] = 0xfe;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6a->_S6_un._S6_u8[1] = 0x80;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6a->_S6_un._S6_u8[8] = 0x02;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6a->_S6_un._S6_u8[9] = 0x14;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6a->_S6_un._S6_u8[10] = 0x4f;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6a->_S6_un._S6_u8[11] = 0xff;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6a->_S6_un._S6_u8[12] = 0xfe;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6a->_S6_un._S6_u8[13] = 0x0b;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6a->_S6_un._S6_u8[14] = 0x76;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China ip6a->_S6_un._S6_u8[15] = 0xc8;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6b->_S6_un._S6_u8[0] = 0x10;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China ip6b->_S6_un._S6_u8[1] = 0x80;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6b->_S6_un._S6_u8[10] = 0x08;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6b->_S6_un._S6_u8[11] = 0x08;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6b->_S6_un._S6_u8[13] = 0x20;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6b->_S6_un._S6_u8[13] = 0x0c;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6b->_S6_un._S6_u8[14] = 0x41;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6b->_S6_un._S6_u8[15] = 0x7a;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6c->_S6_un._S6_u8[15] = 0x01;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6e->_S6_un._S6_u8[12] = 0x7f;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6e->_S6_un._S6_u8[15] = 0x01;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6f->_S6_un._S6_u8[10] = 0xff;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6f->_S6_un._S6_u8[11] = 0xff;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6f->_S6_un._S6_u8[12] = 0x7f;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6f->_S6_un._S6_u8[15] = 0x01;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6g->_S6_un._S6_u8[10] = 0xff;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6g->_S6_un._S6_u8[11] = 0xfe;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6g->_S6_un._S6_u8[12] = 0x7f;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6g->_S6_un._S6_u8[15] = 0x01;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6h->_S6_un._S6_u8[0] = 0xff;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6h->_S6_un._S6_u8[1] = 0xff;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6h->_S6_un._S6_u8[2] = 0xff;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6h->_S6_un._S6_u8[3] = 0xff;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6h->_S6_un._S6_u8[4] = 0xff;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6h->_S6_un._S6_u8[5] = 0xff;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6h->_S6_un._S6_u8[6] = 0xff;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6h->_S6_un._S6_u8[7] = 0xff;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6h->_S6_un._S6_u8[8] = 0xff;
c869993e79c1eafbec61a56bf6cea848fe754c71xy ip6h->_S6_un._S6_u8[9] = 0xff;
ip6h->_S6_un._S6_u8[10] = 0xff;
ip6h->_S6_un._S6_u8[11] = 0xff;
ip6h->_S6_un._S6_u8[12] = 0xff;
ip6h->_S6_un._S6_u8[13] = 0xff;
ip6h->_S6_un._S6_u8[14] = 0xff;
ip6h->_S6_un._S6_u8[15] = 0xff;
printf("%s\n", inet_ntop(AF_INET, ip4a));
printf("%s\n", inet_ntop(AF_INET, ip4b));
printf("%s\n", inet_ntop(AF_INET, ip4c));
printf("%s\n", inet_ntop(AF_INET, ip4d));
printf("%s\n", inet_ntop(AF_INET6, ip6a));
printf("%s\n", inet_ntop(AF_INET6, ip6b));
printf("%s\n", inet_ntop(AF_INET6, ip6c));
printf("%s\n", inet_ntop(AF_INET6, ip6d));
printf("%s\n", inet_ntop(AF_INET6, ip6e));
printf("%s\n", inet_ntop(AF_INET6, ip6f));
printf("%s\n", inet_ntop(AF_INET6, ip6g));
printf("%s\n", inet_ntop(AF_INET6, ip6h));
exit(0);
}