mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-29 00:32:51 +00:00
Removed ip_2_ip4/6_c const macros again now that ip_2_ip4/6 macros keep the original const'ness
This commit is contained in:
parent
262a641396
commit
c71723101a
@ -1770,11 +1770,11 @@ lwip_netconn_do_join_leave_group(struct api_msg_msg *msg)
|
||||
#if LWIP_IPV6 && LWIP_IPV6_MLD
|
||||
if (PCB_ISIPV6(msg->conn->pcb.udp)) {
|
||||
if (msg->msg.jl.join_or_leave == NETCONN_JOIN) {
|
||||
msg->err = mld6_joingroup(ip_2_ip6_c(API_EXPR_REF(msg->msg.jl.netif_addr)),
|
||||
ip_2_ip6_c(API_EXPR_REF(msg->msg.jl.multiaddr)));
|
||||
msg->err = mld6_joingroup(ip_2_ip6(API_EXPR_REF(msg->msg.jl.netif_addr)),
|
||||
ip_2_ip6(API_EXPR_REF(msg->msg.jl.multiaddr)));
|
||||
} else {
|
||||
msg->err = mld6_leavegroup(ip_2_ip6_c(API_EXPR_REF(msg->msg.jl.netif_addr)),
|
||||
ip_2_ip6_c(API_EXPR_REF(msg->msg.jl.multiaddr)));
|
||||
msg->err = mld6_leavegroup(ip_2_ip6(API_EXPR_REF(msg->msg.jl.netif_addr)),
|
||||
ip_2_ip6(API_EXPR_REF(msg->msg.jl.multiaddr)));
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1782,11 +1782,11 @@ lwip_netconn_do_join_leave_group(struct api_msg_msg *msg)
|
||||
{
|
||||
#if LWIP_IGMP
|
||||
if (msg->msg.jl.join_or_leave == NETCONN_JOIN) {
|
||||
msg->err = igmp_joingroup(ip_2_ip4_c(API_EXPR_REF(msg->msg.jl.netif_addr)),
|
||||
ip_2_ip4_c(API_EXPR_REF(msg->msg.jl.multiaddr)));
|
||||
msg->err = igmp_joingroup(ip_2_ip4(API_EXPR_REF(msg->msg.jl.netif_addr)),
|
||||
ip_2_ip4(API_EXPR_REF(msg->msg.jl.multiaddr)));
|
||||
} else {
|
||||
msg->err = igmp_leavegroup(ip_2_ip4_c(API_EXPR_REF(msg->msg.jl.netif_addr)),
|
||||
ip_2_ip4_c(API_EXPR_REF(msg->msg.jl.multiaddr)));
|
||||
msg->err = igmp_leavegroup(ip_2_ip4(API_EXPR_REF(msg->msg.jl.netif_addr)),
|
||||
ip_2_ip4(API_EXPR_REF(msg->msg.jl.multiaddr)));
|
||||
}
|
||||
#endif /* LWIP_IGMP */
|
||||
}
|
||||
|
@ -1597,7 +1597,7 @@ dhcp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *addr,
|
||||
#endif /* LWIP_IPV6 */
|
||||
|
||||
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_recv(pbuf = %p) from DHCP server %"U16_F".%"U16_F".%"U16_F".%"U16_F" port %"U16_F"\n", (void*)p,
|
||||
ip4_addr1_16(ip_2_ip4_c(addr)), ip4_addr2_16(ip_2_ip4_c(addr)), ip4_addr3_16(ip_2_ip4_c(addr)), ip4_addr4_16(ip_2_ip4_c(addr)), port));
|
||||
ip4_addr1_16(ip_2_ip4(addr)), ip4_addr2_16(ip_2_ip4(addr)), ip4_addr3_16(ip_2_ip4(addr)), ip4_addr4_16(ip_2_ip4(addr)), port));
|
||||
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("pbuf->len = %"U16_F"\n", p->len));
|
||||
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("pbuf->tot_len = %"U16_F"\n", p->tot_len));
|
||||
/* prevent warnings about unused arguments */
|
||||
|
@ -386,7 +386,7 @@ ip_chksum_pseudo(struct pbuf *p, u8_t proto, u16_t proto_len,
|
||||
{
|
||||
#if LWIP_IPV6
|
||||
if (IP_IS_V6(dest)) {
|
||||
return ip6_chksum_pseudo(p, proto, proto_len, ip_2_ip6_c(src), ip_2_ip6_c(dest));
|
||||
return ip6_chksum_pseudo(p, proto, proto_len, ip_2_ip6(src), ip_2_ip6(dest));
|
||||
}
|
||||
#endif /* LWIP_IPV6 */
|
||||
#if LWIP_IPV4 && LWIP_IPV6
|
||||
@ -394,7 +394,7 @@ ip_chksum_pseudo(struct pbuf *p, u8_t proto, u16_t proto_len,
|
||||
#endif /* LWIP_IPV4 && LWIP_IPV6 */
|
||||
#if LWIP_IPV4
|
||||
{
|
||||
return inet_chksum_pseudo(p, proto, proto_len, ip_2_ip4_c(src), ip_2_ip4_c(dest));
|
||||
return inet_chksum_pseudo(p, proto, proto_len, ip_2_ip4(src), ip_2_ip4(dest));
|
||||
}
|
||||
#endif /* LWIP_IPV4 */
|
||||
}
|
||||
@ -533,7 +533,7 @@ ip_chksum_pseudo_partial(struct pbuf *p, u8_t proto, u16_t proto_len,
|
||||
{
|
||||
#if LWIP_IPV6
|
||||
if (IP_IS_V6(dest)) {
|
||||
return ip6_chksum_pseudo_partial(p, proto, proto_len, chksum_len, ip_2_ip6_c(src), ip_2_ip6_c(dest));
|
||||
return ip6_chksum_pseudo_partial(p, proto, proto_len, chksum_len, ip_2_ip6(src), ip_2_ip6(dest));
|
||||
}
|
||||
#endif /* LWIP_IPV6 */
|
||||
#if LWIP_IPV4 && LWIP_IPV6
|
||||
@ -541,7 +541,7 @@ ip_chksum_pseudo_partial(struct pbuf *p, u8_t proto, u16_t proto_len,
|
||||
#endif /* LWIP_IPV4 && LWIP_IPV6 */
|
||||
#if LWIP_IPV4
|
||||
{
|
||||
return inet_chksum_pseudo_partial(p, proto, proto_len, chksum_len, ip_2_ip4_c(src), ip_2_ip4_c(dest));
|
||||
return inet_chksum_pseudo_partial(p, proto, proto_len, chksum_len, ip_2_ip4(src), ip_2_ip4(dest));
|
||||
}
|
||||
#endif /* LWIP_IPV4 */
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ icmp6_input(struct pbuf *p, struct netif *inp)
|
||||
/* Determine reply source IPv6 address. */
|
||||
#if LWIP_MULTICAST_PING
|
||||
if (ip6_addr_ismulticast(ip6_current_dest_addr())) {
|
||||
reply_src = ip_2_ip6_c(ip6_select_source_address(inp, ip6_current_src_addr()));
|
||||
reply_src = ip_2_ip6(ip6_select_source_address(inp, ip6_current_src_addr()));
|
||||
if (reply_src == NULL) {
|
||||
/* drop */
|
||||
pbuf_free(p);
|
||||
@ -323,7 +323,7 @@ icmp6_send_response(struct pbuf *p, u8_t code, u32_t data, u8_t type)
|
||||
reply_dest = ip6_current_src_addr();
|
||||
|
||||
/* Select an address to use as source. */
|
||||
reply_src = ip_2_ip6_c(ip6_select_source_address(netif, reply_dest));
|
||||
reply_src = ip_2_ip6(ip6_select_source_address(netif, reply_dest));
|
||||
if (reply_src == NULL) {
|
||||
/* drop */
|
||||
pbuf_free(q);
|
||||
|
@ -255,7 +255,7 @@ ip6_select_source_address(struct netif *netif, const ip6_addr_t * dest)
|
||||
else {
|
||||
/* Replace src only if we find a prefix match. */
|
||||
/* TODO find longest matching prefix. */
|
||||
if ((!(ip6_addr_netcmp(ip_2_ip6_c(src), dest))) &&
|
||||
if ((!(ip6_addr_netcmp(ip_2_ip6(src), dest))) &&
|
||||
ip6_addr_netcmp(netif_ip6_addr(netif, i), dest)) {
|
||||
src = netif_ip_addr6(netif, i);
|
||||
}
|
||||
@ -817,7 +817,7 @@ ip6_output_if(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
|
||||
const ip6_addr_t *src_used = src;
|
||||
if (dest != IP_HDRINCL) {
|
||||
if (src != NULL && ip6_addr_isany(src)) {
|
||||
src = ip_2_ip6_c(ip6_select_source_address(netif, dest));
|
||||
src = ip_2_ip6(ip6_select_source_address(netif, dest));
|
||||
if ((src == NULL) || ip6_addr_isany(src)) {
|
||||
/* No appropriate source address was found for this packet. */
|
||||
LWIP_DEBUGF(IP6_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("ip6_output: No suitable source address for packet.\n"));
|
||||
|
@ -329,7 +329,7 @@ raw_sendto(struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *ipaddr)
|
||||
/* If requested, based on the IPV6_CHECKSUM socket option per RFC3542,
|
||||
compute the checksum and update the checksum in the payload. */
|
||||
if (PCB_ISIPV6(pcb) && pcb->chksum_reqd) {
|
||||
u16_t chksum = ip6_chksum_pseudo(p, pcb->protocol, p->tot_len, ip_2_ip6_c(src_ip), ip_2_ip6_c(dst_ip));
|
||||
u16_t chksum = ip6_chksum_pseudo(p, pcb->protocol, p->tot_len, ip_2_ip6(src_ip), ip_2_ip6(dst_ip));
|
||||
LWIP_ASSERT("Checksum must fit into first pbuf", p->len >= (pcb->chksum_offset + 2));
|
||||
SMEMCPY(((u8_t *)p->payload) + pcb->chksum_offset, &chksum, sizeof(u16_t));
|
||||
}
|
||||
|
@ -1803,7 +1803,7 @@ tcp_eff_send_mss_impl(u16_t sendmss, const ip_addr_t *dest
|
||||
#endif /* LWIP_IPV4 */
|
||||
{
|
||||
/* First look in destination cache, to see if there is a Path MTU. */
|
||||
mtu = nd6_get_destination_mtu(ip_2_ip6_c(dest), outif);
|
||||
mtu = nd6_get_destination_mtu(ip_2_ip6(dest), outif);
|
||||
}
|
||||
#if LWIP_IPV4
|
||||
else
|
||||
|
@ -666,7 +666,7 @@ udp_sendto_if_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_i
|
||||
#if LWIP_IPV6
|
||||
if (PCB_ISIPV6(pcb)) {
|
||||
if (ip6_addr_isany(ip_2_ip6(&pcb->local_ip))) {
|
||||
src_ip = ip6_select_source_address(netif, ip_2_ip6_c(dst_ip));
|
||||
src_ip = ip6_select_source_address(netif, ip_2_ip6(dst_ip));
|
||||
if (src_ip == NULL) {
|
||||
/* No suitable source address was found. */
|
||||
return ERR_RTE;
|
||||
|
@ -245,26 +245,26 @@ extern struct ip_globals ip_data;
|
||||
#if LWIP_IPV4 && LWIP_IPV6
|
||||
#define ip_output(isipv6, p, src, dest, ttl, tos, proto) \
|
||||
((isipv6) ? \
|
||||
ip6_output(p, ip_2_ip6_c(src), ip_2_ip6_c(dest), ttl, tos, proto) : \
|
||||
ip4_output(p, ip_2_ip4_c(src), ip_2_ip4_c(dest), ttl, tos, proto))
|
||||
ip6_output(p, ip_2_ip6(src), ip_2_ip6(dest), ttl, tos, proto) : \
|
||||
ip4_output(p, ip_2_ip4(src), ip_2_ip4(dest), ttl, tos, proto))
|
||||
#define ip_output_if(isipv6, p, src, dest, ttl, tos, proto, netif) \
|
||||
((isipv6) ? \
|
||||
ip6_output_if(p, ip_2_ip6_c(src), ip_2_ip6_c(dest), ttl, tos, proto, netif) : \
|
||||
ip4_output_if(p, ip_2_ip4_c(src), ip_2_ip4_c(dest), ttl, tos, proto, netif))
|
||||
ip6_output_if(p, ip_2_ip6(src), ip_2_ip6(dest), ttl, tos, proto, netif) : \
|
||||
ip4_output_if(p, ip_2_ip4(src), ip_2_ip4(dest), ttl, tos, proto, netif))
|
||||
#define ip_output_if_src(isipv6, p, src, dest, ttl, tos, proto, netif) \
|
||||
((isipv6) ? \
|
||||
ip6_output_if_src(p, ip_2_ip6_c(src), ip_2_ip6_c(dest), ttl, tos, proto, netif) : \
|
||||
ip4_output_if_src(p, ip_2_ip4_c(src), ip_2_ip4_c(dest), ttl, tos, proto, netif))
|
||||
ip6_output_if_src(p, ip_2_ip6(src), ip_2_ip6(dest), ttl, tos, proto, netif) : \
|
||||
ip4_output_if_src(p, ip_2_ip4(src), ip_2_ip4(dest), ttl, tos, proto, netif))
|
||||
#define ip_output_hinted(isipv6, p, src, dest, ttl, tos, proto, addr_hint) \
|
||||
((isipv6) ? \
|
||||
ip6_output_hinted(p, ip_2_ip6_c(src), ip_2_ip6_c(dest), ttl, tos, proto, addr_hint) : \
|
||||
ip4_output_hinted(p, ip_2_ip4_c(src), ip_2_ip4_c(dest), ttl, tos, proto, addr_hint))
|
||||
ip6_output_hinted(p, ip_2_ip6(src), ip_2_ip6(dest), ttl, tos, proto, addr_hint) : \
|
||||
ip4_output_hinted(p, ip_2_ip4(src), ip_2_ip4(dest), ttl, tos, proto, addr_hint))
|
||||
#define ip_route(isipv6, src, dest) \
|
||||
((isipv6) ? \
|
||||
ip6_route(ip_2_ip6_c(src), ip_2_ip6_c(dest)) : \
|
||||
ip4_route_src(ip_2_ip4_c(dest), ip_2_ip4_c(src)))
|
||||
ip6_route(ip_2_ip6(src), ip_2_ip6(dest)) : \
|
||||
ip4_route_src(ip_2_ip4(dest), ip_2_ip4(src)))
|
||||
#define ip_netif_get_local_ip(isipv6, netif, dest) ((isipv6) ? \
|
||||
ip6_netif_get_local_ip(netif, ip_2_ip6_c(dest)) : \
|
||||
ip6_netif_get_local_ip(netif, ip_2_ip6(dest)) : \
|
||||
ip4_netif_get_local_ip(netif))
|
||||
#define ip_debug_print(is_ipv6, p) ((is_ipv6) ? ip6_debug_print(p) : ip4_debug_print(p))
|
||||
#elif LWIP_IPV4 /* LWIP_IPV4 && LWIP_IPV6 */
|
||||
|
@ -70,9 +70,7 @@ typedef struct _ip_addr {
|
||||
|
||||
/* Convert generic ip address to specific protocol version */
|
||||
#define ip_2_ip6(ipaddr) (&((ipaddr)->u_addr.ip6))
|
||||
#define ip_2_ip6_c(ipaddr) ip_2_ip6(ipaddr)
|
||||
#define ip_2_ip4(ipaddr) (&((ipaddr)->u_addr.ip4))
|
||||
#define ip_2_ip4_c(ipaddr) ip_2_ip4(ipaddr)
|
||||
|
||||
#define IP_ADDR4(ipaddr,a,b,c,d) do { IP4_ADDR(ip_2_ip4(ipaddr),a,b,c,d); \
|
||||
IP_SET_TYPE_VAL(*(ipaddr), IPADDR_TYPE_V4); } while(0)
|
||||
@ -80,8 +78,8 @@ typedef struct _ip_addr {
|
||||
IP_SET_TYPE_VAL(*(ipaddr), IPADDR_TYPE_V6); } while(0)
|
||||
|
||||
#define ip_addr_copy(dest, src) do{if(IP_IS_V6_VAL(src)){ \
|
||||
ip6_addr_copy(*ip_2_ip6(&(dest)), *ip_2_ip6_c(&(src))); IP_SET_TYPE_VAL(dest, IPADDR_TYPE_V6); }else{ \
|
||||
ip4_addr_copy(*ip_2_ip4(&(dest)), *ip_2_ip4_c(&(src))); IP_SET_TYPE_VAL(dest, IPADDR_TYPE_V4); }}while(0)
|
||||
ip6_addr_copy(*ip_2_ip6(&(dest)), *ip_2_ip6(&(src))); IP_SET_TYPE_VAL(dest, IPADDR_TYPE_V6); }else{ \
|
||||
ip4_addr_copy(*ip_2_ip4(&(dest)), *ip_2_ip4(&(src))); IP_SET_TYPE_VAL(dest, IPADDR_TYPE_V4); }}while(0)
|
||||
#define ip_addr_copy_from_ip6(dest, src) do{ \
|
||||
ip6_addr_copy(*ip_2_ip6(&(dest)), src); IP_SET_TYPE_VAL(dest, IPADDR_TYPE_V6); }while(0)
|
||||
#define ip_addr_copy_from_ip4(dest, src) do{ \
|
||||
@ -91,11 +89,11 @@ typedef struct _ip_addr {
|
||||
#define ip_addr_get_ip4_u32(ipaddr) (((ipaddr) && !IP_IS_V6(ipaddr)) ? \
|
||||
ip4_addr_get_u32(ip_2_ip4(ipaddr)) : 0)
|
||||
#define ip_addr_set(dest, src) do{if(IP_IS_V6(src)){ \
|
||||
ip6_addr_set(ip_2_ip6(dest), ip_2_ip6_c(src)); IP_SET_TYPE(dest, IPADDR_TYPE_V6); }else{ \
|
||||
ip4_addr_set(ip_2_ip4(dest), ip_2_ip4_c(src)); IP_SET_TYPE(dest, IPADDR_TYPE_V4); }}while(0)
|
||||
ip6_addr_set(ip_2_ip6(dest), ip_2_ip6(src)); IP_SET_TYPE(dest, IPADDR_TYPE_V6); }else{ \
|
||||
ip4_addr_set(ip_2_ip4(dest), ip_2_ip4(src)); IP_SET_TYPE(dest, IPADDR_TYPE_V4); }}while(0)
|
||||
#define ip_addr_set_ipaddr(dest, src) do{if(IP_IS_V6(src)){ \
|
||||
ip6_addr_set(ip_2_ip6(dest), ip_2_ip6_c(src)); IP_SET_TYPE(dest, IPADDR_TYPE_V6); }else{ \
|
||||
ip4_addr_set(ip_2_ip4(dest), ip_2_ip4_c(src)); IP_SET_TYPE(dest, IPADDR_TYPE_V4); }}while(0)
|
||||
ip6_addr_set(ip_2_ip6(dest), ip_2_ip6(src)); IP_SET_TYPE(dest, IPADDR_TYPE_V6); }else{ \
|
||||
ip4_addr_set(ip_2_ip4(dest), ip_2_ip4(src)); IP_SET_TYPE(dest, IPADDR_TYPE_V4); }}while(0)
|
||||
#define ip_addr_set_zero(ipaddr) do{ \
|
||||
ip6_addr_set_zero(ip_2_ip6(ipaddr)); IP_SET_TYPE(ipaddr, 0); }while(0)
|
||||
#define ip_addr_set_zero_ip4(ipaddr) do{ \
|
||||
@ -118,36 +116,36 @@ typedef struct _ip_addr {
|
||||
0 : \
|
||||
ip4_addr_netcmp(ip_2_ip4(addr1), ip_2_ip4(addr2), mask))
|
||||
#define ip_addr_cmp(addr1, addr2) ((IP_IS_V6_VAL(*(addr1)) != IP_IS_V6_VAL(*(addr2))) ? 0 : (IP_IS_V6_VAL(*(addr1)) ? \
|
||||
ip6_addr_cmp(ip_2_ip6_c(addr1), ip_2_ip6_c(addr2)) : \
|
||||
ip4_addr_cmp(ip_2_ip4_c(addr1), ip_2_ip4_c(addr2))))
|
||||
ip6_addr_cmp(ip_2_ip6(addr1), ip_2_ip6(addr2)) : \
|
||||
ip4_addr_cmp(ip_2_ip4(addr1), ip_2_ip4(addr2))))
|
||||
#define ip_addr_isany(ipaddr) ((IP_IS_V6(ipaddr)) ? \
|
||||
ip6_addr_isany(ip_2_ip6_c(ipaddr)) : \
|
||||
ip4_addr_isany(ip_2_ip4_c(ipaddr)))
|
||||
ip6_addr_isany(ip_2_ip6(ipaddr)) : \
|
||||
ip4_addr_isany(ip_2_ip4(ipaddr)))
|
||||
#define ip_addr_isany_val(ipaddr) ((IP_IS_V6_VAL(ipaddr)) ? \
|
||||
ip6_addr_isany_val(*ip_2_ip6(&(ipaddr))) : \
|
||||
ip4_addr_isany_val(*ip_2_ip4(&(ipaddr))))
|
||||
#define ip_addr_isbroadcast(ipaddr, netif) ((IP_IS_V6(ipaddr)) ? \
|
||||
0 : \
|
||||
ip4_addr_isbroadcast(ip_2_ip4_c(ipaddr), netif))
|
||||
ip4_addr_isbroadcast(ip_2_ip4(ipaddr), netif))
|
||||
#define ip_addr_ismulticast(ipaddr) ((IP_IS_V6(ipaddr)) ? \
|
||||
ip6_addr_ismulticast(ip_2_ip6_c(ipaddr)) : \
|
||||
ip4_addr_ismulticast(ip_2_ip4_c(ipaddr)))
|
||||
ip6_addr_ismulticast(ip_2_ip6(ipaddr)) : \
|
||||
ip4_addr_ismulticast(ip_2_ip4(ipaddr)))
|
||||
#define ip_addr_isloopback(ipaddr) ((IP_IS_V6(ipaddr)) ? \
|
||||
ip6_addr_isloopback(ip_2_ip6_c(ipaddr)) : \
|
||||
ip4_addr_isloopback(ip_2_ip4_c(ipaddr)))
|
||||
ip6_addr_isloopback(ip_2_ip6(ipaddr)) : \
|
||||
ip4_addr_isloopback(ip_2_ip4(ipaddr)))
|
||||
#define ip_addr_islinklocal(ipaddr) ((IP_IS_V6(ipaddr)) ? \
|
||||
ip6_addr_islinklocal(ip_2_ip6_c(ipaddr)) : \
|
||||
ip4_addr_islinklocal(ip_2_ip4_c(ipaddr)))
|
||||
ip6_addr_islinklocal(ip_2_ip6(ipaddr)) : \
|
||||
ip4_addr_islinklocal(ip_2_ip4(ipaddr)))
|
||||
#define ip_addr_debug_print(debug, ipaddr) do { if(IP_IS_V6(ipaddr)) { \
|
||||
ip6_addr_debug_print(debug, ip_2_ip6_c(ipaddr)); } else { \
|
||||
ip4_addr_debug_print(debug, ip_2_ip4_c(ipaddr)); }}while(0)
|
||||
ip6_addr_debug_print(debug, ip_2_ip6(ipaddr)); } else { \
|
||||
ip4_addr_debug_print(debug, ip_2_ip4(ipaddr)); }}while(0)
|
||||
#define ip_addr_debug_print_val(debug, ipaddr) do { if(IP_IS_V6_VAL(ipaddr)) { \
|
||||
ip6_addr_debug_print_val(debug, *ip_2_ip6_c(&(ipaddr))); } else { \
|
||||
ip4_addr_debug_print_val(debug, *ip_2_ip4_c(&(ipaddr))); }}while(0)
|
||||
ip6_addr_debug_print_val(debug, *ip_2_ip6(&(ipaddr))); } else { \
|
||||
ip4_addr_debug_print_val(debug, *ip_2_ip4(&(ipaddr))); }}while(0)
|
||||
#define ipaddr_ntoa(addr) (((addr) == NULL) ? "NULL" : \
|
||||
((IP_IS_V6(addr)) ? ip6addr_ntoa(ip_2_ip6_c(addr)) : ip4addr_ntoa(ip_2_ip4_c(addr))))
|
||||
((IP_IS_V6(addr)) ? ip6addr_ntoa(ip_2_ip6(addr)) : ip4addr_ntoa(ip_2_ip4(addr))))
|
||||
#define ipaddr_ntoa_r(addr, buf, buflen) (((addr) == NULL) ? "NULL" : \
|
||||
((IP_IS_V6(addr)) ? ip6addr_ntoa_r(ip_2_ip6_c(addr), buf, buflen) : ip4addr_ntoa_r(ip_2_ip4_c(addr), buf, buflen)))
|
||||
((IP_IS_V6(addr)) ? ip6addr_ntoa_r(ip_2_ip6(addr), buf, buflen) : ip4addr_ntoa_r(ip_2_ip4(addr), buf, buflen)))
|
||||
int ipaddr_aton(const char *cp, ip_addr_t *addr);
|
||||
|
||||
#else /* LWIP_IPV4 && LWIP_IPV6 */
|
||||
@ -163,7 +161,6 @@ typedef ip4_addr_t ip_addr_t;
|
||||
#define IP_SET_TYPE_VAL(ipaddr, iptype)
|
||||
#define IP_SET_TYPE(ipaddr, iptype)
|
||||
#define ip_2_ip4(ipaddr) (ipaddr)
|
||||
#define ip_2_ip4_c(ipaddr) (ipaddr)
|
||||
#define IP_ADDR4(ipaddr,a,b,c,d) IP4_ADDR(ipaddr,a,b,c,d)
|
||||
|
||||
#define ip_addr_copy(dest, src) ip4_addr_copy(dest, src)
|
||||
@ -201,7 +198,6 @@ typedef ip6_addr_t ip_addr_t;
|
||||
#define IP_SET_TYPE_VAL(ipaddr, iptype)
|
||||
#define IP_SET_TYPE(ipaddr, iptype)
|
||||
#define ip_2_ip6(ipaddr) (ipaddr)
|
||||
#define ip_2_ip6_c(ipaddr) (ipaddr)
|
||||
#define IP_ADDR6(ipaddr,i0,i1,i2,i3) IP6_ADDR(ipaddr,i0,i1,i2,i3)
|
||||
|
||||
#define ip_addr_copy(dest, src) ip6_addr_copy(dest, src)
|
||||
@ -244,8 +240,8 @@ extern const ip_addr_t ip_addr_broadcast;
|
||||
/** IP4_ADDR_ can be used as a fixed/const ip4_addr_t
|
||||
* for the wildcard and the broadcast address
|
||||
*/
|
||||
#define IP4_ADDR_ANY (ip_2_ip4_c(&ip_addr_any))
|
||||
#define IP4_ADDR_BROADCAST (ip_2_ip4_c(&ip_addr_broadcast))
|
||||
#define IP4_ADDR_ANY (ip_2_ip4(&ip_addr_any))
|
||||
#define IP4_ADDR_BROADCAST (ip_2_ip4(&ip_addr_broadcast))
|
||||
|
||||
#endif /* LWIP_IPV4*/
|
||||
|
||||
@ -260,7 +256,7 @@ extern const ip_addr_t ip6_addr_any;
|
||||
/** IP6_ADDR_ANY6 can be used as a fixed ip6_addr_t
|
||||
* for the IPv6 wildcard address
|
||||
*/
|
||||
#define IP6_ADDR_ANY6 (ip_2_ip6_c(&ip6_addr_any))
|
||||
#define IP6_ADDR_ANY6 (ip_2_ip6(&ip6_addr_any))
|
||||
|
||||
#if !LWIP_IPV4
|
||||
/** Just a little upgrade-helper for IPv6-only configurations: */
|
||||
|
@ -348,9 +348,9 @@ void netif_set_default(struct netif *netif);
|
||||
void netif_set_ipaddr(struct netif *netif, const ip4_addr_t *ipaddr);
|
||||
void netif_set_netmask(struct netif *netif, const ip4_addr_t *netmask);
|
||||
void netif_set_gw(struct netif *netif, const ip4_addr_t *gw);
|
||||
#define netif_ip4_addr(netif) (ip_2_ip4_c(&((netif)->ip_addr)))
|
||||
#define netif_ip4_netmask(netif) (ip_2_ip4_c(&((netif)->netmask)))
|
||||
#define netif_ip4_gw(netif) (ip_2_ip4_c(&((netif)->gw)))
|
||||
#define netif_ip4_addr(netif) ((const ip4_addr_t*)ip_2_ip4(&((netif)->ip_addr)))
|
||||
#define netif_ip4_netmask(netif) ((const ip4_addr_t*)ip_2_ip4(&((netif)->netmask)))
|
||||
#define netif_ip4_gw(netif) ((const ip4_addr_t*)ip_2_ip4(&((netif)->gw)))
|
||||
#endif /* LWIP_IPV4 */
|
||||
|
||||
void netif_set_up(struct netif *netif);
|
||||
@ -399,7 +399,7 @@ void netif_poll_all(void);
|
||||
|
||||
#if LWIP_IPV6
|
||||
#define netif_ip_addr6(netif, i) ((const ip_addr_t*)(&((netif)->ip6_addr[i])))
|
||||
#define netif_ip6_addr(netif, i) (ip_2_ip6_c(&((netif)->ip6_addr[i])))
|
||||
#define netif_ip6_addr(netif, i) ((const ip6_addr_t*)ip_2_ip6(&((netif)->ip6_addr[i])))
|
||||
#define netif_ip6_addr_set(netif, i, addr6) do { ip6_addr_set(ip_2_ip6(&((netif)->ip6_addr[i])), addr6); IP_SET_TYPE_VAL((netif)->ip6_addr[i], IPADDR_TYPE_V6); } while(0)
|
||||
#define netif_ip6_addr_state(netif, i) ((netif)->ip6_addr_state[i])
|
||||
#define netif_ip6_addr_set_state(netif, i, state) ((netif)->ip6_addr_state[i] = (state))
|
||||
|
Loading…
x
Reference in New Issue
Block a user