[components][sal]add netdev ifindex feature

This commit is contained in:
zms123456
2024-10-11 12:10:21 +08:00
committed by GitHub
parent 344ea87347
commit 9a010bb71b
3 changed files with 53 additions and 0 deletions

View File

@@ -101,6 +101,8 @@ struct netdev
netdev_callback_fn status_callback; /* network interface device flags change callback */
netdev_callback_fn addr_callback; /* network interface device address information change callback */
int ifindex; /* network interface device ifindex */
#ifdef RT_USING_SAL
void *sal_user_data; /* user-specific data for SAL */
#endif /* RT_USING_SAL */
@@ -151,6 +153,7 @@ int netdev_unregister(struct netdev *netdev);
struct netdev *netdev_get_first_by_flags(uint16_t flags);
struct netdev *netdev_get_by_ipaddr(ip_addr_t *ip_addr);
struct netdev *netdev_get_by_name(const char *name);
struct netdev *netdev_get_by_ifindex(int ifindex);
#ifdef RT_USING_SAL
struct netdev *netdev_get_by_family(int family);
int netdev_family_get(struct netdev *netdev);