Skip to content

Commit

Permalink
netopt: introduced link type (wired or wireless)
Browse files Browse the repository at this point in the history
  • Loading branch information
OlegHahm committed Sep 1, 2015
1 parent 07f24ff commit 4dbd491
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions sys/include/net/netopt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

/**
Expand Down
1 change: 1 addition & 0 deletions sys/net/crosslayer/netopt/netopt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
};

Expand Down
4 changes: 4 additions & 0 deletions sys/net/gnrc/link_layer/netdev_eth/gnrc_netdev_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4dbd491

Please sign in to comment.