1 #include <lwip/netif.h>
2 #include <lwip/tcpip.h>
3
4 typedef struct netif* PNETIF;
5
6 void
7 sys_shutdown(void);
8
9 void
LibIPInsertPacket(void * ifarg,const void * const data,const u32_t size)10 LibIPInsertPacket(void *ifarg,
11 const void *const data,
12 const u32_t size)
13 {
14 struct pbuf *p;
15
16 ASSERT(ifarg);
17 ASSERT(data);
18 ASSERT(size > 0);
19
20 p = pbuf_alloc(PBUF_RAW, size, PBUF_RAM);
21 if (p)
22 {
23 ASSERT(p->tot_len == p->len);
24 ASSERT(p->len == size);
25
26 RtlCopyMemory(p->payload, data, p->len);
27
28 ((PNETIF)ifarg)->input(p, (PNETIF)ifarg);
29 }
30 }
31
32 void
LibIPInitialize(void)33 LibIPInitialize(void)
34 {
35 /* This completes asynchronously */
36 tcpip_init(NULL, NULL);
37 }
38
39 void
LibIPShutdown(void)40 LibIPShutdown(void)
41 {
42 /* This is synchronous */
43 sys_shutdown();
44 }
45