mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-08-25 15:42:56 +00:00
Work on task #14283: Add more detailed status callback
Cleanups and IPv6 address status
This commit is contained in:
parent
58c48af58f
commit
3c1713406e
@ -383,7 +383,7 @@ netif_set_addr(struct netif *netif, const ip4_addr_t *ipaddr, const ip4_addr_t *
|
|||||||
netif_set_ipaddr(netif, ipaddr);
|
netif_set_ipaddr(netif, ipaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
netif_invoke_ext_callback(netif, LWIP_NSC_NETIF_IPV4_SETTINGS_CHANGED, NULL, NULL, NULL);
|
netif_invoke_ext_callback(netif, LWIP_NSC_IPV4_SETTINGS_CHANGED, NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
#endif /* LWIP_IPV4*/
|
#endif /* LWIP_IPV4*/
|
||||||
|
|
||||||
@ -528,7 +528,7 @@ netif_set_ipaddr(struct netif *netif, const ip4_addr_t *ipaddr)
|
|||||||
netif_issue_reports(netif, NETIF_REPORT_TYPE_IPV4);
|
netif_issue_reports(netif, NETIF_REPORT_TYPE_IPV4);
|
||||||
|
|
||||||
NETIF_STATUS_CALLBACK(netif);
|
NETIF_STATUS_CALLBACK(netif);
|
||||||
netif_invoke_ext_callback(netif, LWIP_NSC_NETIF_IPV4_ADDRESS_CHANGED, NULL, &old_addr, &new_addr);
|
netif_invoke_ext_callback(netif, LWIP_NSC_IPV4_ADDRESS_CHANGED, NULL, &old_addr, &new_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
LWIP_DEBUGF(NETIF_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("netif: IP address of interface %c%c set to %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n",
|
LWIP_DEBUGF(NETIF_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("netif: IP address of interface %c%c set to %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n",
|
||||||
@ -564,7 +564,7 @@ netif_set_gw(struct netif *netif, const ip4_addr_t *gw)
|
|||||||
ip4_addr3_16(netif_ip4_gw(netif)),
|
ip4_addr3_16(netif_ip4_gw(netif)),
|
||||||
ip4_addr4_16(netif_ip4_gw(netif))));
|
ip4_addr4_16(netif_ip4_gw(netif))));
|
||||||
|
|
||||||
netif_invoke_ext_callback(netif, LWIP_NSC_NETIF_IPV4_GATEWAY_CHANGED, NULL, &old_addr, &new_addr);
|
netif_invoke_ext_callback(netif, LWIP_NSC_IPV4_GATEWAY_CHANGED, NULL, &old_addr, &new_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -596,7 +596,7 @@ netif_set_netmask(struct netif *netif, const ip4_addr_t *netmask)
|
|||||||
ip4_addr3_16(netif_ip4_netmask(netif)),
|
ip4_addr3_16(netif_ip4_netmask(netif)),
|
||||||
ip4_addr4_16(netif_ip4_netmask(netif))));
|
ip4_addr4_16(netif_ip4_netmask(netif))));
|
||||||
|
|
||||||
netif_invoke_ext_callback(netif, LWIP_NSC_NETIF_IPV4_NETMASK_CHANGED, NULL, &old_addr, &new_addr);
|
netif_invoke_ext_callback(netif, LWIP_NSC_IPV4_NETMASK_CHANGED, NULL, &old_addr, &new_addr);
|
||||||
}
|
}
|
||||||
#endif /* LWIP_IPV4 */
|
#endif /* LWIP_IPV4 */
|
||||||
|
|
||||||
@ -636,7 +636,7 @@ netif_set_up(struct netif *netif)
|
|||||||
MIB2_COPY_SYSUPTIME_TO(&netif->ts);
|
MIB2_COPY_SYSUPTIME_TO(&netif->ts);
|
||||||
|
|
||||||
NETIF_STATUS_CALLBACK(netif);
|
NETIF_STATUS_CALLBACK(netif);
|
||||||
netif_invoke_ext_callback(netif, LWIP_NSC_NETIF_STATUS_CHANGED, (void*)1, NULL, NULL);
|
netif_invoke_ext_callback(netif, LWIP_NSC_STATUS_CHANGED, LWIP_PTR_NUMERIC_CAST(void*, 1), NULL, NULL);
|
||||||
|
|
||||||
if (netif->flags & NETIF_FLAG_LINK_UP) {
|
if (netif->flags & NETIF_FLAG_LINK_UP) {
|
||||||
netif_issue_reports(netif, NETIF_REPORT_TYPE_IPV4|NETIF_REPORT_TYPE_IPV6);
|
netif_issue_reports(netif, NETIF_REPORT_TYPE_IPV4|NETIF_REPORT_TYPE_IPV6);
|
||||||
@ -704,7 +704,7 @@ netif_set_down(struct netif *netif)
|
|||||||
#endif /* LWIP_IPV6 */
|
#endif /* LWIP_IPV6 */
|
||||||
|
|
||||||
NETIF_STATUS_CALLBACK(netif);
|
NETIF_STATUS_CALLBACK(netif);
|
||||||
netif_invoke_ext_callback(netif, LWIP_NSC_NETIF_STATUS_CHANGED, (void*)0, NULL, NULL);
|
netif_invoke_ext_callback(netif, LWIP_NSC_STATUS_CHANGED, LWIP_PTR_NUMERIC_CAST(void*, 0), NULL, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -758,7 +758,7 @@ netif_set_link_up(struct netif *netif)
|
|||||||
netif_issue_reports(netif, NETIF_REPORT_TYPE_IPV4|NETIF_REPORT_TYPE_IPV6);
|
netif_issue_reports(netif, NETIF_REPORT_TYPE_IPV4|NETIF_REPORT_TYPE_IPV6);
|
||||||
}
|
}
|
||||||
NETIF_LINK_CALLBACK(netif);
|
NETIF_LINK_CALLBACK(netif);
|
||||||
netif_invoke_ext_callback(netif, LWIP_NSC_LINK_CHANGED, (void*)1, NULL, NULL);
|
netif_invoke_ext_callback(netif, LWIP_NSC_LINK_CHANGED, LWIP_PTR_NUMERIC_CAST(void*, 1), NULL, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -772,7 +772,7 @@ netif_set_link_down(struct netif *netif )
|
|||||||
if (netif->flags & NETIF_FLAG_LINK_UP) {
|
if (netif->flags & NETIF_FLAG_LINK_UP) {
|
||||||
netif->flags &= ~NETIF_FLAG_LINK_UP;
|
netif->flags &= ~NETIF_FLAG_LINK_UP;
|
||||||
NETIF_LINK_CALLBACK(netif);
|
NETIF_LINK_CALLBACK(netif);
|
||||||
netif_invoke_ext_callback(netif, LWIP_NSC_LINK_CHANGED, (void*)0, NULL, NULL);
|
netif_invoke_ext_callback(netif, LWIP_NSC_LINK_CHANGED, LWIP_PTR_NUMERIC_CAST(void*, 0), NULL, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1142,6 +1142,8 @@ netif_ip6_addr_set_state(struct netif* netif, s8_t addr_idx, u8_t state)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
netif_invoke_ext_callback(netif, LWIP_NSC_IPV6_ADDR_STATE_CHANGED, LWIP_PTR_NUMERIC_CAST(void*, addr_idx), NULL, NULL);
|
||||||
|
|
||||||
LWIP_DEBUGF(NETIF_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("netif: IPv6 address %d of interface %c%c set to %s/0x%"X8_F"\n",
|
LWIP_DEBUGF(NETIF_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("netif: IPv6 address %d of interface %c%c set to %s/0x%"X8_F"\n",
|
||||||
addr_idx, netif->name[0], netif->name[1], ip6addr_ntoa(netif_ip6_addr(netif, addr_idx)),
|
addr_idx, netif->name[0], netif->name[1], ip6addr_ntoa(netif_ip6_addr(netif, addr_idx)),
|
||||||
netif_ip6_addr_state(netif, addr_idx)));
|
netif_ip6_addr_state(netif, addr_idx)));
|
||||||
|
@ -514,21 +514,21 @@ typedef enum
|
|||||||
/** link changed. arg: 1 up, 0 down */
|
/** link changed. arg: 1 up, 0 down */
|
||||||
LWIP_NSC_LINK_CHANGED,
|
LWIP_NSC_LINK_CHANGED,
|
||||||
/** netif status changed. arg: 1 up, 0 down */
|
/** netif status changed. arg: 1 up, 0 down */
|
||||||
LWIP_NSC_NETIF_STATUS_CHANGED,
|
LWIP_NSC_STATUS_CHANGED,
|
||||||
/** IPv4 address has changed. arg is NULL */
|
/** IPv4 address has changed. arg is NULL */
|
||||||
LWIP_NSC_NETIF_IPV4_ADDRESS_CHANGED,
|
LWIP_NSC_IPV4_ADDRESS_CHANGED,
|
||||||
/** IPv4 gateway has changed. arg is NULL */
|
/** IPv4 gateway has changed. arg is NULL */
|
||||||
LWIP_NSC_NETIF_IPV4_GATEWAY_CHANGED,
|
LWIP_NSC_IPV4_GATEWAY_CHANGED,
|
||||||
/** IPv4 netmask has changed. arg is NULL */
|
/** IPv4 netmask has changed. arg is NULL */
|
||||||
LWIP_NSC_NETIF_IPV4_NETMASK_CHANGED,
|
LWIP_NSC_IPV4_NETMASK_CHANGED,
|
||||||
/** called AFTER IPv4 address/gateway/netmask changes have been applied */
|
/** called AFTER IPv4 address/gateway/netmask changes have been applied */
|
||||||
LWIP_NSC_NETIF_IPV4_SETTINGS_CHANGED,
|
LWIP_NSC_IPV4_SETTINGS_CHANGED,
|
||||||
/** IPv6 address was added. arg is index of address */
|
/** IPv6 address was added. arg is index of address */
|
||||||
LWIP_NSC_NETIF_IPV6_ADDED,
|
LWIP_NSC_IPV6_ADDED,
|
||||||
/** IPv6 address was removed. arg is index of address */
|
/** IPv6 address was removed. arg is index of address */
|
||||||
LWIP_NSC_NETIF_IPV6_REMOVED,
|
LWIP_NSC_IPV6_REMOVED,
|
||||||
/** IPv6 address state has changed. arg is index of address */
|
/** IPv6 address state has changed. arg is index of address */
|
||||||
LWIP_NSC_NETIF_IPV6_ADDR_STATE_CHANGED
|
LWIP_NSC_IPV6_ADDR_STATE_CHANGED
|
||||||
} netif_status_callback_reason_t;
|
} netif_status_callback_reason_t;
|
||||||
|
|
||||||
typedef void (*netif_ext_status_callback)(struct netif* netif, netif_status_callback_reason_t reason, void* arg, const ip_addr_t* oldaddr, const ip_addr_t* newaddr);
|
typedef void (*netif_ext_status_callback)(struct netif* netif, netif_status_callback_reason_t reason, void* arg, const ip_addr_t* oldaddr, const ip_addr_t* newaddr);
|
||||||
|
Loading…
Reference in New Issue
Block a user