diff options
Diffstat (limited to 'components/net/netdev/include/netdev.h')
| -rw-r--r-- | components/net/netdev/include/netdev.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/components/net/netdev/include/netdev.h b/components/net/netdev/include/netdev.h index 0be2a2bda3..e11a8929b0 100644 --- a/components/net/netdev/include/netdev.h +++ b/components/net/netdev/include/netdev.h @@ -27,6 +27,13 @@ extern "C" { #define NETDEV_DNS_SERVERS_NUM 2U #endif +#if NETDEV_IPV6 +/* the maximum of dns server number supported */ +#ifndef NETDEV_IPV6_NUM_ADDRESSES +#define NETDEV_IPV6_NUM_ADDRESSES 3U +#endif +#endif /* NETDEV_IPV6 */ + /* whether the network interface device is 'up' (set by the network interface driver or application) */ #define NETDEV_FLAG_UP 0x01U /* if set, the network interface device has broadcast capability, only supported in the 'lwIP' stack */ @@ -78,6 +85,9 @@ struct netdev ip_addr_t ip_addr; /* IP address */ ip_addr_t netmask; /* subnet mask */ ip_addr_t gw; /* gateway */ +#if NETDEV_IPV6 + ip_addr_t ip6_addr[NETDEV_IPV6_NUM_ADDRESSES]; /* array of IPv6 addresses */ +#endif /* NETDEV_IPV6 */ ip_addr_t dns_servers[NETDEV_DNS_SERVERS_NUM]; /* DNS server */ uint8_t hwaddr_len; /* hardware address length */ uint8_t hwaddr[NETDEV_HWADDR_MAX_LEN]; /* hardware address */ @@ -122,10 +132,14 @@ struct netdev_ops int (*set_dns_server)(struct netdev *netdev, uint8_t dns_num, ip_addr_t *dns_server); int (*set_dhcp)(struct netdev *netdev, rt_bool_t is_enabled); +#ifdef RT_USING_FINSH /* set network interface device common network interface device operations */ int (*ping)(struct netdev *netdev, const char *host, size_t data_len, uint32_t timeout, struct netdev_ping_resp *ping_resp); void (*netstat)(struct netdev *netdev); +#endif + /* set default network interface device in current network stack*/ + int (*set_default)(struct netdev *netdev); }; /* The network interface device registered and unregistered*/ @@ -163,6 +177,7 @@ int netdev_set_dns_server(struct netdev *netdev, uint8_t dns_num, const ip_addr_ /* Set network interface device callback, it can be called when the status or address changed */ void netdev_set_status_callback(struct netdev *netdev, netdev_callback_fn status_callback); +void netdev_set_addr_callback(struct netdev *netdev, netdev_callback_fn addr_callback); /* Set network interface device status and address, this function can only be called in the network interface device driver */ void netdev_low_level_set_ipaddr(struct netdev *netdev, const ip_addr_t *ipaddr); |
