Added yet another IP-address-modifying define, ip_addr_set_any()

This commit is contained in:
goldsimon 2010-02-08 17:24:08 +00:00
parent b3caddab30
commit 90bed0c5ac
4 changed files with 8 additions and 6 deletions

View File

@ -836,7 +836,7 @@ dhcp_discover(struct netif *netif)
err_t result = ERR_OK; err_t result = ERR_OK;
u16_t msecs; u16_t msecs;
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_discover()\n")); LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_discover()\n"));
ip_addr_set(&dhcp->offered_ip_addr, IP_ADDR_ANY); ip_addr_set_any(&dhcp->offered_ip_addr);
dhcp_set_state(dhcp, DHCP_SELECTING); dhcp_set_state(dhcp, DHCP_SELECTING);
/* create and initialize the DHCP message header */ /* create and initialize the DHCP message header */
result = dhcp_create_request(netif, dhcp); result = dhcp_create_request(netif, dhcp);

View File

@ -1442,7 +1442,7 @@ void snmp_insert_iprteidx_tree(u8_t dflt, struct netif *ni)
if (dflt != 0) if (dflt != 0)
{ {
/* the default route 0.0.0.0 */ /* the default route 0.0.0.0 */
ip_addr_set(&dst, &ip_addr_any); ip_addr_set_any(&dst);
insert = 1; insert = 1;
} }
else else
@ -1519,7 +1519,7 @@ void snmp_delete_iprteidx_tree(u8_t dflt, struct netif *ni)
if (dflt != 0) if (dflt != 0)
{ {
/* the default route 0.0.0.0 */ /* the default route 0.0.0.0 */
ip_addr_set(&dst, &ip_addr_any); ip_addr_set_any(&dst);
del = 1; del = 1;
} }
else else

View File

@ -739,7 +739,7 @@ void
udp_disconnect(struct udp_pcb *pcb) udp_disconnect(struct udp_pcb *pcb)
{ {
/* reset remote address association */ /* reset remote address association */
ip_addr_set(&pcb->remote_ip, IP_ADDR_ANY); ip_addr_set_any(&pcb->remote_ip);
pcb->remote_port = 0; pcb->remote_port = 0;
/* mark PCB as unconnected */ /* mark PCB as unconnected */
pcb->flags &= ~UDP_FLAGS_CONNECTED; pcb->flags &= ~UDP_FLAGS_CONNECTED;

View File

@ -134,9 +134,11 @@ extern const ip_addr_t ip_addr_broadcast;
((src) == NULL ? 0:\ ((src) == NULL ? 0:\
(src)->addr)) (src)->addr))
/** Set complete address to zero */ /** Set complete address to zero */
#define ip_addr_set_zero(ipaddr) (ipaddr)->addr = IPADDR_ANY #define ip_addr_set_zero(ipaddr) ((ipaddr)->addr = 0)
/** Set address to IPADDR_ANY (no need for htonl()) */
#define ip_addr_set_any(ipaddr) ((ipaddr)->addr = IPADDR_ANY)
/** Set address to loopback address */ /** Set address to loopback address */
#define ip_addr_set_loopback(ipaddr) ((ipaddr)->addr = htonl(IPADDR_LOOPBACK)) #define ip_addr_set_loopback(ipaddr) ((ipaddr)->addr = htonl(IPADDR_LOOPBACK))
/** Safely copy one IP address to another and change byte order /** Safely copy one IP address to another and change byte order
* from host- to network-order. */ * from host- to network-order. */
#define ip_addr_set_hton(dest, src) ((dest)->addr = \ #define ip_addr_set_hton(dest, src) ((dest)->addr = \