From f3bdf7232d6cc8916d6e3d6c52cccf47ff7be7b0 Mon Sep 17 00:00:00 2001 From: Jose Alamos Date: Tue, 14 Jul 2020 12:09:43 +0200 Subject: [PATCH] netopt: add NETOPT_PDU_SIZE --- sys/include/net/netopt.h | 16 ++++++++++++++++ sys/net/crosslayer/netopt/netopt.c | 1 + 2 files changed, 17 insertions(+) diff --git a/sys/include/net/netopt.h b/sys/include/net/netopt.h index b3644029d3..3103f4b66a 100644 --- a/sys/include/net/netopt.h +++ b/sys/include/net/netopt.h @@ -195,6 +195,22 @@ typedef enum { * @brief (uint16_t) maximum protocol data unit */ NETOPT_MAX_PDU_SIZE, + /** + * @brief (uint16_t) protocol data unit size + * + * When set, fixes the number of bytes to be received. This is required for + * MAC layers with implicit header mode (no packet length information in + * PDDU) and predictable packet length (e.g LoRaWAN beacons). The device + * driver implementation should attempt to read exactly the expected number + * of bytes (possibly filling it up with garbage data if the payload is + * smaller). + * + * When get, returns the number of expected bytes for the next reception. + * + * In some MAC layers it will only be effective if used in conjunction with + * @ref NETOPT_FIXED_HEADER + */ + NETOPT_PDU_SIZE, /** * @brief (@ref netopt_enable_t) frame preloading * diff --git a/sys/net/crosslayer/netopt/netopt.c b/sys/net/crosslayer/netopt/netopt.c index d2ef4e9a9c..bc737912e1 100644 --- a/sys/net/crosslayer/netopt/netopt.c +++ b/sys/net/crosslayer/netopt/netopt.c @@ -41,6 +41,7 @@ static const char *_netopt_strmap[] = { [NETOPT_IPV6_FORWARDING] = "NETOPT_IPV6_FORWARDING", [NETOPT_IPV6_SND_RTR_ADV] = "NETOPT_IPV6_SND_RTR_ADV", [NETOPT_TX_POWER] = "NETOPT_TX_POWER", + [NETOPT_PDU_SIZE] = "NETOPT_PDU_SIZE", [NETOPT_MAX_PDU_SIZE] = "NETOPT_MAX_PDU_SIZE", [NETOPT_PRELOADING] = "NETOPT_PRELOADING", [NETOPT_PROMISCUOUSMODE] = "NETOPT_PROMISCUOUSMODE",