[lwIP] Add IPv4 input hook
This commit is contained in:
parent
1512da3b03
commit
15231efaff
|
@ -601,6 +601,26 @@ u32_t sys_now(void)
|
|||
return rt_tick_get() * (1000 / RT_TICK_PER_SECOND);
|
||||
}
|
||||
|
||||
/*
|
||||
* lwIP IPv4 input hook
|
||||
*/
|
||||
#ifdef LWIP_USING_IP4INPUT_HOOK
|
||||
static int (*_lwip_ip_input_hook)(struct pbuf *p, struct netif *inp) = RT_NULL;
|
||||
|
||||
void lwip_ip_input_set_hook(int (*hook)(struct pbuf *p, struct netif *inp))
|
||||
{
|
||||
_lwip_ip_input_hook = hook;
|
||||
}
|
||||
|
||||
int lwip_ip_input_hook(struct pbuf *p, struct netif *inp)
|
||||
{
|
||||
if (_lwip_ip_input_hook != RT_NULL)
|
||||
return _lwip_ip_input_hook(p, inp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef RT_LWIP_PPP
|
||||
u32_t sio_read(sio_fd_t fd, u8_t *buf, u32_t size)
|
||||
{
|
||||
|
|
|
@ -161,6 +161,14 @@
|
|||
*/
|
||||
#define SYS_LIGHTWEIGHT_PROT (NO_SYS==0)
|
||||
|
||||
#ifdef LWIP_USING_IP4INPUT_HOOK
|
||||
struct pbuf;
|
||||
struct netif;
|
||||
int lwip_ip_input_hook(struct pbuf *p, struct netif *inp);
|
||||
|
||||
#define LWIP_HOOK_IP4_INPUT lwip_ip_input_hook
|
||||
#endif
|
||||
|
||||
/* ---------- TCP options ---------- */
|
||||
#ifdef RT_LWIP_TCP
|
||||
#define LWIP_TCP 1
|
||||
|
|
Loading…
Reference in New Issue