2023-01-31 00:07:51 +00:00
|
|
|
#include <lwip/netif.h>
|
|
|
|
#include <lwip/tcpip.h>
|
2010-09-21 06:11:24 +00:00
|
|
|
|
2011-08-01 20:10:55 +00:00
|
|
|
typedef struct netif* PNETIF;
|
|
|
|
|
2023-01-31 00:07:51 +00:00
|
|
|
void
|
|
|
|
sys_shutdown(void);
|
|
|
|
|
2010-09-21 06:11:24 +00:00
|
|
|
void
|
|
|
|
LibIPInsertPacket(void *ifarg,
|
2011-07-11 17:33:17 +00:00
|
|
|
const void *const data,
|
|
|
|
const u32_t size)
|
2010-09-21 06:11:24 +00:00
|
|
|
{
|
2011-12-02 06:55:05 +00:00
|
|
|
struct pbuf *p;
|
|
|
|
|
2010-09-21 06:11:24 +00:00
|
|
|
ASSERT(ifarg);
|
|
|
|
ASSERT(data);
|
|
|
|
ASSERT(size > 0);
|
|
|
|
|
2011-12-02 06:55:05 +00:00
|
|
|
p = pbuf_alloc(PBUF_RAW, size, PBUF_RAM);
|
2010-09-21 06:11:24 +00:00
|
|
|
if (p)
|
|
|
|
{
|
2011-12-02 06:55:05 +00:00
|
|
|
ASSERT(p->tot_len == p->len);
|
|
|
|
ASSERT(p->len == size);
|
|
|
|
|
|
|
|
RtlCopyMemory(p->payload, data, p->len);
|
2010-09-21 06:11:24 +00:00
|
|
|
|
2011-08-01 20:10:55 +00:00
|
|
|
((PNETIF)ifarg)->input(p, (PNETIF)ifarg);
|
2010-09-21 06:11:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
LibIPInitialize(void)
|
|
|
|
{
|
|
|
|
/* This completes asynchronously */
|
|
|
|
tcpip_init(NULL, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
LibIPShutdown(void)
|
|
|
|
{
|
|
|
|
/* This is synchronous */
|
|
|
|
sys_shutdown();
|
2024-05-18 10:30:54 +00:00
|
|
|
}
|