1290001Sglebius/* 2290001Sglebius * Copyright (C) 2004, 2005, 2007, 2011, 2012 Internet Systems Consortium, Inc. ("ISC") 3290001Sglebius * Copyright (C) 1999-2002 Internet Software Consortium. 4290001Sglebius * 5290001Sglebius * Permission to use, copy, modify, and/or distribute this software for any 6290001Sglebius * purpose with or without fee is hereby granted, provided that the above 7290001Sglebius * copyright notice and this permission notice appear in all copies. 8290001Sglebius * 9290001Sglebius * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 10290001Sglebius * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 11290001Sglebius * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 12290001Sglebius * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 13290001Sglebius * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 14290001Sglebius * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 15290001Sglebius * PERFORMANCE OF THIS SOFTWARE. 16290001Sglebius */ 17290001Sglebius 18290001Sglebius/* $Id$ */ 19290001Sglebius 20290001Sglebius#ifndef ISC_IPV6_H 21290001Sglebius#define ISC_IPV6_H 1 22290001Sglebius 23290001Sglebius/***** 24290001Sglebius ***** Module Info 25290001Sglebius *****/ 26290001Sglebius 27290001Sglebius/* 28290001Sglebius * IPv6 definitions for systems which do not support IPv6. 29290001Sglebius * 30290001Sglebius * MP: 31290001Sglebius * No impact. 32290001Sglebius * 33290001Sglebius * Reliability: 34290001Sglebius * No anticipated impact. 35290001Sglebius * 36290001Sglebius * Resources: 37290001Sglebius * N/A. 38290001Sglebius * 39290001Sglebius * Security: 40290001Sglebius * No anticipated impact. 41290001Sglebius * 42290001Sglebius * Standards: 43290001Sglebius * RFC2553. 44290001Sglebius */ 45290001Sglebius 46290001Sglebius#if _MSC_VER < 1300 47290001Sglebius#define in6_addr in_addr6 48290001Sglebius#endif 49290001Sglebius 50290001Sglebius#ifndef IN6ADDR_ANY_INIT 51290001Sglebius#define IN6ADDR_ANY_INIT {{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }} 52290001Sglebius#endif 53290001Sglebius#ifndef IN6ADDR_LOOPBACK_INIT 54290001Sglebius#define IN6ADDR_LOOPBACK_INIT {{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }} 55290001Sglebius#endif 56290001Sglebius 57290001SglebiusLIBISC_EXTERNAL_DATA extern const struct in6_addr isc_net_in6addrany; 58290001SglebiusLIBISC_EXTERNAL_DATA extern const struct in6_addr isc_net_in6addrloop; 59290001Sglebius 60290001Sglebius/* 61290001Sglebius * Unspecified 62290001Sglebius */ 63290001Sglebius#ifndef IN6_IS_ADDR_UNSPECIFIED 64290001Sglebius#define IN6_IS_ADDR_UNSPECIFIED(a) (\ 65290001Sglebius*((u_long *)((a)->s6_addr) ) == 0 && \ 66290001Sglebius*((u_long *)((a)->s6_addr) + 1) == 0 && \ 67290001Sglebius*((u_long *)((a)->s6_addr) + 2) == 0 && \ 68290001Sglebius*((u_long *)((a)->s6_addr) + 3) == 0 \ 69290001Sglebius) 70290001Sglebius#endif 71290001Sglebius 72290001Sglebius/* 73290001Sglebius * Loopback 74290001Sglebius */ 75290001Sglebius#ifndef IN6_IS_ADDR_LOOPBACK 76290001Sglebius#define IN6_IS_ADDR_LOOPBACK(a) (\ 77290001Sglebius*((u_long *)((a)->s6_addr) ) == 0 && \ 78290001Sglebius*((u_long *)((a)->s6_addr) + 1) == 0 && \ 79290001Sglebius*((u_long *)((a)->s6_addr) + 2) == 0 && \ 80290001Sglebius*((u_long *)((a)->s6_addr) + 3) == htonl(1) \ 81290001Sglebius) 82290001Sglebius#endif 83290001Sglebius 84290001Sglebius/* 85290001Sglebius * IPv4 compatible 86290001Sglebius */ 87290001Sglebius#define IN6_IS_ADDR_V4COMPAT(a) (\ 88290001Sglebius*((u_long *)((a)->s6_addr) ) == 0 && \ 89290001Sglebius*((u_long *)((a)->s6_addr) + 1) == 0 && \ 90290001Sglebius*((u_long *)((a)->s6_addr) + 2) == 0 && \ 91290001Sglebius*((u_long *)((a)->s6_addr) + 3) != 0 && \ 92290001Sglebius*((u_long *)((a)->s6_addr) + 3) != htonl(1) \ 93290001Sglebius) 94290001Sglebius 95290001Sglebius/* 96290001Sglebius * Mapped 97290001Sglebius */ 98290001Sglebius#define IN6_IS_ADDR_V4MAPPED(a) (\ 99290001Sglebius*((u_long *)((a)->s6_addr) ) == 0 && \ 100290001Sglebius*((u_long *)((a)->s6_addr) + 1) == 0 && \ 101290001Sglebius*((u_long *)((a)->s6_addr) + 2) == htonl(0x0000ffff)) 102290001Sglebius 103290001Sglebius/* 104290001Sglebius * Multicast 105290001Sglebius */ 106290001Sglebius#define IN6_IS_ADDR_MULTICAST(a) \ 107290001Sglebius ((a)->s6_addr[0] == 0xffU) 108290001Sglebius 109290001Sglebius/* 110290001Sglebius * Unicast link / site local. 111290001Sglebius */ 112290001Sglebius#ifndef IN6_IS_ADDR_LINKLOCAL 113290001Sglebius#define IN6_IS_ADDR_LINKLOCAL(a) (\ 114290001Sglebius ((a)->s6_addr[0] == 0xfe) && \ 115290001Sglebius (((a)->s6_addr[1] & 0xc0) == 0x80)) 116290001Sglebius#endif 117290001Sglebius 118290001Sglebius#ifndef IN6_IS_ADDR_SITELOCAL 119290001Sglebius#define IN6_IS_ADDR_SITELOCAL(a) (\ 120290001Sglebius ((a)->s6_addr[0] == 0xfe) && \ 121290001Sglebius (((a)->s6_addr[1] & 0xc0) == 0xc0)) 122290001Sglebius#endif 123290001Sglebius 124290001Sglebius#endif /* ISC_IPV6_H */ 125