diff --git a/sys/include/net/ng_ipv6.h b/sys/include/net/ng_ipv6.h index aa37d53e3cb9ff66cf371db991f5be1090a62809..b10d7c3eac820dceeadc1aa0276a430f2a89e689 100644 --- a/sys/include/net/ng_ipv6.h +++ b/sys/include/net/ng_ipv6.h @@ -93,7 +93,7 @@ kernel_pid_t ng_ipv6_init(void); * * @param[in] iface The receiving interface. * @param[in] pkt A packet. - * @param[in] nh A protocol number (see @ref net_ng_protnum). + * @param[in] nh A protocol number (see @ref net_protnum). */ void ng_ipv6_demux(kernel_pid_t iface, ng_pktsnip_t *pkt, uint8_t nh); diff --git a/sys/include/net/ng_ipv6/ext.h b/sys/include/net/ng_ipv6/ext.h index 880306077d326e47bd968c64c349ec0e9b0dcefa..7aaa747193ae904a68eb8ad3c9114e9c58bdf712 100644 --- a/sys/include/net/ng_ipv6/ext.h +++ b/sys/include/net/ng_ipv6/ext.h @@ -60,7 +60,7 @@ typedef struct __attribute__((packed)) { * * @param[in] iface The receiving interface. * @param[in] pkt A packet. - * @param[in] nh A protocol number (see @ref net_ng_protnum). + * @param[in] nh A protocol number (see @ref net_protnum). * * @return true, on success. * @return false, on failure. @@ -88,7 +88,7 @@ static inline ng_ipv6_ext_t *ng_ipv6_ext_get_next(ng_ipv6_ext_t *ext) * @param[in] ipv6 The IPv6 header. Can be NULL. * @param[in] next The next header. Must be a successor to @p ipv6 if it is * not NULL. - * @param[in] nh @ref net_ng_protnum of the next header. + * @param[in] nh @ref net_protnum of the next header. * @param[in] size Size of the extension header. * * @return The extension header on success. diff --git a/sys/include/net/ng_ipv6/hdr.h b/sys/include/net/ng_ipv6/hdr.h index 160e51afa5e1ea15dbce799535f7a59e034d4598..cb7c842885674c94d4eb846323239ff41b535007 100644 --- a/sys/include/net/ng_ipv6/hdr.h +++ b/sys/include/net/ng_ipv6/hdr.h @@ -274,7 +274,7 @@ static inline uint32_t ng_ipv6_hdr_get_fl(const ng_ipv6_hdr_t *hdr) * </a> * * @param[in] sum Preinialized value of the sum. - * @param[in] prot_num The @ref net_ng_protnum you want to calculate the + * @param[in] prot_num The @ref net_protnum you want to calculate the * checksum for. Can not be inferred from * ng_ipv6_hdr_t::nh, since it can be an IPv6 exentension * header. @@ -302,7 +302,7 @@ static inline uint16_t ng_ipv6_hdr_inet_csum(uint16_t sum, ng_ipv6_hdr_t *hdr, * @brief Builds an IPv6 header for sending and adds it to the packet buffer. * * @details Initializes version field with 6, traffic class, flow label, and - * hop limit with 0, and next header with @ref NG_PROTNUM_RESERVED. + * hop limit with 0, and next header with @ref PROTNUM_RESERVED. * * @param[in] payload Payload for the packet. * @param[in] src Source address for the header. Can be NULL if not diff --git a/sys/include/net/ng_nettype.h b/sys/include/net/ng_nettype.h index b0bf679b2680dfdf361a4cdfec8ef56c55c446aa..9251d5ca9e515c2aa02fba977da6047cd3f1166e 100644 --- a/sys/include/net/ng_nettype.h +++ b/sys/include/net/ng_nettype.h @@ -25,7 +25,7 @@ #include <inttypes.h> #include "net/ng_ethertype.h" -#include "net/ng_protnum.h" +#include "net/protnum.h" #ifdef __cplusplus extern "C" { @@ -149,19 +149,19 @@ static inline ng_nettype_t ng_nettype_from_protnum(uint8_t num) { switch (num) { #ifdef MODULE_NG_ICMPV6 - case NG_PROTNUM_ICMPV6: + case PROTNUM_ICMPV6: return NG_NETTYPE_ICMPV6; #endif #ifdef MODULE_NG_IPV6 - case NG_PROTNUM_IPV6: + case PROTNUM_IPV6: return NG_NETTYPE_IPV6; #endif #ifdef MODULE_NG_TCP - case NG_PROTNUM_TCP: + case PROTNUM_TCP: return NG_NETTYPE_TCP; #endif #ifdef MODULE_NG_UDP - case NG_PROTNUM_UDP: + case PROTNUM_UDP: return NG_NETTYPE_UDP; #endif default: @@ -178,29 +178,29 @@ static inline ng_nettype_t ng_nettype_from_protnum(uint8_t num) * @param[in] type A protocol type * * @return The corresponding Protocol Number to @p type. - * @return @ref NG_PROTNUM_RESERVED if @p type not translatable. + * @return @ref PROTNUM_RESERVED if @p type not translatable. */ static inline uint8_t ng_nettype_to_protnum(ng_nettype_t type) { switch (type) { #ifdef MODULE_NG_ICMPV6 case NG_NETTYPE_ICMPV6: - return NG_PROTNUM_ICMPV6; + return PROTNUM_ICMPV6; #endif #ifdef MODULE_NG_IPV6 case NG_NETTYPE_IPV6: - return NG_PROTNUM_IPV6; + return PROTNUM_IPV6; #endif #ifdef MODULE_NG_TCP case NG_NETTYPE_TCP: - return NG_PROTNUM_TCP; + return PROTNUM_TCP; #endif #ifdef MODULE_NG_UDP case NG_NETTYPE_UDP: - return NG_PROTNUM_UDP; + return PROTNUM_UDP; #endif default: - return NG_PROTNUM_RESERVED; + return PROTNUM_RESERVED; } } diff --git a/sys/include/net/ng_protnum.h b/sys/include/net/ng_protnum.h deleted file mode 100644 index 3f82d8b6250f7a541dfc72ab255f65ebc3c32289..0000000000000000000000000000000000000000 --- a/sys/include/net/ng_protnum.h +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (C) 2015 Martine Lenders <mlenders@inf.fu-berlin.de> - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -/** - * @defgroup net_ng_protnum Protocol Numbers - * @ingroup net - * @brief Defines for the Protocol Numbers as they are used in the - * IPv4 protocol field and the IPv6 next header field - * (ng_ipv6_hdr_t::nh). - * @see <a href="http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml"> - * IANA, Assigned Internet Protocol Numbers - * </a> - * @note Last Updated: 2015-01-06 - * @{ - * - * @file - * @brief Protocol number definitions - * - * @author Martine Lenders <mlenders@inf.fu-berlin.de> - */ -#ifndef NG_PROTNUM_H_ -#define NG_PROTNUM_H_ - - -#ifdef __cplusplus -extern "C" { -#endif - -#define NG_PROTNUM_IPV6_EXT_HOPOPT (0) /**< IPv6 Hop-by-Hop Option */ -#define NG_PROTNUM_ICMP (1) /**< Internet Control Message */ -#define NG_PROTNUM_IGMP (2) /**< Internet Group Management */ -#define NG_PROTNUM_GGP (3) /**< Gateway-to-Gateway */ -#define NG_PROTNUM_IPV4 (4) /**< IPv4 encapsulation */ -#define NG_PROTNUM_ST (5) /**< Stream */ -#define NG_PROTNUM_TCP (6) /**< Transmission Control */ -#define NG_PROTNUM_CBT (7) /**< CBT */ -#define NG_PROTNUM_EGP (8) /**< Exterior Gateway Protocol */ -#define NG_PROTNUM_IGP (9) /**< any private interior gateway - * (Cisco IGRP) */ -#define NG_PROTNUM_BBN_RCC_MON (10) /**< BBN RCC Monitoring */ -#define NG_PROTNUM_NVP_II (11) /**< Network Voice Protocol */ -#define NG_PROTNUM_PUP (12) /**< PUP */ -#define NG_PROTNUM_ARGUS (13) /**< ARGUS */ -#define NG_PROTNUM_EMCON (14) /**< EMCON */ -#define NG_PROTNUM_XNET (15) /**< Cross Net Debugger */ -#define NG_PROTNUM_CHAOS (16) /**< Chaos */ -#define NG_PROTNUM_UDP (17) /**< User Datagram */ -#define NG_PROTNUM_MUX (18) /**< Multiplexing */ -#define NG_PROTNUM_DCN_MEAS (19) /**< DCN Measurement Subsystems */ -#define NG_PROTNUM_HMP (20) /**< Host Monitoring */ -#define NG_PROTNUM_PRM (21) /**< Packet Radio Measurement */ -#define NG_PROTNUM_XNS_IDP (22) /**< XEROX NS IDP */ -#define NG_PROTNUM_TRUNK_1 (23) /**< Trunk-1 */ -#define NG_PROTNUM_TRUNK_2 (24) /**< Trunk-2 */ -#define NG_PROTNUM_LEAF_1 (25) /**< Leaf-1 */ -#define NG_PROTNUM_LEAF_2 (26) /**< Leaf-2 */ -#define NG_PROTNUM_RDP (27) /**< Reliable Data Protocol */ -#define NG_PROTNUM_IRTP (28) /**< Internet Reliable Transaction */ -#define NG_PROTNUM_ISO_TP4 (29) /**< ISO Transport Protocol Class 4 */ -#define NG_PROTNUM_NETBLT (30) /**< Bulk Data Transfer Protocol */ -#define NG_PROTNUM_MFE_NSP (31) /**< MFE Network Services Protocol */ -#define NG_PROTNUM_MERIT_INP (32) /**< MERIT Internodal Protocol */ -#define NG_PROTNUM_DCCP (33) /**< Datagram Congestion Control Protocol */ -#define NG_PROTNUM_3PC (34) /**< Third Party Connect Protocol */ -#define NG_PROTNUM_IDPR (35) /**< Inter-Domain Policy Routing Protocol */ -#define NG_PROTNUM_XTP (36) /**< XTP */ -#define NG_PROTNUM_DDP (37) /**< Datagram Delivery Protocol */ -#define NG_PROTNUM_IDPR_CMTP (38) /**< IDPR Control Message Transport Proto */ -#define NG_PROTNUM_TPPLUSPLUS (39) /**< TP++ Transport Protocol */ -#define NG_PROTNUM_IL (40) /**< IL Transport Protocol */ -#define NG_PROTNUM_IPV6 (41) /**< IPv6 encapsulation */ -#define NG_PROTNUM_SDRP (42) /**< Source Demand Routing Protocol */ -#define NG_PROTNUM_IPV6_EXT_RH (43) /**< Routing Header for IPv6 */ -#define NG_PROTNUM_IPV6_EXT_FRAG (44) /**< Fragment Header for IPv6 */ -#define NG_PROTNUM_IDRP (45) /**< Inter-Domain Routing Protocol */ -#define NG_PROTNUM_RSVP (46) /**< Reservation Protocol */ -#define NG_PROTNUM_GRE (47) /**< Generic Routing Encapsulation */ -#define NG_PROTNUM_DSR (48) /**< Dynamic Source Routing Protocol */ -#define NG_PROTNUM_BNA (49) /**< BNA */ -#define NG_PROTNUM_IPV6_EXT_ESP (50) /**< IPv6 Encap Security Payload - * Extension Header */ -#define NG_PROTNUM_IPV6_EXT_AH (51) /**< IPv6 Authentication Extension - * Header */ -#define NG_PROTNUM_I_NLSP (52) /**< Integrated Net Layer Security - * TUBA */ -#define NG_PROTNUM_SWIPE (53) /**< IP with Encryption (deprecated) */ -#define NG_PROTNUM_NARP (54) /**< NBMA Address Resolution Protocol */ -#define NG_PROTNUM_MOBILE (55) /**< IP Mobility */ -#define NG_PROTNUM_TLSP (56) /**< Transport Layer Security Protocol */ -#define NG_PROTNUM_SKIP (57) /**< SKIP */ -#define NG_PROTNUM_ICMPV6 (58) /**< ICMP for IPv6 */ -#define NG_PROTNUM_IPV6_NONXT (59) /**< No Next Header for IPv6 */ -#define NG_PROTNUM_IPV6_EXT_DST (60) /**< IPv6 Extension Header: - * Destination Options */ -#define NG_PROTNUM_CFTP (62) /**< CFTP */ -#define NG_PROTNUM_SAT_EXPAK (64) /**< SATNET and Backroom EXPAK */ -#define NG_PROTNUM_KRYPTOLAN (65) /**< Kryptolan */ -#define NG_PROTNUM_RVD (66) /**< MIT Remote Virtual Disk Protocol */ -#define NG_PROTNUM_IPPC (67) /**< Internet Pluribus Packet Core */ -#define NG_PROTNUM_SAT_MON (69) /**< SATNET Monitoring */ -#define NG_PROTNUM_VISA (70) /**< VISA Protocol */ -#define NG_PROTNUM_IPCV (71) /**< Internet Packet Core Utility */ -#define NG_PROTNUM_CPNX (72) /**< Computer Protocol Network Executive */ -#define NG_PROTNUM_CPHB (73) /**< Computer Protocol Heart Beat */ -#define NG_PROTNUM_WSN (74) /**< Wang Span Network */ -#define NG_PROTNUM_PVP (75) /**< Packet Video Protocol */ -#define NG_PROTNUM_BR_SAT_MON (76) /**< Backroom SATNET Monitoring */ -#define NG_PROTNUM_SUN_ND (77) /**< SUN ND PROTOCOL-Temporary */ -#define NG_PROTNUM_WB_MON (78) /**< WIDEBAND Monitoring */ -#define NG_PROTNUM_WB_EXPAK (79) /**< WIDEBAND EXPAK */ -#define NG_PROTNUM_ISO_IP (80) /**< ISO Internet Protocol */ -#define NG_PROTNUM_VMTP (81) /**< VMTP */ -#define NG_PROTNUM_SECURE_VMTP (82) /**< SECURE-VMTP */ -#define NG_PROTNUM_VINES (83) /**< VINES */ -#define NG_PROTNUM_TTP (84) /**< Transaction Transport Protocol */ -#define NG_PROTNUM_IPTM (84) /**< Internet Protocol Traffic Manager */ -#define NG_PROTNUM_NSFNET_IGP (85) /**< NSFNET-IGP */ -#define NG_PROTNUM_DGP (86) /**< Dissimilar Gateway Protocol */ -#define NG_PROTNUM_TCF (87) /**< TCF */ -#define NG_PROTNUM_EIGRP (88) /**< EIGRP */ -#define NG_PROTNUM_OSPFIGP (89) /**< OSPFIGP */ -#define NG_PROTNUM_SPRITE_RPC (90) /**< Sprite RPC Protocol */ -#define NG_PROTNUM_LARP (91) /**< Locus Address Resolution Protocol */ -#define NG_PROTNUM_MTP (92) /**< Multicast Transport Protocol */ -#define NG_PROTNUM_AX_25 (93) /**< AX.25 Frames */ -#define NG_PROTNUM_IPIP (94) /**< IP-within-IP Encapsulation Protocol */ -#define NG_PROTNUM_MICP (95) /**< Mobile Internetworking Control Pro - * (deprecated) */ -#define NG_PROTNUM_SCC_SP (96) /**< Semaphore Communications Sec Pro. */ -#define NG_PROTNUM_ETHERIP (97) /**< Ethernet-within-IP Encapsulation */ -#define NG_PROTNUM_ENCAP (98) /**< Encapsulation Header */ -#define NG_PROTNUM_GMTP (100) /**< GMTP */ -#define NG_PROTNUM_IFMP (101) /**< Ipsilon Flow Management Protocol */ -#define NG_PROTNUM_PNNI (102) /**< PNNI over IP */ -#define NG_PROTNUM_PIM (103) /**< Protocol Independent Multicast */ -#define NG_PROTNUM_ARIS (104) /**< ARIS */ -#define NG_PROTNUM_SCPS (105) /**< SCPS */ -#define NG_PROTNUM_QNX (106) /**< QNX */ -#define NG_PROTNUM_A_N (107) /**< Active Networks */ -#define NG_PROTNUM_IPCOMP (108) /**< IP Payload Compression Protocol */ -#define NG_PROTNUM_SNP (109) /**< Sitara Networks Protocol */ -#define NG_PROTNUM_COMPAQ_PEER (110) /**< Compaq Peer Protocol */ -#define NG_PROTNUM_IPX_IN_IP (111) /**< IPX in IP */ -#define NG_PROTNUM_VRRP (112) /**< Virtual Router Redundancy Protocol */ -#define NG_PROTNUM_PGM (113) /**< PGM Reliable Transport Protocol */ -#define NG_PROTNUM_L2TP (115) /**< Layer Two Tunneling Protocol */ -#define NG_PROTNUM_DDX (116) /**< D-II Data Exchange (DDX) */ -#define NG_PROTNUM_IATP (117) /**< Interactive Agent Transfer Protocol */ -#define NG_PROTNUM_STP (118) /**< Schedule Transfer Protocol */ -#define NG_PROTNUM_SRP (119) /**< SpectraLink Radio Protocol */ -#define NG_PROTNUM_UTI (120) /**< UTI */ -#define NG_PROTNUM_SMP (121) /**< Simple Message Protocol */ -#define NG_PROTNUM_SM (122) /**< Simple Multicast Protocol */ -#define NG_PROTNUM_PTP (123) /**< Performance Transparency Protocol */ -#define NG_PROTNUM_ISIS_OVER_IPV4 (124) /**< ISIS over IPv4 */ -#define NG_PROTNUM_FIRE (125) /**< FIRE */ -#define NG_PROTNUM_CRTP (126) /**< Combat Radio Transport Protocol */ -#define NG_PROTNUM_CRUDP (127) /**< Combat Radio User Datagram */ -#define NG_PROTNUM_SSCOPMCE (128) /**< SSCOPMCE */ -#define NG_PROTNUM_IPLT (129) /**< IPLT */ -#define NG_PROTNUM_SPS (130) /**< Secure Packet Shield */ -#define NG_PROTNUM_PIPE (131) /**< Private IP Encapsulation within IP */ -#define NG_PROTNUM_SCTP (132) /**< Stream Control Transmission Protocol */ -#define NG_PROTNUM_FC (133) /**< Fibre Channel */ -#define NG_PROTNUM_RSVP_E2E_IGNORE (134) /**< RSVP-E2E-IGNORE */ -#define NG_PROTNUM_IPV6_EXT_MOB (135) /**< IPv6 Mobility Extension Header */ -#define NG_PROTNUM_UDPLITE (136) /**< UDPLite */ -#define NG_PROTNUM_MPLS_IN_IP (137) /**< MPLS-in-IP */ -#define NG_PROTNUM_MANET (138) /**< MANET Protocols */ -#define NG_PROTNUM_HIP (139) /**< Host Identity Protocol */ -#define NG_PROTNUM_SHIM6 (140) /**< Shim6 Protocol */ -#define NG_PROTNUM_WESP (141) /**< Wrapped Encapsulating Security Payload */ -#define NG_PROTNUM_ROHC (142) /**< Robust Header Compression */ -#define NG_PROTNUM_RESERVED (255) /**< Reserved */ - -#ifdef __cplusplus -} -#endif - -#endif /* NG_PROTNUM_H_ */ -/** @} */ diff --git a/sys/include/net/protnum.h b/sys/include/net/protnum.h new file mode 100644 index 0000000000000000000000000000000000000000..fe5793c4f7590110e33e7867719f018229c48be4 --- /dev/null +++ b/sys/include/net/protnum.h @@ -0,0 +1,186 @@ +/* + * Copyright (C) 2015 Martine Lenders <mlenders@inf.fu-berlin.de> + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @defgroup net_protnum Protocol Numbers + * @ingroup net + * @brief Defines for the Protocol Numbers as they are used in the + * IPv4 protocol field and the IPv6 next header field + * (ng_ipv6_hdr_t::nh). + * @see <a href="http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml"> + * IANA, Assigned Internet Protocol Numbers + * </a> + * @note Last Updated: 2015-01-06 + * @{ + * + * @file + * @brief Protocol number definitions + * + * @author Martine Lenders <mlenders@inf.fu-berlin.de> + */ +#ifndef PROTNUM_H_ +#define PROTNUM_H_ + + +#ifdef __cplusplus +extern "C" { +#endif + +#define PROTNUM_IPV6_EXT_HOPOPT (0) /**< IPv6 Hop-by-Hop Option */ +#define PROTNUM_ICMP (1) /**< Internet Control Message */ +#define PROTNUM_IGMP (2) /**< Internet Group Management */ +#define PROTNUM_GGP (3) /**< Gateway-to-Gateway */ +#define PROTNUM_IPV4 (4) /**< IPv4 encapsulation */ +#define PROTNUM_ST (5) /**< Stream */ +#define PROTNUM_TCP (6) /**< Transmission Control */ +#define PROTNUM_CBT (7) /**< CBT */ +#define PROTNUM_EGP (8) /**< Exterior Gateway Protocol */ +#define PROTNUM_IGP (9) /**< any private interior gateway + * (Cisco IGRP) */ +#define PROTNUM_BBN_RCC_MON (10) /**< BBN RCC Monitoring */ +#define PROTNUM_NVP_II (11) /**< Network Voice Protocol */ +#define PROTNUM_PUP (12) /**< PUP */ +#define PROTNUM_ARGUS (13) /**< ARGUS */ +#define PROTNUM_EMCON (14) /**< EMCON */ +#define PROTNUM_XNET (15) /**< Cross Net Debugger */ +#define PROTNUM_CHAOS (16) /**< Chaos */ +#define PROTNUM_UDP (17) /**< User Datagram */ +#define PROTNUM_MUX (18) /**< Multiplexing */ +#define PROTNUM_DCN_MEAS (19) /**< DCN Measurement Subsystems */ +#define PROTNUM_HMP (20) /**< Host Monitoring */ +#define PROTNUM_PRM (21) /**< Packet Radio Measurement */ +#define PROTNUM_XNS_IDP (22) /**< XEROX NS IDP */ +#define PROTNUM_TRUNK_1 (23) /**< Trunk-1 */ +#define PROTNUM_TRUNK_2 (24) /**< Trunk-2 */ +#define PROTNUM_LEAF_1 (25) /**< Leaf-1 */ +#define PROTNUM_LEAF_2 (26) /**< Leaf-2 */ +#define PROTNUM_RDP (27) /**< Reliable Data Protocol */ +#define PROTNUM_IRTP (28) /**< Internet Reliable Transaction */ +#define PROTNUM_ISO_TP4 (29) /**< ISO Transport Protocol Class 4 */ +#define PROTNUM_NETBLT (30) /**< Bulk Data Transfer Protocol */ +#define PROTNUM_MFE_NSP (31) /**< MFE Network Services Protocol */ +#define PROTNUM_MERIT_INP (32) /**< MERIT Internodal Protocol */ +#define PROTNUM_DCCP (33) /**< Datagram Congestion Control Protocol */ +#define PROTNUM_3PC (34) /**< Third Party Connect Protocol */ +#define PROTNUM_IDPR (35) /**< Inter-Domain Policy Routing Protocol */ +#define PROTNUM_XTP (36) /**< XTP */ +#define PROTNUM_DDP (37) /**< Datagram Delivery Protocol */ +#define PROTNUM_IDPR_CMTP (38) /**< IDPR Control Message Transport Proto */ +#define PROTNUM_TPPLUSPLUS (39) /**< TP++ Transport Protocol */ +#define PROTNUM_IL (40) /**< IL Transport Protocol */ +#define PROTNUM_IPV6 (41) /**< IPv6 encapsulation */ +#define PROTNUM_SDRP (42) /**< Source Demand Routing Protocol */ +#define PROTNUM_IPV6_EXT_RH (43) /**< Routing Header for IPv6 */ +#define PROTNUM_IPV6_EXT_FRAG (44) /**< Fragment Header for IPv6 */ +#define PROTNUM_IDRP (45) /**< Inter-Domain Routing Protocol */ +#define PROTNUM_RSVP (46) /**< Reservation Protocol */ +#define PROTNUM_GRE (47) /**< Generic Routing Encapsulation */ +#define PROTNUM_DSR (48) /**< Dynamic Source Routing Protocol */ +#define PROTNUM_BNA (49) /**< BNA */ +#define PROTNUM_IPV6_EXT_ESP (50) /**< IPv6 Encap Security Payload + * Extension Header */ +#define PROTNUM_IPV6_EXT_AH (51) /**< IPv6 Authentication Extension + * Header */ +#define PROTNUM_I_NLSP (52) /**< Integrated Net Layer Security + * TUBA */ +#define PROTNUM_SWIPE (53) /**< IP with Encryption (deprecated) */ +#define PROTNUM_NARP (54) /**< NBMA Address Resolution Protocol */ +#define PROTNUM_MOBILE (55) /**< IP Mobility */ +#define PROTNUM_TLSP (56) /**< Transport Layer Security Protocol */ +#define PROTNUM_SKIP (57) /**< SKIP */ +#define PROTNUM_ICMPV6 (58) /**< ICMP for IPv6 */ +#define PROTNUM_IPV6_NONXT (59) /**< No Next Header for IPv6 */ +#define PROTNUM_IPV6_EXT_DST (60) /**< IPv6 Extension Header: + * Destination Options */ +#define PROTNUM_CFTP (62) /**< CFTP */ +#define PROTNUM_SAT_EXPAK (64) /**< SATNET and Backroom EXPAK */ +#define PROTNUM_KRYPTOLAN (65) /**< Kryptolan */ +#define PROTNUM_RVD (66) /**< MIT Remote Virtual Disk Protocol */ +#define PROTNUM_IPPC (67) /**< Internet Pluribus Packet Core */ +#define PROTNUM_SAT_MON (69) /**< SATNET Monitoring */ +#define PROTNUM_VISA (70) /**< VISA Protocol */ +#define PROTNUM_IPCV (71) /**< Internet Packet Core Utility */ +#define PROTNUM_CPNX (72) /**< Computer Protocol Network Executive */ +#define PROTNUM_CPHB (73) /**< Computer Protocol Heart Beat */ +#define PROTNUM_WSN (74) /**< Wang Span Network */ +#define PROTNUM_PVP (75) /**< Packet Video Protocol */ +#define PROTNUM_BR_SAT_MON (76) /**< Backroom SATNET Monitoring */ +#define PROTNUM_SUN_ND (77) /**< SUN ND PROTOCOL-Temporary */ +#define PROTNUM_WB_MON (78) /**< WIDEBAND Monitoring */ +#define PROTNUM_WB_EXPAK (79) /**< WIDEBAND EXPAK */ +#define PROTNUM_ISO_IP (80) /**< ISO Internet Protocol */ +#define PROTNUM_VMTP (81) /**< VMTP */ +#define PROTNUM_SECURE_VMTP (82) /**< SECURE-VMTP */ +#define PROTNUM_VINES (83) /**< VINES */ +#define PROTNUM_TTP (84) /**< Transaction Transport Protocol */ +#define PROTNUM_IPTM (84) /**< Internet Protocol Traffic Manager */ +#define PROTNUM_NSFNET_IGP (85) /**< NSFNET-IGP */ +#define PROTNUM_DGP (86) /**< Dissimilar Gateway Protocol */ +#define PROTNUM_TCF (87) /**< TCF */ +#define PROTNUM_EIGRP (88) /**< EIGRP */ +#define PROTNUM_OSPFIGP (89) /**< OSPFIGP */ +#define PROTNUM_SPRITE_RPC (90) /**< Sprite RPC Protocol */ +#define PROTNUM_LARP (91) /**< Locus Address Resolution Protocol */ +#define PROTNUM_MTP (92) /**< Multicast Transport Protocol */ +#define PROTNUM_AX_25 (93) /**< AX.25 Frames */ +#define PROTNUM_IPIP (94) /**< IP-within-IP Encapsulation Protocol */ +#define PROTNUM_MICP (95) /**< Mobile Internetworking Control Pro + * (deprecated) */ +#define PROTNUM_SCC_SP (96) /**< Semaphore Communications Sec Pro. */ +#define PROTNUM_ETHERIP (97) /**< Ethernet-within-IP Encapsulation */ +#define PROTNUM_ENCAP (98) /**< Encapsulation Header */ +#define PROTNUM_GMTP (100) /**< GMTP */ +#define PROTNUM_IFMP (101) /**< Ipsilon Flow Management Protocol */ +#define PROTNUM_PNNI (102) /**< PNNI over IP */ +#define PROTNUM_PIM (103) /**< Protocol Independent Multicast */ +#define PROTNUM_ARIS (104) /**< ARIS */ +#define PROTNUM_SCPS (105) /**< SCPS */ +#define PROTNUM_QNX (106) /**< QNX */ +#define PROTNUM_A_N (107) /**< Active Networks */ +#define PROTNUM_IPCOMP (108) /**< IP Payload Compression Protocol */ +#define PROTNUM_SNP (109) /**< Sitara Networks Protocol */ +#define PROTNUM_COMPAQ_PEER (110) /**< Compaq Peer Protocol */ +#define PROTNUM_IPX_IN_IP (111) /**< IPX in IP */ +#define PROTNUM_VRRP (112) /**< Virtual Router Redundancy Protocol */ +#define PROTNUM_PGM (113) /**< PGM Reliable Transport Protocol */ +#define PROTNUM_L2TP (115) /**< Layer Two Tunneling Protocol */ +#define PROTNUM_DDX (116) /**< D-II Data Exchange (DDX) */ +#define PROTNUM_IATP (117) /**< Interactive Agent Transfer Protocol */ +#define PROTNUM_STP (118) /**< Schedule Transfer Protocol */ +#define PROTNUM_SRP (119) /**< SpectraLink Radio Protocol */ +#define PROTNUM_UTI (120) /**< UTI */ +#define PROTNUM_SMP (121) /**< Simple Message Protocol */ +#define PROTNUM_SM (122) /**< Simple Multicast Protocol */ +#define PROTNUM_PTP (123) /**< Performance Transparency Protocol */ +#define PROTNUM_ISIS_OVER_IPV4 (124) /**< ISIS over IPv4 */ +#define PROTNUM_FIRE (125) /**< FIRE */ +#define PROTNUM_CRTP (126) /**< Combat Radio Transport Protocol */ +#define PROTNUM_CRUDP (127) /**< Combat Radio User Datagram */ +#define PROTNUM_SSCOPMCE (128) /**< SSCOPMCE */ +#define PROTNUM_IPLT (129) /**< IPLT */ +#define PROTNUM_SPS (130) /**< Secure Packet Shield */ +#define PROTNUM_PIPE (131) /**< Private IP Encapsulation within IP */ +#define PROTNUM_SCTP (132) /**< Stream Control Transmission Protocol */ +#define PROTNUM_FC (133) /**< Fibre Channel */ +#define PROTNUM_RSVP_E2E_IGNORE (134) /**< RSVP-E2E-IGNORE */ +#define PROTNUM_IPV6_EXT_MOB (135) /**< IPv6 Mobility Extension Header */ +#define PROTNUM_UDPLITE (136) /**< UDPLite */ +#define PROTNUM_MPLS_IN_IP (137) /**< MPLS-in-IP */ +#define PROTNUM_MANET (138) /**< MANET Protocols */ +#define PROTNUM_HIP (139) /**< Host Identity Protocol */ +#define PROTNUM_SHIM6 (140) /**< Shim6 Protocol */ +#define PROTNUM_WESP (141) /**< Wrapped Encapsulating Security Payload */ +#define PROTNUM_ROHC (142) /**< Robust Header Compression */ +#define PROTNUM_RESERVED (255) /**< Reserved */ + +#ifdef __cplusplus +} +#endif + +#endif /* PROTNUM_H_ */ +/** @} */ diff --git a/sys/net/network_layer/ng_icmpv6/ng_icmpv6.c b/sys/net/network_layer/ng_icmpv6/ng_icmpv6.c index 95560763239c3156ec67c1e1450aed32f89e6e00..3b1a97e01e287cb09bba91c76a9671258db527f5 100644 --- a/sys/net/network_layer/ng_icmpv6/ng_icmpv6.c +++ b/sys/net/network_layer/ng_icmpv6/ng_icmpv6.c @@ -22,7 +22,7 @@ #include "byteorder.h" #include "kernel_types.h" #include "net/ng_netbase.h" -#include "net/ng_protnum.h" +#include "net/protnum.h" #include "net/ng_ipv6/hdr.h" #include "net/ng_ndp.h" #include "od.h" @@ -48,7 +48,7 @@ static inline uint16_t _calc_csum(ng_pktsnip_t *hdr, } csum = ng_inet_csum(csum, hdr->data, hdr->size); - csum = ng_ipv6_hdr_inet_csum(csum, pseudo_hdr->data, NG_PROTNUM_ICMPV6, + csum = ng_ipv6_hdr_inet_csum(csum, pseudo_hdr->data, PROTNUM_ICMPV6, len); return ~csum; diff --git a/sys/net/network_layer/ng_ipv6/ext/ng_ipv6_ext.c b/sys/net/network_layer/ng_ipv6/ext/ng_ipv6_ext.c index f1b6ef95409de3d4b4031ff3de6d2d74c2b12a8a..d7029289dc80fca4a055809e7c9e999ade8a2954 100644 --- a/sys/net/network_layer/ng_ipv6/ext/ng_ipv6_ext.c +++ b/sys/net/network_layer/ng_ipv6/ext/ng_ipv6_ext.c @@ -33,13 +33,13 @@ bool ng_ipv6_ext_demux(kernel_pid_t iface, ng_pktsnip_t *pkt, while (c) { switch (nh) { - case NG_PROTNUM_IPV6_EXT_HOPOPT: - case NG_PROTNUM_IPV6_EXT_DST: - case NG_PROTNUM_IPV6_EXT_RH: - case NG_PROTNUM_IPV6_EXT_FRAG: - case NG_PROTNUM_IPV6_EXT_AH: - case NG_PROTNUM_IPV6_EXT_ESP: - case NG_PROTNUM_IPV6_EXT_MOB: + case PROTNUM_IPV6_EXT_HOPOPT: + case PROTNUM_IPV6_EXT_DST: + case PROTNUM_IPV6_EXT_RH: + case PROTNUM_IPV6_EXT_FRAG: + case PROTNUM_IPV6_EXT_AH: + case PROTNUM_IPV6_EXT_ESP: + case PROTNUM_IPV6_EXT_MOB: /* TODO: add handling of types */ nh = ext->nh; offset += ((ext->len * NG_IPV6_EXT_LEN_UNIT) + NG_IPV6_EXT_LEN_UNIT); diff --git a/sys/net/network_layer/ng_ipv6/ext/rh/ng_ipv6_ext_rh.c b/sys/net/network_layer/ng_ipv6/ext/rh/ng_ipv6_ext_rh.c index 5373651ac7f936e924d5ba88087911be72e0cd06..0823d5cbe76821411d5fa9ba61c330c1953b7a86 100644 --- a/sys/net/network_layer/ng_ipv6/ext/rh/ng_ipv6_ext_rh.c +++ b/sys/net/network_layer/ng_ipv6/ext/rh/ng_ipv6_ext_rh.c @@ -14,7 +14,7 @@ #include <stdbool.h> -#include "net/ng_protnum.h" +#include "net/protnum.h" #include "net/ng_rpl/srh.h" #include "net/ng_ipv6/ext/rh.h" @@ -25,16 +25,16 @@ ng_ipv6_addr_t *ng_ipv6_ext_rh_next_hop(ng_ipv6_hdr_t *ipv6) while (c) { switch (ext->type) { - case NG_PROTNUM_IPV6_EXT_HOPOPT: - case NG_PROTNUM_IPV6_EXT_DST: - case NG_PROTNUM_IPV6_EXT_FRAG: - case NG_PROTNUM_IPV6_EXT_AH: - case NG_PROTNUM_IPV6_EXT_ESP: - case NG_PROTNUM_IPV6_EXT_MOB: + case PROTNUM_IPV6_EXT_HOPOPT: + case PROTNUM_IPV6_EXT_DST: + case PROTNUM_IPV6_EXT_FRAG: + case PROTNUM_IPV6_EXT_AH: + case PROTNUM_IPV6_EXT_ESP: + case PROTNUM_IPV6_EXT_MOB: ext = (ng_ipv6_ext_rh_t *)ng_ipv6_ext_get_next((ng_ipv6_ext_t *)ext); break; - case NG_PROTNUM_IPV6_EXT_RH: + case PROTNUM_IPV6_EXT_RH: c = false; break; @@ -44,7 +44,7 @@ ng_ipv6_addr_t *ng_ipv6_ext_rh_next_hop(ng_ipv6_hdr_t *ipv6) } } - if (ipv6->nh == NG_PROTNUM_IPV6_EXT_RH) { + if (ipv6->nh == PROTNUM_IPV6_EXT_RH) { switch (ext->type) { #ifdef MODULE_NG_RPL_SRH case NG_RPL_SRH_TYPE: diff --git a/sys/net/network_layer/ng_ipv6/hdr/ng_ipv6_hdr.c b/sys/net/network_layer/ng_ipv6/hdr/ng_ipv6_hdr.c index 197eb6391d7edfe7d715e711f18371d15f33530d..8895cda259aea79a2563645eee5215911f08b8f0 100644 --- a/sys/net/network_layer/ng_ipv6/hdr/ng_ipv6_hdr.c +++ b/sys/net/network_layer/ng_ipv6/hdr/ng_ipv6_hdr.c @@ -16,7 +16,7 @@ #include "net/ng_ipv6/hdr.h" #include "net/ng_nettype.h" #include "net/ng_pktbuf.h" -#include "net/ng_protnum.h" +#include "net/protnum.h" #define ENABLE_DEBUG (0) #include "debug.h" @@ -84,7 +84,7 @@ ng_pktsnip_t *ng_ipv6_hdr_build(ng_pktsnip_t *payload, } hdr->v_tc_fl = byteorder_htonl(0x60000000); /* set version, tc and fl in one go*/ - hdr->nh = NG_PROTNUM_RESERVED; + hdr->nh = PROTNUM_RESERVED; hdr->hl = 0; return ipv6; diff --git a/sys/net/network_layer/ng_ipv6/ng_ipv6.c b/sys/net/network_layer/ng_ipv6/ng_ipv6.c index e564fa5bdb589e6e40a8acf1ec8f9f7a239799b4..9f25fefc86c058d25d4bcb408240f5c4ba4cddb3 100644 --- a/sys/net/network_layer/ng_ipv6/ng_ipv6.c +++ b/sys/net/network_layer/ng_ipv6/ng_ipv6.c @@ -21,7 +21,7 @@ #include "net/ng_icmpv6.h" #include "net/ng_netbase.h" #include "net/ng_ndp.h" -#include "net/ng_protnum.h" +#include "net/protnum.h" #include "thread.h" #include "utlist.h" @@ -79,18 +79,18 @@ void ng_ipv6_demux(kernel_pid_t iface, ng_pktsnip_t *pkt, uint8_t nh) pkt->type = ng_nettype_from_protnum(nh); switch (nh) { - case NG_PROTNUM_ICMPV6: + case PROTNUM_ICMPV6: DEBUG("ipv6: handle ICMPv6 packet (nh = %" PRIu8 ")\n", nh); ng_icmpv6_demux(iface, pkt); break; #ifdef MODULE_NG_IPV6_EXT - case NG_PROTNUM_IPV6_EXT_HOPOPT: - case NG_PROTNUM_IPV6_EXT_DST: - case NG_PROTNUM_IPV6_EXT_RH: - case NG_PROTNUM_IPV6_EXT_FRAG: - case NG_PROTNUM_IPV6_EXT_AH: - case NG_PROTNUM_IPV6_EXT_ESP: - case NG_PROTNUM_IPV6_EXT_MOB: + case PROTNUM_IPV6_EXT_HOPOPT: + case PROTNUM_IPV6_EXT_DST: + case PROTNUM_IPV6_EXT_RH: + case PROTNUM_IPV6_EXT_FRAG: + case PROTNUM_IPV6_EXT_AH: + case PROTNUM_IPV6_EXT_ESP: + case PROTNUM_IPV6_EXT_MOB: DEBUG("ipv6: handle extension header (nh = %" PRIu8 ")\n", nh); if (!ng_ipv6_ext_demux(iface, pkt, nh)) { DEBUG("ipv6: unable to parse extension headers.\n"); @@ -98,7 +98,7 @@ void ng_ipv6_demux(kernel_pid_t iface, ng_pktsnip_t *pkt, uint8_t nh) return; } #endif - case NG_PROTNUM_IPV6: + case PROTNUM_IPV6: DEBUG("ipv6: handle encapsulated IPv6 packet (nh = %" PRIu8 ")\n", nh); _decapsulate(pkt); break; @@ -262,12 +262,12 @@ static int _fill_ipv6_hdr(kernel_pid_t iface, ng_pktsnip_t *ipv6, ng_pkt_len(payload), hdr->len.u16); /* check if e.g. extension header was not already marked */ - if (hdr->nh == NG_PROTNUM_RESERVED) { + if (hdr->nh == PROTNUM_RESERVED) { hdr->nh = ng_nettype_to_protnum(payload->type); /* if still reserved: mark no next header */ - if (hdr->nh == NG_PROTNUM_RESERVED) { - hdr->nh = NG_PROTNUM_IPV6_NONXT; + if (hdr->nh == PROTNUM_RESERVED) { + hdr->nh = PROTNUM_IPV6_NONXT; } } diff --git a/sys/net/transport_layer/ng_udp/ng_udp.c b/sys/net/transport_layer/ng_udp/ng_udp.c index 5910bf19c3bbc0cc97ffa2f83ca1a6c292b5af6d..4e24076a3cc87ab6ce017d5fc4777c51f1cb5663 100644 --- a/sys/net/transport_layer/ng_udp/ng_udp.c +++ b/sys/net/transport_layer/ng_udp/ng_udp.c @@ -82,7 +82,7 @@ static uint16_t _calc_csum(ng_pktsnip_t *hdr, ng_pktsnip_t *pseudo_hdr, #ifdef MODULE_NG_IPV6 case NG_NETTYPE_IPV6: csum = ng_ipv6_hdr_inet_csum(csum, pseudo_hdr->data, - NG_PROTNUM_UDP, len); + PROTNUM_UDP, len); break; #endif default: diff --git a/tests/unittests/tests-ipv6_hdr/tests-ipv6_hdr.c b/tests/unittests/tests-ipv6_hdr/tests-ipv6_hdr.c index c4dd4821668fa776f25a503b8ae63ada41645699..5e1f73e4859cb870daf7112b9f42598261fc31f9 100644 --- a/tests/unittests/tests-ipv6_hdr/tests-ipv6_hdr.c +++ b/tests/unittests/tests-ipv6_hdr/tests-ipv6_hdr.c @@ -19,7 +19,7 @@ #include "net/ng_ipv6/addr.h" #include "net/ng_ipv6/hdr.h" #include "net/ng_pktbuf.h" -#include "net/ng_protnum.h" +#include "net/protnum.h" #include "net/ng_inet_csum.h" #include "unittests-constants.h" @@ -261,7 +261,7 @@ static void test_ipv6_hdr_inet_csum__initial_sum_overflows(void) }; /* calculate checksum of pseudo header */ - res = ng_ipv6_hdr_inet_csum(sum, (ng_ipv6_hdr_t *)&val, NG_PROTNUM_ICMPV6, + res = ng_ipv6_hdr_inet_csum(sum, (ng_ipv6_hdr_t *)&val, PROTNUM_ICMPV6, payload_len); res = ~res; /* take 1's-complement for correct checksum */ @@ -290,7 +290,7 @@ static void test_ipv6_hdr_inet_csum__initial_sum_0(void) payload_len = sizeof(val) - sizeof(ng_ipv6_hdr_t); /* calculate checksum of pseudo header */ - res = ng_ipv6_hdr_inet_csum(0, (ng_ipv6_hdr_t *)&val, NG_PROTNUM_ICMPV6, + res = ng_ipv6_hdr_inet_csum(0, (ng_ipv6_hdr_t *)&val, PROTNUM_ICMPV6, payload_len); /* calculate checksum of payload */ res = ng_inet_csum(res, val + sizeof(ng_ipv6_hdr_t), payload_len); @@ -339,7 +339,7 @@ static void test_ipv6_hdr_build__src_NULL(void) TEST_ASSERT(ng_ipv6_hdr_is(hdr)); TEST_ASSERT_EQUAL_INT(0, ng_ipv6_hdr_get_tc(hdr)); TEST_ASSERT_EQUAL_INT(0, ng_ipv6_hdr_get_fl(hdr)); - TEST_ASSERT_EQUAL_INT(NG_PROTNUM_RESERVED, hdr->nh); + TEST_ASSERT_EQUAL_INT(PROTNUM_RESERVED, hdr->nh); TEST_ASSERT_EQUAL_INT(0, hdr->hl); TEST_ASSERT(ng_ipv6_addr_equal(&dst, &hdr->dst)); TEST_ASSERT(!ng_pktbuf_is_empty()); @@ -360,7 +360,7 @@ static void test_ipv6_hdr_build__dst_NULL(void) TEST_ASSERT(ng_ipv6_hdr_is(hdr)); TEST_ASSERT_EQUAL_INT(0, ng_ipv6_hdr_get_tc(hdr)); TEST_ASSERT_EQUAL_INT(0, ng_ipv6_hdr_get_fl(hdr)); - TEST_ASSERT_EQUAL_INT(NG_PROTNUM_RESERVED, hdr->nh); + TEST_ASSERT_EQUAL_INT(PROTNUM_RESERVED, hdr->nh); TEST_ASSERT_EQUAL_INT(0, hdr->hl); TEST_ASSERT(ng_ipv6_addr_equal(&src, &hdr->src)); TEST_ASSERT(!ng_pktbuf_is_empty()); @@ -383,7 +383,7 @@ static void test_ipv6_hdr_build__complete(void) TEST_ASSERT(ng_ipv6_hdr_is(hdr)); TEST_ASSERT_EQUAL_INT(0, ng_ipv6_hdr_get_tc(hdr)); TEST_ASSERT_EQUAL_INT(0, ng_ipv6_hdr_get_fl(hdr)); - TEST_ASSERT_EQUAL_INT(NG_PROTNUM_RESERVED, hdr->nh); + TEST_ASSERT_EQUAL_INT(PROTNUM_RESERVED, hdr->nh); TEST_ASSERT_EQUAL_INT(0, hdr->hl); TEST_ASSERT(ng_ipv6_addr_equal(&src, &hdr->src)); TEST_ASSERT(ng_ipv6_addr_equal(&dst, &hdr->dst));