Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ip6_addr.h Source File

ip6_addr.h

Go to the documentation of this file.
00001 /**
00002  * @file
00003  *
00004  * IPv6 addresses.
00005  */
00006 
00007 /*
00008  * Copyright (c) 2010 Inico Technologies Ltd.
00009  * All rights reserved.
00010  *
00011  * Redistribution and use in source and binary forms, with or without modification,
00012  * are permitted provided that the following conditions are met:
00013  *
00014  * 1. Redistributions of source code must retain the above copyright notice,
00015  *    this list of conditions and the following disclaimer.
00016  * 2. Redistributions in binary form must reproduce the above copyright notice,
00017  *    this list of conditions and the following disclaimer in the documentation
00018  *    and/or other materials provided with the distribution.
00019  * 3. The name of the author may not be used to endorse or promote products
00020  *    derived from this software without specific prior written permission.
00021  *
00022  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
00023  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00024  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
00025  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00026  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
00027  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00028  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00029  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
00030  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
00031  * OF SUCH DAMAGE.
00032  *
00033  * This file is part of the lwIP TCP/IP stack.
00034  *
00035  * Author: Ivan Delamer <delamer@inicotech.com>
00036  *
00037  * Structs and macros for handling IPv6 addresses.
00038  *
00039  * Please coordinate changes and requests with Ivan Delamer
00040  * <delamer@inicotech.com>
00041  */
00042 #ifndef LWIP_HDR_IP6_ADDR_H
00043 #define LWIP_HDR_IP6_ADDR_H
00044 
00045 #include "lwip/opt.h"
00046 #include "def.h"
00047 
00048 #if LWIP_IPV6  /* don't build if not configured for use in lwipopts.h */
00049 
00050 #include "lwip/ip6_zone.h"
00051 
00052 #ifdef __cplusplus
00053 extern "C" {
00054 #endif
00055 
00056 
00057 /** This is the aligned version of ip6_addr_t,
00058     used as local variable, on the stack, etc. */
00059 struct ip6_addr {
00060   u32_t addr[4];
00061 #if LWIP_IPV6_SCOPES
00062   u8_t zone;
00063 #endif /* LWIP_IPV6_SCOPES */
00064 };
00065 
00066 /** IPv6 address */
00067 typedef struct ip6_addr ip6_addr_t;
00068 
00069 /** Set an IPv6 partial address given by byte-parts */
00070 #define IP6_ADDR_PART(ip6addr, index, a,b,c,d) \
00071   (ip6addr)->addr[index] = PP_HTONL(LWIP_MAKEU32(a,b,c,d))
00072 
00073 /** Set a full IPv6 address by passing the 4 u32_t indices in network byte order
00074     (use PP_HTONL() for constants) */
00075 #define IP6_ADDR(ip6addr, idx0, idx1, idx2, idx3) do { \
00076   (ip6addr)->addr[0] = idx0; \
00077   (ip6addr)->addr[1] = idx1; \
00078   (ip6addr)->addr[2] = idx2; \
00079   (ip6addr)->addr[3] = idx3; \
00080   ip6_addr_clear_zone(ip6addr); } while(0)
00081 
00082 /** Access address in 16-bit block */
00083 #define IP6_ADDR_BLOCK1(ip6addr) ((u16_t)((lwip_htonl((ip6addr)->addr[0]) >> 16) & 0xffff))
00084 /** Access address in 16-bit block */
00085 #define IP6_ADDR_BLOCK2(ip6addr) ((u16_t)((lwip_htonl((ip6addr)->addr[0])) & 0xffff))
00086 /** Access address in 16-bit block */
00087 #define IP6_ADDR_BLOCK3(ip6addr) ((u16_t)((lwip_htonl((ip6addr)->addr[1]) >> 16) & 0xffff))
00088 /** Access address in 16-bit block */
00089 #define IP6_ADDR_BLOCK4(ip6addr) ((u16_t)((lwip_htonl((ip6addr)->addr[1])) & 0xffff))
00090 /** Access address in 16-bit block */
00091 #define IP6_ADDR_BLOCK5(ip6addr) ((u16_t)((lwip_htonl((ip6addr)->addr[2]) >> 16) & 0xffff))
00092 /** Access address in 16-bit block */
00093 #define IP6_ADDR_BLOCK6(ip6addr) ((u16_t)((lwip_htonl((ip6addr)->addr[2])) & 0xffff))
00094 /** Access address in 16-bit block */
00095 #define IP6_ADDR_BLOCK7(ip6addr) ((u16_t)((lwip_htonl((ip6addr)->addr[3]) >> 16) & 0xffff))
00096 /** Access address in 16-bit block */
00097 #define IP6_ADDR_BLOCK8(ip6addr) ((u16_t)((lwip_htonl((ip6addr)->addr[3])) & 0xffff))
00098 
00099 /** Copy IPv6 address - faster than ip6_addr_set: no NULL check */
00100 #define ip6_addr_copy(dest, src) do{(dest).addr[0] = (src).addr[0]; \
00101                                     (dest).addr[1] = (src).addr[1]; \
00102                                     (dest).addr[2] = (src).addr[2]; \
00103                                     (dest).addr[3] = (src).addr[3]; \
00104                                     ip6_addr_copy_zone((dest), (src)); }while(0)
00105 /** Safely copy one IPv6 address to another (src may be NULL) */
00106 #define ip6_addr_set(dest, src) do{(dest)->addr[0] = (src) == NULL ? 0 : (src)->addr[0]; \
00107                                    (dest)->addr[1] = (src) == NULL ? 0 : (src)->addr[1]; \
00108                                    (dest)->addr[2] = (src) == NULL ? 0 : (src)->addr[2]; \
00109                                    (dest)->addr[3] = (src) == NULL ? 0 : (src)->addr[3]; \
00110                                    ip6_addr_set_zone((dest), (src) == NULL ? IP6_NO_ZONE : ip6_addr_zone(src)); }while(0)
00111 
00112 /** Copy packed IPv6 address to unpacked IPv6 address; zone is not set */
00113 #define ip6_addr_copy_from_packed(dest, src) do{(dest).addr[0] = (src).addr[0]; \
00114                                     (dest).addr[1] = (src).addr[1]; \
00115                                     (dest).addr[2] = (src).addr[2]; \
00116                                     (dest).addr[3] = (src).addr[3]; \
00117                                     ip6_addr_clear_zone(&dest); }while(0)
00118 
00119 /** Copy unpacked IPv6 address to packed IPv6 address; zone is lost */
00120 #define ip6_addr_copy_to_packed(dest, src) do{(dest).addr[0] = (src).addr[0]; \
00121                                     (dest).addr[1] = (src).addr[1]; \
00122                                     (dest).addr[2] = (src).addr[2]; \
00123                                     (dest).addr[3] = (src).addr[3]; }while(0)
00124 
00125 /** Set complete address to zero */
00126 #define ip6_addr_set_zero(ip6addr)    do{(ip6addr)->addr[0] = 0; \
00127                                          (ip6addr)->addr[1] = 0; \
00128                                          (ip6addr)->addr[2] = 0; \
00129                                          (ip6addr)->addr[3] = 0; \
00130                                          ip6_addr_clear_zone(ip6addr);}while(0)
00131 
00132 /** Set address to ipv6 'any' (no need for lwip_htonl()) */
00133 #define ip6_addr_set_any(ip6addr)       ip6_addr_set_zero(ip6addr)
00134 /** Set address to ipv6 loopback address */
00135 #define ip6_addr_set_loopback(ip6addr) do{(ip6addr)->addr[0] = 0; \
00136                                           (ip6addr)->addr[1] = 0; \
00137                                           (ip6addr)->addr[2] = 0; \
00138                                           (ip6addr)->addr[3] = PP_HTONL(0x00000001UL); \
00139                                           ip6_addr_clear_zone(ip6addr);}while(0)
00140 /** Safely copy one IPv6 address to another and change byte order
00141  * from host- to network-order. */
00142 #define ip6_addr_set_hton(dest, src) do{(dest)->addr[0] = (src) == NULL ? 0 : lwip_htonl((src)->addr[0]); \
00143                                         (dest)->addr[1] = (src) == NULL ? 0 : lwip_htonl((src)->addr[1]); \
00144                                         (dest)->addr[2] = (src) == NULL ? 0 : lwip_htonl((src)->addr[2]); \
00145                                         (dest)->addr[3] = (src) == NULL ? 0 : lwip_htonl((src)->addr[3]); \
00146                                         ip6_addr_set_zone((dest), (src) == NULL ? IP6_NO_ZONE : ip6_addr_zone(src));}while(0)
00147 
00148 
00149 /** Compare IPv6 networks, ignoring zone information. To be used sparingly! */
00150 #define ip6_addr_netcmp_zoneless(addr1, addr2) (((addr1)->addr[0] == (addr2)->addr[0]) && \
00151                                                ((addr1)->addr[1] == (addr2)->addr[1]))
00152 
00153 /**
00154  * Determine if two IPv6 address are on the same network.
00155  *
00156  * @param addr1 IPv6 address 1
00157  * @param addr2 IPv6 address 2
00158  * @return 1 if the network identifiers of both address match, 0 if not
00159  */
00160 #define ip6_addr_netcmp(addr1, addr2) (ip6_addr_netcmp_zoneless((addr1), (addr2)) && \
00161                                        ip6_addr_cmp_zone((addr1), (addr2)))
00162 
00163 /* Exact-host comparison *after* ip6_addr_netcmp() succeeded, for efficiency. */
00164 #define ip6_addr_nethostcmp(addr1, addr2) (((addr1)->addr[2] == (addr2)->addr[2]) && \
00165                                            ((addr1)->addr[3] == (addr2)->addr[3]))
00166 
00167 /** Compare IPv6 addresses, ignoring zone information. To be used sparingly! */
00168 #define ip6_addr_cmp_zoneless(addr1, addr2) (((addr1)->addr[0] == (addr2)->addr[0]) && \
00169                                     ((addr1)->addr[1] == (addr2)->addr[1]) && \
00170                                     ((addr1)->addr[2] == (addr2)->addr[2]) && \
00171                                     ((addr1)->addr[3] == (addr2)->addr[3]))
00172 /**
00173  * Determine if two IPv6 addresses are the same. In particular, the address
00174  * part of both must be the same, and the zone must be compatible.
00175  *
00176  * @param addr1 IPv6 address 1
00177  * @param addr2 IPv6 address 2
00178  * @return 1 if the addresses are considered equal, 0 if not
00179  */
00180 #define ip6_addr_cmp(addr1, addr2) (ip6_addr_cmp_zoneless((addr1), (addr2)) && \
00181                                    ip6_addr_cmp_zone((addr1), (addr2)))
00182 
00183 /** Compare IPv6 address to packed address and zone */
00184 #define ip6_addr_cmp_packed(ip6addr, paddr, zone_idx) (((ip6addr)->addr[0] == (paddr)->addr[0]) && \
00185                                     ((ip6addr)->addr[1] == (paddr)->addr[1]) && \
00186                                     ((ip6addr)->addr[2] == (paddr)->addr[2]) && \
00187                                     ((ip6addr)->addr[3] == (paddr)->addr[3]) && \
00188                                     ip6_addr_equals_zone((ip6addr), (zone_idx)))
00189 
00190 #define ip6_get_subnet_id(ip6addr)   (lwip_htonl((ip6addr)->addr[2]) & 0x0000ffffUL)
00191 
00192 #define ip6_addr_isany_val(ip6addr) (((ip6addr).addr[0] == 0) && \
00193                                      ((ip6addr).addr[1] == 0) && \
00194                                      ((ip6addr).addr[2] == 0) && \
00195                                      ((ip6addr).addr[3] == 0))
00196 #define ip6_addr_isany(ip6addr) (((ip6addr) == NULL) || ip6_addr_isany_val(*(ip6addr)))
00197 
00198 #define ip6_addr_isloopback(ip6addr) (((ip6addr)->addr[0] == 0UL) && \
00199                                       ((ip6addr)->addr[1] == 0UL) && \
00200                                       ((ip6addr)->addr[2] == 0UL) && \
00201                                       ((ip6addr)->addr[3] == PP_HTONL(0x00000001UL)))
00202 
00203 #define ip6_addr_isglobal(ip6addr) (((ip6addr)->addr[0] & PP_HTONL(0xe0000000UL)) == PP_HTONL(0x20000000UL))
00204 
00205 #define ip6_addr_islinklocal(ip6addr) (((ip6addr)->addr[0] & PP_HTONL(0xffc00000UL)) == PP_HTONL(0xfe800000UL))
00206 
00207 #define ip6_addr_issitelocal(ip6addr) (((ip6addr)->addr[0] & PP_HTONL(0xffc00000UL)) == PP_HTONL(0xfec00000UL))
00208 
00209 #define ip6_addr_isuniquelocal(ip6addr) (((ip6addr)->addr[0] & PP_HTONL(0xfe000000UL)) == PP_HTONL(0xfc000000UL))
00210 
00211 #define ip6_addr_isipv4mappedipv6(ip6addr) (((ip6addr)->addr[0] == 0) && ((ip6addr)->addr[1] == 0) && (((ip6addr)->addr[2]) == PP_HTONL(0x0000FFFFUL)))
00212 
00213 #define ip6_addr_ismulticast(ip6addr) (((ip6addr)->addr[0] & PP_HTONL(0xff000000UL)) == PP_HTONL(0xff000000UL))
00214 #define ip6_addr_multicast_transient_flag(ip6addr)  ((ip6addr)->addr[0] & PP_HTONL(0x00100000UL))
00215 #define ip6_addr_multicast_prefix_flag(ip6addr)     ((ip6addr)->addr[0] & PP_HTONL(0x00200000UL))
00216 #define ip6_addr_multicast_rendezvous_flag(ip6addr) ((ip6addr)->addr[0] & PP_HTONL(0x00400000UL))
00217 #define ip6_addr_multicast_scope(ip6addr) ((lwip_htonl((ip6addr)->addr[0]) >> 16) & 0xf)
00218 #define IP6_MULTICAST_SCOPE_RESERVED            0x0
00219 #define IP6_MULTICAST_SCOPE_RESERVED0           0x0
00220 #define IP6_MULTICAST_SCOPE_INTERFACE_LOCAL     0x1
00221 #define IP6_MULTICAST_SCOPE_LINK_LOCAL          0x2
00222 #define IP6_MULTICAST_SCOPE_RESERVED3           0x3
00223 #define IP6_MULTICAST_SCOPE_ADMIN_LOCAL         0x4
00224 #define IP6_MULTICAST_SCOPE_SITE_LOCAL          0x5
00225 #define IP6_MULTICAST_SCOPE_ORGANIZATION_LOCAL  0x8
00226 #define IP6_MULTICAST_SCOPE_GLOBAL              0xe
00227 #define IP6_MULTICAST_SCOPE_RESERVEDF           0xf
00228 #define ip6_addr_ismulticast_iflocal(ip6addr) (((ip6addr)->addr[0] & PP_HTONL(0xff8f0000UL)) == PP_HTONL(0xff010000UL))
00229 #define ip6_addr_ismulticast_linklocal(ip6addr) (((ip6addr)->addr[0] & PP_HTONL(0xff8f0000UL)) == PP_HTONL(0xff020000UL))
00230 #define ip6_addr_ismulticast_adminlocal(ip6addr) (((ip6addr)->addr[0] & PP_HTONL(0xff8f0000UL)) == PP_HTONL(0xff040000UL))
00231 #define ip6_addr_ismulticast_sitelocal(ip6addr) (((ip6addr)->addr[0] & PP_HTONL(0xff8f0000UL)) == PP_HTONL(0xff050000UL))
00232 #define ip6_addr_ismulticast_orglocal(ip6addr) (((ip6addr)->addr[0] & PP_HTONL(0xff8f0000UL)) == PP_HTONL(0xff080000UL))
00233 #define ip6_addr_ismulticast_global(ip6addr) (((ip6addr)->addr[0] & PP_HTONL(0xff8f0000UL)) == PP_HTONL(0xff0e0000UL))
00234 
00235 /* Scoping note: while interface-local and link-local multicast addresses do
00236  * have a scope (i.e., they are meaningful only in the context of a particular
00237  * interface), the following functions are not assigning or comparing zone
00238  * indices. The reason for this is backward compatibility. Any call site that
00239  * produces a non-global multicast address must assign a multicast address as
00240  * appropriate itself. */
00241 
00242 #define ip6_addr_isallnodes_iflocal(ip6addr) (((ip6addr)->addr[0] == PP_HTONL(0xff010000UL)) && \
00243     ((ip6addr)->addr[1] == 0UL) && \
00244     ((ip6addr)->addr[2] == 0UL) && \
00245     ((ip6addr)->addr[3] == PP_HTONL(0x00000001UL)))
00246 
00247 #define ip6_addr_isallnodes_linklocal(ip6addr) (((ip6addr)->addr[0] == PP_HTONL(0xff020000UL)) && \
00248     ((ip6addr)->addr[1] == 0UL) && \
00249     ((ip6addr)->addr[2] == 0UL) && \
00250     ((ip6addr)->addr[3] == PP_HTONL(0x00000001UL)))
00251 #define ip6_addr_set_allnodes_linklocal(ip6addr) do{(ip6addr)->addr[0] = PP_HTONL(0xff020000UL); \
00252                 (ip6addr)->addr[1] = 0; \
00253                 (ip6addr)->addr[2] = 0; \
00254                 (ip6addr)->addr[3] = PP_HTONL(0x00000001UL); \
00255                 ip6_addr_clear_zone(ip6addr); }while(0)
00256 
00257 #define ip6_addr_isallrouters_linklocal(ip6addr) (((ip6addr)->addr[0] == PP_HTONL(0xff020000UL)) && \
00258     ((ip6addr)->addr[1] == 0UL) && \
00259     ((ip6addr)->addr[2] == 0UL) && \
00260     ((ip6addr)->addr[3] == PP_HTONL(0x00000002UL)))
00261 #define ip6_addr_set_allrouters_linklocal(ip6addr) do{(ip6addr)->addr[0] = PP_HTONL(0xff020000UL); \
00262                 (ip6addr)->addr[1] = 0; \
00263                 (ip6addr)->addr[2] = 0; \
00264                 (ip6addr)->addr[3] = PP_HTONL(0x00000002UL); \
00265                 ip6_addr_clear_zone(ip6addr); }while(0)
00266 
00267 #define ip6_addr_issolicitednode(ip6addr) ( ((ip6addr)->addr[0] == PP_HTONL(0xff020000UL)) && \
00268         ((ip6addr)->addr[2] == PP_HTONL(0x00000001UL)) && \
00269         (((ip6addr)->addr[3] & PP_HTONL(0xff000000UL)) == PP_HTONL(0xff000000UL)) )
00270 
00271 #define ip6_addr_set_solicitednode(ip6addr, if_id) do{(ip6addr)->addr[0] = PP_HTONL(0xff020000UL); \
00272                 (ip6addr)->addr[1] = 0; \
00273                 (ip6addr)->addr[2] = PP_HTONL(0x00000001UL); \
00274                 (ip6addr)->addr[3] = (PP_HTONL(0xff000000UL) | (if_id)); \
00275                 ip6_addr_clear_zone(ip6addr); }while(0)
00276 
00277 #define ip6_addr_cmp_solicitednode(ip6addr, sn_addr) (((ip6addr)->addr[0] == PP_HTONL(0xff020000UL)) && \
00278                                     ((ip6addr)->addr[1] == 0) && \
00279                                     ((ip6addr)->addr[2] == PP_HTONL(0x00000001UL)) && \
00280                                     ((ip6addr)->addr[3] == (PP_HTONL(0xff000000UL) | (sn_addr)->addr[3])))
00281 
00282 /* IPv6 address states. */
00283 #define IP6_ADDR_INVALID      0x00
00284 #define IP6_ADDR_TENTATIVE    0x08
00285 #define IP6_ADDR_TENTATIVE_1  0x09 /* 1 probe sent */
00286 #define IP6_ADDR_TENTATIVE_2  0x0a /* 2 probes sent */
00287 #define IP6_ADDR_TENTATIVE_3  0x0b /* 3 probes sent */
00288 #define IP6_ADDR_TENTATIVE_4  0x0c /* 4 probes sent */
00289 #define IP6_ADDR_TENTATIVE_5  0x0d /* 5 probes sent */
00290 #define IP6_ADDR_TENTATIVE_6  0x0e /* 6 probes sent */
00291 #define IP6_ADDR_TENTATIVE_7  0x0f /* 7 probes sent */
00292 #define IP6_ADDR_VALID        0x10 /* This bit marks an address as valid (preferred or deprecated) */
00293 #define IP6_ADDR_PREFERRED    0x30
00294 #define IP6_ADDR_DEPRECATED   0x10 /* Same as VALID (valid but not preferred) */
00295 #define IP6_ADDR_DUPLICATED   0x40 /* Failed DAD test, not valid */
00296 
00297 #define IP6_ADDR_TENTATIVE_COUNT_MASK 0x07 /* 1-7 probes sent */
00298 
00299 #define ip6_addr_isinvalid(addr_state) (addr_state == IP6_ADDR_INVALID)
00300 #define ip6_addr_istentative(addr_state) (addr_state & IP6_ADDR_TENTATIVE)
00301 #define ip6_addr_isvalid(addr_state) (addr_state & IP6_ADDR_VALID) /* Include valid, preferred, and deprecated. */
00302 #define ip6_addr_ispreferred(addr_state) (addr_state == IP6_ADDR_PREFERRED)
00303 #define ip6_addr_isdeprecated(addr_state) (addr_state == IP6_ADDR_DEPRECATED)
00304 #define ip6_addr_isduplicated(addr_state) (addr_state == IP6_ADDR_DUPLICATED)
00305 
00306 #if LWIP_IPV6_ADDRESS_LIFETIMES
00307 #define IP6_ADDR_LIFE_STATIC   (0)
00308 #define IP6_ADDR_LIFE_INFINITE (0xffffffffUL)
00309 #define ip6_addr_life_isstatic(addr_life) ((addr_life) == IP6_ADDR_LIFE_STATIC)
00310 #define ip6_addr_life_isinfinite(addr_life) ((addr_life) == IP6_ADDR_LIFE_INFINITE)
00311 #endif /* LWIP_IPV6_ADDRESS_LIFETIMES */
00312 
00313 #define ip6_addr_debug_print_parts(debug, a, b, c, d, e, f, g, h) \
00314   LWIP_DEBUGF(debug, ("%" X16_F ":%" X16_F ":%" X16_F ":%" X16_F ":%" X16_F ":%" X16_F ":%" X16_F ":%" X16_F, \
00315                       a, b, c, d, e, f, g, h))
00316 #define ip6_addr_debug_print(debug, ipaddr) \
00317   ip6_addr_debug_print_parts(debug, \
00318                       (u16_t)((ipaddr) != NULL ? IP6_ADDR_BLOCK1(ipaddr) : 0),    \
00319                       (u16_t)((ipaddr) != NULL ? IP6_ADDR_BLOCK2(ipaddr) : 0),    \
00320                       (u16_t)((ipaddr) != NULL ? IP6_ADDR_BLOCK3(ipaddr) : 0),    \
00321                       (u16_t)((ipaddr) != NULL ? IP6_ADDR_BLOCK4(ipaddr) : 0),    \
00322                       (u16_t)((ipaddr) != NULL ? IP6_ADDR_BLOCK5(ipaddr) : 0),    \
00323                       (u16_t)((ipaddr) != NULL ? IP6_ADDR_BLOCK6(ipaddr) : 0),    \
00324                       (u16_t)((ipaddr) != NULL ? IP6_ADDR_BLOCK7(ipaddr) : 0),    \
00325                       (u16_t)((ipaddr) != NULL ? IP6_ADDR_BLOCK8(ipaddr) : 0))
00326 #define ip6_addr_debug_print_val(debug, ipaddr) \
00327   ip6_addr_debug_print_parts(debug, \
00328                       IP6_ADDR_BLOCK1(&(ipaddr)),    \
00329                       IP6_ADDR_BLOCK2(&(ipaddr)),    \
00330                       IP6_ADDR_BLOCK3(&(ipaddr)),    \
00331                       IP6_ADDR_BLOCK4(&(ipaddr)),    \
00332                       IP6_ADDR_BLOCK5(&(ipaddr)),    \
00333                       IP6_ADDR_BLOCK6(&(ipaddr)),    \
00334                       IP6_ADDR_BLOCK7(&(ipaddr)),    \
00335                       IP6_ADDR_BLOCK8(&(ipaddr)))
00336 
00337 #define IP6ADDR_STRLEN_MAX    46
00338 
00339 int ip6addr_aton(const char *cp, ip6_addr_t *addr);
00340 /** returns ptr to static buffer; not reentrant! */
00341 char *ip6addr_ntoa(const ip6_addr_t *addr);
00342 char *ip6addr_ntoa_r(const ip6_addr_t *addr, char *buf, int buflen);
00343 
00344 
00345 
00346 #ifdef __cplusplus
00347 }
00348 #endif
00349 
00350 #endif /* LWIP_IPV6 */
00351 
00352 #endif /* LWIP_HDR_IP6_ADDR_H */