Browse Source

gnrc: replace all instances of ng_netconf with ng_netopt

dev/timer
Martine Lenders 8 years ago
parent
commit
6f56b983f0
  1. 52
      cpu/nrf51/radio/nrfmin/nrfmin.c
  2. 2
      drivers/include/kw2xrf.h
  3. 118
      drivers/kw2xrf/kw2xrf.c
  4. 172
      drivers/ng_at86rf2xx/ng_at86rf2xx_netdev.c
  5. 36
      drivers/xbee/xbee.c
  6. 8
      sys/include/net/ng_netapi.h
  7. 2
      sys/include/net/ng_netbase.h
  8. 8
      sys/include/net/ng_netdev.h
  9. 10
      sys/include/net/ng_nettest.h
  10. 56
      sys/net/application_layer/ng_zep/ng_zep.c
  11. 6
      sys/net/crosslayer/ng_netapi/ng_netapi.c
  12. 14
      sys/net/crosslayer/ng_nettest/ng_nettest.c
  13. 38
      sys/net/link_layer/ng_netdev_eth/ng_netdev_eth.c
  14. 6
      sys/net/network_layer/ng_ipv6/netif/ng_ipv6_netif.c
  15. 6
      sys/net/network_layer/ng_ndp/ng_ndp.c
  16. 2
      sys/net/network_layer/ng_sixlowpan/iphc/ng_sixlowpan_iphc.c
  17. 2
      sys/net/network_layer/ng_sixlowpan/ng_sixlowpan.c
  18. 135
      sys/shell/commands/sc_netif.c

52
cpu/nrf51/radio/nrfmin/nrfmin.c

@ -211,52 +211,52 @@ static void _switch_to_rx(void)
*/
int _get_state(uint8_t *val, size_t max_len)
{
ng_netconf_state_t state;
ng_netopt_state_t state;
if (max_len < sizeof(ng_netconf_state_t)) {
if (max_len < sizeof(ng_netopt_state_t)) {
return -EOVERFLOW;
}
switch (_state) {
case STATE_OFF:
state = NETCONF_STATE_OFF;
state = NG_NETOPT_STATE_OFF;
break;
case STATE_IDLE:
state = NETCONF_STATE_SLEEP;
state = NG_NETOPT_STATE_SLEEP;
break;
case STATE_RX:
state = NETCONF_STATE_IDLE;
state = NG_NETOPT_STATE_IDLE;
break;
case STATE_TX:
state = NETCONF_STATE_TX;
state = NG_NETOPT_STATE_TX;
break;
default:
return -ECANCELED;
}
memcpy(val, &state, sizeof(ng_netconf_state_t));
return sizeof(ng_netconf_state_t);
memcpy(val, &state, sizeof(ng_netopt_state_t));
return sizeof(ng_netopt_state_t);
}
int _set_state(uint8_t *val, size_t len)
{
ng_netconf_state_t state;
ng_netopt_state_t state;
if (len != sizeof(ng_netconf_state_t)) {
if (len != sizeof(ng_netopt_state_t)) {
return -EINVAL;
}
/* get target state */
memcpy(&state, val, len);
/* switch to target state */
switch (state) {
case NETCONF_STATE_SLEEP:
case NG_NETOPT_STATE_SLEEP:
_switch_to_idle();
break;
case NETCONF_STATE_IDLE:
case NG_NETOPT_STATE_IDLE:
_switch_to_rx();
break;
default:
return -ENOTSUP;
}
return sizeof(ng_netconf_state_t);
return sizeof(ng_netopt_state_t);
}
int _get_address(uint8_t *val, size_t max_len)
@ -662,42 +662,40 @@ int _rem_event_cb(ng_netdev_t *dev, ng_netdev_event_cb_t cb)
return -ENOENT;
}
int _get(ng_netdev_t *dev, ng_netconf_opt_t opt,
void *value, size_t max_len)
int _get(ng_netdev_t *dev, ng_netopt_t opt, void *value, size_t max_len)
{
(void)dev;
switch (opt) {
case NETCONF_OPT_ADDRESS:
case NG_NETOPT_ADDRESS:
return _get_address(value, max_len);
case NETCONF_OPT_CHANNEL:
case NG_NETOPT_CHANNEL:
return _get_channel(value, max_len);
case NETCONF_OPT_NID:
case NG_NETOPT_NID:
return _get_pan(value, max_len);
case NETCONF_OPT_TX_POWER:
case NG_NETOPT_TX_POWER:
return _get_txpower(value, max_len);
case NETCONF_OPT_STATE:
case NG_NETOPT_STATE:
return _get_state(value, max_len);
default:
return -ENOTSUP;
}
}
int _set(ng_netdev_t *dev, ng_netconf_opt_t opt,
void *value, size_t value_len)
int _set(ng_netdev_t *dev, ng_netopt_t opt, void *value, size_t value_len)
{
(void)dev;
switch (opt) {
case NETCONF_OPT_ADDRESS:
case NG_NETOPT_ADDRESS:
return _set_address(value, value_len);
case NETCONF_OPT_CHANNEL:
case NG_NETOPT_CHANNEL:
return _set_channel(value, value_len);
case NETCONF_OPT_NID:
case NG_NETOPT_NID:
return _set_pan(value, value_len);
case NETCONF_OPT_TX_POWER:
case NG_NETOPT_TX_POWER:
return _set_txpower(value, value_len);
case NETCONF_OPT_STATE:
case NG_NETOPT_STATE:
return _set_state(value, value_len);
default:
return -ENOTSUP;

2
drivers/include/kw2xrf.h

@ -109,7 +109,7 @@ typedef struct {
kernel_pid_t mac_pid; /**< The driver's thread's PID */
/* driver specific fields */
uint8_t buf[KW2XRF_MAX_PKT_LENGTH]; /**< Buffer for incoming or outgoing packets */
ng_netconf_state_t state; /**< Variable to keep radio driver's state */
ng_netopt_state_t state; /**< Variable to keep radio driver's state */
uint8_t seq_nr; /**< Next packets sequence number */
uint16_t radio_pan; /**< The PAN the radio device is using */
uint8_t radio_channel; /**< The channel the radio device is using */

118
drivers/kw2xrf/kw2xrf.c

@ -184,32 +184,32 @@ void kw2xrf_set_sequence(kw2xrf_t *dev, kw2xrf_physeq_t seq)
/* Progrmm new sequence */
switch (seq) {
case XCVSEQ_IDLE:
dev->state = NETCONF_STATE_SLEEP;
dev->state = NG_NETOPT_STATE_SLEEP;
break;
case XCVSEQ_RECEIVE:
dev->state = NETCONF_STATE_IDLE;
dev->state = NG_NETOPT_STATE_IDLE;
break;
case XCVSEQ_TRANSMIT:
dev->state = NETCONF_STATE_TX;
dev->state = NG_NETOPT_STATE_TX;
break;
case XCVSEQ_CCA:
dev->state = NETCONF_STATE_TX;
dev->state = NG_NETOPT_STATE_TX;
break;
case XCVSEQ_TX_RX:
dev->state = NETCONF_STATE_TX;
dev->state = NG_NETOPT_STATE_TX;
break;
case XCVSEQ_CONTINUOUS_CCA:
dev->state = NETCONF_STATE_TX;
dev->state = NG_NETOPT_STATE_TX;
break;
default:
DEBUG("kw2xrf: undefined state assigned to phy\n");
dev->state = NETCONF_STATE_IDLE;
dev->state = NG_NETOPT_STATE_IDLE;
}
/* Mapping of TX-sequences depending on AUTOACK flag */
@ -352,7 +352,7 @@ int kw2xrf_on(kw2xrf_t *dev)
/* abort any ongoing sequence */
kw2xrf_set_sequence(dev, XCVSEQ_IDLE);
dev->state = NETCONF_STATE_SLEEP;
dev->state = NG_NETOPT_STATE_SLEEP;
return 0;
}
@ -508,7 +508,7 @@ uint64_t kw2xrf_get_addr_long(kw2xrf_t *dev)
return addr;
}
int kw2xrf_get(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value, size_t max_len)
int kw2xrf_get(ng_netdev_t *netdev, ng_netopt_t opt, void *value, size_t max_len)
{
kw2xrf_t *dev = (kw2xrf_t *)netdev;
@ -517,7 +517,7 @@ int kw2xrf_get(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value, size_t ma
}
switch (opt) {
case NETCONF_OPT_ADDRESS:
case NG_NETOPT_ADDRESS:
if (max_len < sizeof(uint16_t)) {
return -EOVERFLOW;
}
@ -525,7 +525,7 @@ int kw2xrf_get(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value, size_t ma
*((uint16_t *)value) = ((dev->addr_short[0] << 8) | dev->addr_short[1]);
return sizeof(uint16_t);
case NETCONF_OPT_ADDRESS_LONG:
case NG_NETOPT_ADDRESS_LONG:
if (max_len < sizeof(uint64_t)) {
return -EOVERFLOW;
}
@ -533,7 +533,7 @@ int kw2xrf_get(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value, size_t ma
*((uint64_t *)value) = kw2xrf_get_addr_long(dev);
return sizeof(uint64_t);
case NETCONF_OPT_ADDR_LEN:
case NG_NETOPT_ADDR_LEN:
if (max_len < sizeof(uint16_t)) {
return -EOVERFLOW;
}
@ -541,7 +541,7 @@ int kw2xrf_get(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value, size_t ma
*((uint16_t *)value) = 2;
return sizeof(uint16_t);
case NETCONF_OPT_SRC_LEN:
case NG_NETOPT_SRC_LEN:
if (max_len < sizeof(uint16_t)) {
return -EOVERFLOW;
}
@ -555,7 +555,7 @@ int kw2xrf_get(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value, size_t ma
return sizeof(uint16_t);
case NETCONF_OPT_NID:
case NG_NETOPT_NID:
if (max_len < sizeof(uint16_t)) {
return -EOVERFLOW;
}
@ -563,21 +563,21 @@ int kw2xrf_get(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value, size_t ma
*((uint16_t *)value) = dev->radio_pan;
return sizeof(uint16_t);
case NETCONF_OPT_CHANNEL:
case NG_NETOPT_CHANNEL:
return kw2xrf_get_channel(dev, (uint8_t *)value, max_len);
case NETCONF_OPT_PROTO:
case NG_NETOPT_PROTO:
return kw2xrf_get_proto(dev, (uint8_t *)value, max_len);
case NETCONF_OPT_STATE:
if (max_len < sizeof(ng_netconf_state_t)) {
case NG_NETOPT_STATE:
if (max_len < sizeof(ng_netopt_state_t)) {
return -EOVERFLOW;
}
*(ng_netconf_state_t *)value = *(ng_netconf_state_t *) & (dev->state);
*(ng_netopt_state_t *)value = *(ng_netopt_state_t *) & (dev->state);
return 0;
case NETCONF_OPT_TX_POWER:
case NG_NETOPT_TX_POWER:
if (max_len < 1) {
return -EOVERFLOW;
}
@ -585,7 +585,7 @@ int kw2xrf_get(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value, size_t ma
*(int16_t *)value = dev->tx_power;
return 0;
case NETCONF_OPT_MAX_PACKET_SIZE:
case NG_NETOPT_MAX_PACKET_SIZE:
if (max_len < sizeof(int16_t)) {
return -EOVERFLOW;
}
@ -593,21 +593,21 @@ int kw2xrf_get(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value, size_t ma
*((uint16_t *)value) = KW2XRF_MAX_PKT_LENGTH;
return sizeof(uint16_t);
case NETCONF_OPT_PRELOADING:
*((ng_netconf_enable_t *)value) = !!(dev->option & KW2XRF_OPT_PRELOADING);
return sizeof(ng_netconf_enable_t);
case NG_NETOPT_PRELOADING:
*((ng_netopt_enable_t *)value) = !!(dev->option & KW2XRF_OPT_PRELOADING);
return sizeof(ng_netopt_enable_t);
case NETCONF_OPT_AUTOACK:
*((ng_netconf_enable_t *)value) = !!(dev->option & KW2XRF_OPT_AUTOACK);
return sizeof(ng_netconf_enable_t);
case NG_NETOPT_AUTOACK:
*((ng_netopt_enable_t *)value) = !!(dev->option & KW2XRF_OPT_AUTOACK);
return sizeof(ng_netopt_enable_t);
case NETCONF_OPT_PROMISCUOUSMODE:
*((ng_netconf_enable_t *)value) = !!(dev->option & KW2XRF_OPT_PROMISCUOUS);
return sizeof(ng_netconf_enable_t);
case NG_NETOPT_PROMISCUOUSMODE:
*((ng_netopt_enable_t *)value) = !!(dev->option & KW2XRF_OPT_PROMISCUOUS);
return sizeof(ng_netopt_enable_t);
case NETCONF_OPT_RAWMODE:
*((ng_netconf_enable_t *)value) = !!(dev->option & KW2XRF_OPT_RAWDUMP);
return sizeof(ng_netconf_enable_t);
case NG_NETOPT_RAWMODE:
*((ng_netopt_enable_t *)value) = !!(dev->option & KW2XRF_OPT_RAWDUMP);
return sizeof(ng_netopt_enable_t);
default:
return -ENOTSUP;
@ -696,7 +696,7 @@ void kw2xrf_set_option(kw2xrf_t *dev, uint16_t option, bool state)
}
}
int kw2xrf_set(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value, size_t value_len)
int kw2xrf_set(ng_netdev_t *netdev, ng_netopt_t opt, void *value, size_t value_len)
{
kw2xrf_t *dev = (kw2xrf_t *)netdev;
@ -705,24 +705,24 @@ int kw2xrf_set(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value, size_t va
}
switch (opt) {
case NETCONF_OPT_CHANNEL:
case NG_NETOPT_CHANNEL:
return kw2xrf_set_channel(dev, (uint8_t *)value, value_len);
case NETCONF_OPT_ADDRESS:
case NG_NETOPT_ADDRESS:
if (value_len > sizeof(uint16_t)) {
return -EOVERFLOW;
}
return kw2xrf_set_addr(dev, *((uint16_t *)value));
case NETCONF_OPT_ADDRESS_LONG:
case NG_NETOPT_ADDRESS_LONG:
if (value_len > sizeof(uint64_t)) {
return -EOVERFLOW;
}
return kw2xrf_set_addr_long(dev, *((uint64_t *)value));
case NETCONF_OPT_SRC_LEN:
case NG_NETOPT_SRC_LEN:
if (value_len > sizeof(uint16_t)) {
return -EOVERFLOW;
}
@ -741,14 +741,14 @@ int kw2xrf_set(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value, size_t va
return sizeof(uint16_t);
case NETCONF_OPT_NID:
case NG_NETOPT_NID:
if (value_len > sizeof(uint16_t)) {
return -EOVERFLOW;
}
return kw2xrf_set_pan(dev, *((uint16_t *)value));
case NETCONF_OPT_TX_POWER:
case NG_NETOPT_TX_POWER:
if (value_len < sizeof(uint16_t)) {
return -EOVERFLOW;
}
@ -756,48 +756,48 @@ int kw2xrf_set(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value, size_t va
kw2xrf_set_tx_power(dev, (int8_t *)value, value_len);
return sizeof(uint16_t);
case NETCONF_OPT_PROTO:
case NG_NETOPT_PROTO:
return kw2xrf_set_proto(dev, (uint8_t *)value, value_len);
case NETCONF_OPT_AUTOACK:
case NG_NETOPT_AUTOACK:
/* Set up HW generated automatic ACK after Receive */
kw2xrf_set_option(dev, KW2XRF_OPT_AUTOACK,
((bool *)value)[0]);
return sizeof(ng_netconf_enable_t);
return sizeof(ng_netopt_enable_t);
case NETCONF_OPT_PROMISCUOUSMODE:
case NG_NETOPT_PROMISCUOUSMODE:
kw2xrf_set_option(dev, KW2XRF_OPT_PROMISCUOUS,
((bool *)value)[0]);
return sizeof(ng_netconf_enable_t);
return sizeof(ng_netopt_enable_t);
case NETCONF_OPT_RAWMODE:
case NG_NETOPT_RAWMODE:
kw2xrf_set_option(dev, KW2XRF_OPT_RAWDUMP,
((bool *)value)[0]);
return sizeof(ng_netconf_enable_t);
return sizeof(ng_netopt_enable_t);
case NETCONF_OPT_PRELOADING:
case NG_NETOPT_PRELOADING:
kw2xrf_set_option(dev, KW2XRF_OPT_PRELOADING,
((bool *)value)[0]);
return sizeof(ng_netconf_enable_t);
return sizeof(ng_netopt_enable_t);
case NETCONF_OPT_AUTOCCA:
case NG_NETOPT_AUTOCCA:
kw2xrf_set_option(dev, KW2XRF_OPT_CSMA,
((bool *)value)[0]);
return sizeof(ng_netconf_enable_t);
return sizeof(ng_netopt_enable_t);
case NETCONF_OPT_STATE:
if (*((ng_netconf_state_t *)value) == NETCONF_STATE_TX) {
case NG_NETOPT_STATE:
if (*((ng_netopt_state_t *)value) == NG_NETOPT_STATE_TX) {
DEBUG("kw2xrf: Sending now.\n");
kw2xrf_set_sequence(dev, XCVSEQ_TRANSMIT);
return sizeof(ng_netconf_state_t);
return sizeof(ng_netopt_state_t);
}
else if (*((ng_netconf_state_t *)value) == NETCONF_STATE_SLEEP) {
else if (*((ng_netopt_state_t *)value) == NG_NETOPT_STATE_SLEEP) {
kw2xrf_set_sequence(dev, XCVSEQ_IDLE);
return sizeof(ng_netconf_state_t);
return sizeof(ng_netopt_state_t);
}
else if (*((ng_netconf_state_t *)value) == NETCONF_STATE_IDLE) {
else if (*((ng_netopt_state_t *)value) == NG_NETOPT_STATE_IDLE) {
kw2xrf_set_sequence(dev, XCVSEQ_RECEIVE);
return sizeof(ng_netconf_state_t);
return sizeof(ng_netopt_state_t);
}
/* TODO: Implement Off state here, when LPM functions are implemented */
@ -1188,7 +1188,7 @@ int kw2xrf_send(ng_netdev_t *netdev, ng_pktsnip_t *pkt)
DEBUG("kw2xrf: packet with size %i loaded to tx_buf\n", dev->buf[0]);
kw2xrf_write_fifo(dev->buf, dev->buf[0]);
if ((dev->option & KW2XRF_OPT_PRELOADING) == NETCONF_DISABLE) {
if ((dev->option & KW2XRF_OPT_PRELOADING) == NG_NETOPT_DISABLE) {
DEBUG("kw2xrf: Sending now.\n");
kw2xrf_set_sequence(dev, XCVSEQ_TRANSMIT);
}

172
drivers/ng_at86rf2xx/ng_at86rf2xx_netdev.c

@ -312,47 +312,46 @@ static void _receive_data(ng_at86rf2xx_t *dev)
dev->event_cb(NETDEV_EVENT_RX_COMPLETE, payload);
}
static int _set_state(ng_at86rf2xx_t *dev, ng_netconf_state_t state)
static int _set_state(ng_at86rf2xx_t *dev, ng_netopt_state_t state)
{
switch (state) {
case NETCONF_STATE_SLEEP:
case NG_NETOPT_STATE_SLEEP:
ng_at86rf2xx_set_state(dev, NG_AT86RF2XX_STATE_TRX_OFF);
break;
case NETCONF_STATE_IDLE:
case NG_NETOPT_STATE_IDLE:
ng_at86rf2xx_set_state(dev, NG_AT86RF2XX_STATE_RX_AACK_ON);
break;
case NETCONF_STATE_TX:
case NG_NETOPT_STATE_TX:
if (dev->options & NG_AT86RF2XX_OPT_PRELOADING) {
ng_at86rf2xx_tx_exec(dev);
}
break;
case NETCONF_STATE_RESET:
case NG_NETOPT_STATE_RESET:
ng_at86rf2xx_reset(dev);
break;
default:
return -ENOTSUP;
}
return sizeof(ng_netconf_state_t);
return sizeof(ng_netopt_state_t);
}
ng_netconf_state_t _get_state(ng_at86rf2xx_t *dev)
ng_netopt_state_t _get_state(ng_at86rf2xx_t *dev)
{
switch (ng_at86rf2xx_get_state(dev)) {
case NG_AT86RF2XX_STATE_SLEEP:
return NETCONF_STATE_SLEEP;
return NG_NETOPT_STATE_SLEEP;
case NG_AT86RF2XX_STATE_BUSY_RX_AACK:
return NETCONF_STATE_RX;
return NG_NETOPT_STATE_RX;
case NG_AT86RF2XX_STATE_BUSY_TX_ARET:
case NG_AT86RF2XX_STATE_TX_ARET_ON:
return NETCONF_STATE_TX;
return NG_NETOPT_STATE_TX;
case NG_AT86RF2XX_STATE_RX_AACK_ON:
default:
return NETCONF_STATE_IDLE;
return NG_NETOPT_STATE_IDLE;
}
}
static int _get(ng_netdev_t *device, ng_netconf_opt_t opt,
void *val, size_t max_len)
static int _get(ng_netdev_t *device, ng_netopt_t opt, void *val, size_t max_len)
{
if (device == NULL) {
return -ENODEV;
@ -361,28 +360,28 @@ static int _get(ng_netdev_t *device, ng_netconf_opt_t opt,
switch (opt) {
case NETCONF_OPT_ADDRESS:
case NG_NETOPT_ADDRESS:
if (max_len < sizeof(uint16_t)) {
return -EOVERFLOW;
}
*((uint16_t *)val) = ng_at86rf2xx_get_addr_short(dev);
return sizeof(uint16_t);
case NETCONF_OPT_ADDRESS_LONG:
case NG_NETOPT_ADDRESS_LONG:
if (max_len < sizeof(uint64_t)) {
return -EOVERFLOW;
}
*((uint64_t *)val) = ng_at86rf2xx_get_addr_long(dev);
return sizeof(uint64_t);
case NETCONF_OPT_ADDR_LEN:
case NG_NETOPT_ADDR_LEN:
if (max_len < sizeof(uint16_t)) {
return -EOVERFLOW;
}
*((uint16_t *)val) = 2;
return sizeof(uint16_t);
case NETCONF_OPT_SRC_LEN:
case NG_NETOPT_SRC_LEN:
if (max_len < sizeof(uint16_t)) {
return -EOVERFLOW;
}
@ -394,14 +393,14 @@ static int _get(ng_netdev_t *device, ng_netconf_opt_t opt,
}
return sizeof(uint16_t);
case NETCONF_OPT_NID:
case NG_NETOPT_NID:
if (max_len < sizeof(uint16_t)) {
return -EOVERFLOW;
}
*((uint16_t *)val) = dev->pan;
return sizeof(uint16_t);
case NETCONF_OPT_IPV6_IID:
case NG_NETOPT_IPV6_IID:
if (max_len < sizeof(eui64_t)) {
return -EOVERFLOW;
}
@ -415,14 +414,14 @@ static int _get(ng_netdev_t *device, ng_netconf_opt_t opt,
}
return sizeof(eui64_t);
case NETCONF_OPT_PROTO:
case NG_NETOPT_PROTO:
if (max_len < sizeof(ng_nettype_t)) {
return -EOVERFLOW;
}
*((ng_nettype_t *)val) = dev->proto;
return sizeof(ng_nettype_t);
case NETCONF_OPT_CHANNEL:
case NG_NETOPT_CHANNEL:
if (max_len < sizeof(uint16_t)) {
return -EOVERFLOW;
}
@ -430,98 +429,98 @@ static int _get(ng_netdev_t *device, ng_netconf_opt_t opt,
((uint8_t *)val)[0] = ng_at86rf2xx_get_chan(dev);
return sizeof(uint16_t);
case NETCONF_OPT_TX_POWER:
case NG_NETOPT_TX_POWER:
if (max_len < sizeof(int16_t)) {
return -EOVERFLOW;
}
*((uint16_t *)val) = ng_at86rf2xx_get_txpower(dev);
return sizeof(uint16_t);
case NETCONF_OPT_MAX_PACKET_SIZE:
case NG_NETOPT_MAX_PACKET_SIZE:
if (max_len < sizeof(int16_t)) {
return -EOVERFLOW;
}
*((uint16_t *)val) = NG_AT86RF2XX_MAX_PKT_LENGTH;
return sizeof(uint16_t);
case NETCONF_OPT_STATE:
if (max_len < sizeof(ng_netconf_state_t)) {
case NG_NETOPT_STATE:
if (max_len < sizeof(ng_netopt_state_t)) {
return -EOVERFLOW;
}
*((ng_netconf_state_t*)val) = _get_state(dev);
*((ng_netopt_state_t*)val) = _get_state(dev);
break;
case NETCONF_OPT_PRELOADING:
case NG_NETOPT_PRELOADING:
if (dev->options & NG_AT86RF2XX_OPT_PRELOADING) {
*((ng_netconf_enable_t *)val) = NETCONF_ENABLE;
*((ng_netopt_enable_t *)val) = NG_NETOPT_ENABLE;
}
else {
*((ng_netconf_enable_t *)val) = NETCONF_DISABLE;
*((ng_netopt_enable_t *)val) = NG_NETOPT_DISABLE;
}
return sizeof(ng_netconf_enable_t);
return sizeof(ng_netopt_enable_t);
case NETCONF_OPT_AUTOACK:
case NG_NETOPT_AUTOACK:
if (dev->options & NG_AT86RF2XX_OPT_AUTOACK) {
*((ng_netconf_enable_t *)val) = NETCONF_ENABLE;
*((ng_netopt_enable_t *)val) = NG_NETOPT_ENABLE;
}
else {
*((ng_netconf_enable_t *)val) = NETCONF_DISABLE;
*((ng_netopt_enable_t *)val) = NG_NETOPT_DISABLE;
}
return sizeof(ng_netconf_enable_t);
return sizeof(ng_netopt_enable_t);
case NETCONF_OPT_RETRANS:
case NG_NETOPT_RETRANS:
if (max_len < sizeof(uint8_t)) {
return -EOVERFLOW;
}
*((uint8_t *)val) = ng_at86rf2xx_get_max_retries(dev);
return sizeof(uint8_t);
case NETCONF_OPT_PROMISCUOUSMODE:
case NG_NETOPT_PROMISCUOUSMODE:
if (dev->options & NG_AT86RF2XX_OPT_PROMISCUOUS) {
*((ng_netconf_enable_t *)val) = NETCONF_ENABLE;
*((ng_netopt_enable_t *)val) = NG_NETOPT_ENABLE;
}
else {
*((ng_netconf_enable_t *)val) = NETCONF_DISABLE;
*((ng_netopt_enable_t *)val) = NG_NETOPT_DISABLE;
}
return sizeof(ng_netconf_enable_t);
return sizeof(ng_netopt_enable_t);
case NETCONF_OPT_RAWMODE:
case NG_NETOPT_RAWMODE:
if (dev->options & NG_AT86RF2XX_OPT_RAWDUMP) {
*((ng_netconf_enable_t *)val) = NETCONF_ENABLE;
*((ng_netopt_enable_t *)val) = NG_NETOPT_ENABLE;
}
else {
*((ng_netconf_enable_t *)val) = NETCONF_DISABLE;
*((ng_netopt_enable_t *)val) = NG_NETOPT_DISABLE;
}
return sizeof(ng_netconf_enable_t);
return sizeof(ng_netopt_enable_t);
case NETCONF_OPT_IS_CHANNEL_CLR:
case NG_NETOPT_IS_CHANNEL_CLR:
if (ng_at86rf2xx_cca(dev)) {
*((ng_netconf_enable_t *)val) = NETCONF_ENABLE;
*((ng_netopt_enable_t *)val) = NG_NETOPT_ENABLE;
}
else {
*((ng_netconf_enable_t *)val) = NETCONF_DISABLE;
*((ng_netopt_enable_t *)val) = NG_NETOPT_DISABLE;
}
return sizeof(ng_netconf_enable_t);
return sizeof(ng_netopt_enable_t);
case NETCONF_OPT_RX_START_IRQ:
*((ng_netconf_enable_t *)val) =
case NG_NETOPT_RX_START_IRQ:
*((ng_netopt_enable_t *)val) =
!!(dev->options & NG_AT86RF2XX_OPT_TELL_RX_START);
return sizeof(ng_netconf_enable_t);
return sizeof(ng_netopt_enable_t);
case NETCONF_OPT_RX_END_IRQ:
*((ng_netconf_enable_t *)val) =
case NG_NETOPT_RX_END_IRQ:
*((ng_netopt_enable_t *)val) =
!!(dev->options & NG_AT86RF2XX_OPT_TELL_RX_END);
return sizeof(ng_netconf_enable_t);
return sizeof(ng_netopt_enable_t);
case NETCONF_OPT_TX_START_IRQ:
*((ng_netconf_enable_t *)val) =
case NG_NETOPT_TX_START_IRQ:
*((ng_netopt_enable_t *)val) =
!!(dev->options & NG_AT86RF2XX_OPT_TELL_TX_START);
return sizeof(ng_netconf_enable_t);
return sizeof(ng_netopt_enable_t);
case NETCONF_OPT_TX_END_IRQ:
*((ng_netconf_enable_t *)val) =
case NG_NETOPT_TX_END_IRQ:
*((ng_netopt_enable_t *)val) =
!!(dev->options & NG_AT86RF2XX_OPT_TELL_TX_END);
return sizeof(ng_netconf_enable_t);
return sizeof(ng_netopt_enable_t);
default:
return -ENOTSUP;
@ -530,8 +529,7 @@ static int _get(ng_netdev_t *device, ng_netconf_opt_t opt,
return 0;
}
static int _set(ng_netdev_t *device, ng_netconf_opt_t opt,
void *val, size_t len)
static int _set(ng_netdev_t *device, ng_netopt_t opt, void *val, size_t len)
{
ng_at86rf2xx_t *dev = (ng_at86rf2xx_t *) device;
@ -540,21 +538,21 @@ static int _set(ng_netdev_t *device, ng_netconf_opt_t opt,
}
switch (opt) {
case NETCONF_OPT_ADDRESS:
case NG_NETOPT_ADDRESS:
if (len > sizeof(uint16_t)) {
return -EOVERFLOW;
}
ng_at86rf2xx_set_addr_short(dev, *((uint16_t*)val));
return sizeof(uint16_t);
case NETCONF_OPT_ADDRESS_LONG:
case NG_NETOPT_ADDRESS_LONG:
if (len > sizeof(uint64_t)) {
return -EOVERFLOW;
}
ng_at86rf2xx_set_addr_long(dev, *((uint64_t*)val));
return sizeof(uint64_t);
case NETCONF_OPT_SRC_LEN:
case NG_NETOPT_SRC_LEN:
if (len > sizeof(uint16_t)) {
return -EOVERFLOW;
}
@ -571,14 +569,14 @@ static int _set(ng_netdev_t *device, ng_netconf_opt_t opt,
}
return sizeof(uint16_t);
case NETCONF_OPT_NID:
case NG_NETOPT_NID:
if (len > sizeof(uint16_t)) {
return -EOVERFLOW;
}
ng_at86rf2xx_set_pan(dev, *((uint16_t *)val));
return sizeof(uint16_t);
case NETCONF_OPT_CHANNEL:
case NG_NETOPT_CHANNEL:
if (len != sizeof(uint16_t)) {
return -EINVAL;
}
@ -590,65 +588,65 @@ static int _set(ng_netdev_t *device, ng_netconf_opt_t opt,
ng_at86rf2xx_set_chan(dev, chan);
return sizeof(uint16_t);
case NETCONF_OPT_TX_POWER:
case NG_NETOPT_TX_POWER:
if (len > sizeof(int16_t)) {
return -EOVERFLOW;
}
ng_at86rf2xx_set_txpower(dev, *((int16_t *)val));
return sizeof(uint16_t);
case NETCONF_OPT_STATE:
if (len > sizeof(ng_netconf_state_t)) {
case NG_NETOPT_STATE:
if (len > sizeof(ng_netopt_state_t)) {
return -EOVERFLOW;
}
return _set_state(dev, *((ng_netconf_state_t *)val));
return _set_state(dev, *((ng_netopt_state_t *)val));
case NETCONF_OPT_AUTOACK:
case NG_NETOPT_AUTOACK:
ng_at86rf2xx_set_option(dev, NG_AT86RF2XX_OPT_AUTOACK,
((bool *)val)[0]);
return sizeof(ng_netconf_enable_t);
return sizeof(ng_netopt_enable_t);
case NETCONF_OPT_RETRANS:
case NG_NETOPT_RETRANS:
if (len > sizeof(uint8_t)) {
return -EOVERFLOW;
}
ng_at86rf2xx_set_max_retries(dev, *((uint8_t *)val));
return sizeof(uint8_t);
case NETCONF_OPT_PRELOADING:
case NG_NETOPT_PRELOADING:
ng_at86rf2xx_set_option(dev, NG_AT86RF2XX_OPT_PRELOADING,
((bool *)val)[0]);
return sizeof(ng_netconf_enable_t);
return sizeof(ng_netopt_enable_t);
case NETCONF_OPT_PROMISCUOUSMODE:
case NG_NETOPT_PROMISCUOUSMODE:
ng_at86rf2xx_set_option(dev, NG_AT86RF2XX_OPT_PROMISCUOUS,
((bool *)val)[0]);
return sizeof(ng_netconf_enable_t);
return sizeof(ng_netopt_enable_t);
case NETCONF_OPT_RAWMODE:
case NG_NETOPT_RAWMODE:
ng_at86rf2xx_set_option(dev, NG_AT86RF2XX_OPT_RAWDUMP,
((bool *)val)[0]);
return sizeof(ng_netconf_enable_t);
return sizeof(ng_netopt_enable_t);
case NETCONF_OPT_RX_START_IRQ:
case NG_NETOPT_RX_START_IRQ:
ng_at86rf2xx_set_option(dev, NG_AT86RF2XX_OPT_TELL_RX_START,
((bool *)val)[0]);
return sizeof(ng_netconf_enable_t);
return sizeof(ng_netopt_enable_t);
case NETCONF_OPT_RX_END_IRQ:
case NG_NETOPT_RX_END_IRQ:
ng_at86rf2xx_set_option(dev, NG_AT86RF2XX_OPT_TELL_RX_END,
((bool *)val)[0]);
return sizeof(ng_netconf_enable_t);
return sizeof(ng_netopt_enable_t);
case NETCONF_OPT_TX_START_IRQ:
case NG_NETOPT_TX_START_IRQ:
ng_at86rf2xx_set_option(dev, NG_AT86RF2XX_OPT_TELL_TX_START,
((bool *)val)[0]);
return sizeof(ng_netconf_enable_t);
return sizeof(ng_netopt_enable_t);
case NETCONF_OPT_TX_END_IRQ:
case NG_NETOPT_TX_END_IRQ:
ng_at86rf2xx_set_option(dev, NG_AT86RF2XX_OPT_TELL_TX_END,
((bool *)val)[0]);
return sizeof(ng_netconf_enable_t);
return sizeof(ng_netopt_enable_t);
default:
return -ENOTSUP;

36
drivers/xbee/xbee.c

@ -597,8 +597,7 @@ static int _rem_cb(ng_netdev_t *dev, ng_netdev_event_cb_t cb)
return 0;
}
static int _get(ng_netdev_t *netdev, ng_netconf_opt_t opt,
void *value, size_t max_len)
static int _get(ng_netdev_t *netdev, ng_netopt_t opt, void *value, size_t max_len)
{
xbee_t *dev = (xbee_t *)netdev;
if (dev == NULL) {
@ -606,12 +605,12 @@ static int _get(ng_netdev_t *netdev, ng_netconf_opt_t opt,
}
switch (opt) {
case NETCONF_OPT_ADDRESS:
case NG_NETOPT_ADDRESS:
return _get_addr_short(dev, (uint8_t *)value, max_len);
case NETCONF_OPT_ADDRESS_LONG:
case NG_NETOPT_ADDRESS_LONG:
return _get_addr_long(dev, (uint8_t *)value, max_len);
case NETCONF_OPT_ADDR_LEN:
case NETCONF_OPT_SRC_LEN:
case NG_NETOPT_ADDR_LEN:
case NG_NETOPT_SRC_LEN:
if (max_len < sizeof(uint16_t)) {
return -EOVERFLOW;
}
@ -622,7 +621,7 @@ static int _get(ng_netdev_t *netdev, ng_netconf_opt_t opt,
*((uint16_t *)value) = 2;
}
return sizeof(uint16_t);
case NETCONF_OPT_IPV6_IID:
case NG_NETOPT_IPV6_IID:
if (max_len < sizeof(eui64_t)) {
return -EOVERFLOW;
}
@ -634,25 +633,24 @@ static int _get(ng_netdev_t *netdev, ng_netconf_opt_t opt,
}
return sizeof(eui64_t);
case NETCONF_OPT_CHANNEL:
case NG_NETOPT_CHANNEL:
return _get_channel(dev, (uint8_t *)value, max_len);
case NETCONF_OPT_MAX_PACKET_SIZE:
case NG_NETOPT_MAX_PACKET_SIZE:
if (max_len < sizeof(uint16_t)) {
return -EOVERFLOW;
}
*((uint16_t *)value) = XBEE_MAX_PAYLOAD_LENGTH;
return sizeof(uint16_t);
case NETCONF_OPT_NID:
case NG_NETOPT_NID:
return _get_panid(dev, (uint8_t *)value, max_len);
case NETCONF_OPT_PROTO:
case NG_NETOPT_PROTO:
return _get_proto(dev, (uint8_t *)value, max_len);
default:
return -ENOTSUP;
}
}
static int _set(ng_netdev_t *netdev, ng_netconf_opt_t opt,
void *value, size_t value_len)
static int _set(ng_netdev_t *netdev, ng_netopt_t opt, void *value, size_t value_len)
{
xbee_t *dev = (xbee_t *)netdev;
if (dev == NULL) {
@ -660,16 +658,16 @@ static int _set(ng_netdev_t *netdev, ng_netconf_opt_t opt,
}
switch (opt) {
case NETCONF_OPT_ADDRESS:
case NG_NETOPT_ADDRESS:
return _set_addr(dev, (uint8_t *)value, value_len);
case NETCONF_OPT_ADDR_LEN:
case NETCONF_OPT_SRC_LEN:
case NG_NETOPT_ADDR_LEN:
case NG_NETOPT_SRC_LEN:
return _set_addr_len(dev, value, value_len);
case NETCONF_OPT_CHANNEL:
case NG_NETOPT_CHANNEL:
return _set_channel(dev, (uint8_t *)value, value_len);
case NETCONF_OPT_NID:
case NG_NETOPT_NID:
return _set_panid(dev, (uint8_t *)value, value_len);
case NETCONF_OPT_PROTO:
case NG_NETOPT_PROTO:
return _set_proto(dev, (uint8_t *)value, value_len);
default:
return -ENOTSUP;

8
sys/include/net/ng_netapi.h

@ -30,7 +30,7 @@
#include "kernel.h"
#include "thread.h"
#include "net/ng_netconf.h"
#include "net/ng_netopt.h"
#include "net/ng_nettype.h"
#include "net/ng_pkt.h"
@ -67,7 +67,7 @@ extern "C" {
* @brief Data structure to be send for setting and getting options
*/
typedef struct {
ng_netconf_opt_t opt; /**< the option to get/set */
ng_netopt_t opt; /**< the option to get/set */
uint16_t context; /**< (optional) context for that option */
void *data; /**< data to set or buffer to read into */
uint16_t data_len; /**< size of the data / the buffer */
@ -133,7 +133,7 @@ int ng_netapi_dispatch_receive(ng_nettype_t type, uint32_t demux_ctx,
*
* @return value returned by the @ref NG_NETAPI_MSG_TYPE_ACK message
*/
int ng_netapi_get(kernel_pid_t pid, ng_netconf_opt_t opt, uint16_t context,
int ng_netapi_get(kernel_pid_t pid, ng_netopt_t opt, uint16_t context,
void *data, size_t max_len);
/**
@ -148,7 +148,7 @@ int ng_netapi_get(kernel_pid_t pid, ng_netconf_opt_t opt, uint16_t context,
*
* @return value returned by the @ref NG_NETAPI_MSG_TYPE_ACK message
*/
int ng_netapi_set(kernel_pid_t pid, ng_netconf_opt_t opt, uint16_t context,
int ng_netapi_set(kernel_pid_t pid, ng_netopt_t opt, uint16_t context,
void *data, size_t data_len);
#ifdef __cplusplus

2
sys/include/net/ng_netbase.h

@ -22,7 +22,7 @@
#include "net/ng_netdev.h"
#include "net/ng_netapi.h"
#include "net/ng_netconf.h"
#include "net/ng_netopt.h"
#include "net/ng_netreg.h"
#include "net/ng_nettype.h"
#include "net/ng_netif.h"

8
sys/include/net/ng_netdev.h

@ -28,7 +28,7 @@
#include "kernel.h"
#include "net/ng_pkt.h"
#include "net/ng_netconf.h"
#include "net/ng_netopt.h"
#ifdef __cplusplus
extern "C" {
@ -127,8 +127,7 @@ typedef struct {
* @p max_len is too small to store the option value
* @return -ECANCELED if internal driver error occurred
*/
int (*get)(ng_netdev_t *dev, ng_netconf_opt_t opt,
void *value, size_t max_len);
int (*get)(ng_netdev_t *dev, ng_netopt_t opt, void *value, size_t max_len);
/**
* @brief Set an option value for a given network device
@ -144,8 +143,7 @@ typedef struct {
* @return -EINVAL if @p value is invalid
* @return -ECANCELED if internal driver error occurred
*/
int (*set)(ng_netdev_t *dev, ng_netconf_opt_t opt,
void *value, size_t value_len);
int (*set)(ng_netdev_t *dev, ng_netopt_t opt, void *value, size_t value_len);
/**
* @brief This function is called by a MAC layer when a message of type

10
sys/include/net/ng_nettest.h

@ -26,7 +26,7 @@
#include "kernel_types.h"
#include "net/ng_netapi.h"
#include "net/ng_netconf.h"
#include "net/ng_netopt.h"
#include "net/ng_nettype.h"
#include "net/ng_pkt.h"
#include "thread.h"
@ -105,7 +105,7 @@ typedef enum {
* @param[in] opt The option to register the getter for.
* @param[in] cb An option getter. NULL to delete.
*/
void ng_nettest_register_get(ng_netconf_opt_t opt, ng_nettest_opt_cb_t cb);
void ng_nettest_register_get(ng_netopt_t opt, ng_nettest_opt_cb_t cb);
/**
* @brief Registers a setter for an option.
@ -115,7 +115,7 @@ void ng_nettest_register_get(ng_netconf_opt_t opt, ng_nettest_opt_cb_t cb);
* @param[in] opt The option to register the setter for.
* @param[in] cb An option setter. NULL to delete.
*/
void ng_nettest_register_set(ng_netconf_opt_t opt, ng_nettest_opt_cb_t cb);
void ng_nettest_register_set(ng_netopt_t opt, ng_nettest_opt_cb_t cb);
/**
* @brief Test @ref NG_NETAPI_MSG_TYPE_SND command to @p pid.
@ -223,7 +223,7 @@ ng_nettest_res_t ng_nettest_receive(kernel_pid_t pid, ng_pktsnip_t *in,
*
* @return @see ng_nettest_res_t
*/
ng_nettest_res_t ng_nettest_get(kernel_pid_t pid, ng_netconf_opt_t opt,
ng_nettest_res_t ng_nettest_get(kernel_pid_t pid, ng_netopt_t opt,
uint16_t context, void *data, size_t data_len,
void *exp_data, int exp_res);
@ -242,7 +242,7 @@ ng_nettest_res_t ng_nettest_get(kernel_pid_t pid, ng_netconf_opt_t opt,
*
* @return @see ng_nettest_res_t
*/
ng_nettest_res_t ng_nettest_set(kernel_pid_t pid, ng_netconf_opt_t opt,
ng_nettest_res_t ng_nettest_set(kernel_pid_t pid, ng_netopt_t opt,
uint16_t context, void *data, size_t data_len,
int exp_res);

56
sys/net/application_layer/ng_zep/ng_zep.c

@ -56,10 +56,8 @@ static ringbuffer_t _rx_buf = RINGBUFFER_INIT(_rx_buf_array);
static int _send(ng_netdev_t *dev, ng_pktsnip_t *pkt);
static int _add_cb(ng_netdev_t *dev, ng_netdev_event_cb_t cb);
static int _rem_cb(ng_netdev_t *dev, ng_netdev_event_cb_t cb);
static int _get(ng_netdev_t *dev, ng_netconf_opt_t opt, void *value,
size_t max_len);
static int _set(ng_netdev_t *dev, ng_netconf_opt_t opt, void *value,
size_t value_len);
static int _get(ng_netdev_t *dev, ng_netopt_t opt, void *value, size_t max_len);
static int _set(ng_netdev_t *dev, ng_netopt_t opt, void *value, size_t value_len);
static void _isr_event(ng_netdev_t *dev, uint32_t event_type);
static const ng_netdev_driver_t _zep_driver = {
@ -184,14 +182,14 @@ static inline void _set_uint64_ptr(uint64_t *ptr, uint64_t val)
*ptr = val;
}
static inline void _set_flag_ptr(ng_netconf_enable_t *enable,
static inline void _set_flag_ptr(ng_netopt_enable_t *enable,
uint16_t flag_field, uint16_t flag)
{
if (flag_field & flag) {
*enable = NETCONF_ENABLE;
*enable = NG_NETOPT_ENABLE;
}
else {
*enable = NETCONF_DISABLE;
*enable = NG_NETOPT_DISABLE;
}
}
@ -329,8 +327,7 @@ static int _rem_cb(ng_netdev_t *dev, ng_netdev_event_cb_t cb)
return 0;
}
static int _get(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value,
size_t max_len)
static int _get(ng_netdev_t *netdev, ng_netopt_t opt, void *value, size_t max_len)
{
ng_zep_t *dev = (ng_zep_t *)netdev;
@ -339,7 +336,7 @@ static int _get(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value,
}
switch (opt) {
case NETCONF_OPT_CHANNEL:
case NG_NETOPT_CHANNEL:
if (max_len < sizeof(uint16_t)) {
return -EOVERFLOW;
}
@ -347,7 +344,7 @@ static int _get(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value,
_set_uint16_ptr(value, (uint16_t)dev->chan);
return sizeof(uint16_t);
case NETCONF_OPT_ADDRESS:
case NG_NETOPT_ADDRESS:
if (max_len < sizeof(uint16_t)) {
return -EOVERFLOW;
}
@ -355,7 +352,7 @@ static int _get(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value,
_set_uint16_ptr(value, byteorder_ltobs(dev->addr).u16);
return sizeof(uint16_t);
case NETCONF_OPT_ADDRESS_LONG:
case NG_NETOPT_ADDRESS_LONG:
if (max_len < sizeof(uint64_t)) {
return -EOVERFLOW;
}
@ -363,7 +360,7 @@ static int _get(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value,
_set_uint64_ptr(value, byteorder_ltobll(dev->eui64).u64);
return sizeof(uint64_t);
case NETCONF_OPT_ADDR_LEN:
case NG_NETOPT_ADDR_LEN:
if (max_len < sizeof(uint16_t)) {
return -EOVERFLOW;
}
@ -377,7 +374,7 @@ static int _get(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value,
return sizeof(uint16_t);
case NETCONF_OPT_SRC_LEN:
case NG_NETOPT_SRC_LEN:
if (max_len < sizeof(uint16_t)) {
return -EOVERFLOW;
}
@ -391,7 +388,7 @@ static int _get(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value,
return sizeof(uint16_t);
case NETCONF_OPT_PROTO:
case NG_NETOPT_PROTO:
if (max_len < sizeof(ng_nettype_t)) {
return -EOVERFLOW;
}
@ -399,7 +396,7 @@ static int _get(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value,
*((ng_nettype_t *)value) = dev->proto;
return sizeof(ng_nettype_t);
case NETCONF_OPT_NID:
case NG_NETOPT_NID:
if (max_len < sizeof(uint16_t)) {
return -EOVERFLOW;
}
@ -407,7 +404,7 @@ static int _get(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value,
_set_uint16_ptr(value, byteorder_ltobs(dev->pan).u16);
return sizeof(uint16_t);
case NETCONF_OPT_IPV6_IID:
case NG_NETOPT_IPV6_IID:
if (max_len < sizeof(eui64_t)) {
return -EOVERFLOW;
}
@ -421,7 +418,7 @@ static int _get(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value,
}
return sizeof(eui64_t);
case NETCONF_OPT_MAX_PACKET_SIZE:
case NG_NETOPT_MAX_PACKET_SIZE:
if (max_len < sizeof(uint16_t)) {
return -EOVERFLOW;
}
@ -429,8 +426,8 @@ static int _get(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value,
_set_uint16_ptr(value, NG_ZEP_MAX_PKT_LENGTH);
return sizeof(uint16_t);
case NETCONF_OPT_AUTOACK:
if (max_len < sizeof(ng_netconf_enable_t)) {
case NG_NETOPT_AUTOACK:
if (max_len < sizeof(ng_netopt_enable_t)) {
return -EOVERFLOW;
}
@ -442,8 +439,7 @@ static int _get(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value,
}
}
static int _set(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value,
size_t value_len)
static int _set(ng_netdev_t *netdev, ng_netopt_t opt, void *value, size_t value_len)
{
ng_zep_t *dev = (ng_zep_t *)netdev;
@ -452,7 +448,7 @@ static int _set(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value,
}
switch (opt) {
case NETCONF_OPT_CHANNEL:
case NG_NETOPT_CHANNEL:
if (value_len < sizeof(uint16_t)) {
return -EOVERFLOW;
}
@ -465,7 +461,7 @@ static int _set(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value,
dev->chan = *_get_uint16_ptr(value);
return sizeof(uint16_t);
case NETCONF_OPT_ADDRESS:
case NG_NETOPT_ADDRESS:
if (value_len < sizeof(be_uint16_t)) {
return -EOVERFLOW;
}
@ -476,7 +472,7 @@ static int _set(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value,
return sizeof(be_uint16_t);
}
case NETCONF_OPT_ADDRESS_LONG:
case NG_NETOPT_ADDRESS_LONG:
if (value_len < sizeof(be_uint64_t)) {
return -EOVERFLOW;
}
@ -487,7 +483,7 @@ static int _set(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value,
return sizeof(be_uint64_t);
}
case NETCONF_OPT_ADDR_LEN:
case NG_NETOPT_ADDR_LEN:
if (value_len < sizeof(uint16_t)) {
return -EOVERFLOW;
}
@ -507,7 +503,7 @@ static int _set(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value,
return sizeof(uint16_t);