lwIP 2.1.2 Lightweight IP stack

Macros
IPv4 only
Infrastructure » IP address handling

## Macros
#define | IPADDR4_INIT(u32val) { { { { u32val, 0ul, 0ul, 0ul } IPADDR6_ZONE_INIT } }, IPADDR_TYPE_V4 }
#define | IPADDR4_INIT_BYTES(a, b, c, d) IPADDR4_INIT(PP_HTONL(LWIP_MAKEU32(a,b,c,d)))
#define | IP_IS_V4_VAL(ipaddr) (IP_GET_TYPE(&ipaddr) == IPADDR_TYPE_V4)
#define | IP_IS_V4(ipaddr) (((ipaddr) == NULL) || IP_IS_V4_VAL(*(ipaddr)))
#define | ip_2_ip4(ipaddr) (&((ipaddr)->u_addr.ip4))
#define | IP_ADDR4(ipaddr, a, b, c, d)
#define | ip_addr_copy_from_ip4(dest, src)
#define | ip_addr_set_ip4_u32(ipaddr, val)
#define | ip_addr_set_ip4_u32_val(ipaddr, val)
#define | ip_addr_get_ip4_u32(ipaddr)
#define | IP_ADDR_ANY IP4_ADDR_ANY
#define | IP4_ADDR_ANY (&ip_addr_any)
#define | IP4_ADDR_ANY4 (ip_2_ip4(&ip_addr_any))
#define | IP_ADDR_BROADCAST (&ip_addr_broadcast)
#define | IP4_ADDR_BROADCAST (ip_2_ip4(&ip_addr_broadcast))

## Detailed Description

## Macro Definition Documentation

## ◆ IP4_ADDR_ANY

#define IP4_ADDR_ANY (&ip_addr_any)

Can be used as a fixed/const ip_addr_t for the IPv4 wildcard and the broadcast address

## ◆ IP4_ADDR_ANY4

#define IP4_ADDR_ANY4 (ip_2_ip4(&ip_addr_any))

Can be used as a fixed/const ip4_addr_t for the wildcard and the broadcast address

## ◆ IP4_ADDR_BROADCAST

#define IP4_ADDR_BROADCAST (ip_2_ip4(&ip_addr_broadcast))

## ◆ ip_2_ip4

#define ip_2_ip4 | ( |  | ipaddr | ) | (&((ipaddr)->u_addr.ip4))

Convert generic ip address to specific protocol version

## ◆ IP_ADDR4

#define IP_ADDR4 | ( |  | ipaddr,
|  |  | a,
|  |  | b,
|  |  | c,
|  |  | d
| ) |  |

Value:
do { IP4_ADDR(ip_2_ip4(ipaddr),a,b,c,d); \
IP_SET_TYPE_VAL(*(ipaddr), IPADDR_TYPE_V4); } while(0)
IP4_ADDR
#define IP4_ADDR(ipaddr, a, b, c, d)
Definition: ip4_addr.h:104
ip_2_ip4
#define ip_2_ip4(ipaddr)
Definition: ip_addr.h:120
IPADDR_TYPE_V4
Definition: ip_addr.h:56

## ◆ IP_ADDR_ANY

#define IP_ADDR_ANY IP4_ADDR_ANY

Can be used as a fixed/const ip_addr_t for the IP wildcard. Defined to IP4_ADDR_ANY when IPv4 is enabled. Defined to IP6_ADDR_ANY in IPv6 only systems. Use this if you can handle IPv4 AND IPv6 addresses. Use IP4_ADDR_ANY or IP6_ADDR_ANY when the IP type matters.

## ◆ IP_ADDR_BROADCAST

#define IP_ADDR_BROADCAST (&ip_addr_broadcast)

## ◆ ip_addr_copy_from_ip4

#define ip_addr_copy_from_ip4 | ( |  | dest,
|  |  | src
| ) |  |

Value:
do{ \
ip4_addr_copy(*ip_2_ip4(&(dest)), src); IP_SET_TYPE_VAL(dest, IPADDR_TYPE_V4); ip_clear_no4(&dest); }while(0)
ip_2_ip4
#define ip_2_ip4(ipaddr)
Definition: ip_addr.h:120
IPADDR_TYPE_V4
Definition: ip_addr.h:56

## ◆ ip_addr_get_ip4_u32

#define ip_addr_get_ip4_u32 | ( |  | ipaddr | ) |

Value:
(((ipaddr) && IP_IS_V4(ipaddr)) ? \
ip4_addr_get_u32(ip_2_ip4(ipaddr)) : 0)
IP_IS_V4
#define IP_IS_V4(ipaddr)
Definition: ip_addr.h:100
ip4_addr_get_u32
#define ip4_addr_get_u32(src_ipaddr)
Definition: ip4_addr.h:128
ip_2_ip4
#define ip_2_ip4(ipaddr)
Definition: ip_addr.h:120

## ◆ ip_addr_set_ip4_u32

#define ip_addr_set_ip4_u32 | ( |  | ipaddr,
|  |  | val
| ) |  |

Value:
do{if(ipaddr){ip4_addr_set_u32(ip_2_ip4(ipaddr), val); \
IP_SET_TYPE(ipaddr, IPADDR_TYPE_V4); ip_clear_no4(ipaddr); }}while(0)
ip_2_ip4
#define ip_2_ip4(ipaddr)
Definition: ip_addr.h:120
ip4_addr_set_u32
#define ip4_addr_set_u32(dest_ipaddr, src_u32)
Definition: ip4_addr.h:126
IPADDR_TYPE_V4
Definition: ip_addr.h:56

## ◆ ip_addr_set_ip4_u32_val

#define ip_addr_set_ip4_u32_val | ( |  | ipaddr,
|  |  | val
| ) |  |

Value:
do{ ip4_addr_set_u32(ip_2_ip4(&(ipaddr)), val); \
IP_SET_TYPE_VAL(ipaddr, IPADDR_TYPE_V4); ip_clear_no4(&ipaddr); }while(0)
ip_2_ip4
#define ip_2_ip4(ipaddr)
Definition: ip_addr.h:120
ip4_addr_set_u32
#define ip4_addr_set_u32(dest_ipaddr, src_u32)
Definition: ip4_addr.h:126
IPADDR_TYPE_V4
Definition: ip_addr.h:56

## ◆ IP_IS_V4

#define IP_IS_V4 | ( |  | ipaddr | ) | (((ipaddr) == NULL) || IP_IS_V4_VAL(*(ipaddr)))

## ◆ IP_IS_V4_VAL

#define IP_IS_V4_VAL | ( |  | ipaddr | ) | (IP_GET_TYPE(&ipaddr) == IPADDR_TYPE_V4)

## ◆ IPADDR4_INIT

#define IPADDR4_INIT | ( |  | u32val | ) | { { { { u32val, 0ul, 0ul, 0ul } IPADDR6_ZONE_INIT } }, IPADDR_TYPE_V4 }

## ◆ IPADDR4_INIT_BYTES

#define IPADDR4_INIT_BYTES | ( |  | a,
|  |  | b,
|  |  | c,
|  |  | d
| ) |  | IPADDR4_INIT(PP_HTONL(LWIP_MAKEU32(a,b,c,d)))