static int _netif_set(char *cmd_name, kernel_pid_t dev, char *key, char *value) { if ((strcmp("addr", key) == 0) || (strcmp("addr_short", key) == 0)) { return _netif_set_addr(dev, NETOPT_ADDRESS, value); } else if (strcmp("addr_long", key) == 0) { return _netif_set_addr(dev, NETOPT_ADDRESS_LONG, value); } else if ((strcmp("channel", key) == 0) || (strcmp("chan", key) == 0)) { return _netif_set_u16(dev, NETOPT_CHANNEL, value); } else if ((strcmp("nid", key) == 0) || (strcmp("pan", key) == 0) || (strcmp("pan_id", key) == 0)) { return _netif_set_u16(dev, NETOPT_NID, value); } else if (strcmp("power", key) == 0) { return _netif_set_i16(dev, NETOPT_TX_POWER, value); } else if (strcmp("src_len", key) == 0) { return _netif_set_u16(dev, NETOPT_SRC_LEN, value); } else if (strcmp("state", key) == 0) { return _netif_set_state(dev, value); } _set_usage(cmd_name); return 1; }
static int _netif_set(char *cmd_name, kernel_pid_t dev, char *key, char *value) { if ((strcmp("addr", key) == 0) || (strcmp("addr_short", key) == 0)) { return _netif_set_addr(dev, NETOPT_ADDRESS, value); } else if (strcmp("addr_long", key) == 0) { return _netif_set_addr(dev, NETOPT_ADDRESS_LONG, value); } else if ((strcmp("channel", key) == 0) || (strcmp("chan", key) == 0)) { return _netif_set_u16(dev, NETOPT_CHANNEL, value); } else if (strcmp("page", key) == 0) { return _netif_set_u16(dev, NETOPT_CHANNEL_PAGE, value); } else if ((strcmp("nid", key) == 0) || (strcmp("pan", key) == 0) || (strcmp("pan_id", key) == 0)) { return _netif_set_u16(dev, NETOPT_NID, value); } else if (strcmp("power", key) == 0) { return _netif_set_i16(dev, NETOPT_TX_POWER, value); } else if (strcmp("src_len", key) == 0) { return _netif_set_u16(dev, NETOPT_SRC_LEN, value); } else if (strcmp("state", key) == 0) { return _netif_set_state(dev, value); } else if (strcmp("retrans", key) == 0) { return _netif_set_u8(dev, NETOPT_RETRANS, value); } else if (strcmp("csma_retries", key) == 0) { return _netif_set_u8(dev, NETOPT_CSMA_RETRIES, value); } else if (strcmp("cca_threshold", key) == 0) { return _netif_set_u8(dev, NETOPT_CCA_THRESHOLD, value); } else if (strcmp("encrypt", key) == 0) { return _netif_set_encrypt(dev, NETOPT_ENCRYPTION, value); } else if (strcmp("key", key) == 0) { return _netif_set_encrypt_key(dev, NETOPT_ENCRYPTION_KEY, value); } _set_usage(cmd_name); return 1; }
static int _netif_set(char *cmd_name, kernel_pid_t iface, char *key, char *value) { if ((strcmp("addr", key) == 0) || (strcmp("addr_short", key) == 0)) { return _netif_set_addr(iface, NETOPT_ADDRESS, value); } else if (strcmp("addr_long", key) == 0) { return _netif_set_addr(iface, NETOPT_ADDRESS_LONG, value); } else if (strcmp("cca_threshold", key) == 0) { return _netif_set_u8(iface, NETOPT_CCA_THRESHOLD, 0, value); } else if ((strcmp("frequency", key) == 0) || (strcmp("freq", key) == 0)) { return _netif_set_u32(iface, NETOPT_CHANNEL_FREQUENCY, 0, value); } else if ((strcmp("bandwidth", key) == 0) || (strcmp("bw", key) == 0)) { return _netif_set_bandwidth(iface, value); } else if ((strcmp("spreading_factor", key) == 0) || (strcmp("sf", key) == 0)) { return _netif_set_u8(iface, NETOPT_SPREADING_FACTOR, 0, value); } else if ((strcmp("coding_rate", key) == 0) || (strcmp("cr", key) == 0)) { return _netif_set_coding_rate(iface, value); } else if ((strcmp("channel", key) == 0) || (strcmp("chan", key) == 0)) { return _netif_set_u16(iface, NETOPT_CHANNEL, 0, value); } else if (strcmp("csma_retries", key) == 0) { return _netif_set_u8(iface, NETOPT_CSMA_RETRIES, 0, value); } else if ((strcmp("hl", key) == 0) || (strcmp("hop_limit", key) == 0)) { return _netif_set_u8(iface, NETOPT_HOP_LIMIT, 0, value); } else if (strcmp("key", key) == 0) { return _netif_set_encrypt_key(iface, NETOPT_ENCRYPTION_KEY, value); } #ifdef MODULE_GNRC_IPV6 else if (strcmp("mtu", key) == 0) { return _netif_set_u16(iface, NETOPT_MAX_PDU_SIZE, GNRC_NETTYPE_IPV6, value); } #endif else if ((strcmp("nid", key) == 0) || (strcmp("pan", key) == 0) || (strcmp("pan_id", key) == 0)) { return _netif_set_u16(iface, NETOPT_NID, 0, value); } else if (strcmp("page", key) == 0) { return _netif_set_u16(iface, NETOPT_CHANNEL_PAGE, 0, value); } else if (strcmp("power", key) == 0) { return _netif_set_i16(iface, NETOPT_TX_POWER, value); } else if (strcmp("retrans", key) == 0) { return _netif_set_u8(iface, NETOPT_RETRANS, 0, value); } else if (strcmp("src_len", key) == 0) { return _netif_set_u16(iface, NETOPT_SRC_LEN, 0, value); } else if (strcmp("state", key) == 0) { return _netif_set_state(iface, value); } _set_usage(cmd_name); return 1; }