mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
gnrc_nettype: reorder gnrc_nettype_t to fit the grouping again
This commit is contained in:
parent
b35a291332
commit
774ca13563
@ -60,10 +60,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 +67,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 +96,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,23 +118,7 @@ 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
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @{
|
||||
@ -149,9 +127,7 @@ typedef enum {
|
||||
#ifdef TEST_SUITES
|
||||
GNRC_NETTYPE_TEST,
|
||||
#endif
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
/** @} */
|
||||
|
||||
GNRC_NETTYPE_NUMOF, /**< maximum number of available protocols */
|
||||
} gnrc_nettype_t;
|
||||
@ -207,6 +183,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 +202,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;
|
||||
@ -291,14 +267,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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user