70#if LWIP_NETIF_LOOPBACK_MULTITHREADING
96#if LWIP_NETIF_STATUS_CALLBACK
97#define NETIF_STATUS_CALLBACK(n) do{ if (n->status_callback) { (n->status_callback)(n); }}while(0)
99#define NETIF_STATUS_CALLBACK(n)
102#if LWIP_NETIF_LINK_CALLBACK
103#define NETIF_LINK_CALLBACK(n) do{ if (n->link_callback) { (n->link_callback)(n); }}while(0)
105#define NETIF_LINK_CALLBACK(n)
108#if LWIP_NETIF_EXT_STATUS_CALLBACK
109static netif_ext_callback_t *ext_callback;
112#if !LWIP_SINGLE_NETIF
117#define netif_index_to_num(index) ((index) - 1)
120#if LWIP_NUM_NETIF_CLIENT_DATA > 0
121static u8_t netif_client_id;
124#define NETIF_REPORT_TYPE_IPV4 0x01
125#define NETIF_REPORT_TYPE_IPV6 0x02
129static err_t netif_null_output_ip6(
struct netif *
netif,
struct pbuf *
p,
const ip6_addr_t *ipaddr);
132static err_t netif_null_output_ip4(
struct netif *
netif,
struct pbuf *
p,
const ip4_addr_t *ipaddr);
144static struct netif loop_netif;
147struct netif* netif_get_loopif(
void)
174 netif->output = netif_loop_output_ipv4;
177 netif->output_ip6 = netif_loop_output_ipv6;
179#if LWIP_LOOPIF_MULTICAST
192#define LOOPIF_ADDRINIT &loop_ipaddr, &loop_netmask, &loop_gw,
193 ip4_addr_t loop_ipaddr, loop_netmask, loop_gw;
194 IP4_ADDR(&loop_gw, 127, 0, 0, 1);
195 IP4_ADDR(&loop_ipaddr, 127, 0, 0, 1);
196 IP4_ADDR(&loop_netmask, 255, 0, 0, 0);
198#define LOOPIF_ADDRINIT
202 netif_add(&loop_netif, LOOPIF_ADDRINIT
NULL, netif_loopif_init, ip_input);
209 loop_netif.ip6_addr_state[0] = IP6_ADDR_VALID;
237 return ethernet_input(
p, inp);
240 return ip_input(
p, inp);
289 const ip4_addr_t *ipaddr,
const ip4_addr_t *netmask,
const ip4_addr_t *gw,
310 if (ipaddr ==
NULL) {
311 ipaddr = ip_2_ip4(IP4_ADDR_ANY);
313 if (netmask ==
NULL) {
314 netmask = ip_2_ip4(IP4_ADDR_ANY);
317 gw = ip_2_ip4(IP4_ADDR_ANY);
321 ip_addr_set_zero_ip4(&
netif->ip_addr);
322 ip_addr_set_zero_ip4(&
netif->netmask);
323 ip_addr_set_zero_ip4(&
netif->gw);
324 netif->output = netif_null_output_ip4;
329 netif->ip6_addr_state[
i] = IP6_ADDR_INVALID;
330#if LWIP_IPV6_ADDRESS_LIFETIMES
331 netif->ip6_addr_valid_life[
i] = IP6_ADDR_LIFE_STATIC;
332 netif->ip6_addr_pref_life[
i] = IP6_ADDR_LIFE_STATIC;
335 netif->output_ip6 = netif_null_output_ip6;
340#ifdef netif_get_client_data
344#if LWIP_IPV6_AUTOCONFIG
346 netif->ip6_autoconfig_enabled = 1;
348 nd6_restart_netif(
netif);
350#if LWIP_NETIF_STATUS_CALLBACK
353#if LWIP_NETIF_LINK_CALLBACK
359#if LWIP_IPV6 && LWIP_IPV6_MLD
375#if LWIP_LOOPBACK_MAX_PBUFS
376 netif->loop_cnt_current = 0;
378#if LWIP_NETIF_LOOPBACK_MULTITHREADING
379 netif->reschedule_poll = 0;
384 netif_set_addr(
netif, ipaddr, netmask, gw);
391#if LWIP_IPV6 && LWIP_ND6_ALLOW_RA_UPDATES
397#if !LWIP_SINGLE_NETIF
404 struct netif *netif2;
414 LWIP_ASSERT(
"too many netifs, max. supported number is 255", num_netifs <= 255);
420 }
while (netif2 !=
NULL);
462 tcp_netif_ip_addr_changed(old_addr, new_addr);
465 udp_netif_ip_addr_changed(old_addr, new_addr);
468 raw_netif_ip_addr_changed(old_addr, new_addr);
480 if (ip4_addr_eq(ipaddr, netif_ip4_addr(
netif)) == 0) {
482 *ip_2_ip4(&new_addr) = *ipaddr;
491 acd_netif_ip_addr_changed(
netif, old_addr, &new_addr);
497 ip4_addr_set(ip_2_ip4(&
netif->ip_addr), ipaddr);
521netif_set_ipaddr(
struct netif *
netif,
const ip4_addr_t *ipaddr)
528 if (ipaddr ==
NULL) {
529 ipaddr = IP4_ADDR_ANY4;
534 if (netif_do_set_ipaddr(
netif, ipaddr, &old_addr)) {
535#if LWIP_NETIF_EXT_STATUS_CALLBACK
537 args.ipv4_changed.old_address = &old_addr;
547 if (ip4_addr_eq(netmask, netif_ip4_netmask(
netif)) == 0) {
548#if LWIP_NETIF_EXT_STATUS_CALLBACK
556 ip4_addr_set(ip_2_ip4(&
netif->netmask), netmask);
561 ip4_addr1_16(netif_ip4_netmask(
netif)),
562 ip4_addr2_16(netif_ip4_netmask(
netif)),
563 ip4_addr3_16(netif_ip4_netmask(
netif)),
564 ip4_addr4_16(netif_ip4_netmask(
netif))));
581netif_set_netmask(
struct netif *
netif,
const ip4_addr_t *netmask)
583#if LWIP_NETIF_EXT_STATUS_CALLBACK
594 if (netmask ==
NULL) {
595 netmask = IP4_ADDR_ANY4;
598 if (netif_do_set_netmask(
netif, netmask, old_nm)) {
599#if LWIP_NETIF_EXT_STATUS_CALLBACK
601 args.ipv4_changed.old_netmask = old_nm;
611 if (ip4_addr_eq(gw, netif_ip4_gw(
netif)) == 0) {
612#if LWIP_NETIF_EXT_STATUS_CALLBACK
619 ip4_addr_set(ip_2_ip4(&
netif->gw), gw);
623 ip4_addr1_16(netif_ip4_gw(
netif)),
624 ip4_addr2_16(netif_ip4_gw(
netif)),
625 ip4_addr3_16(netif_ip4_gw(
netif)),
626 ip4_addr4_16(netif_ip4_gw(
netif))));
642netif_set_gw(
struct netif *
netif,
const ip4_addr_t *gw)
644#if LWIP_NETIF_EXT_STATUS_CALLBACK
659 if (netif_do_set_gw(
netif, gw, old_gw)) {
660#if LWIP_NETIF_EXT_STATUS_CALLBACK
662 args.ipv4_changed.old_gw = old_gw;
679netif_set_addr(
struct netif *
netif,
const ip4_addr_t *ipaddr,
const ip4_addr_t *netmask,
680 const ip4_addr_t *gw)
682#if LWIP_NETIF_EXT_STATUS_CALLBACK
699 if (ipaddr ==
NULL) {
700 ipaddr = IP4_ADDR_ANY4;
702 if (netmask ==
NULL) {
703 netmask = IP4_ADDR_ANY4;
709 remove = ip4_addr_isany(ipaddr);
713 if (netif_do_set_ipaddr(
netif, ipaddr, &old_addr)) {
714#if LWIP_NETIF_EXT_STATUS_CALLBACK
720 if (netif_do_set_netmask(
netif, netmask, old_nm)) {
721#if LWIP_NETIF_EXT_STATUS_CALLBACK
726 if (netif_do_set_gw(
netif, gw, old_gw)) {
727#if LWIP_NETIF_EXT_STATUS_CALLBACK
734 if (netif_do_set_ipaddr(
netif, ipaddr, &old_addr)) {
735#if LWIP_NETIF_EXT_STATUS_CALLBACK
742#if LWIP_NETIF_EXT_STATUS_CALLBACK
779 if (!ip4_addr_isany_val(*netif_ip4_addr(
netif))) {
793 if (ip6_addr_isvalid(netif_ip6_addr_state(
netif,
i))) {
814#if !LWIP_SINGLE_NETIF
820 struct netif *tmp_netif;
827 if (tmp_netif ==
NULL) {
833#if LWIP_NETIF_REMOVE_CALLBACK
834 if (
netif->remove_callback) {
884#if LWIP_NETIF_EXT_STATUS_CALLBACK
887 args.status_changed.state = 1;
894 nd6_restart_netif(
netif);
914 !ip4_addr_isany_val(*netif_ip4_addr(
netif))) {
915#if LWIP_ARP && !LWIP_ACD
921 etharp_gratuitous(
netif);
928 igmp_report_groups(
netif);
938 mld6_report_groups(
netif);
956#if LWIP_NETIF_EXT_STATUS_CALLBACK
959 args.status_changed.state = 0;
967#if LWIP_IPV4 && LWIP_ARP
969 etharp_cleanup_netif(
netif);
974 nd6_cleanup_netif(
netif);
981#if LWIP_NETIF_STATUS_CALLBACK
997#if LWIP_NETIF_REMOVE_CALLBACK
1008 netif->remove_callback = remove_callback;
1028 dhcp_network_changed_link_up(
netif);
1032 autoip_network_changed_link_up(
netif);
1037 nd6_restart_netif(
netif);
1041#if LWIP_NETIF_EXT_STATUS_CALLBACK
1044 args.link_changed.state = 1;
1066 autoip_network_changed_link_down(
netif);
1070 acd_network_changed_link_down(
netif);
1073#if LWIP_IPV6 && LWIP_ND6_ALLOW_RA_UPDATES
1078#if LWIP_NETIF_EXT_STATUS_CALLBACK
1081 args.link_changed.state = 0;
1088#if LWIP_NETIF_LINK_CALLBACK
1099 netif->link_callback = link_callback;
1126#if LWIP_LOOPBACK_MAX_PBUFS
1133 struct netif *stats_if = &loop_netif;
1138#if LWIP_NETIF_LOOPBACK_MULTITHREADING
1139 u8_t schedule_poll = 0;
1154#if LWIP_LOOPBACK_MAX_PBUFS
1157 if (((
netif->loop_cnt_current + clen) <
netif->loop_cnt_current) ||
1190#if LWIP_NETIF_LOOPBACK_MULTITHREADING
1191 if (
netif->reschedule_poll) {
1193 netif->reschedule_poll = 0;
1199#if LWIP_NETIF_LOOPBACK_MULTITHREADING
1210#if LWIP_NETIF_LOOPBACK_MULTITHREADING
1212 if (schedule_poll) {
1215 netif->reschedule_poll = 1;
1230 return netif_loop_output(
netif,
p);
1239 return netif_loop_output(
netif,
p);
1258 struct netif *stats_if = &loop_netif;
1270 struct pbuf *
in, *in_end;
1271#if LWIP_LOOPBACK_MAX_PBUFS
1275 in = in_end =
netif->loop_first;
1278 in_end = in_end->
next;
1279#if LWIP_LOOPBACK_MAX_PBUFS
1283#if LWIP_LOOPBACK_MAX_PBUFS
1286 ((
netif->loop_cnt_current - clen) <
netif->loop_cnt_current));
1291 if (in_end ==
netif->loop_last) {
1317#if !LWIP_NETIF_LOOPBACK_MULTITHREADING
1333#if LWIP_NUM_NETIF_CLIENT_DATA > 0
1341netif_alloc_client_data_id(
void)
1348#if LWIP_NUM_NETIF_CLIENT_DATA > 256
1349#error LWIP_NUM_NETIF_CLIENT_DATA must be <= 256
1368netif_ip6_addr_set(
struct netif *
netif,
s8_t addr_idx,
const ip6_addr_t *addr6)
1375 netif_ip6_addr_set_parts(
netif, addr_idx, addr6->addr[0], addr6->addr[1],
1376 addr6->addr[2], addr6->addr[3]);
1398 ip6_addr_copy(*
ip_2_ip6(&old_addr), *netif_ip6_addr(
netif, addr_idx));
1406 IP_ADDR6(&new_ipaddr, i0, i1, i2, i3);
1407 ip6_addr_assign_zone(
ip_2_ip6(&new_ipaddr), IP6_UNICAST,
netif);
1409 if (ip6_addr_isvalid(netif_ip6_addr_state(
netif, addr_idx))) {
1416 if (ip6_addr_isvalid(netif_ip6_addr_state(
netif, addr_idx))) {
1421#if LWIP_NETIF_EXT_STATUS_CALLBACK
1424 args.ipv6_set.addr_index = addr_idx;
1425 args.ipv6_set.old_address = &old_addr;
1433 netif_ip6_addr_state(
netif, addr_idx)));
1454 old_state = netif_ip6_addr_state(
netif, addr_idx);
1456 if (old_state !=
state) {
1457 u8_t old_valid = old_state & IP6_ADDR_VALID;
1458 u8_t new_valid =
state & IP6_ADDR_VALID;
1464 nd6_adjust_mld_membership(
netif, addr_idx,
state);
1468 if (old_valid && !new_valid) {
1475 if (!old_valid && new_valid) {
1478 IP6_ADDR_ZONECHECK_NETIF(netif_ip6_addr(
netif, addr_idx),
netif);
1482 if ((old_state & ~IP6_ADDR_TENTATIVE_COUNT_MASK) !=
1483 (
state & ~IP6_ADDR_TENTATIVE_COUNT_MASK)) {
1488#if LWIP_NETIF_EXT_STATUS_CALLBACK
1491 args.ipv6_addr_state_changed.addr_index = addr_idx;
1492 args.ipv6_addr_state_changed.old_state = old_state;
1493 args.ipv6_addr_state_changed.address = netif_ip_addr6(
netif, addr_idx);
1500 netif_ip6_addr_state(
netif, addr_idx)));
1518netif_get_ip6_addr_match(
struct netif *
netif,
const ip6_addr_t *ip6addr)
1525 LWIP_ASSERT(
"netif_get_ip6_addr_match: invalid ip6addr", ip6addr !=
NULL);
1528 if (ip6_addr_has_zone(ip6addr) && !ip6_addr_test_zone(ip6addr,
netif)) {
1534 if (!ip6_addr_isinvalid(netif_ip6_addr_state(
netif,
i)) &&
1535 ip6_addr_zoneless_eq(netif_ip6_addr(
netif,
i), ip6addr)) {
1551netif_create_ip6_linklocal_address(
struct netif *
netif,
u8_t from_mac_48bit)
1564 if (from_mac_48bit) {
1599#if LWIP_IPV6_DUP_DETECT_ATTEMPTS
1601 netif_ip6_addr_set_state(
netif, 0, IP6_ADDR_TENTATIVE);
1604 netif_ip6_addr_set_state(
netif, 0, IP6_ADDR_PREFERRED);
1619netif_add_ip6_address(
struct netif *
netif,
const ip6_addr_t *ip6addr,
s8_t *chosen_idx)
1626 LWIP_ASSERT(
"netif_add_ip6_address: invalid ip6addr", ip6addr !=
NULL);
1628 i = netif_get_ip6_addr_match(
netif, ip6addr);
1631 if (chosen_idx !=
NULL) {
1639 if (ip6_addr_isinvalid(netif_ip6_addr_state(
netif,
i))) {
1642 netif_ip6_addr_set_state(
netif,
i, IP6_ADDR_TENTATIVE);
1643 if (chosen_idx !=
NULL) {
1650 if (chosen_idx !=
NULL) {
1659netif_null_output_ip6(
struct netif *
netif,
struct pbuf *
p,
const ip6_addr_t *ipaddr)
1673netif_null_output_ip4(
struct netif *
netif,
struct pbuf *
p,
const ip4_addr_t *ipaddr)
1767 if (!
num && (
name[2] !=
'0')) {
1784#if LWIP_NETIF_EXT_STATUS_CALLBACK
1811 netif_ext_callback_t *
last, *iter;
1816 if (ext_callback ==
NULL) {
1821 ext_callback = ext_callback->next;
1823 last = ext_callback;
1824 for (iter = ext_callback->next; iter !=
NULL;
last = iter, iter = iter->next) {
1844 netif_ext_callback_t *
callback = ext_callback;
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
#define SYS_ARCH_UNPROTECT(lev)
#define SYS_ARCH_PROTECT(lev)
#define SYS_ARCH_DECL_PROTECT(lev)
#define LWIP_DEBUGF(debug, message)
#define LWIP_ERROR(message, expression, handler)
#define LWIP_ASSERT(message, assertion)
#define MIB2_STATS_NETIF_ADD(n, x, val)
#define mib2_netif_added(ni)
#define MIB2_STATS_NETIF_INC(n, x)
#define mib2_add_route_ip4(dflt, ni)
#define MIB2_INIT_NETIF(netif, type, speed)
#define mib2_netif_removed(ni)
#define mib2_remove_route_ip4(dflt, ni)
#define MIB2_COPY_SYSUPTIME_TO(ptrToVal)
#define mib2_remove_ip4(ni)
void(* tcpip_callback_fn)(void *ctx)
GLdouble GLdouble GLdouble r
GLenum const GLvoid * addr
GLenum GLenum GLenum input
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define LWIP_UNUSED_ARG(x)
err_t netif_input(struct pbuf *p, struct netif *inp)
#define LWIP_IPV6_NUM_ADDRESSES
#define LWIP_ASSERT_CORE_LOCKED()
#define LWIP_LOOPBACK_MAX_PBUFS
#define LWIP_NUM_NETIF_CLIENT_DATA
err_t tcpip_input(struct pbuf *p, struct netif *inp)
err_t tcpip_try_callback(tcpip_callback_fn function, void *ctx)
#define NETIF_FLAG_LINK_UP
#define NETIF_FLAG_ETHERNET
#define NETIF_FLAG_ETHARP
char * netif_index_to_name(u8_t idx, char *name)
void netif_set_link_down(struct netif *netif)
struct netif * netif_find(const char *name)
void(* netif_ext_callback_fn)(struct netif *netif, netif_nsc_reason_t reason, const netif_ext_callback_args_t *args)
void netif_set_down(struct netif *netif)
#define netif_is_up(netif)
void netif_remove(struct netif *netif)
struct netif * netif_get_by_index(u8_t idx)
struct netif * netif_add(struct netif *netif, void *state, netif_init_fn init, netif_input_fn input)
u8_t netif_name_to_index(const char *name)
void netif_set_default(struct netif *netif)
void netif_set_link_up(struct netif *netif)
void netif_set_up(struct netif *netif)
struct netif * netif_add_noaddr(struct netif *netif, void *state, netif_init_fn init, netif_input_fn input)
struct pbuf * pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
u8_t pbuf_free(struct pbuf *p)
err_t pbuf_copy(struct pbuf *p_to, const struct pbuf *p_from)
void lwip_itoa(char *result, size_t bufsize, int number)
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
#define ip_addr_copy(dest, src)
#define IP_ADDR6(ipaddr, i0, i1, i2, i3)
#define IP_SET_TYPE_VAL(ipaddr, iptype)
#define ip_addr_copy_from_ip6(dest, src)
#define IP_ADDR6_HOST(ipaddr, i0, i1, i2, i3)
#define ip_addr_set_zero_ip6(ipaddr)
static IPrintDialogCallback callback
static void WINAPI status_callback(HINTERNET handle, DWORD_PTR ctx, DWORD status, LPVOID info, DWORD info_len)
static void netif_do_ip_addr_changed(const ip_addr_t *old_addr, const ip_addr_t *new_addr)
struct netif * netif_list
#define NETIF_REPORT_TYPE_IPV4
struct netif * netif_default
#define netif_index_to_num(index)
#define NETIF_STATUS_CALLBACK(n)
#define NETIF_REPORT_TYPE_IPV6
#define NETIF_LINK_CALLBACK(n)
static void netif_issue_reports(struct netif *netif, u8_t report_type)
#define LWIP_NSC_IPV6_ADDR_STATE_CHANGED
#define LWIP_NSC_IPV4_GATEWAY_CHANGED
err_t(* netif_init_fn)(struct netif *netif)
#define netif_set_flags(netif, set_flags)
void(* netif_status_callback_fn)(struct netif *netif)
#define LWIP_NSC_IPV4_SETTINGS_CHANGED
@ LWIP_NETIF_CLIENT_DATA_INDEX_MAX
#define LWIP_NSC_LINK_CHANGED
#define netif_invoke_ext_callback(netif, reason, args)
#define LWIP_NSC_STATUS_CHANGED
#define LWIP_NSC_IPV4_ADDR_VALID
#define netif_add_ext_callback(callback, fn)
#define LWIP_NSC_IPV6_SET
#define NETIF_FOREACH(netif)
#define NETIF_RESET_HINTS(netif)
err_t(* netif_input_fn)(struct pbuf *p, struct netif *inp)
#define NETIF_SET_CHECKSUM_CTRL(netif, chksumflags)
#define netif_get_index(netif)
#define netif_clear_flags(netif, clr_flags)
#define LWIP_NSC_IPV4_NETMASK_CHANGED
#define LWIP_NSC_NETIF_ADDED
#define netif_remove_ext_callback(callback)
#define LWIP_NSC_NETIF_REMOVED
#define LWIP_NSC_IPV4_ADDRESS_CHANGED
u16_t pbuf_clen(const struct pbuf *p)
static unsigned __int64 next
#define LINK_STATS_INC(x)
u8_t hwaddr[NETIF_MAX_HWADDR_LEN]
struct netif_ext_callback_args_t::ipv4_changed_s ipv4_changed
static GLenum _GLUfuncptr fn