netopt.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Freie Universität Berlin
3  * 2015 Kaspar Schleiser <kaspar@schleiser.de>
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser
6  * General Public License v2.1. See the file LICENSE in the top level
7  * directory for more details.
8  */
9 
10 #pragma once
11 
27 #include <stdint.h>
28 #include <stdbool.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
44 typedef enum {
69 
96 
101 
120 
254 
267 
277 
291 
300 
310 
319 
330 
339 
348 
358 
367 
374 
379 
396 
404 
414 
419 
426 
444 
455 
466 
475 
480 
485 
494 
499 
504 
511 
518 
525 
530 
535 
540 
545 
550 
557 
564 
573 
580 
587 
595 
600 
605 
610 
615 
620 
625 
632 
639 
646 
652 
658 
663 
668 
674 
679 
684 
689 
694 
701 
706 
711 
716 
721 
726 
731 
736 
741 
746 
751 
758 
763 
764  /* add more options if needed */
765 
770 
775 
780 
788 
799 
808 
818 
828 
838 
854 
859 
864 
872 
879 } netopt_t;
880 
884 typedef enum {
888 
893 typedef enum {
910  /* add other states if needed */
912 
916 typedef enum {
922 
926 typedef uint16_t netopt_channel_t;
927 
931 typedef int16_t netopt_rssi_t;
932 
936 #define NETOPT_SCAN_REQ_ALL_CH ((netopt_channel_t)(-1))
937 
941 typedef struct netopt_scan_result {
945 
952 #define NETOPT_SCAN_RESULT_INITIALIZER(ch, str) \
953  (netopt_scan_result_t) { \
954  .channel = ch, \
955  .strength = str, \
956  }
957 
963 struct l2scan_list;
964 
968 typedef void (*netopt_on_scan_result_t) (void *netif, const struct l2scan_list *res);
969 
973 typedef struct netopt_scan_request {
977 
984 #define NETOPT_SCAN_REQUEST_INITIALIZER(ch, cb) \
985  (netopt_scan_request_t) { \
986  .channel = ch, \
987  .scan_cb = (netopt_on_scan_result_t)cb, \
988  }
989 
993 typedef struct netopt_connect_result {
996 
1002 #define NETOPT_CONNECT_RESULT_INITIALIZER(ch) \
1003  (netopt_connect_result_t) { \
1004  .channel = ch, \
1005  }
1006 
1013 
1019 #define NETOPT_DISCONNECT_RESULT_INITIALIZER(ch) \
1020  (netopt_disconnect_result_t) { \
1021  .channel = ch, \
1022  }
1023 
1027 typedef void (*netopt_on_connect_result_t) (void *netif, const struct netopt_connect_result *res);
1028 
1032 typedef void (*netopt_on_disconnect_result_t) (void *netif, const struct netopt_disconnect_result *res);
1033 
1037 typedef struct netopt_connect_request {
1042 
1050 #define NETOPT_CONNECT_REQUEST_INITIALIZER(ch, ccb, dcb) \
1051  (netopt_connect_request_t) { \
1052  .disconn_cb = (netopt_on_disconnect_result_t)dcb, \
1053  .conn_cb = (netopt_on_connect_result_t)ccb, \
1054  .channel = ch, \
1055  }
1056 
1063 
1069 #define NETOPT_DISCONNECT_REQUEST_INITIALIZER(dcb) \
1070  (netopt_disconnect_request_t) { \
1071  .disconn_cb = (netopt_on_disconnect_result_t)dcb, \
1072  }
1073 
1081 const char *netopt2str(netopt_t opt);
1082 
1083 #ifdef __cplusplus
1084 }
1085 #endif
1086 
struct netopt_scan_request netopt_scan_request_t
Basic network scan request.
netopt_enable_t
Binary parameter for enabling and disabling options.
Definition: netopt.h:884
struct netopt_disconnect_result netopt_disconnect_result_t
Basic disconnect result.
netopt_t
Global list of configuration options available throughout the network stack, e.g.
Definition: netopt.h:44
int16_t netopt_rssi_t
Netopt RSSI type.
Definition: netopt.h:931
netopt_rf_testmode_t
Option parameter to be used with NETOPT_RF_TESTMODE.
Definition: netopt.h:916
void(* netopt_on_connect_result_t)(void *netif, const struct netopt_connect_result *res)
Basic callback type on network connection NETOPT_CONNECT.
Definition: netopt.h:1027
netopt_state_t
Option parameter to be used with NETOPT_STATE to set or get the state of a network device or protocol...
Definition: netopt.h:893
const char * netopt2str(netopt_t opt)
Get a string ptr corresponding to opt, for debugging.
struct netopt_connect_request netopt_connect_request_t
Basic network connect request.
struct netopt_connect_result netopt_connect_result_t
Basic network connect result.
uint16_t netopt_channel_t
Netopt RF channel type.
Definition: netopt.h:926
struct netopt_disconnect_request netopt_disconnect_request_t
Basic network disconnect request.
struct netopt_scan_result netopt_scan_result_t
Basic network scan result.
void(* netopt_on_disconnect_result_t)(void *netif, const struct netopt_disconnect_result *res)
Basic callback type on network disconnection NETOPT_CONNECT.
Definition: netopt.h:1032
void(* netopt_on_scan_result_t)(void *netif, const struct l2scan_list *res)
Basic callback type on network scan NETOPT_CONNECT.
Definition: netopt.h:968
@ NETOPT_DISABLE
disable a given option
Definition: netopt.h:885
@ NETOPT_ENABLE
enable a given option
Definition: netopt.h:886
@ NETOPT_LORAWAN_ADR
(netopt_enable_t) LoRaWAN adaptive datarate
Definition: netopt.h:662
@ NETOPT_L2_GROUP
(array of byte array) get link layer multicast groups as array of byte arrays (length of each byte ar...
Definition: netopt.h:849
@ NETOPT_CHANNEL_HOP_PERIOD
(uint8_t) channel hopping period
Definition: netopt.h:503
@ NETOPT_RETRANS
(uint8_t) maximum number of retransmissions
Definition: netopt.h:232
@ NETOPT_GTS_ALLOC
(ieee802154_dsme_alloc_t) Allocate DSME GTS slot
Definition: netopt.h:863
@ NETOPT_CSMA_RETRIES
(uint8_t) maximum number of CSMA retries
Definition: netopt.h:329
@ NETOPT_L2FILTER
(l2filter_t) add an address to a link layer filter list
Definition: netopt.h:454
@ NETOPT_MR_OFDM_MCS
(uint8_t) MR-OFDM PHY Modulation and Coding Scheme (Values: 0-6)
Definition: netopt.h:720
@ NETOPT_BATMON
(uint16_t) Set the battery monitor voltage (in mV).
Definition: netopt.h:837
@ NETOPT_OQPSK_RATE
(uint8_t) legacy O-QPSK proprietary mode Allows to select higher data rates than standard 250 kbit/s ...
Definition: netopt.h:700
@ NETOPT_LORAWAN_APPSKEY
(uint8_t*) LoRaWAN application session key (16 bytes length)
Definition: netopt.h:624
@ NETOPT_IPV6_GROUP
(ipv6_addr_t) get IPv6 multicast groups of an interface as array of ipv6_addr_t or join an IPv6 multi...
Definition: netopt.h:163
@ NETOPT_IEEE802154_PHY
(uint8_t) 802.15.4 PHY mode
Definition: netopt.h:693
@ NETOPT_ADDRESS
(byte array, see below) link layer address in network byte order
Definition: netopt.h:68
@ NETOPT_DEVICE_TYPE
(uint16_t) device type
Definition: netopt.h:373
@ NETOPT_MR_FSK_SRATE
(uint8_t) MR-FSK PHY Symbol Rate (kHz)
Definition: netopt.h:735
@ NETOPT_ACTIVE
(netopt_enable_t) network interface status.
Definition: netopt.h:309
@ NETOPT_CHECKSUM
(netopt_enable_t) enable hardware checksumming
Definition: netopt.h:586
@ NETOPT_CHANNEL_PAGE
(uint16_t) channel page as defined by IEEE 802.15.4
Definition: netopt.h:378
@ NETOPT_MAX_PDU_SIZE
(uint16_t) maximum protocol data unit
Definition: netopt.h:183
@ NETOPT_OTAA
(netopt_enable_t) Enable or disable OTAA activation (LoRaWAN)
Definition: netopt.h:769
@ NETOPT_6LO
(netopt_enable_t) 6Lo support
Definition: netopt.h:556
@ NETOPT_NUM_GATEWAYS
(uint8_t) Get the number of gateways of the last Link Check request.
Definition: netopt.h:779
@ NETOPT_CHANNEL_HOP
(netopt_enable_t) channel hopping
Definition: netopt.h:498
@ NETOPT_RAWMODE
(netopt_enable_t) when enabled, bypass protocol processing of incoming frames
Definition: netopt.h:244
@ NETOPT_PROTO
(gnrc_nettype_t) the protocol for the layer
Definition: netopt.h:236
@ NETOPT_LORAWAN_SNWKSINTKEY
(uint8_t*) LoRaWAN serving network session integrity key (16 bytes length)
Definition: netopt.h:638
@ NETOPT_LORAWAN_PUBLIC_NETWORK
(netopt_enable_t) LoRaWAN public network
Definition: netopt.h:667
@ NETOPT_LINK_CHECK
(netopt_enable_t) Perform a Link Check request (LoRaWAN)
Definition: netopt.h:787
@ NETOPT_AUTOCCA
(netopt_enable_t) perform channel clear assessment before transmitting
Definition: netopt.h:290
@ NETOPT_ADDRESS_LONG
(byte array, see below) long link layer address in network byte order
Definition: netopt.h:80
@ NETOPT_ADDR_LEN
(uint16_t) get the default address length a network device expects
Definition: netopt.h:84
@ NETOPT_RSSI
(int16_t) Received Signal Strength Indicator (RSSI)
Definition: netopt.h:798
@ NETOPT_CSMA_MAXBE
(uint8_t) maximum backoff exponent for the CSMA-CA algorithm
Definition: netopt.h:338
@ NETOPT_IPV6_GROUP_LEAVE
(ipv6_addr_t) Leave an IPv6 multicast group on an interface
Definition: netopt.h:167
@ NETOPT_DEMOD_MARGIN
(uint8_t) Get the demodulation margin of the last Link Check request.
Definition: netopt.h:774
@ NETOPT_INTEGRITY_CHECK
(netopt_enable_t) frame integrity check (e.g CRC)
Definition: netopt.h:484
@ NETOPT_LORAWAN_RX2_FREQ
(uint32_t) LoRaWAN frequency used for second RX window
Definition: netopt.h:678
@ NETOPT_MR_OQPSK_RATE
(uint8_t) MR-O-QPSK Rate Mode
Definition: netopt.h:710
@ NETOPT_SCAN
(netopt_scan_request_t) Instruct the interface to do a network scan
Definition: netopt.h:807
@ NETOPT_MR_OFDM_OPTION
(uint8_t) MR-OFDM PHY Option (Values: 1-4)
Definition: netopt.h:715
@ NETOPT_NID
(uint16_t) network ID
Definition: netopt.h:95
@ NETOPT_CSMA
(netopt_enable_t) CSMA/CA support
Definition: netopt.h:318
@ NETOPT_MR_FSK_MODULATION_INDEX
(uint8_t) MR-FSK PHY Modulation Index (x 64)
Definition: netopt.h:725
@ NETOPT_IQ_INVERT
(netopt_enable_t) IQ inverted
Definition: netopt.h:549
@ NETOPT_L2FILTER_RM
(l2filter_t) remove an address from a link layer filter list
Definition: netopt.h:465
@ NETOPT_LORAWAN_MIN_RX_SYMBOL
(uint8_t) LoRaWAN maximum system overall timing error (symbols)
Definition: netopt.h:688
@ NETOPT_IS_WIRED
(netopt_enable_t) read-only check for a wired interface.
Definition: netopt.h:366
@ NETOPT_RF_TESTMODE
(netopt_rf_testmode_t) Test mode for the radio, e.g.
Definition: netopt.h:443
@ NETOPT_CODING_RATE
(uint8_t) radio coding rate
Definition: netopt.h:539
@ NETOPT_MR_FSK_FEC
(uint8_t) MR-FSK PHY Forward Error Correction
Definition: netopt.h:740
@ NETOPT_PROMISCUOUSMODE
(netopt_enable_t) promiscuous mode
Definition: netopt.h:210
@ NETOPT_LORAWAN_APPEUI
(uint8_t*) LoRaWAN application EUI (8 bytes length)
Definition: netopt.h:599
@ NETOPT_LAST_ED_LEVEL
(int8_t) Energy level during the last performed CCA or RX frame
Definition: netopt.h:474
@ NETOPT_LINK
(netopt_enable_t) network interface link status.
Definition: netopt.h:299
@ NETOPT_IPV6_IID
(eui64_t) get the IPv6 interface identifier of a network interface
Definition: netopt.h:119
@ NETOPT_TX_START_IRQ
(netopt_enable_t) Used to check if the driver generates NETDEV_EVENT_TX_STARTED events
Definition: netopt.h:266
@ NETOPT_LORAWAN_JOINEUI
(uint8_t*) LoRaWAN join EUI (8 bytes length)
Definition: netopt.h:604
@ NETOPT_BANDWIDTH
(uint8_t) radio modulation bandwidth
Definition: netopt.h:529
@ NETOPT_IPV6_FORWARDING
(netopt_enable_t) IPv6 forwarding state
Definition: netopt.h:171
@ NETOPT_STATS
(netstats_t) get statistics about sent and received packets and data of the device or protocol
Definition: netopt.h:413
@ NETOPT_PDU_SIZE
(uint16_t) protocol data unit size
Definition: netopt.h:199
@ NETOPT_TX_RETRIES_NEEDED
(uint8_t) retry amount from missing ACKs of the last transmission
Definition: netopt.h:572
@ NETOPT_CSMA_MINBE
(uint8_t) minimum backoff exponent for the CSMA-CA algorithm
Definition: netopt.h:347
@ NETOPT_CCA_MODE
(uint8_t) CCA mode for the radio transceiver
Definition: netopt.h:403
@ NETOPT_TX_POWER
(int16_t) transmit power for radio devices in dBm
Definition: netopt.h:179
@ NETOPT_STATE
(netopt_state_t) state of network device
Definition: netopt.h:240
@ NETOPT_SRC_LEN
(uint16_t) address length to use for the link layer source address
Definition: netopt.h:88
@ NETOPT_IPV6_ADDR
(ipv6_addr_t[]) get IPv6 addresses of an interface as array of ipv6_addr_t or add an IPv6 address as ...
Definition: netopt.h:135
@ NETOPT_CCA_THRESHOLD
(int8_t) CCA threshold for the radio transceiver
Definition: netopt.h:395
@ NETOPT_ENCRYPTION
(netopt_enable_t) link layer encryption.
Definition: netopt.h:418
@ NETOPT_MAC_NO_SLEEP
(netopt_enable_t) block transceiver sleep
Definition: netopt.h:357
@ NETOPT_ACK_REQ
(netopt_enable_t) acknowledgement request on outgoing frames
Definition: netopt.h:228
@ NETOPT_LORAWAN_NWKKEY
(uint8_t*) LoRaWAN network key (16 bytes length)
Definition: netopt.h:614
@ NETOPT_ENCRYPTION_KEY
(byte array) set encryption key
Definition: netopt.h:425
@ NETOPT_RX_SYMBOL_TIMEOUT
(uint16_t) Get or set the number of PHY symbols before assuming there's no data
Definition: netopt.h:762
@ NETOPT_CONNECT
(netopt_connect_request_t) Instructs the interface to connect to a network
Definition: netopt.h:817
@ NETOPT_SINGLE_RECEIVE
(netopt_enable_t) single frame reception
Definition: netopt.h:510
@ NETOPT_PRELOADING
(netopt_enable_t) frame preloading
Definition: netopt.h:206
@ NETOPT_AUTOACK
(netopt_enable_t) automatic link layer ACKs
Definition: netopt.h:214
@ NETOPT_LORAWAN_DEVICE_CLASS
(uint8_t) LoRaWAN device class (A, B, C)
Definition: netopt.h:651
@ NETOPT_PAN_COORD
(netopt_enable_t) Set/Get PAN coordinator role
Definition: netopt.h:858
@ NETOPT_NUMOF
maximum number of options defined here.
Definition: netopt.h:878
@ NETOPT_ACK_PENDING
(netopt_enable_t) frame pending bit of ACKs
Definition: netopt.h:221
@ NETOPT_RX_TIMEOUT
(uint32_t) reception timeout of a frame
Definition: netopt.h:517
@ NETOPT_FIXED_HEADER
(netopt_enable_t) fixed header mode
Definition: netopt.h:544
@ NETOPT_MR_OQPSK_CHIPS
(uint8_t) MR-O-QPSK Chip Rate (kchip/s)
Definition: netopt.h:705
@ NETOPT_PHY_BUSY
(netopt_enable_t) enable busy mode
Definition: netopt.h:594
@ NETOPT_LORAWAN_MAX_RX_ERROR
(uint32_t) LoRaWAN maximum system overall timing error (ms)
Definition: netopt.h:683
@ NETOPT_GTS_TX
(netopt_enable_t) Transmit frames using GTS transmission
Definition: netopt.h:871
@ NETOPT_TX_END_IRQ
(netopt_enable_t) Used to check if the driver generates NETDEV_EVENT_TX_COMPLETE events
Definition: netopt.h:276
@ NETOPT_SPREADING_FACTOR
(uint8_t) radio spreading factor
Definition: netopt.h:534
@ NETOPT_L2_GROUP_LEAVE
(array of byte arrays) Leave an link layer multicast group
Definition: netopt.h:853
@ NETOPT_CHANNEL
(uint16_t) channel number
Definition: netopt.h:48
@ NETOPT_LORAWAN_RX2_DR
(loramac_dr_idx_t) LoRaWAN datarate for second RX window
Definition: netopt.h:673
@ NETOPT_6LO_IPHC
(netopt_enable_t) header compression
Definition: netopt.h:563
@ NETOPT_MR_FSK_MODULATION_ORDER
(uint8_t) MR-FSK Modulation Order
Definition: netopt.h:730
@ NETOPT_PREAMBLE_LENGTH
(uint16_t) preamble length
Definition: netopt.h:479
@ NETOPT_IS_CHANNEL_CLR
(netopt_enable_t) check whether the network medium is clear
Definition: netopt.h:55
@ NETOPT_TX_TIMEOUT
(uint32_t) transmission timeout of a frame
Definition: netopt.h:524
@ NETOPT_RX_START_IRQ
(netopt_enable_t) Used to check if the driver generates NETDEV_EVENT_RX_STARTED events
Definition: netopt.h:253
@ NETOPT_IPV6_ADDR_REMOVE
(ipv6_addr_t) Removes an IPv6 address from an interface
Definition: netopt.h:139
@ NETOPT_DISCONNECT
(netopt_disconnect_request_t) Instructs the interface to disconnect from a network
Definition: netopt.h:827
@ NETOPT_SYNCWORD
(uint8_t*) phy layer syncword
Definition: netopt.h:750
@ NETOPT_LORAWAN_APPKEY
(uint8_t*) LoRaWAN application key (16 bytes length)
Definition: netopt.h:609
@ NETOPT_IPV6_SND_RTR_ADV
(netopt_enable_t) sending of IPv6 router advertisements
Definition: netopt.h:175
@ NETOPT_CHANNEL_SPACING
(uint8_t) PHY Channel Spacing (kHz)
Definition: netopt.h:745
@ NETOPT_CHANNEL_FREQUENCY
(uint32_t) channel center frequency
Definition: netopt.h:493
@ NETOPT_IPV6_ADDR_FLAGS
(array of uint8_t) get the flags to the addresses returned by NETOPT_IPV6_ADDR as array
Definition: netopt.h:148
@ NETOPT_RANDOM
(uint32_t) Get a random value from the device
Definition: netopt.h:757
@ NETOPT_LORAWAN_DR
(uint8_t) LoRaWAN datarate
Definition: netopt.h:657
@ NETOPT_LORAWAN_NWKSENCKEY
(uint8_t*) LoRaWAN network session encryption key buffer (16 bytes length)
Definition: netopt.h:645
@ NETOPT_BLE_CTX
(netdev_ble_ctx_t) set BLE radio context (channel, CRC, AA)
Definition: netopt.h:579
@ NETOPT_HOP_LIMIT
(uint8_t) hop limit
Definition: netopt.h:100
@ NETOPT_LORAWAN_FNWKSINTKEY
(uint8_t*) LoRaWAN forwarding network session integrity key (16 bytes length)
Definition: netopt.h:631
@ NETOPT_LORAWAN_NWKSKEY
(uint8_t*) LoRaWAN network session key (16 bytes length)
Definition: netopt.h:619
@ NETOPT_RF_TESTMODE_CTX_PRBS9
PRBS9 continuous tx mode.
Definition: netopt.h:920
@ NETOPT_RF_TESTMODE_IDLE
idle mode, radio off
Definition: netopt.h:917
@ NETOPT_RF_TESTMODE_CTX_CW
carrier wave continuous tx mode
Definition: netopt.h:919
@ NETOPT_RF_TESTMODE_CRX
continuous rx mode
Definition: netopt.h:918
@ NETOPT_STATE_IDLE
idle mode, the device listens to receive packets
Definition: netopt.h:896
@ NETOPT_STATE_OFF
powered off
Definition: netopt.h:894
@ NETOPT_STATE_RX
receive mode, the device currently receives a packet
Definition: netopt.h:898
@ NETOPT_STATE_STANDBY
standby mode.
Definition: netopt.h:908
@ NETOPT_STATE_TX
transmit mode, set: triggers transmission of a preloaded packet (see NETOPT_PRELOADING*).
Definition: netopt.h:900
@ NETOPT_STATE_RESET
triggers a hardware reset.
Definition: netopt.h:906
@ NETOPT_STATE_SLEEP
sleep mode
Definition: netopt.h:895
Type of a Link Layer scan list.
Definition: l2scan_list.h:36
Basic network connect request.
Definition: netopt.h:1037
netopt_on_connect_result_t conn_cb
On connect callback.
Definition: netopt.h:1039
netopt_on_disconnect_result_t disconn_cb
On disconnect callback.
Definition: netopt.h:1038
netopt_channel_t channel
Channel of the network to connect to.
Definition: netopt.h:1040
Basic network connect result.
Definition: netopt.h:993
netopt_channel_t channel
Connected channel.
Definition: netopt.h:994
Basic network disconnect request.
Definition: netopt.h:1060
netopt_on_disconnect_result_t disconn_cb
On disconnect callback.
Definition: netopt.h:1061
Basic disconnect result.
Definition: netopt.h:1010
netopt_channel_t channel
Channel of the disconnected AP.
Definition: netopt.h:1011
Basic network scan request.
Definition: netopt.h:973
netopt_on_scan_result_t scan_cb
Scan result callback.
Definition: netopt.h:974
netopt_channel_t channel
Channel to scan.
Definition: netopt.h:975
Basic network scan result.
Definition: netopt.h:941
netopt_channel_t channel
Scanned channel.
Definition: netopt.h:942
netopt_rssi_t strength
Received signal strength.
Definition: netopt.h:943