ReactOS 0.4.16-dev-306-g647d351
Mainloop mode ("NO_SYS")
Collaboration diagram for Mainloop mode ("NO_SYS"):

Functions

void lwip_init (void)
 
err_t netif_input (struct pbuf *p, struct netif *inp)
 

Detailed Description

Use this mode if you do not run an OS on your system. #define NO_SYS to 1. Feed incoming packets to netif->input(pbuf, netif) function from mainloop, not from interrupt context. You can allocate a Packet buffers (PBUF) in interrupt context and put them into a queue which is processed from mainloop.
Call sys_check_timeouts() periodically in the mainloop.
Porting: implement all functions in Time, Critical sections and Compiler/platform abstraction.
You can only use "raw" APIs in this mode.
Sample code:

Function Documentation

◆ lwip_init()

void lwip_init ( void  )

Initialize all modules. Use this in NO_SYS mode. Use tcpip_init() otherwise.

Definition at line 339 of file init.c.

340{
341#ifndef LWIP_SKIP_CONST_CHECK
342 int a = 0;
344 LWIP_ASSERT("LWIP_CONST_CAST not implemented correctly. Check your lwIP port.", LWIP_CONST_CAST(void *, &a) == &a);
345#endif
346#ifndef LWIP_SKIP_PACKING_CHECK
347 LWIP_ASSERT("Struct packing not implemented correctly. Check your lwIP port.", sizeof(struct packed_struct_test) == PACKED_STRUCT_TEST_EXPECTED_SIZE);
348#endif
349
350 /* Modules initialization */
351 stats_init();
352#if !NO_SYS
353 sys_init();
354#endif /* !NO_SYS */
355 mem_init();
356 memp_init();
357 pbuf_init();
358 netif_init();
359#if LWIP_IPV4
360 ip_init();
361#if LWIP_ARP
362 etharp_init();
363#endif /* LWIP_ARP */
364#endif /* LWIP_IPV4 */
365#if LWIP_RAW
366 raw_init();
367#endif /* LWIP_RAW */
368#if LWIP_UDP
369 udp_init();
370#endif /* LWIP_UDP */
371#if LWIP_TCP
372 tcp_init();
373#endif /* LWIP_TCP */
374#if LWIP_IGMP
375 igmp_init();
376#endif /* LWIP_IGMP */
377#if LWIP_DNS
378 dns_init();
379#endif /* LWIP_DNS */
380#if PPP_SUPPORT
381 ppp_init();
382#endif
383
384#if LWIP_TIMERS
385 sys_timeouts_init();
386#endif /* LWIP_TIMERS */
387}
STREAM tcp_init(uint32 maxlen)
Definition: tcp.c:82
#define PACKED_STRUCT_TEST_EXPECTED_SIZE
Definition: init.c:78
void mem_init(void)
Definition: mem.c:516
#define LWIP_ASSERT(message, assertion)
Definition: debug.h:116
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define LWIP_UNUSED_ARG(x)
Definition: arch.h:373
#define LWIP_CONST_CAST(target_type, val)
Definition: arch.h:240
void sys_init(void)
Definition: sys_arch.c:305
void memp_init(void)
Definition: memp.c:224
void netif_init(void)
Definition: netif.c:188
#define pbuf_init()
Definition: pbuf.h:273
#define stats_init()
Definition: stats.h:318

Referenced by lwip_fuzztest(), main(), and tcpip_init().

◆ netif_input()

err_t netif_input ( struct pbuf p,
struct netif inp 
)

Forwards a received packet for input processing with ethernet_input() or ip_input() depending on netif flags. Don't call directly, pass to netif_add() and call netif->input(). Only works if the netif driver correctly sets NETIF_FLAG_ETHARP and/or NETIF_FLAG_ETHERNET flag!

Definition at line 228 of file netif.c.

229{
231
232 LWIP_ASSERT("netif_input: invalid pbuf", p != NULL);
233 LWIP_ASSERT("netif_input: invalid netif", inp != NULL);
234
235#if LWIP_ETHERNET
237 return ethernet_input(p, inp);
238 } else
239#endif /* LWIP_ETHERNET */
240 return ip_input(p, inp);
241}
#define NULL
Definition: types.h:112
GLfloat GLfloat p
Definition: glext.h:8902
#define LWIP_ASSERT_CORE_LOCKED()
Definition: opt.h:227
#define NETIF_FLAG_ETHERNET
Definition: netif.h:101
#define NETIF_FLAG_ETHARP
Definition: netif.h:97
u8_t flags
Definition: netif.h:354

Referenced by main().