Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gnrc: make pseudo-modules explicit + documentation improvements #18727

Merged
merged 5 commits into from
Oct 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 88 additions & 2 deletions makefiles/pseudomodules.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions sys/include/net/gnrc/dhcpv6/client/simple_pd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
111 changes: 43 additions & 68 deletions sys/include/net/gnrc/nettype.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@
*/

/**
* @defgroup net_gnrc_nettype Protocol type
* @defgroup net_gnrc_nettype gnrc_nettype: Protocol type
* @ingroup net_gnrc
* @brief Protocol type definitions and helper functions
*
* The protocol types are used with the @ref net_gnrc_netapi, the @ref net_gnrc_netif,
* 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
Expand Down Expand Up @@ -60,42 +61,28 @@ 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
*/
#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
/**
* @}
*/

/**
* @{
Expand All @@ -110,23 +97,6 @@ typedef enum {
#if IS_USED(MODULE_GNRC_NETTYPE_ICMPV6) || defined(DOXYGEN)
GNRC_NETTYPE_ICMPV6, /**< Protocol is ICMPv6 */
#endif
/**
* @}
*/

/**
* @{
* @name Transport layer
*/
#if IS_USED(MODULE_GNRC_NETTYPE_TCP) || defined(DOXYGEN)
GNRC_NETTYPE_TCP, /**< Protocol is TCP */
#endif
#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 */
Expand All @@ -137,33 +107,39 @@ typedef enum {
#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 */
/**
* @{
* @name Transport layer
*/
#if IS_USED(MODULE_GNRC_NETTYPE_TCP) || defined(DOXYGEN)
GNRC_NETTYPE_TCP, /**< Protocol is TCP */
#endif
#if IS_USED(MODULE_GNRC_NETTYPE_UDP) || defined(DOXYGEN)
GNRC_NETTYPE_UDP, /**< Protocol is UDP */
#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)
Expand Down Expand Up @@ -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
*
Expand All @@ -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;
Expand All @@ -222,25 +201,21 @@ 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;
}
}

/**
* @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)
Expand Down Expand Up @@ -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>
Expand All @@ -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;
Expand Down
Loading