netopt: introduced link type (wired or wireless)

This commit is contained in:
Oleg Hahm 2015-08-24 00:23:33 +02:00
parent 07f24ffb38
commit 4dbd491097
3 changed files with 16 additions and 0 deletions

View File

@ -139,6 +139,17 @@ typedef enum {
NETOPT_TX_END_IRQ,
NETOPT_AUTOCCA, /**< en/disable to check automatically
* before sending the channel is clear. */
/**
* @brief read-only check for a wired interface.
*
* If the interface is wireless this function will return -ENOTSUP, a
* positive value otherwise.
*
* @note Setting this option will always return -EONOTSUP.
*/
NETOPT_IS_WIRED,
/* add more options if needed */
/**

View File

@ -46,6 +46,7 @@ static const char *_netopt_strmap[] = {
[NETOPT_TX_START_IRQ] = "NETOPT_TX_START_IRQ",
[NETOPT_TX_END_IRQ] = "NETOPT_TX_END_IRQ",
[NETOPT_AUTOCCA] = "NETOPT_AUTOCCA",
[NETOPT_IS_WIRED] = "NETOPT_IS_WIRED",
[NETOPT_NUMOF] = "NETOPT_NUMOF",
};

View File

@ -273,6 +273,10 @@ static int _get(gnrc_netdev_t *dev, netopt_t opt, void *value, size_t max_len)
DEBUG("promiscous mode\n");
return _get_promiscousmode((gnrc_netdev_eth_t *)dev, value, max_len);
case NETOPT_IS_WIRED:
DEBUG("is wired\n");
return 1;
default:
DEBUG("[not supported: %d]\n", opt);
return -ENOTSUP;