Microchip® Advanced Software Framework

ip6_addr.h File Reference

IPv6 addresses.

#include "lwip/opt.h"

Data Structures

struct  ip6_addr
 
struct  ip6_addr_packed
 

Macros

#define IP6_ADDR(ip6addr, index, a, b, c, d)
 Set an IPv6 partial address given by byte-parts. More...
 
#define IP6_ADDR_ANY   ((ip6_addr_t *)&ip6_addr_any)
 
#define IP6_ADDR_BLOCK1(ip6addr)   ((u16_t)(htonl((ip6addr)->addr[0]) >> 16) & 0xffff)
 Access address in 16-bit block. More...
 
#define IP6_ADDR_BLOCK2(ip6addr)   ((u16_t)(htonl((ip6addr)->addr[0])) & 0xffff)
 
#define IP6_ADDR_BLOCK3(ip6addr)   ((u16_t)(htonl((ip6addr)->addr[1]) >> 16) & 0xffff)
 
#define IP6_ADDR_BLOCK4(ip6addr)   ((u16_t)(htonl((ip6addr)->addr[1])) & 0xffff)
 
#define IP6_ADDR_BLOCK5(ip6addr)   ((u16_t)(htonl((ip6addr)->addr[2]) >> 16) & 0xffff)
 
#define IP6_ADDR_BLOCK6(ip6addr)   ((u16_t)(htonl((ip6addr)->addr[2])) & 0xffff)
 
#define IP6_ADDR_BLOCK7(ip6addr)   ((u16_t)(htonl((ip6addr)->addr[3]) >> 16) & 0xffff)
 
#define IP6_ADDR_BLOCK8(ip6addr)   ((u16_t)(htonl((ip6addr)->addr[3])) & 0xffff)
 
#define ip6_addr_cmp(addr1, addr2)
 
#define ip6_addr_cmp_solicitednode(ip6addr, sn_addr)
 
#define ip6_addr_copy(dest, src)
 Copy IPv6 address - faster than ip6_addr_set: no NULL check. More...
 
#define ip6_addr_debug_print(debug, ipaddr)
 
#define IP6_ADDR_DEPRECATED   0x50
 
#define IP6_ADDR_INVALID   0x00
 
#define ip6_addr_isallnodes_iflocal(ip6addr)
 
#define ip6_addr_isallnodes_linklocal(ip6addr)
 
#define ip6_addr_isallrouters_linklocal(ip6addr)
 
#define ip6_addr_isany(ip6addr)
 
#define ip6_addr_isdeprecated(addr_state)   (addr_state == IP6_ADDR_DEPRECATED)
 
#define ip6_addr_isglobal(ip6addr)   (((ip6addr)->addr[0] & PP_HTONL(0xe0000000UL)) == PP_HTONL(0x20000000UL))
 
#define ip6_addr_isinvalid(addr_state)   (addr_state == IP6_ADDR_INVALID)
 
#define ip6_addr_islinklocal(ip6addr)   (((ip6addr)->addr[0] & PP_HTONL(0xffc00000UL)) == PP_HTONL(0xfe800000UL))
 
#define ip6_addr_isloopback(ip6addr)
 
#define ip6_addr_ismulticast(ip6addr)   (((ip6addr)->addr[0] & PP_HTONL(0xff000000UL)) == PP_HTONL(0xff000000UL))
 
#define ip6_addr_ismulticast_adminlocal(ip6addr)   (((ip6addr)->addr[0] & PP_HTONL(0xffff0000UL)) == PP_HTONL(0xff040000UL))
 
#define ip6_addr_ismulticast_global(ip6addr)   (((ip6addr)->addr[0] & PP_HTONL(0xffff0000UL)) == PP_HTONL(0xff0e0000UL))
 
#define ip6_addr_ismulticast_iflocal(ip6addr)   (((ip6addr)->addr[0] & PP_HTONL(0xffff0000UL)) == PP_HTONL(0xff010000UL))
 
#define ip6_addr_ismulticast_linklocal(ip6addr)   (((ip6addr)->addr[0] & PP_HTONL(0xffff0000UL)) == PP_HTONL(0xff020000UL))
 
#define ip6_addr_ismulticast_orglocal(ip6addr)   (((ip6addr)->addr[0] & PP_HTONL(0xffff0000UL)) == PP_HTONL(0xff080000UL))
 
#define ip6_addr_ismulticast_sitelocal(ip6addr)   (((ip6addr)->addr[0] & PP_HTONL(0xffff0000UL)) == PP_HTONL(0xff050000UL))
 
#define ip6_addr_ispreferred(addr_state)   (addr_state == IP6_ADDR_PREFERRED)
 
#define ip6_addr_issitelocal(ip6addr)   (((ip6addr)->addr[0] & PP_HTONL(0xffc00000UL)) == PP_HTONL(0xfec00000UL))
 
#define ip6_addr_issolicitednode(ip6addr)
 
#define ip6_addr_istentative(addr_state)   (addr_state & IP6_ADDR_TENTATIVE)
 
#define ip6_addr_isuniquelocal(ip6addr)   (((ip6addr)->addr[0] & PP_HTONL(0xfe000000UL)) == PP_HTONL(0xfc000000UL))
 
#define ip6_addr_isvalid(addr_state)   (addr_state & IP6_ADDR_VALID) /* Include valid, preferred, and deprecated. */
 
#define ip6_addr_multicast_prefix_flag(ip6addr)   ((ip6addr)->addr[0] & PP_HTONL(0x00200000UL))
 
#define ip6_addr_multicast_rendezvous_flag(ip6addr)   ((ip6addr)->addr[0] & PP_HTONL(0x00400000UL))
 
#define ip6_addr_multicast_scope(ip6addr)   ((htonl((ip6addr)->addr[0]) >> 16) & 0xf)
 
#define ip6_addr_multicast_transient_flag(ip6addr)   ((ip6addr)->addr[0] & PP_HTONL(0x00100000UL))
 
#define ip6_addr_netcmp(addr1, addr2)
 Determine if two IPv6 address are on the same network. More...
 
#define IP6_ADDR_PREFERRED   0x30
 
#define ip6_addr_set(dest, src)
 Safely copy one IPv6 address to another (src may be NULL) More...
 
#define ip6_addr_set_allnodes_linklocal(ip6addr)
 
#define ip6_addr_set_allrouters_linklocal(ip6addr)
 
#define ip6_addr_set_any(ip6addr)   ip6_addr_set_zero(ip6addr)
 Set address to ipv6 'any' (no need for htonl()) More...
 
#define ip6_addr_set_hton(dest, src)
 Safely copy one IPv6 address to another and change byte order from host- to network-order. More...
 
#define ip6_addr_set_loopback(ip6addr)
 Set address to ipv6 loopback address. More...
 
#define ip6_addr_set_solicitednode(ip6addr, if_id)
 
#define ip6_addr_set_zero(ip6addr)
 Set complete address to zero. More...
 
#define IP6_ADDR_TENTATIVE   0x08
 
#define IP6_ADDR_TENTATIVE_1   0x09 /* 1 probe sent */
 
#define IP6_ADDR_TENTATIVE_2   0x0a /* 2 probes sent */
 
#define IP6_ADDR_TENTATIVE_3   0x0b /* 3 probes sent */
 
#define IP6_ADDR_TENTATIVE_4   0x0c /* 4 probes sent */
 
#define IP6_ADDR_TENTATIVE_5   0x0d /* 5 probes sent */
 
#define IP6_ADDR_TENTATIVE_6   0x0e /* 6 probes sent */
 
#define IP6_ADDR_TENTATIVE_7   0x0f /* 7 probes sent */
 
#define IP6_ADDR_VALID   0x10
 
#define ip6_get_subnet_id(ip6addr)   (htonl((ip6addr)->addr[2]) & 0x0000ffffUL)
 
#define IP6_MULTICAST_SCOPE_ADMIN_LOCAL   0x4
 
#define IP6_MULTICAST_SCOPE_GLOBAL   0xe
 
#define IP6_MULTICAST_SCOPE_INTERFACE_LOCAL   0x1
 
#define IP6_MULTICAST_SCOPE_LINK_LOCAL   0x2
 
#define IP6_MULTICAST_SCOPE_ORGANIZATION_LOCAL   0x8
 
#define IP6_MULTICAST_SCOPE_RESERVED   0x0
 
#define IP6_MULTICAST_SCOPE_RESERVED0   0x0
 
#define IP6_MULTICAST_SCOPE_RESERVED3   0x3
 
#define IP6_MULTICAST_SCOPE_RESERVEDF   0xf
 
#define IP6_MULTICAST_SCOPE_SITE_LOCAL   0x5
 
#define IP6ADDR_STRLEN_MAX   46
 

Typedefs

typedef struct ip6_addr_packed ip6_addr_p_t
 
typedef typedefPACK_STRUCT_END
struct ip6_addr 
ip6_addr_t
 ip6_addr_t uses a struct for convenience only, so that the same defines can operate both on ip6_addr_t as well as on ip6_addr_p_t. More...
 

Functions

int ip6addr_aton (const char *cp, ip6_addr_t *addr)
 Check whether "cp" is a valid ascii representation of an IPv6 address and convert to a binary address. More...
 
char * ip6addr_ntoa (const ip6_addr_t *addr)
 returns ptr to static buffer; not reentrant! More...
 
char * ip6addr_ntoa_r (const ip6_addr_t *addr, char *buf, int buflen)
 Same as ipaddr_ntoa, but reentrant since a user-supplied buffer is used. More...
 

Variables

const ip6_addr_t ip6_addr_any
 IP6_ADDR_ANY can be used as a fixed IPv6 address for the wildcard. More...
 
PACK_STRUCT_BEGIN struct
ip6_addr_packed 
PACK_STRUCT_STRUCT
 

#define IP6_ADDR (   ip6addr,
  index,
  a,
  b,
  c,
 
)
Value:
(ip6addr)->addr[index] = ((u32_t)((d) & 0xff) << 24) | \
((u32_t)((c) & 0xff) << 16) | \
((u32_t)((b) & 0xff) << 8) | \
(u32_t)((a) & 0xff)
unsigned int u32_t
Definition: cc.h:49

Set an IPv6 partial address given by byte-parts.

Little-endian version, stored in network order (no htonl).

#define IP6_ADDR_ANY   ((ip6_addr_t *)&ip6_addr_any)
#define IP6_ADDR_BLOCK1 (   ip6addr)    ((u16_t)(htonl((ip6addr)->addr[0]) >> 16) & 0xffff)

Access address in 16-bit block.

Referenced by ip6_output().

#define IP6_ADDR_BLOCK2 (   ip6addr)    ((u16_t)(htonl((ip6addr)->addr[0])) & 0xffff)

Referenced by ip6_output().

#define IP6_ADDR_BLOCK3 (   ip6addr)    ((u16_t)(htonl((ip6addr)->addr[1]) >> 16) & 0xffff)

Referenced by ip6_output().

#define IP6_ADDR_BLOCK4 (   ip6addr)    ((u16_t)(htonl((ip6addr)->addr[1])) & 0xffff)

Referenced by ip6_output().

#define IP6_ADDR_BLOCK5 (   ip6addr)    ((u16_t)(htonl((ip6addr)->addr[2]) >> 16) & 0xffff)

Referenced by ip6_output().

#define IP6_ADDR_BLOCK6 (   ip6addr)    ((u16_t)(htonl((ip6addr)->addr[2])) & 0xffff)

Referenced by ip6_output().

#define IP6_ADDR_BLOCK7 (   ip6addr)    ((u16_t)(htonl((ip6addr)->addr[3]) >> 16) & 0xffff)

Referenced by ip6_output().

#define IP6_ADDR_BLOCK8 (   ip6addr)    ((u16_t)(htonl((ip6addr)->addr[3])) & 0xffff)

Referenced by ip6_output().

#define ip6_addr_cmp (   addr1,
  addr2 
)
Value:
(((addr1)->addr[0] == (addr2)->addr[0]) && \
((addr1)->addr[1] == (addr2)->addr[1]) && \
((addr1)->addr[2] == (addr2)->addr[2]) && \
((addr1)->addr[3] == (addr2)->addr[3]))

Referenced by ip6_input(), ip6_output_if_src(), ip6_reass(), ip6_route(), mld6_joingroup(), mld6_leavegroup(), mld6_lookfor_group(), nd6_find_destination_cache_entry(), nd6_find_neighbor_cache_entry(), nd6_get_next_hop_entry(), nd6_get_router(), nd6_input(), nd6_reachability_hint(), netif_get_ip6_addr_match(), and udp_input().

#define ip6_addr_cmp_solicitednode (   ip6addr,
  sn_addr 
)
Value:
(((ip6addr)->addr[0] == PP_HTONL(0xff020000UL)) && \
((ip6addr)->addr[1] == 0) && \
((ip6addr)->addr[2] == PP_HTONL(0x00000001UL)) && \
((ip6addr)->addr[3] == (PP_HTONL(0xff000000UL) | (sn_addr)->addr[3])))
#define PP_HTONL(x)
Definition: def.h:110

Referenced by ip6_input().

#define ip6_addr_copy (   dest,
  src 
)
Value:
do{(dest).addr[0] = (src).addr[0]; \
(dest).addr[1] = (src).addr[1]; \
(dest).addr[2] = (src).addr[2]; \
(dest).addr[3] = (src).addr[3];}while(0)

Copy IPv6 address - faster than ip6_addr_set: no NULL check.

Referenced by icmp6_send_response(), ip6_input(), ip6_output(), ip6_output_if_src(), and nd6_get_next_hop_entry().

#define ip6_addr_debug_print (   debug,
  ipaddr 
)
Value:
LWIP_DEBUGF(debug, ("%" X16_F ":%" X16_F ":%" X16_F ":%" X16_F ":%" X16_F ":%" X16_F ":%" X16_F ":%" X16_F, \
ipaddr != NULL ? IP6_ADDR_BLOCK1(ipaddr) : 0, \
ipaddr != NULL ? IP6_ADDR_BLOCK2(ipaddr) : 0, \
ipaddr != NULL ? IP6_ADDR_BLOCK3(ipaddr) : 0, \
ipaddr != NULL ? IP6_ADDR_BLOCK4(ipaddr) : 0, \
ipaddr != NULL ? IP6_ADDR_BLOCK5(ipaddr) : 0, \
ipaddr != NULL ? IP6_ADDR_BLOCK6(ipaddr) : 0, \
ipaddr != NULL ? IP6_ADDR_BLOCK7(ipaddr) : 0, \
ipaddr != NULL ? IP6_ADDR_BLOCK8(ipaddr) : 0))
#define IP6_ADDR_BLOCK1(ip6addr)
Access address in 16-bit block.
Definition: ip6_addr.h:106
#define IP6_ADDR_BLOCK7(ip6addr)
Definition: ip6_addr.h:112
#define IP6_ADDR_BLOCK3(ip6addr)
Definition: ip6_addr.h:108
#define IP6_ADDR_BLOCK4(ip6addr)
Definition: ip6_addr.h:109
#define IP6_ADDR_BLOCK2(ip6addr)
Definition: ip6_addr.h:107
#define IP6_ADDR_BLOCK6(ip6addr)
Definition: ip6_addr.h:111
#define IP6_ADDR_BLOCK8(ip6addr)
Definition: ip6_addr.h:113
#define NULL
Definition: nm_bsp.h:70
#define IP6_ADDR_BLOCK5(ip6addr)
Definition: ip6_addr.h:110
#define LWIP_DEBUGF(debug, message)
if &quot;expression&quot; isn&#39;t true, then print &quot;message&quot; and execute &quot;handler&quot; expression ...
Definition: debug.h:82
#define X16_F
Definition: cc.h:62
#define IP6_ADDR_DEPRECATED   0x50
#define IP6_ADDR_INVALID   0x00

Referenced by nd6_input(), nd6_tmr(), and netif_add().

#define ip6_addr_isallnodes_iflocal (   ip6addr)
Value:
(((ip6addr)->addr[0] == PP_HTONL(0xff010000UL)) && \
((ip6addr)->addr[1] == 0UL) && \
((ip6addr)->addr[2] == 0UL) && \
((ip6addr)->addr[3] == PP_HTONL(0x00000001UL)))
#define PP_HTONL(x)
Definition: def.h:110

Referenced by ip6_input().

#define ip6_addr_isallnodes_linklocal (   ip6addr)
Value:
(((ip6addr)->addr[0] == PP_HTONL(0xff020000UL)) && \
((ip6addr)->addr[1] == 0UL) && \
((ip6addr)->addr[2] == 0UL) && \
((ip6addr)->addr[3] == PP_HTONL(0x00000001UL)))
#define PP_HTONL(x)
Definition: def.h:110

Referenced by ip6_input(), and mld6_input().

#define ip6_addr_isallrouters_linklocal (   ip6addr)
Value:
(((ip6addr)->addr[0] == PP_HTONL(0xff020000UL)) && \
((ip6addr)->addr[1] == 0UL) && \
((ip6addr)->addr[2] == 0UL) && \
((ip6addr)->addr[3] == PP_HTONL(0x00000002UL)))
#define PP_HTONL(x)
Definition: def.h:110
#define ip6_addr_isany (   ip6addr)
Value:
(((ip6addr) == NULL) || \
(((ip6addr)->addr[0] == 0) && \
((ip6addr)->addr[1] == 0) && \
((ip6addr)->addr[2] == 0) && \
((ip6addr)->addr[3] == 0)))
#define NULL
Definition: nm_bsp.h:70

Referenced by ip6_input(), ip6_output_if(), ip6_route(), mld6_input(), mld6_joingroup(), mld6_leavegroup(), mld6_send(), nd6_input(), nd6_new_destination_cache_entry(), and udp_input().

#define ip6_addr_isdeprecated (   addr_state)    (addr_state == IP6_ADDR_DEPRECATED)
#define ip6_addr_isglobal (   ip6addr)    (((ip6addr)->addr[0] & PP_HTONL(0xe0000000UL)) == PP_HTONL(0x20000000UL))
#define ip6_addr_isinvalid (   addr_state)    (addr_state == IP6_ADDR_INVALID)
#define ip6_addr_islinklocal (   ip6addr)    (((ip6addr)->addr[0] & PP_HTONL(0xffc00000UL)) == PP_HTONL(0xfe800000UL))
#define ip6_addr_isloopback (   ip6addr)
Value:
(((ip6addr)->addr[0] == 0UL) && \
((ip6addr)->addr[1] == 0UL) && \
((ip6addr)->addr[2] == 0UL) && \
((ip6addr)->addr[3] == PP_HTONL(0x00000001UL)))
#define PP_HTONL(x)
Definition: def.h:110
#define ip6_addr_ismulticast (   ip6addr)    (((ip6addr)->addr[0] & PP_HTONL(0xff000000UL)) == PP_HTONL(0xff000000UL))
#define ip6_addr_ismulticast_adminlocal (   ip6addr)    (((ip6addr)->addr[0] & PP_HTONL(0xffff0000UL)) == PP_HTONL(0xff040000UL))
#define ip6_addr_ismulticast_global (   ip6addr)    (((ip6addr)->addr[0] & PP_HTONL(0xffff0000UL)) == PP_HTONL(0xff0e0000UL))
#define ip6_addr_ismulticast_iflocal (   ip6addr)    (((ip6addr)->addr[0] & PP_HTONL(0xffff0000UL)) == PP_HTONL(0xff010000UL))
#define ip6_addr_ismulticast_linklocal (   ip6addr)    (((ip6addr)->addr[0] & PP_HTONL(0xffff0000UL)) == PP_HTONL(0xff020000UL))
#define ip6_addr_ismulticast_orglocal (   ip6addr)    (((ip6addr)->addr[0] & PP_HTONL(0xffff0000UL)) == PP_HTONL(0xff080000UL))
#define ip6_addr_ismulticast_sitelocal (   ip6addr)    (((ip6addr)->addr[0] & PP_HTONL(0xffff0000UL)) == PP_HTONL(0xff050000UL))
#define ip6_addr_ispreferred (   addr_state)    (addr_state == IP6_ADDR_PREFERRED)
#define ip6_addr_issitelocal (   ip6addr)    (((ip6addr)->addr[0] & PP_HTONL(0xffc00000UL)) == PP_HTONL(0xfec00000UL))
#define ip6_addr_issolicitednode (   ip6addr)
Value:
( ((ip6addr)->addr[0] == PP_HTONL(0xff020000UL)) && \
((ip6addr)->addr[2] == PP_HTONL(0x00000001UL)) && \
(((ip6addr)->addr[3] & PP_HTONL(0xff000000UL)) == PP_HTONL(0xff000000UL)) )
#define PP_HTONL(x)
Definition: def.h:110

Referenced by ip6_input().

#define ip6_addr_istentative (   addr_state)    (addr_state & IP6_ADDR_TENTATIVE)

Referenced by nd6_input(), and nd6_tmr().

#define ip6_addr_isuniquelocal (   ip6addr)    (((ip6addr)->addr[0] & PP_HTONL(0xfe000000UL)) == PP_HTONL(0xfc000000UL))
#define ip6_addr_isvalid (   addr_state)    (addr_state & IP6_ADDR_VALID) /* Include valid, preferred, and deprecated. */
#define ip6_addr_multicast_prefix_flag (   ip6addr)    ((ip6addr)->addr[0] & PP_HTONL(0x00200000UL))
#define ip6_addr_multicast_rendezvous_flag (   ip6addr)    ((ip6addr)->addr[0] & PP_HTONL(0x00400000UL))
#define ip6_addr_multicast_scope (   ip6addr)    ((htonl((ip6addr)->addr[0]) >> 16) & 0xf)
#define ip6_addr_multicast_transient_flag (   ip6addr)    ((ip6addr)->addr[0] & PP_HTONL(0x00100000UL))
#define ip6_addr_netcmp (   addr1,
  addr2 
)
Value:
(((addr1)->addr[0] == (addr2)->addr[0]) && \
((addr1)->addr[1] == (addr2)->addr[1]))

Determine if two IPv6 address are on the same network.

  • addr1 IPv6 address 1
  • addr2 IPv6 address 2
    Returns
    !0 if the network identifiers of both address match

Referenced by ip6_route(), ip6_select_source_address(), nd6_get_onlink_prefix(), and nd6_is_prefix_in_netif().

#define IP6_ADDR_PREFERRED   0x30
#define ip6_addr_set (   dest,
  src 
)
Value:
do{(dest)->addr[0] = (src) == NULL ? 0 : (src)->addr[0]; \
(dest)->addr[1] = (src) == NULL ? 0 : (src)->addr[1]; \
(dest)->addr[2] = (src) == NULL ? 0 : (src)->addr[2]; \
(dest)->addr[3] = (src) == NULL ? 0 : (src)->addr[3];}while(0)
#define NULL
Definition: nm_bsp.h:70

Safely copy one IPv6 address to another (src may be NULL)

Referenced by mld6_new_group(), mld6_send(), nd6_get_next_hop_entry(), nd6_input(), nd6_new_onlink_prefix(), nd6_new_router(), nd6_send_na(), nd6_send_ns(), and nd6_send_q().

#define ip6_addr_set_allnodes_linklocal (   ip6addr)
Value:
do{(ip6addr)->addr[0] = PP_HTONL(0xff020000UL); \
(ip6addr)->addr[1] = 0; \
(ip6addr)->addr[2] = 0; \
(ip6addr)->addr[3] = PP_HTONL(0x00000001UL);}while(0)
#define PP_HTONL(x)
Definition: def.h:110

Referenced by nd6_send_na().

#define ip6_addr_set_allrouters_linklocal (   ip6addr)
Value:
do{(ip6addr)->addr[0] = PP_HTONL(0xff020000UL); \
(ip6addr)->addr[1] = 0; \
(ip6addr)->addr[2] = 0; \
(ip6addr)->addr[3] = PP_HTONL(0x00000002UL);}while(0)
#define PP_HTONL(x)
Definition: def.h:110

Referenced by nd6_send_rs().

#define ip6_addr_set_any (   ip6addr)    ip6_addr_set_zero(ip6addr)

Set address to ipv6 'any' (no need for htonl())

Referenced by ip6_input(), and nd6_get_next_hop_entry().

#define ip6_addr_set_hton (   dest,
  src 
)
Value:
do{(dest)->addr[0] = (src) == NULL ? 0 : htonl((src)->addr[0]); \
(dest)->addr[1] = (src) == NULL ? 0 : htonl((src)->addr[1]); \
(dest)->addr[2] = (src) == NULL ? 0 : htonl((src)->addr[2]); \
(dest)->addr[3] = (src) == NULL ? 0 : htonl((src)->addr[3]);}while(0)
#define NULL
Definition: nm_bsp.h:70
#define htonl(x)
Definition: def.h:79

Safely copy one IPv6 address to another and change byte order from host- to network-order.

#define ip6_addr_set_loopback (   ip6addr)
Value:
do{(ip6addr)->addr[0] = 0; \
(ip6addr)->addr[1] = 0; \
(ip6addr)->addr[2] = 0; \
(ip6addr)->addr[3] = PP_HTONL(0x00000001UL);}while(0)
#define PP_HTONL(x)
Definition: def.h:110

Set address to ipv6 loopback address.

#define ip6_addr_set_solicitednode (   ip6addr,
  if_id 
)
Value:
do{(ip6addr)->addr[0] = PP_HTONL(0xff020000UL); \
(ip6addr)->addr[1] = 0; \
(ip6addr)->addr[2] = PP_HTONL(0x00000001UL); \
(ip6addr)->addr[3] = (PP_HTONL(0xff000000UL) | (if_id));}while(0)
#define PP_HTONL(x)
Definition: def.h:110

Referenced by nd6_input(), nd6_send_na(), nd6_send_ns(), and nd6_tmr().

#define ip6_addr_set_zero (   ip6addr)
Value:
do{(ip6addr)->addr[0] = 0; \
(ip6addr)->addr[1] = 0; \
(ip6addr)->addr[2] = 0; \
(ip6addr)->addr[3] = 0;}while(0)

Set complete address to zero.

Referenced by nd6_free_neighbor_cache_entry(), and netif_add().

#define IP6_ADDR_TENTATIVE   0x08
#define IP6_ADDR_TENTATIVE_1   0x09 /* 1 probe sent */
#define IP6_ADDR_TENTATIVE_2   0x0a /* 2 probes sent */
#define IP6_ADDR_TENTATIVE_3   0x0b /* 3 probes sent */
#define IP6_ADDR_TENTATIVE_4   0x0c /* 4 probes sent */
#define IP6_ADDR_TENTATIVE_5   0x0d /* 5 probes sent */
#define IP6_ADDR_TENTATIVE_6   0x0e /* 6 probes sent */
#define IP6_ADDR_TENTATIVE_7   0x0f /* 7 probes sent */
#define IP6_ADDR_VALID   0x10

Referenced by netif_init().

#define ip6_get_subnet_id (   ip6addr)    (htonl((ip6addr)->addr[2]) & 0x0000ffffUL)
#define IP6_MULTICAST_SCOPE_ADMIN_LOCAL   0x4
#define IP6_MULTICAST_SCOPE_GLOBAL   0xe
#define IP6_MULTICAST_SCOPE_INTERFACE_LOCAL   0x1
#define IP6_MULTICAST_SCOPE_LINK_LOCAL   0x2
#define IP6_MULTICAST_SCOPE_ORGANIZATION_LOCAL   0x8
#define IP6_MULTICAST_SCOPE_RESERVED   0x0
#define IP6_MULTICAST_SCOPE_RESERVED0   0x0
#define IP6_MULTICAST_SCOPE_RESERVED3   0x3
#define IP6_MULTICAST_SCOPE_RESERVEDF   0xf
#define IP6_MULTICAST_SCOPE_SITE_LOCAL   0x5
#define IP6ADDR_STRLEN_MAX   46

typedef struct ip6_addr_packed ip6_addr_p_t
typedef typedefPACK_STRUCT_END struct ip6_addr ip6_addr_t

ip6_addr_t uses a struct for convenience only, so that the same defines can operate both on ip6_addr_t as well as on ip6_addr_p_t.

int ip6addr_aton ( const char *  cp,
ip6_addr_t addr 
)

Check whether "cp" is a valid ascii representation of an IPv6 address and convert to a binary address.

Returns 1 if the address is valid, 0 if not.

Parameters
cpIPv6 address in ascii representation (e.g. "FF01::1")
addrpointer to which to save the ip address in network order
Returns
1 if cp could be converted to addr, 0 on failure

References htonl, isdigit, islower, and isxdigit.

char* ip6addr_ntoa ( const ip6_addr_t addr)

returns ptr to static buffer; not reentrant!

returns ptr to static buffer; not reentrant!

returns ptr to static buffer; not reentrant!

Parameters
addrip6 address in network order to convert
Returns
pointer to a global static (!) buffer that holds the ASCII representation of addr

References ip6addr_ntoa_r().

char* ip6addr_ntoa_r ( const ip6_addr_t addr,
char *  buf,
int  buflen 
)

Same as ipaddr_ntoa, but reentrant since a user-supplied buffer is used.

Parameters
addrip6 address in network order to convert
buftarget buffer where the string is stored
buflenlength of buf
Returns
either pointer to buf which now holds the ASCII representation of addr or NULL if buf was too small

References htonl, NULL, and xchar.

Referenced by ip6addr_ntoa().

const ip6_addr_t ip6_addr_any

IP6_ADDR_ANY can be used as a fixed IPv6 address for the wildcard.

PACK_STRUCT_BEGIN struct ip6_addr_packed PACK_STRUCT_STRUCT