[TCPIP]
[reactos.git] / reactos / lib / drivers / lwip / src / rosip.c
1 #include "lwip/sys.h"
2 #include "lwip/tcpip.h"
3
4 #include "rosip.h"
5
6 #include <debug.h>
7
8 typedef struct netif* PNETIF;
9
10 void
11 LibIPInsertPacket(void *ifarg,
12 const void *const data,
13 const u32_t size)
14 {
15 struct pbuf *p, *p1;
16 u32_t i;
17
18 ASSERT(ifarg);
19 ASSERT(data);
20 ASSERT(size > 0);
21
22 p = pbuf_alloc(PBUF_TRANSPORT, size, PBUF_POOL);
23 if (p)
24 {
25 for (i = 0, p1 = p; i < size; i += p1->len, p1 = p1->next)
26 {
27 ASSERT(p1);
28 RtlCopyMemory(p1->payload, ((PUCHAR)data) + i, p1->len);
29 }
30
31 ((PNETIF)ifarg)->input(p, (PNETIF)ifarg);
32 }
33 }
34
35 void
36 LibIPInitialize(void)
37 {
38 /* This completes asynchronously */
39 tcpip_init(NULL, NULL);
40 }
41
42 void
43 LibIPShutdown(void)
44 {
45 /* This is synchronous */
46 sys_shutdown();
47 }