Commit 662d1e7d authored by Daniele Lacamera's avatar Daniele Lacamera

Added pico_ipv6_link_by_dev_next()

parent 04dbaa41
......@@ -1147,6 +1147,28 @@ struct pico_ipv6_link *pico_ipv6_link_by_dev(struct pico_device *dev)
return NULL;
}
struct pico_ipv6_link *pico_ipv6_link_by_dev_next(struct pico_device *dev, struct pico_ipv6_link *last)
{
struct pico_tree_node *index = NULL;
struct pico_ipv6_link *link = NULL;
int valid = 0;
if (last == NULL)
valid = 1;
pico_tree_foreach(index, &IPV6Links)
{
link = index->keyValue;
if (link->dev == dev) {
if (last == link)
valid = 1;
else if (valid > 0)
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;
......
......@@ -99,4 +99,5 @@ 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);
struct pico_ipv6_link *pico_ipv6_link_by_dev_next(struct pico_device *dev, struct pico_ipv6_link *last);
#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