Commit 0de95f03 authored by Daniele Lacamera's avatar Daniele Lacamera

Added function to get ip6 link of a given device

parent 55f5db6d
......@@ -6,6 +6,7 @@
extern volatile pico_time full_tick;
extern volatile uint32_t sys_tick_counter;
extern volatile uint32_t __stm32_tick;
#ifdef PICO_SUPPORT_RTOS
#define PICO_SUPPORT_MUTEX
......
......@@ -1132,6 +1132,21 @@ struct pico_ip6 pico_ipv6_route_get_gateway(struct pico_ip6 *addr)
return route->gateway;
}
struct pico_ipv6_link *pico_ipv6_link_by_dev(struct pico_device *dev)
{
struct pico_tree_node *index = NULL;
struct pico_ipv6_link *link = NULL;
pico_tree_foreach(index, &IPV6Links)
{
link = index->keyValue;
if (dev == link->dev)
return link;
}
return NULL;
}
void pico_ipv6_unreachable(struct pico_frame *f, uint8_t code)
{
struct pico_ipv6_hdr *hdr = (struct pico_ipv6_hdr *)f->net_hdr;
......
......@@ -98,4 +98,5 @@ struct pico_ipv6_link *pico_ipv6_link_get(struct pico_ip6 *address);
struct pico_device *pico_ipv6_link_find(struct pico_ip6 *address);
struct pico_ip6 pico_ipv6_route_get_gateway(struct pico_ip6 *addr);
struct pico_ip6 *pico_ipv6_source_find(const struct pico_ip6 *dst);
struct pico_ipv6_link *pico_ipv6_link_by_dev(struct pico_device *dev);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment