ReactOS  0.4.15-dev-1152-g6c94e4f
netif.c
Go to the documentation of this file.
1 
7 /*
8  * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without modification,
12  * are permitted provided that the following conditions are met:
13  *
14  * 1. Redistributions of source code must retain the above copyright notice,
15  * this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright notice,
17  * this list of conditions and the following disclaimer in the documentation
18  * and/or other materials provided with the distribution.
19  * 3. The name of the author may not be used to endorse or promote products
20  * derived from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
23  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
25  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
27  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
30  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
31  * OF SUCH DAMAGE.
32  *
33  * This file is part of the lwIP TCP/IP stack.
34  *
35  * Author: Adam Dunkels <adam@sics.se>
36  *
37  */
38 
39 #include "lwip/opt.h"
40 
41 #include "lwip/def.h"
42 #include "lwip/ip_addr.h"
43 #include "lwip/netif.h"
44 #include "lwip/tcp_impl.h"
45 #include "lwip/snmp.h"
46 #include "lwip/igmp.h"
47 #include "netif/etharp.h"
48 #include "lwip/stats.h"
49 #if ENABLE_LOOPBACK
50 #include "lwip/sys.h"
51 #if LWIP_NETIF_LOOPBACK_MULTITHREADING
52 #include "lwip/tcpip.h"
53 #endif /* LWIP_NETIF_LOOPBACK_MULTITHREADING */
54 #endif /* ENABLE_LOOPBACK */
55 
56 #if LWIP_AUTOIP
57 #include "lwip/autoip.h"
58 #endif /* LWIP_AUTOIP */
59 #if LWIP_DHCP
60 #include "lwip/dhcp.h"
61 #endif /* LWIP_DHCP */
62 
63 #if LWIP_NETIF_STATUS_CALLBACK
64 #define NETIF_STATUS_CALLBACK(n) do{ if (n->status_callback) { (n->status_callback)(n); }}while(0)
65 #else
66 #define NETIF_STATUS_CALLBACK(n)
67 #endif /* LWIP_NETIF_STATUS_CALLBACK */
68 
69 #if LWIP_NETIF_LINK_CALLBACK
70 #define NETIF_LINK_CALLBACK(n) do{ if (n->link_callback) { (n->link_callback)(n); }}while(0)
71 #else
72 #define NETIF_LINK_CALLBACK(n)
73 #endif /* LWIP_NETIF_LINK_CALLBACK */
74 
75 struct netif *netif_list;
77 
78 static u8_t netif_num;
79 
80 #if LWIP_HAVE_LOOPIF
81 static struct netif loop_netif;
82 
90 static err_t
91 netif_loopif_init(struct netif *netif)
92 {
93  /* initialize the snmp variables and counters inside the struct netif
94  * ifSpeed: no assumption can be made!
95  */
97 
98  netif->name[0] = 'l';
99  netif->name[1] = 'o';
100  netif->output = netif_loop_output;
101  return ERR_OK;
102 }
103 #endif /* LWIP_HAVE_LOOPIF */
104 
105 void
107 {
108 #if LWIP_HAVE_LOOPIF
109  ip_addr_t loop_ipaddr, loop_netmask, loop_gw;
110  IP4_ADDR(&loop_gw, 127,0,0,1);
111  IP4_ADDR(&loop_ipaddr, 127,0,0,1);
112  IP4_ADDR(&loop_netmask, 255,0,0,0);
113 
114 #if NO_SYS
115  netif_add(&loop_netif, &loop_ipaddr, &loop_netmask, &loop_gw, NULL, netif_loopif_init, ip_input);
116 #else /* NO_SYS */
117  netif_add(&loop_netif, &loop_ipaddr, &loop_netmask, &loop_gw, NULL, netif_loopif_init, tcpip_input);
118 #endif /* NO_SYS */
119  netif_set_up(&loop_netif);
120 
121 #endif /* LWIP_HAVE_LOOPIF */
122 }
123 
138 struct netif *
141 {
142 
143  LWIP_ASSERT("No init function given", init != NULL);
144 
145  /* reset new interface configuration state */
149  netif->flags = 0;
150 #if LWIP_DHCP
151  /* netif not under DHCP control by default */
152  netif->dhcp = NULL;
153 #endif /* LWIP_DHCP */
154 #if LWIP_AUTOIP
155  /* netif not under AutoIP control by default */
156  netif->autoip = NULL;
157 #endif /* LWIP_AUTOIP */
158 #if LWIP_NETIF_STATUS_CALLBACK
159  netif->status_callback = NULL;
160 #endif /* LWIP_NETIF_STATUS_CALLBACK */
161 #if LWIP_NETIF_LINK_CALLBACK
162  netif->link_callback = NULL;
163 #endif /* LWIP_NETIF_LINK_CALLBACK */
164 #if LWIP_IGMP
165  netif->igmp_mac_filter = NULL;
166 #endif /* LWIP_IGMP */
167 #if ENABLE_LOOPBACK
168  netif->loop_first = NULL;
169  netif->loop_last = NULL;
170 #endif /* ENABLE_LOOPBACK */
171 
172  /* remember netif specific state information data */
173  netif->state = state;
174  netif->num = netif_num++;
175  netif->input = input;
177 #if ENABLE_LOOPBACK && LWIP_LOOPBACK_MAX_PBUFS
178  netif->loop_cnt_current = 0;
179 #endif /* ENABLE_LOOPBACK && LWIP_LOOPBACK_MAX_PBUFS */
180 
181  netif_set_addr(netif, ipaddr, netmask, gw);
182 
183  /* call user specified initialization function for netif */
184  if (init(netif) != ERR_OK) {
185  return NULL;
186  }
187 
188  /* add this netif to the list */
189  netif->next = netif_list;
190  netif_list = netif;
191  snmp_inc_iflist();
192 
193 #if LWIP_IGMP
194  /* start IGMP processing */
195  if (netif->flags & NETIF_FLAG_IGMP) {
196  igmp_start(netif);
197  }
198 #endif /* LWIP_IGMP */
199 
200  LWIP_DEBUGF(NETIF_DEBUG, ("netif: added interface %c%c IP addr ",
201  netif->name[0], netif->name[1]));
203  LWIP_DEBUGF(NETIF_DEBUG, (" netmask "));
205  LWIP_DEBUGF(NETIF_DEBUG, (" gw "));
207  LWIP_DEBUGF(NETIF_DEBUG, ("\n"));
208  return netif;
209 }
210 
220 void
222  ip_addr_t *gw)
223 {
224  netif_set_ipaddr(netif, ipaddr);
227 }
228 
234 void
236 {
237  if (netif == NULL) {
238  return;
239  }
240 
241 #if LWIP_IGMP
242  /* stop IGMP processing */
243  if (netif->flags & NETIF_FLAG_IGMP) {
244  igmp_stop(netif);
245  }
246 #endif /* LWIP_IGMP */
247  if (netif_is_up(netif)) {
248  /* set netif down before removing (call callback function) */
250  }
251 
253 
254  /* is it the first netif? */
255  if (netif_list == netif) {
256  netif_list = netif->next;
257  } else {
258  /* look for netif further down the list */
259  struct netif * tmpNetif;
260  for (tmpNetif = netif_list; tmpNetif != NULL; tmpNetif = tmpNetif->next) {
261  if (tmpNetif->next == netif) {
262  tmpNetif->next = netif->next;
263  break;
264  }
265  }
266  if (tmpNetif == NULL)
267  return; /* we didn't find any netif today */
268  }
269  snmp_dec_iflist();
270  /* this netif is default? */
271  if (netif_default == netif) {
272  /* reset default netif */
274  }
275 #if LWIP_NETIF_REMOVE_CALLBACK
276  if (netif->remove_callback) {
277  netif->remove_callback(netif);
278  }
279 #endif /* LWIP_NETIF_REMOVE_CALLBACK */
280  LWIP_DEBUGF( NETIF_DEBUG, ("netif_remove: removed netif\n") );
281 }
282 
289 struct netif *
291 {
292  struct netif *netif;
293  u8_t num;
294 
295  if (name == NULL) {
296  return NULL;
297  }
298 
299  num = name[2] - '0';
300 
301  for(netif = netif_list; netif != NULL; netif = netif->next) {
302  if (num == netif->num &&
303  name[0] == netif->name[0] &&
304  name[1] == netif->name[1]) {
305  LWIP_DEBUGF(NETIF_DEBUG, ("netif_find: found %c%c\n", name[0], name[1]));
306  return netif;
307  }
308  }
309  LWIP_DEBUGF(NETIF_DEBUG, ("netif_find: didn't find %c%c\n", name[0], name[1]));
310  return NULL;
311 }
312 
322 void
324 {
325  /* TODO: Handling of obsolete pcbs */
326  /* See: http://mail.gnu.org/archive/html/lwip-users/2003-03/msg00118.html */
327 #if LWIP_TCP
328  struct tcp_pcb *pcb;
329  struct tcp_pcb_listen *lpcb;
330 
331  /* address is actually being changed? */
332  if (ipaddr && (ip_addr_cmp(ipaddr, &(netif->ip_addr))) == 0) {
333  /* extern struct tcp_pcb *tcp_active_pcbs; defined by tcp.h */
334  LWIP_DEBUGF(NETIF_DEBUG | LWIP_DBG_STATE, ("netif_set_ipaddr: netif address being changed\n"));
335  pcb = tcp_active_pcbs;
336  while (pcb != NULL) {
337  /* PCB bound to current local interface address? */
338  if (ip_addr_cmp(&(pcb->local_ip), &(netif->ip_addr))
339 #if LWIP_AUTOIP
340  /* connections to link-local addresses must persist (RFC3927 ch. 1.9) */
341  && !ip_addr_islinklocal(&(pcb->local_ip))
342 #endif /* LWIP_AUTOIP */
343  ) {
344  /* this connection must be aborted */
345  struct tcp_pcb *next = pcb->next;
346  LWIP_DEBUGF(NETIF_DEBUG | LWIP_DBG_STATE, ("netif_set_ipaddr: aborting TCP pcb %p\n", (void *)pcb));
347  tcp_abort(pcb);
348  pcb = next;
349  } else {
350  pcb = pcb->next;
351  }
352  }
353  for (lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) {
354  /* PCB bound to current local interface address? */
355  if ((!(ip_addr_isany(&(lpcb->local_ip)))) &&
356  (ip_addr_cmp(&(lpcb->local_ip), &(netif->ip_addr)))) {
357  /* The PCB is listening to the old ipaddr and
358  * is set to listen to the new one instead */
359  ip_addr_set(&(lpcb->local_ip), ipaddr);
360  }
361  }
362  }
363 #endif
366  /* set new IP address to netif */
367  ip_addr_set(&(netif->ip_addr), ipaddr);
370 
371  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",
372  netif->name[0], netif->name[1],
377 }
378 
387 void
389 {
390  ip_addr_set(&(netif->gw), gw);
391  LWIP_DEBUGF(NETIF_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("netif: GW address of interface %c%c set to %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n",
392  netif->name[0], netif->name[1],
393  ip4_addr1_16(&netif->gw),
394  ip4_addr2_16(&netif->gw),
395  ip4_addr3_16(&netif->gw),
396  ip4_addr4_16(&netif->gw)));
397 }
398 
408 void
410 {
412  /* set new netmask to netif */
413  ip_addr_set(&(netif->netmask), netmask);
415  LWIP_DEBUGF(NETIF_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("netif: netmask of interface %c%c set to %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n",
416  netif->name[0], netif->name[1],
421 }
422 
429 void
431 {
432  if (netif == NULL) {
433  /* remove default route */
435  } else {
436  /* install default route */
438  }
440  LWIP_DEBUGF(NETIF_DEBUG, ("netif: setting default interface %c%c\n",
441  netif ? netif->name[0] : '\'', netif ? netif->name[1] : '\''));
442 }
443 
453 void netif_set_up(struct netif *netif)
454 {
455  if (!(netif->flags & NETIF_FLAG_UP)) {
457 
458 #if LWIP_SNMP
460 #endif /* LWIP_SNMP */
461 
463 
464  if (netif->flags & NETIF_FLAG_LINK_UP) {
465 #if LWIP_ARP
466  /* For Ethernet network interfaces, we would like to send a "gratuitous ARP" */
467  if (netif->flags & (NETIF_FLAG_ETHARP)) {
468  etharp_gratuitous(netif);
469  }
470 #endif /* LWIP_ARP */
471 
472 #if LWIP_IGMP
473  /* resend IGMP memberships */
474  if (netif->flags & NETIF_FLAG_IGMP) {
475  igmp_report_groups( netif);
476  }
477 #endif /* LWIP_IGMP */
478  }
479  }
480 }
481 
491 {
492  if (netif->flags & NETIF_FLAG_UP) {
494 #if LWIP_SNMP
496 #endif
497 
498 #if LWIP_ARP
499  if (netif->flags & NETIF_FLAG_ETHARP) {
500  etharp_cleanup_netif(netif);
501  }
502 #endif /* LWIP_ARP */
504  }
505 }
506 
507 #if LWIP_NETIF_STATUS_CALLBACK
508 
511 void netif_set_status_callback(struct netif *netif, netif_status_callback_fn status_callback)
512 {
513  if (netif) {
514  netif->status_callback = status_callback;
515  }
516 }
517 #endif /* LWIP_NETIF_STATUS_CALLBACK */
518 
519 #if LWIP_NETIF_REMOVE_CALLBACK
520 
523 void
524 netif_set_remove_callback(struct netif *netif, netif_status_callback_fn remove_callback)
525 {
526  if (netif) {
527  netif->remove_callback = remove_callback;
528  }
529 }
530 #endif /* LWIP_NETIF_REMOVE_CALLBACK */
531 
536 {
537  if (!(netif->flags & NETIF_FLAG_LINK_UP)) {
539 
540 #if LWIP_DHCP
541  if (netif->dhcp) {
542  dhcp_network_changed(netif);
543  }
544 #endif /* LWIP_DHCP */
545 
546 #if LWIP_AUTOIP
547  if (netif->autoip) {
548  autoip_network_changed(netif);
549  }
550 #endif /* LWIP_AUTOIP */
551 
552  if (netif->flags & NETIF_FLAG_UP) {
553 #if LWIP_ARP
554  /* For Ethernet network interfaces, we would like to send a "gratuitous ARP" */
555  if (netif->flags & NETIF_FLAG_ETHARP) {
556  etharp_gratuitous(netif);
557  }
558 #endif /* LWIP_ARP */
559 
560 #if LWIP_IGMP
561  /* resend IGMP memberships */
562  if (netif->flags & NETIF_FLAG_IGMP) {
563  igmp_report_groups( netif);
564  }
565 #endif /* LWIP_IGMP */
566  }
568  }
569 }
570 
575 {
576  if (netif->flags & NETIF_FLAG_LINK_UP) {
579  }
580 }
581 
582 #if LWIP_NETIF_LINK_CALLBACK
583 
586 void netif_set_link_callback(struct netif *netif, netif_status_callback_fn link_callback)
587 {
588  if (netif) {
589  netif->link_callback = link_callback;
590  }
591 }
592 #endif /* LWIP_NETIF_LINK_CALLBACK */
593 
594 #if ENABLE_LOOPBACK
595 
609 err_t
610 netif_loop_output(struct netif *netif, struct pbuf *p,
611  ip_addr_t *ipaddr)
612 {
613  struct pbuf *r;
614  err_t err;
615  struct pbuf *last;
616 #if LWIP_LOOPBACK_MAX_PBUFS
617  u8_t clen = 0;
618 #endif /* LWIP_LOOPBACK_MAX_PBUFS */
619  /* If we have a loopif, SNMP counters are adjusted for it,
620  * if not they are adjusted for 'netif'. */
621 #if LWIP_SNMP
622 #if LWIP_HAVE_LOOPIF
623  struct netif *stats_if = &loop_netif;
624 #else /* LWIP_HAVE_LOOPIF */
625  struct netif *stats_if = netif;
626 #endif /* LWIP_HAVE_LOOPIF */
627 #endif /* LWIP_SNMP */
629  LWIP_UNUSED_ARG(ipaddr);
630 
631  /* Allocate a new pbuf */
632  r = pbuf_alloc(PBUF_LINK, p->tot_len, PBUF_RAM);
633  if (r == NULL) {
634  LINK_STATS_INC(link.memerr);
635  LINK_STATS_INC(link.drop);
636  snmp_inc_ifoutdiscards(stats_if);
637  return ERR_MEM;
638  }
639 #if LWIP_LOOPBACK_MAX_PBUFS
640  clen = pbuf_clen(r);
641  /* check for overflow or too many pbuf on queue */
642  if(((netif->loop_cnt_current + clen) < netif->loop_cnt_current) ||
643  ((netif->loop_cnt_current + clen) > LWIP_LOOPBACK_MAX_PBUFS)) {
644  pbuf_free(r);
645  LINK_STATS_INC(link.memerr);
646  LINK_STATS_INC(link.drop);
647  snmp_inc_ifoutdiscards(stats_if);
648  return ERR_MEM;
649  }
650  netif->loop_cnt_current += clen;
651 #endif /* LWIP_LOOPBACK_MAX_PBUFS */
652 
653  /* Copy the whole pbuf queue p into the single pbuf r */
654  if ((err = pbuf_copy(r, p)) != ERR_OK) {
655  pbuf_free(r);
656  LINK_STATS_INC(link.memerr);
657  LINK_STATS_INC(link.drop);
658  snmp_inc_ifoutdiscards(stats_if);
659  return err;
660  }
661 
662  /* Put the packet on a linked list which gets emptied through calling
663  netif_poll(). */
664 
665  /* let last point to the last pbuf in chain r */
666  for (last = r; last->next != NULL; last = last->next);
667 
668  SYS_ARCH_PROTECT(lev);
669  if(netif->loop_first != NULL) {
670  LWIP_ASSERT("if first != NULL, last must also be != NULL", netif->loop_last != NULL);
671  netif->loop_last->next = r;
672  netif->loop_last = last;
673  } else {
674  netif->loop_first = r;
675  netif->loop_last = last;
676  }
677  SYS_ARCH_UNPROTECT(lev);
678 
679  LINK_STATS_INC(link.xmit);
680  snmp_add_ifoutoctets(stats_if, p->tot_len);
681  snmp_inc_ifoutucastpkts(stats_if);
682 
683 #if LWIP_NETIF_LOOPBACK_MULTITHREADING
684  /* For multithreading environment, schedule a call to netif_poll */
685  tcpip_callback((tcpip_callback_fn)netif_poll, netif);
686 #endif /* LWIP_NETIF_LOOPBACK_MULTITHREADING */
687 
688  return ERR_OK;
689 }
690 
697 void
698 netif_poll(struct netif *netif)
699 {
700  struct pbuf *in;
701  /* If we have a loopif, SNMP counters are adjusted for it,
702  * if not they are adjusted for 'netif'. */
703 #if LWIP_SNMP
704 #if LWIP_HAVE_LOOPIF
705  struct netif *stats_if = &loop_netif;
706 #else /* LWIP_HAVE_LOOPIF */
707  struct netif *stats_if = netif;
708 #endif /* LWIP_HAVE_LOOPIF */
709 #endif /* LWIP_SNMP */
711 
712  do {
713  /* Get a packet from the list. With SYS_LIGHTWEIGHT_PROT=1, this is protected */
714  SYS_ARCH_PROTECT(lev);
715  in = netif->loop_first;
716  if (in != NULL) {
717  struct pbuf *in_end = in;
718 #if LWIP_LOOPBACK_MAX_PBUFS
719  u8_t clen = pbuf_clen(in);
720  /* adjust the number of pbufs on queue */
721  LWIP_ASSERT("netif->loop_cnt_current underflow",
722  ((netif->loop_cnt_current - clen) < netif->loop_cnt_current));
723  netif->loop_cnt_current -= clen;
724 #endif /* LWIP_LOOPBACK_MAX_PBUFS */
725  while (in_end->len != in_end->tot_len) {
726  LWIP_ASSERT("bogus pbuf: len != tot_len but next == NULL!", in_end->next != NULL);
727  in_end = in_end->next;
728  }
729  /* 'in_end' now points to the last pbuf from 'in' */
730  if (in_end == netif->loop_last) {
731  /* this was the last pbuf in the list */
732  netif->loop_first = netif->loop_last = NULL;
733  } else {
734  /* pop the pbuf off the list */
735  netif->loop_first = in_end->next;
736  LWIP_ASSERT("should not be null since first != last!", netif->loop_first != NULL);
737  }
738  /* De-queue the pbuf from its successors on the 'loop_' list. */
739  in_end->next = NULL;
740  }
741  SYS_ARCH_UNPROTECT(lev);
742 
743  if (in != NULL) {
744  LINK_STATS_INC(link.recv);
745  snmp_add_ifinoctets(stats_if, in->tot_len);
746  snmp_inc_ifinucastpkts(stats_if);
747  /* loopback packets are always IP packets! */
748  if (ip_input(in, netif) != ERR_OK) {
749  pbuf_free(in);
750  }
751  /* Don't reference the packet any more! */
752  in = NULL;
753  }
754  /* go on while there is a packet on the list */
755  } while (netif->loop_first != NULL);
756 }
757 
758 #if !LWIP_NETIF_LOOPBACK_MULTITHREADING
759 
762 void
763 netif_poll_all(void)
764 {
765  struct netif *netif = netif_list;
766  /* loop through netifs */
767  while (netif != NULL) {
768  netif_poll(netif);
769  /* proceed to next network interface */
770  netif = netif->next;
771  }
772 }
773 #endif /* !LWIP_NETIF_LOOPBACK_MULTITHREADING */
774 #endif /* ENABLE_LOOPBACK */
#define ip_addr_islinklocal(addr1)
Definition: ip_addr.h:210
err_t(* netif_input_fn)(struct pbuf *p, struct netif *inp)
Definition: netif.h:109
#define snmp_add_ifinoctets(ni, value)
Definition: snmp.h:245
u16_t tot_len
Definition: pbuf.h:93
#define snmp_add_ifoutoctets(ni, value)
Definition: snmp.h:249
struct netif * netif_list
Definition: netif.c:75
void(* netif_status_callback_fn)(struct netif *netif)
Definition: netif.h:128
#define tcpip_callback(f, ctx)
Definition: tcpip.h:102
struct pbuf * next
Definition: pbuf.h:81
u16_t len
Definition: pbuf.h:96
void netif_set_gw(struct netif *netif, ip_addr_t *gw)
Definition: netif.c:388
POINT last
Definition: font.c:46
struct netif * netif_default
Definition: netif.c:76
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define NETIF_FLAG_UP
Definition: netif.h:69
void netif_set_link_down(struct netif *netif)
Definition: netif.c:574
err_t ip_input(struct pbuf *p, struct netif *inp)
Definition: ip.c:305
#define ip4_addr1_16(ipaddr)
Definition: ip_addr.h:226
#define snmp_get_sysuptime(value)
Definition: snmp.h:239
#define NETIF_FLAG_LINK_UP
Definition: netif.h:84
typedefPACK_STRUCT_END struct ip_addr ip_addr_t
Definition: ip_addr.h:64
netif_output_fn output
Definition: netif.h:151
#define NETIF_DEBUG
Definition: opt.h:1905
void netif_set_default(struct netif *netif)
Definition: netif.c:430
u8_t num
Definition: netif.h:196
#define LWIP_ASSERT(message, assertion)
Definition: debug.h:66
static int init
Definition: wintirpc.c:33
#define snmp_dec_iflist()
Definition: snmp.h:254
static void WINAPI status_callback(HINTERNET handle, DWORD_PTR ctx, DWORD status, LPVOID info, DWORD info_len)
Definition: ftp.c:950
struct pbuf * pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
Definition: pbuf.c:207
Definition: pbuf.h:58
void netif_init(void)
Definition: netif.c:106
#define IP4_ADDR(ipaddr, a, b, c, d)
Definition: ip_addr.h:139
void netif_set_up(struct netif *netif)
Definition: netif.c:453
Definition: pbuf.h:53
struct netif * netif_find(char *name)
Definition: netif.c:290
#define NETIF_STATUS_CALLBACK(n)
Definition: netif.c:66
smooth NULL
Definition: ftsmooth.c:416
u8_t pbuf_free(struct pbuf *p)
Definition: pbuf.c:618
s8_t err_t
Definition: err.h:47
err_t pbuf_copy(struct pbuf *p_to, struct pbuf *p_from)
Definition: pbuf.c:852
#define LWIP_DEBUGF(debug, message)
Definition: debug.h:95
#define ip_addr_set_zero(ipaddr)
Definition: ip_addr.h:168
ip_addr_t gw
Definition: netif.h:143
#define ip4_addr2_16(ipaddr)
Definition: ip_addr.h:227
#define NETIF_FLAG_ETHARP
Definition: netif.h:88
#define U16_F
Definition: cc.h:36
#define snmp_delete_ipaddridx_tree(ni)
Definition: snmp.h:279
#define snmp_insert_iprteidx_tree(dflt, ni)
Definition: snmp.h:280
struct netif * netif_add(struct netif *netif, ip_addr_t *ipaddr, ip_addr_t *netmask, ip_addr_t *gw, void *state, netif_init_fn init, netif_input_fn input)
Definition: netif.c:139
#define ERR_OK
Definition: err.h:52
struct netif * next
Definition: netif.h:138
err_t tcpip_input(struct pbuf *p, struct netif *inp)
Definition: tcpip.c:162
#define NETIF_SET_HWADDRHINT(netif, hint)
Definition: netif.h:321
Definition: pbuf.h:79
u8_t flags
Definition: netif.h:192
#define snmp_insert_ipaddridx_tree(ni)
Definition: snmp.h:278
void(* tcpip_callback_fn)(void *ctx)
Definition: tcpip.h:78
#define LINK_STATS_INC(x)
Definition: stats.h:227
#define ip_addr_debug_print(debug, ipaddr)
Definition: ip_addr.h:212
Definition: netif.h:136
GLuint GLuint num
Definition: glext.h:9618
void netif_remove(struct netif *netif)
Definition: netif.c:235
err_t(* netif_init_fn)(struct netif *netif)
Definition: netif.h:102
#define SYS_ARCH_PROTECT(lev)
Definition: cc.h:55
#define NETIF_FLAG_IGMP
Definition: netif.h:95
#define snmp_inc_ifoutucastpkts(ni)
Definition: snmp.h:250
ip_addr_t ip_addr
Definition: netif.h:141
#define snmp_inc_ifoutdiscards(ni)
Definition: snmp.h:252
#define ip4_addr3_16(ipaddr)
Definition: ip_addr.h:228
static u8_t netif_num
Definition: netif.c:78
static int state
Definition: maze.c:121
#define snmp_inc_iflist()
Definition: snmp.h:253
#define err(...)
#define LWIP_AUTOIP
Definition: opt.h:701
#define NETIF_INIT_SNMP(netif, type, speed)
Definition: netif.h:248
void netif_set_down(struct netif *netif)
Definition: netif.c:490
#define ip4_addr4_16(ipaddr)
Definition: ip_addr.h:229
static unsigned __int64 next
Definition: rand_nt.c:6
void netif_set_ipaddr(struct netif *netif, ip_addr_t *ipaddr)
Definition: netif.c:323
u8_t pbuf_clen(struct pbuf *p)
Definition: pbuf.c:704
GLenum GLenum GLenum input
Definition: glext.h:9031
#define ip_addr_set(dest, src)
Definition: ip_addr.h:164
GLuint in
Definition: glext.h:9616
#define ip_addr_isany(addr1)
Definition: ip_addr.h:200
#define ip_addr_cmp(addr1, addr2)
Definition: ip_addr.h:198
#define ERR_MEM
Definition: fontsub.h:52
void * state
Definition: netif.h:172
#define NETIF_LINK_CALLBACK(n)
Definition: netif.c:72
unsigned char u8_t
Definition: cc.h:23
#define snmp_delete_iprteidx_tree(dflt, ni)
Definition: snmp.h:281
#define LWIP_DBG_TRACE
Definition: debug.h:57
#define LWIP_LOOPBACK_MAX_PBUFS
Definition: opt.h:1175
netif_input_fn input
Definition: netif.h:147
#define SYS_ARCH_DECL_PROTECT(lev)
Definition: cc.h:54
void netif_set_netmask(struct netif *netif, ip_addr_t *netmask)
Definition: netif.c:409
char name[2]
Definition: netif.h:194
Definition: name.c:38
#define LWIP_DBG_STATE
Definition: debug.h:59
#define SYS_ARCH_UNPROTECT(lev)
Definition: cc.h:56
void netif_set_link_up(struct netif *netif)
Definition: netif.c:535
#define snmp_inc_ifinucastpkts(ni)
Definition: snmp.h:246
ip_addr_t netmask
Definition: netif.h:142
#define netif_is_up(netif)
Definition: netif.h:282
const WCHAR * link
Definition: db.cpp:989
GLfloat GLfloat p
Definition: glext.h:8902
#define LWIP_UNUSED_ARG(x)
Definition: arch.h:73
void netif_set_addr(struct netif *netif, ip_addr_t *ipaddr, ip_addr_t *netmask, ip_addr_t *gw)
Definition: netif.c:221