1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-29 16:31:18 +01:00

Merge pull request #18727 from miri64/gnrc/enh/explicit-pseudomodules

gnrc: make pseudo-modules explicit + documentation improvements
This commit is contained in:
Martine Lenders 2022-10-14 17:39:39 +02:00 committed by GitHub
commit c94c32dce4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 201 additions and 140 deletions

View File

@ -87,7 +87,21 @@ PSEUDOMODULES += gcoap_dns
PSEUDOMODULES += gcoap_dns_proxied
## @}
PSEUDOMODULES += fido2_tests
PSEUDOMODULES += gnrc_dhcpv6_%
## @addtogroup net_dhcpv6_client
## @{
## @defgroup net_gnrc_dhcpv6_client gnrc_dhcpv6_client: Basic DHCPv6 client implementation in GNRC
## @{
PSEUDOMODULES += gnrc_dhcpv6_client
## @}
## @defgroup net_gnrc_dhcpv6_client_6lbr gnrc_dhcpv6_client_6lbr: Basic client for GNRC 6LoWPAN BRs
## @{
PSEUDOMODULES += gnrc_dhcpv6_client_6lbr
## @}
## @addtogroup net_dhcpv6_client_simple_pd
## @{
PSEUDOMODULES += gnrc_dhcpv6_client_simple_pd
## @}
## @}
PSEUDOMODULES += gnrc_ipv6_auto_subnets_auto_init
PSEUDOMODULES += gnrc_ipv6_auto_subnets_simple
PSEUDOMODULES += gnrc_ipv6_default
@ -134,7 +148,79 @@ PSEUDOMODULES += gnrc_netif_single
PSEUDOMODULES += gnrc_netif_cmd_lora
## @}
PSEUDOMODULES += gnrc_netif_dedup
PSEUDOMODULES += gnrc_nettype_%
## @addtogroup net_gnrc_nettype
## @{
## @defgroup net_gnrc_nettype_ccn gnrc_nettype_ccn
## @{
## Enables @ref GNRC_NETTYPE_CCN and @ref GNRC_NETTYPE_CCN_CHUNK
PSEUDOMODULES += gnrc_nettype_ccn
## @}
## @defgroup net_gnrc_nettype_gomac gnrc_nettype_gomac
## @{
## Enables @ref GNRC_NETTYPE_GOMACH
PSEUDOMODULES += gnrc_nettype_gomach
## @}
## @defgroup net_gnrc_nettype_icmpv6 gnrc_nettype_icmpv6
## Enables @ref GNRC_NETTYPE_ICMPV6.
## @{
PSEUDOMODULES += gnrc_nettype_icmpv6
## @}
## @defgroup net_gnrc_nettype_ipv6 gnrc_nettype_ipv6
## Enables @ref GNRC_NETTYPE_IPV6.
## @{
PSEUDOMODULES += gnrc_nettype_ipv6
## @}
## @defgroup net_gnrc_nettype_ipv6_ext gnrc_nettype_ipv6_ext
## @{
## Enables @ref GNRC_NETTYPE_IPV6_EXT.
PSEUDOMODULES += gnrc_nettype_ipv6_ext
## @}
## @defgroup net_gnrc_nettype_lorawan gnrc_nettype_lorawan
## Enables @ref GNRC_NETTYPE_LORAWAN
## @{
PSEUDOMODULES += gnrc_nettype_lorawan
## @}
## @defgroup net_gnrc_nettype_lwmac gnrc_nettype_lwmac
## Enables @ref GNRC_NETTYPE_LWMAC
## @{
PSEUDOMODULES += gnrc_nettype_lwmac
## @}
## @defgroup net_gnrc_nettype_ndn gnrc_nettype_ndn
## Enables @ref GNRC_NETTYPE_NDN
## @{
PSEUDOMODULES += gnrc_nettype_ndn
## @}
## @defgroup net_gnrc_nettype_sixlowpan gnrc_nettype_sixlowpan
## Enables @ref GNRC_NETTYPE_SIXLOWPAN
## @{
PSEUDOMODULES += gnrc_nettype_sixlowpan
## @}
## @defgroup net_gnrc_nettype_tcp gnrc_nettype_tcp
## Enables @ref GNRC_NETTYPE_TCP
## @{
PSEUDOMODULES += gnrc_nettype_tcp
## @}
## @defgroup net_gnrc_nettype_udp gnrc_nettype_udp
## Enables @ref GNRC_NETTYPE_UDP
## @{
PSEUDOMODULES += gnrc_nettype_udp
## @}
## @}
PSEUDOMODULES += gnrc_sixloenc
PSEUDOMODULES += gnrc_sixlowpan_border_router_default
PSEUDOMODULES += gnrc_sixlowpan_default

View File

@ -7,8 +7,8 @@
*/
/**
* @defgroup net_dhcpv6_client_simple_pd DHCPv6 client for simple prefix
* delegation
* @defgroup net_dhcpv6_client_simple_pd gnrc_dhcpv6_client_simple_pd: DHCPv6 client for
* simple prefix delegation
* @ingroup net_dhcpv6_client
* @brief DHCPv6 client bootstrapping for prefix deligation with routers &
* 6LoWPAN border routers

View File

@ -7,7 +7,7 @@
*/
/**
* @defgroup net_gnrc_nettype Protocol type
* @defgroup net_gnrc_nettype gnrc_nettype: Protocol type
* @ingroup net_gnrc
* @brief Protocol type definitions and helper functions
*
@ -15,8 +15,9 @@
* the @ref net_gnrc_netreg, and the @ref net_gnrc_pkt to identify network protocols
* throughout the network stack.
*
* To include a nettype into your build, use the corresponding pseudo-module
* e.g. to use `GNRC_NETTYPE_IPV6` in your code, use
*
* To include a nettype into your build, use the corresponding module of the same name in
* lower-case, e.g., to use @ref GNRC_NETTYPE_IPV6 in your code, use:
*
* ```
* USEMODULE += gnrc_nettype_ipv6
@ -60,10 +61,6 @@ typedef enum {
GNRC_NETTYPE_NETIF = -1,
GNRC_NETTYPE_UNDEF = 0, /**< Protocol is undefined */
#if IS_USED(MODULE_GNRC_NETTYPE_SIXLOWPAN) || defined(DOXYGEN)
GNRC_NETTYPE_SIXLOWPAN, /**< Protocol is 6LoWPAN */
#endif
/**
* @{
* @name Link layer
@ -71,31 +68,21 @@ typedef enum {
#if IS_USED(MODULE_GNRC_NETTYPE_GOMACH) || defined(DOXYGEN)
GNRC_NETTYPE_GOMACH, /**< Protocol is GoMacH */
#endif
/**
* @}
*/
/**
* @{
* @name Link layer
*/
#if IS_USED(MODULE_GNRC_NETTYPE_LWMAC) || defined(DOXYGEN)
GNRC_NETTYPE_LWMAC, /**< Protocol is lwMAC */
#endif
/**
* @}
*/
/**
* @{
* @name Link layer
*/
#if IS_USED(MODULE_GNRC_NETTYPE_CUSTOM) || defined(DOXYGEN)
GNRC_NETTYPE_CUSTOM, /**< Custom ethertype */
GNRC_NETTYPE_CUSTOM, /**< Custom ethertype */
#endif
/** @} */
#if IS_USED(MODULE_GNRC_NETTYPE_SIXLOWPAN) || defined(DOXYGEN)
GNRC_NETTYPE_SIXLOWPAN, /**< Protocol is 6LoWPAN */
#endif
#if IS_USED(MODULE_GNRC_NETTYPE_LORAWAN) || defined(DOXYGEN)
GNRC_NETTYPE_LORAWAN, /**< Protocol is LoRaWAN */
#endif
/**
* @}
*/
/**
* @{
@ -110,9 +97,17 @@ typedef enum {
#if IS_USED(MODULE_GNRC_NETTYPE_ICMPV6) || defined(DOXYGEN)
GNRC_NETTYPE_ICMPV6, /**< Protocol is ICMPv6 */
#endif
/**
* @}
*/
#if IS_USED(MODULE_GNRC_NETTYPE_CCN) || defined(DOXYGEN)
GNRC_NETTYPE_CCN, /**< Protocol is CCN */
GNRC_NETTYPE_CCN_CHUNK, /**< Protocol is CCN, packet contains a content
chunk */
#endif
#if IS_USED(MODULE_GNRC_NETTYPE_NDN) || defined(DOXYGEN)
GNRC_NETTYPE_NDN, /**< Protocol is NDN */
#endif
/** @} */
/**
* @{
@ -124,46 +119,27 @@ typedef enum {
#if IS_USED(MODULE_GNRC_NETTYPE_UDP) || defined(DOXYGEN)
GNRC_NETTYPE_UDP, /**< Protocol is UDP */
#endif
/**
* @}
*/
#if IS_USED(MODULE_GNRC_NETTYPE_CCN) || defined(DOXYGEN)
GNRC_NETTYPE_CCN, /**< Protocol is CCN */
GNRC_NETTYPE_CCN_CHUNK, /**< Protocol is CCN, packet contains a content
chunk */
#endif
#if IS_USED(MODULE_GNRC_NETTYPE_NDN) || defined(DOXYGEN)
GNRC_NETTYPE_NDN, /**< Protocol is NDN */
#endif
#if IS_USED(MODULE_GNRC_NETTYPE_LORAWAN) || defined(DOXYGEN)
GNRC_NETTYPE_LORAWAN, /**< Protocol is LoRaWAN */
#endif
/** @} */
/**
* @{
* @name Testing
*/
#ifdef TEST_SUITES
GNRC_NETTYPE_TEST,
GNRC_NETTYPE_TEST, /**< Usable with test vectors */
#endif
/**
* @}
*/
/** @} */
GNRC_NETTYPE_NUMOF, /**< maximum number of available protocols */
} gnrc_nettype_t;
/**
* @brief Translates an Ether Type number to @ref net_gnrc_nettype
* @see [IANA, ETHER TYPES]
* (http://www.iana.org/assignments/ieee-802-numbers/ieee-802-numbers.xhtml)
* @brief Translates an Ether Type number to @ref gnrc_nettype_t
* @see [IANA, ETHER TYPES](http://www.iana.org/assignments/ieee-802-numbers/ieee-802-numbers.xhtml)
*
* @param[in] type An Ether Type number
*
* @return The corresponding @ref net_gnrc_nettype to @p type.
* @return The corresponding @ref gnrc_nettype_t to @p type.
* @return @ref GNRC_NETTYPE_UNDEF if @p type not translatable.
*/
static inline gnrc_nettype_t gnrc_nettype_from_ethertype(uint16_t type)
@ -195,9 +171,8 @@ static inline gnrc_nettype_t gnrc_nettype_from_ethertype(uint16_t type)
}
/**
* @brief Translates @ref net_gnrc_nettype to an Ether Type number
* @see [IANA, ETHER TYPES]
* (http://www.iana.org/assignments/ieee-802-numbers/ieee-802-numbers.xhtml)
* @brief Translates @ref gnrc_nettype_t to an Ether Type number
* @see [IANA, ETHER TYPES](http://www.iana.org/assignments/ieee-802-numbers/ieee-802-numbers.xhtml)
*
* @param[in] type A protocol type
*
@ -207,6 +182,10 @@ static inline gnrc_nettype_t gnrc_nettype_from_ethertype(uint16_t type)
static inline uint16_t gnrc_nettype_to_ethertype(gnrc_nettype_t type)
{
switch (type) {
#if IS_USED(MODULE_GNRC_NETTYPE_CUSTOM)
case GNRC_NETTYPE_CUSTOM:
return ETHERTYPE_CUSTOM;
#endif
#if IS_USED(MODULE_GNRC_SIXLOENC) && IS_USED(MODULE_GNRC_NETTYPE_SIXLOWPAN)
case GNRC_NETTYPE_SIXLOWPAN:
return ETHERTYPE_6LOENC;
@ -222,10 +201,6 @@ static inline uint16_t gnrc_nettype_to_ethertype(gnrc_nettype_t type)
#if IS_USED(MODULE_GNRC_NETTYPE_NDN)
case GNRC_NETTYPE_NDN:
return ETHERTYPE_NDN;
#endif
#if IS_USED(MODULE_GNRC_NETTYPE_CUSTOM)
case GNRC_NETTYPE_CUSTOM:
return ETHERTYPE_CUSTOM;
#endif
default:
return ETHERTYPE_UNKNOWN;
@ -233,14 +208,14 @@ static inline uint16_t gnrc_nettype_to_ethertype(gnrc_nettype_t type)
}
/**
* @brief Translates a Protocol Number to @ref net_gnrc_nettype
* @brief Translates a Protocol Number to @ref gnrc_nettype_t
* @see <a href="http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml">
* IANA, Assigned Internet Protocol Numbers
* </a>
*
* @param[in] num A Protocol Number
*
* @return The corresponding @ref net_gnrc_nettype to @p num.
* @return The corresponding @ref gnrc_nettype_t to @p num.
* @return @ref GNRC_NETTYPE_UNDEF if @p num not translatable.
*/
static inline gnrc_nettype_t gnrc_nettype_from_protnum(uint8_t num)
@ -278,7 +253,7 @@ static inline gnrc_nettype_t gnrc_nettype_from_protnum(uint8_t num)
}
/**
* @brief Translates @ref net_gnrc_nettype to a Protocol Number
* @brief Translates @ref gnrc_nettype_t to a Protocol Number
* @see <a href="http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml">
* IANA, Assigned Internet Protocol Numbers
* </a>
@ -291,14 +266,14 @@ static inline gnrc_nettype_t gnrc_nettype_from_protnum(uint8_t num)
static inline uint8_t gnrc_nettype_to_protnum(gnrc_nettype_t type)
{
switch (type) {
#if IS_USED(MODULE_GNRC_NETTYPE_ICMPV6)
case GNRC_NETTYPE_ICMPV6:
return PROTNUM_ICMPV6;
#endif
#if IS_USED(MODULE_GNRC_NETTYPE_IPV6)
case GNRC_NETTYPE_IPV6:
return PROTNUM_IPV6;
#endif
#if IS_USED(MODULE_GNRC_NETTYPE_ICMPV6)
case GNRC_NETTYPE_ICMPV6:
return PROTNUM_ICMPV6;
#endif
#if IS_USED(MODULE_GNRC_NETTYPE_TCP)
case GNRC_NETTYPE_TCP:
return PROTNUM_TCP;

View File

@ -50,91 +50,91 @@ static void _dump_snip(gnrc_pktsnip_t *pkt)
size_t hdr_len = 0;
switch (pkt->type) {
case GNRC_NETTYPE_NETIF:
printf("NETTYPE_NETIF (%i)\n", pkt->type);
if (IS_USED(MODULE_GNRC_NETIF_HDR)) {
gnrc_netif_hdr_print(pkt->data);
hdr_len = pkt->size;
}
break;
case GNRC_NETTYPE_UNDEF:
printf("NETTYPE_UNDEF (%i)\n", pkt->type);
break;
case GNRC_NETTYPE_NETIF:
printf("NETTYPE_NETIF (%i)\n", pkt->type);
if (IS_USED(MODULE_GNRC_NETIF_HDR)) {
gnrc_netif_hdr_print(pkt->data);
hdr_len = pkt->size;
}
break;
case GNRC_NETTYPE_UNDEF:
printf("NETTYPE_UNDEF (%i)\n", pkt->type);
break;
#if IS_USED(MODULE_GNRC_NETTYPE_SIXLOWPAN)
case GNRC_NETTYPE_SIXLOWPAN:
printf("NETTYPE_SIXLOWPAN (%i)\n", pkt->type);
if (IS_USED(MODULE_SIXLOWPAN)) {
sixlowpan_print(pkt->data, pkt->size);
hdr_len = pkt->size;
}
break;
case GNRC_NETTYPE_SIXLOWPAN:
printf("NETTYPE_SIXLOWPAN (%i)\n", pkt->type);
if (IS_USED(MODULE_SIXLOWPAN)) {
sixlowpan_print(pkt->data, pkt->size);
hdr_len = pkt->size;
}
break;
#endif /* IS_USED(MODULE_GNRC_NETTYPE_SIXLOWPAN) */
#if IS_USED(MODULE_GNRC_NETTYPE_LORAWAN)
case GNRC_NETTYPE_LORAWAN:
printf("NETTYPE_LORAWAN (%i)\n", pkt->type);
break;
#endif /* IS_USED(MODULE_GNRC_NETTYPE_LORAWAN) */
#if IS_USED(MODULE_GNRC_NETTYPE_IPV6)
case GNRC_NETTYPE_IPV6:
printf("NETTYPE_IPV6 (%i)\n", pkt->type);
if (IS_USED(MODULE_IPV6_HDR)) {
ipv6_hdr_print(pkt->data);
hdr_len = sizeof(ipv6_hdr_t);
}
break;
case GNRC_NETTYPE_IPV6:
printf("NETTYPE_IPV6 (%i)\n", pkt->type);
if (IS_USED(MODULE_IPV6_HDR)) {
ipv6_hdr_print(pkt->data);
hdr_len = sizeof(ipv6_hdr_t);
}
break;
#endif /* IS_USED(MODULE_GNRC_NETTYPE_IPV6) */
#if IS_USED(MODULE_GNRC_NETTYPE_IPV6_EXT)
case GNRC_NETTYPE_IPV6_EXT:
printf("NETTYPE_IPV6_EXT (%i)\n", pkt->type);
break;
case GNRC_NETTYPE_IPV6_EXT:
printf("NETTYPE_IPV6_EXT (%i)\n", pkt->type);
break;
#endif /* IS_USED(MODULE_GNRC_NETTYPE_IPV6_EXT) */
#if IS_USED(MODULE_GNRC_NETTYPE_ICMPV6)
case GNRC_NETTYPE_ICMPV6:
printf("NETTYPE_ICMPV6 (%i)\n", pkt->type);
if (IS_USED(MODULE_ICMPV6)) {
icmpv6_hdr_print(pkt->data);
hdr_len = sizeof(icmpv6_hdr_t);
}
break;
case GNRC_NETTYPE_ICMPV6:
printf("NETTYPE_ICMPV6 (%i)\n", pkt->type);
if (IS_USED(MODULE_ICMPV6)) {
icmpv6_hdr_print(pkt->data);
hdr_len = sizeof(icmpv6_hdr_t);
}
break;
#endif /* IS_USED(MODULE_GNRC_NETTYPE_ICMPV6) */
#if IS_USED(MODULE_GNRC_NETTYPE_TCP)
case GNRC_NETTYPE_TCP:
printf("NETTYPE_TCP (%i)\n", pkt->type);
if (IS_USED(MODULE_TCP)) {
tcp_hdr_print(pkt->data);
hdr_len = sizeof(tcp_hdr_t);
}
break;
#endif /* IS_USED(MODULE_GNRC_NETTYPE_TCP) */
#if IS_USED(MODULE_GNRC_NETTYPE_UDP)
case GNRC_NETTYPE_UDP:
printf("NETTYPE_UDP (%i)\n", pkt->type);
if (IS_USED(MODULE_UDP)) {
udp_hdr_print(pkt->data);
hdr_len = sizeof(udp_hdr_t);
}
break;
#endif /* IS_USED(MODULE_GNRC_NETTYPE_UDP) */
#if IS_USED(MODULE_GNRC_NETTYPE_CCN)
case GNRC_NETTYPE_CCN_CHUNK:
printf("GNRC_NETTYPE_CCN_CHUNK (%i)\n", pkt->type);
printf("Content is: %.*s\n", (int)pkt->size, (char*)pkt->data);
hdr_len = pkt->size;
break;
case GNRC_NETTYPE_CCN_CHUNK:
printf("GNRC_NETTYPE_CCN_CHUNK (%i)\n", pkt->type);
printf("Content is: %.*s\n", (int)pkt->size, (char*)pkt->data);
hdr_len = pkt->size;
break;
#endif /* IS_USED(MODULE_GNRC_NETTYPE_CCN) */
#if IS_USED(MODULE_GNRC_NETTYPE_NDN)
case GNRC_NETTYPE_NDN:
printf("NETTYPE_NDN (%i)\n", pkt->type);
break;
#endif /* IS_USED(MODULE_GNRC_NETTYPE_NDN) */
#if IS_USED(MODULE_GNRC_NETTYPE_LORAWAN)
case GNRC_NETTYPE_LORAWAN:
printf("NETTYPE_LORAWAN (%i)\n", pkt->type);
#if IS_USED(MODULE_GNRC_NETTYPE_TCP)
case GNRC_NETTYPE_TCP:
printf("NETTYPE_TCP (%i)\n", pkt->type);
if (IS_USED(MODULE_TCP)) {
tcp_hdr_print(pkt->data);
hdr_len = sizeof(tcp_hdr_t);
}
break;
#endif /* IS_USED(MODULE_GNRC_NETTYPE_LORAWAN) */
#endif /* IS_USED(MODULE_GNRC_NETTYPE_TCP) */
#if IS_USED(MODULE_GNRC_NETTYPE_UDP)
case GNRC_NETTYPE_UDP:
printf("NETTYPE_UDP (%i)\n", pkt->type);
if (IS_USED(MODULE_UDP)) {
udp_hdr_print(pkt->data);
hdr_len = sizeof(udp_hdr_t);
}
break;
#endif /* IS_USED(MODULE_GNRC_NETTYPE_UDP) */
#ifdef TEST_SUITES
case GNRC_NETTYPE_TEST:
printf("NETTYPE_TEST (%i)\n", pkt->type);
break;
case GNRC_NETTYPE_TEST:
printf("NETTYPE_TEST (%i)\n", pkt->type);
break;
#endif
default:
printf("NETTYPE_UNKNOWN (%i)\n", pkt->type);
break;
default:
printf("NETTYPE_UNKNOWN (%i)\n", pkt->type);
break;
}
if (hdr_len < pkt->size) {
size_t size = pkt->size - hdr_len;