diff --git a/Makefile.dep b/Makefile.dep index 85076fee24bfa..6babfa31e9460 100644 --- a/Makefile.dep +++ b/Makefile.dep @@ -22,13 +22,13 @@ ifneq (,$(filter tcp,$(USEMODULE))) endif ifneq (,$(filter socket_base,$(USEMODULE))) - USEMODULE += sixlowpan + USEMODULE += sixlowpan_legacy USEMODULE += net_help USEMODULE += vtimer endif ifneq (,$(filter sixlowborder,$(USEMODULE))) - USEMODULE += sixlowpan + USEMODULE += sixlowpan_legacy endif ifneq (,$(filter rpl,$(USEMODULE))) @@ -36,10 +36,10 @@ ifneq (,$(filter rpl,$(USEMODULE))) endif ifneq (,$(filter routing,$(USEMODULE))) - USEMODULE += sixlowpan + USEMODULE += sixlowpan_legacy endif -ifneq (,$(filter sixlowpan,$(USEMODULE))) +ifneq (,$(filter sixlowpan_legacy,$(USEMODULE))) USEMODULE += ieee802154 USEMODULE += net_help USEMODULE += net_if @@ -49,7 +49,7 @@ endif ifneq (,$(filter aodvv2,$(USEMODULE))) USEMODULE += vtimer - USEMODULE += sixlowpan + USEMODULE += sixlowpan_legacy USEMODULE += oonf_common USEMODULE += oonf_rfc5444 endif diff --git a/cpu/native/include/nativenet.h b/cpu/native/include/nativenet.h index d7909fc0745f5..4a96bc0582e86 100644 --- a/cpu/native/include/nativenet.h +++ b/cpu/native/include/nativenet.h @@ -47,7 +47,7 @@ extern "C" { #endif -#ifdef MODULE_SIXLOWPAN +#ifdef MODULE_SIXLOWPAN_LEGACY #define NATIVE_MAX_DATA_LENGTH (127) #else #define NATIVE_MAX_DATA_LENGTH (TAP_MAX_DATA) diff --git a/examples/rpl_udp/helper.c b/examples/rpl_udp/helper.c index 5860bd9c72dbc..5c968c061cad0 100644 --- a/examples/rpl_udp/helper.c +++ b/examples/rpl_udp/helper.c @@ -22,7 +22,7 @@ #include #include #include "msg.h" -#include "sixlowpan/ip.h" +#include "sixlowpan_legacy/ip.h" #include "transceiver.h" #include "ieee802154_frame.h" #include "rpl/rpl_structs.h" @@ -33,9 +33,9 @@ #include "debug.h" #define LL_HDR_LEN (0x4) -#define IPV6_HDR_LEN (0x28) +#define IPV6_LEGACY_HDR_LEN (0x28) -extern uint8_t ipv6_ext_hdr_len; +extern uint8_t ipv6_legacy_ext_hdr_len; msg_t msg_q[RCV_BUFFER_SIZE]; @@ -63,7 +63,7 @@ void *rpl_udp_monitor(void *arg) msg_t m; radio_packet_t *p; - ipv6_hdr_t *ipv6_buf; + ipv6_legacy_hdr_t *ipv6_legacy_buf; uint8_t icmp_type, icmp_code; icmpv6_hdr_t *icmpv6_buf = NULL; @@ -89,19 +89,19 @@ void *rpl_udp_monitor(void *arg) p->processing--; DEBUG("\n"); } - else if (m.type == IPV6_PACKET_RECEIVED) { - ipv6_buf = (ipv6_hdr_t *) m.content.ptr; - printf("IPv6 datagram received (next header: %02X)", ipv6_buf->nextheader); - printf(" from %s ", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, - &ipv6_buf->srcaddr)); - - if (ipv6_buf->nextheader == IPV6_PROTO_NUM_ICMPV6) { - icmpv6_buf = (icmpv6_hdr_t *) &ipv6_buf[(LL_HDR_LEN + IPV6_HDR_LEN) + ipv6_ext_hdr_len]; + else if (m.type == IPV6_LEGACY_PACKET_RECEIVED) { + ipv6_legacy_buf = (ipv6_legacy_hdr_t *) m.content.ptr; + printf("IPv6 datagram received (next header: %02X)", ipv6_legacy_buf->nextheader); + printf(" from %s ", ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, + &ipv6_legacy_buf->srcaddr)); + + if (ipv6_legacy_buf->nextheader == IPV6_LEGACY_PROTO_NUM_ICMPV6) { + icmpv6_buf = (icmpv6_hdr_t *) &ipv6_legacy_buf[(LL_HDR_LEN + IPV6_LEGACY_HDR_LEN) + ipv6_legacy_ext_hdr_len]; icmp_type = icmpv6_buf->type; icmp_code = icmpv6_buf->code; } - if (ipv6_buf->nextheader == IPV6_PROTO_NUM_ICMPV6) { + if (ipv6_legacy_buf->nextheader == IPV6_LEGACY_PROTO_NUM_ICMPV6) { DEBUG("\t ICMP type: %02X ", icmp_type); DEBUG("\t ICMP code: %02X ", icmp_code); (void) icmp_type; diff --git a/examples/rpl_udp/rpl.c b/examples/rpl_udp/rpl.c index 5aca75c33b04d..82f4adc904a19 100644 --- a/examples/rpl_udp/rpl.c +++ b/examples/rpl_udp/rpl.c @@ -23,7 +23,7 @@ #include "vtimer.h" #include "thread.h" #include "net_if.h" -#include "sixlowpan.h" +#include "sixlowpan_legacy.h" #include "udp.h" #include "rpl.h" #include "rpl/rpl_dodag.h" @@ -83,11 +83,11 @@ void rpl_udp_init(int argc, char **argv) if (command == 'r') { rpl_init_root(); - ipv6_iface_set_routing_provider(rpl_get_next_hop); + ipv6_legacy_iface_set_routing_provider(rpl_get_next_hop); is_root = 1; } else { - ipv6_iface_set_routing_provider(rpl_get_next_hop); + ipv6_legacy_iface_set_routing_provider(rpl_get_next_hop); } } else { @@ -104,8 +104,8 @@ void rpl_udp_init(int argc, char **argv) "monitor"); DEBUGF("Register at transceiver %02X\n", TRANSCEIVER); transceiver_register(TRANSCEIVER, monitor_pid); - ipv6_register_packet_handler(monitor_pid); - //sixlowpan_lowpan_register(monitor_pid); + ipv6_legacy_register_packet_handler(monitor_pid); + //sixlowpan_legacy_lowpan_register(monitor_pid); } else { printf("ERROR: Unknown command '%c'\n", command); @@ -113,15 +113,15 @@ void rpl_udp_init(int argc, char **argv) } /* add global address */ - ipv6_addr_t tmp; + ipv6_legacy_addr_t tmp; /* initialize prefix */ - ipv6_addr_init(&tmp, 0xabcd, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, id); + ipv6_legacy_addr_init(&tmp, 0xabcd, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, id); /* set host suffix */ - ipv6_addr_set_by_eui64(&tmp, 0, &tmp); - ipv6_net_if_add_addr(0, &tmp, NDP_ADDR_STATE_PREFERRED, 0, 0, 0); + ipv6_legacy_addr_set_by_eui64(&tmp, 0, &tmp); + ipv6_legacy_net_if_add_addr(0, &tmp, NDP_ADDR_STATE_PREFERRED, 0, 0, 0); if (command != 'h') { - ipv6_init_as_router(); + ipv6_legacy_init_as_router(); } /* set channel to 10 */ @@ -152,13 +152,13 @@ void rpl_udp_dodag(int argc, char **argv) } printf("Part of Dodag:\n"); - printf("%s\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, + printf("%s\n", ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, (&mydodag->dodag_id))); printf("my rank: %d\n", mydodag->my_rank); if (!is_root) { printf("my preferred parent:\n"); - printf("%s\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, + printf("%s\n", ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, (&mydodag->my_preferred_parent->addr))); } diff --git a/examples/rpl_udp/rpl_udp.h b/examples/rpl_udp/rpl_udp.h index 60ab602e824f2..5888046a6df16 100644 --- a/examples/rpl_udp/rpl_udp.h +++ b/examples/rpl_udp/rpl_udp.h @@ -99,7 +99,7 @@ void *rpl_udp_monitor(void *arg); extern radio_address_t id; /** @brief Char array for IP address printing */ -extern char addr_str[IPV6_MAX_ADDR_STR_LEN]; +extern char addr_str[IPV6_LEGACY_MAX_ADDR_STR_LEN]; #ifdef __cplusplus } diff --git a/examples/rpl_udp/udp.c b/examples/rpl_udp/udp.c index a7671ab9e96aa..0cd175d71974e 100644 --- a/examples/rpl_udp/udp.c +++ b/examples/rpl_udp/udp.c @@ -36,7 +36,7 @@ #define SERVER_PORT (0xFF01) char udp_server_stack_buffer[KERNEL_CONF_STACKSIZE_MAIN]; -char addr_str[IPV6_MAX_ADDR_STR_LEN]; +char addr_str[IPV6_LEGACY_MAX_ADDR_STR_LEN]; static void *init_udp_server(void *); @@ -97,7 +97,7 @@ void udp_send(int argc, char **argv) { int sock; sockaddr6_t sa; - ipv6_addr_t ipaddr; + ipv6_legacy_addr_t ipaddr; int bytes_sent; int address; char text[5]; @@ -122,10 +122,10 @@ void udp_send(int argc, char **argv) memset(&sa, 0, sizeof(sa)); if (address) { - ipv6_addr_init(&ipaddr, 0xabcd, 0x0, 0x0, 0x0, 0x0, 0x00ff, 0xfe00, (uint16_t)address); + ipv6_legacy_addr_init(&ipaddr, 0xabcd, 0x0, 0x0, 0x0, 0x0, 0x00ff, 0xfe00, (uint16_t)address); } else { - ipv6_addr_set_all_nodes_addr(&ipaddr); + ipv6_legacy_addr_set_all_nodes_addr(&ipaddr); } sa.sin6_family = AF_INET; @@ -141,7 +141,7 @@ void udp_send(int argc, char **argv) } else { printf("Successful deliverd %i bytes over UDP to %s to 6LoWPAN\n", - bytes_sent, ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, + bytes_sent, ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, &ipaddr)); } diff --git a/pkg/libcoap/0001-Add-RIOT-Makefile.patch b/pkg/libcoap/0001-Add-RIOT-Makefile.patch index e88c7b699cf82..41f029ee10921 100644 --- a/pkg/libcoap/0001-Add-RIOT-Makefile.patch +++ b/pkg/libcoap/0001-Add-RIOT-Makefile.patch @@ -15,7 +15,7 @@ index 0000000..f90baa1 +++ b/Makefile @@ -0,0 +1,5 @@ +MODULE:=$(shell basename $(CURDIR)) -+INCLUDES += -I$(RIOTBASE) -I$(RIOTBASE)/sys/include -I$(RIOTBASE)/core/include -I$(RIOTBASE)/drivers/include -I$(RIOTBASE)/drivers/cc110x_legacy/include -I$(RIOTBASE)/cpu/arm7_common/include -I$(RIOTBASE)/sys/net/transport_layer/include -I$(RIOTBASE)/sys/net/sixlowpan/include/ -I$(RIOTBASE)/sys/net/ieee802154/include -I$(RIOTBASE)/sys/net/net_help -I$(RIOTBASE)/sys/posix/include -I$(RIOTBASE)/sys/posix/pnet/include ++INCLUDES += -I$(RIOTBASE) -I$(RIOTBASE)/sys/include -I$(RIOTBASE)/core/include -I$(RIOTBASE)/drivers/include -I$(RIOTBASE)/drivers/cc110x_legacy/include -I$(RIOTBASE)/cpu/arm7_common/include -I$(RIOTBASE)/sys/net/transport_layer/include -I$(RIOTBASE)/sys/net/sixlowpan_legacy/include/ -I$(RIOTBASE)/sys/net/ieee802154/include -I$(RIOTBASE)/sys/net/net_help -I$(RIOTBASE)/sys/posix/include -I$(RIOTBASE)/sys/posix/pnet/include +CFLAGS += -DWITH_POSIX + +include $(RIOTBASE)/Makefile.base diff --git a/sys/Makefile b/sys/Makefile index 2461904134809..315173a81ff05 100644 --- a/sys/Makefile +++ b/sys/Makefile @@ -35,11 +35,11 @@ endif ifneq (,$(filter protocol_multiplex,$(USEMODULE))) DIRS += net/link_layer/protocol-multiplex endif -ifneq (,$(filter sixlowpan,$(USEMODULE))) - DIRS += net/network_layer/sixlowpan +ifneq (,$(filter sixlowpan_legacy,$(USEMODULE))) + DIRS += net/network_layer/sixlowpan_legacy endif ifneq (,$(filter sixlowborder,$(USEMODULE))) - DIRS += net/network_layer/sixlowpan/border + DIRS += net/network_layer/sixlowpan_legacy/border endif ifneq (,$(filter rpl,$(USEMODULE))) DIRS += net/routing/rpl diff --git a/sys/Makefile.include b/sys/Makefile.include index e974bb582ddb4..830f1f569b100 100644 --- a/sys/Makefile.include +++ b/sys/Makefile.include @@ -31,7 +31,7 @@ endif ifneq (,$(filter protocol_multiplex,$(USEMODULE))) USEMODULE_INCLUDES += $(RIOTBASE)/sys/net/include endif -ifneq (,$(filter sixlowpan,$(USEMODULE))) +ifneq (,$(filter sixlowpan_legacy,$(USEMODULE))) USEMODULE_INCLUDES += $(RIOTBASE)/sys/net/include endif ifneq (,$(filter rpl,$(USEMODULE))) diff --git a/sys/auto_init/auto_init.c b/sys/auto_init/auto_init.c index 9d2d7bfbbe7f2..a2f7db2cffc66 100644 --- a/sys/auto_init/auto_init.c +++ b/sys/auto_init/auto_init.c @@ -55,8 +55,8 @@ #include "rtc.h" #endif -#ifdef MODULE_SIXLOWPAN -#include "sixlowpan.h" +#ifdef MODULE_SIXLOWPAN_LEGACY +#include "sixlowpan_legacy.h" #endif #ifdef MODULE_UDP @@ -249,9 +249,9 @@ void auto_init(void) DEBUG("Auto init net_if module.\n"); auto_init_net_if(); #endif -#ifdef MODULE_SIXLOWPAN +#ifdef MODULE_SIXLOWPAN_LEGACY DEBUG("Auto init 6LoWPAN module.\n"); - sixlowpan_lowpan_init(); + sixlowpan_legacy_lowpan_init(); #endif #ifdef MODULE_PROFILING extern void profiling_init(void); diff --git a/sys/net/include/etx_beaconing.h b/sys/net/include/etx_beaconing.h index c694e4796cdce..1677caa875029 100644 --- a/sys/net/include/etx_beaconing.h +++ b/sys/net/include/etx_beaconing.h @@ -20,7 +20,7 @@ #ifndef ETX_BEACONING_H_ #define ETX_BEACONING_H_ #include -#include "sixlowpan.h" +#include "sixlowpan_legacy.h" #ifdef __cplusplus extern "C" { @@ -56,7 +56,7 @@ extern "C" { #define ETX_BEST_CANDIDATES (15) //Sent only 15 candidates in a beaconing packet #define ETX_TUPLE_SIZE (2) //1 Byte for Addr, 1 Byte for packets rec. #define ETX_PKT_REC_OFFSET (ETX_TUPLE_SIZE - 1) //Offset in a tuple of (addr,pkt_rec), will always be the last byte -#define ETX_IPV6_LAST_BYTE (15) //The last byte for an ipv6 address +#define ETX_IPV6_LEGACY_LAST_BYTE (15) //The last byte for an ipv6_legacy address #define ETX_MAX_JITTER (ETX_INTERVAL / 5) //The default value is 20% of ETX_INTERVAL #define ETX_JITTER_MOD (ETX_MAX_JITTER + 1) //The modulo value for jitter computation #define ETX_DEF_JIT_CORRECT (ETX_MAX_JITTER / 2) //Default Jitter correction value (normally ETX_MAX_JITTER / 2) @@ -94,7 +94,7 @@ typedef struct __attribute__((packed)) etx_probe_t { } etx_probe_t; typedef struct etx_neighbor_t { - ipv6_addr_t addr; //The address of this node + ipv6_legacy_addr_t addr; //The address of this node uint8_t tx_cur_round; //The indicator for receiving a packet from this candidate this round uint8_t packets_tx[ETX_WINDOW]; //The packets this node has transmitted TO ME uint8_t packets_rx; //The packets this node has received FROM ME @@ -103,8 +103,8 @@ typedef struct etx_neighbor_t { } etx_neighbor_t; //prototypes -void etx_init_beaconing(ipv6_addr_t *address); -double etx_get_metric(ipv6_addr_t *address); +void etx_init_beaconing(ipv6_legacy_addr_t *address); +double etx_get_metric(ipv6_legacy_addr_t *address); void etx_update(etx_neighbor_t *neighbor); #define ETX_PKT_OPT (0) //Position of Option-Type-Byte diff --git a/sys/net/include/ipv6.h b/sys/net/include/ipv6_legacy.h similarity index 55% rename from sys/net/include/ipv6.h rename to sys/net/include/ipv6_legacy.h index eccc499cb814e..90199d62b86d7 100644 --- a/sys/net/include/ipv6.h +++ b/sys/net/include/ipv6_legacy.h @@ -7,9 +7,9 @@ */ /** - * @ingroup net_sixlowpan + * @ingroup net_sixlowpan_legacy * @{ - * @file ipv6.h + * @file ipv6_legacy.h * @brief IPv6 and ICMP functions * * Wraps all API types, constants and functions of @@ -17,16 +17,16 @@ * * @author Martin Lenders */ -#ifndef IPV6_H -#define IPV6_H +#ifndef IPV6_LEGACY_H +#define IPV6_LEGACY_H -#include "sixlowpan/error.h" -#include "sixlowpan/types.h" -#include "sixlowpan/ip.h" -#include "sixlowpan/icmp.h" -#include "sixlowpan/ndp.h" +#include "sixlowpan_legacy/error.h" +#include "sixlowpan_legacy/types.h" +#include "sixlowpan_legacy/ip.h" +#include "sixlowpan_legacy/icmp.h" +#include "sixlowpan_legacy/ndp.h" -#include "../network_layer/sixlowpan/icmp.h" /* TODO: remove if not needed anymore */ +#include "../network_layer/sixlowpan_legacy/icmp.h" /* TODO: remove if not needed anymore */ #ifdef __cplusplus extern "C" { @@ -36,7 +36,7 @@ extern "C" { } #endif -#endif /* IPV6_H */ +#endif /* IPV6_LEGACY_H */ /** * @} */ diff --git a/sys/net/include/net_if.h b/sys/net/include/net_if.h index 98258bd392bb9..e50b3496dc4ac 100644 --- a/sys/net/include/net_if.h +++ b/sys/net/include/net_if.h @@ -46,42 +46,42 @@ typedef uint8_t net_if_l3p_t; * @brief Interface protocols (for net_if_t.protocols): Use unicast IPv6 * address in upper layer, addr_len must be 128. */ -#define NET_IF_L3P_IPV6_UNICAST (0x01) +#define NET_IF_L3P_IPV6_LEGACY_UNICAST (0x01) /** * @brief Interface protocols (for net_if_t.protocols): Use multicast IPv6 * address in upper layer, addr_len must be 128. */ -#define NET_IF_L3P_IPV6_MULTICAST (0x02) +#define NET_IF_L3P_IPV6_LEGACY_MULTICAST (0x02) /** * @brief Interface protocols (for net_if_t.protocols): Use anycast IPv6 * address in upper layer, addr_len must be 128. */ -#define NET_IF_L3P_IPV6_ANYCAST (0x04) +#define NET_IF_L3P_IPV6_LEGACY_ANYCAST (0x04) /** * @brief Interface protocols (for net_if_t.protocols): Use IPv6 prefix in * upper layer, addr_len <= 128 becomes prefix length. */ -#define NET_IF_L3P_IPV6_PREFIX (0x08) +#define NET_IF_L3P_IPV6_LEGACY_PREFIX (0x08) /** * @brief Interface protocols (for net_if_t.protocols): Convenience macro - * combining NET_IF_L3P_IPV6_UNICAST, NET_IF_L3P_IPV6_ANYCAST, and - * NET_IF_L3P_IPV6_MULTICAST for comparisons + * combining NET_IF_L3P_IPV6_LEGACY_UNICAST, NET_IF_L3P_IPV6_LEGACY_ANYCAST, and + * NET_IF_L3P_IPV6_LEGACY_MULTICAST for comparisons */ -#define NET_IF_L3P_IPV6_ADDR (NET_IF_L3P_IPV6_UNICAST | NET_IF_L3P_IPV6_ANYCAST \ - | NET_IF_L3P_IPV6_MULTICAST) +#define NET_IF_L3P_IPV6_LEGACY_ADDR (NET_IF_L3P_IPV6_LEGACY_UNICAST | NET_IF_L3P_IPV6_LEGACY_ANYCAST \ + | NET_IF_L3P_IPV6_LEGACY_MULTICAST) /** * @brief Interface protocols (for net_if_t.protocols): Convenience macro - * combining NET_IF_L3P_IPV6_UNICAST, NET_IF_L3P_IPV6_ANYCAST, - * NET_IF_L3P_IPV6_MULTICAST, and NET_IF_L3P_IPV6_PREFIX for + * combining NET_IF_L3P_IPV6_LEGACY_UNICAST, NET_IF_L3P_IPV6_LEGACY_ANYCAST, + * NET_IF_L3P_IPV6_LEGACY_MULTICAST, and NET_IF_L3P_IPV6_LEGACY_PREFIX for * comparisons */ -#define NET_IF_L3P_IPV6 (NET_IF_L3P_IPV6_UNICAST | NET_IF_L3P_IPV6_ANYCAST \ - | NET_IF_L3P_IPV6_MULTICAST | NET_IF_L3P_IPV6_PREFIX) +#define NET_IF_L3P_IPV6_LEGACY (NET_IF_L3P_IPV6_LEGACY_UNICAST | NET_IF_L3P_IPV6_LEGACY_ANYCAST \ + | NET_IF_L3P_IPV6_LEGACY_MULTICAST | NET_IF_L3P_IPV6_LEGACY_PREFIX) /** * @brief Interface protocols: Return value of net_if_get_l3p_types() on diff --git a/sys/net/include/rpl.h b/sys/net/include/rpl.h index c06be848d1768..aa12a30daeaf7 100644 --- a/sys/net/include/rpl.h +++ b/sys/net/include/rpl.h @@ -29,7 +29,7 @@ #include #include #include -#include "ipv6.h" +#include "ipv6_legacy.h" #include "rpl/rpl_dodag.h" #include "rpl/rpl_of_manager.h" @@ -47,7 +47,7 @@ extern "C" { extern kernel_pid_t rpl_process_pid; extern uint8_t rpl_max_routing_entries; -/* needed for receiving messages with ICMP-code 155. Received via IPC from ipv6.c */ +/* needed for receiving messages with ICMP-code 155. Received via IPC from ipv6_legacy.c */ extern mutex_t rpl_recv_mutex; /* needed for sending RPL-messages */ @@ -61,7 +61,7 @@ extern uint8_t rpl_buffer[BUFFER_SIZE - LL_HDR_LEN]; * @brief Initialization of RPL. * * This function initializes all basic RPL resources such as mutex for send/receive, - * corresponding objective functions and sixlowpan (including own address). Calls + * corresponding objective functions and sixlowpan_legacy (including own address). Calls * initialization for mode as specified by PL_DEFAULT_MOP in rpl_structs.h. * * @param[in] if_id ID of the interface, which correspond to the network under RPL-control @@ -92,7 +92,7 @@ void rpl_init_root(void); * @param[in] destination IPv6-address of the destination of the DIO. Should be a direct neighbor. * */ -void rpl_send_DIO(ipv6_addr_t *destination); +void rpl_send_DIO(ipv6_legacy_addr_t *destination); /** * @brief Sends a DAO-message to a given destination @@ -107,7 +107,7 @@ void rpl_send_DIO(ipv6_addr_t *destination); * @param[in] start_index Describes whether a DAO must be split because of too many routing entries. * */ -void rpl_send_DAO(ipv6_addr_t *destination, uint8_t lifetime, bool default_lifetime, uint8_t start_index); +void rpl_send_DAO(ipv6_legacy_addr_t *destination, uint8_t lifetime, bool default_lifetime, uint8_t start_index); /** * @brief Sends a DIS-message to a given destination @@ -119,7 +119,7 @@ void rpl_send_DAO(ipv6_addr_t *destination, uint8_t lifetime, bool default_lifet * @param[in] destination IPv6-address of the destination of the DIS. Should be a direct neighbor or multicast-address. * */ -void rpl_send_DIS(ipv6_addr_t *destination); +void rpl_send_DIS(ipv6_legacy_addr_t *destination); /** * @brief Sends a DAO acknowledgment-message to a given destination @@ -131,7 +131,7 @@ void rpl_send_DIS(ipv6_addr_t *destination); * @param[in] destination IPv6-address of the destination of the DAO_ACK. Should be a direct neighbor. * */ -void rpl_send_DAO_ACK(ipv6_addr_t *destination); +void rpl_send_DAO_ACK(ipv6_legacy_addr_t *destination); /** * @brief Receives a DIO message @@ -173,7 +173,7 @@ void rpl_recv_DAO_ACK(void); * @brief Initialization of RPl-root. * * This function initializes all RPL resources especially for root purposes. - * corresponding objective functions and sixlowpan (including own address). It also register mutexes for + * corresponding objective functions and sixlowpan_legacy (including own address). It also register mutexes for * sending and receiving RPL-based messages. Both are necessary because of parallel access from different * layers/modules of RIOT. May change with future structure changes. * @@ -193,7 +193,7 @@ void *rpl_process(void *arg); * @return Next hop address * * */ -ipv6_addr_t *rpl_get_next_hop(ipv6_addr_t *addr); +ipv6_legacy_addr_t *rpl_get_next_hop(ipv6_legacy_addr_t *addr); /** * @brief Adds routing entry to routing table @@ -206,7 +206,7 @@ ipv6_addr_t *rpl_get_next_hop(ipv6_addr_t *addr); * @param[in] lifetime Lifetime of the entry * * */ -void rpl_add_routing_entry(ipv6_addr_t *addr, ipv6_addr_t *next_hop, uint16_t lifetime); +void rpl_add_routing_entry(ipv6_legacy_addr_t *addr, ipv6_legacy_addr_t *next_hop, uint16_t lifetime); /** * @brief Deletes routing entry to routing table @@ -217,7 +217,7 @@ void rpl_add_routing_entry(ipv6_addr_t *addr, ipv6_addr_t *next_hop, uint16_t li * @param[in] addr Destination address * * */ -void rpl_del_routing_entry(ipv6_addr_t *addr); +void rpl_del_routing_entry(ipv6_legacy_addr_t *addr); /** * @brief Finds routing entry for a given destination. @@ -230,7 +230,7 @@ void rpl_del_routing_entry(ipv6_addr_t *addr); * @return Routing entry address * * */ -rpl_routing_entry_t *rpl_find_routing_entry(ipv6_addr_t *addr); +rpl_routing_entry_t *rpl_find_routing_entry(ipv6_legacy_addr_t *addr); /** * @brief Clears routing table. @@ -273,16 +273,16 @@ uint8_t rpl_is_root(void); * @param[in] lifetime Lifetime of the relation * * */ -void rpl_add_srh_entry(ipv6_addr_t *child, ipv6_addr_t *parent, uint16_t lifetime); +void rpl_add_srh_entry(ipv6_legacy_addr_t *child, ipv6_legacy_addr_t *parent, uint16_t lifetime); /** * @brief Constructs a source routing header based on an original IPv6-header * - * @param[in] act_ipv6_hdr Pointer to original IPv6-packet header + * @param[in] act_ipv6_legacy_hdr Pointer to original IPv6-packet header * @return Source routing header or NULL * * */ -ipv6_srh_t *rpl_get_srh_header(ipv6_hdr_t *act_ipv6_hdr); +ipv6_legacy_srh_t *rpl_get_srh_header(ipv6_legacy_hdr_t *act_ipv6_legacy_hdr); /** * @brief Manages sending an SRH-header integrated in an original IPv6-package to the next hop. @@ -295,16 +295,16 @@ ipv6_srh_t *rpl_get_srh_header(ipv6_hdr_t *act_ipv6_hdr); * @param[in] srh_length Length of the pre-built source routing header * @return Status of sending progress * */ -int rpl_srh_sendto(const void *buf, uint16_t len, ipv6_addr_t *src, ipv6_addr_t *dest, ipv6_srh_t *srh_header, uint8_t srh_length); +int rpl_srh_sendto(const void *buf, uint16_t len, ipv6_legacy_addr_t *src, ipv6_legacy_addr_t *dest, ipv6_legacy_srh_t *srh_header, uint8_t srh_length); /** * @brief Sends IPC-message to the service, which is indicated by the next-header-field in the source routing header * - * @param[in] ipv6_header Actual IPv6-header + * @param[in] ipv6_legacy_header Actual IPv6-header * @return IPv6-address of the next-hop. Is NULL on error occurrence. * * */ -void rpl_remove_srh_header(ipv6_hdr_t *ipv6_header, const void *buf, uint8_t nextheader); +void rpl_remove_srh_header(ipv6_legacy_hdr_t *ipv6_legacy_header, const void *buf, uint8_t nextheader); #endif /* RPL_DEFAULT_MOP == RPL_NON_STORING_MODE */ diff --git a/sys/net/include/rpl/rpl_dodag.h b/sys/net/include/rpl/rpl_dodag.h index 07bb3b5d03edc..7e0df3212165f 100644 --- a/sys/net/include/rpl/rpl_dodag.h +++ b/sys/net/include/rpl/rpl_dodag.h @@ -18,7 +18,7 @@ */ #include -#include "ipv6.h" +#include "ipv6_legacy.h" #include "rpl_structs.h" #include "rpl_config.h" @@ -30,22 +30,22 @@ void rpl_instances_init(void); rpl_instance_t *rpl_new_instance(uint8_t instanceid); rpl_instance_t *rpl_get_instance(uint8_t instanceid); rpl_instance_t *rpl_get_my_instance(void); -rpl_dodag_t *rpl_new_dodag(uint8_t instanceid, ipv6_addr_t *id); -rpl_dodag_t *rpl_get_dodag(ipv6_addr_t *id); +rpl_dodag_t *rpl_new_dodag(uint8_t instanceid, ipv6_legacy_addr_t *id); +rpl_dodag_t *rpl_get_dodag(ipv6_legacy_addr_t *id); rpl_dodag_t *rpl_get_my_dodag(void); -void rpl_join_dodag(rpl_dodag_t *dodag, ipv6_addr_t *parent, uint16_t parent_rank); +void rpl_join_dodag(rpl_dodag_t *dodag, ipv6_legacy_addr_t *parent, uint16_t parent_rank); void rpl_del_dodag(rpl_dodag_t *dodag); -rpl_parent_t *rpl_new_parent(rpl_dodag_t *dodag, ipv6_addr_t *address, uint16_t rank); -rpl_parent_t *rpl_find_parent(ipv6_addr_t *address); +rpl_parent_t *rpl_new_parent(rpl_dodag_t *dodag, ipv6_legacy_addr_t *address, uint16_t rank); +rpl_parent_t *rpl_find_parent(ipv6_legacy_addr_t *address); void rpl_leave_dodag(rpl_dodag_t *dodag); -bool rpl_equal_id(ipv6_addr_t *id1, ipv6_addr_t *id2); -ipv6_addr_t *rpl_get_my_preferred_parent(void); +bool rpl_equal_id(ipv6_legacy_addr_t *id1, ipv6_legacy_addr_t *id2); +ipv6_legacy_addr_t *rpl_get_my_preferred_parent(void); void rpl_delete_parent(rpl_parent_t *parent); void rpl_delete_worst_parent(void); void rpl_delete_all_parents(void); rpl_parent_t *rpl_find_preferred_parent(void); void rpl_parent_update(rpl_parent_t *parent); -void rpl_global_repair(rpl_dodag_t *dodag, ipv6_addr_t *p_addr, uint16_t rank); +void rpl_global_repair(rpl_dodag_t *dodag, ipv6_legacy_addr_t *p_addr, uint16_t rank); void rpl_local_repair(void); uint16_t rpl_calc_rank(uint16_t abs_rank, uint16_t minhoprankincrease); diff --git a/sys/net/include/rpl/rpl_nonstoring.h b/sys/net/include/rpl/rpl_nonstoring.h index b4ed43cf0de31..87a8543047b54 100644 --- a/sys/net/include/rpl/rpl_nonstoring.h +++ b/sys/net/include/rpl/rpl_nonstoring.h @@ -46,10 +46,10 @@ void rpl_init_root_mode(void); * This function initializes all basic RPL mode resources. For this mode this includes only acquiring the own * address. * - * @param[in] my_ipv6_address Own IPv6 address as assigned by RPL core-initialization. + * @param[in] my_ipv6_legacy_address Own IPv6 address as assigned by RPL core-initialization. * */ -void rpl_init_mode(ipv6_addr_t *my_ipv6_address); +void rpl_init_mode(ipv6_legacy_addr_t *my_ipv6_legacy_address); /** * @brief Returns whether a node is root or not @@ -71,7 +71,7 @@ uint8_t rpl_is_root_mode(void); * @param[in] destination IPv6-address of the destination of the DIO. Should be a direct neighbor or multicast address. * */ -void rpl_send_DIO_mode(ipv6_addr_t *destination); +void rpl_send_DIO_mode(ipv6_legacy_addr_t *destination); /** * @brief Sends a DAO-message to a given destination @@ -84,7 +84,7 @@ void rpl_send_DIO_mode(ipv6_addr_t *destination); * @param[in] start_index Describes whether a DAO must be split because of too many routing entries. * */ -void rpl_send_DAO_mode(ipv6_addr_t *destination, uint8_t lifetime, bool default_lifetime, uint8_t start_index); +void rpl_send_DAO_mode(ipv6_legacy_addr_t *destination, uint8_t lifetime, bool default_lifetime, uint8_t start_index); /** * @brief Sends a DIS-message to a given destination @@ -94,7 +94,7 @@ void rpl_send_DAO_mode(ipv6_addr_t *destination, uint8_t lifetime, bool default_ * @param[in] destination IPv6-address of the destination of the DIS. Should be a direct neighbor. * */ -void rpl_send_DIS_mode(ipv6_addr_t *destination); +void rpl_send_DIS_mode(ipv6_legacy_addr_t *destination); /** * @brief Sends a DAO acknowledgment-message to a given destination @@ -104,7 +104,7 @@ void rpl_send_DIS_mode(ipv6_addr_t *destination); * @param[in] destination IPv6-address of the destination of the DAO_ACK. Should be a direct neighbor. * */ -void rpl_send_DAO_ACK_mode(ipv6_addr_t *destination); +void rpl_send_DAO_ACK_mode(ipv6_legacy_addr_t *destination); /** * @brief Receives a DIO message @@ -143,7 +143,7 @@ void rpl_recv_dao_ack_mode(void); * * This function sends any RPl related messages to a given destination. This implementation should be equal * for all modes and therefore should not be altered. Every mode related RPL-sending function calls this for - * relaying it in lower layers to sixlowpan. Because send-functions are wrapped by a mutex in rpl.c, the same + * relaying it in lower layers to sixlowpan_legacy. Because send-functions are wrapped by a mutex in rpl.c, the same * mutex applies here. * * @param[in] destination IPv6-address of the destination of the message. @@ -152,7 +152,7 @@ void rpl_recv_dao_ack_mode(void); * @param[in] next_header Index to next header in message. * */ -void rpl_send(ipv6_addr_t *destination, uint8_t *payload, uint16_t p_len, uint8_t next_header); +void rpl_send(ipv6_legacy_addr_t *destination, uint8_t *payload, uint16_t p_len, uint8_t next_header); #ifdef __cplusplus } diff --git a/sys/net/include/rpl/rpl_of_manager.h b/sys/net/include/rpl/rpl_of_manager.h index 3f13c001ad6b5..953d7a2cdf306 100644 --- a/sys/net/include/rpl/rpl_of_manager.h +++ b/sys/net/include/rpl/rpl_of_manager.h @@ -29,7 +29,7 @@ extern "C" { * @brief Initialization of Manager and of-functions. * @param[in] my_address Own address for initialization of beaconing */ -void rpl_of_manager_init(ipv6_addr_t *my_address); +void rpl_of_manager_init(ipv6_legacy_addr_t *my_address); /** * @brief Returns objective function with a given cope point diff --git a/sys/net/include/rpl/rpl_storing.h b/sys/net/include/rpl/rpl_storing.h index 1fa0af40f4ba4..4c1b1821cda3b 100644 --- a/sys/net/include/rpl/rpl_storing.h +++ b/sys/net/include/rpl/rpl_storing.h @@ -47,10 +47,10 @@ void rpl_init_root_mode(void); * This function initializes all basic RPL mode resources. For this mode this includes only acquiring the own * address. * - * @param[in] my_ipv6_address Own IPv6 address as assigned by RPL core-initialization. + * @param[in] my_ipv6_legacy_address Own IPv6 address as assigned by RPL core-initialization. * */ -void rpl_init_mode(ipv6_addr_t *my_ipv6_address); +void rpl_init_mode(ipv6_legacy_addr_t *my_ipv6_legacy_address); /** * @brief Sends a DIO-message to a given destination @@ -60,7 +60,7 @@ void rpl_init_mode(ipv6_addr_t *my_ipv6_address); * @param[in] destination IPv6-address of the destination of the DIO. Should be a direct neighbor or multicast address. * */ -void rpl_send_DIO_mode(ipv6_addr_t *destination); +void rpl_send_DIO_mode(ipv6_legacy_addr_t *destination); /** * @brief Returns whether a node is root or not @@ -85,7 +85,7 @@ uint8_t rpl_is_root_mode(void); * @param[in] start_index Describes whether a DAO must be split because of too many routing entries. * */ -void rpl_send_DAO_mode(ipv6_addr_t *destination, uint8_t lifetime, bool default_lifetime, uint8_t start_index); +void rpl_send_DAO_mode(ipv6_legacy_addr_t *destination, uint8_t lifetime, bool default_lifetime, uint8_t start_index); /** * @brief Sends a DIS-message to a given destination @@ -95,7 +95,7 @@ void rpl_send_DAO_mode(ipv6_addr_t *destination, uint8_t lifetime, bool default_ * @param[in] destination IPv6-address of the destination of the DIS. Should be a direct neighbor. * */ -void rpl_send_DIS_mode(ipv6_addr_t *destination); +void rpl_send_DIS_mode(ipv6_legacy_addr_t *destination); /** * @brief Sends a DAO acknowledgment-message to a given destination @@ -105,7 +105,7 @@ void rpl_send_DIS_mode(ipv6_addr_t *destination); * @param[in] destination IPv6-address of the destination of the DAO_ACK. Should be a direct neighbor. * */ -void rpl_send_DAO_ACK_mode(ipv6_addr_t *destination); +void rpl_send_DAO_ACK_mode(ipv6_legacy_addr_t *destination); /** * @brief Receives a DIO message @@ -144,7 +144,7 @@ void rpl_recv_dao_ack_mode(void); * * This function sends any RPl related messages to a given destination. This implementation should be equal * for all modes and therefore should not be altered. Every mode related RPL-sending function calls this for - * relaying it in lower layers to sixlowpan. Because send-functions are wrapped by a mutex in rpl.c, the same + * relaying it in lower layers to sixlowpan_legacy. Because send-functions are wrapped by a mutex in rpl.c, the same * mutex applies here. * * @param[in] destination IPv6-address of the destination of the message. @@ -153,7 +153,7 @@ void rpl_recv_dao_ack_mode(void); * @param[in] next_header Index to next header in message. * */ -void rpl_send(ipv6_addr_t *destination, uint8_t *payload, uint16_t p_len, uint8_t next_header); +void rpl_send(ipv6_legacy_addr_t *destination, uint8_t *payload, uint16_t p_len, uint8_t next_header); #ifdef __cplusplus } diff --git a/sys/net/include/rpl/rpl_structs.h b/sys/net/include/rpl/rpl_structs.h index d712df33ee279..ee068443cefa1 100644 --- a/sys/net/include/rpl/rpl_structs.h +++ b/sys/net/include/rpl/rpl_structs.h @@ -19,7 +19,7 @@ */ #include -#include "ipv6.h" +#include "ipv6_legacy.h" #ifndef RPL_STRUCTS_H_INCLUDED #define RPL_STRUCTS_H_INCLUDED @@ -39,7 +39,7 @@ struct __attribute__((packed)) rpl_dio_t { uint8_t dtsn; uint8_t flags; uint8_t reserved; - ipv6_addr_t dodagid; + ipv6_legacy_addr_t dodagid; }; struct __attribute__((packed)) rpl_dis_t { @@ -66,7 +66,7 @@ struct __attribute__((packed)) rpl_dao_ack_t { /* DODAG ID Struct */ /* may be present in dao or dao_ack packets */ struct __attribute__((packed)) dodag_id_t { - ipv6_addr_t dodagid; + ipv6_legacy_addr_t dodagid; }; /* RPL-Option Generic Format (RFC 6550 Fig. 19) */ @@ -97,18 +97,18 @@ typedef struct __attribute__((packed)) { uint8_t length; uint8_t rplinstanceid; uint8_t VID_Flags; - ipv6_addr_t dodagid; + ipv6_legacy_addr_t dodagid; uint8_t version; } rpl_opt_solicited_t; /* RPL Target-Option (RFC 6550 Fig. 25) */ -/* TODO: ipv6_addr_t target may be replaced by a target prefix of variable length */ +/* TODO: ipv6_legacy_addr_t target may be replaced by a target prefix of variable length */ typedef struct __attribute__((packed)) { uint8_t type; uint8_t length; uint8_t flags; uint8_t prefix_length; - ipv6_addr_t target; + ipv6_legacy_addr_t target; } rpl_opt_target_t; /* RPL Transit-Option (RFC 6550 Fig. 26) */ @@ -119,13 +119,13 @@ typedef struct __attribute__((packed)) { uint8_t path_control; uint8_t path_sequence; uint8_t path_lifetime; - ipv6_addr_t parent; + ipv6_legacy_addr_t parent; } rpl_opt_transit_t; struct rpl_dodag_t; typedef struct { - ipv6_addr_t addr; + ipv6_legacy_addr_t addr; uint16_t rank; uint8_t dtsn; struct rpl_dodag_t *dodag; @@ -146,7 +146,7 @@ typedef struct { //Node-internal representation of a DODAG, with nodespecific information typedef struct rpl_dodag_t { rpl_instance_t *instance; - ipv6_addr_t dodag_id; + ipv6_legacy_addr_t dodag_id; uint8_t used; uint8_t mop; uint8_t dtsn; @@ -181,8 +181,8 @@ typedef struct rpl_of_t { } rpl_of_t; typedef struct { - ipv6_addr_t address; - ipv6_addr_t next_hop; + ipv6_legacy_addr_t address; + ipv6_legacy_addr_t next_hop; uint16_t lifetime; uint8_t used; } rpl_routing_entry_t; diff --git a/sys/net/include/sixlowpan.h b/sys/net/include/sixlowpan_legacy.h similarity index 82% rename from sys/net/include/sixlowpan.h rename to sys/net/include/sixlowpan_legacy.h index b2f0e6125e78d..1d8cee5105d1f 100644 --- a/sys/net/include/sixlowpan.h +++ b/sys/net/include/sixlowpan_legacy.h @@ -7,7 +7,7 @@ */ /** - * @defgroup net_sixlowpan 6LoWPAN + * @defgroup net_sixlowpan_legacy 6LoWPAN * @ingroup net * @brief 6LoWPAN module implements (parts of) the 6LoWPAN adaption layer * for IPv6 over Low Power Wireless Personal Area Networks @@ -34,18 +34,18 @@ * * * @{ - * @file sixlowpan.h + * @file sixlowpan_legacy.h * @brief 6lowpan link layer and lowpan functions * * @author Martin Lenders */ -#ifndef SIXLOWPAN_H -#define SIXLOWPAN_H +#ifndef SIXLOWPAN_LEGACY_H +#define SIXLOWPAN_LEGACY_H -#include "sixlowpan/error.h" -#include "sixlowpan/types.h" -#include "sixlowpan/lowpan.h" -#include "sixlowpan/mac.h" +#include "sixlowpan_legacy/error.h" +#include "sixlowpan_legacy/types.h" +#include "sixlowpan_legacy/lowpan.h" +#include "sixlowpan_legacy/mac.h" #ifdef __cplusplus extern "C" { @@ -55,5 +55,5 @@ extern "C" { } #endif -#endif /* SIXLOWPAN_H */ +#endif /* SIXLOWPAN_LEGACY_H */ /** @} */ diff --git a/sys/net/include/sixlowpan/error.h b/sys/net/include/sixlowpan_legacy/error.h similarity index 92% rename from sys/net/include/sixlowpan/error.h rename to sys/net/include/sixlowpan_legacy/error.h index 607ccd4e21238..45b2510f4d5d0 100644 --- a/sys/net/include/sixlowpan/error.h +++ b/sys/net/include/sixlowpan_legacy/error.h @@ -7,17 +7,17 @@ */ /** - * @ingroup net_sixlowpan_lowpan + * @ingroup net_sixlowpan_legacy_lowpan * @{ * - * @file sixlowpan/error.h + * @file sixlowpan_legacy/error.h * @brief 6LoWPAN error codes * * @author Martin Lenders */ -#ifndef SIXLOWPAN_ERROR_H -#define SIXLOWPAN_ERROR_H +#ifndef SIXLOWPAN_LEGACY_ERROR_H +#define SIXLOWPAN_LEGACY_ERROR_H #ifdef __cplusplus extern "C" { @@ -104,4 +104,4 @@ extern "C" { #endif /** @} */ -#endif /* SIXLOWPAN_ERROR_H */ +#endif /* SIXLOWPAN_LEGACY_ERROR_H */ diff --git a/sys/net/include/sixlowpan/icmp.h b/sys/net/include/sixlowpan_legacy/icmp.h similarity index 87% rename from sys/net/include/sixlowpan/icmp.h rename to sys/net/include/sixlowpan_legacy/icmp.h index 0692ec8997d09..34427976c71e7 100644 --- a/sys/net/include/sixlowpan/icmp.h +++ b/sys/net/include/sixlowpan_legacy/icmp.h @@ -7,13 +7,13 @@ */ /** - * @addtogroup net_sixlowpan_ndp Neighbor discovery - * @ingroup net_sixlowpan + * @addtogroup net_sixlowpan_legacy_ndp Neighbor discovery + * @ingroup net_sixlowpan_legacy * @brief Internet Control Message Protocol version 6 * * @{ * - * @file include/sixlowpan/icmp.h + * @file include/sixlowpan_legacy/icmp.h * @brief 6LoWPAN ICMP related header * * @author Stephan Zeisberg @@ -22,13 +22,13 @@ * @author Oliver Gesch */ -#ifndef SIXLOWPAN_ICMP_H -#define SIXLOWPAN_ICMP_H +#ifndef SIXLOWPAN_LEGACY_ICMP_H +#define SIXLOWPAN_LEGACY_ICMP_H #include #include -#include "sixlowpan/types.h" +#include "sixlowpan_legacy/types.h" #ifdef __cplusplus extern "C" { @@ -129,7 +129,7 @@ extern "C" { * RFC 4443, section 3.4 * */ -#define ICMPV6_PARAMETER_PROB_CODE_IPV6_OPT_UNREC (2) +#define ICMPV6_PARAMETER_PROB_CODE_IPV6_LEGACY_OPT_UNREC (2) /** * @brief Send ICMPv6 parameter problem message. @@ -143,7 +143,7 @@ extern "C" { * @param[in] packet Data payload for echo request. * @param[in] packet_len Length of data payload. */ -void icmpv6_send_parameter_prob(ipv6_addr_t *src, ipv6_addr_t *dest, +void icmpv6_send_parameter_prob(ipv6_legacy_addr_t *src, ipv6_legacy_addr_t *dest, uint8_t code, uint32_t pointer, uint8_t *packet, uint8_t packet_len); @@ -156,7 +156,7 @@ void icmpv6_send_parameter_prob(ipv6_addr_t *src, ipv6_addr_t *dest, * @param[in] data Data payload for echo request. * @param[in] data_len Length of data payload. */ -void icmpv6_send_echo_request(ipv6_addr_t *destaddr, uint16_t id, +void icmpv6_send_echo_request(ipv6_legacy_addr_t *destaddr, uint16_t id, uint16_t seq, uint8_t *data, size_t data_len); @@ -169,7 +169,7 @@ void icmpv6_send_echo_request(ipv6_addr_t *destaddr, uint16_t id, * @param[in] data Data payload for echo reply. * @param[in] data_len Length of data payload. */ -void icmpv6_send_echo_reply(ipv6_addr_t *destaddr, uint16_t id, +void icmpv6_send_echo_reply(ipv6_legacy_addr_t *destaddr, uint16_t id, uint16_t seq, uint8_t *data, size_t data_len); /** @@ -200,7 +200,7 @@ void icmpv6_send_router_sol(uint8_t sllao); * router option. If *abro* == OPT_ABRO add it, * else not. */ -void icmpv6_send_router_adv(ipv6_addr_t *addr, uint8_t sllao, +void icmpv6_send_router_adv(ipv6_legacy_addr_t *addr, uint8_t sllao, uint8_t mtu, uint8_t pi, uint8_t sixco, uint8_t abro); @@ -217,8 +217,8 @@ void icmpv6_send_router_adv(ipv6_addr_t *addr, uint8_t sllao, * @param[in] aro Flag to include address registration option. If * *aro* == OPT_ARO add it, else not. */ -void icmpv6_send_neighbor_sol(ipv6_addr_t *src, ipv6_addr_t *dest, - ipv6_addr_t *targ, uint8_t slloa, +void icmpv6_send_neighbor_sol(ipv6_legacy_addr_t *src, ipv6_legacy_addr_t *dest, + ipv6_legacy_addr_t *targ, uint8_t slloa, uint8_t aro); /** @@ -235,25 +235,25 @@ void icmpv6_send_neighbor_sol(ipv6_addr_t *src, ipv6_addr_t *dest, * @param[in] aro Flag to include address registration option. If * *aro* == OPT_ARO add it, else not. */ -void icmpv6_send_neighbor_adv(ipv6_addr_t *src, ipv6_addr_t *dst, - ipv6_addr_t *tgt, uint8_t rso, +void icmpv6_send_neighbor_adv(ipv6_legacy_addr_t *src, ipv6_legacy_addr_t *dst, + ipv6_legacy_addr_t *tgt, uint8_t rso, uint8_t sllao, uint8_t aro); /** * @brief Calculates the checksum for ICMPv6 packets. * - * @param[in] ipv6_buf The initialized IPv6 header of the packet. + * @param[in] ipv6_legacy_buf The initialized IPv6 header of the packet. * @param[in] icmpv6_buf The initialized ICMPv6_header of the packet * (except checksum, payload is expected directly * after the packet header in memory). * * @return The internet checksum of the given ICMPv6 packet. */ -uint16_t icmpv6_csum(ipv6_hdr_t *ipv6_buf, icmpv6_hdr_t *icmpv6_buf); +uint16_t icmpv6_csum(ipv6_legacy_hdr_t *ipv6_legacy_buf, icmpv6_hdr_t *icmpv6_buf); #ifdef __cplusplus } #endif -#endif /* SIXLOWPAN_ICMP_H */ +#endif /* SIXLOWPAN_LEGACY_ICMP_H */ /** @} */ diff --git a/sys/net/include/sixlowpan/ip.h b/sys/net/include/sixlowpan_legacy/ip.h similarity index 57% rename from sys/net/include/sixlowpan/ip.h rename to sys/net/include/sixlowpan_legacy/ip.h index bccd75816e4c0..9abe2043b6450 100644 --- a/sys/net/include/sixlowpan/ip.h +++ b/sys/net/include/sixlowpan_legacy/ip.h @@ -7,12 +7,12 @@ */ /** - * @defgroup net_sixlowpan_ip IPv6 - * @ingroup net_sixlowpan + * @defgroup net_sixlowpan_legacy_ip IPv6 + * @ingroup net_sixlowpan_legacy * @brief Internet Protocol version 6 * @{ * - * @file include/sixlowpan/ip.h + * @file include/sixlowpan_legacy/ip.h * @brief 6LoWPAN constants, data structs, and prototypes for network layer * * @author Stephan Zeisberg @@ -21,15 +21,15 @@ * @author Oliver Gesch */ -#ifndef SIXLOWPAN_IP_H -#define SIXLOWPAN_IP_H +#ifndef SIXLOWPAN_LEGACY_IP_H +#define SIXLOWPAN_LEGACY_IP_H #include #include "inet_ntop.h" #include "net_if.h" #include "net_help.h" -#include "sixlowpan/types.h" +#include "sixlowpan_legacy/types.h" #ifdef __cplusplus extern "C" { @@ -38,60 +38,60 @@ extern "C" { /** * @brief IPv6 maximum transmission unit. */ -#define IPV6_MTU (256) +#define IPV6_LEGACY_MTU (256) /** * @brief Length of an IPv6 address in byte. */ -#define IPV6_ADDR_LEN (16) +#define IPV6_LEGACY_ADDR_LEN (16) /** * @brief Length of an IPv6 address in bit. */ -#define IPV6_ADDR_BIT_LEN (128) +#define IPV6_LEGACY_ADDR_BIT_LEN (128) /** * @brief Maximum length of an IPv6 address represented as string. */ -#define IPV6_MAX_ADDR_STR_LEN (40) +#define IPV6_LEGACY_MAX_ADDR_STR_LEN (40) /** * @brief L4 protocol number for TCP. */ -#define IPV6_PROTO_NUM_TCP (6) +#define IPV6_LEGACY_PROTO_NUM_TCP (6) /** * @brief L4 protocol number for UDP. */ -#define IPV6_PROTO_NUM_UDP (17) +#define IPV6_LEGACY_PROTO_NUM_UDP (17) /** * @brief Next header value for source routing * @see */ -#define IPV6_PROTO_NUM_SRH (43) +#define IPV6_LEGACY_PROTO_NUM_SRH (43) /** * @brief L4 protocol number for ICMPv6. */ -#define IPV6_PROTO_NUM_ICMPV6 (58) +#define IPV6_LEGACY_PROTO_NUM_ICMPV6 (58) /** * @brief L4 protocol number for no L4 protocol in IPv6. */ -#define IPV6_PROTO_NUM_NONE (59) +#define IPV6_LEGACY_PROTO_NUM_NONE (59) /** * @brief L4 protocol number for IPv6 destination options. */ -#define IPV6_PROTO_NUM_IPV6_OPTS (60) +#define IPV6_LEGACY_PROTO_NUM_IPV6_LEGACY_OPTS (60) /** * @brief message type for notification * - * @see ipv6_register_packet_handler() + * @see ipv6_legacy_register_packet_handler() */ -#define IPV6_PACKET_RECEIVED (UPPER_LAYER_2) +#define IPV6_LEGACY_PACKET_RECEIVED (UPPER_LAYER_2) /** * @brief Get IPv6 send/receive buffer. @@ -100,7 +100,7 @@ extern "C" { * @note To be deleted in later releases. Here only because it is * used by the rpl module. */ -ipv6_hdr_t *ipv6_get_buf(void); +ipv6_legacy_hdr_t *ipv6_legacy_get_buf(void); /** * @brief Send IPv6 packet to dest. @@ -117,8 +117,8 @@ ipv6_hdr_t *ipv6_get_buf(void); * In case of reactive routing: routing * is going to try to find a route */ -int ipv6_sendto(const ipv6_addr_t *dest, uint8_t next_header, - const uint8_t *payload, uint16_t payload_length, ipv6_addr_t *next_hop); +int ipv6_legacy_sendto(const ipv6_legacy_addr_t *dest, uint8_t next_header, + const uint8_t *payload, uint16_t payload_length, ipv6_legacy_addr_t *next_hop); /** * @brief Send an IPv6 packet defined by its header. @@ -135,28 +135,28 @@ int ipv6_sendto(const ipv6_addr_t *dest, uint8_t next_header, * In case of reactive routing: routing is going * to try to find a route */ -int ipv6_send_packet(ipv6_hdr_t *packet, ipv6_addr_t *next_hop); +int ipv6_legacy_send_packet(ipv6_legacy_hdr_t *packet, ipv6_legacy_addr_t *next_hop); /** * @brief Determines if node is a router. * * @return 1 if node is router, 0 otherwise. */ -uint8_t ipv6_is_router(void); +uint8_t ipv6_legacy_is_router(void); /** * @brief Sets the default hop limit to use with IPv6 packets. * * @param[in] hop_limit The hop limit to set the default hop limit to. */ -void ipv6_set_default_hop_limit(uint8_t hop_limit); +void ipv6_legacy_set_default_hop_limit(uint8_t hop_limit); /** * @brief Gets the default hop limit that is used for IPv6 packets. * * @return The current default hop limit for IPv6 packets. */ -uint8_t ipv6_get_default_hop_limit(void); +uint8_t ipv6_legacy_get_default_hop_limit(void); /** * @brief Registers a handler thread for incoming IP packets. @@ -166,7 +166,7 @@ uint8_t ipv6_get_default_hop_limit(void); * @return 0 on success, ENOMEN if maximum number of registrable * threads is exceeded. */ -uint8_t ipv6_register_packet_handler(kernel_pid_t pid); +uint8_t ipv6_legacy_register_packet_handler(kernel_pid_t pid); /** * @brief Registers a handler thread for L4 protocol. @@ -174,24 +174,24 @@ uint8_t ipv6_register_packet_handler(kernel_pid_t pid); * @param[in] next_header Next header ID of the L4 protocol. * @param[in] pid PID of the handler thread */ -void ipv6_register_next_header_handler(uint8_t next_header, kernel_pid_t pid); +void ipv6_legacy_register_next_header_handler(uint8_t next_header, kernel_pid_t pid); /** * @brief Registers a handler thread for RPL options * * @param[in] pid PID of the handler thread. */ -void ipv6_register_rpl_handler(kernel_pid_t pid); +void ipv6_legacy_register_rpl_handler(kernel_pid_t pid); /** - * @brief Sets the first 64 bit of *ipv6_addr* to link local prefix. + * @brief Sets the first 64 bit of *ipv6_legacy_addr* to link local prefix. * - * @param[in,out] ipv6_addr The address to set. + * @param[in,out] ipv6_legacy_addr The address to set. */ -static inline void ipv6_addr_set_link_local_prefix(ipv6_addr_t *ipv6_addr) +static inline void ipv6_legacy_addr_set_link_local_prefix(ipv6_legacy_addr_t *ipv6_legacy_addr) { - ipv6_addr->uint32[0] = HTONL(0xfe800000); - ipv6_addr->uint32[1] = 0; + ipv6_legacy_addr->uint32[0] = HTONL(0xfe800000); + ipv6_legacy_addr->uint32[1] = 0; } /** @@ -208,7 +208,7 @@ static inline void ipv6_addr_set_link_local_prefix(ipv6_addr_t *ipv6_addr) * @param[in] addr6 The seventh 16 bit of the new address. * @param[in] addr7 The eighth 16 bit of the new address. */ -void ipv6_addr_init(ipv6_addr_t *out, uint16_t addr0, uint16_t addr1, +void ipv6_legacy_addr_init(ipv6_legacy_addr_t *out, uint16_t addr0, uint16_t addr1, uint16_t addr2, uint16_t addr3, uint16_t addr4, uint16_t addr5, uint16_t addr6, uint16_t addr7); @@ -220,13 +220,13 @@ void ipv6_addr_init(ipv6_addr_t *out, uint16_t addr0, uint16_t addr1, * @param[out] out Address to be set. * @param[in] if_id The interface to take the EUI-64 from. * @param[in] prefix 64-bit network prefix to be used for *out* - * (only the first 64 bit of the ipv6_addr_t type + * (only the first 64 bit of the ipv6_legacy_addr_t type * are copied to *out*) * * @return The Address to be set on success, NULL on error. */ -ipv6_addr_t *ipv6_addr_set_by_eui64(ipv6_addr_t *out, int if_id, - const ipv6_addr_t *prefix); +ipv6_legacy_addr_t *ipv6_legacy_addr_set_by_eui64(ipv6_legacy_addr_t *out, int if_id, + const ipv6_legacy_addr_t *prefix); /** * @brief Sets IPv6 address *out* with the first *bits* bit taken @@ -237,104 +237,104 @@ ipv6_addr_t *ipv6_addr_set_by_eui64(ipv6_addr_t *out, int if_id, * @param[in] bits Bits to be copied from *prefix* to *out* * (set to 128 when greater than 128). */ -void ipv6_addr_init_prefix(ipv6_addr_t *out, const ipv6_addr_t *prefix, +void ipv6_legacy_addr_init_prefix(ipv6_legacy_addr_t *out, const ipv6_legacy_addr_t *prefix, uint8_t bits); /** - * @brief Set *ipv6_addr* to the loopback address. + * @brief Set *ipv6_legacy_addr* to the loopback address. * * @see * RFC 4291 * * - * @param[out] ipv6_addr Is set to the loopback address. + * @param[out] ipv6_legacy_addr Is set to the loopback address. */ -static inline void ipv6_addr_set_loopback_addr(ipv6_addr_t *ipv6_addr) +static inline void ipv6_legacy_addr_set_loopback_addr(ipv6_legacy_addr_t *ipv6_legacy_addr) { - ipv6_addr->uint32[0] = 0; - ipv6_addr->uint32[1] = 0; - ipv6_addr->uint32[2] = 0; - ipv6_addr->uint32[3] = HTONL(1); + ipv6_legacy_addr->uint32[0] = 0; + ipv6_legacy_addr->uint32[1] = 0; + ipv6_legacy_addr->uint32[2] = 0; + ipv6_legacy_addr->uint32[3] = HTONL(1); } /** - * @brief Set *ipv6_addr* to a link-local all routers multicast + * @brief Set *ipv6_legacy_addr* to a link-local all routers multicast * address (ff02::/16 prefix). * * @see * RFC 4291 * * - * @param[out] ipv6_addr Is set to a link-local all routers multicast + * @param[out] ipv6_legacy_addr Is set to a link-local all routers multicast * address. */ -static inline void ipv6_addr_set_all_routers_addr(ipv6_addr_t *ipv6_addr) +static inline void ipv6_legacy_addr_set_all_routers_addr(ipv6_legacy_addr_t *ipv6_legacy_addr) { - ipv6_addr->uint32[0] = HTONL(0xff020000); - ipv6_addr->uint32[1] = 0; - ipv6_addr->uint32[2] = 0; - ipv6_addr->uint32[3] = HTONL(2); + ipv6_legacy_addr->uint32[0] = HTONL(0xff020000); + ipv6_legacy_addr->uint32[1] = 0; + ipv6_legacy_addr->uint32[2] = 0; + ipv6_legacy_addr->uint32[3] = HTONL(2); } /** - * @brief Set *ipv6_addr* to a link-local all nodes multicast address + * @brief Set *ipv6_legacy_addr* to a link-local all nodes multicast address * (ff02::/16 prefix). * * @see * RFC 4291 * * - * @param[out] ipv6_addr Is set to a link-local all nodes multicast + * @param[out] ipv6_legacy_addr Is set to a link-local all nodes multicast * address. */ -static inline void ipv6_addr_set_all_nodes_addr(ipv6_addr_t *ipv6_addr) +static inline void ipv6_legacy_addr_set_all_nodes_addr(ipv6_legacy_addr_t *ipv6_legacy_addr) { - ipv6_addr->uint32[0] = HTONL(0xff020000); - ipv6_addr->uint32[1] = 0; - ipv6_addr->uint32[2] = 0; - ipv6_addr->uint32[3] = HTONL(1); + ipv6_legacy_addr->uint32[0] = HTONL(0xff020000); + ipv6_legacy_addr->uint32[1] = 0; + ipv6_legacy_addr->uint32[2] = 0; + ipv6_legacy_addr->uint32[3] = HTONL(1); } /** - * @brief Set *ipv6_addr_out* to the solicited-node multicast address - * computed from *ipv6_addr_in*. + * @brief Set *ipv6_legacy_addr_out* to the solicited-node multicast address + * computed from *ipv6_legacy_addr_in*. * * @see * RFC 4291 * * - * @param[out] ipv6_addr_out Is set to solicited-node address of + * @param[out] ipv6_legacy_addr_out Is set to solicited-node address of * this node. - * @param[in] ipv6_addr_in The IPv6 address the solicited-node + * @param[in] ipv6_legacy_addr_in The IPv6 address the solicited-node * address. */ -static inline void ipv6_addr_set_solicited_node_addr(ipv6_addr_t *ipv6_addr_out, - const ipv6_addr_t *ipv6_addr_in) +static inline void ipv6_legacy_addr_set_solicited_node_addr(ipv6_legacy_addr_t *ipv6_legacy_addr_out, + const ipv6_legacy_addr_t *ipv6_legacy_addr_in) { /* copy only the last 24-bit of the ip-address that is beeing resolved */ - ipv6_addr_out->uint32[0] = HTONL(0xff020000); - ipv6_addr_out->uint32[1] = 0; - ipv6_addr_out->uint32[2] = HTONL(1); - ipv6_addr_out->uint8[12] = 0xff; - ipv6_addr_out->uint8[13] = ipv6_addr_in->uint8[13]; - ipv6_addr_out->uint16[7] = ipv6_addr_in->uint16[7]; + ipv6_legacy_addr_out->uint32[0] = HTONL(0xff020000); + ipv6_legacy_addr_out->uint32[1] = 0; + ipv6_legacy_addr_out->uint32[2] = HTONL(1); + ipv6_legacy_addr_out->uint8[12] = 0xff; + ipv6_legacy_addr_out->uint8[13] = ipv6_legacy_addr_in->uint8[13]; + ipv6_legacy_addr_out->uint16[7] = ipv6_legacy_addr_in->uint16[7]; } /** * @brief Converts IPv6 address into string. * * @param[out] addr_str The IPv6 address as string. Must allocate - * at least IPV6_MAX_ADDR_STR_LEN byte (40 + * at least IPV6_LEGACY_MAX_ADDR_STR_LEN byte (40 * byte). * @param[in] str_len The maximum length available to *addr_str*. - * @param[in] ipv6_addr IPv6 address to be converted. + * @param[in] ipv6_legacy_addr IPv6 address to be converted. * * @return Pointer to addr_str. */ -static inline const char *ipv6_addr_to_str(char *addr_str, uint8_t str_len, - const ipv6_addr_t *ipv6_addr) +static inline const char *ipv6_legacy_addr_to_str(char *addr_str, uint8_t str_len, + const ipv6_legacy_addr_t *ipv6_legacy_addr) { - return inet_ntop(AF_INET6, ipv6_addr, addr_str, (size_t)str_len); + return inet_ntop(AF_INET6, ipv6_legacy_addr, addr_str, (size_t)str_len); } /** @@ -345,7 +345,7 @@ static inline const char *ipv6_addr_to_str(char *addr_str, uint8_t str_len, * * @return 1 if *a* and *b* are equal, 0 otherwise. */ -static inline int ipv6_addr_is_equal(const ipv6_addr_t *a, const ipv6_addr_t *b) +static inline int ipv6_legacy_addr_is_equal(const ipv6_legacy_addr_t *a, const ipv6_legacy_addr_t *b) { return (a->uint32[0] == b->uint32[0]) && (a->uint32[1] == b->uint32[1]) && @@ -354,133 +354,133 @@ static inline int ipv6_addr_is_equal(const ipv6_addr_t *a, const ipv6_addr_t *b) } /** - * @brief Checks if *ipv6_addr* is unspecified (all zero). + * @brief Checks if *ipv6_legacy_addr* is unspecified (all zero). * * @see * RFC 4291 * * - * @param[in] ipv6_addr An IPv6 address. + * @param[in] ipv6_legacy_addr An IPv6 address. * - * @return 1 if *ipv6_addr* is unspecified address, 0 otherwise. + * @return 1 if *ipv6_legacy_addr* is unspecified address, 0 otherwise. */ -static inline int ipv6_addr_is_unspecified(const ipv6_addr_t *ipv6_addr) +static inline int ipv6_legacy_addr_is_unspecified(const ipv6_legacy_addr_t *ipv6_legacy_addr) { - return (ipv6_addr->uint32[0] == 0) && - (ipv6_addr->uint32[1] == 0) && - (ipv6_addr->uint32[2] == 0) && - (ipv6_addr->uint32[3] == 0); + return (ipv6_legacy_addr->uint32[0] == 0) && + (ipv6_legacy_addr->uint32[1] == 0) && + (ipv6_legacy_addr->uint32[2] == 0) && + (ipv6_legacy_addr->uint32[3] == 0); } /** - * @brief Check if *ipv6_addr* is a multicast address. + * @brief Check if *ipv6_legacy_addr* is a multicast address. * * @see * RFC 4291 * * - * @param[in] ipv6_addr An IPv6 address. + * @param[in] ipv6_legacy_addr An IPv6 address. * - * @return 1 if *ipv6_addr* is multicast address, 0 otherwise. + * @return 1 if *ipv6_legacy_addr* is multicast address, 0 otherwise. */ -static inline int ipv6_addr_is_multicast(const ipv6_addr_t *ipv6_addr) +static inline int ipv6_legacy_addr_is_multicast(const ipv6_legacy_addr_t *ipv6_legacy_addr) { - return (ipv6_addr->uint8[0] == 0xff); + return (ipv6_legacy_addr->uint8[0] == 0xff); } /** - * @brief Checks if *ipv6_addr* is a loopback address. + * @brief Checks if *ipv6_legacy_addr* is a loopback address. * * @see * RFC 4291 * * - * @param[in] ipv6_addr An IPv6 address. + * @param[in] ipv6_legacy_addr An IPv6 address. * - * @return 1 if *ipv6_addr* is loopback address, 0 otherwise. + * @return 1 if *ipv6_legacy_addr* is loopback address, 0 otherwise. */ -static inline int ipv6_addr_is_loopback(const ipv6_addr_t *ipv6_addr) +static inline int ipv6_legacy_addr_is_loopback(const ipv6_legacy_addr_t *ipv6_legacy_addr) { - return ipv6_addr->uint32[0] == 0 && - ipv6_addr->uint32[1] == 0 && - ipv6_addr->uint32[2] == 0 && - NTOHL(ipv6_addr->uint32[3]) == 1; + return ipv6_legacy_addr->uint32[0] == 0 && + ipv6_legacy_addr->uint32[1] == 0 && + ipv6_legacy_addr->uint32[2] == 0 && + NTOHL(ipv6_legacy_addr->uint32[3]) == 1; } /** - * @brief Check if *ipv6_addr* is a link-local address. + * @brief Check if *ipv6_legacy_addr* is a link-local address. * * @see * RFC 4291 * * - * @param[in] ipv6_addr An IPv6 address. + * @param[in] ipv6_legacy_addr An IPv6 address. * - * @return 1 if *ipv6_addr* is link-local address, 0 otherwise. + * @return 1 if *ipv6_legacy_addr* is link-local address, 0 otherwise. */ -static inline int ipv6_addr_is_link_local(const ipv6_addr_t *ipv6_addr) +static inline int ipv6_legacy_addr_is_link_local(const ipv6_legacy_addr_t *ipv6_legacy_addr) { - return ((ipv6_addr->uint32[0] == HTONL(0xfe800000)) && - (ipv6_addr->uint32[1] == 0)) || - (ipv6_addr_is_multicast(ipv6_addr) && - (ipv6_addr->uint8[1] & 0x0f) == 2); + return ((ipv6_legacy_addr->uint32[0] == HTONL(0xfe800000)) && + (ipv6_legacy_addr->uint32[1] == 0)) || + (ipv6_legacy_addr_is_multicast(ipv6_legacy_addr) && + (ipv6_legacy_addr->uint8[1] & 0x0f) == 2); } /** - * @brief Check if *ipv6_addr* is unique local unicast address. + * @brief Check if *ipv6_legacy_addr* is unique local unicast address. * * @see * RFC 4193 * * - * @param[in] ipv6_addr An IPv6 address. + * @param[in] ipv6_legacy_addr An IPv6 address. * - * @return 1 if *ipv6_addr* is unique local unicast address, + * @return 1 if *ipv6_legacy_addr* is unique local unicast address, * 0 otherwise. */ -static inline int ipv6_addr_is_unique_local_unicast(const ipv6_addr_t *ipv6_addr) +static inline int ipv6_legacy_addr_is_unique_local_unicast(const ipv6_legacy_addr_t *ipv6_legacy_addr) { - return ((ipv6_addr->uint8[0] == 0xfc) || (ipv6_addr->uint8[0] == 0xfd)); + return ((ipv6_legacy_addr->uint8[0] == 0xfc) || (ipv6_legacy_addr->uint8[0] == 0xfd)); } /** - * @brief Check if *ipv6_addr* is solicited-node multicast address. + * @brief Check if *ipv6_legacy_addr* is solicited-node multicast address. * * @see * RFC 4291 * * - * @param[in] ipv6_addr An IPv6 address. + * @param[in] ipv6_legacy_addr An IPv6 address. * - * @return 1 if *ipv6_addr* is solicited-node multicast address, + * @return 1 if *ipv6_legacy_addr* is solicited-node multicast address, * 0 otherwise. */ -static inline int ipv6_addr_is_solicited_node(const ipv6_addr_t *ipv6_addr) +static inline int ipv6_legacy_addr_is_solicited_node(const ipv6_legacy_addr_t *ipv6_legacy_addr) { - return (ipv6_addr->uint32[0] == HTONL(0xff020000)) && - (ipv6_addr->uint32[1] == 0) && - (ipv6_addr->uint32[2] == HTONL(1)) && - (ipv6_addr->uint8[12] == 0xff); + return (ipv6_legacy_addr->uint32[0] == HTONL(0xff020000)) && + (ipv6_legacy_addr->uint32[1] == 0) && + (ipv6_legacy_addr->uint32[2] == HTONL(1)) && + (ipv6_legacy_addr->uint8[12] == 0xff); } /** * @brief Get pointer to potential EUI-64 bit of the IPv6 address. * - * @param[in] ipv6_addr An IPv6 address of this node. + * @param[in] ipv6_legacy_addr An IPv6 address of this node. * @param[in] prefix_len Length of the prefix. Only multiples of 8 are * possible. * * @return The IID (as EUI-64) of this node. */ -static inline net_if_eui64_t *ipv6_addr_get_iid(const ipv6_addr_t *ipv6_addr, +static inline net_if_eui64_t *ipv6_legacy_addr_get_iid(const ipv6_legacy_addr_t *ipv6_legacy_addr, uint8_t prefix_len) { - return ((net_if_eui64_t *) &ipv6_addr->uint8[prefix_len / 8]); + return ((net_if_eui64_t *) &ipv6_legacy_addr->uint8[prefix_len / 8]); } /* - * TODO to wrap sixlowpan initialisations - * int ipv6_iface_init(transceiver_type_t trans, ..); + * TODO to wrap sixlowpan_legacy initialisations + * int ipv6_legacy_iface_init(transceiver_type_t trans, ..); */ /** @@ -506,7 +506,7 @@ static inline net_if_eui64_t *ipv6_addr_get_iid(const ipv6_addr_t *ipv6_addr, * * @return 1 on success, 0 on failure. */ -int ipv6_net_if_add_addr(int if_id, const ipv6_addr_t *addr, +int ipv6_legacy_net_if_add_addr(int if_id, const ipv6_legacy_addr_t *addr, ndp_addr_state_t state, uint32_t val_ltime, uint32_t pref_ltime, uint8_t is_anycast); @@ -524,7 +524,7 @@ int ipv6_net_if_add_addr(int if_id, const ipv6_addr_t *addr, * @param[in] dest The destination address for a packet we search * the source address for. */ -void ipv6_net_if_get_best_src_addr(ipv6_addr_t *src, const ipv6_addr_t *dest); +void ipv6_legacy_net_if_get_best_src_addr(ipv6_legacy_addr_t *src, const ipv6_legacy_addr_t *dest); /** * @brief Registers a function that decides how to route incomming @@ -538,7 +538,7 @@ void ipv6_net_if_get_best_src_addr(ipv6_addr_t *src, const ipv6_addr_t *dest); * * @param next_hop function that returns the next hop to reach dest */ -void ipv6_iface_set_routing_provider(ipv6_addr_t *(*next_hop)(ipv6_addr_t *dest)); +void ipv6_legacy_iface_set_routing_provider(ipv6_legacy_addr_t *(*next_hop)(ipv6_legacy_addr_t *dest)); /** * @brief Registers a function that decides if a node in a RPL-network is actually the @@ -546,7 +546,7 @@ void ipv6_iface_set_routing_provider(ipv6_addr_t *(*next_hop)(ipv6_addr_t *dest) * Only used in RPL non-storing mode by now. * */ -void ipv6_iface_set_srh_indicator(uint8_t (*srh_indi)(void)); +void ipv6_legacy_iface_set_srh_indicator(uint8_t (*srh_indi)(void)); /** * @brief Calculates the IPv6 upper-layer checksum. @@ -554,18 +554,18 @@ void ipv6_iface_set_srh_indicator(uint8_t (*srh_indi)(void)); * @see * RFC 2460, section 8.1 * - * @param[in] ipv6_header Pointer to the IPv6 header of the packet. + * @param[in] ipv6_legacy_header Pointer to the IPv6 header of the packet. * @param[in] buf Pointer to the upper-layer payload of the IP datagram. * @param[in] len The length of the upper-layer header and data. * @param[in] proto Upper-layer protocol number according to RFC1700. * * @return The IPv6 upper-layer checksum. */ -uint16_t ipv6_csum(ipv6_hdr_t *ipv6_header, uint8_t *buf, uint16_t len, uint8_t proto); +uint16_t ipv6_legacy_csum(ipv6_legacy_hdr_t *ipv6_legacy_header, uint8_t *buf, uint16_t len, uint8_t proto); #ifdef __cplusplus } #endif -#endif /* SIXLOWPAN_IP_H */ +#endif /* SIXLOWPAN_LEGACY_IP_H */ /** @} */ diff --git a/sys/net/include/sixlowpan/lowpan.h b/sys/net/include/sixlowpan_legacy/lowpan.h similarity index 77% rename from sys/net/include/sixlowpan/lowpan.h rename to sys/net/include/sixlowpan_legacy/lowpan.h index 02c5f72689019..f35b9a7da6ab7 100644 --- a/sys/net/include/sixlowpan/lowpan.h +++ b/sys/net/include/sixlowpan_legacy/lowpan.h @@ -7,12 +7,12 @@ */ /** - * @defgroup net_sixlowpan_lowpan 6LoWPAN adaptation layer - * @ingroup net_sixlowpan + * @defgroup net_sixlowpan_legacy_lowpan 6LoWPAN adaptation layer + * @ingroup net_sixlowpan_legacy * @brief IPv6 over LoW Power wireless Area Networks * @{ * - * @file include/sixlowpan/lowpan.h + * @file include/sixlowpan_legacy/lowpan.h * @brief 6LoWPAN LoWPAN layer header * * @author Stephan Zeisberg @@ -21,15 +21,15 @@ * @author Oliver Gesch */ -#ifndef SIXLOWPAN_LOWPAN_H -#define SIXLOWPAN_LOWPAN_H +#ifndef SIXLOWPAN_LEGACY_LOWPAN_H +#define SIXLOWPAN_LEGACY_LOWPAN_H #include #include "transceiver.h" #include "net_help.h" #include "net_if.h" -#include "sixlowpan/types.h" +#include "sixlowpan_legacy/types.h" #ifdef __cplusplus extern "C" { @@ -41,7 +41,7 @@ extern "C" { * RFC 4944, section 5.1 * */ -#define SIXLOWPAN_IPV6_DISPATCH (0x41) +#define SIXLOWPAN_LEGACY_IPV6_LEGACY_DISPATCH (0x41) /** * @brief 6LoWPAN dispatch value for IPv6 header compression (part of @@ -50,7 +50,7 @@ extern "C" { * RFC 4944, section 3.1.1 * */ -#define SIXLOWPAN_IPHC1_DISPATCH (0x60) +#define SIXLOWPAN_LEGACY_IPHC1_DISPATCH (0x60) /** * @brief Flag for Flow Label elision (part of first byte of @@ -59,7 +59,7 @@ extern "C" { * RFC 6282, section 3.1.1 * */ -#define SIXLOWPAN_IPHC1_FL_C (0x10) +#define SIXLOWPAN_LEGACY_IPHC1_FL_C (0x10) /** * @brief Flag for Traffic Class elision (part of first byte of @@ -68,7 +68,7 @@ extern "C" { * RFC 6282, section 3.1.1 * */ -#define SIXLOWPAN_IPHC1_TC_C (0x08) +#define SIXLOWPAN_LEGACY_IPHC1_TC_C (0x08) /** * @brief Flag for Next Header Compression (part of first byte of @@ -77,7 +77,7 @@ extern "C" { * RFC 6282, section 3.1.1 * */ -#define SIXLOWPAN_IPHC1_NH (0x04) +#define SIXLOWPAN_LEGACY_IPHC1_NH (0x04) /** * @brief Flag for Context Identifier Extention (part of second byte @@ -86,7 +86,7 @@ extern "C" { * RFC 6282, section 3.1.1 * */ -#define SIXLOWPAN_IPHC2_CID (0x80) +#define SIXLOWPAN_LEGACY_IPHC2_CID (0x80) /** * @brief Flag for Source Address Compression (part of second byte @@ -95,7 +95,7 @@ extern "C" { * RFC 6282, section 3.1.1 * */ -#define SIXLOWPAN_IPHC2_SAC (0x40) +#define SIXLOWPAN_LEGACY_IPHC2_SAC (0x40) /** * @brief Bits for Source Address Mode (part of second byte of @@ -104,7 +104,7 @@ extern "C" { * RFC 6282, section 3.1.1 * */ -#define SIXLOWPAN_IPHC2_SAM (0x30) +#define SIXLOWPAN_LEGACY_IPHC2_SAM (0x30) /** * @brief Flag for Destination Address Compression (part of second @@ -113,7 +113,7 @@ extern "C" { * RFC 6282, section 3.1.1 * */ -#define SIXLOWPAN_IPHC2_DAC (0x04) +#define SIXLOWPAN_LEGACY_IPHC2_DAC (0x04) /** * @brief Bits for Destination Address Mode (part of second byte of @@ -122,7 +122,7 @@ extern "C" { * RFC 6282, section 3.1.1 * */ -#define SIXLOWPAN_IPHC2_DAM (0x03) +#define SIXLOWPAN_LEGACY_IPHC2_DAM (0x03) /** * @brief Flag for Multicast Compression (part of second byte of @@ -131,7 +131,7 @@ extern "C" { * RFC 6282, section 3.1.1 * */ -#define SIXLOWPAN_IPHC2_M (0x08) +#define SIXLOWPAN_LEGACY_IPHC2_M (0x08) /** @@ -140,7 +140,7 @@ extern "C" { * RFC 4944, section 5.1 * */ -#define SIXLOWPAN_FRAG1_DISPATCH (0xc0) +#define SIXLOWPAN_LEGACY_FRAG1_DISPATCH (0xc0) /** * 6LoWPAN dispatch value for fragmentation header (subsequent fragment) @@ -148,23 +148,23 @@ extern "C" { * RFC 4944, section 5.1 * */ -#define SIXLOWPAN_FRAGN_DISPATCH (0xe0) +#define SIXLOWPAN_LEGACY_FRAGN_DISPATCH (0xe0) /** * 6LoWPAN fragmentation header length (first fragment) */ -#define SIXLOWPAN_FRAG1_HDR_LEN (4) +#define SIXLOWPAN_LEGACY_FRAG1_HDR_LEN (4) /** * 6LoWPAN fragmentation header length (subsequent fragment) */ -#define SIXLOWPAN_FRAGN_HDR_LEN (5) +#define SIXLOWPAN_LEGACY_FRAGN_HDR_LEN (5) /** * @brief message type for notification * - * @see sixlowpan_lowpan_register() + * @see sixlowpan_legacy_lowpan_register() */ #define LOWPAN_FRAME_RECEIVED (UPPER_LAYER_1) @@ -174,7 +174,7 @@ extern "C" { typedef enum __attribute__((packed)) { LOWPAN_IPHC_DISABLE = 0, ///< header compression disabled LOWPAN_IPHC_ENABLE = 1 ///< header compression enabled -} sixlowpan_lowpan_iphc_status_t; +} sixlowpan_legacy_lowpan_iphc_status_t; /** * @brief Data type to represent an 6LoWPAN frame as byte stream. @@ -182,7 +182,7 @@ typedef enum __attribute__((packed)) { typedef struct __attribute__((packed)) { uint8_t length; ///< length of the byte stream. uint8_t *data; ///< the byte stream representing the 6LoWPAN frame. -} sixlowpan_lowpan_frame_t; +} sixlowpan_legacy_lowpan_frame_t; /** @@ -192,7 +192,7 @@ typedef struct __attribute__((packed)) { * * @return 1 on success, 0 on failure. */ -int sixlowpan_lowpan_init_interface(int if_id); +int sixlowpan_legacy_lowpan_init_interface(int if_id); /** * @brief Checks if an EUI-64 was set from a short address. If so @@ -202,7 +202,7 @@ int sixlowpan_lowpan_init_interface(int if_id); * * @return The short address on success, 0 on failure. */ -static inline uint16_t sixlowpan_lowpan_eui64_to_short_addr(const net_if_eui64_t *iid) +static inline uint16_t sixlowpan_legacy_lowpan_eui64_to_short_addr(const net_if_eui64_t *iid) { if (iid->uint32[0] == HTONL(0x000000ff) && iid->uint16[2] == HTONS(0xfe00)) { @@ -215,15 +215,15 @@ static inline uint16_t sixlowpan_lowpan_eui64_to_short_addr(const net_if_eui64_t /** * @brief Initializes all addresses and prefixes on an interface needed * for 6LoWPAN. Calling this function together with - * sixlowpan_lowpan_init_interface() is not necessary. + * sixlowpan_legacy_lowpan_init_interface() is not necessary. * * @param[in] if_id The interface to use with 6LoWPAN. * @param[in] prefix the address prefix to advertise. * * @return 1 on success, 0 on failure. */ -int sixlowpan_lowpan_init_adhoc_interface(int if_id, - const ipv6_addr_t *prefix); +int sixlowpan_legacy_lowpan_init_adhoc_interface(int if_id, + const ipv6_legacy_addr_t *prefix); /** * @brief Initializes a 6LoWPAN border router with an address @@ -235,7 +235,7 @@ int sixlowpan_lowpan_init_adhoc_interface(int if_id, * * @return 1 on success, 0 on failure. */ -int sixlowpan_lowpan_border_init(int if_id); +int sixlowpan_legacy_lowpan_border_init(int if_id); /** * @brief Send data via 6LoWPAN to destination node or next hop dest. @@ -249,7 +249,7 @@ int sixlowpan_lowpan_border_init(int if_id); * * @return length of transmitted data on success, -1 on failure. */ -int sixlowpan_lowpan_sendto(int if_id, const void *dest, int dest_len, +int sixlowpan_legacy_lowpan_sendto(int if_id, const void *dest, int dest_len, uint8_t *data, uint16_t data_len); /** @@ -257,8 +257,8 @@ int sixlowpan_lowpan_sendto(int if_id, const void *dest, int dest_len, * * @param[in] status Header compression status to set to. */ -void sixlowpan_lowpan_set_iphc_status( - sixlowpan_lowpan_iphc_status_t status); +void sixlowpan_legacy_lowpan_set_iphc_status( + sixlowpan_legacy_lowpan_iphc_status_t status); /** * @brief Initialize 6LoWPAN neighbor discovery (i.e. send @@ -271,11 +271,11 @@ void sixlowpan_lowpan_set_iphc_status( * * */ -void sixlowpan_lowpan_bootstrapping(void); +void sixlowpan_legacy_lowpan_bootstrapping(void); /** * @brief Registers a thread to read received 6LoWPAN frames. The - * 6LoWPAN frames are delivered as sixlowpan_lowpan_frame_t + * 6LoWPAN frames are delivered as sixlowpan_legacy_lowpan_frame_t * structs. * * @param[in] pid The PID of the receiver thread. @@ -283,19 +283,19 @@ void sixlowpan_lowpan_bootstrapping(void); * @return 1 on success, ENOMEM if maximum number of registrable * threads is exceeded. */ -uint8_t sixlowpan_lowpan_register(kernel_pid_t pid); +uint8_t sixlowpan_legacy_lowpan_register(kernel_pid_t pid); #if ENABLE_DEBUG /** * @brief Print current buffer of assembled (i. e. not fragmented) * 6LoWPAN packages. */ -void sixlowpan_lowpan_print_fifo_buffers(void); +void sixlowpan_legacy_lowpan_print_fifo_buffers(void); /** * @brief Print current buffer for 6LoWPAN fragmentation reassembly. */ -void sixlowpan_lowpan_print_reassembly_buffers(void); +void sixlowpan_legacy_lowpan_print_reassembly_buffers(void); #endif /** @@ -303,11 +303,11 @@ void sixlowpan_lowpan_print_reassembly_buffers(void); * * @return 1 on success, 0 on failure. */ -int sixlowpan_lowpan_init(void); +int sixlowpan_legacy_lowpan_init(void); #ifdef __cplusplus } #endif -#endif /* SIXLOWPAN_LOWPAN_H */ +#endif /* SIXLOWPAN_LEGACY_LOWPAN_H */ /** @} */ diff --git a/sys/net/include/sixlowpan/mac.h b/sys/net/include/sixlowpan_legacy/mac.h similarity index 83% rename from sys/net/include/sixlowpan/mac.h rename to sys/net/include/sixlowpan_legacy/mac.h index c8f69c05169f2..00e7fb12d31c9 100644 --- a/sys/net/include/sixlowpan/mac.h +++ b/sys/net/include/sixlowpan_legacy/mac.h @@ -7,10 +7,10 @@ */ /** - * @ingroup net_sixlowpan_lowpan + * @ingroup net_sixlowpan_legacy_lowpan * @{ * - * @file sixlowpan/mac.h + * @file sixlowpan_legacy/mac.h * @brief 6LoWPAN data structs, and prototypes for MAC layer * * @author Stephan Zeisberg @@ -19,14 +19,14 @@ * @author Oliver Gesch */ -#ifndef SIXLOWPAN_MAC_H -#define SIXLOWPAN_MAC_H +#ifndef SIXLOWPAN_LEGACY_MAC_H +#define SIXLOWPAN_LEGACY_MAC_H #include #include "transceiver.h" -#include "sixlowpan/types.h" +#include "sixlowpan_legacy/types.h" #ifdef __cplusplus extern "C" { @@ -52,7 +52,7 @@ extern "C" { * * @return Length of transmitted data in byte */ -int sixlowpan_mac_send_ieee802154_frame(int if_id, const void *dest, +int sixlowpan_legacy_mac_send_ieee802154_frame(int if_id, const void *dest, uint8_t dest_len, const void *payload, uint8_t length, uint8_t mcast); /** @@ -60,11 +60,11 @@ int sixlowpan_mac_send_ieee802154_frame(int if_id, const void *dest, * * @return PID of the MAC receiver thread. */ -kernel_pid_t sixlowpan_mac_init(void); +kernel_pid_t sixlowpan_legacy_mac_init(void); #ifdef __cplusplus } #endif /** @} */ -#endif /* SIXLOWPAN_MAC_H */ +#endif /* SIXLOWPAN_LEGACY_MAC_H */ diff --git a/sys/net/include/sixlowpan/ndp.h b/sys/net/include/sixlowpan_legacy/ndp.h similarity index 84% rename from sys/net/include/sixlowpan/ndp.h rename to sys/net/include/sixlowpan_legacy/ndp.h index 1c7e480eecca7..0eb698ee2a15a 100644 --- a/sys/net/include/sixlowpan/ndp.h +++ b/sys/net/include/sixlowpan_legacy/ndp.h @@ -7,12 +7,12 @@ */ /** - * @addtogroup net_sixlowpan_ndp - * @ingroup net_sixlowpan + * @addtogroup net_sixlowpan_legacy_ndp + * @ingroup net_sixlowpan_legacy * @brief Neighbor discovery protocol for 6LoWPAN and IPv6 * @{ * - * @file sixlowpan/ndp.h + * @file sixlowpan_legacy/ndp.h * @brief 6LoWPAN constants, data structs, and prototypes related to NDP * * @author Stephan Zeisberg @@ -21,14 +21,14 @@ * @author Oliver Gesch */ -#ifndef SIXLOWPAN_NDP_H -#define SIXLOWPAN_NDP_H +#ifndef SIXLOWPAN_LEGACY_NDP_H +#define SIXLOWPAN_LEGACY_NDP_H #include #include "net_if.h" #include "timex.h" -#include "sixlowpan/types.h" +#include "sixlowpan_legacy/types.h" #ifdef __cplusplus extern "C" { @@ -87,10 +87,10 @@ typedef struct __attribute__((packed)) ndp_prefix_info_t { struct ndp_prefix_info_t *addr_prev; /** * @brief Flags to define upper layer protocols this address applies to. - * For this layer NET_IF_L3P_IPV6_PREFIX must be set. + * For this layer NET_IF_L3P_IPV6_LEGACY_PREFIX must be set. */ net_if_l3p_t prefix_protocol; - ipv6_addr_t *prefix_data; ///< The Prefix. + ipv6_legacy_addr_t *prefix_data; ///< The Prefix. uint8_t prefix_len; ///< Length of the prefix. uint8_t inuse; ///< Prefix is in in use. /** @@ -109,7 +109,7 @@ typedef struct __attribute__((packed)) ndp_prefix_info_t { * router advertisement. */ typedef struct __attribute__((packed)) { - ipv6_addr_t addr; ///< Address of router. + ipv6_legacy_addr_t addr; ///< Address of router. timex_t inval_time; ///< remaining time until this entry is ///< invalid. } ndp_default_router_list_t; @@ -127,7 +127,7 @@ typedef struct __attribute__((packed)) { ndp_nce_state_t state; ///< State of neighbor cache entry. uint8_t isrouter; ///< Flag to signify that this neighbor ///< is a router. - ipv6_addr_t addr; ///< IPv6 address of the neighbor. + ipv6_legacy_addr_t addr; ///< IPv6 address of the neighbor. uint8_t lladdr[8]; ///< Link-layer address of the neighbor uint8_t lladdr_len; ///< Length of link-layer address of the ///< neighbor @@ -142,12 +142,12 @@ typedef struct __attribute__((packed)) { */ typedef struct __attribute__((packed)) { uint16_t version; ///< version of entry. - ipv6_addr_t abr_addr; ///< Addres of ABR. + ipv6_legacy_addr_t abr_addr; ///< Addres of ABR. uint8_t cids[NDP_6LOWPAN_CONTEXT_MAX]; ///< context IDs. } ndp_a6br_cache_t; -ndp_default_router_list_t *ndp_default_router_list_search(ipv6_addr_t *ipaddr); -uint8_t ndp_neighbor_cache_add(int if_id, const ipv6_addr_t *ipaddr, +ndp_default_router_list_t *ndp_default_router_list_search(ipv6_legacy_addr_t *ipaddr); +uint8_t ndp_neighbor_cache_add(int if_id, const ipv6_legacy_addr_t *ipaddr, const void *lladdr, uint8_t lladdr_len, uint8_t isrouter, ndp_nce_state_t state, ndp_nce_type_t type, uint16_t ltime); @@ -160,11 +160,11 @@ uint8_t ndp_neighbor_cache_add(int if_id, const ipv6_addr_t *ipaddr, * * @return 1 on success, 0 otherwise. */ -uint8_t ndp_neighbor_cache_remove(const ipv6_addr_t *ipaddr); +uint8_t ndp_neighbor_cache_remove(const ipv6_legacy_addr_t *ipaddr); -ndp_neighbor_cache_t *ndp_neighbor_cache_search(ipv6_addr_t *ipaddr); -ndp_neighbor_cache_t *ndp_get_ll_address(ipv6_addr_t *ipaddr); -int ndp_addr_is_on_link(ipv6_addr_t *dest_addr); +ndp_neighbor_cache_t *ndp_neighbor_cache_search(ipv6_legacy_addr_t *ipaddr); +ndp_neighbor_cache_t *ndp_get_ll_address(ipv6_legacy_addr_t *ipaddr); +int ndp_addr_is_on_link(ipv6_legacy_addr_t *dest_addr); /** * @brief Adds a prefix information to an interface. If it already exists, @@ -195,7 +195,7 @@ int ndp_addr_is_on_link(ipv6_addr_t *dest_addr); * ICMPV6_NDP_OPT_PI_FLAG_ON_LINK and * ICMPV6_NDP_OPT_PI_FLAG_AUTONOM */ -int ndp_add_prefix_info(int if_id, const ipv6_addr_t *prefix, +int ndp_add_prefix_info(int if_id, const ipv6_legacy_addr_t *prefix, uint8_t prefix_len, uint32_t valid_lifetime, uint32_t preferred_lifetime, uint8_t advertisable, uint8_t flags); @@ -207,13 +207,13 @@ int ndp_add_prefix_info(int if_id, const ipv6_addr_t *prefix, * @param[in] if_id The interface's ID. * @param[in] addr The address to search the prefix for. * @param[in] up_to The number of bits up to which point the search should - * go. Set to IPV6_ADDR_BIT_LEN for the whole address. - * Values greater then IPV6_ADDR_BIT_LEN are set to - * IPV6_ADDR_BIT_LEN. + * go. Set to IPV6_LEGACY_ADDR_BIT_LEN for the whole address. + * Values greater then IPV6_LEGACY_ADDR_BIT_LEN are set to + * IPV6_LEGACY_ADDR_BIT_LEN. * * @return The found prefix information, NULL when none is found. */ -ndp_prefix_info_t *ndp_prefix_info_search(int if_id, const ipv6_addr_t *addr, +ndp_prefix_info_t *ndp_prefix_info_search(int if_id, const ipv6_legacy_addr_t *addr, uint8_t up_to); /** @@ -226,7 +226,7 @@ ndp_prefix_info_t *ndp_prefix_info_search(int if_id, const ipv6_addr_t *addr, * * @return The found prefix information, NULL when none is found. */ -ndp_prefix_info_t *ndp_prefix_info_match(int if_id, const ipv6_addr_t *prefix, +ndp_prefix_info_t *ndp_prefix_info_match(int if_id, const ipv6_legacy_addr_t *prefix, uint8_t prefix_len); ndp_a6br_cache_t *ndp_a6br_cache_get_most_current(void); ndp_a6br_cache_t *ndp_a6br_cache_get_oldest(void); @@ -236,4 +236,4 @@ ndp_a6br_cache_t *ndp_a6br_cache_get_oldest(void); #endif /** @} */ -#endif /* SIXLOWPAN_NDP_H */ +#endif /* SIXLOWPAN_LEGACY_NDP_H */ diff --git a/sys/net/include/sixlowpan/types.h b/sys/net/include/sixlowpan_legacy/types.h similarity index 94% rename from sys/net/include/sixlowpan/types.h rename to sys/net/include/sixlowpan_legacy/types.h index 0ade7ef5882f0..b7d08a01479e5 100644 --- a/sys/net/include/sixlowpan/types.h +++ b/sys/net/include/sixlowpan_legacy/types.h @@ -7,12 +7,12 @@ */ /** - * @defgroup net_sixlowpan_types Type definitions and data structs for 6LoWPAN and IPv6 - * @ingroup net_sixlowpan + * @defgroup net_sixlowpan_legacy_types Type definitions and data structs for 6LoWPAN and IPv6 + * @ingroup net_sixlowpan_legacy * @brief Structs, constants, and enums for 6LoWPAN and IPv6 related functions * @{ * - * @file sixlowpan/types.h + * @file sixlowpan_legacy/types.h * @brief 6LoWPAN data types * * @author Stephan Zeisberg @@ -21,8 +21,8 @@ * @author Oliver Gesch */ -#ifndef SIXLOWPAN_TYPES_H -#define SIXLOWPAN_TYPES_H +#ifndef SIXLOWPAN_LEGACY_TYPES_H +#define SIXLOWPAN_LEGACY_TYPES_H #include @@ -53,7 +53,7 @@ typedef union __attribute__((packed)) { uint8_t uint8[16]; ///< devided by 16 8-bit words. uint16_t uint16[8]; ///< devided by 8 16-bit words. uint32_t uint32[4]; ///< devided by 4 32-bit words. -} ipv6_addr_t; +} ipv6_legacy_addr_t; /** * @brief Data type to represent an IPv6 packet header @@ -70,9 +70,9 @@ typedef struct __attribute__((packed)) { uint16_t length; ///< payload length of this packet. uint8_t nextheader; ///< type of next header in this packet. uint8_t hoplimit; ///< hop limit for this packet. - ipv6_addr_t srcaddr; ///< source address of this packet. - ipv6_addr_t destaddr; ///< destination address of this packet. -} ipv6_hdr_t; + ipv6_legacy_addr_t srcaddr; ///< source address of this packet. + ipv6_legacy_addr_t destaddr; ///< destination address of this packet. +} ipv6_legacy_hdr_t; /** * @brief Data type to represent an IPv6 source routing header for RPL @@ -88,8 +88,8 @@ typedef struct __attribute__((packed)) { unsigned pad :4; /**< number of octets used for padding after adresses. */ unsigned reserved :10; /**< reserved. Set to 0. */ unsigned reserved2 :10; /**< reserved. Set to 0. */ - ipv6_addr_t route[]; -} ipv6_srh_t; + ipv6_legacy_addr_t route[]; +} ipv6_legacy_srh_t; /** * @brief Data type to represent an ICMPv6 packet header. @@ -193,7 +193,7 @@ typedef struct __attribute__((packed)) { */ typedef struct __attribute__((packed)) { uint32_t reserved; ///< reserved field. - ipv6_addr_t target_addr; ///< target address field. + ipv6_legacy_addr_t target_addr; ///< target address field. } icmpv6_neighbor_sol_hdr_t; /** @@ -210,7 +210,7 @@ typedef struct __attribute__((packed)) { typedef struct __attribute__((packed)) { uint8_t rso; ///< flags + first 5 bits of reserved field. uint8_t reserved[3]; ///< rest of reserved field. - ipv6_addr_t target_addr; ///< target address field. + ipv6_legacy_addr_t target_addr; ///< target address field. } icmpv6_neighbor_adv_hdr_t; /** @@ -283,7 +283,7 @@ typedef struct __attribute__((packed)) { uint32_t val_ltime; ///< valid lifetime field. uint32_t pref_ltime; ///< preferred lifetime field. uint32_t reserved2; ///< reserved2 field. - ipv6_addr_t addr; ///< prefix field. + ipv6_legacy_addr_t addr; ///< prefix field. } icmpv6_ndp_opt_pi_t; /** @@ -386,7 +386,7 @@ typedef struct __attribute__((packed)) { uint8_t length; ///< length field. uint16_t version; ///< version field. uint32_t reserved; ///< reseverd field. - ipv6_addr_t addr; ///< 6LBR address field. + ipv6_legacy_addr_t addr; ///< 6LBR address field. } icmpv6_ndp_opt_abro_t; /** @@ -405,4 +405,4 @@ typedef enum __attribute__((packed)) { #endif /** @} */ -#endif /* SIXLOWPAN_TYPES_H */ +#endif /* SIXLOWPAN_LEGACY_TYPES_H */ diff --git a/sys/net/include/socket_base/in.h b/sys/net/include/socket_base/in.h index 64b3603023af2..9093f02d6f3e9 100644 --- a/sys/net/include/socket_base/in.h +++ b/sys/net/include/socket_base/in.h @@ -35,7 +35,7 @@ extern "C" { /* * Protocols (RFC 1700) TODO: may be deleted due to some double definition - * in sys/net/sixlowpan/include/sixlowpan/ip.h + * in sys/net/sixlowpan_legacy/include/sixlowpan_legacy/ip.h */ #define IPPROTO_IP (0) ///< dummy for IP #define IPPROTO_HOPOPTS (0) ///< IP6 hop-by-hop options @@ -79,7 +79,7 @@ extern "C" { #define IPPROTO_CMTP (38) ///< Control Message Transport #define IPPROTO_TPXX (39) ///< TP++ Transport #define IPPROTO_IL (40) ///< IL transport protocol -#define IPPROTO_IPV6 (41) ///< IP6 header +#define IPPROTO_IPV6_LEGACY (41) ///< IP6 header #define IPPROTO_SDRP (42) ///< Source Demand Routing #define IPPROTO_ROUTING (43) ///< IP6 routing header #define IPPROTO_FRAGMENT (44) ///< IP6 fragmentation header diff --git a/sys/net/include/socket_base/socket.h b/sys/net/include/socket_base/socket.h index 850a977123d37..825c333b06f7b 100644 --- a/sys/net/include/socket_base/socket.h +++ b/sys/net/include/socket_base/socket.h @@ -24,7 +24,7 @@ #include -#include "ipv6.h" +#include "ipv6_legacy.h" #include "socket_base/in.h" @@ -182,7 +182,7 @@ typedef struct __attribute__((packed)) { uint8_t sin6_family; ///< set to AF_INET6 uint16_t sin6_port; ///< transport layer port number uint32_t sin6_flowinfo; ///< IPv6 flow information - ipv6_addr_t sin6_addr; ///< IPv6 address + ipv6_legacy_addr_t sin6_addr; ///< IPv6 address } sockaddr6_t; /** diff --git a/sys/net/link_layer/ieee802154/ieee802154_frame.c b/sys/net/link_layer/ieee802154/ieee802154_frame.c index 47d270476912b..b1f297fce81dc 100644 --- a/sys/net/link_layer/ieee802154/ieee802154_frame.c +++ b/sys/net/link_layer/ieee802154/ieee802154_frame.c @@ -7,7 +7,7 @@ * General Public License v2.1. See the file LICENSE in the top level * directory for more details. * - * @ingroup sixlowpan + * @ingroup sixlowpan_legacy * @{ * @file ieee802154_frame.c * @brief IEEE 802.14.4 framing operations diff --git a/sys/net/network_layer/sixlowpan/Makefile b/sys/net/network_layer/sixlowpan_legacy/Makefile similarity index 100% rename from sys/net/network_layer/sixlowpan/Makefile rename to sys/net/network_layer/sixlowpan_legacy/Makefile diff --git a/sys/net/network_layer/sixlowpan/border/border.c b/sys/net/network_layer/sixlowpan_legacy/border/border.c similarity index 82% rename from sys/net/network_layer/sixlowpan/border/border.c rename to sys/net/network_layer/sixlowpan_legacy/border/border.c index b53c456becaef..8931e9f43792b 100644 --- a/sys/net/network_layer/sixlowpan/border/border.c +++ b/sys/net/network_layer/sixlowpan_legacy/border/border.c @@ -7,7 +7,7 @@ * General Public License v2.1. See the file LICENSE in the top level * directory for more details. * - * @ingroup sixlowpan + * @ingroup sixlowpan_legacy * @{ * @file sixlowborder.c * @brief constraint node implementation for a 6lowpan border router @@ -28,7 +28,7 @@ #include "board_uart0.h" #include "ieee802154_frame.h" -#include "sixlowpan/error.h" +#include "sixlowpan_legacy/error.h" #include "bordermultiplex.h" #include "flowcontrol.h" #include "border.h" @@ -49,7 +49,7 @@ kernel_pid_t serial_reader_pid = KERNEL_PID_UNDEF; uint8_t serial_out_buf[BORDER_BUFFER_SIZE]; uint8_t serial_in_buf[BORDER_BUFFER_SIZE]; -ipv6_addr_t *abr_addr; +ipv6_legacy_addr_t *abr_addr; uint8_t *get_serial_out_buffer(int offset) { @@ -123,9 +123,9 @@ void serial_reader_f(void) } } -int sixlowpan_lowpan_border_init(int if_id) +int sixlowpan_legacy_lowpan_border_init(int if_id) { - ipv6_net_if_addr_t *addr = NULL; + ipv6_legacy_net_if_addr_t *addr = NULL; uint8_t abr_addr_initialized = 0; serial_reader_pid = thread_create( @@ -141,15 +141,15 @@ int sixlowpan_lowpan_border_init(int if_id) return 0; } - if (!sixlowpan_lowpan_init_interface(if_id)) { + if (!sixlowpan_legacy_lowpan_init_interface(if_id)) { return 0; } while (net_if_iter_addresses(if_id, (net_if_addr_t **) &addr)) { - if (!ipv6_addr_is_multicast(addr->addr_data) && - !ipv6_addr_is_link_local(addr->addr_data) && - !ipv6_addr_is_loopback(addr->addr_data) && - !ipv6_addr_is_unique_local_unicast(addr->addr_data)) { + if (!ipv6_legacy_addr_is_multicast(addr->addr_data) && + !ipv6_legacy_addr_is_link_local(addr->addr_data) && + !ipv6_legacy_addr_is_loopback(addr->addr_data) && + !ipv6_legacy_addr_is_unique_local_unicast(addr->addr_data)) { abr_addr_initialized = 1; abr_addr = addr->addr_data; break; @@ -157,12 +157,12 @@ int sixlowpan_lowpan_border_init(int if_id) } if (!abr_addr_initialized) { - DEBUG("sixlowpan_lowpan_border_init(): A prefix must be initialized to" + DEBUG("sixlowpan_legacy_lowpan_border_init(): A prefix must be initialized to" "interface %d first", if_id); return 0; } - ipv6_init_as_router(); + ipv6_legacy_init_as_router(); return 1; } @@ -173,10 +173,10 @@ void border_process_lowpan(void) while (1) { msg_receive(&m); - ipv6_hdr_t *ipv6_buf = (ipv6_hdr_t *)m.content.ptr; + ipv6_legacy_hdr_t *ipv6_legacy_buf = (ipv6_legacy_hdr_t *)m.content.ptr; - if (ipv6_buf->nextheader == IPV6_PROTO_NUM_ICMPV6) { - icmpv6_hdr_t *icmp_buf = (icmpv6_hdr_t *)(((uint8_t *)ipv6_buf) + IPV6_HDR_LEN); + if (ipv6_legacy_buf->nextheader == IPV6_LEGACY_PROTO_NUM_ICMPV6) { + icmpv6_hdr_t *icmp_buf = (icmpv6_hdr_t *)(((uint8_t *)ipv6_legacy_buf) + IPV6_LEGACY_HDR_LEN); if (icmp_buf->type == ICMPV6_TYPE_REDIRECT) { continue; @@ -190,6 +190,6 @@ void border_process_lowpan(void) } /* TODO: Bei ICMPv6-Paketen entsprechende LoWPAN-Optionen verarbeiten und entfernen */ - multiplex_send_ipv6_over_uart(ipv6_buf); + multiplex_send_ipv6_legacy_over_uart(ipv6_legacy_buf); } } diff --git a/sys/net/network_layer/sixlowpan/border/border.h b/sys/net/network_layer/sixlowpan_legacy/border/border.h similarity index 82% rename from sys/net/network_layer/sixlowpan/border/border.h rename to sys/net/network_layer/sixlowpan_legacy/border/border.h index 78bc598d72d7d..47e7086615dfe 100644 --- a/sys/net/network_layer/sixlowpan/border/border.h +++ b/sys/net/network_layer/sixlowpan_legacy/border/border.h @@ -7,7 +7,7 @@ * General Public License v2.1. See the file LICENSE in the top level * directory for more details. * - * @ingroup sixlowpan + * @ingroup sixlowpan_legacy * @{ * @file sixlowborder.h * @brief header for 6lowpan border router @@ -18,8 +18,8 @@ /* 6LoWPAN Border Router header file */ -#ifndef _SIXLOWPAN_BORDER_H -#define _SIXLOWPAN_BORDER_H +#ifndef _SIXLOWPAN_LEGACY_BORDER_H +#define _SIXLOWPAN_LEGACY_BORDER_H #include @@ -33,7 +33,7 @@ extern "C" { #endif -extern ipv6_addr_t *abr_addr; +extern ipv6_legacy_addr_t *abr_addr; kernel_pid_t border_get_serial_reader(void); @@ -46,4 +46,4 @@ void border_process_lowpan(void); } #endif -#endif /* _SIXLOWPAN_BORDER_H*/ +#endif /* _SIXLOWPAN_LEGACY_BORDER_H*/ diff --git a/sys/net/network_layer/sixlowpan/border/bordermultiplex.c b/sys/net/network_layer/sixlowpan_legacy/border/bordermultiplex.c similarity index 87% rename from sys/net/network_layer/sixlowpan/border/bordermultiplex.c rename to sys/net/network_layer/sixlowpan_legacy/border/bordermultiplex.c index f607fc84d2e93..002373e1658f8 100644 --- a/sys/net/network_layer/sixlowpan/border/bordermultiplex.c +++ b/sys/net/network_layer/sixlowpan_legacy/border/bordermultiplex.c @@ -7,7 +7,7 @@ * General Public License v2.1. See the file LICENSE in the top level * directory for more details. * - * @ingroup sixlowpan + * @ingroup sixlowpan_legacy * @{ * @file bordermultiplex.c * @brief multiplexiing border router information @@ -20,7 +20,7 @@ #include #include "board_uart0.h" -#include "sixlowpan/error.h" +#include "sixlowpan_legacy/error.h" #include "flowcontrol.h" #include "lowpan.h" @@ -46,9 +46,9 @@ void demultiplex(border_packet_t *packet) border_l3_header_t *l3_header_buf = (border_l3_header_t *)packet; switch (l3_header_buf->ethertype) { - case (BORDER_ETHERTYPE_IPV6): { - ipv6_hdr_t *ipv6_buf = (ipv6_hdr_t *)(((unsigned char *)packet) + sizeof(border_l3_header_t)); - ipv6_send_packet(ipv6_buf, NULL); + case (BORDER_ETHERTYPE_IPV6_LEGACY): { + ipv6_legacy_hdr_t *ipv6_legacy_buf = (ipv6_legacy_hdr_t *)(((unsigned char *)packet) + sizeof(border_l3_header_t)); + ipv6_legacy_send_packet(ipv6_legacy_buf, NULL); break; } @@ -66,8 +66,8 @@ void demultiplex(border_packet_t *packet) switch (conf_header_buf->conftype) { case (BORDER_CONF_CONTEXT): { border_context_packet_t *context = (border_context_packet_t *)packet; - ipv6_addr_t target_addr; - ipv6_addr_set_all_nodes_addr(&target_addr); + ipv6_legacy_addr_t target_addr; + ipv6_legacy_addr_set_all_nodes_addr(&target_addr); mutex_lock(&lowpan_context_mutex); lowpan_context_update( context->context.cid, @@ -102,20 +102,20 @@ void demultiplex(border_packet_t *packet) } } -void multiplex_send_ipv6_over_uart(ipv6_hdr_t *packet) +void multiplex_send_ipv6_legacy_over_uart(ipv6_legacy_hdr_t *packet) { border_l3_header_t *serial_buf; serial_buf = (border_l3_header_t *)get_serial_out_buffer(0); serial_buf->empty = 0; serial_buf->type = BORDER_PACKET_L3_TYPE; - serial_buf->ethertype = BORDER_ETHERTYPE_IPV6; - memcpy(get_serial_in_buffer(0) + sizeof(border_l3_header_t), packet, IPV6_HDR_LEN + packet->length); + serial_buf->ethertype = BORDER_ETHERTYPE_IPV6_LEGACY; + memcpy(get_serial_in_buffer(0) + sizeof(border_l3_header_t), packet, IPV6_LEGACY_HDR_LEN + packet->length); flowcontrol_send_over_uart((border_packet_t *) serial_buf, sizeof(border_l3_header_t)); } -void multiplex_send_addr_over_uart(ipv6_addr_t *addr) +void multiplex_send_addr_over_uart(ipv6_legacy_addr_t *addr) { border_addr_packet_t *serial_buf; @@ -123,7 +123,7 @@ void multiplex_send_addr_over_uart(ipv6_addr_t *addr) serial_buf->empty = 0; serial_buf->type = BORDER_PACKET_CONF_TYPE; serial_buf->conftype = BORDER_CONF_IPADDR; - memcpy(&serial_buf->addr, addr, sizeof(ipv6_addr_t)); + memcpy(&serial_buf->addr, addr, sizeof(ipv6_legacy_addr_t)); flowcontrol_send_over_uart((border_packet_t *) serial_buf, sizeof(border_addr_packet_t)); } diff --git a/sys/net/network_layer/sixlowpan/border/bordermultiplex.h b/sys/net/network_layer/sixlowpan_legacy/border/bordermultiplex.h similarity index 79% rename from sys/net/network_layer/sixlowpan/border/bordermultiplex.h rename to sys/net/network_layer/sixlowpan_legacy/border/bordermultiplex.h index db451d14be3c5..7bc3a71213447 100644 --- a/sys/net/network_layer/sixlowpan/border/bordermultiplex.h +++ b/sys/net/network_layer/sixlowpan_legacy/border/bordermultiplex.h @@ -7,7 +7,7 @@ * General Public License v2.1. See the file LICENSE in the top level * directory for more details. * - * @ingroup sixlowpan + * @ingroup sixlowpan_legacy * @{ * @file bordermultiplex.h * @brief data structs for border router multiplexing @@ -16,8 +16,8 @@ * @} */ -#ifndef _SIXLOWPAN_BORDERMULTIPLEX_H -#define _SIXLOWPAN_BORDERMULTIPLEX_H +#ifndef _SIXLOWPAN_LEGACY_BORDERMULTIPLEX_H +#define _SIXLOWPAN_LEGACY_BORDERMULTIPLEX_H #include #include @@ -38,7 +38,7 @@ extern "C" { #define BORDER_CONF_IPADDR (3) /* ethertypes for L3 packets */ -#define BORDER_ETHERTYPE_IPV6 (0x86DD) +#define BORDER_ETHERTYPE_IPV6_LEGACY (0x86DD) typedef struct __attribute__((packed)) { uint8_t empty; @@ -66,7 +66,7 @@ typedef struct __attribute__((packed)) { uint8_t seq_num; uint8_t conftype; uint16_t version; - ipv6_addr_t addr; + ipv6_legacy_addr_t addr; } border_addr_packet_t; typedef struct __attribute__((packed)) { @@ -77,18 +77,18 @@ typedef struct __attribute__((packed)) { struct border_context_t { uint16_t version; uint8_t cid; - ipv6_addr_t prefix; + ipv6_legacy_addr_t prefix; uint8_t length; uint8_t comp; uint16_t lifetime; } context; } border_context_packet_t; -#define BORDER_BUFFER_SIZE (sizeof(border_l3_header_t) + IPV6_MTU) +#define BORDER_BUFFER_SIZE (sizeof(border_l3_header_t) + IPV6_LEGACY_MTU) void demultiplex(border_packet_t *packet); -void multiplex_send_ipv6_over_uart(ipv6_hdr_t *packet); -void multiplex_send_addr_over_uart(ipv6_addr_t *addr); +void multiplex_send_ipv6_legacy_over_uart(ipv6_legacy_hdr_t *packet); +void multiplex_send_addr_over_uart(ipv6_legacy_addr_t *addr); int readpacket(uint8_t *packet_buf, size_t size); int writepacket(uint8_t *packet_buf, size_t size); @@ -97,4 +97,4 @@ int writepacket(uint8_t *packet_buf, size_t size); } #endif -#endif /* _SIXLOWPAN_BORDERMULTIPLEX_H*/ +#endif /* _SIXLOWPAN_LEGACY_BORDERMULTIPLEX_H*/ diff --git a/sys/net/network_layer/sixlowpan/border/flowcontrol.c b/sys/net/network_layer/sixlowpan_legacy/border/flowcontrol.c similarity index 96% rename from sys/net/network_layer/sixlowpan/border/flowcontrol.c rename to sys/net/network_layer/sixlowpan_legacy/border/flowcontrol.c index 19240a86d2282..d8691638ca6aa 100644 --- a/sys/net/network_layer/sixlowpan/border/flowcontrol.c +++ b/sys/net/network_layer/sixlowpan_legacy/border/flowcontrol.c @@ -7,7 +7,7 @@ * General Public License v2.1. See the file LICENSE in the top level * directory for more details. * - * @ingroup sixlowpan + * @ingroup sixlowpan_legacy * @{ * @file flowcontrol.c * @brief flowcontrol for constraint node border router implementation @@ -38,7 +38,7 @@ flowcontrol_stat_t slwin_stat; sem_t connection_established; int16_t synack_seqnum = -1; -ipv6_addr_t init_threeway_handshake(void) +ipv6_legacy_addr_t init_threeway_handshake(void) { border_syn_packet_t *syn; msg_t m; @@ -48,8 +48,8 @@ ipv6_addr_t init_threeway_handshake(void) syn = (border_syn_packet_t *)m.content.ptr; border_conf_header_t *synack = (border_conf_header_t *)get_serial_out_buffer(0); - ipv6_addr_t addr; - memcpy(&addr, &(syn->addr), sizeof(ipv6_addr_t)); + ipv6_legacy_addr_t addr; + memcpy(&addr, &(syn->addr), sizeof(ipv6_legacy_addr_t)); slwin_stat.next_exp = syn->next_seq_num; slwin_stat.last_frame = syn->next_exp - 1; @@ -67,7 +67,7 @@ ipv6_addr_t init_threeway_handshake(void) return addr; } -ipv6_addr_t flowcontrol_init(void) +ipv6_legacy_addr_t flowcontrol_init(void) { int i; diff --git a/sys/net/network_layer/sixlowpan/border/flowcontrol.h b/sys/net/network_layer/sixlowpan_legacy/border/flowcontrol.h similarity index 89% rename from sys/net/network_layer/sixlowpan/border/flowcontrol.h rename to sys/net/network_layer/sixlowpan_legacy/border/flowcontrol.h index c6e21facb2a77..042545468594b 100644 --- a/sys/net/network_layer/sixlowpan/border/flowcontrol.h +++ b/sys/net/network_layer/sixlowpan_legacy/border/flowcontrol.h @@ -7,7 +7,7 @@ * General Public License v2.1. See the file LICENSE in the top level * directory for more details. * - * @ingroup sixlowpan + * @ingroup sixlowpan_legacy * @{ * @file flowcontrol.h * @brief data structs for border router flowcontrol @@ -16,8 +16,8 @@ * @} */ -#ifndef _SIXLOWPAN_FLOWCONTROL_H -#define _SIXLOWPAN_FLOWCONTROL_H +#ifndef _SIXLOWPAN_LEGACY_FLOWCONTROL_H +#define _SIXLOWPAN_LEGACY_FLOWCONTROL_H #include @@ -71,10 +71,10 @@ typedef struct __attribute__((packed)) { uint8_t next_seq_num; uint8_t conftype; uint8_t next_exp; - ipv6_addr_t addr; + ipv6_legacy_addr_t addr; } border_syn_packet_t; -ipv6_addr_t flowcontrol_init(void); +ipv6_legacy_addr_t flowcontrol_init(void); void flowcontrol_send_over_uart(border_packet_t *packet, int len); void flowcontrol_deliver_from_uart(border_packet_t *packet, int len); @@ -82,4 +82,4 @@ void flowcontrol_deliver_from_uart(border_packet_t *packet, int len); } #endif -#endif /* _SIXLOWPAN_FLOWCONTROL_H*/ +#endif /* _SIXLOWPAN_LEGACY_FLOWCONTROL_H*/ diff --git a/sys/net/network_layer/sixlowpan/icmp.c b/sys/net/network_layer/sixlowpan_legacy/icmp.c similarity index 74% rename from sys/net/network_layer/sixlowpan/icmp.c rename to sys/net/network_layer/sixlowpan_legacy/icmp.c index 77b5965c82a1b..7c997df2dc8a3 100644 --- a/sys/net/network_layer/sixlowpan/icmp.c +++ b/sys/net/network_layer/sixlowpan_legacy/icmp.c @@ -7,7 +7,7 @@ * General Public License v2.1. See the file LICENSE in the top level * directory for more details. * - * @ingroup sixlowpan + * @ingroup sixlowpan_legacy * @{ * @file sixlownd.c * @brief 6lowpan neighbor discovery functions @@ -25,7 +25,7 @@ #include "vtimer.h" #include "mutex.h" #include "net_if.h" -#include "sixlowpan/error.h" +#include "sixlowpan_legacy/error.h" #include "ip.h" #include "icmp.h" @@ -38,7 +38,7 @@ #endif #include "debug.h" -#define LLHDR_ICMPV6HDR_LEN (LL_HDR_LEN + IPV6_HDR_LEN + ICMPV6_HDR_LEN) +#define LLHDR_ICMPV6HDR_LEN (LL_HDR_LEN + IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN) #define ND_HOPLIMIT (0xFF) /* parameter problem [rfc4443] */ @@ -97,7 +97,7 @@ #define PREFIX_BUF_LEN (NET_IF_MAX * OPT_PI_LIST_LEN) /* extern variables */ -uint8_t ipv6_ext_hdr_len = 0; +uint8_t ipv6_legacy_ext_hdr_len = 0; /* counter */ uint8_t abr_count = 0; @@ -112,12 +112,12 @@ ndp_a6br_cache_t abr_cache[ABR_CACHE_SIZE]; ndp_neighbor_cache_t nbr_cache[NBR_CACHE_SIZE]; ndp_default_router_list_t def_rtr_lst[DEF_RTR_LST_SIZE]; ndp_prefix_info_t prefix_info_buf[PREFIX_BUF_LEN]; -uint8_t prefix_buf[sizeof(ipv6_addr_t) * PREFIX_BUF_LEN]; +uint8_t prefix_buf[sizeof(ipv6_legacy_addr_t) * PREFIX_BUF_LEN]; /* pointer */ static uint8_t *llao; -static ipv6_hdr_t *ipv6_buf; +static ipv6_legacy_hdr_t *ipv6_legacy_buf; static icmpv6_hdr_t *icmp_buf; static icmpv6_router_adv_hdr_t *rtr_adv_buf; static icmpv6_neighbor_sol_hdr_t *nbr_sol_buf; @@ -135,7 +135,7 @@ ndp_neighbor_cache_t *nbr_entry; ndp_default_router_list_t *def_rtr_entry; /* elements */ -//ipv6_addr_t tmpaddr; +//ipv6_legacy_addr_t tmpaddr; uint8_t recvd_cids[NDP_6LOWPAN_CONTEXT_MAX]; uint8_t icmpv6_opt_hdr_len = 0; @@ -143,7 +143,7 @@ uint8_t recvd_cids_len = 0; ndp_prefix_info_t *recvd_prefixes[PREFIX_BUF_LEN]; uint8_t recvd_pref_len = 0; -void def_rtr_lst_add(ipv6_addr_t *ipaddr, uint32_t rtr_ltime); +void def_rtr_lst_add(ipv6_legacy_addr_t *ipaddr, uint32_t rtr_ltime); void def_rtr_lst_rem(ndp_default_router_list_t *entry); /** @@ -238,82 +238,82 @@ static icmpv6_ndp_opt_aro_t *get_opt_aro_buf(uint8_t ext_len, uint8_t opt_len) return ((icmpv6_ndp_opt_aro_t *) &buffer[LLHDR_ICMPV6HDR_LEN + ext_len + opt_len]); } -void icmpv6_send_echo_request(ipv6_addr_t *destaddr, uint16_t id, uint16_t seq, uint8_t *data, size_t data_len) +void icmpv6_send_echo_request(ipv6_legacy_addr_t *destaddr, uint16_t id, uint16_t seq, uint8_t *data, size_t data_len) { uint16_t packet_length; - ipv6_buf = ipv6_get_buf(); - icmp_buf = get_icmpv6_buf(ipv6_ext_hdr_len); - icmpv6_echo_request_hdr_t *echo_buf = get_echo_req_buf(ipv6_ext_hdr_len); + ipv6_legacy_buf = ipv6_legacy_get_buf(); + icmp_buf = get_icmpv6_buf(ipv6_legacy_ext_hdr_len); + icmpv6_echo_request_hdr_t *echo_buf = get_echo_req_buf(ipv6_legacy_ext_hdr_len); uint8_t *echo_data_buf = ((uint8_t *)echo_buf) + sizeof(icmpv6_echo_request_hdr_t); icmp_buf->type = ICMPV6_TYPE_ECHO_REQUEST; icmp_buf->code = 0; - ipv6_buf->version_trafficclass = IPV6_VER; - ipv6_buf->trafficclass_flowlabel = 0; - ipv6_buf->flowlabel = 0; - ipv6_buf->nextheader = IPV6_PROTO_NUM_ICMPV6; - ipv6_buf->hoplimit = ipv6_get_default_hop_limit(); - - memcpy(&ipv6_buf->destaddr, destaddr, sizeof(ipv6_addr_t)); - ipv6_net_if_get_best_src_addr(&ipv6_buf->srcaddr, &ipv6_buf->destaddr); + ipv6_legacy_buf->version_trafficclass = IPV6_LEGACY_VER; + ipv6_legacy_buf->trafficclass_flowlabel = 0; + ipv6_legacy_buf->flowlabel = 0; + ipv6_legacy_buf->nextheader = IPV6_LEGACY_PROTO_NUM_ICMPV6; + ipv6_legacy_buf->hoplimit = ipv6_legacy_get_default_hop_limit(); + + memcpy(&ipv6_legacy_buf->destaddr, destaddr, sizeof(ipv6_legacy_addr_t)); + ipv6_legacy_net_if_get_best_src_addr(&ipv6_legacy_buf->srcaddr, &ipv6_legacy_buf->destaddr); echo_buf->id = HTONS(id); echo_buf->seq = HTONS(seq); memcpy(echo_data_buf, data, data_len); - packet_length = IPV6_HDR_LEN + ICMPV6_HDR_LEN + ipv6_ext_hdr_len + + packet_length = IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN + ipv6_legacy_ext_hdr_len + ECHO_REQ_LEN + data_len; - ipv6_buf->length = HTONS(packet_length - IPV6_HDR_LEN); + ipv6_legacy_buf->length = HTONS(packet_length - IPV6_LEGACY_HDR_LEN); - icmp_buf->checksum = icmpv6_csum(ipv6_buf, icmp_buf); + icmp_buf->checksum = icmpv6_csum(ipv6_legacy_buf, icmp_buf); #ifdef DEBUG_ENABLED - char addr_str[IPV6_MAX_ADDR_STR_LEN]; + char addr_str[IPV6_LEGACY_MAX_ADDR_STR_LEN]; printf("INFO: send echo request (id = %04x, seq = %d, data_len = %zu) to: %s\n", - id, seq, data_len, ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, - &ipv6_buf->destaddr)); + id, seq, data_len, ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, + &ipv6_legacy_buf->destaddr)); #endif - ipv6_send_packet(ipv6_buf, NULL); + ipv6_legacy_send_packet(ipv6_legacy_buf, NULL); } -void icmpv6_send_echo_reply(ipv6_addr_t *destaddr, uint16_t id, uint16_t seq, uint8_t *data, size_t data_len) +void icmpv6_send_echo_reply(ipv6_legacy_addr_t *destaddr, uint16_t id, uint16_t seq, uint8_t *data, size_t data_len) { uint16_t packet_length; - ipv6_buf = ipv6_get_buf(); - icmp_buf = get_icmpv6_buf(ipv6_ext_hdr_len); - icmpv6_echo_reply_hdr_t *echo_buf = get_echo_repl_buf(ipv6_ext_hdr_len); + ipv6_legacy_buf = ipv6_legacy_get_buf(); + icmp_buf = get_icmpv6_buf(ipv6_legacy_ext_hdr_len); + icmpv6_echo_reply_hdr_t *echo_buf = get_echo_repl_buf(ipv6_legacy_ext_hdr_len); uint8_t *echo_data_buf = ((uint8_t *)echo_buf) + sizeof(icmpv6_echo_reply_hdr_t); icmp_buf->type = ICMPV6_TYPE_ECHO_REPLY; icmp_buf->code = 0; - ipv6_buf->version_trafficclass = IPV6_VER; - ipv6_buf->trafficclass_flowlabel = 0; - ipv6_buf->flowlabel = 0; - ipv6_buf->nextheader = IPV6_PROTO_NUM_ICMPV6; - ipv6_buf->hoplimit = ipv6_get_default_hop_limit(); - - memcpy(&ipv6_buf->destaddr, destaddr, sizeof(ipv6_addr_t)); - ipv6_net_if_get_best_src_addr(&ipv6_buf->srcaddr, &ipv6_buf->destaddr); + ipv6_legacy_buf->version_trafficclass = IPV6_LEGACY_VER; + ipv6_legacy_buf->trafficclass_flowlabel = 0; + ipv6_legacy_buf->flowlabel = 0; + ipv6_legacy_buf->nextheader = IPV6_LEGACY_PROTO_NUM_ICMPV6; + ipv6_legacy_buf->hoplimit = ipv6_legacy_get_default_hop_limit(); + + memcpy(&ipv6_legacy_buf->destaddr, destaddr, sizeof(ipv6_legacy_addr_t)); + ipv6_legacy_net_if_get_best_src_addr(&ipv6_legacy_buf->srcaddr, &ipv6_legacy_buf->destaddr); echo_buf->id = HTONS(id); echo_buf->seq = HTONS(seq); memcpy(echo_data_buf, data, data_len); - packet_length = IPV6_HDR_LEN + ICMPV6_HDR_LEN + ipv6_ext_hdr_len + + packet_length = IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN + ipv6_legacy_ext_hdr_len + ECHO_REPL_LEN + data_len; - ipv6_buf->length = HTONS(packet_length - IPV6_HDR_LEN); + ipv6_legacy_buf->length = HTONS(packet_length - IPV6_LEGACY_HDR_LEN); - icmp_buf->checksum = icmpv6_csum(ipv6_buf, icmp_buf); + icmp_buf->checksum = icmpv6_csum(ipv6_legacy_buf, icmp_buf); #ifdef DEBUG_ENABLED - char addr_str[IPV6_MAX_ADDR_STR_LEN]; + char addr_str[IPV6_LEGACY_MAX_ADDR_STR_LEN]; printf("INFO: send echo reply (id = %04x, seq = %d, data_len = %zu) to: %s\n", - id, seq, data_len, ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, - &ipv6_buf->destaddr)); + id, seq, data_len, ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, + &ipv6_legacy_buf->destaddr)); #endif - ipv6_send_packet(ipv6_buf, NULL); + ipv6_legacy_send_packet(ipv6_legacy_buf, NULL); } /* send router solicitation message - RFC4861 section 4.1 */ @@ -321,70 +321,70 @@ void icmpv6_send_router_sol(uint8_t sllao) { uint16_t packet_length; - ipv6_buf = ipv6_get_buf(); - icmp_buf = get_icmpv6_buf(ipv6_ext_hdr_len); + ipv6_legacy_buf = ipv6_legacy_get_buf(); + icmp_buf = get_icmpv6_buf(ipv6_legacy_ext_hdr_len); icmp_buf->type = ICMPV6_TYPE_ROUTER_SOL; icmp_buf->code = 0; - ipv6_buf->version_trafficclass = IPV6_VER; - ipv6_buf->trafficclass_flowlabel = 0; - ipv6_buf->flowlabel = 0; - ipv6_buf->nextheader = IPV6_PROTO_NUM_ICMPV6; - ipv6_buf->hoplimit = ND_HOPLIMIT; + ipv6_legacy_buf->version_trafficclass = IPV6_LEGACY_VER; + ipv6_legacy_buf->trafficclass_flowlabel = 0; + ipv6_legacy_buf->flowlabel = 0; + ipv6_legacy_buf->nextheader = IPV6_LEGACY_PROTO_NUM_ICMPV6; + ipv6_legacy_buf->hoplimit = ND_HOPLIMIT; - ipv6_addr_set_all_routers_addr(&ipv6_buf->destaddr); - //iface_find_src_ipaddr(&ipv6_buf->srcaddr, NDP_ADDR_STATE_PREFERRED, - /* IPV6_ADDR_TYPE_MULTICAST); */ + ipv6_legacy_addr_set_all_routers_addr(&ipv6_legacy_buf->destaddr); + //iface_find_src_ipaddr(&ipv6_legacy_buf->srcaddr, NDP_ADDR_STATE_PREFERRED, + /* IPV6_LEGACY_ADDR_TYPE_MULTICAST); */ - ipv6_net_if_get_best_src_addr(&(ipv6_buf->srcaddr), &(ipv6_buf->destaddr)); + ipv6_legacy_net_if_get_best_src_addr(&(ipv6_legacy_buf->srcaddr), &(ipv6_legacy_buf->destaddr)); icmpv6_opt_hdr_len = RTR_SOL_LEN; if (sllao == OPT_SLLAO) { - opt_stllao_buf = get_opt_stllao_buf(ipv6_ext_hdr_len, icmpv6_opt_hdr_len); + opt_stllao_buf = get_opt_stllao_buf(ipv6_legacy_ext_hdr_len, icmpv6_opt_hdr_len); int if_id = 0; // TODO get this somehow if (net_if_get_src_address_mode(if_id) == NET_IF_TRANS_ADDR_M_LONG) { icmpv6_ndp_set_sllao(opt_stllao_buf, if_id, NDP_OPT_SLLAO_TYPE, 2); - packet_length = IPV6_HDR_LEN + ICMPV6_HDR_LEN + ipv6_ext_hdr_len + + packet_length = IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN + ipv6_legacy_ext_hdr_len + RTR_SOL_LEN + OPT_STLLAO_MAX_LEN; } else { icmpv6_ndp_set_sllao(opt_stllao_buf, if_id, NDP_OPT_SLLAO_TYPE, 1); - packet_length = IPV6_HDR_LEN + ICMPV6_HDR_LEN + ipv6_ext_hdr_len + + packet_length = IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN + ipv6_legacy_ext_hdr_len + RTR_SOL_LEN + OPT_STLLAO_MIN_LEN; } } else { - packet_length = IPV6_HDR_LEN + ICMPV6_HDR_LEN + ipv6_ext_hdr_len + + packet_length = IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN + ipv6_legacy_ext_hdr_len + RTR_SOL_LEN; } - ipv6_buf->length = HTONS(packet_length - IPV6_HDR_LEN); + ipv6_legacy_buf->length = HTONS(packet_length - IPV6_LEGACY_HDR_LEN); - icmp_buf->checksum = icmpv6_csum(ipv6_buf, icmp_buf); + icmp_buf->checksum = icmpv6_csum(ipv6_legacy_buf, icmp_buf); #ifdef DEBUG_ENABLED - char addr_str[IPV6_MAX_ADDR_STR_LEN]; + char addr_str[IPV6_LEGACY_MAX_ADDR_STR_LEN]; printf("INFO: send router solicitation to: %s\n", - ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, - &ipv6_buf->destaddr)); + ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, + &ipv6_legacy_buf->destaddr)); #endif - ipv6_send_packet(ipv6_buf, NULL); + ipv6_legacy_send_packet(ipv6_legacy_buf, NULL); } void recv_echo_req(void) { - ipv6_buf = ipv6_get_buf(); - icmpv6_echo_request_hdr_t *echo_buf = get_echo_req_buf(ipv6_ext_hdr_len); + ipv6_legacy_buf = ipv6_legacy_get_buf(); + icmpv6_echo_request_hdr_t *echo_buf = get_echo_req_buf(ipv6_legacy_ext_hdr_len); uint8_t *echo_data_buf = ((uint8_t *)echo_buf) + sizeof(icmpv6_echo_reply_hdr_t); - size_t data_len = NTOHS(ipv6_buf->length) - ICMPV6_HDR_LEN - ECHO_REQ_LEN; + size_t data_len = NTOHS(ipv6_legacy_buf->length) - ICMPV6_HDR_LEN - ECHO_REQ_LEN; #ifdef DEBUG_ENABLED - char addr_str[IPV6_MAX_ADDR_STR_LEN]; + char addr_str[IPV6_LEGACY_MAX_ADDR_STR_LEN]; printf("INFO: received echo request from: %s\n", - ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, - &ipv6_buf->srcaddr)); + ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, + &ipv6_legacy_buf->srcaddr)); printf("\n"); printf("id = 0x%04x, seq = %d, data_len = %zu\n", NTOHS(echo_buf->id), NTOHS(echo_buf->seq), data_len); @@ -398,22 +398,22 @@ void recv_echo_req(void) } #endif - icmpv6_send_echo_reply(&ipv6_buf->srcaddr, NTOHS(echo_buf->id), + icmpv6_send_echo_reply(&ipv6_legacy_buf->srcaddr, NTOHS(echo_buf->id), NTOHS(echo_buf->seq), echo_data_buf, data_len); } void recv_echo_repl(void) { #ifdef DEBUG_ENABLED - ipv6_buf = ipv6_get_buf(); - icmpv6_echo_reply_hdr_t *echo_buf = get_echo_repl_buf(ipv6_ext_hdr_len); + ipv6_legacy_buf = ipv6_legacy_get_buf(); + icmpv6_echo_reply_hdr_t *echo_buf = get_echo_repl_buf(ipv6_legacy_ext_hdr_len); uint8_t *echo_data_buf = ((uint8_t *)echo_buf) + sizeof(icmpv6_echo_reply_hdr_t); - size_t data_len = NTOHS(ipv6_buf->length) - ICMPV6_HDR_LEN - ECHO_REPL_LEN; - char addr_str[IPV6_MAX_ADDR_STR_LEN]; + size_t data_len = NTOHS(ipv6_legacy_buf->length) - ICMPV6_HDR_LEN - ECHO_REPL_LEN; + char addr_str[IPV6_LEGACY_MAX_ADDR_STR_LEN]; printf("INFO: received echo reply from: %s\n", - ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, - &ipv6_buf->srcaddr)); + ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, + &ipv6_legacy_buf->srcaddr)); printf("\n"); printf("id = 0x%04x, seq = %d, data_len = %zu\n", NTOHS(echo_buf->id), NTOHS(echo_buf->seq), data_len); @@ -431,18 +431,18 @@ void recv_echo_repl(void) void recv_rtr_sol(void) { icmpv6_opt_hdr_len = RTR_SOL_LEN; - ipv6_buf = ipv6_get_buf(); + ipv6_legacy_buf = ipv6_legacy_get_buf(); /* check if source option is set*/ if (opt_stllao_buf->type == NDP_OPT_SLLAO_TYPE) { - opt_stllao_buf = get_opt_stllao_buf(ipv6_ext_hdr_len, icmpv6_opt_hdr_len); + opt_stllao_buf = get_opt_stllao_buf(ipv6_legacy_ext_hdr_len, icmpv6_opt_hdr_len); llao = (uint8_t *)opt_stllao_buf; icmpv6_opt_hdr_len += (opt_stllao_buf->length) << 3; } if (llao != NULL) { uint8_t lladdr_len; - nbr_entry = ndp_neighbor_cache_search(&ipv6_buf->srcaddr); + nbr_entry = ndp_neighbor_cache_search(&ipv6_legacy_buf->srcaddr); if (opt_stllao_buf->length == 2) { lladdr_len = 8; @@ -472,7 +472,7 @@ void recv_rtr_sol(void) } else { /* nothing found, add neigbor into cache*/ - ndp_neighbor_cache_add(if_id, &ipv6_buf->srcaddr, &llao[2], lladdr_len, + ndp_neighbor_cache_add(if_id, &ipv6_legacy_buf->srcaddr, &llao[2], lladdr_len, 0, NDP_NCE_STATUS_STALE, NDP_NCE_TYPE_TENTATIVE, NBR_CACHE_LTIME_TEN); } @@ -480,10 +480,10 @@ void recv_rtr_sol(void) /* send solicited router advertisment */ if (abr_count > 0) { - icmpv6_send_router_adv(&ipv6_buf->srcaddr, 0, 0, OPT_PI, OPT_6CO, OPT_ABRO); + icmpv6_send_router_adv(&ipv6_legacy_buf->srcaddr, 0, 0, OPT_PI, OPT_6CO, OPT_ABRO); } else { - icmpv6_send_router_adv(&ipv6_buf->srcaddr, 0, 0, OPT_PI, 0, 0); + icmpv6_send_router_adv(&ipv6_legacy_buf->srcaddr, 0, 0, OPT_PI, 0, 0); } } @@ -511,7 +511,7 @@ void get_opt_6co_flags(uint8_t *compression_flag, uint8_t *cid, uint8_t flags) lowpan_context_t *abr_get_context(ndp_a6br_cache_t *abr, uint8_t cid); -void icmpv6_send_router_adv(ipv6_addr_t *addr, uint8_t sllao, uint8_t mtu, uint8_t pi, +void icmpv6_send_router_adv(ipv6_legacy_addr_t *addr, uint8_t sllao, uint8_t mtu, uint8_t pi, uint8_t sixco, uint8_t abro) { int if_id = 0; // TODO: get this somehow @@ -519,31 +519,31 @@ void icmpv6_send_router_adv(ipv6_addr_t *addr, uint8_t sllao, uint8_t mtu, uint8 lowpan_context_t *contexts = NULL; ndp_a6br_cache_t *msg_abr = NULL; - ipv6_buf = ipv6_get_buf(); - icmp_buf = get_icmpv6_buf(ipv6_ext_hdr_len); + ipv6_legacy_buf = ipv6_legacy_get_buf(); + icmp_buf = get_icmpv6_buf(ipv6_legacy_ext_hdr_len); - ipv6_buf->version_trafficclass = IPV6_VER; - ipv6_buf->trafficclass_flowlabel = 0; - ipv6_buf->flowlabel = 0; - ipv6_buf->nextheader = IPV6_PROTO_NUM_ICMPV6; - ipv6_buf->hoplimit = ND_HOPLIMIT; + ipv6_legacy_buf->version_trafficclass = IPV6_LEGACY_VER; + ipv6_legacy_buf->trafficclass_flowlabel = 0; + ipv6_legacy_buf->flowlabel = 0; + ipv6_legacy_buf->nextheader = IPV6_LEGACY_PROTO_NUM_ICMPV6; + ipv6_legacy_buf->hoplimit = ND_HOPLIMIT; if (addr == NULL) { /* not solicited */ - ipv6_addr_set_all_nodes_addr(&ipv6_buf->destaddr); + ipv6_legacy_addr_set_all_nodes_addr(&ipv6_legacy_buf->destaddr); } else { - memcpy(&ipv6_buf->destaddr, addr, 16); + memcpy(&ipv6_legacy_buf->destaddr, addr, 16); } - ipv6_net_if_get_best_src_addr(&(ipv6_buf->srcaddr), &(ipv6_buf->destaddr)); + ipv6_legacy_net_if_get_best_src_addr(&(ipv6_legacy_buf->srcaddr), &(ipv6_legacy_buf->destaddr)); icmp_buf->type = ICMPV6_TYPE_ROUTER_ADV; icmp_buf->code = 0; //TODO: gethoplimit func, set current ttl - rtr_adv_buf = get_rtr_adv_buf(ipv6_ext_hdr_len); + rtr_adv_buf = get_rtr_adv_buf(ipv6_legacy_ext_hdr_len); rtr_adv_buf->hoplimit = MULTIHOP_HOPLIMIT; /* set M and O flag, last 6 bits are zero */ rtr_adv_buf->autoconfig_flags = ICMPV6_ROUTER_ADV_FLAG_MANAGED | ICMPV6_ROUTER_ADV_FLAG_OTHER; @@ -552,11 +552,11 @@ void icmpv6_send_router_adv(ipv6_addr_t *addr, uint8_t sllao, uint8_t mtu, uint8 rtr_adv_buf->retrans_timer = 0; icmpv6_opt_hdr_len = RTR_ADV_LEN; - packet_length = IPV6_HDR_LEN + ICMPV6_HDR_LEN + RTR_ADV_LEN; + packet_length = IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN + RTR_ADV_LEN; if (sllao == OPT_SLLAO) { /* set link layer address option */ - opt_stllao_buf = get_opt_stllao_buf(ipv6_ext_hdr_len, icmpv6_opt_hdr_len); + opt_stllao_buf = get_opt_stllao_buf(ipv6_legacy_ext_hdr_len, icmpv6_opt_hdr_len); if (net_if_get_src_address_mode(if_id) == NET_IF_TRANS_ADDR_M_LONG) { icmpv6_ndp_set_sllao(opt_stllao_buf, if_id, NDP_OPT_SLLAO_TYPE, 2); @@ -572,7 +572,7 @@ void icmpv6_send_router_adv(ipv6_addr_t *addr, uint8_t sllao, uint8_t mtu, uint8 if (mtu == OPT_MTU) { /* set MTU options */ - opt_mtu_buf = get_opt_mtu_buf(ipv6_ext_hdr_len, icmpv6_opt_hdr_len); + opt_mtu_buf = get_opt_mtu_buf(ipv6_legacy_ext_hdr_len, icmpv6_opt_hdr_len); opt_mtu_buf->type = OPT_MTU_TYPE; opt_mtu_buf->length = OPT_MTU_LEN; opt_mtu_buf->reserved = 0; @@ -587,12 +587,12 @@ void icmpv6_send_router_adv(ipv6_addr_t *addr, uint8_t sllao, uint8_t mtu, uint8 /* set authoritive border router option */ if (abr_count > 0) { msg_abr = ndp_a6br_cache_get_most_current(); - opt_abro_buf = get_opt_abro_buf(ipv6_ext_hdr_len, icmpv6_opt_hdr_len); + opt_abro_buf = get_opt_abro_buf(ipv6_legacy_ext_hdr_len, icmpv6_opt_hdr_len); opt_abro_buf->type = OPT_ABRO_TYPE; opt_abro_buf->length = OPT_ABRO_LEN; opt_abro_buf->version = HTONS(msg_abr->version); opt_abro_buf->reserved = 0; - memcpy(&(opt_abro_buf->addr), &(msg_abr->abr_addr), sizeof(ipv6_addr_t)); + memcpy(&(opt_abro_buf->addr), &(msg_abr->abr_addr), sizeof(ipv6_legacy_addr_t)); } } @@ -623,7 +623,7 @@ void icmpv6_send_router_adv(ipv6_addr_t *addr, uint8_t sllao, uint8_t mtu, uint8 } for (int i = 0; i < contexts_len; i++) { - opt_6co_hdr_buf = get_opt_6co_hdr_buf(ipv6_ext_hdr_len, icmpv6_opt_hdr_len); + opt_6co_hdr_buf = get_opt_6co_hdr_buf(ipv6_legacy_ext_hdr_len, icmpv6_opt_hdr_len); opt_6co_hdr_buf->type = OPT_6CO_TYPE; if (contexts[i].length > 64) { @@ -641,7 +641,7 @@ void icmpv6_send_router_adv(ipv6_addr_t *addr, uint8_t sllao, uint8_t mtu, uint8 icmpv6_opt_hdr_len += OPT_6CO_HDR_LEN; packet_length += OPT_6CO_HDR_LEN; /* attach prefixes */ - opt_6co_prefix_buf = get_opt_6co_prefix_buf(ipv6_ext_hdr_len, icmpv6_opt_hdr_len); + opt_6co_prefix_buf = get_opt_6co_prefix_buf(ipv6_legacy_ext_hdr_len, icmpv6_opt_hdr_len); if (opt_6co_hdr_buf->c_length > 64) { memset((void *)opt_6co_prefix_buf, 0, 16); @@ -670,10 +670,10 @@ void icmpv6_send_router_adv(ipv6_addr_t *addr, uint8_t sllao, uint8_t mtu, uint8 /* set prefix option */ while (net_if_iter_addresses(if_id, (net_if_addr_t **) &prefix)) { - if (prefix->prefix_protocol & NET_IF_L3P_IPV6_PREFIX && + if (prefix->prefix_protocol & NET_IF_L3P_IPV6_LEGACY_PREFIX && prefix->inuse && prefix->advertisable) { - opt_pi_buf = get_opt_pi_buf(ipv6_ext_hdr_len, icmpv6_opt_hdr_len); - memset(&opt_pi_buf->addr, 0, sizeof(ipv6_addr_t)); + opt_pi_buf = get_opt_pi_buf(ipv6_legacy_ext_hdr_len, icmpv6_opt_hdr_len); + memset(&opt_pi_buf->addr, 0, sizeof(ipv6_legacy_addr_t)); memcpy(&opt_pi_buf->addr, &prefix->prefix_data, prefix->prefix_len); opt_pi_buf->type = OPT_PI_TYPE; opt_pi_buf->length = OPT_PI_LEN; @@ -688,18 +688,18 @@ void icmpv6_send_router_adv(ipv6_addr_t *addr, uint8_t sllao, uint8_t mtu, uint8 } } - ipv6_buf->length = HTONS(packet_length - IPV6_HDR_LEN); + ipv6_legacy_buf->length = HTONS(packet_length - IPV6_LEGACY_HDR_LEN); /* calculate checksum */ - icmp_buf->checksum = icmpv6_csum(ipv6_buf, icmp_buf); + icmp_buf->checksum = icmpv6_csum(ipv6_legacy_buf, icmp_buf); #ifdef DEBUG_ENABLED - char addr_str[IPV6_MAX_ADDR_STR_LEN]; + char addr_str[IPV6_LEGACY_MAX_ADDR_STR_LEN]; printf("INFO: send router advertisement to: %s\n", - ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, - &ipv6_buf->destaddr)); + ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, + &ipv6_legacy_buf->destaddr)); #endif - ipv6_send_packet(ipv6_buf, NULL); + ipv6_legacy_send_packet(ipv6_legacy_buf, NULL); } void recv_rtr_adv(void) @@ -709,42 +709,42 @@ void recv_rtr_adv(void) int8_t abro_found = 0; int16_t abro_version = 0; /* later replaced, just to supress warnings */ uint16_t packet_length; - ipv6_addr_t abro_addr; + ipv6_legacy_addr_t abro_addr; - ipv6_buf = ipv6_get_buf(); - packet_length = IPV6_HDR_LEN + NTOHS(ipv6_buf->length); + ipv6_legacy_buf = ipv6_legacy_get_buf(); + packet_length = IPV6_LEGACY_HDR_LEN + NTOHS(ipv6_legacy_buf->length); icmpv6_opt_hdr_len = RTR_ADV_LEN; - rtr_adv_buf = get_rtr_adv_buf(ipv6_ext_hdr_len); - ipv6_addr_t newaddr; + rtr_adv_buf = get_rtr_adv_buf(ipv6_legacy_ext_hdr_len); + ipv6_legacy_addr_t newaddr; recvd_cids_len = 0; /* update interface reachable time and retrans timer */ if (rtr_adv_buf->reachable_time != 0) { - ipv6_net_if_ext_t *iface; + ipv6_legacy_net_if_ext_t *iface; - iface = ipv6_net_if_get_ext(if_id); + iface = ipv6_legacy_net_if_get_ext(if_id); if (iface) { iface->adv_reachable_time = NTOHL(rtr_adv_buf->reachable_time); } } if (rtr_adv_buf->retrans_timer != 0) { - ipv6_net_if_ext_t *iface; + ipv6_legacy_net_if_ext_t *iface; - iface = ipv6_net_if_get_ext(if_id); + iface = ipv6_legacy_net_if_get_ext(if_id); if (iface) { iface->adv_retrans_timer = NTOHL(rtr_adv_buf->retrans_timer); } } - def_rtr_entry = ndp_default_router_list_search(&ipv6_buf->srcaddr); + def_rtr_entry = ndp_default_router_list_search(&ipv6_legacy_buf->srcaddr); if (rtr_adv_buf->router_lifetime != 0) { if (def_rtr_entry != NULL) { set_remaining_time(&(def_rtr_entry->inval_time), HTONL(rtr_adv_buf->router_lifetime)); } else { - def_rtr_lst_add(&(ipv6_buf->srcaddr), HTONL(rtr_adv_buf->router_lifetime)); + def_rtr_lst_add(&(ipv6_legacy_buf->srcaddr), HTONL(rtr_adv_buf->router_lifetime)); trigger_ns = 1; } } @@ -758,8 +758,8 @@ void recv_rtr_adv(void) mutex_lock(&lowpan_context_mutex); /* read options */ - while (packet_length > IPV6_HDR_LEN + ICMPV6_HDR_LEN + icmpv6_opt_hdr_len) { - opt_buf = get_opt_buf(ipv6_ext_hdr_len, icmpv6_opt_hdr_len); + while (packet_length > IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN + icmpv6_opt_hdr_len) { + opt_buf = get_opt_buf(ipv6_legacy_ext_hdr_len, icmpv6_opt_hdr_len); switch (opt_buf->type) { case (NDP_OPT_SLLAO_TYPE): { @@ -772,10 +772,10 @@ void recv_rtr_adv(void) /* rfc 4862 section 5.5.3 */ case (OPT_PI_TYPE): { - opt_pi_buf = get_opt_pi_buf(ipv6_ext_hdr_len, icmpv6_opt_hdr_len); + opt_pi_buf = get_opt_pi_buf(ipv6_legacy_ext_hdr_len, icmpv6_opt_hdr_len); /* crazy condition, read 5.5.3a-b-c for further information */ - if (ipv6_addr_is_link_local(&opt_pi_buf->addr) || + if (ipv6_legacy_addr_is_link_local(&opt_pi_buf->addr) || (HTONL(opt_pi_buf->pref_ltime) > HTONL(opt_pi_buf->val_ltime))) { break; @@ -787,19 +787,19 @@ void recv_rtr_adv(void) } if (opt_pi_buf->l_a_reserved1 & ICMPV6_NDP_OPT_PI_FLAG_AUTONOM) { - ipv6_net_if_hit_t addr_hit; + ipv6_legacy_net_if_hit_t addr_hit; - if (!ipv6_net_if_addr_prefix_eq(&addr_hit, &opt_pi_buf->addr)) { + if (!ipv6_legacy_net_if_addr_prefix_eq(&addr_hit, &opt_pi_buf->addr)) { /* 5.5.3d */ if (opt_pi_buf->val_ltime != 0) { /* iid will also be added here */ - ipv6_addr_set_by_eui64(&newaddr, if_id, + ipv6_legacy_addr_set_by_eui64(&newaddr, if_id, &opt_pi_buf->addr); /* add into address list * TODO: duplicate address detection is not * implementet yet, so all new addresse will * be added with state PREFFERED */ - ipv6_net_if_add_addr(if_id, &newaddr, + ipv6_legacy_net_if_add_addr(if_id, &newaddr, NDP_ADDR_STATE_PREFERRED, opt_pi_buf->val_ltime, opt_pi_buf->pref_ltime, 0); @@ -839,14 +839,14 @@ void recv_rtr_adv(void) uint8_t comp; uint8_t num; - opt_6co_hdr_buf = get_opt_6co_hdr_buf(ipv6_ext_hdr_len, icmpv6_opt_hdr_len); + opt_6co_hdr_buf = get_opt_6co_hdr_buf(ipv6_legacy_ext_hdr_len, icmpv6_opt_hdr_len); get_opt_6co_flags(&comp, &num, opt_6co_hdr_buf->c_flags); - ipv6_addr_t prefix; + ipv6_legacy_addr_t prefix; memset(&prefix, 0, 16); - opt_6co_prefix_buf = get_opt_6co_prefix_buf(ipv6_ext_hdr_len, icmpv6_opt_hdr_len + OPT_6CO_HDR_LEN); + opt_6co_prefix_buf = get_opt_6co_prefix_buf(ipv6_legacy_ext_hdr_len, icmpv6_opt_hdr_len + OPT_6CO_HDR_LEN); memcpy(&prefix, opt_6co_prefix_buf, opt_6co_hdr_buf->c_length); @@ -863,10 +863,10 @@ void recv_rtr_adv(void) } case (OPT_ABRO_TYPE): { - opt_abro_buf = get_opt_abro_buf(ipv6_ext_hdr_len, icmpv6_opt_hdr_len); + opt_abro_buf = get_opt_abro_buf(ipv6_legacy_ext_hdr_len, icmpv6_opt_hdr_len); abro_found = 1; abro_version = HTONS(opt_abro_buf->version); - memcpy(&(abro_addr), &(opt_abro_buf->addr), sizeof(ipv6_addr_t)); + memcpy(&(abro_addr), &(opt_abro_buf->addr), sizeof(ipv6_legacy_addr_t)); break; } @@ -897,54 +897,54 @@ void recv_rtr_adv(void) * containing its tentative global IPv6 address to register * * if new address was configured, set src to newaddr(gp16) */ - icmpv6_send_neighbor_sol(&newaddr, &(ipv6_buf->srcaddr), &(ipv6_buf->srcaddr), OPT_SLLAO, OPT_ARO); + icmpv6_send_neighbor_sol(&newaddr, &(ipv6_legacy_buf->srcaddr), &(ipv6_legacy_buf->srcaddr), OPT_SLLAO, OPT_ARO); } } -void icmpv6_send_neighbor_sol(ipv6_addr_t *src, ipv6_addr_t *dest, ipv6_addr_t *targ, +void icmpv6_send_neighbor_sol(ipv6_legacy_addr_t *src, ipv6_legacy_addr_t *dest, ipv6_legacy_addr_t *targ, uint8_t sllao, uint8_t aro) { uint16_t packet_length; int if_id = 0; // TODO: get this somehow - ipv6_net_if_hit_t hit; + ipv6_legacy_net_if_hit_t hit; - ipv6_buf = ipv6_get_buf(); - ipv6_buf->version_trafficclass = IPV6_VER; - ipv6_buf->trafficclass_flowlabel = 0; - ipv6_buf->flowlabel = 0; - ipv6_buf->nextheader = IPV6_PROTO_NUM_ICMPV6; - ipv6_buf->hoplimit = ND_HOPLIMIT; + ipv6_legacy_buf = ipv6_legacy_get_buf(); + ipv6_legacy_buf->version_trafficclass = IPV6_LEGACY_VER; + ipv6_legacy_buf->trafficclass_flowlabel = 0; + ipv6_legacy_buf->flowlabel = 0; + ipv6_legacy_buf->nextheader = IPV6_LEGACY_PROTO_NUM_ICMPV6; + ipv6_legacy_buf->hoplimit = ND_HOPLIMIT; if (dest == NULL) { - ipv6_addr_set_solicited_node_addr(&(ipv6_buf->destaddr), targ); + ipv6_legacy_addr_set_solicited_node_addr(&(ipv6_legacy_buf->destaddr), targ); } else { - memcpy(&(ipv6_buf->destaddr.uint8[0]), &(dest->uint8[0]), 16); + memcpy(&(ipv6_legacy_buf->destaddr.uint8[0]), &(dest->uint8[0]), 16); } - ipv6_ext_hdr_len = 0; - icmp_buf = get_icmpv6_buf(ipv6_ext_hdr_len); + ipv6_legacy_ext_hdr_len = 0; + icmp_buf = get_icmpv6_buf(ipv6_legacy_ext_hdr_len); icmp_buf->type = ICMPV6_TYPE_NEIGHBOR_SOL; icmp_buf->code = 0; - nbr_sol_buf = get_nbr_sol_buf(ipv6_ext_hdr_len); + nbr_sol_buf = get_nbr_sol_buf(ipv6_legacy_ext_hdr_len); nbr_sol_buf->reserved = 0; memcpy(&(nbr_sol_buf->target_addr), targ, 16); icmpv6_opt_hdr_len = NBR_SOL_LEN; - packet_length = IPV6_HDR_LEN + ICMPV6_HDR_LEN + NBR_SOL_LEN; + packet_length = IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN + NBR_SOL_LEN; - if (!ipv6_net_if_addr_match(&hit, targ)) { + if (!ipv6_legacy_net_if_addr_match(&hit, targ)) { if (src == NULL) { - ipv6_net_if_get_best_src_addr(&(ipv6_buf->srcaddr), &(ipv6_buf->destaddr)); + ipv6_legacy_net_if_get_best_src_addr(&(ipv6_legacy_buf->srcaddr), &(ipv6_legacy_buf->destaddr)); } else { - memcpy(&(ipv6_buf->srcaddr), src, 16); + memcpy(&(ipv6_legacy_buf->srcaddr), src, 16); } if (sllao == OPT_SLLAO) { /* set sllao option */ - opt_stllao_buf = get_opt_stllao_buf(ipv6_ext_hdr_len, icmpv6_opt_hdr_len); + opt_stllao_buf = get_opt_stllao_buf(ipv6_legacy_ext_hdr_len, icmpv6_opt_hdr_len); if (net_if_get_src_address_mode(if_id) == NET_IF_TRANS_ADDR_M_LONG) { icmpv6_ndp_set_sllao(opt_stllao_buf, if_id, NDP_OPT_SLLAO_TYPE, 2); @@ -961,7 +961,7 @@ void icmpv6_send_neighbor_sol(ipv6_addr_t *src, ipv6_addr_t *dest, ipv6_addr_t * if (aro == OPT_ARO) { /* set aro option */ - opt_aro_buf = get_opt_aro_buf(ipv6_ext_hdr_len, icmpv6_opt_hdr_len); + opt_aro_buf = get_opt_aro_buf(ipv6_legacy_ext_hdr_len, icmpv6_opt_hdr_len); opt_aro_buf->type = OPT_ARO_TYPE; opt_aro_buf->length = OPT_ARO_LEN; opt_aro_buf->status = 0; @@ -980,36 +980,36 @@ void icmpv6_send_neighbor_sol(ipv6_addr_t *src, ipv6_addr_t *dest, ipv6_addr_t * packet_length += OPT_ARO_HDR_LEN; } - ipv6_buf->length = HTONS(packet_length - IPV6_HDR_LEN); + ipv6_legacy_buf->length = HTONS(packet_length - IPV6_LEGACY_HDR_LEN); - icmp_buf->checksum = icmpv6_csum(ipv6_buf, icmp_buf); + icmp_buf->checksum = icmpv6_csum(ipv6_legacy_buf, icmp_buf); #ifdef DEBUG_ENABLED - char addr_str[IPV6_MAX_ADDR_STR_LEN]; + char addr_str[IPV6_LEGACY_MAX_ADDR_STR_LEN]; printf("INFO: send neighbor solicitation to: %s\n", - ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, - &ipv6_buf->destaddr)); + ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, + &ipv6_legacy_buf->destaddr)); #endif - ipv6_send_packet(ipv6_buf, NULL); + ipv6_legacy_send_packet(ipv6_legacy_buf, NULL); } void recv_nbr_sol(void) { int if_id = 0; // TODO, get this somehow - ipv6_buf = ipv6_get_buf(); + ipv6_legacy_buf = ipv6_legacy_get_buf(); llao = NULL; icmpv6_opt_hdr_len = NBR_SOL_LEN; uint8_t send_na = 0; uint8_t sllao_set = 0; - uint16_t packet_length = IPV6_HDR_LEN + NTOHS(ipv6_buf->length); + uint16_t packet_length = IPV6_LEGACY_HDR_LEN + NTOHS(ipv6_legacy_buf->length); /* check whick options are set, we need that because an aro * option condition is that a sllao option is set. thus that we don't * know which option comes first we need to this here */ - while (packet_length > IPV6_HDR_LEN + ICMPV6_HDR_LEN + icmpv6_opt_hdr_len) { - opt_buf = get_opt_buf(ipv6_ext_hdr_len, icmpv6_opt_hdr_len); + while (packet_length > IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN + icmpv6_opt_hdr_len) { + opt_buf = get_opt_buf(ipv6_legacy_ext_hdr_len, icmpv6_opt_hdr_len); if (opt_buf->type == NDP_OPT_SLLAO_TYPE) { sllao_set = 1; @@ -1020,18 +1020,18 @@ void recv_nbr_sol(void) icmpv6_opt_hdr_len = NBR_SOL_LEN; - while (packet_length > IPV6_HDR_LEN + ICMPV6_HDR_LEN + icmpv6_opt_hdr_len) { - opt_buf = get_opt_buf(ipv6_ext_hdr_len, icmpv6_opt_hdr_len); + while (packet_length > IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN + icmpv6_opt_hdr_len) { + opt_buf = get_opt_buf(ipv6_legacy_ext_hdr_len, icmpv6_opt_hdr_len); switch (opt_buf->type) { case (NDP_OPT_SLLAO_TYPE): { - opt_stllao_buf = get_opt_stllao_buf(ipv6_ext_hdr_len, + opt_stllao_buf = get_opt_stllao_buf(ipv6_legacy_ext_hdr_len, icmpv6_opt_hdr_len); llao = (uint8_t *)opt_stllao_buf; if (llao != NULL && - !(ipv6_addr_is_unspecified(&ipv6_buf->srcaddr))) { - nbr_entry = ndp_neighbor_cache_search(&(ipv6_buf->srcaddr)); + !(ipv6_legacy_addr_is_unspecified(&ipv6_legacy_buf->srcaddr))) { + nbr_entry = ndp_neighbor_cache_search(&(ipv6_legacy_buf->srcaddr)); if (nbr_entry != NULL) { switch (opt_stllao_buf->length) { @@ -1072,7 +1072,7 @@ void recv_nbr_sol(void) else { switch (opt_stllao_buf->length) { case (1): { - ndp_neighbor_cache_add(if_id, &ipv6_buf->srcaddr, + ndp_neighbor_cache_add(if_id, &ipv6_legacy_buf->srcaddr, &llao[2], 2, 0, NDP_NCE_STATUS_STALE, NDP_NCE_TYPE_TENTATIVE, @@ -1082,7 +1082,7 @@ void recv_nbr_sol(void) } case (2): { - ndp_neighbor_cache_add(if_id, &ipv6_buf->srcaddr, + ndp_neighbor_cache_add(if_id, &ipv6_legacy_buf->srcaddr, &llao[2], 8, 0, NDP_NCE_STATUS_STALE, NDP_NCE_TYPE_TENTATIVE, @@ -1102,20 +1102,20 @@ void recv_nbr_sol(void) case (OPT_ARO_TYPE): { /* check if sllao option is set, and if address src address * isn't unspecified - draft-ietf-6lowpan-nd-15#section-6.5 */ - if (!(ipv6_addr_is_unspecified(&ipv6_buf->srcaddr)) && + if (!(ipv6_legacy_addr_is_unspecified(&ipv6_legacy_buf->srcaddr)) && sllao_set == 1) { uint8_t aro_state = NDP_OPT_ARO_STATE_SUCCESS; - opt_aro_buf = get_opt_aro_buf(ipv6_ext_hdr_len, + opt_aro_buf = get_opt_aro_buf(ipv6_legacy_ext_hdr_len, icmpv6_opt_hdr_len); if ((opt_aro_buf->length == 2) && (opt_aro_buf->status == 0)) { /* check neighbor cache for duplicates */ - nbr_entry = ndp_neighbor_cache_search(&(ipv6_buf->srcaddr)); + nbr_entry = ndp_neighbor_cache_search(&(ipv6_legacy_buf->srcaddr)); if (nbr_entry == NULL) { /* create neighbor cache */ - aro_state = ndp_neighbor_cache_add(if_id, &ipv6_buf->srcaddr, + aro_state = ndp_neighbor_cache_add(if_id, &ipv6_legacy_buf->srcaddr, &(opt_aro_buf->eui64), 8, 0, NDP_NCE_STATUS_STALE, NDP_NCE_TYPE_TENTATIVE, opt_aro_buf->reg_ltime); @@ -1133,7 +1133,7 @@ void recv_nbr_sol(void) nbr_entry->state = NDP_NCE_STATUS_STALE; nbr_entry->isrouter = 0; memcpy(&(nbr_entry->addr.uint8[0]), - &(ipv6_buf->srcaddr.uint8[0]), 16); + &(ipv6_legacy_buf->srcaddr.uint8[0]), 16); } aro_state = NDP_OPT_ARO_STATE_SUCCESS; @@ -1158,19 +1158,19 @@ void recv_nbr_sol(void) icmpv6_opt_hdr_len += (opt_buf->length * 8); } - ipv6_net_if_hit_t alist_targ, alist_dest; + ipv6_legacy_net_if_hit_t alist_targ, alist_dest; - nbr_sol_buf = get_nbr_sol_buf(ipv6_ext_hdr_len); + nbr_sol_buf = get_nbr_sol_buf(ipv6_legacy_ext_hdr_len); - if (ipv6_net_if_addr_match(&alist_targ, &nbr_sol_buf->target_addr) != NULL) { - ipv6_net_if_addr_match(&alist_dest, &ipv6_buf->destaddr); + if (ipv6_legacy_net_if_addr_match(&alist_targ, &nbr_sol_buf->target_addr) != NULL) { + ipv6_legacy_net_if_addr_match(&alist_dest, &ipv6_legacy_buf->destaddr); if ((memcmp(alist_targ.addr->addr_data, alist_dest.addr->addr_data, 16) == 0) || - ipv6_addr_is_solicited_node(&ipv6_buf->destaddr)) { - memcpy(&(ipv6_buf->destaddr.uint8[0]), - &(ipv6_buf->srcaddr.uint8[0]), sizeof(ipv6_addr_t)); - memcpy(&(ipv6_buf->srcaddr.uint8[0]), - &(nbr_sol_buf->target_addr.uint8[0]), sizeof(ipv6_addr_t)); + ipv6_legacy_addr_is_solicited_node(&ipv6_legacy_buf->destaddr)) { + memcpy(&(ipv6_legacy_buf->destaddr.uint8[0]), + &(ipv6_legacy_buf->srcaddr.uint8[0]), sizeof(ipv6_legacy_addr_t)); + memcpy(&(ipv6_legacy_buf->srcaddr.uint8[0]), + &(nbr_sol_buf->target_addr.uint8[0]), sizeof(ipv6_legacy_addr_t)); send_na = 1; } } @@ -1178,48 +1178,48 @@ void recv_nbr_sol(void) if (send_na) { /* solicited na */ uint8_t flags = (ICMPV6_NEIGHBOR_ADV_FLAG_OVERRIDE | ICMPV6_NEIGHBOR_ADV_FLAG_SOLICITED); - icmpv6_send_neighbor_adv(&(ipv6_buf->srcaddr), &(ipv6_buf->destaddr), + icmpv6_send_neighbor_adv(&(ipv6_legacy_buf->srcaddr), &(ipv6_legacy_buf->destaddr), alist_targ.addr->addr_data, flags, 0, OPT_ARO); } } -void icmpv6_send_neighbor_adv(ipv6_addr_t *src, ipv6_addr_t *dst, ipv6_addr_t *tgt, +void icmpv6_send_neighbor_adv(ipv6_legacy_addr_t *src, ipv6_legacy_addr_t *dst, ipv6_legacy_addr_t *tgt, uint8_t rso, uint8_t sllao, uint8_t aro) { int if_id = 0; // TODO: get this somehow uint16_t packet_length; - ipv6_buf = ipv6_get_buf(); - ipv6_buf->version_trafficclass = IPV6_VER; - ipv6_buf->trafficclass_flowlabel = 0; - ipv6_buf->flowlabel = 0; - ipv6_buf->nextheader = IPV6_PROTO_NUM_ICMPV6; - ipv6_buf->hoplimit = ND_HOPLIMIT; + ipv6_legacy_buf = ipv6_legacy_get_buf(); + ipv6_legacy_buf->version_trafficclass = IPV6_LEGACY_VER; + ipv6_legacy_buf->trafficclass_flowlabel = 0; + ipv6_legacy_buf->flowlabel = 0; + ipv6_legacy_buf->nextheader = IPV6_LEGACY_PROTO_NUM_ICMPV6; + ipv6_legacy_buf->hoplimit = ND_HOPLIMIT; - ipv6_ext_hdr_len = 0; - icmp_buf = get_icmpv6_buf(ipv6_ext_hdr_len); + ipv6_legacy_ext_hdr_len = 0; + icmp_buf = get_icmpv6_buf(ipv6_legacy_ext_hdr_len); icmp_buf->type = ICMPV6_TYPE_NEIGHBOR_ADV; icmp_buf->code = 0; - if (&ipv6_buf->destaddr != dst) { - memcpy(&(ipv6_buf->destaddr.uint8[0]), &(dst->uint8[0]), 16); + if (&ipv6_legacy_buf->destaddr != dst) { + memcpy(&(ipv6_legacy_buf->destaddr.uint8[0]), &(dst->uint8[0]), 16); } - if (&ipv6_buf->srcaddr != src) { - memcpy(&(ipv6_buf->srcaddr.uint8[0]), &(src->uint8[0]), 16); + if (&ipv6_legacy_buf->srcaddr != src) { + memcpy(&(ipv6_legacy_buf->srcaddr.uint8[0]), &(src->uint8[0]), 16); } - nbr_adv_buf = get_nbr_adv_buf(ipv6_ext_hdr_len); + nbr_adv_buf = get_nbr_adv_buf(ipv6_legacy_ext_hdr_len); nbr_adv_buf->rso = rso; memset(&(nbr_adv_buf->reserved[0]), 0, 3); memcpy(&(nbr_adv_buf->target_addr.uint8[0]), &(tgt->uint8[0]), 16); - packet_length = IPV6_HDR_LEN + ICMPV6_HDR_LEN + NBR_ADV_LEN; + packet_length = IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN + NBR_ADV_LEN; if (sllao == OPT_SLLAO) { /* set sllao option */ - opt_stllao_buf = get_opt_stllao_buf(ipv6_ext_hdr_len, icmpv6_opt_hdr_len); + opt_stllao_buf = get_opt_stllao_buf(ipv6_legacy_ext_hdr_len, icmpv6_opt_hdr_len); if (net_if_get_src_address_mode(if_id) == NET_IF_TRANS_ADDR_M_LONG) { icmpv6_ndp_set_sllao(opt_stllao_buf, if_id, NDP_OPT_SLLAO_TYPE, 2); @@ -1235,7 +1235,7 @@ void icmpv6_send_neighbor_adv(ipv6_addr_t *src, ipv6_addr_t *dst, ipv6_addr_t *t if (aro == OPT_ARO) { /* set aro option */ - opt_aro_buf = get_opt_aro_buf(ipv6_ext_hdr_len, icmpv6_opt_hdr_len); + opt_aro_buf = get_opt_aro_buf(ipv6_legacy_ext_hdr_len, icmpv6_opt_hdr_len); opt_aro_buf->type = OPT_ARO_TYPE; opt_aro_buf->length = OPT_ARO_LEN; opt_aro_buf->status = 0; /* TODO */ @@ -1254,35 +1254,35 @@ void icmpv6_send_neighbor_adv(ipv6_addr_t *src, ipv6_addr_t *dst, ipv6_addr_t *t packet_length += OPT_ARO_HDR_LEN; } - ipv6_buf->length = HTONS(packet_length - IPV6_HDR_LEN); + ipv6_legacy_buf->length = HTONS(packet_length - IPV6_LEGACY_HDR_LEN); - icmp_buf->checksum = icmpv6_csum(ipv6_buf, icmp_buf); + icmp_buf->checksum = icmpv6_csum(ipv6_legacy_buf, icmp_buf); #ifdef DEBUG_ENABLED - char addr_str[IPV6_MAX_ADDR_STR_LEN]; + char addr_str[IPV6_LEGACY_MAX_ADDR_STR_LEN]; printf("INFO: send neighbor advertisement to: %s\n", - ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, - &ipv6_buf->destaddr)); + ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, + &ipv6_legacy_buf->destaddr)); #endif - ipv6_send_packet(ipv6_buf, NULL); + ipv6_legacy_send_packet(ipv6_legacy_buf, NULL); } void recv_nbr_adv(void) { - ipv6_buf = ipv6_get_buf(); - uint16_t packet_length = IPV6_HDR_LEN + NTOHS(ipv6_buf->length); + ipv6_legacy_buf = ipv6_legacy_get_buf(); + uint16_t packet_length = IPV6_LEGACY_HDR_LEN + NTOHS(ipv6_legacy_buf->length); icmpv6_opt_hdr_len = NBR_ADV_LEN; llao = NULL; nbr_entry = NULL; - nbr_adv_buf = get_nbr_adv_buf(ipv6_ext_hdr_len); + nbr_adv_buf = get_nbr_adv_buf(ipv6_legacy_ext_hdr_len); /* check if options are present */ - while (packet_length > IPV6_HDR_LEN + ICMPV6_HDR_LEN + icmpv6_opt_hdr_len) { - opt_buf = get_opt_buf(ipv6_ext_hdr_len, icmpv6_opt_hdr_len); + while (packet_length > IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN + icmpv6_opt_hdr_len) { + opt_buf = get_opt_buf(ipv6_legacy_ext_hdr_len, icmpv6_opt_hdr_len); switch (opt_buf->type) { case (NDP_OPT_TLLAO_TYPE): { - llao = (uint8_t *)get_opt_stllao_buf(ipv6_ext_hdr_len, + llao = (uint8_t *)get_opt_stllao_buf(ipv6_legacy_ext_hdr_len, icmpv6_opt_hdr_len); break; } @@ -1295,9 +1295,9 @@ void recv_nbr_adv(void) icmpv6_opt_hdr_len += (opt_buf->length * 8); } - ipv6_net_if_hit_t hit; + ipv6_legacy_net_if_hit_t hit; - if (ipv6_net_if_addr_match(&hit, &nbr_adv_buf->target_addr) == NULL) { + if (ipv6_legacy_net_if_addr_match(&hit, &nbr_adv_buf->target_addr) == NULL) { nbr_entry = ndp_neighbor_cache_search(&nbr_adv_buf->target_addr); if (nbr_entry != NULL) { @@ -1429,68 +1429,68 @@ void icmpv6_ndp_set_sllao(icmpv6_ndp_opt_stllao_t *sllao, int if_id, } } -uint16_t icmpv6_csum(ipv6_hdr_t *ipv6_buf, icmpv6_hdr_t *icmpv6_buf) +uint16_t icmpv6_csum(ipv6_legacy_hdr_t *ipv6_legacy_buf, icmpv6_hdr_t *icmpv6_buf) { uint16_t sum; - uint16_t len = NTOHS(ipv6_buf->length); + uint16_t len = NTOHS(ipv6_legacy_buf->length); icmpv6_buf->checksum = 0; - sum = len + IPV6_PROTO_NUM_ICMPV6; + sum = len + IPV6_LEGACY_PROTO_NUM_ICMPV6; - sum = net_help_csum(sum, (uint8_t *)&ipv6_buf->srcaddr, 2 * sizeof(ipv6_addr_t)); + sum = net_help_csum(sum, (uint8_t *)&ipv6_legacy_buf->srcaddr, 2 * sizeof(ipv6_legacy_addr_t)); sum = net_help_csum(sum, (uint8_t *)icmpv6_buf, len); return (sum == 0) ? 0 : ~HTONS(sum); } -void icmpv6_send_parameter_prob(ipv6_addr_t *src, ipv6_addr_t *dest, +void icmpv6_send_parameter_prob(ipv6_legacy_addr_t *src, ipv6_legacy_addr_t *dest, uint8_t code, uint32_t pointer, uint8_t *packet, uint8_t packet_len) { - uint16_t packet_length = IPV6_HDR_LEN + ICMPV6_HDR_LEN + PARA_PROB_LEN; + uint16_t packet_length = IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN + PARA_PROB_LEN; icmpv6_parameter_prob_hdr_t *para_prob_buf; - memcpy(&(ipv6_buf[packet_length]), packet, min(IPV6_MTU - packet_length, packet_len)); + memcpy(&(ipv6_legacy_buf[packet_length]), packet, min(IPV6_LEGACY_MTU - packet_length, packet_len)); - ipv6_buf = ipv6_get_buf(); - ipv6_buf->version_trafficclass = IPV6_VER; - ipv6_buf->trafficclass_flowlabel = 0; - ipv6_buf->flowlabel = 0; - ipv6_buf->nextheader = IPV6_PROTO_NUM_ICMPV6; - ipv6_buf->hoplimit = ND_HOPLIMIT; + ipv6_legacy_buf = ipv6_legacy_get_buf(); + ipv6_legacy_buf->version_trafficclass = IPV6_LEGACY_VER; + ipv6_legacy_buf->trafficclass_flowlabel = 0; + ipv6_legacy_buf->flowlabel = 0; + ipv6_legacy_buf->nextheader = IPV6_LEGACY_PROTO_NUM_ICMPV6; + ipv6_legacy_buf->hoplimit = ND_HOPLIMIT; - ipv6_ext_hdr_len = 0; - icmp_buf = get_icmpv6_buf(ipv6_ext_hdr_len); + ipv6_legacy_ext_hdr_len = 0; + icmp_buf = get_icmpv6_buf(ipv6_legacy_ext_hdr_len); icmp_buf->type = ICMPV6_TYPE_PARAMETER_PROB; icmp_buf->code = code; - memcpy(&(ipv6_buf->destaddr.uint8[0]), &(dest->uint8[0]), 16); - memcpy(&(ipv6_buf->srcaddr.uint8[0]), &(src->uint8[0]), 16); + memcpy(&(ipv6_legacy_buf->destaddr.uint8[0]), &(dest->uint8[0]), 16); + memcpy(&(ipv6_legacy_buf->srcaddr.uint8[0]), &(src->uint8[0]), 16); - para_prob_buf = get_para_prob_buf(ipv6_ext_hdr_len); + para_prob_buf = get_para_prob_buf(ipv6_legacy_ext_hdr_len); para_prob_buf->pointer = pointer; - packet_length += min(IPV6_MTU - packet_length, packet_len); + packet_length += min(IPV6_LEGACY_MTU - packet_length, packet_len); - ipv6_buf->length = HTONS(packet_length - IPV6_HDR_LEN); + ipv6_legacy_buf->length = HTONS(packet_length - IPV6_LEGACY_HDR_LEN); - icmp_buf->checksum = icmpv6_csum(ipv6_buf, icmp_buf); + icmp_buf->checksum = icmpv6_csum(ipv6_legacy_buf, icmp_buf); #ifdef DEBUG_ENABLED - char addr_str[IPV6_MAX_ADDR_STR_LEN]; + char addr_str[IPV6_LEGACY_MAX_ADDR_STR_LEN]; printf("INFO: send parameter problem to: %s\n", - ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, - &ipv6_buf->destaddr)); + ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, + &ipv6_legacy_buf->destaddr)); #endif - ipv6_send_packet(ipv6_buf, NULL); + ipv6_legacy_send_packet(ipv6_legacy_buf, NULL); } //------------------------------------------------------------------------------ /* neighbor cache functions */ -ndp_neighbor_cache_t *ndp_neighbor_cache_search(ipv6_addr_t *ipaddr) +ndp_neighbor_cache_t *ndp_neighbor_cache_search(ipv6_legacy_addr_t *ipaddr) { int i; @@ -1503,7 +1503,7 @@ ndp_neighbor_cache_t *ndp_neighbor_cache_search(ipv6_addr_t *ipaddr) return NULL; } -ndp_neighbor_cache_t *ndp_get_ll_address(ipv6_addr_t *ipaddr) +ndp_neighbor_cache_t *ndp_get_ll_address(ipv6_legacy_addr_t *ipaddr) { ndp_neighbor_cache_t *nce = ndp_neighbor_cache_search(ipaddr); @@ -1516,14 +1516,14 @@ ndp_neighbor_cache_t *ndp_get_ll_address(ipv6_addr_t *ipaddr) return nce; } -int ndp_addr_is_on_link(ipv6_addr_t *dest_addr) +int ndp_addr_is_on_link(ipv6_legacy_addr_t *dest_addr) { int if_id = -1; if ((ndp_neighbor_cache_search(dest_addr))) { #ifdef DEBUG_ENABLED - char addr_str[IPV6_MAX_ADDR_STR_LEN]; - DEBUG("INFO: %s is in nbr cache\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, dest_addr)); + char addr_str[IPV6_LEGACY_MAX_ADDR_STR_LEN]; + DEBUG("INFO: %s is in nbr cache\n", ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, dest_addr)); #endif return 1; } @@ -1544,7 +1544,7 @@ int ndp_addr_is_on_link(ipv6_addr_t *dest_addr) return 0; } -uint8_t ndp_neighbor_cache_add(int if_id, const ipv6_addr_t *ipaddr, +uint8_t ndp_neighbor_cache_add(int if_id, const ipv6_legacy_addr_t *ipaddr, const void *lladdr, uint8_t lladdr_len, uint8_t isrouter, ndp_nce_state_t state, ndp_nce_type_t type, uint16_t ltime) @@ -1587,7 +1587,7 @@ void nbr_cache_auto_rem(void) } } -uint8_t ndp_neighbor_cache_remove(const ipv6_addr_t *ipaddr) +uint8_t ndp_neighbor_cache_remove(const ipv6_legacy_addr_t *ipaddr) { int i; uint8_t removed = 0; @@ -1646,7 +1646,7 @@ ndp_a6br_cache_t *ndp_a6br_cache_get_oldest(void) return abr; } -ndp_a6br_cache_t *abr_get_version(uint16_t version, ipv6_addr_t *abr_addr) +ndp_a6br_cache_t *abr_get_version(uint16_t version, ipv6_legacy_addr_t *abr_addr) { int i = 0; @@ -1671,7 +1671,7 @@ lowpan_context_t *abr_get_context(ndp_a6br_cache_t *abr, uint8_t cid) return lowpan_context_num_lookup(abr->cids[cid]); } -ndp_a6br_cache_t *abr_add_context(uint16_t version, ipv6_addr_t *abr_addr, +ndp_a6br_cache_t *abr_add_context(uint16_t version, ipv6_legacy_addr_t *abr_addr, uint8_t cid) { ndp_a6br_cache_t *abr = abr_get_version(version, abr_addr); @@ -1685,7 +1685,7 @@ ndp_a6br_cache_t *abr_add_context(uint16_t version, ipv6_addr_t *abr_addr, } abr->version = version; - memcpy(&(abr->abr_addr), abr_addr, sizeof(ipv6_addr_t)); + memcpy(&(abr->abr_addr), abr_addr, sizeof(ipv6_legacy_addr_t)); memset(abr->cids, 0xFF, NDP_6LOWPAN_CONTEXT_MAX); } @@ -1706,7 +1706,7 @@ void abr_remove_context(uint8_t cid) //------------------------------------------------------------------------------ /* default router list functions */ -ndp_default_router_list_t *ndp_default_router_list_search(ipv6_addr_t *ipaddr) +ndp_default_router_list_t *ndp_default_router_list_search(ipv6_legacy_addr_t *ipaddr) { int i; @@ -1720,7 +1720,7 @@ ndp_default_router_list_t *ndp_default_router_list_search(ipv6_addr_t *ipaddr) return NULL; } -void def_rtr_lst_add(ipv6_addr_t *ipaddr, uint32_t rtr_ltime) +void def_rtr_lst_add(ipv6_legacy_addr_t *ipaddr, uint32_t rtr_ltime) { if (def_rtr_count == DEF_RTR_LST_SIZE) { DEBUG("ERROR: default router list full\n"); @@ -1755,7 +1755,7 @@ void def_rtr_lst_rem(ndp_default_router_list_t *entry) //------------------------------------------------------------------------------ /* prefix information functions */ -int ndp_add_prefix_info(int if_id, const ipv6_addr_t *prefix, +int ndp_add_prefix_info(int if_id, const ipv6_legacy_addr_t *prefix, uint8_t prefix_len, uint32_t valid_lifetime, uint32_t preferred_lifetime, uint8_t advertisable, uint8_t flags) @@ -1788,11 +1788,11 @@ int ndp_add_prefix_info(int if_id, const ipv6_addr_t *prefix, memcpy(&prefix_buf[prefix_buf_count], prefix, (prefix_len / 8) + 1); } - prefix_info->prefix_data = (ipv6_addr_t *) &prefix_buf[prefix_buf_count]; + prefix_info->prefix_data = (ipv6_legacy_addr_t *) &prefix_buf[prefix_buf_count]; prefix_buf_count += prefix_len; prefix_info->prefix_len = prefix_len; - prefix_info->prefix_protocol = NET_IF_L3P_IPV6_PREFIX; + prefix_info->prefix_protocol = NET_IF_L3P_IPV6_LEGACY_PREFIX; prefix_info->inuse = 1; prefix_info->advertisable = advertisable; prefix_info->flags = 0xc0 & flags; @@ -1808,7 +1808,7 @@ int ndp_add_prefix_info(int if_id, const ipv6_addr_t *prefix, return SIXLOWERROR_SUCCESS; } -ndp_prefix_info_t *ndp_prefix_info_search(int if_id, const ipv6_addr_t *addr, +ndp_prefix_info_t *ndp_prefix_info_search(int if_id, const ipv6_legacy_addr_t *addr, uint8_t up_to) { uint8_t best_match = 0; @@ -1819,7 +1819,7 @@ ndp_prefix_info_t *ndp_prefix_info_search(int if_id, const ipv6_addr_t *addr, } while (net_if_iter_addresses(if_id, (net_if_addr_t **) &prefix)) { - if (prefix->prefix_protocol & NET_IF_L3P_IPV6_PREFIX) { + if (prefix->prefix_protocol & NET_IF_L3P_IPV6_LEGACY_PREFIX) { uint8_t match = 0, len = min(up_to, prefix->prefix_len); uint8_t byte_len = (len / 8); @@ -1852,7 +1852,7 @@ ndp_prefix_info_t *ndp_prefix_info_search(int if_id, const ipv6_addr_t *addr, return tmp; } -ndp_prefix_info_t *ndp_prefix_info_match(int if_id, const ipv6_addr_t *prefix, +ndp_prefix_info_t *ndp_prefix_info_match(int if_id, const ipv6_legacy_addr_t *prefix, uint8_t prefix_len) { ndp_prefix_info_t *res = ndp_prefix_info_search(if_id, prefix, diff --git a/sys/net/network_layer/sixlowpan/icmp.h b/sys/net/network_layer/sixlowpan_legacy/icmp.h similarity index 75% rename from sys/net/network_layer/sixlowpan/icmp.h rename to sys/net/network_layer/sixlowpan_legacy/icmp.h index d44768fcce23f..f5be22204f40c 100644 --- a/sys/net/network_layer/sixlowpan/icmp.h +++ b/sys/net/network_layer/sixlowpan_legacy/icmp.h @@ -9,9 +9,9 @@ */ /** - * @ingroup net_sixlowpan + * @ingroup net_sixlowpan_legacy * @{ - * @file sixlowpan/icmp.h + * @file sixlowpan_legacy/icmp.h * @brief 6lowpan neighbor discovery constants, data structs, and prototypes * @author Stephan Zeisberg * @author Martin Lenders @@ -19,15 +19,15 @@ * @} */ -#ifndef _SIXLOWPAN_ICMP_H -#define _SIXLOWPAN_ICMP_H +#ifndef _SIXLOWPAN_LEGACY_ICMP_H +#define _SIXLOWPAN_LEGACY_ICMP_H #include #include "vtimer.h" -#include "sixlowpan/icmp.h" -#include "sixlowpan/ndp.h" -#include "sixlowpan/types.h" +#include "sixlowpan_legacy/icmp.h" +#include "sixlowpan_legacy/ndp.h" +#include "sixlowpan_legacy/types.h" #include "lowpan.h" #include "ip.h" @@ -59,7 +59,7 @@ void recv_nbr_adv(void); void recv_nbr_sol(void); void nbr_cache_auto_rem(void); -ndp_a6br_cache_t *abr_add_context(uint16_t version, ipv6_addr_t *abr_addr, +ndp_a6br_cache_t *abr_add_context(uint16_t version, ipv6_legacy_addr_t *abr_addr, uint8_t cid); void abr_remove_context(uint8_t cid); @@ -67,4 +67,4 @@ void abr_remove_context(uint8_t cid); } #endif -#endif /* _SIXLOWPAN_ICMP_H*/ +#endif /* _SIXLOWPAN_LEGACY_ICMP_H*/ diff --git a/sys/net/network_layer/sixlowpan/ip.c b/sys/net/network_layer/sixlowpan_legacy/ip.c similarity index 61% rename from sys/net/network_layer/sixlowpan/ip.c rename to sys/net/network_layer/sixlowpan_legacy/ip.c index b0c51c6f2b9e1..b4997db469581 100644 --- a/sys/net/network_layer/sixlowpan/ip.c +++ b/sys/net/network_layer/sixlowpan_legacy/ip.c @@ -7,7 +7,7 @@ * General Public License v2.1. See the file LICENSE in the top level * directory for more details. * - * @ingroup sixlowpan + * @ingroup sixlowpan_legacy * @{ * @file sixlowip.c * @brief 6lowpan IP layer functions @@ -26,7 +26,7 @@ #include "mutex.h" #include "msg.h" #include "net_if.h" -#include "sixlowpan/mac.h" +#include "sixlowpan_legacy/mac.h" #include "ip.h" #include "icmp.h" @@ -37,18 +37,18 @@ #define ENABLE_DEBUG (0) #if ENABLE_DEBUG #define DEBUG_ENABLED -char addr_str[IPV6_MAX_ADDR_STR_LEN]; +char addr_str[IPV6_LEGACY_MAX_ADDR_STR_LEN]; #endif #include "debug.h" #define IP_PKT_RECV_BUF_SIZE (64) -#define LLHDR_IPV6HDR_LEN (LL_HDR_LEN + IPV6_HDR_LEN) -#define IPV6_NET_IF_ADDR_BUFFER_LEN (NET_IF_MAX * IPV6_NET_IF_ADDR_LIST_LEN) +#define LLHDR_IPV6_LEGACYHDR_LEN (LL_HDR_LEN + IPV6_LEGACY_HDR_LEN) +#define IPV6_LEGACY_NET_IF_ADDR_BUFFER_LEN (NET_IF_MAX * IPV6_LEGACY_NET_IF_ADDR_LIST_LEN) uint8_t ip_send_buffer[BUFFER_SIZE]; uint8_t buffer[BUFFER_SIZE]; msg_t ip_msg_queue[IP_PKT_RECV_BUF_SIZE]; -ipv6_hdr_t *ipv6_buf; +ipv6_legacy_hdr_t *ipv6_legacy_buf; icmpv6_hdr_t *icmp_buf; uint8_t *nextheader; @@ -56,41 +56,41 @@ kernel_pid_t udp_packet_handler_pid = KERNEL_PID_UNDEF; kernel_pid_t tcp_packet_handler_pid = KERNEL_PID_UNDEF; static volatile kernel_pid_t _rpl_process_pid = KERNEL_PID_UNDEF; -ipv6_addr_t *(*ip_get_next_hop)(ipv6_addr_t *); +ipv6_legacy_addr_t *(*ip_get_next_hop)(ipv6_legacy_addr_t *); uint8_t (*ip_srh_indicator)(void); -static ipv6_net_if_ext_t ipv6_net_if_ext[NET_IF_MAX]; -static ipv6_net_if_addr_t ipv6_net_if_addr_buffer[IPV6_NET_IF_ADDR_BUFFER_LEN]; -static ipv6_addr_t ipv6_addr_buffer[IPV6_NET_IF_ADDR_BUFFER_LEN]; -static uint8_t ipv6_net_if_addr_buffer_count = 0; +static ipv6_legacy_net_if_ext_t ipv6_legacy_net_if_ext[NET_IF_MAX]; +static ipv6_legacy_net_if_addr_t ipv6_legacy_net_if_addr_buffer[IPV6_LEGACY_NET_IF_ADDR_BUFFER_LEN]; +static ipv6_legacy_addr_t ipv6_legacy_addr_buffer[IPV6_LEGACY_NET_IF_ADDR_BUFFER_LEN]; +static uint8_t ipv6_legacy_net_if_addr_buffer_count = 0; static uint8_t default_hop_limit = MULTIHOP_HOPLIMIT; /* registered upper layer threads */ kernel_pid_t sixlowip_reg[SIXLOWIP_MAX_REGISTERED]; -int ipv6_send_packet(ipv6_hdr_t *packet, ipv6_addr_t *next_hop) +int ipv6_legacy_send_packet(ipv6_legacy_hdr_t *packet, ipv6_legacy_addr_t *next_hop) { - uint16_t length = IPV6_HDR_LEN + NTOHS(packet->length); + uint16_t length = IPV6_LEGACY_HDR_LEN + NTOHS(packet->length); ndp_neighbor_cache_t *nce; if (next_hop == NULL) { - DEBUGF("Got a packet to send to %s\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &packet->destaddr)); - ipv6_net_if_get_best_src_addr(&packet->srcaddr, &packet->destaddr); + DEBUGF("Got a packet to send to %s\n", ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, &packet->destaddr)); + ipv6_legacy_net_if_get_best_src_addr(&packet->srcaddr, &packet->destaddr); } - if (!ipv6_addr_is_multicast(&packet->destaddr) + if (!ipv6_legacy_addr_is_multicast(&packet->destaddr) && ndp_addr_is_on_link(&packet->destaddr)) { /* not multicast, on-link */ nce = ndp_get_ll_address(&packet->destaddr); if (nce == NULL - || sixlowpan_lowpan_sendto(nce->if_id, &nce->lladdr, + || sixlowpan_legacy_lowpan_sendto(nce->if_id, &nce->lladdr, nce->lladdr_len, (uint8_t *) packet, length) < 0) { /* XXX: this is wrong, but until ND does work correctly, * this is the only way (aka the old way)*/ uint16_t raddr = NTOHS(packet->destaddr.uint16[7]); - sixlowpan_lowpan_sendto(0, &raddr, 2, (uint8_t *) packet, length); + sixlowpan_legacy_lowpan_sendto(0, &raddr, 2, (uint8_t *) packet, length); /* return -1; */ } @@ -98,16 +98,16 @@ int ipv6_send_packet(ipv6_hdr_t *packet, ipv6_addr_t *next_hop) } else { /* see if dest should be routed to a different next hop */ - if (ipv6_addr_is_multicast(&packet->destaddr)) { + if (ipv6_legacy_addr_is_multicast(&packet->destaddr)) { /* if_id will be ignored */ uint16_t addr = 0xffff; - return sixlowpan_lowpan_sendto(0, &addr, 2, (uint8_t *) packet, + return sixlowpan_legacy_lowpan_sendto(0, &addr, 2, (uint8_t *) packet, length); } if (next_hop == NULL) { - DEBUG("Trying to find the next hop for %s\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &packet->destaddr)); - ipv6_addr_t *dest = ip_get_next_hop(&packet->destaddr); + DEBUG("Trying to find the next hop for %s\n", ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, &packet->destaddr)); + ipv6_legacy_addr_t *dest = ip_get_next_hop(&packet->destaddr); if (ip_get_next_hop == NULL) { return -1; @@ -120,27 +120,27 @@ int ipv6_send_packet(ipv6_hdr_t *packet, ipv6_addr_t *next_hop) nce = ndp_get_ll_address(dest); if (nce == NULL - || sixlowpan_lowpan_sendto(nce->if_id, &nce->lladdr, + || sixlowpan_legacy_lowpan_sendto(nce->if_id, &nce->lladdr, nce->lladdr_len, (uint8_t *) packet, length) < 0) { /* XXX: this is wrong, but until ND does work correctly, * this is the only way (aka the old way)*/ uint16_t raddr = dest->uint16[7]; - sixlowpan_lowpan_sendto(0, &raddr, 2, (uint8_t *) packet, + sixlowpan_legacy_lowpan_sendto(0, &raddr, 2, (uint8_t *) packet, length); /* return -1; */ } } else { - DEBUGF("Set destination based on next-hop: %s\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, next_hop)); + DEBUGF("Set destination based on next-hop: %s\n", ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, next_hop)); nce = ndp_get_ll_address(next_hop); if (nce == NULL - || sixlowpan_lowpan_sendto(nce->if_id, &nce->lladdr, + || sixlowpan_legacy_lowpan_sendto(nce->if_id, &nce->lladdr, nce->lladdr_len, (uint8_t *) packet, length) < 0) { /* XXX: this is wrong, but until ND does work correctly, * this is the only way (aka the old way)*/ uint16_t raddr = next_hop->uint16[7]; - sixlowpan_lowpan_sendto(0, &raddr, 2, (uint8_t *) packet, + sixlowpan_legacy_lowpan_sendto(0, &raddr, 2, (uint8_t *) packet, length); /* return -1; */ } @@ -150,69 +150,69 @@ int ipv6_send_packet(ipv6_hdr_t *packet, ipv6_addr_t *next_hop) } } -ipv6_hdr_t *ipv6_get_buf_send(void) +ipv6_legacy_hdr_t *ipv6_legacy_get_buf_send(void) { - return ((ipv6_hdr_t *) &ip_send_buffer[LL_HDR_LEN]); + return ((ipv6_legacy_hdr_t *) &ip_send_buffer[LL_HDR_LEN]); } uint8_t *get_payload_buf_send(uint8_t ext_len) { - return &(ip_send_buffer[LLHDR_IPV6HDR_LEN + ext_len]); + return &(ip_send_buffer[LLHDR_IPV6_LEGACYHDR_LEN + ext_len]); } -ipv6_hdr_t *ipv6_get_buf(void) +ipv6_legacy_hdr_t *ipv6_legacy_get_buf(void) { - return ((ipv6_hdr_t *) &buffer[LL_HDR_LEN]); + return ((ipv6_legacy_hdr_t *) &buffer[LL_HDR_LEN]); } icmpv6_hdr_t *get_icmpv6_buf(uint8_t ext_len) { - return ((icmpv6_hdr_t *) &buffer[LLHDR_IPV6HDR_LEN + ext_len]); + return ((icmpv6_hdr_t *) &buffer[LLHDR_IPV6_LEGACYHDR_LEN + ext_len]); } uint8_t *get_payload_buf(uint8_t ext_len) { - return &(buffer[LLHDR_IPV6HDR_LEN + ext_len]); + return &(buffer[LLHDR_IPV6_LEGACYHDR_LEN + ext_len]); } -int ipv6_sendto(const ipv6_addr_t *dest, uint8_t next_header, - const uint8_t *payload, uint16_t payload_length, ipv6_addr_t *next_hop) +int ipv6_legacy_sendto(const ipv6_legacy_addr_t *dest, uint8_t next_header, + const uint8_t *payload, uint16_t payload_length, ipv6_legacy_addr_t *next_hop) { uint8_t *p_ptr; - if (next_header == IPV6_PROTO_NUM_TCP) { - p_ptr = get_payload_buf_send(ipv6_ext_hdr_len); - ipv6_buf = ipv6_get_buf_send(); + if (next_header == IPV6_LEGACY_PROTO_NUM_TCP) { + p_ptr = get_payload_buf_send(ipv6_legacy_ext_hdr_len); + ipv6_legacy_buf = ipv6_legacy_get_buf_send(); } else { - ipv6_buf = ipv6_get_buf(); - p_ptr = get_payload_buf(ipv6_ext_hdr_len); + ipv6_legacy_buf = ipv6_legacy_get_buf(); + p_ptr = get_payload_buf(ipv6_legacy_ext_hdr_len); } - ipv6_buf->version_trafficclass = IPV6_VER; - ipv6_buf->trafficclass_flowlabel = 0; - ipv6_buf->flowlabel = 0; - ipv6_buf->nextheader = next_header; - ipv6_buf->hoplimit = MULTIHOP_HOPLIMIT; - ipv6_buf->length = HTONS(payload_length); + ipv6_legacy_buf->version_trafficclass = IPV6_LEGACY_VER; + ipv6_legacy_buf->trafficclass_flowlabel = 0; + ipv6_legacy_buf->flowlabel = 0; + ipv6_legacy_buf->nextheader = next_header; + ipv6_legacy_buf->hoplimit = MULTIHOP_HOPLIMIT; + ipv6_legacy_buf->length = HTONS(payload_length); - memcpy(&(ipv6_buf->destaddr), dest, 16); + memcpy(&(ipv6_legacy_buf->destaddr), dest, 16); memcpy(p_ptr, payload, payload_length); - return ipv6_send_packet(ipv6_buf, next_hop); + return ipv6_legacy_send_packet(ipv6_legacy_buf, next_hop); } -void ipv6_set_default_hop_limit(uint8_t hop_limit) +void ipv6_legacy_set_default_hop_limit(uint8_t hop_limit) { default_hop_limit = hop_limit; } -uint8_t ipv6_get_default_hop_limit(void) +uint8_t ipv6_legacy_get_default_hop_limit(void) { return default_hop_limit; } /* Register an upper layer thread */ -uint8_t ipv6_register_packet_handler(kernel_pid_t pid) +uint8_t ipv6_legacy_register_packet_handler(kernel_pid_t pid) { uint8_t i; @@ -281,7 +281,7 @@ int icmpv6_demultiplex(const icmpv6_hdr_t *hdr) if (_rpl_process_pid != KERNEL_PID_UNDEF) { msg_t m_send; - m_send.content.ptr = (char *) ipv6_buf; + m_send.content.ptr = (char *) ipv6_legacy_buf; msg_send(&m_send, _rpl_process_pid); } else { @@ -298,7 +298,7 @@ int icmpv6_demultiplex(const icmpv6_hdr_t *hdr) return 0; } -uint8_t ipv6_get_addr_match(const ipv6_addr_t *src, const ipv6_addr_t *dst) +uint8_t ipv6_legacy_get_addr_match(const ipv6_legacy_addr_t *src, const ipv6_legacy_addr_t *dst) { uint8_t val = 0, xor; @@ -338,25 +338,25 @@ uint8_t ipv6_get_addr_match(const ipv6_addr_t *src, const ipv6_addr_t *dst) * @return 0 If *addr* is not assigned to any interface * @return -1 If no IPv6 address is configured to any interface */ -static int is_our_address(ipv6_addr_t *addr) +static int is_our_address(ipv6_legacy_addr_t *addr) { int if_id = -1; int if_counter = -1; - DEBUGF("Is this my address: %s?\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, addr)); + DEBUGF("Is this my address: %s?\n", ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, addr)); while ((if_id = net_if_iter_interfaces(if_id)) >= 0) { - ipv6_net_if_ext_t *net_if_ext = ipv6_net_if_get_ext(if_id); - ipv6_net_if_addr_t *myaddr = NULL; + ipv6_legacy_net_if_ext_t *net_if_ext = ipv6_legacy_net_if_get_ext(if_id); + ipv6_legacy_net_if_addr_t *myaddr = NULL; uint8_t prefix = net_if_ext->prefix / 8; - uint8_t suffix = IPV6_ADDR_LEN - prefix; + uint8_t suffix = IPV6_LEGACY_ADDR_LEN - prefix; - while ((myaddr = (ipv6_net_if_addr_t *) net_if_iter_addresses(if_id, + while ((myaddr = (ipv6_legacy_net_if_addr_t *) net_if_iter_addresses(if_id, (net_if_addr_t **) &myaddr)) != NULL) { if_counter++; - DEBUGF("\tCompare with: %s?\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, (ipv6_addr_t *) myaddr->addr_data)); + DEBUGF("\tCompare with: %s?\n", ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, (ipv6_legacy_addr_t *) myaddr->addr_data)); - if ((ipv6_get_addr_match(myaddr->addr_data, addr) + if ((ipv6_legacy_get_addr_match(myaddr->addr_data, addr) >= net_if_ext->prefix) && (memcmp(&addr->uint8[prefix], &myaddr->addr_data->uint8[prefix], suffix) == 0)) { @@ -374,7 +374,7 @@ static int is_our_address(ipv6_addr_t *addr) return -1; } -void *ipv6_process(void *arg) +void *ipv6_legacy_process(void *arg) { (void) arg; @@ -388,21 +388,21 @@ void *ipv6_process(void *arg) while (1) { msg_receive(&m_recv_lowpan); - ipv6_buf = (ipv6_hdr_t *) m_recv_lowpan.content.ptr; + ipv6_legacy_buf = (ipv6_legacy_hdr_t *) m_recv_lowpan.content.ptr; /* identifiy packet */ - nextheader = &ipv6_buf->nextheader; + nextheader = &ipv6_legacy_buf->nextheader; for (i = 0; i < SIXLOWIP_MAX_REGISTERED; i++) { if (sixlowip_reg[i]) { msg_t m_send; - m_send.type = IPV6_PACKET_RECEIVED; - m_send.content.ptr = (char *) ipv6_buf; + m_send.type = IPV6_LEGACY_PACKET_RECEIVED; + m_send.content.ptr = (char *) ipv6_legacy_buf; msg_send(&m_send, sixlowip_reg[i]); } } - int addr_match = is_our_address(&ipv6_buf->destaddr); + int addr_match = is_our_address(&ipv6_legacy_buf->destaddr); DEBUGF("Did it match? %d\n", addr_match); /* no address configured for this node so far, exit early */ @@ -413,12 +413,12 @@ void *ipv6_process(void *arg) /* destination is our address */ else if (addr_match) { switch (*nextheader) { - case (IPV6_PROTO_NUM_ICMPV6): { - icmp_buf = get_icmpv6_buf(ipv6_ext_hdr_len); + case (IPV6_LEGACY_PROTO_NUM_ICMPV6): { + icmp_buf = get_icmpv6_buf(ipv6_legacy_ext_hdr_len); /* checksum test*/ - if (ipv6_csum(ipv6_buf, (uint8_t *) icmp_buf, - NTOHS(ipv6_buf->length), IPV6_PROTO_NUM_ICMPV6) + if (ipv6_legacy_csum(ipv6_legacy_buf, (uint8_t *) icmp_buf, + NTOHS(ipv6_legacy_buf->length), IPV6_LEGACY_PROTO_NUM_ICMPV6) != 0xffff) { DEBUG("ERROR: wrong checksum\n"); } @@ -427,9 +427,9 @@ void *ipv6_process(void *arg) break; } - case (IPV6_PROTO_NUM_TCP): { + case (IPV6_LEGACY_PROTO_NUM_TCP): { if (tcp_packet_handler_pid != KERNEL_PID_UNDEF) { - m_send.content.ptr = (char *) ipv6_buf; + m_send.content.ptr = (char *) ipv6_legacy_buf; msg_send_receive(&m_send, &m_recv, tcp_packet_handler_pid); } else { @@ -439,9 +439,9 @@ void *ipv6_process(void *arg) break; } - case (IPV6_PROTO_NUM_UDP): { + case (IPV6_LEGACY_PROTO_NUM_UDP): { if (udp_packet_handler_pid != KERNEL_PID_UNDEF) { - m_send.content.ptr = (char *) ipv6_buf; + m_send.content.ptr = (char *) ipv6_legacy_buf; msg_send_receive(&m_send, &m_recv, udp_packet_handler_pid); } else { @@ -451,9 +451,9 @@ void *ipv6_process(void *arg) break; } - case (IPV6_PROTO_NUM_SRH): { + case (IPV6_LEGACY_PROTO_NUM_SRH): { if (_rpl_process_pid != KERNEL_PID_UNDEF) { - m_send.content.ptr = (char *) ipv6_buf; + m_send.content.ptr = (char *) ipv6_legacy_buf; msg_send(&m_send, _rpl_process_pid); } else { @@ -463,7 +463,7 @@ void *ipv6_process(void *arg) break; } - case (IPV6_PROTO_NUM_NONE): { + case (IPV6_LEGACY_PROTO_NUM_NONE): { DEBUG("INFO: Packet with no Header following the IPv6 Header received.\n"); break; } @@ -475,13 +475,13 @@ void *ipv6_process(void *arg) } /* destination is foreign address */ else { - DEBUG("That's not for me, destination is %s\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &ipv6_buf->destaddr)); + DEBUG("That's not for me, destination is %s\n", ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, &ipv6_legacy_buf->destaddr)); if ((ip_srh_indicator != NULL) - && (ipv6_buf->nextheader != IPV6_PROTO_NUM_ICMPV6) + && (ipv6_legacy_buf->nextheader != IPV6_LEGACY_PROTO_NUM_ICMPV6) && (ip_srh_indicator() == 1)) { if (_rpl_process_pid != KERNEL_PID_UNDEF) { - m_send.content.ptr = (char *) ipv6_buf; + m_send.content.ptr = (char *) ipv6_legacy_buf; msg_send(&m_send, _rpl_process_pid); } else { @@ -490,19 +490,19 @@ void *ipv6_process(void *arg) } else { - packet_length = IPV6_HDR_LEN + NTOHS(ipv6_buf->length); + packet_length = IPV6_LEGACY_HDR_LEN + NTOHS(ipv6_legacy_buf->length); ndp_neighbor_cache_t *nce; - ipv6_addr_t *dest; + ipv6_legacy_addr_t *dest; if (ip_get_next_hop == NULL) { - dest = &ipv6_buf->destaddr; + dest = &ipv6_legacy_buf->destaddr; } else { - dest = ip_get_next_hop(&ipv6_buf->destaddr); + dest = ip_get_next_hop(&ipv6_legacy_buf->destaddr); } - if ((dest == NULL) || ((--ipv6_buf->hoplimit) == 0)) { + if ((dest == NULL) || ((--ipv6_legacy_buf->hoplimit) == 0)) { DEBUG("!!! Packet not for me, routing handler is set, but I " " have no idea where to send or the hop limit is exceeded.\n"); msg_reply(&m_recv_lowpan, &m_send_lowpan); @@ -512,20 +512,20 @@ void *ipv6_process(void *arg) nce = ndp_get_ll_address(dest); /* copy received packet to send buffer */ - memcpy(ipv6_get_buf_send(), ipv6_get_buf(), packet_length); + memcpy(ipv6_legacy_get_buf_send(), ipv6_legacy_get_buf(), packet_length); /* send packet to node ID derived from dest IP */ if (nce != NULL) { - sixlowpan_lowpan_sendto(nce->if_id, &nce->lladdr, - nce->lladdr_len, (uint8_t *) ipv6_get_buf_send(), + sixlowpan_legacy_lowpan_sendto(nce->if_id, &nce->lladdr, + nce->lladdr_len, (uint8_t *) ipv6_legacy_get_buf_send(), packet_length); } else { /* XXX: this is wrong, but until ND does work correctly, * this is the only way (aka the old way)*/ uint16_t raddr = dest->uint16[7]; - sixlowpan_lowpan_sendto(0, &raddr, 2, - (uint8_t *) ipv6_get_buf_send(), packet_length); + sixlowpan_legacy_lowpan_sendto(0, &raddr, 2, + (uint8_t *) ipv6_legacy_get_buf_send(), packet_length); } } } @@ -534,61 +534,61 @@ void *ipv6_process(void *arg) } } -ipv6_net_if_ext_t *ipv6_net_if_get_ext(int if_id) +ipv6_legacy_net_if_ext_t *ipv6_legacy_net_if_get_ext(int if_id) { if (net_if_get_interface(if_id)) { - return &ipv6_net_if_ext[if_id]; + return &ipv6_legacy_net_if_ext[if_id]; } else { return NULL; } } -int ipv6_net_if_add_addr(int if_id, const ipv6_addr_t *addr, +int ipv6_legacy_net_if_add_addr(int if_id, const ipv6_legacy_addr_t *addr, ndp_addr_state_t state, uint32_t val_ltime, uint32_t pref_ltime, uint8_t is_anycast) { - ipv6_net_if_hit_t hit; + ipv6_legacy_net_if_hit_t hit; - if (ipv6_addr_is_unspecified(addr) == 128) { + if (ipv6_legacy_addr_is_unspecified(addr) == 128) { DEBUG("ERROR: unspecified address (::) can't be assigned to interface.\n"); return 0; } - if (ipv6_addr_is_multicast(addr) && is_anycast) { + if (ipv6_legacy_addr_is_multicast(addr) && is_anycast) { DEBUG("ERROR: anycast addresses must not be multicast addresses " "(i.e. start with ff::/2)\n"); return 0; } - if (ipv6_net_if_addr_match(&hit, addr)) { + if (ipv6_legacy_net_if_addr_match(&hit, addr)) { return 1; } - if (ipv6_net_if_addr_buffer_count < IPV6_NET_IF_ADDR_BUFFER_LEN) { + if (ipv6_legacy_net_if_addr_buffer_count < IPV6_LEGACY_NET_IF_ADDR_BUFFER_LEN) { timex_t valtime = { val_ltime, 0 }; timex_t preftime = { pref_ltime, 0 }; timex_t now; vtimer_now(&now); - ipv6_addr_t *addr_data = - &ipv6_addr_buffer[ipv6_net_if_addr_buffer_count]; - memcpy(addr_data, addr, sizeof(ipv6_addr_t)); + ipv6_legacy_addr_t *addr_data = + &ipv6_legacy_addr_buffer[ipv6_legacy_net_if_addr_buffer_count]; + memcpy(addr_data, addr, sizeof(ipv6_legacy_addr_t)); - ipv6_net_if_addr_t *addr_entry = - &ipv6_net_if_addr_buffer[ipv6_net_if_addr_buffer_count]; + ipv6_legacy_net_if_addr_t *addr_entry = + &ipv6_legacy_net_if_addr_buffer[ipv6_legacy_net_if_addr_buffer_count]; addr_entry->addr_data = addr_data; addr_entry->addr_len = 128; if (is_anycast) { - addr_entry->addr_protocol = NET_IF_L3P_IPV6_ANYCAST; + addr_entry->addr_protocol = NET_IF_L3P_IPV6_LEGACY_ANYCAST; } - else if (ipv6_addr_is_multicast(addr_data)) { - addr_entry->addr_protocol = NET_IF_L3P_IPV6_MULTICAST; + else if (ipv6_legacy_addr_is_multicast(addr_data)) { + addr_entry->addr_protocol = NET_IF_L3P_IPV6_LEGACY_MULTICAST; } else { - addr_entry->addr_protocol = NET_IF_L3P_IPV6_UNICAST; + addr_entry->addr_protocol = NET_IF_L3P_IPV6_LEGACY_UNICAST; } addr_entry->ndp_state = state; @@ -596,17 +596,17 @@ int ipv6_net_if_add_addr(int if_id, const ipv6_addr_t *addr, addr_entry->preferred_lifetime = timex_add(now, preftime); addr_entry->is_anycast = is_anycast; - ipv6_net_if_addr_buffer_count++; + ipv6_legacy_net_if_addr_buffer_count++; net_if_add_address(if_id, (net_if_addr_t *) addr_entry); /* Register to Solicited-Node multicast address according to RFC 4291 */ - if (is_anycast || !ipv6_addr_is_multicast(addr)) { - ipv6_addr_t sol_node_mcast_addr; - ipv6_addr_set_solicited_node_addr(&sol_node_mcast_addr, addr); + if (is_anycast || !ipv6_legacy_addr_is_multicast(addr)) { + ipv6_legacy_addr_t sol_node_mcast_addr; + ipv6_legacy_addr_set_solicited_node_addr(&sol_node_mcast_addr, addr); - if (ipv6_net_if_addr_match(&hit, &sol_node_mcast_addr) == NULL) { - ipv6_net_if_add_addr(if_id, &sol_node_mcast_addr, state, + if (ipv6_legacy_net_if_addr_match(&hit, &sol_node_mcast_addr) == NULL) { + ipv6_legacy_net_if_add_addr(if_id, &sol_node_mcast_addr, state, val_ltime, pref_ltime, 0); } } @@ -617,16 +617,16 @@ int ipv6_net_if_add_addr(int if_id, const ipv6_addr_t *addr, return 0; } -ipv6_net_if_hit_t *ipv6_net_if_addr_match(ipv6_net_if_hit_t *hit, - const ipv6_addr_t *addr) +ipv6_legacy_net_if_hit_t *ipv6_legacy_net_if_addr_match(ipv6_legacy_net_if_hit_t *hit, + const ipv6_legacy_addr_t *addr) { int if_id = -1; - ipv6_net_if_addr_t *addr_entry = NULL; + ipv6_legacy_net_if_addr_t *addr_entry = NULL; while ((if_id = net_if_iter_interfaces(if_id)) >= 0) { while (net_if_iter_addresses(if_id, (net_if_addr_t **) &addr_entry) != NULL) { - if (addr_entry->addr_protocol & NET_IF_L3P_IPV6) { + if (addr_entry->addr_protocol & NET_IF_L3P_IPV6_LEGACY) { uint8_t byte_al = addr_entry->addr_len / 8; uint8_t mask[] = { 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe @@ -649,16 +649,16 @@ ipv6_net_if_hit_t *ipv6_net_if_addr_match(ipv6_net_if_hit_t *hit, return NULL; } -ipv6_net_if_hit_t *ipv6_net_if_addr_prefix_eq(ipv6_net_if_hit_t *hit, - ipv6_addr_t *addr) +ipv6_legacy_net_if_hit_t *ipv6_legacy_net_if_addr_prefix_eq(ipv6_legacy_net_if_hit_t *hit, + ipv6_legacy_addr_t *addr) { int if_id = -1; - ipv6_net_if_addr_t *addr_entry = NULL; + ipv6_legacy_net_if_addr_t *addr_entry = NULL; while ((if_id = net_if_iter_interfaces(if_id)) >= 0) { while (net_if_iter_addresses(if_id, (net_if_addr_t **) &addr_entry) != NULL) { - if (addr_entry->addr_protocol & NET_IF_L3P_IPV6) { + if (addr_entry->addr_protocol & NET_IF_L3P_IPV6_LEGACY) { if (memcmp(addr_entry->addr_data, &addr, 8) == 0) { hit->if_id = if_id; hit->addr = addr_entry; @@ -671,11 +671,11 @@ ipv6_net_if_hit_t *ipv6_net_if_addr_prefix_eq(ipv6_net_if_hit_t *hit, return NULL; } -/* TODO ipv6_net_if_hit_t returning function similar wrapping - * ipv6_net_if_get_best_src_addr() to search on all interfaces */ +/* TODO ipv6_legacy_net_if_hit_t returning function similar wrapping + * ipv6_legacy_net_if_get_best_src_addr() to search on all interfaces */ -ipv6_addr_t *ipv6_addr_set_by_eui64(ipv6_addr_t *out, int if_id, - const ipv6_addr_t *prefix) +ipv6_legacy_addr_t *ipv6_legacy_addr_set_by_eui64(ipv6_legacy_addr_t *out, int if_id, + const ipv6_legacy_addr_t *prefix) { uint8_t force_generation = 0; out->uint16[0] = prefix->uint16[0]; @@ -689,9 +689,9 @@ ipv6_addr_t *ipv6_addr_set_by_eui64(ipv6_addr_t *out, int if_id, if (net_if_get_eui64((net_if_eui64_t *) &out->uint8[8], if_id, force_generation)) { -#ifdef MODULE_SIXLOWPAN +#ifdef MODULE_SIXLOWPAN_LEGACY - if (!sixlowpan_lowpan_eui64_to_short_addr((net_if_eui64_t *)&out->uint8[8])) { + if (!sixlowpan_legacy_lowpan_eui64_to_short_addr((net_if_eui64_t *)&out->uint8[8])) { out->uint8[8] ^= 0x02; } @@ -705,7 +705,7 @@ ipv6_addr_t *ipv6_addr_set_by_eui64(ipv6_addr_t *out, int if_id, } } -void ipv6_addr_init_prefix(ipv6_addr_t *out, const ipv6_addr_t *prefix, +void ipv6_legacy_addr_init_prefix(ipv6_legacy_addr_t *out, const ipv6_legacy_addr_t *prefix, uint8_t bits) { if (bits > 128) { @@ -730,24 +730,24 @@ void ipv6_addr_init_prefix(ipv6_addr_t *out, const ipv6_addr_t *prefix, memset(&(out[bytes + 1]), 0, 15 - bytes); } -void ipv6_net_if_get_best_src_addr(ipv6_addr_t *src, const ipv6_addr_t *dest) +void ipv6_legacy_net_if_get_best_src_addr(ipv6_legacy_addr_t *src, const ipv6_legacy_addr_t *dest) { /* try to find best match if dest is not mcast or link local */ int if_id = 0; // TODO: get this somehow - ipv6_net_if_addr_t *addr = NULL; - ipv6_net_if_addr_t *tmp_addr = NULL; + ipv6_legacy_net_if_addr_t *addr = NULL; + ipv6_legacy_net_if_addr_t *tmp_addr = NULL; - if (!(ipv6_addr_is_link_local(dest)) && !(ipv6_addr_is_multicast(dest))) { - while ((addr = (ipv6_net_if_addr_t *) net_if_iter_addresses(if_id, + if (!(ipv6_legacy_addr_is_link_local(dest)) && !(ipv6_legacy_addr_is_multicast(dest))) { + while ((addr = (ipv6_legacy_net_if_addr_t *) net_if_iter_addresses(if_id, (net_if_addr_t **) &addr))) { if (addr->ndp_state == NDP_ADDR_STATE_PREFERRED) { - if (!ipv6_addr_is_link_local(addr->addr_data) - && !ipv6_addr_is_multicast(addr->addr_data) - && !ipv6_addr_is_unique_local_unicast( + if (!ipv6_legacy_addr_is_link_local(addr->addr_data) + && !ipv6_legacy_addr_is_multicast(addr->addr_data) + && !ipv6_legacy_addr_is_unique_local_unicast( addr->addr_data)) { uint8_t bmatch = 0; - uint8_t tmp = ipv6_get_addr_match(dest, addr->addr_data); + uint8_t tmp = ipv6_legacy_get_addr_match(dest, addr->addr_data); if (tmp >= bmatch) { tmp_addr = addr; @@ -757,11 +757,11 @@ void ipv6_net_if_get_best_src_addr(ipv6_addr_t *src, const ipv6_addr_t *dest) } } else { - while ((addr = (ipv6_net_if_addr_t *) net_if_iter_addresses(if_id, + while ((addr = (ipv6_legacy_net_if_addr_t *) net_if_iter_addresses(if_id, (net_if_addr_t **) &addr))) { if (addr->ndp_state == NDP_ADDR_STATE_PREFERRED - && ipv6_addr_is_link_local(addr->addr_data) - && !ipv6_addr_is_multicast(addr->addr_data)) { + && ipv6_legacy_addr_is_link_local(addr->addr_data) + && !ipv6_legacy_addr_is_multicast(addr->addr_data)) { tmp_addr = addr; } } @@ -775,7 +775,7 @@ void ipv6_net_if_get_best_src_addr(ipv6_addr_t *src, const ipv6_addr_t *dest) } } -void ipv6_addr_init(ipv6_addr_t *out, uint16_t addr0, uint16_t addr1, +void ipv6_legacy_addr_init(ipv6_legacy_addr_t *out, uint16_t addr0, uint16_t addr1, uint16_t addr2, uint16_t addr3, uint16_t addr4, uint16_t addr5, uint16_t addr6, uint16_t addr7) { @@ -806,15 +806,15 @@ void set_remaining_time(timex_t *t, uint32_t time) *t = timex_add(now, tmp); } -int ipv6_init_as_router(void) +int ipv6_legacy_init_as_router(void) { - ipv6_addr_t addr; + ipv6_legacy_addr_t addr; int if_id = -1; - ipv6_addr_set_all_routers_addr(&addr); + ipv6_legacy_addr_set_all_routers_addr(&addr); while ((if_id = net_if_iter_interfaces(if_id)) >= 0) { - if (!ipv6_net_if_add_addr(if_id, &addr, NDP_ADDR_STATE_PREFERRED, 0, 0, + if (!ipv6_legacy_net_if_add_addr(if_id, &addr, NDP_ADDR_STATE_PREFERRED, 0, 0, 0)) { return 0; } @@ -823,14 +823,14 @@ int ipv6_init_as_router(void) return 1; } -uint8_t ipv6_is_router(void) +uint8_t ipv6_legacy_is_router(void) { - ipv6_addr_t addr; - ipv6_net_if_hit_t hit; + ipv6_legacy_addr_t addr; + ipv6_legacy_net_if_hit_t hit; - ipv6_addr_set_all_routers_addr(&addr); + ipv6_legacy_addr_set_all_routers_addr(&addr); - if (ipv6_net_if_addr_match(&hit, &addr) != NULL) { + if (ipv6_legacy_net_if_addr_match(&hit, &addr) != NULL) { return 1; } @@ -847,14 +847,14 @@ void set_udp_packet_handler_pid(kernel_pid_t pid) udp_packet_handler_pid = pid; } -void ipv6_register_next_header_handler(uint8_t next_header, kernel_pid_t pid) +void ipv6_legacy_register_next_header_handler(uint8_t next_header, kernel_pid_t pid) { switch (next_header) { - case (IPV6_PROTO_NUM_TCP): + case (IPV6_LEGACY_PROTO_NUM_TCP): set_tcp_packet_handler_pid(pid); break; - case (IPV6_PROTO_NUM_UDP): + case (IPV6_LEGACY_PROTO_NUM_UDP): set_udp_packet_handler_pid(pid); break; @@ -865,38 +865,38 @@ void ipv6_register_next_header_handler(uint8_t next_header, kernel_pid_t pid) } #ifdef MODULE_RPL /* register routing function */ -void ipv6_iface_set_routing_provider(ipv6_addr_t *(*next_hop)(ipv6_addr_t *dest)) +void ipv6_legacy_iface_set_routing_provider(ipv6_legacy_addr_t *(*next_hop)(ipv6_legacy_addr_t *dest)) { ip_get_next_hop = next_hop; } /* register source-routing indicator function */ -void ipv6_iface_set_srh_indicator(uint8_t (*srh_indi)(void)) +void ipv6_legacy_iface_set_srh_indicator(uint8_t (*srh_indi)(void)) { ip_srh_indicator = srh_indi; } /* register rpl-process function */ -void ipv6_register_rpl_handler(kernel_pid_t pid) +void ipv6_legacy_register_rpl_handler(kernel_pid_t pid) { _rpl_process_pid = pid; } #endif -uint16_t ipv6_csum(ipv6_hdr_t *ipv6_header, uint8_t *buf, uint16_t len, +uint16_t ipv6_legacy_csum(ipv6_legacy_hdr_t *ipv6_legacy_header, uint8_t *buf, uint16_t len, uint8_t proto) { uint16_t sum = 0; DEBUG("Calculate checksum over src: %s, dst: %s, len: %04X, buf: %p, proto: %u\n", - ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, - &ipv6_header->srcaddr), - ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, - &ipv6_header->destaddr), + ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, + &ipv6_legacy_header->srcaddr), + ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, + &ipv6_legacy_header->destaddr), len, buf, proto); sum = len + proto; - sum = net_help_csum(sum, (uint8_t *) &ipv6_header->srcaddr, - 2 * sizeof(ipv6_addr_t)); + sum = net_help_csum(sum, (uint8_t *) &ipv6_legacy_header->srcaddr, + 2 * sizeof(ipv6_legacy_addr_t)); sum = net_help_csum(sum, buf, len); return (sum == 0) ? 0xffff : HTONS(sum); } diff --git a/sys/net/network_layer/sixlowpan/ip.h b/sys/net/network_layer/sixlowpan_legacy/ip.h similarity index 69% rename from sys/net/network_layer/sixlowpan/ip.h rename to sys/net/network_layer/sixlowpan_legacy/ip.h index 895917a772dcb..21a18e68d7737 100644 --- a/sys/net/network_layer/sixlowpan/ip.h +++ b/sys/net/network_layer/sixlowpan_legacy/ip.h @@ -7,7 +7,7 @@ * General Public License v2.1. See the file LICENSE in the top level * directory for more details. * - * @ingroup sixlowpan + * @ingroup sixlowpan_legacy * @{ * @file sixlowip.h * @brief 6lowpan IP layer header @@ -20,8 +20,8 @@ /* 6LoWPAN IP header file */ -#ifndef _SIXLOWPAN_IP_H -#define _SIXLOWPAN_IP_H +#ifndef _SIXLOWPAN_LEGACY_IP_H +#define _SIXLOWPAN_LEGACY_IP_H #include @@ -30,17 +30,17 @@ #include "mutex.h" #include "net_if.h" -#include "sixlowpan/ip.h" -#include "sixlowpan/types.h" +#include "sixlowpan_legacy/ip.h" +#include "sixlowpan_legacy/types.h" #ifdef __cplusplus extern "C" { #endif /* IPv6 field values */ -#define IPV6_VER (0x60) +#define IPV6_LEGACY_VER (0x60) /* size of global buffer */ -#define BUFFER_SIZE (LL_HDR_LEN + IPV6_MTU) +#define BUFFER_SIZE (LL_HDR_LEN + IPV6_LEGACY_MTU) #define MULTIHOP_HOPLIMIT (64) @@ -48,7 +48,7 @@ extern "C" { #define IP_PROCESS_STACKSIZE (KERNEL_CONF_STACKSIZE_MAIN) /* extern variables */ -extern uint8_t ipv6_ext_hdr_len; +extern uint8_t ipv6_legacy_ext_hdr_len; extern kernel_pid_t ip_process_pid; #ifdef MODULE_RPL @@ -58,9 +58,9 @@ extern int srh_handler_pid; /* base header lengths */ #define LL_HDR_LEN (0x4) #define ICMPV6_HDR_LEN (0x4) -#define IPV6_HDR_LEN (0x28) +#define IPV6_LEGACY_HDR_LEN (0x28) -#define IPV6_NET_IF_ADDR_LIST_LEN (10) // maybe to much +#define IPV6_LEGACY_NET_IF_ADDR_LIST_LEN (10) // maybe to much /* buffer */ extern uint8_t buffer[BUFFER_SIZE]; @@ -73,21 +73,21 @@ typedef struct __attribute__((packed)) struct net_if_addr_t *addr_next; struct net_if_addr_t *addr_prev; net_if_l3p_t addr_protocol; - ipv6_addr_t *addr_data; + ipv6_legacy_addr_t *addr_data; uint8_t addr_len; ndp_addr_state_t ndp_state; timex_t valid_lifetime; timex_t preferred_lifetime; uint8_t is_anycast; } -ipv6_net_if_addr_t; +ipv6_legacy_net_if_addr_t; typedef struct __attribute__((packed)) { - ipv6_net_if_addr_t *addr; + ipv6_legacy_net_if_addr_t *addr; int if_id; } -ipv6_net_if_hit_t; +ipv6_legacy_net_if_hit_t; typedef struct __attribute__((packed)) { @@ -96,20 +96,20 @@ typedef struct __attribute__((packed)) uint32_t adv_reachable_time; uint32_t adv_retrans_timer; } -ipv6_net_if_ext_t; +ipv6_legacy_net_if_ext_t; /* function prototypes */ -ipv6_net_if_ext_t *ipv6_net_if_get_ext(int if_id); +ipv6_legacy_net_if_ext_t *ipv6_legacy_net_if_get_ext(int if_id); icmpv6_hdr_t *get_icmpv6_buf(uint8_t ext_len); uint8_t *get_payload_buf(uint8_t ext_len); uint8_t *get_payload_buf_send(uint8_t ext_len); int icmpv6_demultiplex(const icmpv6_hdr_t *hdr); -int ipv6_init_as_router(void); -void *ipv6_process(void *); -ipv6_net_if_hit_t *ipv6_net_if_addr_prefix_eq(ipv6_net_if_hit_t *hit, ipv6_addr_t *addr); -ipv6_net_if_hit_t *ipv6_net_if_addr_match(ipv6_net_if_hit_t *hit, const ipv6_addr_t *addr); +int ipv6_legacy_init_as_router(void); +void *ipv6_legacy_process(void *); +ipv6_legacy_net_if_hit_t *ipv6_legacy_net_if_addr_prefix_eq(ipv6_legacy_net_if_hit_t *hit, ipv6_legacy_addr_t *addr); +ipv6_legacy_net_if_hit_t *ipv6_legacy_net_if_addr_match(ipv6_legacy_net_if_hit_t *hit, const ipv6_legacy_addr_t *addr); uint32_t get_remaining_time(timex_t *t); void set_remaining_time(timex_t *t, uint32_t time); @@ -117,4 +117,4 @@ void set_remaining_time(timex_t *t, uint32_t time); } #endif -#endif /* _SIXLOWPAN_IP_H*/ +#endif /* _SIXLOWPAN_LEGACY_IP_H*/ diff --git a/sys/net/network_layer/sixlowpan/lowpan.c b/sys/net/network_layer/sixlowpan_legacy/lowpan.c similarity index 67% rename from sys/net/network_layer/sixlowpan/lowpan.c rename to sys/net/network_layer/sixlowpan_legacy/lowpan.c index e79d5b1e256dd..298c701d5f80f 100644 --- a/sys/net/network_layer/sixlowpan/lowpan.c +++ b/sys/net/network_layer/sixlowpan_legacy/lowpan.c @@ -7,9 +7,9 @@ * General Public License v2.1. See the file LICENSE in the top level * directory for more details. * - * @ingroup sixlowpan + * @ingroup sixlowpan_legacy * @{ - * @file sixlowpan.c + * @file sixlowpan_legacy.c * @brief 6lowpan functions * @author Stephan Zeisberg * @author Martin Lenders @@ -32,8 +32,8 @@ #include "hwtimer.h" #include "msg.h" #include "transceiver.h" -#include "sixlowpan/mac.h" -#include "sixlowpan/ndp.h" +#include "sixlowpan_legacy/mac.h" +#include "sixlowpan_legacy/ndp.h" #include "lowpan.h" #ifdef MODULE_SIXLOWBORDER @@ -49,21 +49,21 @@ #define ENABLE_DEBUG (0) #if ENABLE_DEBUG #define DEBUG_ENABLED -char addr_str[IPV6_MAX_ADDR_STR_LEN]; +char addr_str[IPV6_LEGACY_MAX_ADDR_STR_LEN]; #endif #include "debug.h" #define CON_STACKSIZE (KERNEL_CONF_STACKSIZE_DEFAULT) #define LOWPAN_TRANSFER_BUF_STACKSIZE (KERNEL_CONF_STACKSIZE_DEFAULT) -#define SIXLOWPAN_MAX_REGISTERED (4) +#define SIXLOWPAN_LEGACY_MAX_REGISTERED (4) #define LOWPAN_REAS_BUF_TIMEOUT (15 * 1000 * 1000) /* TODO: Set back to 3 * 1000 * (1000) */ -#define IPV6_LL_ADDR_LEN (8) +#define IPV6_LEGACY_LL_ADDR_LEN (8) -#define SIXLOWPAN_FRAG_HDR_MASK (0xf8) +#define SIXLOWPAN_LEGACY_FRAG_HDR_MASK (0xf8) typedef struct lowpan_interval_list_t { uint8_t start; @@ -110,8 +110,8 @@ uint8_t max_frag_initial = 0; uint8_t max_frag; static uint16_t packet_length; -static sixlowpan_lowpan_iphc_status_t iphc_status = LOWPAN_IPHC_ENABLE; -static ipv6_hdr_t *ipv6_buf; +static sixlowpan_legacy_lowpan_iphc_status_t iphc_status = LOWPAN_IPHC_ENABLE; +static ipv6_legacy_hdr_t *ipv6_legacy_buf; static lowpan_reas_buf_t *head = NULL; static lowpan_reas_buf_t *packet_fifo = NULL; @@ -131,8 +131,8 @@ kernel_pid_t transfer_pid = KERNEL_PID_UNDEF; mutex_t lowpan_context_mutex = MUTEX_INIT; /* registered upper layer threads */ -kernel_pid_t sixlowpan_reg[SIXLOWPAN_MAX_REGISTERED]; -static sixlowpan_lowpan_frame_t current_frame; +kernel_pid_t sixlowpan_legacy_reg[SIXLOWPAN_LEGACY_MAX_REGISTERED]; +static sixlowpan_legacy_lowpan_frame_t current_frame; char ip_process_buf[IP_PROCESS_STACKSIZE]; char con_buf[CON_STACKSIZE]; @@ -143,7 +143,7 @@ uint16_t local_address = 0; int lowpan_init(int as_border); uint8_t lowpan_iphc_encoding(int if_id, const uint8_t *dest, int dest_len, - ipv6_hdr_t *ipv6_buf_extra, uint8_t *ptr); + ipv6_legacy_hdr_t *ipv6_legacy_buf_extra, uint8_t *ptr); void lowpan_iphc_decoding(uint8_t *data, uint8_t length, net_if_eui64_t *s_addr, net_if_eui64_t *d_addr); void add_fifo_packet(lowpan_reas_buf_t *current_packet); @@ -153,24 +153,24 @@ void init_reas_bufs(lowpan_reas_buf_t *buf); void check_timeout(void); void print_long_local_addr(net_if_eui64_t *saddr); -lowpan_context_t *lowpan_context_lookup(ipv6_addr_t *addr); +lowpan_context_t *lowpan_context_lookup(ipv6_legacy_addr_t *addr); /* deliver packet to mac*/ -int sixlowpan_lowpan_sendto(int if_id, const void *dest, int dest_len, +int sixlowpan_legacy_lowpan_sendto(int if_id, const void *dest, int dest_len, uint8_t *data, uint16_t data_len) { uint8_t mcast = 0; - ipv6_buf = (ipv6_hdr_t *) data; + ipv6_legacy_buf = (ipv6_legacy_hdr_t *) data; uint16_t send_packet_length = data_len; - if (ipv6_addr_is_multicast(&ipv6_buf->destaddr)) { + if (ipv6_legacy_addr_is_multicast(&ipv6_legacy_buf->destaddr)) { /* send broadcast */ mcast = 1; } /* check if packet needs to be fragmented */ - DEBUG("sixlowpan_lowpan_sendto(%d, dest, %d, data, %"PRIu16")\n", + DEBUG("sixlowpan_legacy_lowpan_sendto(%d, dest, %d, data, %"PRIu16")\n", if_id, dest_len, data_len); #ifdef DEBUG_ENABLED DEBUG("dest: "); @@ -196,7 +196,7 @@ int sixlowpan_lowpan_sendto(int if_id, const void *dest, int dest_len, if (iphc_status == LOWPAN_IPHC_ENABLE) { - if (!lowpan_iphc_encoding(if_id, dest, dest_len, ipv6_buf, data)) { + if (!lowpan_iphc_encoding(if_id, dest, dest_len, ipv6_legacy_buf, data)) { return -1; } @@ -205,7 +205,7 @@ int sixlowpan_lowpan_sendto(int if_id, const void *dest, int dest_len, } else { memmove(data + 1, data, data_len); - data[0] = SIXLOWPAN_IPV6_DISPATCH; + data[0] = SIXLOWPAN_LEGACY_IPV6_LEGACY_DISPATCH; send_packet_length++; } @@ -226,7 +226,7 @@ int sixlowpan_lowpan_sendto(int if_id, const void *dest, int dest_len, /* first fragment */ max_frag_initial = ((max_frame - 4) / 8) * 8; - if (data[0] == (char)SIXLOWPAN_IPV6_DISPATCH) { + if (data[0] == (char)SIXLOWPAN_LEGACY_IPV6_LEGACY_DISPATCH) { /* XXX: weird, but only this way we get correct packet output */ max_frag_initial++; datagram_size--; @@ -234,12 +234,12 @@ int sixlowpan_lowpan_sendto(int if_id, const void *dest, int dest_len, memcpy(&fragbuf[4], data, max_frag_initial); - fragbuf[0] = ((SIXLOWPAN_FRAG1_DISPATCH << 8) | datagram_size) >> 8; - fragbuf[1] = (SIXLOWPAN_FRAG1_DISPATCH << 8) | datagram_size; + fragbuf[0] = ((SIXLOWPAN_LEGACY_FRAG1_DISPATCH << 8) | datagram_size) >> 8; + fragbuf[1] = (SIXLOWPAN_LEGACY_FRAG1_DISPATCH << 8) | datagram_size; fragbuf[2] = tag >> 8; fragbuf[3] = tag; - sixlowpan_mac_send_ieee802154_frame(if_id, dest, dest_len, + sixlowpan_legacy_mac_send_ieee802154_frame(if_id, dest, dest_len, &fragbuf, max_frag_initial + 4, mcast); @@ -254,13 +254,13 @@ int sixlowpan_lowpan_sendto(int if_id, const void *dest, int dest_len, memset(&fragbuf[0], 0, sizeof(fragbuf)); memcpy(&fragbuf[5], data, max_frag); - fragbuf[0] = ((SIXLOWPAN_FRAGN_DISPATCH << 8) | datagram_size) >> 8; - fragbuf[1] = (SIXLOWPAN_FRAGN_DISPATCH << 8) | datagram_size; + fragbuf[0] = ((SIXLOWPAN_LEGACY_FRAGN_DISPATCH << 8) | datagram_size) >> 8; + fragbuf[1] = (SIXLOWPAN_LEGACY_FRAGN_DISPATCH << 8) | datagram_size; fragbuf[2] = tag >> 8; fragbuf[3] = tag; fragbuf[4] = position / 8; - sixlowpan_mac_send_ieee802154_frame(if_id, dest, dest_len, + sixlowpan_legacy_mac_send_ieee802154_frame(if_id, dest, dest_len, &fragbuf, max_frag + 5, mcast); data += max_frag; @@ -272,29 +272,29 @@ int sixlowpan_lowpan_sendto(int if_id, const void *dest, int dest_len, memset(&fragbuf[0], 0, sizeof(fragbuf)); memcpy(&fragbuf[5], data, remaining); - fragbuf[0] = ((SIXLOWPAN_FRAGN_DISPATCH << 8) | datagram_size) >> 8; - fragbuf[1] = (SIXLOWPAN_FRAGN_DISPATCH << 8) | datagram_size; + fragbuf[0] = ((SIXLOWPAN_LEGACY_FRAGN_DISPATCH << 8) | datagram_size) >> 8; + fragbuf[1] = (SIXLOWPAN_LEGACY_FRAGN_DISPATCH << 8) | datagram_size; fragbuf[2] = tag >> 8; fragbuf[3] = tag; fragbuf[4] = position / 8; tag++; - if (sixlowpan_mac_send_ieee802154_frame(if_id, dest, dest_len, + if (sixlowpan_legacy_mac_send_ieee802154_frame(if_id, dest, dest_len, &fragbuf, remaining + 5, mcast) < 0) { return -1; } } else { - return sixlowpan_mac_send_ieee802154_frame(if_id, dest, dest_len, data, + return sixlowpan_legacy_mac_send_ieee802154_frame(if_id, dest, dest_len, data, send_packet_length, mcast); } return data_len; } -void sixlowpan_lowpan_set_iphc_status( - sixlowpan_lowpan_iphc_status_t status) +void sixlowpan_legacy_lowpan_set_iphc_status( + sixlowpan_legacy_lowpan_iphc_status_t status) { iphc_status = status; } @@ -308,7 +308,7 @@ void print_long_local_addr(net_if_eui64_t *saddr) ((uint8_t *)saddr)[6], ((uint8_t *)saddr)[7]); } -void sixlowpan_lowpan_print_reassembly_buffers(void) +void sixlowpan_legacy_lowpan_print_reassembly_buffers(void) { lowpan_reas_buf_t *temp_buffer; lowpan_interval_list_t *temp_interval; @@ -332,7 +332,7 @@ void sixlowpan_lowpan_print_reassembly_buffers(void) } } -void sixlowpan_lowpan_print_fifo_buffers(void) +void sixlowpan_legacy_lowpan_print_fifo_buffers(void) { lowpan_reas_buf_t *temp_buffer; lowpan_interval_list_t *temp_interval; @@ -362,7 +362,7 @@ static void *lowpan_transfer(void *arg) (void) arg; msg_t m_recv, m_send; - ipv6_hdr_t *ipv6_buf; + ipv6_legacy_hdr_t *ipv6_legacy_buf; lowpan_reas_buf_t *current_buf; while (1) { @@ -373,24 +373,24 @@ static void *lowpan_transfer(void *arg) if (current_buf != NULL) { mutex_unlock(&fifo_mutex); - if (current_buf->packet[0] == SIXLOWPAN_IPV6_DISPATCH) { + if (current_buf->packet[0] == SIXLOWPAN_LEGACY_IPV6_LEGACY_DISPATCH) { DEBUG("INFO: Uncompressed IPv6 dispatch (0x%02x) received\n", current_buf->packet[0]); - ipv6_buf = ipv6_get_buf(); - memcpy(ipv6_buf, (current_buf->packet) + 1, current_buf->packet_size - 1); - m_send.content.ptr = (char *)ipv6_buf; + ipv6_legacy_buf = ipv6_legacy_get_buf(); + memcpy(ipv6_legacy_buf, (current_buf->packet) + 1, current_buf->packet_size - 1); + m_send.content.ptr = (char *)ipv6_legacy_buf; packet_length = current_buf->packet_size - 1; msg_send_receive(&m_send, &m_recv, ip_process_pid); } - else if (((current_buf->packet[0] & 0xf0) == IPV6_VER) && + else if (((current_buf->packet[0] & 0xf0) == IPV6_LEGACY_VER) && (iphc_status == LOWPAN_IPHC_DISABLE)) { - ipv6_buf = ipv6_get_buf(); - memcpy(ipv6_buf, (current_buf->packet), current_buf->packet_size); - m_send.content.ptr = (char *)ipv6_buf; + ipv6_legacy_buf = ipv6_legacy_get_buf(); + memcpy(ipv6_legacy_buf, (current_buf->packet), current_buf->packet_size); + m_send.content.ptr = (char *)ipv6_legacy_buf; packet_length = current_buf->packet_size; msg_send_receive(&m_send, &m_recv, ip_process_pid); } - else if (((current_buf->packet[0] & 0xe0) == SIXLOWPAN_IPHC1_DISPATCH) && + else if (((current_buf->packet[0] & 0xe0) == SIXLOWPAN_LEGACY_IPHC1_DISPATCH) && (iphc_status == LOWPAN_IPHC_ENABLE)) { DEBUG("INFO: IPHC1 dispatch 0x%02x received, decompress\n", current_buf->packet[0]); @@ -399,8 +399,8 @@ static void *lowpan_transfer(void *arg) &(current_buf->s_addr), &(current_buf->d_addr)); - ipv6_buf = ipv6_get_buf(); - m_send.content.ptr = (char *) ipv6_buf; + ipv6_legacy_buf = ipv6_legacy_get_buf(); + m_send.content.ptr = (char *) ipv6_legacy_buf; msg_send_receive(&m_send, &m_recv, ip_process_pid); } else { @@ -763,20 +763,20 @@ void add_fifo_packet(lowpan_reas_buf_t *current_packet) } /* Register an upper layer thread */ -uint8_t sixlowpan_lowpan_register(kernel_pid_t pid) +uint8_t sixlowpan_legacy_lowpan_register(kernel_pid_t pid) { uint8_t i; - for (i = 0; (((i < SIXLOWPAN_MAX_REGISTERED) && sixlowpan_reg[i] != pid) && - (sixlowpan_reg[i] != 0)); i++) { + for (i = 0; (((i < SIXLOWPAN_LEGACY_MAX_REGISTERED) && sixlowpan_legacy_reg[i] != pid) && + (sixlowpan_legacy_reg[i] != 0)); i++) { ; } - if (i >= SIXLOWPAN_MAX_REGISTERED) { + if (i >= SIXLOWPAN_LEGACY_MAX_REGISTERED) { return ENOMEM; } else { - sixlowpan_reg[i] = pid; + sixlowpan_legacy_reg[i] = pid; return 1; } } @@ -789,40 +789,40 @@ void lowpan_read(uint8_t *data, uint8_t length, net_if_eui64_t *s_addr, check_timeout(); - for (i = 0; i < SIXLOWPAN_MAX_REGISTERED; i++) { - if (sixlowpan_reg[i]) { + for (i = 0; i < SIXLOWPAN_LEGACY_MAX_REGISTERED; i++) { + if (sixlowpan_legacy_reg[i]) { msg_t m_send; m_send.type = LOWPAN_FRAME_RECEIVED;; current_frame.length = length; current_frame.data = data; m_send.content.ptr = (char *) ¤t_frame; - msg_send(&m_send, sixlowpan_reg[i]); + msg_send(&m_send, sixlowpan_legacy_reg[i]); } } /* Fragmented Packet */ - if (((data[0] & SIXLOWPAN_FRAG_HDR_MASK) == SIXLOWPAN_FRAG1_DISPATCH) || - ((data[0] & SIXLOWPAN_FRAG_HDR_MASK) == SIXLOWPAN_FRAGN_DISPATCH)) { + if (((data[0] & SIXLOWPAN_LEGACY_FRAG_HDR_MASK) == SIXLOWPAN_LEGACY_FRAG1_DISPATCH) || + ((data[0] & SIXLOWPAN_LEGACY_FRAG_HDR_MASK) == SIXLOWPAN_LEGACY_FRAGN_DISPATCH)) { uint8_t hdr_length = 0; uint8_t datagram_offset = 0; uint16_t datagram_size = 0; uint16_t datagram_tag = 0; uint16_t byte_offset; DEBUG("INFO: fragmentation dispatch 0x%02x received\n", - data[0] & SIXLOWPAN_FRAG_HDR_MASK); + data[0] & SIXLOWPAN_LEGACY_FRAG_HDR_MASK); /* get 11-bit from first 2 byte*/ datagram_size = (((uint16_t)(data[0] << 8)) | data[1]) & 0x07ff; /* get 16-bit datagram tag */ datagram_tag = (((uint16_t)(data[2] << 8)) | data[3]); - switch (data[0] & SIXLOWPAN_FRAG_HDR_MASK) { + switch (data[0] & SIXLOWPAN_LEGACY_FRAG_HDR_MASK) { /* First Fragment */ - case (SIXLOWPAN_FRAG1_DISPATCH): { + case (SIXLOWPAN_LEGACY_FRAG1_DISPATCH): { datagram_offset = 0; hdr_length += 4; - if (data[4] == (char)SIXLOWPAN_IPV6_DISPATCH) { + if (data[4] == (char)SIXLOWPAN_LEGACY_IPV6_LEGACY_DISPATCH) { hdr_length++; } @@ -830,7 +830,7 @@ void lowpan_read(uint8_t *data, uint8_t length, net_if_eui64_t *s_addr, } /* Subsequent Fragment */ - case (SIXLOWPAN_FRAGN_DISPATCH): { + case (SIXLOWPAN_LEGACY_FRAGN_DISPATCH): { datagram_offset = data[4]; hdr_length += 5; break; @@ -877,11 +877,11 @@ void lowpan_read(uint8_t *data, uint8_t length, net_if_eui64_t *s_addr, /* draft-ietf-6lowpan-hc-13#section-3.1 */ uint8_t lowpan_iphc_encoding(int if_id, const uint8_t *dest, int dest_len, - ipv6_hdr_t *ipv6_buf_extra, uint8_t *ptr) + ipv6_legacy_hdr_t *ipv6_legacy_buf_extra, uint8_t *ptr) { - uint16_t payload_length = NTOHS(ipv6_buf->length); + uint16_t payload_length = NTOHS(ipv6_legacy_buf->length); uint8_t lowpan_iphc[2]; - uint8_t *ipv6_hdr_fields = &comp_buf[2]; + uint8_t *ipv6_legacy_hdr_fields = &comp_buf[2]; lowpan_context_t *con = NULL; uint16_t hdr_pos = 0; uint8_t tc; @@ -900,63 +900,63 @@ uint8_t lowpan_iphc_encoding(int if_id, const uint8_t *dest, int dest_len, own_iid.uint8[0] ^= 0x02; } - ipv6_buf = ipv6_buf_extra; + ipv6_legacy_buf = ipv6_legacy_buf_extra; memset(&lowpan_iphc, 0, 2); /* set iphc dispatch */ - lowpan_iphc[0] = SIXLOWPAN_IPHC1_DISPATCH; + lowpan_iphc[0] = SIXLOWPAN_LEGACY_IPHC1_DISPATCH; /* TF: Traffic Class, Flow Label: * first we need to change DSCP and ECN because in 6lowpan-nd-13 these * fields are reverse, the original order is DSCP/ECN (rfc 3168) */ - tc = (ipv6_buf->version_trafficclass << 4) | - (ipv6_buf->trafficclass_flowlabel >> 4); + tc = (ipv6_legacy_buf->version_trafficclass << 4) | + (ipv6_legacy_buf->trafficclass_flowlabel >> 4); tc = (tc >> 2) | (tc << 6); - if ((ipv6_buf->flowlabel == 0) && - (ipv6_buf->trafficclass_flowlabel & 0x0f) == 0) { + if ((ipv6_legacy_buf->flowlabel == 0) && + (ipv6_legacy_buf->trafficclass_flowlabel & 0x0f) == 0) { /* flowlabel is elided */ - lowpan_iphc[0] |= SIXLOWPAN_IPHC1_FL_C; + lowpan_iphc[0] |= SIXLOWPAN_LEGACY_IPHC1_FL_C; - if (((ipv6_buf->version_trafficclass & 0x0f) == 0) && - ((ipv6_buf->trafficclass_flowlabel & 0xf0) == 0)) { + if (((ipv6_legacy_buf->version_trafficclass & 0x0f) == 0) && + ((ipv6_legacy_buf->trafficclass_flowlabel & 0xf0) == 0)) { /* traffic class is elided */ - lowpan_iphc[0] |= SIXLOWPAN_IPHC1_TC_C; + lowpan_iphc[0] |= SIXLOWPAN_LEGACY_IPHC1_TC_C; } else { /* ECN + DSCP (1 byte), Flow Label is elided */ - ipv6_hdr_fields[hdr_pos] = tc; + ipv6_legacy_hdr_fields[hdr_pos] = tc; hdr_pos++; } } else { /* flowlabel not compressible */ - if (((ipv6_buf->version_trafficclass & 0x0f) == 0) && - ((ipv6_buf->trafficclass_flowlabel & 0xf0) == 0)) { + if (((ipv6_legacy_buf->version_trafficclass & 0x0f) == 0) && + ((ipv6_legacy_buf->trafficclass_flowlabel & 0xf0) == 0)) { /* traffic class is elided */ - lowpan_iphc[0] |= SIXLOWPAN_IPHC1_TC_C; + lowpan_iphc[0] |= SIXLOWPAN_LEGACY_IPHC1_TC_C; /* ECN + 2-bit Pad + Flow Label (3 bytes), DSCP is elided */ - ipv6_hdr_fields[hdr_pos] = ((tc & 0xc0) | - (ipv6_buf->trafficclass_flowlabel & 0x0f)); - memcpy(&(ipv6_hdr_fields[hdr_pos]), &ipv6_buf->flowlabel , 2); + ipv6_legacy_hdr_fields[hdr_pos] = ((tc & 0xc0) | + (ipv6_legacy_buf->trafficclass_flowlabel & 0x0f)); + memcpy(&(ipv6_legacy_hdr_fields[hdr_pos]), &ipv6_legacy_buf->flowlabel , 2); hdr_pos += 3; } else { /* ECN + DSCP + 4-bit Pad + Flow Label (4 bytes) */ - memcpy(&ipv6_hdr_fields[hdr_pos], &ipv6_buf->version_trafficclass, 4); - ipv6_hdr_fields[hdr_pos] = tc; + memcpy(&ipv6_legacy_hdr_fields[hdr_pos], &ipv6_legacy_buf->version_trafficclass, 4); + ipv6_legacy_hdr_fields[hdr_pos] = tc; hdr_pos += 4; } } /* NH: Next Header: * TODO: NHC */ - ipv6_hdr_fields[hdr_pos] = ipv6_buf->nextheader; + ipv6_legacy_hdr_fields[hdr_pos] = ipv6_legacy_buf->nextheader; hdr_pos++; /* HLIM: Hop Limit: */ - switch (ipv6_buf->hoplimit) { + switch (ipv6_legacy_buf->hoplimit) { case (1): { /* 01: The Hop Limit field is compressed and the hop limit is 1. */ lowpan_iphc[0] |= 0x01; @@ -976,7 +976,7 @@ uint8_t lowpan_iphc_encoding(int if_id, const uint8_t *dest, int dest_len, } default: { - ipv6_hdr_fields[hdr_pos] = ipv6_buf->hoplimit; + ipv6_legacy_hdr_fields[hdr_pos] = ipv6_legacy_buf->hoplimit; hdr_pos++; break; } @@ -985,47 +985,47 @@ uint8_t lowpan_iphc_encoding(int if_id, const uint8_t *dest, int dest_len, mutex_lock(&lowpan_context_mutex); /* CID: Context Identifier Extension: */ - if ((lowpan_context_lookup(&ipv6_buf->srcaddr) != NULL) || - (lowpan_context_lookup(&ipv6_buf->destaddr) != NULL)) { - lowpan_iphc[1] |= SIXLOWPAN_IPHC2_CID; - memmove(&ipv6_hdr_fields[1], &ipv6_hdr_fields[0], hdr_pos); + if ((lowpan_context_lookup(&ipv6_legacy_buf->srcaddr) != NULL) || + (lowpan_context_lookup(&ipv6_legacy_buf->destaddr) != NULL)) { + lowpan_iphc[1] |= SIXLOWPAN_LEGACY_IPHC2_CID; + memmove(&ipv6_legacy_hdr_fields[1], &ipv6_legacy_hdr_fields[0], hdr_pos); hdr_pos++; } /* SAC: Source Address Compression */ - if (ipv6_addr_is_unspecified(&(ipv6_buf->srcaddr))) { + if (ipv6_legacy_addr_is_unspecified(&(ipv6_legacy_buf->srcaddr))) { /* SAC = 1 and SAM = 00 */ - lowpan_iphc[1] |= SIXLOWPAN_IPHC2_SAC; + lowpan_iphc[1] |= SIXLOWPAN_LEGACY_IPHC2_SAC; } else { - if ((con = lowpan_context_lookup(&ipv6_buf->srcaddr)) != NULL) { + if ((con = lowpan_context_lookup(&ipv6_legacy_buf->srcaddr)) != NULL) { /* 1: Source address compression uses stateful, context-based * compression. */ - lowpan_iphc[1] |= SIXLOWPAN_IPHC2_SAC; - ipv6_hdr_fields[0] |= (con->num << 4); + lowpan_iphc[1] |= SIXLOWPAN_LEGACY_IPHC2_SAC; + ipv6_legacy_hdr_fields[0] |= (con->num << 4); } - if (con || ipv6_addr_is_link_local(&ipv6_buf->srcaddr)) { + if (con || ipv6_legacy_addr_is_link_local(&ipv6_legacy_buf->srcaddr)) { /* 0: Source address compression uses stateless compression.*/ - if (memcmp(&(ipv6_buf->srcaddr.uint8[8]), &own_iid, 8) == 0) { + if (memcmp(&(ipv6_legacy_buf->srcaddr.uint8[8]), &own_iid, 8) == 0) { /* 0 bits. The address is derived using context information * and possibly the link-layer addresses.*/ lowpan_iphc[1] |= 0x30; } - else if ((ipv6_buf->srcaddr.uint16[4] == 0) && - (ipv6_buf->srcaddr.uint16[5] == 0) && - (ipv6_buf->srcaddr.uint16[6] == 0) && - ((ipv6_buf->srcaddr.uint8[14]) & 0x80) == 0) { + else if ((ipv6_legacy_buf->srcaddr.uint16[4] == 0) && + (ipv6_legacy_buf->srcaddr.uint16[5] == 0) && + (ipv6_legacy_buf->srcaddr.uint16[6] == 0) && + ((ipv6_legacy_buf->srcaddr.uint8[14]) & 0x80) == 0) { /* 49-bit of interface identifier are 0, so we can compress * source address-iid to 16-bit */ - memcpy(&ipv6_hdr_fields[hdr_pos], &ipv6_buf->srcaddr.uint16[7], 2); + memcpy(&ipv6_legacy_hdr_fields[hdr_pos], &ipv6_legacy_buf->srcaddr.uint16[7], 2); hdr_pos += 2; /* 16 bits. The address is derived using context information * and the 16 bits carried inline. */ lowpan_iphc[1] |= 0x20; } else { - memcpy(&ipv6_hdr_fields[hdr_pos], &(ipv6_buf->srcaddr.uint16[4]), 8); + memcpy(&ipv6_legacy_hdr_fields[hdr_pos], &(ipv6_legacy_buf->srcaddr.uint16[4]), 8); hdr_pos += 8; /* 64 bits. The address is derived using context information * and the 64 bits carried inline. */ @@ -1034,102 +1034,102 @@ uint8_t lowpan_iphc_encoding(int if_id, const uint8_t *dest, int dest_len, } else { /* full address carried inline */ - memcpy(&ipv6_hdr_fields[hdr_pos], &(ipv6_buf->srcaddr.uint8[0]), 16); + memcpy(&ipv6_legacy_hdr_fields[hdr_pos], &(ipv6_legacy_buf->srcaddr.uint8[0]), 16); hdr_pos += 16; } } /* M: Multicast Compression */ - if (ipv6_addr_is_multicast(&ipv6_buf->destaddr)) { + if (ipv6_legacy_addr_is_multicast(&ipv6_legacy_buf->destaddr)) { /* 1: Destination address is a multicast address. */ - lowpan_iphc[1] |= SIXLOWPAN_IPHC2_M; + lowpan_iphc[1] |= SIXLOWPAN_LEGACY_IPHC2_M; /* just another cool if condition */ - if ((ipv6_buf->destaddr.uint8[1] == 2) && - (ipv6_buf->destaddr.uint16[1] == 0) && - (ipv6_buf->destaddr.uint16[2] == 0) && - (ipv6_buf->destaddr.uint16[3] == 0) && - (ipv6_buf->destaddr.uint16[4] == 0) && - (ipv6_buf->destaddr.uint16[5] == 0) && - (ipv6_buf->destaddr.uint16[6] == 0) && - (ipv6_buf->destaddr.uint8[14] == 0)) { + if ((ipv6_legacy_buf->destaddr.uint8[1] == 2) && + (ipv6_legacy_buf->destaddr.uint16[1] == 0) && + (ipv6_legacy_buf->destaddr.uint16[2] == 0) && + (ipv6_legacy_buf->destaddr.uint16[3] == 0) && + (ipv6_legacy_buf->destaddr.uint16[4] == 0) && + (ipv6_legacy_buf->destaddr.uint16[5] == 0) && + (ipv6_legacy_buf->destaddr.uint16[6] == 0) && + (ipv6_legacy_buf->destaddr.uint8[14] == 0)) { /* 11: 8 bits. The address takes the form FF02::00XX. */ lowpan_iphc[1] |= 0x03; - ipv6_hdr_fields[hdr_pos] = ipv6_buf->destaddr.uint8[15]; + ipv6_legacy_hdr_fields[hdr_pos] = ipv6_legacy_buf->destaddr.uint8[15]; hdr_pos++; } - else if ((ipv6_buf->destaddr.uint16[1] == 0) && - (ipv6_buf->destaddr.uint16[2] == 0) && - (ipv6_buf->destaddr.uint16[3] == 0) && - (ipv6_buf->destaddr.uint16[4] == 0) && - (ipv6_buf->destaddr.uint16[5] == 0) && - (ipv6_buf->destaddr.uint8[12] == 0)) { + else if ((ipv6_legacy_buf->destaddr.uint16[1] == 0) && + (ipv6_legacy_buf->destaddr.uint16[2] == 0) && + (ipv6_legacy_buf->destaddr.uint16[3] == 0) && + (ipv6_legacy_buf->destaddr.uint16[4] == 0) && + (ipv6_legacy_buf->destaddr.uint16[5] == 0) && + (ipv6_legacy_buf->destaddr.uint8[12] == 0)) { /* 10: 32 bits. The address takes the form FFXX::00XX:XXXX. */ lowpan_iphc[1] |= 0x02; /* copy second and last 3 byte */ - ipv6_hdr_fields[hdr_pos] = ipv6_buf->destaddr.uint8[1]; + ipv6_legacy_hdr_fields[hdr_pos] = ipv6_legacy_buf->destaddr.uint8[1]; hdr_pos++; - memcpy(&ipv6_hdr_fields[hdr_pos], &ipv6_buf->destaddr.uint8[13], 3); + memcpy(&ipv6_legacy_hdr_fields[hdr_pos], &ipv6_legacy_buf->destaddr.uint8[13], 3); hdr_pos += 3; } - else if ((ipv6_buf->destaddr.uint16[1] == 0) && - (ipv6_buf->destaddr.uint16[2] == 0) && - (ipv6_buf->destaddr.uint16[3] == 0) && - (ipv6_buf->destaddr.uint16[4] == 0) && - (ipv6_buf->destaddr.uint8[10] == 0)) { + else if ((ipv6_legacy_buf->destaddr.uint16[1] == 0) && + (ipv6_legacy_buf->destaddr.uint16[2] == 0) && + (ipv6_legacy_buf->destaddr.uint16[3] == 0) && + (ipv6_legacy_buf->destaddr.uint16[4] == 0) && + (ipv6_legacy_buf->destaddr.uint8[10] == 0)) { /* 01: 48 bits. The address takes the form FFXX::00XX:XXXX:XXXX */ lowpan_iphc[1] |= 0x01; /* copy second and last 5 byte */ - ipv6_hdr_fields[hdr_pos] = ipv6_buf->destaddr.uint8[1]; + ipv6_legacy_hdr_fields[hdr_pos] = ipv6_legacy_buf->destaddr.uint8[1]; hdr_pos++; - memcpy(&ipv6_hdr_fields[hdr_pos], &ipv6_buf->destaddr.uint8[11], 5); + memcpy(&ipv6_legacy_hdr_fields[hdr_pos], &ipv6_legacy_buf->destaddr.uint8[11], 5); hdr_pos += 5; } else { - memcpy(&ipv6_hdr_fields[hdr_pos], &ipv6_buf->destaddr.uint8[0], 16); + memcpy(&ipv6_legacy_hdr_fields[hdr_pos], &ipv6_legacy_buf->destaddr.uint8[0], 16); hdr_pos += 16; } } else { /* 0: Destination address is not a multicast address. */ - if ((con = lowpan_context_lookup(&ipv6_buf->destaddr)) != NULL) { + if ((con = lowpan_context_lookup(&ipv6_legacy_buf->destaddr)) != NULL) { /* 1: Destination address compression uses stateful, context-based * compression. */ - lowpan_iphc[1] |= SIXLOWPAN_IPHC2_DAC; - ipv6_hdr_fields[0] = con->num; + lowpan_iphc[1] |= SIXLOWPAN_LEGACY_IPHC2_DAC; + ipv6_legacy_hdr_fields[0] = con->num; } - if (con || ipv6_addr_is_link_local(&ipv6_buf->destaddr)) { + if (con || ipv6_legacy_addr_is_link_local(&ipv6_legacy_buf->destaddr)) { if (dest_len == 8 && - ipv6_buf->destaddr.uint8[8] == (dest[0] ^ 0x02) && - memcmp(&ipv6_buf->destaddr.uint8[9], &dest[1], 7) == 0) { + ipv6_legacy_buf->destaddr.uint8[8] == (dest[0] ^ 0x02) && + memcmp(&ipv6_legacy_buf->destaddr.uint8[9], &dest[1], 7) == 0) { /* 0 bits. The address is derived using context information * and possibly the link-layer addresses.*/ lowpan_iphc[1] |= 0x03; } else if (dest_len == 2 && - ipv6_buf->destaddr.uint32[2] == HTONL(0x000000ff) && - ipv6_buf->destaddr.uint16[6] == HTONS(0xfe00) && - ipv6_buf->destaddr.uint16[7] == *((uint16_t *) dest)) { + ipv6_legacy_buf->destaddr.uint32[2] == HTONL(0x000000ff) && + ipv6_legacy_buf->destaddr.uint16[6] == HTONS(0xfe00) && + ipv6_legacy_buf->destaddr.uint16[7] == *((uint16_t *) dest)) { /* 0 bits. The address is derived using context information * and possibly the link-layer addresses.*/ lowpan_iphc[1] |= 0x03; } - else if ((ipv6_buf->destaddr.uint16[4] == 0) && - (ipv6_buf->destaddr.uint16[5] == 0) && - (ipv6_buf->destaddr.uint16[6] == 0) && - ((ipv6_buf->destaddr.uint8[14]) & 0x80) == 0) { + else if ((ipv6_legacy_buf->destaddr.uint16[4] == 0) && + (ipv6_legacy_buf->destaddr.uint16[5] == 0) && + (ipv6_legacy_buf->destaddr.uint16[6] == 0) && + ((ipv6_legacy_buf->destaddr.uint8[14]) & 0x80) == 0) { /* 49-bit of interface identifier are 0, so we can compress * source address-iid to 16-bit */ - memcpy(&ipv6_hdr_fields[hdr_pos], &ipv6_buf->destaddr.uint16[7], 2); + memcpy(&ipv6_legacy_hdr_fields[hdr_pos], &ipv6_legacy_buf->destaddr.uint16[7], 2); hdr_pos += 2; /* 16 bits. The address is derived using context information * and the 16 bits carried inline. */ lowpan_iphc[1] |= 0x02; } else { - memcpy(&ipv6_hdr_fields[hdr_pos], &(ipv6_buf->destaddr.uint16[4]), 8); + memcpy(&ipv6_legacy_hdr_fields[hdr_pos], &(ipv6_legacy_buf->destaddr.uint16[4]), 8); hdr_pos += 8; /* 64 bits. The address is derived using context information * and the 64 bits carried inline. */ @@ -1137,7 +1137,7 @@ uint8_t lowpan_iphc_encoding(int if_id, const uint8_t *dest, int dest_len, } } else { - memcpy(&ipv6_hdr_fields[hdr_pos], &(ipv6_buf->destaddr.uint8[0]), 16); + memcpy(&ipv6_legacy_hdr_fields[hdr_pos], &(ipv6_legacy_buf->destaddr.uint8[0]), 16); hdr_pos += 16; } } @@ -1148,16 +1148,16 @@ uint8_t lowpan_iphc_encoding(int if_id, const uint8_t *dest, int dest_len, comp_buf[1] = lowpan_iphc[1]; /*uint8_t *ptr; - if (ipv6_buf->nextheader == IPV6_PROTO_NUM_TCP) + if (ipv6_legacy_buf->nextheader == IPV6_LEGACY_PROTO_NUM_TCP) { - ptr = get_payload_buf_send(ipv6_ext_hdr_len); + ptr = get_payload_buf_send(ipv6_legacy_ext_hdr_len); } else { - ptr = get_payload_buf(ipv6_ext_hdr_len); + ptr = get_payload_buf(ipv6_legacy_ext_hdr_len); } */ - memcpy(&ipv6_hdr_fields[hdr_pos], &ptr[IPV6_HDR_LEN], NTOHS(ipv6_buf->length)); + memcpy(&ipv6_legacy_hdr_fields[hdr_pos], &ptr[IPV6_LEGACY_HDR_LEN], NTOHS(ipv6_legacy_buf->length)); comp_len = 2 + hdr_pos + payload_length; @@ -1168,7 +1168,7 @@ void lowpan_iphc_decoding(uint8_t *data, uint8_t length, net_if_eui64_t *s_addr, net_if_eui64_t *d_addr) { uint8_t hdr_pos = 0; - uint8_t *ipv6_hdr_fields = data; + uint8_t *ipv6_legacy_hdr_fields = data; uint8_t lowpan_iphc[2]; uint8_t cid = 0; uint8_t dci = 0; @@ -1176,69 +1176,69 @@ void lowpan_iphc_decoding(uint8_t *data, uint8_t length, net_if_eui64_t *s_addr, uint8_t ll_prefix[2] = {0xfe, 0x80}; lowpan_context_t *con = NULL; - ipv6_buf = ipv6_get_buf(); + ipv6_legacy_buf = ipv6_legacy_get_buf(); - lowpan_iphc[0] = ipv6_hdr_fields[0]; - lowpan_iphc[1] = ipv6_hdr_fields[1]; + lowpan_iphc[0] = ipv6_legacy_hdr_fields[0]; + lowpan_iphc[1] = ipv6_legacy_hdr_fields[1]; hdr_pos += 2; /* first check if CID flag is set */ - if (lowpan_iphc[1] & SIXLOWPAN_IPHC2_CID) { + if (lowpan_iphc[1] & SIXLOWPAN_LEGACY_IPHC2_CID) { hdr_pos++; cid = 1; } /* TF: Traffic Class, Flow Label: */ - if (lowpan_iphc[0] & SIXLOWPAN_IPHC1_FL_C) { + if (lowpan_iphc[0] & SIXLOWPAN_LEGACY_IPHC1_FL_C) { /* flowlabel is elided */ - if (lowpan_iphc[0] & SIXLOWPAN_IPHC1_TC_C) { + if (lowpan_iphc[0] & SIXLOWPAN_LEGACY_IPHC1_TC_C) { /* traffic class is elided */ - ipv6_buf->version_trafficclass = 0x60; - ipv6_buf->trafficclass_flowlabel = 0; - ipv6_buf->flowlabel = 0; + ipv6_legacy_buf->version_trafficclass = 0x60; + ipv6_legacy_buf->trafficclass_flowlabel = 0; + ipv6_legacy_buf->flowlabel = 0; } else { /* toogle ecn/dscp order */ - ipv6_buf->version_trafficclass = 0x60 | (0x0f & - (ipv6_hdr_fields[hdr_pos] >> 2)); - ipv6_buf->trafficclass_flowlabel = ((ipv6_hdr_fields[hdr_pos] >> 2) & 0x30) | - ((ipv6_hdr_fields[hdr_pos] << 6) & 0xc0); - ipv6_buf->flowlabel = 0; + ipv6_legacy_buf->version_trafficclass = 0x60 | (0x0f & + (ipv6_legacy_hdr_fields[hdr_pos] >> 2)); + ipv6_legacy_buf->trafficclass_flowlabel = ((ipv6_legacy_hdr_fields[hdr_pos] >> 2) & 0x30) | + ((ipv6_legacy_hdr_fields[hdr_pos] << 6) & 0xc0); + ipv6_legacy_buf->flowlabel = 0; hdr_pos += 3; } } else { /* flowlabel carried inline */ - if (lowpan_iphc[0] & SIXLOWPAN_IPHC1_TC_C) { + if (lowpan_iphc[0] & SIXLOWPAN_LEGACY_IPHC1_TC_C) { /* traffic class is elided */ - ipv6_buf->version_trafficclass = 0x60; + ipv6_legacy_buf->version_trafficclass = 0x60; /* ecn + 4 bit flowlabel*/ - ipv6_buf->trafficclass_flowlabel = ((ipv6_hdr_fields[hdr_pos] >> 2) & 0x30) | - (ipv6_hdr_fields[hdr_pos] & 0x0f); + ipv6_legacy_buf->trafficclass_flowlabel = ((ipv6_legacy_hdr_fields[hdr_pos] >> 2) & 0x30) | + (ipv6_legacy_hdr_fields[hdr_pos] & 0x0f); hdr_pos++; /* copy 2byte flowlabel */ - memcpy(&ipv6_buf->flowlabel, &ipv6_hdr_fields[hdr_pos], 2); + memcpy(&ipv6_legacy_buf->flowlabel, &ipv6_legacy_hdr_fields[hdr_pos], 2); hdr_pos += 2; } else { - ipv6_buf->version_trafficclass = 0x60 | (0x0f & - (ipv6_hdr_fields[hdr_pos] >> 2)); - ipv6_buf->trafficclass_flowlabel = ((ipv6_hdr_fields[hdr_pos] >> 2) & 0x30) | - (ipv6_hdr_fields[hdr_pos] & 0x0f) | - (ipv6_hdr_fields[hdr_pos + 1] & 0x0f); + ipv6_legacy_buf->version_trafficclass = 0x60 | (0x0f & + (ipv6_legacy_hdr_fields[hdr_pos] >> 2)); + ipv6_legacy_buf->trafficclass_flowlabel = ((ipv6_legacy_hdr_fields[hdr_pos] >> 2) & 0x30) | + (ipv6_legacy_hdr_fields[hdr_pos] & 0x0f) | + (ipv6_legacy_hdr_fields[hdr_pos + 1] & 0x0f); hdr_pos += 2; - memcpy(&ipv6_buf->trafficclass_flowlabel, - &ipv6_hdr_fields[hdr_pos], 2); + memcpy(&ipv6_legacy_buf->trafficclass_flowlabel, + &ipv6_legacy_hdr_fields[hdr_pos], 2); hdr_pos += 2; } } /* NH: Next Header: */ - if (lowpan_iphc[0] & SIXLOWPAN_IPHC1_NH) { + if (lowpan_iphc[0] & SIXLOWPAN_LEGACY_IPHC1_NH) { // TODO: next header decompression } else { - ipv6_buf->nextheader = ipv6_hdr_fields[hdr_pos]; + ipv6_legacy_buf->nextheader = ipv6_legacy_hdr_fields[hdr_pos]; hdr_pos++; } @@ -1246,17 +1246,17 @@ void lowpan_iphc_decoding(uint8_t *data, uint8_t length, net_if_eui64_t *s_addr, if (lowpan_iphc[0] & 0x03) { switch (lowpan_iphc[0] & 0x03) { case (0x01): { - ipv6_buf->hoplimit = 1; + ipv6_legacy_buf->hoplimit = 1; break; } case (0x02): { - ipv6_buf->hoplimit = 64; + ipv6_legacy_buf->hoplimit = 64; break; } case (0x03): { - ipv6_buf->hoplimit = 255; + ipv6_legacy_buf->hoplimit = 255; break; } @@ -1265,23 +1265,23 @@ void lowpan_iphc_decoding(uint8_t *data, uint8_t length, net_if_eui64_t *s_addr, } } else { - ipv6_buf->hoplimit = ipv6_hdr_fields[hdr_pos]; + ipv6_legacy_buf->hoplimit = ipv6_legacy_hdr_fields[hdr_pos]; hdr_pos++; } /* CID: Context Identifier Extension: + SAC: Source Address Compression */ - if (lowpan_iphc[1] & SIXLOWPAN_IPHC2_SAC) { + if (lowpan_iphc[1] & SIXLOWPAN_LEGACY_IPHC2_SAC) { /* 1: Source address compression uses stateful, context-based * compression.*/ uint8_t sci = 0; if (cid) { - sci = ipv6_hdr_fields[3] >> 4; + sci = ipv6_legacy_hdr_fields[3] >> 4; } mutex_lock(&lowpan_context_mutex); /* check context number */ - if (((lowpan_iphc[1] & SIXLOWPAN_IPHC2_SAM) >> 4) & 0x03) { + if (((lowpan_iphc[1] & SIXLOWPAN_LEGACY_IPHC2_SAM) >> 4) & 0x03) { con = lowpan_context_num_lookup(sci); } @@ -1290,40 +1290,40 @@ void lowpan_iphc_decoding(uint8_t *data, uint8_t length, net_if_eui64_t *s_addr, return; } - switch (((lowpan_iphc[1] & SIXLOWPAN_IPHC2_SAM) >> 4) & 0x03) { + switch (((lowpan_iphc[1] & SIXLOWPAN_LEGACY_IPHC2_SAM) >> 4) & 0x03) { case (0x01): { /* 64-bits */ - memcpy(&(ipv6_buf->srcaddr.uint8[8]), &ipv6_hdr_fields[hdr_pos], 8); + memcpy(&(ipv6_legacy_buf->srcaddr.uint8[8]), &ipv6_legacy_hdr_fields[hdr_pos], 8); /* By RFC 6282 3.1.1. Bits covered by context * information are always used. */ - memcpy(&(ipv6_buf->srcaddr.uint8[0]), &con->prefix, con->length); + memcpy(&(ipv6_legacy_buf->srcaddr.uint8[0]), &con->prefix, con->length); hdr_pos += 8; break; } case (0x02): { /* 16-bits */ - memset(&(ipv6_buf->srcaddr.uint8[8]), 0, 6); - memcpy(&(ipv6_buf->srcaddr.uint8[14]), &ipv6_hdr_fields[hdr_pos], 2); + memset(&(ipv6_legacy_buf->srcaddr.uint8[8]), 0, 6); + memcpy(&(ipv6_legacy_buf->srcaddr.uint8[14]), &ipv6_legacy_hdr_fields[hdr_pos], 2); /* By RFC 6282 3.1.1. Bits covered by context * information are always used. */ - memcpy(&(ipv6_buf->srcaddr.uint8[0]), &con->prefix, con->length); + memcpy(&(ipv6_legacy_buf->srcaddr.uint8[0]), &con->prefix, con->length); hdr_pos += 2; break; } case (0x03): { /* 0-bits */ - memcpy(&(ipv6_buf->srcaddr.uint8[8]), &s_addr->uint8[0], 8); + memcpy(&(ipv6_legacy_buf->srcaddr.uint8[8]), &s_addr->uint8[0], 8); /* By RFC 6282 3.1.1. Bits covered by context * information are always used. */ - memcpy(&(ipv6_buf->srcaddr.uint8[0]), &con->prefix, con->length); + memcpy(&(ipv6_legacy_buf->srcaddr.uint8[0]), &con->prefix, con->length); break; } default: { /* unspecified address */ - memset(&(ipv6_buf->srcaddr.uint8[0]), 0, 16); + memset(&(ipv6_legacy_buf->srcaddr.uint8[0]), 0, 16); break; } } @@ -1331,37 +1331,37 @@ void lowpan_iphc_decoding(uint8_t *data, uint8_t length, net_if_eui64_t *s_addr, mutex_unlock(&lowpan_context_mutex); } else { - switch (((lowpan_iphc[1] & SIXLOWPAN_IPHC2_SAM) >> 4) & 0x03) { + switch (((lowpan_iphc[1] & SIXLOWPAN_LEGACY_IPHC2_SAM) >> 4) & 0x03) { case (0x01): { /* 64-bits */ - memcpy(&(ipv6_buf->srcaddr.uint8[0]), &ll_prefix[0], 2); - memset(&(ipv6_buf->srcaddr.uint8[2]), 0, 6); - memcpy(&(ipv6_buf->srcaddr.uint8[8]), &ipv6_hdr_fields[hdr_pos], 8); + memcpy(&(ipv6_legacy_buf->srcaddr.uint8[0]), &ll_prefix[0], 2); + memset(&(ipv6_legacy_buf->srcaddr.uint8[2]), 0, 6); + memcpy(&(ipv6_legacy_buf->srcaddr.uint8[8]), &ipv6_legacy_hdr_fields[hdr_pos], 8); hdr_pos += 8; break; } case (0x02): { /* 16-bits */ - memcpy(&(ipv6_buf->srcaddr.uint8[0]), &ll_prefix[0], 2); - memset(&(ipv6_buf->srcaddr.uint8[2]), 0, 12); - memcpy(&(ipv6_buf->srcaddr.uint8[14]), &ipv6_hdr_fields[hdr_pos], 2); + memcpy(&(ipv6_legacy_buf->srcaddr.uint8[0]), &ll_prefix[0], 2); + memset(&(ipv6_legacy_buf->srcaddr.uint8[2]), 0, 12); + memcpy(&(ipv6_legacy_buf->srcaddr.uint8[14]), &ipv6_legacy_hdr_fields[hdr_pos], 2); hdr_pos += 2; break; } case (0x03): { /* 0-bits */ - memcpy(&(ipv6_buf->srcaddr.uint8[0]), &ll_prefix[0], 2); - memset(&(ipv6_buf->srcaddr.uint8[2]), 0, 6); - memcpy(&(ipv6_buf->srcaddr.uint8[8]), &s_addr->uint8[0], 8); + memcpy(&(ipv6_legacy_buf->srcaddr.uint8[0]), &ll_prefix[0], 2); + memset(&(ipv6_legacy_buf->srcaddr.uint8[2]), 0, 6); + memcpy(&(ipv6_legacy_buf->srcaddr.uint8[8]), &s_addr->uint8[0], 8); break; } default: { /* full address carried inline */ - memcpy(&(ipv6_buf->srcaddr.uint8[0]), - &ipv6_hdr_fields[hdr_pos], 16); + memcpy(&(ipv6_legacy_buf->srcaddr.uint8[0]), + &ipv6_legacy_hdr_fields[hdr_pos], 16); hdr_pos += 16; break; } @@ -1369,19 +1369,19 @@ void lowpan_iphc_decoding(uint8_t *data, uint8_t length, net_if_eui64_t *s_addr, } /* M: Multicast Compression + DAC: Destination Address Compression */ - if (lowpan_iphc[1] & SIXLOWPAN_IPHC2_M) { + if (lowpan_iphc[1] & SIXLOWPAN_LEGACY_IPHC2_M) { /* 1: Destination address is a multicast address. */ - if (lowpan_iphc[1] & SIXLOWPAN_IPHC2_DAC) { + if (lowpan_iphc[1] & SIXLOWPAN_LEGACY_IPHC2_DAC) { /* 1: Destination address compression uses stateful, context-based * compression. * If M=1 and DAC=1: */ if (cid) { - dci = ipv6_hdr_fields[3] & 0x0f; + dci = ipv6_legacy_hdr_fields[3] & 0x0f; } mutex_lock(&lowpan_context_mutex); - if ((lowpan_iphc[1] & SIXLOWPAN_IPHC2_DAM) & 0x03) { + if ((lowpan_iphc[1] & SIXLOWPAN_LEGACY_IPHC2_DAM) & 0x03) { con = lowpan_context_num_lookup(dci); } @@ -1398,13 +1398,13 @@ void lowpan_iphc_decoding(uint8_t *data, uint8_t length, net_if_eui64_t *s_addr, /* If M=1 and DAC=0: */ switch (lowpan_iphc[1] & 0x03) { case (0x01): { - m_prefix[1] = ipv6_hdr_fields[hdr_pos]; + m_prefix[1] = ipv6_legacy_hdr_fields[hdr_pos]; hdr_pos++; break; } case (0x02): { - m_prefix[1] = ipv6_hdr_fields[hdr_pos]; + m_prefix[1] = ipv6_legacy_hdr_fields[hdr_pos]; hdr_pos++; break; } @@ -1415,31 +1415,31 @@ void lowpan_iphc_decoding(uint8_t *data, uint8_t length, net_if_eui64_t *s_addr, switch (lowpan_iphc[1] & 0x03) { case (0x01): { - memcpy(&(ipv6_buf->destaddr.uint8[0]), &m_prefix[0], 2); - memset(&(ipv6_buf->destaddr.uint8[2]), 0, 9); - memcpy(&(ipv6_buf->destaddr.uint8[11]), &ipv6_hdr_fields[hdr_pos], 5); + memcpy(&(ipv6_legacy_buf->destaddr.uint8[0]), &m_prefix[0], 2); + memset(&(ipv6_legacy_buf->destaddr.uint8[2]), 0, 9); + memcpy(&(ipv6_legacy_buf->destaddr.uint8[11]), &ipv6_legacy_hdr_fields[hdr_pos], 5); hdr_pos += 5; break; } case (0x02): { - memcpy(&(ipv6_buf->destaddr.uint8[0]), &m_prefix[0], 2); - memset(&(ipv6_buf->destaddr.uint8[2]), 0, 11); - memcpy(&(ipv6_buf->destaddr.uint8[13]), &ipv6_hdr_fields[hdr_pos], 3); + memcpy(&(ipv6_legacy_buf->destaddr.uint8[0]), &m_prefix[0], 2); + memset(&(ipv6_legacy_buf->destaddr.uint8[2]), 0, 11); + memcpy(&(ipv6_legacy_buf->destaddr.uint8[13]), &ipv6_legacy_hdr_fields[hdr_pos], 3); hdr_pos += 3; break; } case (0x03): { - memcpy(&(ipv6_buf->destaddr.uint8[0]), &m_prefix[0], 2); - memset(&(ipv6_buf->destaddr.uint8[2]), 0, 13); - memcpy(&(ipv6_buf->destaddr.uint8[15]), &ipv6_hdr_fields[hdr_pos], 1); + memcpy(&(ipv6_legacy_buf->destaddr.uint8[0]), &m_prefix[0], 2); + memset(&(ipv6_legacy_buf->destaddr.uint8[2]), 0, 13); + memcpy(&(ipv6_legacy_buf->destaddr.uint8[15]), &ipv6_legacy_hdr_fields[hdr_pos], 1); hdr_pos++; break; } default: { - memcpy(&(ipv6_buf->destaddr.uint8[0]), &ipv6_hdr_fields[hdr_pos], 16); + memcpy(&(ipv6_legacy_buf->destaddr.uint8[0]), &ipv6_legacy_hdr_fields[hdr_pos], 16); hdr_pos += 16; break; } @@ -1447,17 +1447,17 @@ void lowpan_iphc_decoding(uint8_t *data, uint8_t length, net_if_eui64_t *s_addr, } } else { - if (lowpan_iphc[1] & SIXLOWPAN_IPHC2_DAC) { + if (lowpan_iphc[1] & SIXLOWPAN_LEGACY_IPHC2_DAC) { /* 1: Destination address compression uses stateful, context-based * compression. * If M=1 and DAC=1: */ if (cid) { - dci = ipv6_hdr_fields[3] & 0x0f; + dci = ipv6_legacy_hdr_fields[3] & 0x0f; } mutex_lock(&lowpan_context_mutex); - if ((lowpan_iphc[1] & SIXLOWPAN_IPHC2_DAM) & 0x03) { + if ((lowpan_iphc[1] & SIXLOWPAN_LEGACY_IPHC2_DAM) & 0x03) { con = lowpan_context_num_lookup(dci); } @@ -1466,29 +1466,29 @@ void lowpan_iphc_decoding(uint8_t *data, uint8_t length, net_if_eui64_t *s_addr, return; } - switch ((lowpan_iphc[1] & SIXLOWPAN_IPHC2_DAM) & 0x03) { + switch ((lowpan_iphc[1] & SIXLOWPAN_LEGACY_IPHC2_DAM) & 0x03) { case (0x01): { - memcpy(&(ipv6_buf->destaddr.uint8[8]), &ipv6_hdr_fields[hdr_pos], 8); + memcpy(&(ipv6_legacy_buf->destaddr.uint8[8]), &ipv6_legacy_hdr_fields[hdr_pos], 8); /* By draft-ietf-6lowpan-hc-15 3.1.1. Bits covered by context information are always used. */ - memcpy(&(ipv6_buf->srcaddr.uint8[0]), &con->prefix, con->length); + memcpy(&(ipv6_legacy_buf->srcaddr.uint8[0]), &con->prefix, con->length); hdr_pos += 8; break; } case (0x02): { - memset(&(ipv6_buf->destaddr.uint8[8]), 0, 6); - memcpy(&(ipv6_buf->destaddr.uint8[14]), &ipv6_hdr_fields[hdr_pos], 2); + memset(&(ipv6_legacy_buf->destaddr.uint8[8]), 0, 6); + memcpy(&(ipv6_legacy_buf->destaddr.uint8[14]), &ipv6_legacy_hdr_fields[hdr_pos], 2); /* By draft-ietf-6lowpan-hc-15 3.1.1. Bits covered by context information are always used. */ - memcpy(&(ipv6_buf->srcaddr.uint8[0]), &con->prefix, con->length); + memcpy(&(ipv6_legacy_buf->srcaddr.uint8[0]), &con->prefix, con->length); hdr_pos += 2; break; } case (0x03): { - memset(&(ipv6_buf->destaddr.uint8[0]), 0, 8); - memcpy(&(ipv6_buf->destaddr.uint8[8]), &d_addr->uint8[0], 8); + memset(&(ipv6_legacy_buf->destaddr.uint8[0]), 0, 8); + memcpy(&(ipv6_legacy_buf->destaddr.uint8[8]), &d_addr->uint8[0], 8); /* By draft-ietf-6lowpan-hc-15 3.1.1. Bits covered by context information are always used. */ - memcpy(&(ipv6_buf->srcaddr.uint8[0]), &con->prefix, con->length); + memcpy(&(ipv6_legacy_buf->srcaddr.uint8[0]), &con->prefix, con->length); break; } @@ -1499,35 +1499,35 @@ void lowpan_iphc_decoding(uint8_t *data, uint8_t length, net_if_eui64_t *s_addr, mutex_unlock(&lowpan_context_mutex); } else { - switch ((lowpan_iphc[1] & SIXLOWPAN_IPHC2_DAM) & 0x03) { + switch ((lowpan_iphc[1] & SIXLOWPAN_LEGACY_IPHC2_DAM) & 0x03) { case (0x01): { - memcpy(&(ipv6_buf->destaddr.uint8[0]), &ll_prefix[0], 2); - memset(&(ipv6_buf->destaddr.uint8[2]), 0, 6); - memcpy(&(ipv6_buf->destaddr.uint8[8]), - &ipv6_hdr_fields[hdr_pos], 8); + memcpy(&(ipv6_legacy_buf->destaddr.uint8[0]), &ll_prefix[0], 2); + memset(&(ipv6_legacy_buf->destaddr.uint8[2]), 0, 6); + memcpy(&(ipv6_legacy_buf->destaddr.uint8[8]), + &ipv6_legacy_hdr_fields[hdr_pos], 8); hdr_pos += 8; break; } case (0x02): { - memcpy(&(ipv6_buf->destaddr.uint8[0]), &ll_prefix[0], 2); - memset(&(ipv6_buf->destaddr.uint8[2]), 0, 12); - memcpy(&(ipv6_buf->destaddr.uint8[14]), - &ipv6_hdr_fields[hdr_pos], 2); + memcpy(&(ipv6_legacy_buf->destaddr.uint8[0]), &ll_prefix[0], 2); + memset(&(ipv6_legacy_buf->destaddr.uint8[2]), 0, 12); + memcpy(&(ipv6_legacy_buf->destaddr.uint8[14]), + &ipv6_legacy_hdr_fields[hdr_pos], 2); hdr_pos += 2; break; } case (0x03): { - memcpy(&(ipv6_buf->destaddr.uint8[0]), &ll_prefix, 2); - memset(&(ipv6_buf->destaddr.uint8[2]), 0, 14); - memcpy(&(ipv6_buf->destaddr.uint8[8]), &d_addr->uint8[0], 8); + memcpy(&(ipv6_legacy_buf->destaddr.uint8[0]), &ll_prefix, 2); + memset(&(ipv6_legacy_buf->destaddr.uint8[2]), 0, 14); + memcpy(&(ipv6_legacy_buf->destaddr.uint8[8]), &d_addr->uint8[0], 8); break; } default: { - memcpy(&(ipv6_buf->destaddr.uint8[0]), - &ipv6_hdr_fields[hdr_pos], 16); + memcpy(&(ipv6_legacy_buf->destaddr.uint8[0]), + &ipv6_legacy_hdr_fields[hdr_pos], 16); hdr_pos += 16; break; } @@ -1535,13 +1535,13 @@ void lowpan_iphc_decoding(uint8_t *data, uint8_t length, net_if_eui64_t *s_addr, } } - uint8_t *ptr = get_payload_buf(ipv6_ext_hdr_len); + uint8_t *ptr = get_payload_buf(ipv6_legacy_ext_hdr_len); - memcpy(ptr, &ipv6_hdr_fields[hdr_pos], length - hdr_pos); + memcpy(ptr, &ipv6_legacy_hdr_fields[hdr_pos], length - hdr_pos); - /* ipv6 length */ - ipv6_buf->length = HTONS(length - hdr_pos); - packet_length = IPV6_HDR_LEN + ipv6_buf->length; + /* ipv6_legacy length */ + ipv6_legacy_buf->length = HTONS(length - hdr_pos); + packet_length = IPV6_LEGACY_HDR_LEN + ipv6_legacy_buf->length; } uint8_t lowpan_context_len(void) @@ -1568,7 +1568,7 @@ void lowpan_context_remove(uint8_t num) memset(&contexts[NDP_6LOWPAN_CONTEXT_MAX - 1], 0, sizeof(lowpan_context_t)); } -lowpan_context_t *lowpan_context_update(uint8_t num, const ipv6_addr_t *prefix, +lowpan_context_t *lowpan_context_update(uint8_t num, const ipv6_legacy_addr_t *prefix, uint8_t length, uint8_t comp, uint16_t lifetime) { @@ -1604,7 +1604,7 @@ lowpan_context_t *lowpan_context_get(void) return contexts; } -lowpan_context_t *lowpan_context_lookup(ipv6_addr_t *addr) +lowpan_context_t *lowpan_context_lookup(ipv6_legacy_addr_t *addr) { int i; @@ -1678,59 +1678,59 @@ void init_reas_bufs(lowpan_reas_buf_t *buf) buf->next = NULL; } -int sixlowpan_lowpan_init_adhoc_interface(int if_id, const ipv6_addr_t *prefix) +int sixlowpan_legacy_lowpan_init_adhoc_interface(int if_id, const ipv6_legacy_addr_t *prefix) { - ipv6_addr_t tmp; + ipv6_legacy_addr_t tmp; /* if prefix is set */ if (prefix != NULL) { /* init network prefix */ - ipv6_addr_t save_prefix; + ipv6_legacy_addr_t save_prefix; - ipv6_addr_init_prefix(&save_prefix, prefix, 64); + ipv6_legacy_addr_init_prefix(&save_prefix, prefix, 64); ndp_add_prefix_info(if_id, &save_prefix, 64, NDP_OPT_PI_VLIFETIME_INFINITE, NDP_OPT_PI_PLIFETIME_INFINITE, 1, ICMPV6_NDP_OPT_PI_FLAG_AUTONOM); - ipv6_init_as_router(); + ipv6_legacy_init_as_router(); /* add global address */ - if (!ipv6_addr_set_by_eui64(&tmp, if_id, prefix)) { + if (!ipv6_legacy_addr_set_by_eui64(&tmp, if_id, prefix)) { return 0; } DEBUG("%s, %d: set unique address for interface %d to %s, according " "to prefix %s\n", __FILE__, __LINE__, if_id, - ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &tmp), - ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &tmp)); + ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, &tmp), + ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, &tmp)); - if (!ipv6_net_if_add_addr(if_id, &tmp, NDP_ADDR_STATE_PREFERRED, + if (!ipv6_legacy_net_if_add_addr(if_id, &tmp, NDP_ADDR_STATE_PREFERRED, NDP_OPT_PI_VLIFETIME_INFINITE, NDP_OPT_PI_PLIFETIME_INFINITE, 0)) { return 0; } } - return sixlowpan_lowpan_init_interface(if_id); + return sixlowpan_legacy_lowpan_init_interface(if_id); } -int sixlowpan_lowpan_init_interface(int if_id) +int sixlowpan_legacy_lowpan_init_interface(int if_id) { - ipv6_addr_t tmp; + ipv6_legacy_addr_t tmp; /* init link-local prefix */ - ipv6_addr_set_link_local_prefix(&tmp); + ipv6_legacy_addr_set_link_local_prefix(&tmp); - if (!ipv6_addr_set_by_eui64(&tmp, if_id, &tmp)) { + if (!ipv6_legacy_addr_set_by_eui64(&tmp, if_id, &tmp)) { DEBUG("Can not set link-local by EUI-64 on interface %d\n", if_id); return 0; } - DEBUG("%s, %d: sixlowpan_lowpan_init(): add link local address to " + DEBUG("%s, %d: sixlowpan_legacy_lowpan_init(): add link local address to " "interface %d: %s\n", __FILE__, __LINE__, if_id, - ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &tmp)); + ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, &tmp)); - if (!ipv6_net_if_add_addr(if_id, &tmp, NDP_ADDR_STATE_PREFERRED, + if (!ipv6_legacy_net_if_add_addr(if_id, &tmp, NDP_ADDR_STATE_PREFERRED, NDP_OPT_PI_VLIFETIME_INFINITE, NDP_OPT_PI_PLIFETIME_INFINITE, 0)) { DEBUG("Can not add link-local address to interface %d\n", if_id); @@ -1738,12 +1738,12 @@ int sixlowpan_lowpan_init_interface(int if_id) } /* add solicited nodes multicast address of link local address */ - ipv6_addr_set_solicited_node_addr(&tmp, &tmp); - DEBUG("%s, %d: sixlowpan_lowpan_init(): add solicited nodes multicast address " + ipv6_legacy_addr_set_solicited_node_addr(&tmp, &tmp); + DEBUG("%s, %d: sixlowpan_legacy_lowpan_init(): add solicited nodes multicast address " "to of link layer address interface %d: %s\n", __FILE__, __LINE__, - if_id, ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &tmp)); + if_id, ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, &tmp)); - if (!ipv6_net_if_add_addr(if_id, &tmp, NDP_ADDR_STATE_PREFERRED, + if (!ipv6_legacy_net_if_add_addr(if_id, &tmp, NDP_ADDR_STATE_PREFERRED, NDP_OPT_PI_VLIFETIME_INFINITE, NDP_OPT_PI_PLIFETIME_INFINITE, 0)) { DEBUG("Can not add all nodes address to interface %d\n", if_id); @@ -1751,12 +1751,12 @@ int sixlowpan_lowpan_init_interface(int if_id) } /* add all nodes multicast address */ - ipv6_addr_set_all_nodes_addr(&tmp); - DEBUG("%s, %d: sixlowpan_lowpan_init(): add all nodes multicast address " + ipv6_legacy_addr_set_all_nodes_addr(&tmp); + DEBUG("%s, %d: sixlowpan_legacy_lowpan_init(): add all nodes multicast address " "to interface %d: %s\n", __FILE__, __LINE__, if_id, - ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &tmp)); + ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, &tmp)); - if (!ipv6_net_if_add_addr(if_id, &tmp, NDP_ADDR_STATE_PREFERRED, + if (!ipv6_legacy_net_if_add_addr(if_id, &tmp, NDP_ADDR_STATE_PREFERRED, NDP_OPT_PI_VLIFETIME_INFINITE, NDP_OPT_PI_PLIFETIME_INFINITE, 0)) { DEBUG("Can not add all nodes address to interface %d\n", if_id); @@ -1764,12 +1764,12 @@ int sixlowpan_lowpan_init_interface(int if_id) } /* add loopback address */ - ipv6_addr_set_loopback_addr(&tmp); - DEBUG("%s, %d: sixlowpan_lowpan_init(): add loopback address to interface " + ipv6_legacy_addr_set_loopback_addr(&tmp); + DEBUG("%s, %d: sixlowpan_legacy_lowpan_init(): add loopback address to interface " "0: %s\n", __FILE__, __LINE__, - ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &tmp)); + ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, &tmp)); - if (!ipv6_net_if_add_addr(0, &tmp, NDP_ADDR_STATE_PREFERRED, + if (!ipv6_legacy_net_if_add_addr(0, &tmp, NDP_ADDR_STATE_PREFERRED, NDP_OPT_PI_VLIFETIME_INFINITE, NDP_OPT_PI_PLIFETIME_INFINITE, 0)) { DEBUG("Can not add all nodes address to interface %d\n", if_id); @@ -1781,17 +1781,17 @@ int sixlowpan_lowpan_init_interface(int if_id) return 1; } -int sixlowpan_lowpan_init(void) +int sixlowpan_legacy_lowpan_init(void) { short i; /* init mac-layer and radio transceiver */ - sixlowpan_mac_init(); + sixlowpan_legacy_mac_init(); if (ip_process_pid == KERNEL_PID_UNDEF) { ip_process_pid = thread_create(ip_process_buf, IP_PROCESS_STACKSIZE, PRIORITY_MAIN - 1, CREATE_STACKTEST, - ipv6_process, NULL, "ip_process"); + ipv6_legacy_process, NULL, "ip_process"); } if (ip_process_pid == KERNEL_PID_UNDEF) { @@ -1824,7 +1824,7 @@ int sixlowpan_lowpan_init(void) } -void sixlowpan_lowpan_bootstrapping(void) +void sixlowpan_legacy_lowpan_bootstrapping(void) { icmpv6_send_router_sol(OPT_SLLAO); diff --git a/sys/net/network_layer/sixlowpan/lowpan.h b/sys/net/network_layer/sixlowpan_legacy/lowpan.h similarity index 81% rename from sys/net/network_layer/sixlowpan/lowpan.h rename to sys/net/network_layer/sixlowpan_legacy/lowpan.h index c9ce70d124887..3249e3b284ce7 100644 --- a/sys/net/network_layer/sixlowpan/lowpan.h +++ b/sys/net/network_layer/sixlowpan_legacy/lowpan.h @@ -7,7 +7,7 @@ */ /** - * @file network_layer/sixlowpan/lowpan.h + * @file network_layer/sixlowpan_legacy/lowpan.h * @brief 6lowpan header * * @author Stephan Zeisberg @@ -16,14 +16,14 @@ * @author Eric Engel */ -#ifndef _SIXLOWPAN_LOWPAN_H -#define _SIXLOWPAN_LOWPAN_H +#ifndef _SIXLOWPAN_LEGACY_LOWPAN_H +#define _SIXLOWPAN_LEGACY_LOWPAN_H #include "mutex.h" #include "net_if.h" #include "vtimer.h" -#include "sixlowpan/lowpan.h" +#include "sixlowpan_legacy/lowpan.h" #ifdef __cplusplus extern "C" { @@ -33,7 +33,7 @@ extern "C" { typedef struct { uint8_t num; - ipv6_addr_t prefix; + ipv6_legacy_addr_t prefix; uint8_t length; uint8_t comp; uint16_t lifetime; @@ -46,7 +46,7 @@ void lowpan_read(uint8_t *data, uint8_t length, net_if_eui64_t *s_addr, net_if_eui64_t *d_addr); uint8_t lowpan_context_len(void); lowpan_context_t *lowpan_context_update(uint8_t num, - const ipv6_addr_t *prefix, + const ipv6_legacy_addr_t *prefix, uint8_t length, uint8_t comp, uint16_t lifetime); lowpan_context_t *lowpan_context_get(void); @@ -56,4 +56,4 @@ lowpan_context_t *lowpan_context_num_lookup(uint8_t num); } #endif -#endif /* _SIXLOWPAN_LOWPAN_H */ +#endif /* _SIXLOWPAN_LEGACY_LOWPAN_H */ diff --git a/sys/net/network_layer/sixlowpan/mac.c b/sys/net/network_layer/sixlowpan_legacy/mac.c similarity index 95% rename from sys/net/network_layer/sixlowpan/mac.c rename to sys/net/network_layer/sixlowpan_legacy/mac.c index 83ed79bea4344..7e1b9998c21c6 100644 --- a/sys/net/network_layer/sixlowpan/mac.c +++ b/sys/net/network_layer/sixlowpan_legacy/mac.c @@ -7,7 +7,7 @@ * General Public License v2.1. See the file LICENSE in the top level * directory for more details. * - * @ingroup sixlowpan + * @ingroup sixlowpan_legacy * @{ * @file sixlowmac.c * @brief 6lowpan link layer functions @@ -28,7 +28,7 @@ #include "msg.h" #include "radio/radio.h" #include "net_if.h" -#include "sixlowpan/mac.h" +#include "sixlowpan_legacy/mac.h" #include "ip.h" #include "icmp.h" @@ -206,7 +206,7 @@ void set_ieee802154_frame_values(int if_id, uint16_t dest_pan, macdsn++; } -int sixlowpan_mac_prepare_ieee802144_frame( +int sixlowpan_legacy_mac_prepare_ieee802144_frame( ieee802154_frame_t *frame, int if_id, uint16_t dest_pan, const void *dest, uint8_t dest_len, const void *payload, uint8_t length, uint8_t mcast) { @@ -269,7 +269,7 @@ int sixlowpan_mac_prepare_ieee802144_frame( return hdrlen; } -int sixlowpan_mac_send_data(int if_id, +int sixlowpan_legacy_mac_send_data(int if_id, const void *dest, uint8_t dest_len, const void *payload, uint8_t payload_len, uint8_t mcast) @@ -293,21 +293,21 @@ int sixlowpan_mac_send_data(int if_id, return -1; } -int sixlowpan_mac_send_ieee802154_frame(int if_id, +int sixlowpan_legacy_mac_send_ieee802154_frame(int if_id, const void *dest, uint8_t dest_len, const void *payload, uint8_t payload_len, uint8_t mcast) { if (net_if_get_interface(if_id) && net_if_get_interface(if_id)->transceivers & IEEE802154_TRANSCEIVER) { - return sixlowpan_mac_send_data(if_id, dest, dest_len, payload, + return sixlowpan_legacy_mac_send_data(if_id, dest, dest_len, payload, payload_len, mcast); } else { ieee802154_frame_t frame; uint16_t dest_pan = HTONS(0xabcd); uint8_t length; - int hdrlen = sixlowpan_mac_prepare_ieee802144_frame(&frame, if_id, + int hdrlen = sixlowpan_legacy_mac_prepare_ieee802144_frame(&frame, if_id, dest_pan, dest, dest_len, payload, payload_len, mcast); @@ -318,12 +318,12 @@ int sixlowpan_mac_send_ieee802154_frame(int if_id, length = hdrlen + frame.payload_len + IEEE_802154_FCS_LEN; - return sixlowpan_mac_send_data(if_id, dest, dest_len, lowpan_mac_buf, + return sixlowpan_legacy_mac_send_data(if_id, dest, dest_len, lowpan_mac_buf, length, mcast); } } -kernel_pid_t sixlowpan_mac_init(void) +kernel_pid_t sixlowpan_legacy_mac_init(void) { kernel_pid_t recv_pid = thread_create(radio_stack_buffer, RADIO_STACK_SIZE, PRIORITY_MAIN - 2, CREATE_STACKTEST, diff --git a/sys/net/network_layer/sixlowpan/serialnumber.c b/sys/net/network_layer/sixlowpan_legacy/serialnumber.c similarity index 98% rename from sys/net/network_layer/sixlowpan/serialnumber.c rename to sys/net/network_layer/sixlowpan_legacy/serialnumber.c index ae918f1e46ff7..4118c453bd9a6 100644 --- a/sys/net/network_layer/sixlowpan/serialnumber.c +++ b/sys/net/network_layer/sixlowpan_legacy/serialnumber.c @@ -7,7 +7,7 @@ * General Public License v2.1. See the file LICENSE in the top level * directory for more details. * - * @ingroup sixlowpan + * @ingroup sixlowpan_legacy * @{ * @file serialnumber.c * @brief serial number arithmetics (corresponding RFC1982) for version field in ABRO diff --git a/sys/net/network_layer/sixlowpan/serialnumber.h b/sys/net/network_layer/sixlowpan_legacy/serialnumber.h similarity index 95% rename from sys/net/network_layer/sixlowpan/serialnumber.h rename to sys/net/network_layer/sixlowpan_legacy/serialnumber.h index 6a0c23745b5c3..423ca0fb98532 100644 --- a/sys/net/network_layer/sixlowpan/serialnumber.h +++ b/sys/net/network_layer/sixlowpan_legacy/serialnumber.h @@ -10,8 +10,8 @@ * Header file for serial number arithmetics [RFC1982] */ -#ifndef _SIXLOWPAN_SERIALNUMBER_H -#define _SIXLOWPAN_SERIALNUMBER_H +#ifndef _SIXLOWPAN_LEGACY_SERIALNUMBER_H +#define _SIXLOWPAN_LEGACY_SERIALNUMBER_H #include #ifdef __cplusplus @@ -95,4 +95,4 @@ serial_comp_res_t serial_comp32(uint32_t s1, uint32_t s2); } #endif -#endif /* _SIXLOWPAN_SERIALNUMBER_H*/ +#endif /* _SIXLOWPAN_LEGACY_SERIALNUMBER_H*/ diff --git a/sys/net/routing/aodvv2/aodv.c b/sys/net/routing/aodvv2/aodv.c index 47f216333ef6a..7db5cc56e158f 100644 --- a/sys/net/routing/aodvv2/aodv.c +++ b/sys/net/routing/aodvv2/aodv.c @@ -38,7 +38,7 @@ static void _write_packet(struct rfc5444_writer *wr __attribute__ ((unused)), void *buffer, size_t length); #ifdef DEBUG_ENABLED -char addr_str[IPV6_MAX_ADDR_STR_LEN]; +char addr_str[IPV6_LEGACY_MAX_ADDR_STR_LEN]; static struct netaddr_str nbuf; #endif @@ -50,9 +50,9 @@ static int sender_thread; static int _sock_snd; static struct autobuf _hexbuf; static sockaddr6_t sa_wp; -static ipv6_addr_t _v6_addr_local, _v6_addr_mcast, _v6_addr_loopback; +static ipv6_legacy_addr_t _v6_addr_local, _v6_addr_mcast, _v6_addr_loopback; static struct netaddr na_local; /* the same as _v6_addr_local, but to save us - * constant calls to ipv6_addr_t_to_netaddr()... */ + * constant calls to ipv6_legacy_addr_t_to_netaddr()... */ static struct writer_target *wt; struct netaddr na_mcast = (struct netaddr){}; @@ -90,7 +90,7 @@ void aodv_init(void) NULL, "_aodv_sender_thread"); /* register aodv for routing */ - ipv6_iface_set_routing_provider(aodv_get_next_hop); + ipv6_legacy_iface_set_routing_provider(aodv_get_next_hop); } @@ -186,20 +186,20 @@ void aodv_send_rerr(struct unreachable_node unreachable_nodes[], size_t len, str static void _init_addresses(void) { /* init multicast address: set to to a link-local all nodes multicast address */ - ipv6_addr_set_all_nodes_addr(&_v6_addr_mcast); + ipv6_legacy_addr_set_all_nodes_addr(&_v6_addr_mcast); AODV_DEBUG("my multicast address is: %s\n", - ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &_v6_addr_mcast)); + ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, &_v6_addr_mcast)); /* get best IP for sending */ - ipv6_net_if_get_best_src_addr(&_v6_addr_local, &_v6_addr_mcast); + ipv6_legacy_net_if_get_best_src_addr(&_v6_addr_local, &_v6_addr_mcast); AODV_DEBUG("my src address is: %s\n", - ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &_v6_addr_local)); + ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, &_v6_addr_local)); /* store src & multicast address as netaddr as well for easy interaction * with oonf based stuff */ - ipv6_addr_t_to_netaddr(&_v6_addr_local, &na_local); - ipv6_addr_t_to_netaddr(&_v6_addr_mcast, &na_mcast); - ipv6_addr_set_loopback_addr(&_v6_addr_loopback); + ipv6_legacy_addr_t_to_netaddr(&_v6_addr_local, &na_local); + ipv6_legacy_addr_t_to_netaddr(&_v6_addr_mcast, &na_mcast); + ipv6_legacy_addr_set_loopback_addr(&_v6_addr_loopback); /* init sockaddr that write_packet will use to send data */ sa_wp.sin6_family = AF_INET6; @@ -287,12 +287,12 @@ static void *_aodv_receiver_thread(void *arg) } AODV_DEBUG("_aodv_receiver_thread() %s:", - ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &_v6_addr_local)); + ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, &_v6_addr_local)); DEBUG(" UDP packet received from %s\n", - ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &sa_rcv.sin6_addr)); + ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, &sa_rcv.sin6_addr)); struct netaddr _sender; - ipv6_addr_t_to_netaddr(&sa_rcv.sin6_addr, &_sender); + ipv6_legacy_addr_t_to_netaddr(&sa_rcv.sin6_addr, &_sender); /* For some reason we sometimes get passed our own packets. drop them. */ if (netaddr_cmp(&_sender, &na_local) == 0) { @@ -306,21 +306,21 @@ static void *_aodv_receiver_thread(void *arg) return NULL; } -ipv6_addr_t *aodv_get_next_hop(ipv6_addr_t *dest) +ipv6_legacy_addr_t *aodv_get_next_hop(ipv6_legacy_addr_t *dest) { AODV_DEBUG("aodv_get_next_hop() %s:", - ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &_v6_addr_local)); + ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, &_v6_addr_local)); DEBUG(" getting next hop for %s\n", - ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, dest)); + ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, dest)); struct netaddr _tmp_dest; - ipv6_addr_t_to_netaddr(dest, &_tmp_dest); + ipv6_legacy_addr_t_to_netaddr(dest, &_tmp_dest); timex_t now; struct unreachable_node unreachable_nodes[AODVV2_MAX_UNREACHABLE_NODES]; size_t len; /* The network stack sometimes asks us for the next hop towards our own IP */ - if (memcmp(dest, &_v6_addr_local, sizeof(ipv6_addr_t)) == 0) { + if (memcmp(dest, &_v6_addr_local, sizeof(ipv6_legacy_addr_t)) == 0) { AODV_DEBUG("That's me, returning loopback\n"); return &_v6_addr_loopback; } @@ -355,7 +355,7 @@ ipv6_addr_t *aodv_get_next_hop(ipv6_addr_t *dest) return dest; } DEBUG("\t[ndp] no entry for addr %s found\n", - ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, dest)); + ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, dest)); if (rt_entry) { /* Case 1: Undeliverable Packet */ @@ -371,7 +371,7 @@ ipv6_addr_t *aodv_get_next_hop(ipv6_addr_t *dest) } DEBUG("\tfound dest %s in routing table\n", - ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, dest)); + ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, dest)); vtimer_now(&now); rt_entry->lastUsed = now; @@ -383,11 +383,11 @@ ipv6_addr_t *aodv_get_next_hop(ipv6_addr_t *dest) * possible, but safe way: I can't make sure that the current call to * aodv_get_next_hop() is overridden by another call to aodv_get_next_hop() * by a thread with higher priority, thus messing up return values if I just - * use a static ipv6_addr_t. + * use a static ipv6_legacy_addr_t. * The following malloc will never be free()'d. TODO: FIX THIS ASAP. */ - ipv6_addr_t *next_hop = (ipv6_addr_t *) malloc(sizeof(ipv6_addr_t)); - netaddr_to_ipv6_addr_t(&rt_entry->nextHopAddr, next_hop); + ipv6_legacy_addr_t *next_hop = (ipv6_legacy_addr_t *) malloc(sizeof(ipv6_legacy_addr_t)); + netaddr_to_ipv6_legacy_addr_t(&rt_entry->nextHopAddr, next_hop); return next_hop; } @@ -411,7 +411,7 @@ ipv6_addr_t *aodv_get_next_hop(ipv6_addr_t *dest) }; DEBUG("\tNo route found towards %s, starting route discovery... \n", - ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, dest)); + ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, dest)); aodv_send_rreq(&rreq_data); return NULL; @@ -437,7 +437,7 @@ static void _write_packet(struct rfc5444_writer *wr __attribute__ ((unused)), * specific node or the multicast address) from the writer_target struct * iface* is stored in. This is a bit hacky, but it does the trick. */ wt = container_of(iface, struct writer_target, interface); - netaddr_to_ipv6_addr_t(&wt->target_addr, &sa_wp.sin6_addr); + netaddr_to_ipv6_legacy_addr_t(&wt->target_addr, &sa_wp.sin6_addr); /* When originating a RREQ, add it to our RREQ table/update its predecessor */ if (wt->type == RFC5444_MSGTYPE_RREQ @@ -445,7 +445,7 @@ static void _write_packet(struct rfc5444_writer *wr __attribute__ ((unused)), AODV_DEBUG("originating RREQ with SeqNum %d towards %s via %s; updating RREQ table...\n", wt->packet_data.origNode.seqnum, netaddr_to_string(&nbuf, &wt->packet_data.targNode.addr), - ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &sa_wp.sin6_addr)); + ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, &sa_wp.sin6_addr)); rreqtable_is_redundant(&wt->packet_data); } diff --git a/sys/net/routing/aodvv2/aodv.h b/sys/net/routing/aodvv2/aodv.h index f210b7e22e573..ddba15acfd676 100644 --- a/sys/net/routing/aodvv2/aodv.h +++ b/sys/net/routing/aodvv2/aodv.h @@ -20,8 +20,8 @@ #ifndef AODV_H_ #define AODV_H_ -#include -#include "sixlowpan.h" +#include +#include "sixlowpan_legacy.h" #include "kernel.h" #include "udp.h" #include "socket_base/socket.h" @@ -88,15 +88,15 @@ struct msg_container }; /** - * @brief When set as ipv6_iface_routing_provider, this function is called by - * ipv6_sendto() to determine the next hop towards dest. This function + * @brief When set as ipv6_legacy_iface_routing_provider, this function is called by + * ipv6_legacy_sendto() to determine the next hop towards dest. This function * is non-blocking. * * @param[in] dest destination of the packet * @return Address of the next hop towards dest if there is any, * NULL if there is none (yet) */ -ipv6_addr_t *aodv_get_next_hop(ipv6_addr_t *dest); +ipv6_legacy_addr_t *aodv_get_next_hop(ipv6_legacy_addr_t *dest); /** * @brief Dispatch a RREQ diff --git a/sys/net/routing/aodvv2/reader.c b/sys/net/routing/aodvv2/reader.c index 1333a807fb729..ec85a75ce27cd 100644 --- a/sys/net/routing/aodvv2/reader.c +++ b/sys/net/routing/aodvv2/reader.c @@ -326,8 +326,8 @@ static enum rfc5444_result _cb_rreq_end_callback( TODO evaluate that */ - ipv6_addr_t sender_tmp; - netaddr_to_ipv6_addr_t(&packet_data.sender, &sender_tmp); + ipv6_legacy_addr_t sender_tmp; + netaddr_to_ipv6_legacy_addr_t(&packet_data.sender, &sender_tmp); ndp_neighbor_cache_t *ndp_nc_entry = ndp_neighbor_cache_search(&sender_tmp); if (ndp_nc_entry == NULL) { @@ -528,8 +528,8 @@ static enum rfc5444_result _cb_rrep_end_callback( TODO evaluate that */ - ipv6_addr_t sender_tmp; - netaddr_to_ipv6_addr_t(&packet_data.sender, &sender_tmp); + ipv6_legacy_addr_t sender_tmp; + netaddr_to_ipv6_legacy_addr_t(&packet_data.sender, &sender_tmp); ndp_neighbor_cache_t *ndp_nc_entry = ndp_neighbor_cache_search(&sender_tmp); if (ndp_nc_entry == NULL) { diff --git a/sys/net/routing/aodvv2/utils.c b/sys/net/routing/aodvv2/utils.c index de48d134427de..0ce74afd5b8e8 100644 --- a/sys/net/routing/aodvv2/utils.c +++ b/sys/net/routing/aodvv2/utils.c @@ -12,7 +12,7 @@ * @{ * * @file utils.c - * @brief client- and RREQ-table, ipv6 address representation converters + * @brief client- and RREQ-table, ipv6_legacy address representation converters * * @author Lotte Steenbrink */ @@ -229,14 +229,14 @@ static void _reset_entry_if_stale(uint8_t i) } } -void ipv6_addr_t_to_netaddr(ipv6_addr_t *src, struct netaddr *dst) +void ipv6_legacy_addr_t_to_netaddr(ipv6_legacy_addr_t *src, struct netaddr *dst) { dst->_type = AF_INET6; dst->_prefix_len = AODVV2_RIOT_PREFIXLEN; memcpy(dst->_addr, src, sizeof(dst->_addr)); } -void netaddr_to_ipv6_addr_t(struct netaddr *src, ipv6_addr_t *dst) +void netaddr_to_ipv6_legacy_addr_t(struct netaddr *src, ipv6_legacy_addr_t *dst) { memcpy(dst, src->_addr, sizeof(uint8_t) * NETADDR_MAX_LENGTH); } diff --git a/sys/net/routing/aodvv2/utils.h b/sys/net/routing/aodvv2/utils.h index 8baee0e1f98d8..f2b856a503dd0 100644 --- a/sys/net/routing/aodvv2/utils.h +++ b/sys/net/routing/aodvv2/utils.h @@ -12,7 +12,7 @@ * @{ * * @file utils.h - * @brief client- and RREQ-table, ipv6 address representation converters + * @brief client- and RREQ-table, ipv6_legacy address representation converters * * @author Lotte Steenbrink */ @@ -22,7 +22,7 @@ #include -#include "ipv6.h" +#include "ipv6_legacy.h" #include "common/netaddr.h" @@ -95,18 +95,18 @@ void rreqtable_init(void); bool rreqtable_is_redundant(struct aodvv2_packet_data *packet_data); /** - * Convert an IP stored as an ipv6_addr_t to a netaddr - * @param src ipv6_addr_t to convert + * Convert an IP stored as an ipv6_legacy_addr_t to a netaddr + * @param src ipv6_legacy_addr_t to convert * @param dst (empty) netaddr to convert into */ -void ipv6_addr_t_to_netaddr(ipv6_addr_t *src, struct netaddr *dst); +void ipv6_legacy_addr_t_to_netaddr(ipv6_legacy_addr_t *src, struct netaddr *dst); /** - * Convert an IP stored as a netaddr to an ipv6_addr_t + * Convert an IP stored as a netaddr to an ipv6_legacy_addr_t * @param src (empty) netaddr to convert into - * @param dst ipv6_addr_t to convert + * @param dst ipv6_legacy_addr_t to convert */ -void netaddr_to_ipv6_addr_t(struct netaddr *src, ipv6_addr_t *dst); +void netaddr_to_ipv6_legacy_addr_t(struct netaddr *src, ipv6_legacy_addr_t *dst); #ifdef __cplusplus } diff --git a/sys/net/routing/aodvv2/writer.c b/sys/net/routing/aodvv2/writer.c index 79acc8e024af2..eaa44d4a6b632 100644 --- a/sys/net/routing/aodvv2/writer.c +++ b/sys/net/routing/aodvv2/writer.c @@ -249,7 +249,7 @@ void aodv_packet_writer_init(write_packet_func_ptr ptr) rfc5444_writer_register_msgcontentprovider(&writer, &_rerr_message_content_provider, _rerr_addrtlvs, ARRAYSIZE(_rerr_addrtlvs)); - /* register rreq and rrep messages with 16 byte (ipv6) addresses. + /* register rreq and rrep messages with 16 byte (ipv6_legacy) addresses. * AddPacketHeader & addMessageHeader callbacks are triggered here. */ _rreq_msg = rfc5444_writer_register_message(&writer, RFC5444_MSGTYPE_RREQ, false, RFC5444_MAX_ADDRLEN); diff --git a/sys/net/routing/etx_beaconing.c b/sys/net/routing/etx_beaconing.c index 379851d72edbc..244217c240874 100644 --- a/sys/net/routing/etx_beaconing.c +++ b/sys/net/routing/etx_beaconing.c @@ -30,7 +30,7 @@ #include "thread.h" #include "transceiver.h" -#include "sixlowpan/ip.h" +#include "sixlowpan_legacy/ip.h" #include "ieee802154_frame.h" #include "etx_beaconing.h" @@ -50,7 +50,7 @@ /* prototytpes */ static uint8_t etx_count_packet_tx(etx_neighbor_t *candidate); static void etx_set_packets_received(void); -static bool etx_equal_id(ipv6_addr_t *id1, ipv6_addr_t *id2); +static bool etx_equal_id(ipv6_legacy_addr_t *id1, ipv6_legacy_addr_t *id2); static void *etx_beacon(void *); static void *etx_clock(void *); @@ -110,7 +110,7 @@ transceiver_command_t tcmd; //Message to send probes with msg_t mesg; -static ipv6_addr_t *own_address; +static ipv6_legacy_addr_t *own_address; static etx_probe_t *etx_get_send_buf(void) { @@ -137,14 +137,14 @@ void etx_show_candidates(void) "\t cur_etx:%f\n" "\t packets_rx:%d\n" "\t packets_tx:%d\n" - "\t used:%d\n", candidate->addr.uint8[ETX_IPV6_LAST_BYTE], + "\t used:%d\n", candidate->addr.uint8[ETX_IPV6_LEGACY_LAST_BYTE], candidate->cur_etx, candidate->packets_rx, etx_count_packet_tx(candidate), candidate->used); } } -void etx_init_beaconing(ipv6_addr_t *address) +void etx_init_beaconing(ipv6_legacy_addr_t *address) { own_address = address; //set code @@ -188,7 +188,7 @@ static void *etx_beacon(void *arg) for (uint8_t i = 0; i < ETX_BEST_CANDIDATES; i++) { if (candidates[i].used != 0) { packet->data[i * ETX_TUPLE_SIZE] = - candidates[i].addr.uint8[ETX_IPV6_LAST_BYTE]; + candidates[i].addr.uint8[ETX_IPV6_LEGACY_LAST_BYTE]; packet->data[i * ETX_TUPLE_SIZE + ETX_PKT_REC_OFFSET] = etx_count_packet_tx(&candidates[i]); p_length = p_length + ETX_PKT_HDR_LEN; @@ -199,7 +199,7 @@ static void *etx_beacon(void *arg) /* will be send broadcast, so if_id and destination address will be * ignored (see documentation) */ - sixlowpan_mac_send_ieee802154_frame(0, NULL, 8, &etx_send_buf[0], + sixlowpan_legacy_mac_send_ieee802154_frame(0, NULL, 8, &etx_send_buf[0], ETX_DATA_MAXLEN + ETX_PKT_HDR_LEN, 1); DEBUG("sent beacon!\n"); etx_set_packets_received(); @@ -220,7 +220,7 @@ static void *etx_beacon(void *arg) return NULL; } -etx_neighbor_t *etx_find_candidate(ipv6_addr_t *address) +etx_neighbor_t *etx_find_candidate(ipv6_legacy_addr_t *address) { /* * find the candidate with address address and returns it, or returns NULL @@ -273,7 +273,7 @@ static void *etx_clock(void *arg) return NULL; } -double etx_get_metric(ipv6_addr_t *address) +double etx_get_metric(ipv6_legacy_addr_t *address) { etx_neighbor_t *candidate = etx_find_candidate(address); @@ -292,7 +292,7 @@ double etx_get_metric(ipv6_addr_t *address) return 0; } -etx_neighbor_t *etx_add_candidate(ipv6_addr_t *address) +etx_neighbor_t *etx_add_candidate(ipv6_legacy_addr_t *address) { DEBUG("add candidate\n"); /* @@ -340,7 +340,7 @@ etx_neighbor_t *etx_add_candidate(ipv6_addr_t *address) return NULL ; } -void etx_handle_beacon(ipv6_addr_t *candidate_address) +void etx_handle_beacon(ipv6_legacy_addr_t *candidate_address) { /* * Handle the ETX probe that has been received and update all infos. @@ -352,7 +352,7 @@ void etx_handle_beacon(ipv6_addr_t *candidate_address) "\tPackage Option:%x\n" "\t Data Length:%u\n" "\tSource Address:%d\n\n", etx_rec_buf[ETX_PKT_OPT], etx_rec_buf[ETX_PKT_LEN], - candidate_address->uint8[ETX_IPV6_LAST_BYTE]); + candidate_address->uint8[ETX_IPV6_LEGACY_LAST_BYTE]); etx_neighbor_t *candidate = etx_find_candidate(candidate_address); @@ -381,7 +381,7 @@ void etx_handle_beacon(ipv6_addr_t *candidate_address) rec_pkt->data[i * ETX_TUPLE_SIZE + ETX_PKT_REC_OFFSET]); if (rec_pkt->data[i * ETX_TUPLE_SIZE] - == own_address->uint8[ETX_IPV6_LAST_BYTE]) { + == own_address->uint8[ETX_IPV6_LEGACY_LAST_BYTE]) { candidate->packets_rx = rec_pkt->data[i * ETX_TUPLE_SIZE + ETX_PKT_REC_OFFSET]; @@ -403,11 +403,11 @@ static void *etx_radio(void *arg) msg_init_queue(msg_que, ETX_RCV_QUEUE_SIZE); - ipv6_addr_t ll_address; - ipv6_addr_t candidate_addr; + ipv6_legacy_addr_t ll_address; + ipv6_legacy_addr_t candidate_addr; - ipv6_addr_set_link_local_prefix(&ll_address); - ipv6_net_if_get_best_src_addr(&candidate_addr, &ll_address); + ipv6_legacy_addr_set_link_local_prefix(&ll_address); + ipv6_legacy_net_if_get_best_src_addr(&candidate_addr, &ll_address); while (1) { msg_receive(&m); @@ -424,7 +424,7 @@ static void *etx_radio(void *arg) //create IPv6 address from radio packet //we can do the cast here since rpl nodes can only have addr //up to 8 bits - candidate_addr.uint8[ETX_IPV6_LAST_BYTE] = (uint8_t) p->src; + candidate_addr.uint8[ETX_IPV6_LEGACY_LAST_BYTE] = (uint8_t) p->src; //handle the beacon mutex_lock(&etx_mutex); etx_handle_beacon(&candidate_addr); @@ -486,7 +486,7 @@ void etx_update(etx_neighbor_t *candidate) "\n" "Received Packets: %d\n" "Sent Packets : %d\n\n", - candidate->cur_etx, candidate->addr.uint8[ETX_IPV6_LAST_BYTE], + candidate->cur_etx, candidate->addr.uint8[ETX_IPV6_LEGACY_LAST_BYTE], d_f, d_r, candidate->packets_rx, etx_count_packet_tx(candidate)); } @@ -552,7 +552,7 @@ static void etx_set_packets_received(void) } } -bool etx_equal_id(ipv6_addr_t *id1, ipv6_addr_t *id2) +bool etx_equal_id(ipv6_legacy_addr_t *id1, ipv6_legacy_addr_t *id2) { for (uint8_t i = 0; i < 4; i++) { if (id1->uint32[i] != id2->uint32[i]) { diff --git a/sys/net/routing/rpl/rpl.c b/sys/net/routing/rpl/rpl.c index 636f1d266be38..aac137eeb0b3d 100644 --- a/sys/net/routing/rpl/rpl.c +++ b/sys/net/routing/rpl/rpl.c @@ -32,7 +32,7 @@ #include "of_mrhof.h" #include "trickle.h" -#include "sixlowpan.h" +#include "sixlowpan_legacy.h" #include "net_help.h" /* You can only run Storing Mode by now. Other unsupported modes lead to default (Storing Mode) */ @@ -48,7 +48,7 @@ #if ENABLE_DEBUG #undef TRICKLE_TIMER_STACKSIZE #define TRICKLE_TIMER_STACKSIZE (KERNEL_CONF_STACKSIZE_MAIN) -char addr_str[IPV6_MAX_ADDR_STR_LEN]; +char addr_str[IPV6_LEGACY_MAX_ADDR_STR_LEN]; #endif #include "debug.h" @@ -63,8 +63,8 @@ uint8_t rpl_buffer[BUFFER_SIZE - LL_HDR_LEN]; #if RPL_DEFAULT_MOP == RPL_NON_STORING_MODE uint8_t srh_buffer[BUFFER_SIZE]; uint8_t srh_send_buffer[BUFFER_SIZE]; -ipv6_addr_t *down_next_hop; -ipv6_srh_t *srh_header; +ipv6_legacy_addr_t *down_next_hop; +ipv6_legacy_srh_t *srh_header; msg_t srh_m_send, srh_m_recv; rpl_routing_entry_t rpl_routing_table[RPL_MAX_ROUTING_ENTRIES_NON_STORING]; #else @@ -72,10 +72,10 @@ rpl_routing_entry_t rpl_routing_table[RPL_MAX_ROUTING_ENTRIES_STORING]; #endif uint8_t rpl_max_routing_entries; -ipv6_addr_t my_address; +ipv6_legacy_addr_t my_address; /* IPv6 message buffer */ -ipv6_hdr_t *ipv6_buf; +ipv6_legacy_hdr_t *ipv6_legacy_buf; icmpv6_hdr_t *icmp_buf; uint8_t rpl_init(int if_id) @@ -107,14 +107,14 @@ uint8_t rpl_init(int if_id) PRIORITY_MAIN - 1, CREATE_STACKTEST, rpl_process, NULL, "rpl_process"); - sixlowpan_lowpan_init_interface(if_id); + sixlowpan_legacy_lowpan_init_interface(if_id); /* need link local prefix to query _our_ corresponding address */ - ipv6_addr_t ll_address; - ipv6_addr_set_link_local_prefix(&ll_address); - ipv6_net_if_get_best_src_addr(&my_address, &ll_address); - ipv6_register_rpl_handler(rpl_process_pid); - ipv6_iface_set_srh_indicator(rpl_is_root); - ipv6_iface_set_routing_provider(rpl_get_next_hop); + ipv6_legacy_addr_t ll_address; + ipv6_legacy_addr_set_link_local_prefix(&ll_address); + ipv6_legacy_net_if_get_best_src_addr(&my_address, &ll_address); + ipv6_legacy_register_rpl_handler(rpl_process_pid); + ipv6_legacy_iface_set_srh_indicator(rpl_is_root); + ipv6_legacy_iface_set_routing_provider(rpl_get_next_hop); DEBUGF("All addresses set!\n"); /* initialize objective function manager */ @@ -134,13 +134,13 @@ uint8_t rpl_is_root(void) } #if RPL_DEFAULT_MOP == RPL_NON_STORING_MODE -void internal_srh_process(ipv6_srh_t *srh_header) +void internal_srh_process(ipv6_legacy_srh_t *srh_header) { /* modify it accordingly - the number of entries is not depending on padding, because there is none. */ - uint8_t n = srh_header->hdrextlen / sizeof(ipv6_addr_t); + uint8_t n = srh_header->hdrextlen / sizeof(ipv6_legacy_addr_t); if (srh_header->segments_left > n) { - memset(&down_next_hop, 0, sizeof(ipv6_addr_t)); + memset(&down_next_hop, 0, sizeof(ipv6_legacy_addr_t)); DEBUGF("[Error] source-routing header is invalid.\n"); } else { @@ -149,7 +149,7 @@ void internal_srh_process(ipv6_srh_t *srh_header) down_next_hop = &srh_header->route[n - segs]; srh_header->segments_left = segs - 1; DEBUGF("Segments left after reduction: %d\n", srh_header->segments_left); - DEBUGF("Next hop is: %s\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, down_next_hop)); + DEBUGF("Next hop is: %s\n", ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, down_next_hop)); } } #endif @@ -166,15 +166,15 @@ void *rpl_process(void *arg) mutex_lock(&rpl_recv_mutex); /* differentiate packet types */ - ipv6_buf = ((ipv6_hdr_t *)m_recv.content.ptr); - memcpy(&rpl_buffer, ipv6_buf, NTOHS(ipv6_buf->length) + IPV6_HDR_LEN); + ipv6_legacy_buf = ((ipv6_legacy_hdr_t *)m_recv.content.ptr); + memcpy(&rpl_buffer, ipv6_legacy_buf, NTOHS(ipv6_legacy_buf->length) + IPV6_LEGACY_HDR_LEN); /* This is an RPL-related message. */ - if (ipv6_buf->nextheader == IPV6_PROTO_NUM_ICMPV6) { - icmp_buf = ((icmpv6_hdr_t *)(m_recv.content.ptr + IPV6_HDR_LEN)); + if (ipv6_legacy_buf->nextheader == IPV6_LEGACY_PROTO_NUM_ICMPV6) { + icmp_buf = ((icmpv6_hdr_t *)(m_recv.content.ptr + IPV6_LEGACY_HDR_LEN)); /* get code for message-interpretation and process message */ - DEBUGF("Received RPL information of type %04X and length %u\n", icmp_buf->code, NTOHS(ipv6_buf->length)); + DEBUGF("Received RPL information of type %04X and length %u\n", icmp_buf->code, NTOHS(ipv6_legacy_buf->length)); switch (icmp_buf->code) { case (ICMP_CODE_DIS): { @@ -211,30 +211,30 @@ void *rpl_process(void *arg) /* If the message is not RPL-type, it relates to non-storing mode */ else if (RPL_DEFAULT_MOP == RPL_NON_STORING_MODE) { - if (ipv6_buf->nextheader == IPV6_PROTO_NUM_SRH) { - srh_header = ((ipv6_srh_t *)(m_recv.content.ptr + IPV6_HDR_LEN)); + if (ipv6_legacy_buf->nextheader == IPV6_LEGACY_PROTO_NUM_SRH) { + srh_header = ((ipv6_legacy_srh_t *)(m_recv.content.ptr + IPV6_LEGACY_HDR_LEN)); /* if there are no segments left, the routing is finished */ if (srh_header->segments_left == 0) { DEBUGF("Source routing finished with next header: %02X.\n", srh_header->nextheader); DEBUGF("Size of srh: %d\n", srh_header->hdrextlen); - uint8_t *payload = ((uint8_t *)(m_recv.content.ptr + IPV6_HDR_LEN + sizeof(ipv6_srh_t)+srh_header->hdrextlen)); - rpl_remove_srh_header(ipv6_buf, payload, srh_header->nextheader); + uint8_t *payload = ((uint8_t *)(m_recv.content.ptr + IPV6_LEGACY_HDR_LEN + sizeof(ipv6_legacy_srh_t)+srh_header->hdrextlen)); + rpl_remove_srh_header(ipv6_legacy_buf, payload, srh_header->nextheader); } else { internal_srh_process(srh_header); if (down_next_hop != NULL) { - uint8_t *payload = ((uint8_t *)(m_recv.content.ptr + IPV6_HDR_LEN)); - rpl_srh_sendto(payload, NTOHS(ipv6_buf->length), &ipv6_buf->srcaddr, down_next_hop, srh_header, 0); + uint8_t *payload = ((uint8_t *)(m_recv.content.ptr + IPV6_LEGACY_HDR_LEN)); + rpl_srh_sendto(payload, NTOHS(ipv6_legacy_buf->length), &ipv6_legacy_buf->srcaddr, down_next_hop, srh_header, 0); } } } else { - srh_header = rpl_get_srh_header(ipv6_buf); + srh_header = rpl_get_srh_header(ipv6_legacy_buf); if (srh_header != NULL) { - uint8_t *payload = ((uint8_t *)(m_recv.content.ptr + IPV6_HDR_LEN)); - rpl_srh_sendto(payload, NTOHS(ipv6_buf->length), &ipv6_buf->srcaddr, &ipv6_buf->destaddr, srh_header, srh_header->hdrextlen + sizeof(ipv6_srh_t)); + uint8_t *payload = ((uint8_t *)(m_recv.content.ptr + IPV6_LEGACY_HDR_LEN)); + rpl_srh_sendto(payload, NTOHS(ipv6_legacy_buf->length), &ipv6_legacy_buf->srcaddr, &ipv6_legacy_buf->destaddr, srh_header, srh_header->hdrextlen + sizeof(ipv6_legacy_srh_t)); } } @@ -245,10 +245,10 @@ void *rpl_process(void *arg) } } -void rpl_send_DIO(ipv6_addr_t *destination) +void rpl_send_DIO(ipv6_legacy_addr_t *destination) { if (destination) { - DEBUGF("Send DIO to %s\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, destination)); + DEBUGF("Send DIO to %s\n", ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, destination)); } mutex_lock(&rpl_send_mutex); @@ -256,10 +256,10 @@ void rpl_send_DIO(ipv6_addr_t *destination) mutex_unlock(&rpl_send_mutex); } -void rpl_send_DAO(ipv6_addr_t *destination, uint8_t lifetime, bool default_lifetime, uint8_t start_index) +void rpl_send_DAO(ipv6_legacy_addr_t *destination, uint8_t lifetime, bool default_lifetime, uint8_t start_index) { if (destination) { - DEBUGF("Send DAO to %s\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, destination)); + DEBUGF("Send DAO to %s\n", ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, destination)); } mutex_lock(&rpl_send_mutex); @@ -267,10 +267,10 @@ void rpl_send_DAO(ipv6_addr_t *destination, uint8_t lifetime, bool default_lifet mutex_unlock(&rpl_send_mutex); } -void rpl_send_DIS(ipv6_addr_t *destination) +void rpl_send_DIS(ipv6_legacy_addr_t *destination) { if (destination) { - DEBUGF("Send DIS to %s\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, destination)); + DEBUGF("Send DIS to %s\n", ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, destination)); } mutex_lock(&rpl_send_mutex); @@ -278,10 +278,10 @@ void rpl_send_DIS(ipv6_addr_t *destination) mutex_unlock(&rpl_send_mutex); } -void rpl_send_DAO_ACK(ipv6_addr_t *destination) +void rpl_send_DAO_ACK(ipv6_legacy_addr_t *destination) { if (destination) { - DEBUGF("Send DAO ACK to %s\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, destination)); + DEBUGF("Send DAO ACK to %s\n", ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, destination)); } mutex_lock(&rpl_send_mutex); @@ -318,25 +318,25 @@ void rpl_recv_DAO_ACK(void) rpl_recv_dao_ack_mode(); } -ipv6_addr_t *rpl_get_next_hop(ipv6_addr_t *addr) +ipv6_legacy_addr_t *rpl_get_next_hop(ipv6_legacy_addr_t *addr) { - DEBUGF("Looking up the next hop to %s\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, addr)); + DEBUGF("Looking up the next hop to %s\n", ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, addr)); for (uint8_t i = 0; i < rpl_max_routing_entries; i++) { if (rpl_routing_table[i].used) { - DEBUGF("checking %d: %s\n", i, ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &rpl_routing_table[i].address)); + DEBUGF("checking %d: %s\n", i, ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, &rpl_routing_table[i].address)); } if ((RPL_DEFAULT_MOP == RPL_NON_STORING_MODE) && rpl_is_root()) { if (rpl_routing_table[i].used && rpl_equal_id(&rpl_routing_table[i].address, addr)) { - DEBUGF("found %d: %s\n", i, ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &rpl_routing_table[i].address)); + DEBUGF("found %d: %s\n", i, ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, &rpl_routing_table[i].address)); return &rpl_routing_table[i].address; } } else { if (rpl_routing_table[i].used && rpl_equal_id(&rpl_routing_table[i].address, addr)) { - DEBUGF("found %d: %s\n", i, ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &rpl_routing_table[i].next_hop)); + DEBUGF("found %d: %s\n", i, ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, &rpl_routing_table[i].next_hop)); return &rpl_routing_table[i].next_hop; } } @@ -345,7 +345,7 @@ ipv6_addr_t *rpl_get_next_hop(ipv6_addr_t *addr) return (rpl_get_my_preferred_parent()); } -void rpl_add_routing_entry(ipv6_addr_t *addr, ipv6_addr_t *next_hop, uint16_t lifetime) +void rpl_add_routing_entry(ipv6_legacy_addr_t *addr, ipv6_legacy_addr_t *next_hop, uint16_t lifetime) { rpl_routing_entry_t *entry = rpl_find_routing_entry(addr); @@ -354,12 +354,12 @@ void rpl_add_routing_entry(ipv6_addr_t *addr, ipv6_addr_t *next_hop, uint16_t li return; } - DEBUGF("Adding routing entry %s\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, addr)); + DEBUGF("Adding routing entry %s\n", ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, addr)); for (uint8_t i = 0; i < rpl_max_routing_entries; i++) { if (!rpl_routing_table[i].used) { - memcpy(&rpl_routing_table[i].address, addr, sizeof(ipv6_addr_t)); - memcpy(&rpl_routing_table[i].next_hop, next_hop, sizeof(ipv6_addr_t)); + memcpy(&rpl_routing_table[i].address, addr, sizeof(ipv6_legacy_addr_t)); + memcpy(&rpl_routing_table[i].next_hop, next_hop, sizeof(ipv6_legacy_addr_t)); rpl_routing_table[i].lifetime = lifetime; rpl_routing_table[i].used = 1; break; @@ -367,10 +367,10 @@ void rpl_add_routing_entry(ipv6_addr_t *addr, ipv6_addr_t *next_hop, uint16_t li } } -void rpl_del_routing_entry(ipv6_addr_t *addr) +void rpl_del_routing_entry(ipv6_legacy_addr_t *addr) { - DEBUGF("Deleting routing entry %s\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, addr)); + DEBUGF("Deleting routing entry %s\n", ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, addr)); for (uint8_t i = 0; i < rpl_max_routing_entries; i++) { if (rpl_routing_table[i].used && rpl_equal_id(&rpl_routing_table[i].address, addr)) { @@ -380,10 +380,10 @@ void rpl_del_routing_entry(ipv6_addr_t *addr) } } -rpl_routing_entry_t *rpl_find_routing_entry(ipv6_addr_t *addr) +rpl_routing_entry_t *rpl_find_routing_entry(ipv6_legacy_addr_t *addr) { - DEBUGF("Finding routing entry %s\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, addr)); + DEBUGF("Finding routing entry %s\n", ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, addr)); for (uint8_t i = 0; i < rpl_max_routing_entries; i++) { if (rpl_routing_table[i].used && rpl_equal_id(&rpl_routing_table[i].address, addr)) { @@ -410,7 +410,7 @@ rpl_routing_entry_t *rpl_get_routing_table(void) #if RPL_DEFAULT_MOP == RPL_NON_STORING_MODE /* everything from here on is non-storing mode related */ -void rpl_add_srh_entry(ipv6_addr_t *child, ipv6_addr_t *parent, uint16_t lifetime) +void rpl_add_srh_entry(ipv6_legacy_addr_t *child, ipv6_legacy_addr_t *parent, uint16_t lifetime) { rpl_routing_entry_t *entry = rpl_find_routing_entry(child); @@ -420,7 +420,7 @@ void rpl_add_srh_entry(ipv6_addr_t *child, ipv6_addr_t *parent, uint16_t lifetim * delete the previous entry and add it below. */ if (entry != NULL) { - if (ipv6_addr_is_equal(parent, &entry->next_hop)) { + if (ipv6_legacy_addr_is_equal(parent, &entry->next_hop)) { entry->lifetime = lifetime; return; } @@ -434,13 +434,13 @@ void rpl_add_srh_entry(ipv6_addr_t *child, ipv6_addr_t *parent, uint16_t lifetim * address is now child (unique, iteration variable) and parent is now next_hop. The whole routing table * transforms to a list of childs and their parents, so that route aggregation can be done properly. */ - DEBUGF("Adding source-routing entry child: %s\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, child)); - DEBUGF("Adding source-routing entry parent: %s\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, parent)); + DEBUGF("Adding source-routing entry child: %s\n", ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, child)); + DEBUGF("Adding source-routing entry parent: %s\n", ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, parent)); for (uint8_t i = 0; i < rpl_max_routing_entries; i++) { if (!rpl_routing_table[i].used) { - memcpy(&rpl_routing_table[i].address, child, sizeof(ipv6_addr_t)); - memcpy(&rpl_routing_table[i].next_hop, parent, sizeof(ipv6_addr_t)); + memcpy(&rpl_routing_table[i].address, child, sizeof(ipv6_legacy_addr_t)); + memcpy(&rpl_routing_table[i].next_hop, parent, sizeof(ipv6_legacy_addr_t)); rpl_routing_table[i].lifetime = lifetime; rpl_routing_table[i].used = 1; break; @@ -456,34 +456,34 @@ void rpl_add_srh_entry(ipv6_addr_t *child, ipv6_addr_t *parent, uint16_t lifetim * * @return 1 if *a* and *b* are equal for host suffixes, 0 otherwise. */ -int ipv6_suffix_is_equal(const ipv6_addr_t *a, const ipv6_addr_t *b) +int ipv6_legacy_suffix_is_equal(const ipv6_legacy_addr_t *a, const ipv6_legacy_addr_t *b) { return (a->uint32[2] == b->uint32[2]) && (a->uint32[3] == b->uint32[3]); } -ipv6_srh_t *rpl_get_srh_header(ipv6_hdr_t *act_ipv6_hdr) +ipv6_legacy_srh_t *rpl_get_srh_header(ipv6_legacy_hdr_t *act_ipv6_legacy_hdr) { uint8_t route_length = RPL_MAX_SRH_PATH_LENGTH; - ipv6_addr_t rev_route[route_length]; - ipv6_addr_t *actual_node; + ipv6_legacy_addr_t rev_route[route_length]; + ipv6_legacy_addr_t *actual_node; uint8_t counter = 0; uint8_t traceable; - ipv6_srh_t *srh_header = (ipv6_srh_t *)(&srh_buffer); + ipv6_legacy_srh_t *srh_header = (ipv6_legacy_srh_t *)(&srh_buffer); /* init source route with child */ - actual_node = &(act_ipv6_hdr->destaddr); - DEBUGF("DESTINATION NODE: %s\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, actual_node)); + actual_node = &(act_ipv6_legacy_hdr->destaddr); + DEBUGF("DESTINATION NODE: %s\n", ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, actual_node)); while (!(rpl_equal_id(actual_node, &my_address))) { /* set check variable - this is reversed, if a child/parent-relation is found in one iteration of the routing table */ traceable = 0; for (uint8_t i = 0; i < rpl_max_routing_entries; i++) { - if (rpl_routing_table[i].used && ipv6_suffix_is_equal(&rpl_routing_table[i].address, actual_node)) { - DEBUGF("[INFO] Found parent-child relation with P: %s\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &rpl_routing_table[i].next_hop)); - DEBUGF(" and C: %s\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, actual_node)); - memcpy(&rev_route[counter], actual_node, sizeof(ipv6_addr_t)); + if (rpl_routing_table[i].used && ipv6_legacy_suffix_is_equal(&rpl_routing_table[i].address, actual_node)) { + DEBUGF("[INFO] Found parent-child relation with P: %s\n", ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, &rpl_routing_table[i].next_hop)); + DEBUGF(" and C: %s\n", ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, actual_node)); + memcpy(&rev_route[counter], actual_node, sizeof(ipv6_legacy_addr_t)); actual_node = &rpl_routing_table[i].next_hop; counter++; @@ -507,10 +507,10 @@ ipv6_srh_t *rpl_get_srh_header(ipv6_hdr_t *act_ipv6_hdr) /* build real route based on reversed route. After building it starts with the node next to destination */ if (counter > 1) { for (uint8_t i = 0; i < counter-1; i++) { - memcpy(&srh_header->route[i], &rev_route[counter-i-2], sizeof(ipv6_addr_t)); + memcpy(&srh_header->route[i], &rev_route[counter-i-2], sizeof(ipv6_legacy_addr_t)); } - srh_header->hdrextlen = sizeof(ipv6_addr_t)*(counter-1); - memcpy(&(act_ipv6_hdr->destaddr), &rev_route[counter-1], sizeof(ipv6_addr_t)); + srh_header->hdrextlen = sizeof(ipv6_legacy_addr_t)*(counter-1); + memcpy(&(act_ipv6_legacy_hdr->destaddr), &rev_route[counter-1], sizeof(ipv6_legacy_addr_t)); DEBUGF("Route size: %d\n", srh_header->hdrextlen); } else { @@ -518,7 +518,7 @@ ipv6_srh_t *rpl_get_srh_header(ipv6_hdr_t *act_ipv6_hdr) } /* actually build SRH-header */ - memcpy(&srh_header->nextheader, &(act_ipv6_hdr->nextheader), sizeof(uint8_t)); + memcpy(&srh_header->nextheader, &(act_ipv6_legacy_hdr->nextheader), sizeof(uint8_t)); srh_header->routing_type = 3; srh_header->segments_left = counter - 1; /* cmpri & cmpre are both 0, because by now there is only support for full addresses */ @@ -527,32 +527,32 @@ ipv6_srh_t *rpl_get_srh_header(ipv6_hdr_t *act_ipv6_hdr) /* since the route has exactly the length of its intermediate nodes, padding is zero. */ srh_header->pad = 0; srh_header->reserved = 0; - /* set the destination-address in ipv6-buf->destaddr, which is the pointer of child */ + /* set the destination-address in ipv6_legacy-buf->destaddr, which is the pointer of child */ return srh_header; } -void rpl_remove_srh_header(ipv6_hdr_t *ipv6_header, const void *buf, uint8_t nextheader) +void rpl_remove_srh_header(ipv6_legacy_hdr_t *ipv6_legacy_header, const void *buf, uint8_t nextheader) { - ipv6_hdr_t *temp_ipv6_header = ((ipv6_hdr_t *)(&srh_send_buffer)); - uint8_t *payload = &srh_send_buffer[IPV6_HDR_LEN]; - memcpy(temp_ipv6_header, ipv6_header, sizeof(ipv6_hdr_t)); - int msg_length = NTOHS(ipv6_header->length) - sizeof(ipv6_srh_t); - temp_ipv6_header->length = HTONS(msg_length); - temp_ipv6_header->nextheader = nextheader; + ipv6_legacy_hdr_t *temp_ipv6_legacy_header = ((ipv6_legacy_hdr_t *)(&srh_send_buffer)); + uint8_t *payload = &srh_send_buffer[IPV6_LEGACY_HDR_LEN]; + memcpy(temp_ipv6_legacy_header, ipv6_legacy_header, sizeof(ipv6_legacy_hdr_t)); + int msg_length = NTOHS(ipv6_legacy_header->length) - sizeof(ipv6_legacy_srh_t); + temp_ipv6_legacy_header->length = HTONS(msg_length); + temp_ipv6_legacy_header->nextheader = nextheader; memcpy(payload, buf, msg_length); DEBUGF("Source routing header extraction finished.\n"); - DEBUGF("Dest is now: %s\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &temp_ipv6_header->destaddr)); + DEBUGF("Dest is now: %s\n", ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, &temp_ipv6_legacy_header->destaddr)); srh_m_send.content.ptr = (char *) srh_send_buffer; DEBUGF("Return from relay: %d\n", msg_send_receive(&srh_m_send, &srh_m_recv, ip_process_pid)); } -int rpl_srh_sendto(const void *buf, uint16_t len, ipv6_addr_t *src, ipv6_addr_t *dest, ipv6_srh_t *srh_header, uint8_t srh_length) +int rpl_srh_sendto(const void *buf, uint16_t len, ipv6_legacy_addr_t *src, ipv6_legacy_addr_t *dest, ipv6_legacy_srh_t *srh_header, uint8_t srh_length) { - ipv6_hdr_t *temp_ipv6_header = ((ipv6_hdr_t *)(&srh_send_buffer)); - ipv6_srh_t *current_packet = ((ipv6_srh_t *)(&srh_send_buffer[IPV6_HDR_LEN])); - uint8_t *payload = &srh_send_buffer[IPV6_HDR_LEN + srh_length]; - memcpy(&(temp_ipv6_header->destaddr), dest, sizeof(ipv6_addr_t)); - memcpy(&(temp_ipv6_header->srcaddr), src, sizeof(ipv6_addr_t)); + ipv6_legacy_hdr_t *temp_ipv6_legacy_header = ((ipv6_legacy_hdr_t *)(&srh_send_buffer)); + ipv6_legacy_srh_t *current_packet = ((ipv6_legacy_srh_t *)(&srh_send_buffer[IPV6_LEGACY_HDR_LEN])); + uint8_t *payload = &srh_send_buffer[IPV6_LEGACY_HDR_LEN + srh_length]; + memcpy(&(temp_ipv6_legacy_header->destaddr), dest, sizeof(ipv6_legacy_addr_t)); + memcpy(&(temp_ipv6_legacy_header->srcaddr), src, sizeof(ipv6_legacy_addr_t)); memcpy(current_packet, srh_header, srh_length); memcpy(payload, buf, len); uint16_t plength = srh_length + len; @@ -561,6 +561,6 @@ int rpl_srh_sendto(const void *buf, uint16_t len, ipv6_addr_t *src, ipv6_addr_t DEBUGF("SRH-length: %d\n", current_packet->hdrextlen); DEBUGF("My payload length: %d\n", plength); - return ipv6_sendto(&temp_ipv6_header->destaddr, IPV6_PROTO_NUM_SRH, (uint8_t *)current_packet, plength, &temp_ipv6_header->destaddr); + return ipv6_legacy_sendto(&temp_ipv6_legacy_header->destaddr, IPV6_LEGACY_PROTO_NUM_SRH, (uint8_t *)current_packet, plength, &temp_ipv6_legacy_header->destaddr); } #endif diff --git a/sys/net/routing/rpl/rpl_dodag.c b/sys/net/routing/rpl/rpl_dodag.c index 19477c46345d4..000ebdad61ab3 100644 --- a/sys/net/routing/rpl/rpl_dodag.c +++ b/sys/net/routing/rpl/rpl_dodag.c @@ -27,7 +27,7 @@ #define ENABLE_DEBUG (0) #if ENABLE_DEBUG -char addr_str[IPV6_MAX_ADDR_STR_LEN]; +char addr_str[IPV6_LEGACY_MAX_ADDR_STR_LEN]; #endif #include "debug.h" @@ -78,7 +78,7 @@ rpl_instance_t *rpl_get_my_instance(void) return NULL; } -rpl_dodag_t *rpl_new_dodag(uint8_t instanceid, ipv6_addr_t *dodagid) +rpl_dodag_t *rpl_new_dodag(uint8_t instanceid, ipv6_legacy_addr_t *dodagid) { rpl_instance_t *inst; inst = rpl_get_instance(instanceid); @@ -107,7 +107,7 @@ rpl_dodag_t *rpl_new_dodag(uint8_t instanceid, ipv6_addr_t *dodagid) } -rpl_dodag_t *rpl_get_dodag(ipv6_addr_t *id) +rpl_dodag_t *rpl_get_dodag(ipv6_legacy_addr_t *id) { for (int i = 0; i < RPL_MAX_DODAGS; i++) { if (dodags[i].used && (rpl_equal_id(&dodags[i].dodag_id, id))) { @@ -139,7 +139,7 @@ void rpl_leave_dodag(rpl_dodag_t *dodag) rpl_delete_all_parents(); } -bool rpl_equal_id(ipv6_addr_t *id1, ipv6_addr_t *id2) +bool rpl_equal_id(ipv6_legacy_addr_t *id1, ipv6_legacy_addr_t *id2) { for (uint8_t i = 0; i < 2; i++) { DEBUGF("ID1: %d ID2: %d\n", id1->uint8[12 + i], id2->uint8[12 + i]); @@ -153,7 +153,7 @@ bool rpl_equal_id(ipv6_addr_t *id1, ipv6_addr_t *id2) } -rpl_parent_t *rpl_new_parent(rpl_dodag_t *dodag, ipv6_addr_t *address, uint16_t rank) +rpl_parent_t *rpl_new_parent(rpl_dodag_t *dodag, ipv6_legacy_addr_t *address, uint16_t rank) { rpl_parent_t *parent; rpl_parent_t *end; @@ -176,7 +176,7 @@ rpl_parent_t *rpl_new_parent(rpl_dodag_t *dodag, ipv6_addr_t *address, uint16_t return rpl_new_parent(dodag, address, rank); } -rpl_parent_t *rpl_find_parent(ipv6_addr_t *address) +rpl_parent_t *rpl_find_parent(ipv6_legacy_addr_t *address) { rpl_parent_t *parent; rpl_parent_t *end; @@ -319,7 +319,7 @@ void rpl_parent_update(rpl_parent_t *parent) } } -void rpl_join_dodag(rpl_dodag_t *dodag, ipv6_addr_t *parent, uint16_t parent_rank) +void rpl_join_dodag(rpl_dodag_t *dodag, ipv6_legacy_addr_t *parent, uint16_t parent_rank) { rpl_dodag_t *my_dodag; rpl_parent_t *preferred_parent; @@ -362,7 +362,7 @@ void rpl_join_dodag(rpl_dodag_t *dodag, ipv6_addr_t *parent, uint16_t parent_ran DEBUG("\tdefault_lifetime:\t%02X\n", my_dodag->default_lifetime); DEBUG("\tgrounded:\t%02X\n", my_dodag->grounded); DEBUG("\tmy_preferred_parent:\t%s\n", - ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, + ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, &my_dodag->my_preferred_parent->addr)); DEBUG("\tmy_preferred_parent rank\t%02X\n", my_dodag->my_preferred_parent->rank); DEBUG("\tmy_preferred_parent lifetime\t%04X\n", my_dodag->my_preferred_parent->lifetime); @@ -371,7 +371,7 @@ void rpl_join_dodag(rpl_dodag_t *dodag, ipv6_addr_t *parent, uint16_t parent_ran delay_dao(); } -void rpl_global_repair(rpl_dodag_t *dodag, ipv6_addr_t *p_addr, uint16_t rank) +void rpl_global_repair(rpl_dodag_t *dodag, ipv6_legacy_addr_t *p_addr, uint16_t rank) { DEBUGF("[INFO] Global repair started\n"); rpl_dodag_t *my_dodag = rpl_get_my_dodag(); @@ -420,7 +420,7 @@ void rpl_local_repair(void) } -ipv6_addr_t *rpl_get_my_preferred_parent(void) +ipv6_legacy_addr_t *rpl_get_my_preferred_parent(void) { rpl_dodag_t *my_dodag = rpl_get_my_dodag(); diff --git a/sys/net/routing/rpl/rpl_nonstoring/rpl_nonstoring.c b/sys/net/routing/rpl/rpl_nonstoring/rpl_nonstoring.c index 6697d4b564be2..6102461125029 100644 --- a/sys/net/routing/rpl/rpl_nonstoring/rpl_nonstoring.c +++ b/sys/net/routing/rpl/rpl_nonstoring/rpl_nonstoring.c @@ -22,20 +22,20 @@ #include "msg.h" #include "trickle.h" -#include "sixlowpan.h" +#include "sixlowpan_legacy.h" #include "net_help.h" #define ENABLE_DEBUG (0) #if ENABLE_DEBUG #define DEBUG_ENABLED -char addr_str_mode[IPV6_MAX_ADDR_STR_LEN]; +char addr_str_mode[IPV6_LEGACY_MAX_ADDR_STR_LEN]; #endif #include "debug.h" /* Identification variables */ static char i_am_root; static char i_am_leaf; -static ipv6_addr_t my_address; +static ipv6_legacy_addr_t my_address; /* in send buffer we need space for LL_HDR */ static uint8_t rpl_send_buffer[BUFFER_SIZE]; @@ -43,7 +43,7 @@ static uint8_t rpl_send_buffer[BUFFER_SIZE]; /* SEND BUFFERS */ static icmpv6_hdr_t *icmp_send_buf; static struct rpl_dis_t *rpl_send_dis_buf; -static ipv6_hdr_t *ipv6_send_buf; +static ipv6_legacy_hdr_t *ipv6_legacy_send_buf; static struct rpl_dio_t *rpl_send_dio_buf; static struct rpl_dao_t *rpl_send_dao_buf; static rpl_opt_dodag_conf_t *rpl_send_opt_dodag_conf_buf; @@ -51,7 +51,7 @@ static rpl_opt_target_t *rpl_send_opt_target_buf; static rpl_opt_transit_t *rpl_send_opt_transit_buf; /* RECEIVE BUFFERS */ -static ipv6_hdr_t *ipv6_buf; +static ipv6_legacy_hdr_t *ipv6_legacy_buf; static struct rpl_dio_t *rpl_dio_buf; static struct rpl_dao_t *rpl_dao_buf; static struct rpl_dao_ack_t *rpl_dao_ack_buf; @@ -65,105 +65,105 @@ static rpl_opt_solicited_t *rpl_opt_solicited_buf; /* SEND BUFFERS */ static icmpv6_hdr_t *get_rpl_send_icmpv6_buf(uint8_t ext_len) { - return ((icmpv6_hdr_t *) & (rpl_send_buffer[IPV6_HDR_LEN + ext_len])); + return ((icmpv6_hdr_t *) & (rpl_send_buffer[IPV6_LEGACY_HDR_LEN + ext_len])); } static struct rpl_dis_t *get_rpl_send_dis_buf(void) { - return ((struct rpl_dis_t *) & (rpl_send_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN])); + return ((struct rpl_dis_t *) & (rpl_send_buffer[IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN])); } -static ipv6_hdr_t *get_rpl_send_ipv6_buf(void) +static ipv6_legacy_hdr_t *get_rpl_send_ipv6_legacy_buf(void) { - return ((ipv6_hdr_t *) & (rpl_send_buffer[0])); + return ((ipv6_legacy_hdr_t *) & (rpl_send_buffer[0])); } static uint8_t *get_rpl_send_payload_buf(uint8_t ext_len) { - return &(rpl_send_buffer[IPV6_HDR_LEN + ext_len]); + return &(rpl_send_buffer[IPV6_LEGACY_HDR_LEN + ext_len]); } static struct rpl_dio_t *get_rpl_send_dio_buf(void) { - return ((struct rpl_dio_t *) & (rpl_send_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN])); + return ((struct rpl_dio_t *) & (rpl_send_buffer[IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN])); } static struct rpl_dao_t *get_rpl_send_dao_buf(void) { - return ((struct rpl_dao_t *) & (rpl_send_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN])); + return ((struct rpl_dao_t *) & (rpl_send_buffer[IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN])); } static rpl_opt_dodag_conf_t *get_rpl_send_opt_dodag_conf_buf(uint8_t rpl_msg_len) { - return ((rpl_opt_dodag_conf_t *) & (rpl_send_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len])); + return ((rpl_opt_dodag_conf_t *) & (rpl_send_buffer[IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len])); } static rpl_opt_target_t *get_rpl_send_opt_target_buf(uint8_t rpl_msg_len) { - return ((rpl_opt_target_t *) & (rpl_send_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len])); + return ((rpl_opt_target_t *) & (rpl_send_buffer[IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len])); } static rpl_opt_transit_t *get_rpl_send_opt_transit_buf(uint8_t rpl_msg_len) { - return ((rpl_opt_transit_t *) & (rpl_send_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len])); + return ((rpl_opt_transit_t *) & (rpl_send_buffer[IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len])); } /* RECEIVE BUFFERS */ -static ipv6_hdr_t *get_rpl_ipv6_buf(void) +static ipv6_legacy_hdr_t *get_rpl_ipv6_legacy_buf(void) { - return ((ipv6_hdr_t *) & (rpl_buffer[0])); + return ((ipv6_legacy_hdr_t *) & (rpl_buffer[0])); } static rpl_opt_target_t *get_rpl_opt_target_buf(uint8_t rpl_msg_len) { - return ((rpl_opt_target_t *) & (rpl_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len])); + return ((rpl_opt_target_t *) & (rpl_buffer[IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len])); } static rpl_opt_transit_t *get_rpl_opt_transit_buf(uint8_t rpl_msg_len) { - return ((rpl_opt_transit_t *) & (rpl_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len])); + return ((rpl_opt_transit_t *) & (rpl_buffer[IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len])); } static rpl_opt_dodag_conf_t *get_rpl_opt_dodag_conf_buf(uint8_t rpl_msg_len) { - return ((rpl_opt_dodag_conf_t *) & (rpl_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len])); + return ((rpl_opt_dodag_conf_t *) & (rpl_buffer[IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len])); } static struct rpl_dio_t *get_rpl_dio_buf(void) { - return ((struct rpl_dio_t *) & (rpl_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN])); + return ((struct rpl_dio_t *) & (rpl_buffer[IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN])); } static struct rpl_dao_t *get_rpl_dao_buf(void) { - return ((struct rpl_dao_t *) & (rpl_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN])); + return ((struct rpl_dao_t *) & (rpl_buffer[IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN])); } static struct rpl_dao_ack_t *get_rpl_dao_ack_buf(void) { - return ((struct rpl_dao_ack_t *) & (buffer[(LL_HDR_LEN + IPV6_HDR_LEN + ICMPV6_HDR_LEN)])); + return ((struct rpl_dao_ack_t *) & (buffer[(LL_HDR_LEN + IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN)])); } static struct rpl_dis_t *get_rpl_dis_buf(void) { - return ((struct rpl_dis_t *) & (rpl_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN])); + return ((struct rpl_dis_t *) & (rpl_buffer[IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN])); } static rpl_opt_t *get_rpl_opt_buf(uint8_t rpl_msg_len) { - return ((rpl_opt_t *) & (rpl_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len])); + return ((rpl_opt_t *) & (rpl_buffer[IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len])); } static rpl_opt_solicited_t *get_rpl_opt_solicited_buf(uint8_t rpl_msg_len) { - return ((rpl_opt_solicited_t *) & (rpl_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len])); + return ((rpl_opt_solicited_t *) & (rpl_buffer[IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len])); } -void rpl_init_mode(ipv6_addr_t *init_address) +void rpl_init_mode(ipv6_legacy_addr_t *init_address) { - DEBUGF("My address: %s\n", ipv6_addr_to_str(addr_str_mode, IPV6_MAX_ADDR_STR_LEN, init_address)); - memcpy(&my_address, init_address, sizeof(ipv6_addr_t)); + DEBUGF("My address: %s\n", ipv6_legacy_addr_to_str(addr_str_mode, IPV6_LEGACY_MAX_ADDR_STR_LEN, init_address)); + memcpy(&my_address, init_address, sizeof(ipv6_legacy_addr_t)); } void rpl_init_root_mode(void) @@ -208,7 +208,7 @@ void rpl_init_root_mode(void) dodag->my_rank = RPL_ROOT_RANK; dodag->joined = 1; dodag->my_preferred_parent = NULL; - memcpy(&dodag->dodag_id, &my_address, sizeof(ipv6_addr_t)); + memcpy(&dodag->dodag_id, &my_address, sizeof(ipv6_legacy_addr_t)); } else { @@ -225,14 +225,14 @@ uint8_t rpl_is_root_mode(void) return i_am_root; } -void rpl_send_DIO_mode(ipv6_addr_t *destination) +void rpl_send_DIO_mode(ipv6_legacy_addr_t *destination) { if (i_am_leaf) { return; } rpl_dodag_t *mydodag; - icmp_send_buf = get_rpl_send_icmpv6_buf(ipv6_ext_hdr_len); + icmp_send_buf = get_rpl_send_icmpv6_buf(ipv6_legacy_ext_hdr_len); mydodag = rpl_get_my_dodag(); @@ -281,10 +281,10 @@ void rpl_send_DIO_mode(ipv6_addr_t *destination) uint16_t plen = ICMPV6_HDR_LEN + DIO_BASE_LEN + opt_hdr_len; - rpl_send(destination, (uint8_t *)icmp_send_buf, plen, IPV6_PROTO_NUM_ICMPV6); + rpl_send(destination, (uint8_t *)icmp_send_buf, plen, IPV6_LEGACY_PROTO_NUM_ICMPV6); } -void rpl_send_DAO_mode(ipv6_addr_t *destination, uint8_t lifetime, bool default_lifetime, uint8_t start_index) +void rpl_send_DAO_mode(ipv6_legacy_addr_t *destination, uint8_t lifetime, bool default_lifetime, uint8_t start_index) { if (i_am_root) { return; @@ -309,7 +309,7 @@ void rpl_send_DAO_mode(ipv6_addr_t *destination, uint8_t lifetime, bool default_ lifetime = my_dodag->default_lifetime; } - icmp_send_buf = get_rpl_send_icmpv6_buf(ipv6_ext_hdr_len); + icmp_send_buf = get_rpl_send_icmpv6_buf(ipv6_legacy_ext_hdr_len); icmp_send_buf->type = ICMPV6_TYPE_RPL_CONTROL; icmp_send_buf->code = ICMP_CODE_DAO; @@ -327,7 +327,7 @@ void rpl_send_DAO_mode(ipv6_addr_t *destination, uint8_t lifetime, bool default_ rpl_send_opt_target_buf->length = RPL_OPT_TARGET_LEN; rpl_send_opt_target_buf->flags = 0x00; rpl_send_opt_target_buf->prefix_length = RPL_DODAG_ID_LEN; - memcpy(&rpl_send_opt_target_buf->target, &my_address, sizeof(ipv6_addr_t)); + memcpy(&rpl_send_opt_target_buf->target, &my_address, sizeof(ipv6_legacy_addr_t)); /* 18+2=20 bytes for one target-option */ opt_len += RPL_OPT_TARGET_LEN; @@ -340,21 +340,21 @@ void rpl_send_DAO_mode(ipv6_addr_t *destination, uint8_t lifetime, bool default_ rpl_send_opt_transit_buf->path_control = 0x00; rpl_send_opt_transit_buf->path_sequence = 0x00; rpl_send_opt_transit_buf->path_lifetime = lifetime; - memcpy(&rpl_send_opt_transit_buf->parent, rpl_get_my_preferred_parent(), sizeof(ipv6_addr_t)); - DEBUGF("My pref parent is:%s\n", ipv6_addr_to_str(addr_str_mode, IPV6_MAX_ADDR_STR_LEN, + memcpy(&rpl_send_opt_transit_buf->parent, rpl_get_my_preferred_parent(), sizeof(ipv6_legacy_addr_t)); + DEBUGF("My pref parent is:%s\n", ipv6_legacy_addr_to_str(addr_str_mode, IPV6_LEGACY_MAX_ADDR_STR_LEN, rpl_get_my_preferred_parent())); DEBUGF("Send DAO with instance %04X and sequence %04X to %s\n", rpl_send_dao_buf->rpl_instanceid, rpl_send_dao_buf->dao_sequence, - ipv6_addr_to_str(addr_str_mode, IPV6_MAX_ADDR_STR_LEN, destination)); + ipv6_legacy_addr_to_str(addr_str_mode, IPV6_LEGACY_MAX_ADDR_STR_LEN, destination)); /* 4+2=6 byte for one transit-option */ opt_len += RPL_OPT_TRANSIT_LEN; uint16_t plen = ICMPV6_HDR_LEN + DAO_BASE_LEN + opt_len; - rpl_send(destination, (uint8_t *)icmp_send_buf, plen, IPV6_PROTO_NUM_ICMPV6); + rpl_send(destination, (uint8_t *)icmp_send_buf, plen, IPV6_LEGACY_PROTO_NUM_ICMPV6); } -void rpl_send_DIS_mode(ipv6_addr_t *destination) +void rpl_send_DIS_mode(ipv6_legacy_addr_t *destination) { icmp_send_buf->type = ICMPV6_TYPE_RPL_CONTROL; icmp_send_buf->code = ICMP_CODE_DIS; @@ -362,10 +362,10 @@ void rpl_send_DIS_mode(ipv6_addr_t *destination) rpl_send_dis_buf = get_rpl_send_dis_buf(); uint16_t plen = ICMPV6_HDR_LEN + DIS_BASE_LEN; - rpl_send(destination, (uint8_t *)icmp_send_buf, plen, IPV6_PROTO_NUM_ICMPV6); + rpl_send(destination, (uint8_t *)icmp_send_buf, plen, IPV6_LEGACY_PROTO_NUM_ICMPV6); } -void rpl_send_DAO_ACK_mode(ipv6_addr_t *destination) +void rpl_send_DAO_ACK_mode(ipv6_legacy_addr_t *destination) { /* This is just for suppressing the mandatory unused parameter warning */ (void) destination; @@ -382,9 +382,9 @@ void rpl_recv_DIO_mode(void) return; } - ipv6_buf = get_rpl_ipv6_buf(); - DEBUGF("DIO received from %s\n", ipv6_addr_to_str(addr_str_mode, IPV6_MAX_ADDR_STR_LEN, - &ipv6_buf->srcaddr)); + ipv6_legacy_buf = get_rpl_ipv6_legacy_buf(); + DEBUGF("DIO received from %s\n", ipv6_legacy_addr_to_str(addr_str_mode, IPV6_LEGACY_MAX_ADDR_STR_LEN, + &ipv6_legacy_buf->srcaddr)); rpl_dio_buf = get_rpl_dio_buf(); DEBUGF("instance %04X rank %04X\n", rpl_dio_buf->rpl_instanceid, rpl_dio_buf->rank); @@ -435,10 +435,10 @@ void rpl_recv_DIO_mode(void) uint8_t has_dodag_conf_opt = 0; /* Parse until all options are consumed. - * ipv6_buf->length contains the packet length minus ipv6 and + * ipv6_legacy_buf->length contains the packet length minus ipv6_legacy and * icmpv6 header, so only ICMPV6_HDR_LEN remains to be * subtracted. */ - while (len < (NTOHS(ipv6_buf->length) - ICMPV6_HDR_LEN)) { + while (len < (NTOHS(ipv6_legacy_buf->length) - ICMPV6_HDR_LEN)) { DEBUGF("parsing DIO options\n"); rpl_opt_buf = get_rpl_opt_buf(len); @@ -509,7 +509,7 @@ void rpl_recv_DIO_mode(void) if (my_dodag == NULL) { if (!has_dodag_conf_opt) { DEBUGF("send DIS\n"); - rpl_send_DIS(&ipv6_buf->srcaddr); + rpl_send_DIS(&ipv6_legacy_buf->srcaddr); } if (rpl_dio_buf->rank < ROOT_RANK) { @@ -519,9 +519,9 @@ void rpl_recv_DIO_mode(void) if (dio_dodag.mop != RPL_DEFAULT_MOP) { i_am_leaf = 1; DEBUGF("Will join DODAG as LEAF\n"); - rpl_join_dodag(&dio_dodag, &ipv6_buf->srcaddr, INFINITE_RANK); + rpl_join_dodag(&dio_dodag, &ipv6_legacy_buf->srcaddr, INFINITE_RANK); DEBUGF("Joined DODAG\n"); - DEBUGF("The DODAG-root is: %s\n", ipv6_addr_to_str(addr_str_mode, IPV6_MAX_ADDR_STR_LEN, + DEBUGF("The DODAG-root is: %s\n", ipv6_legacy_addr_to_str(addr_str_mode, IPV6_LEGACY_MAX_ADDR_STR_LEN, &dio_dodag.dodag_id)); } @@ -531,9 +531,9 @@ void rpl_recv_DIO_mode(void) if (rpl_dio_buf->rank != INFINITE_RANK) { DEBUGF("Will join DODAG\n"); - rpl_join_dodag(&dio_dodag, &ipv6_buf->srcaddr, rpl_dio_buf->rank); + rpl_join_dodag(&dio_dodag, &ipv6_legacy_buf->srcaddr, rpl_dio_buf->rank); DEBUGF("Joined DODAG\n"); - DEBUGF("The DODAG-root is: %s\n", ipv6_addr_to_str(addr_str_mode, IPV6_MAX_ADDR_STR_LEN, + DEBUGF("The DODAG-root is: %s\n", ipv6_legacy_addr_to_str(addr_str_mode, IPV6_LEGACY_MAX_ADDR_STR_LEN, &dio_dodag.dodag_id)); } else { @@ -553,7 +553,7 @@ void rpl_recv_DIO_mode(void) } else { DEBUGF("my dodag has no preferred_parent yet - seems to be odd since I have a parent.\n"); - rpl_global_repair(&dio_dodag, &ipv6_buf->srcaddr, rpl_dio_buf->rank); + rpl_global_repair(&dio_dodag, &ipv6_legacy_buf->srcaddr, rpl_dio_buf->rank); } return; @@ -581,11 +581,11 @@ void rpl_recv_DIO_mode(void) /********************* Parent Handling *********************/ DEBUGF("Parent handling.\n"); rpl_parent_t *parent; - parent = rpl_find_parent(&ipv6_buf->srcaddr); + parent = rpl_find_parent(&ipv6_legacy_buf->srcaddr); if (parent == NULL) { /* add new parent candidate */ - parent = rpl_new_parent(my_dodag, &ipv6_buf->srcaddr, rpl_dio_buf->rank); + parent = rpl_new_parent(my_dodag, &ipv6_legacy_buf->srcaddr, rpl_dio_buf->rank); if (parent == NULL) { return; @@ -626,13 +626,13 @@ void rpl_recv_DAO_mode(void) return; } - ipv6_buf = get_rpl_ipv6_buf(); + ipv6_legacy_buf = get_rpl_ipv6_legacy_buf(); rpl_dao_buf = get_rpl_dao_buf(); int len = DAO_BASE_LEN; uint8_t increment_seq = 0; - while (len < (NTOHS(ipv6_buf->length) - ICMPV6_HDR_LEN)) { + while (len < (NTOHS(ipv6_legacy_buf->length) - ICMPV6_HDR_LEN)) { rpl_opt_buf = get_rpl_opt_buf(len); switch (rpl_opt_buf->type) { @@ -671,9 +671,9 @@ void rpl_recv_DAO_mode(void) len += rpl_opt_transit_buf->length; /* route lifetime seconds = (DAO lifetime) * (Unit Lifetime) */ - DEBUGF("Target: %s\n", ipv6_addr_to_str(addr_str_mode, IPV6_MAX_ADDR_STR_LEN, + DEBUGF("Target: %s\n", ipv6_legacy_addr_to_str(addr_str_mode, IPV6_LEGACY_MAX_ADDR_STR_LEN, &rpl_opt_target_buf->target)); - DEBUGF("Transit: %s\n", ipv6_addr_to_str(addr_str_mode, IPV6_MAX_ADDR_STR_LEN, + DEBUGF("Transit: %s\n", ipv6_legacy_addr_to_str(addr_str_mode, IPV6_LEGACY_MAX_ADDR_STR_LEN, &rpl_opt_transit_buf->parent)); #if RPL_DEFAULT_MOP == RPL_NON_STORING_MODE rpl_add_srh_entry(&rpl_opt_target_buf->target, &rpl_opt_transit_buf->parent, @@ -712,11 +712,11 @@ void rpl_recv_DIS_mode(void) return; } - ipv6_buf = get_rpl_ipv6_buf(); + ipv6_legacy_buf = get_rpl_ipv6_legacy_buf(); rpl_dis_buf = get_rpl_dis_buf(); int len = DIS_BASE_LEN; - while (len < (NTOHS(ipv6_buf->length) - ICMPV6_HDR_LEN)) { + while (len < (NTOHS(ipv6_legacy_buf->length) - ICMPV6_HDR_LEN)) { rpl_opt_buf = get_rpl_opt_buf(len); switch (rpl_opt_buf->type) { @@ -767,7 +767,7 @@ void rpl_recv_DIS_mode(void) } } - rpl_send_DIO(&ipv6_buf->srcaddr); + rpl_send_DIO(&ipv6_legacy_buf->srcaddr); } @@ -794,26 +794,26 @@ void rpl_recv_dao_ack_mode(void) } /* obligatory for each mode. normally not modified */ -void rpl_send(ipv6_addr_t *destination, uint8_t *payload, uint16_t p_len, uint8_t next_header) +void rpl_send(ipv6_legacy_addr_t *destination, uint8_t *payload, uint16_t p_len, uint8_t next_header) { uint8_t *p_ptr; - ipv6_send_buf = get_rpl_send_ipv6_buf(); - p_ptr = get_rpl_send_payload_buf(ipv6_ext_hdr_len); + ipv6_legacy_send_buf = get_rpl_send_ipv6_legacy_buf(); + p_ptr = get_rpl_send_payload_buf(ipv6_legacy_ext_hdr_len); - DEBUGF("Trying to send to destination: %s\n", ipv6_addr_to_str(addr_str_mode, - IPV6_MAX_ADDR_STR_LEN, destination)); + DEBUGF("Trying to send to destination: %s\n", ipv6_legacy_addr_to_str(addr_str_mode, + IPV6_LEGACY_MAX_ADDR_STR_LEN, destination)); - ipv6_send_buf->version_trafficclass = IPV6_VER; - ipv6_send_buf->trafficclass_flowlabel = 0; - ipv6_send_buf->flowlabel = 0; - ipv6_send_buf->nextheader = next_header; - ipv6_send_buf->hoplimit = MULTIHOP_HOPLIMIT; - ipv6_send_buf->length = HTONS(p_len); - memcpy(&(ipv6_send_buf->destaddr), destination, 16); - ipv6_net_if_get_best_src_addr(&(ipv6_send_buf->srcaddr), &(ipv6_send_buf->destaddr)); + ipv6_legacy_send_buf->version_trafficclass = IPV6_LEGACY_VER; + ipv6_legacy_send_buf->trafficclass_flowlabel = 0; + ipv6_legacy_send_buf->flowlabel = 0; + ipv6_legacy_send_buf->nextheader = next_header; + ipv6_legacy_send_buf->hoplimit = MULTIHOP_HOPLIMIT; + ipv6_legacy_send_buf->length = HTONS(p_len); + memcpy(&(ipv6_legacy_send_buf->destaddr), destination, 16); + ipv6_legacy_net_if_get_best_src_addr(&(ipv6_legacy_send_buf->srcaddr), &(ipv6_legacy_send_buf->destaddr)); - icmp_send_buf = get_rpl_send_icmpv6_buf(ipv6_ext_hdr_len); - icmp_send_buf->checksum = icmpv6_csum(ipv6_send_buf, icmp_send_buf); + icmp_send_buf = get_rpl_send_icmpv6_buf(ipv6_legacy_ext_hdr_len); + icmp_send_buf->checksum = icmpv6_csum(ipv6_legacy_send_buf, icmp_send_buf); /* The packet was "assembled" in rpl_%mode%.c. Therefore rpl_send_buf was used. * Therefore memcpy is not needed because the payload is at the @@ -823,19 +823,19 @@ void rpl_send(ipv6_addr_t *destination, uint8_t *payload, uint16_t p_len, uint8_ memcpy(p_ptr, payload, p_len); } - if (ipv6_addr_is_multicast(&ipv6_send_buf->destaddr)) { - ipv6_send_packet(ipv6_send_buf, NULL); + if (ipv6_legacy_addr_is_multicast(&ipv6_legacy_send_buf->destaddr)) { + ipv6_legacy_send_packet(ipv6_legacy_send_buf, NULL); } else { /* find appropriate next hop before sending */ - ipv6_addr_t *next_hop = rpl_get_next_hop(&ipv6_send_buf->destaddr); - DEBUGF("Trying to send to destination: %s\n", ipv6_addr_to_str(addr_str_mode, - IPV6_MAX_ADDR_STR_LEN, next_hop)); + ipv6_legacy_addr_t *next_hop = rpl_get_next_hop(&ipv6_legacy_send_buf->destaddr); + DEBUGF("Trying to send to destination: %s\n", ipv6_legacy_addr_to_str(addr_str_mode, + IPV6_LEGACY_MAX_ADDR_STR_LEN, next_hop)); if (next_hop == NULL) { if (i_am_root) { - DEBUGF("[Error] destination unknown: %s\n", ipv6_addr_to_str(addr_str_mode, - IPV6_MAX_ADDR_STR_LEN, &ipv6_send_buf->destaddr)); + DEBUGF("[Error] destination unknown: %s\n", ipv6_legacy_addr_to_str(addr_str_mode, + IPV6_LEGACY_MAX_ADDR_STR_LEN, &ipv6_legacy_send_buf->destaddr)); return; } else { @@ -849,7 +849,7 @@ void rpl_send(ipv6_addr_t *destination, uint8_t *payload, uint16_t p_len, uint8_ } DEBUGF("Sending done (for RPL)\n"); - ipv6_send_packet(ipv6_send_buf, NULL); + ipv6_legacy_send_packet(ipv6_legacy_send_buf, NULL); } } diff --git a/sys/net/routing/rpl/rpl_of_manager.c b/sys/net/routing/rpl/rpl_of_manager.c index a45a026d2f8e9..b63428f0efa83 100644 --- a/sys/net/routing/rpl/rpl_of_manager.c +++ b/sys/net/routing/rpl/rpl_of_manager.c @@ -31,7 +31,7 @@ rpl_of_t *objective_functions[NUMBER_IMPLEMENTED_OFS]; -void rpl_of_manager_init(ipv6_addr_t *my_address) +void rpl_of_manager_init(ipv6_legacy_addr_t *my_address) { /* insert new objective functions here */ objective_functions[0] = rpl_get_of0(); diff --git a/sys/net/routing/rpl/rpl_storing/rpl_storing.c b/sys/net/routing/rpl/rpl_storing/rpl_storing.c index 6c6b826103a87..0b265876f7b05 100644 --- a/sys/net/routing/rpl/rpl_storing/rpl_storing.c +++ b/sys/net/routing/rpl/rpl_storing/rpl_storing.c @@ -23,18 +23,18 @@ #include "msg.h" #include "trickle.h" -#include "sixlowpan.h" +#include "sixlowpan_legacy.h" #include "net_help.h" #define ENABLE_DEBUG (0) #if ENABLE_DEBUG #define DEBUG_ENABLED -char addr_str_mode[IPV6_MAX_ADDR_STR_LEN]; +char addr_str_mode[IPV6_LEGACY_MAX_ADDR_STR_LEN]; #endif #include "debug.h" /* global variables */ -static ipv6_addr_t my_address; +static ipv6_legacy_addr_t my_address; /* Identification variables */ static char i_am_root; @@ -46,7 +46,7 @@ static uint8_t rpl_send_buffer[BUFFER_SIZE]; static icmpv6_hdr_t *icmp_send_buf; static struct rpl_dis_t *rpl_send_dis_buf; static struct rpl_dao_ack_t *rpl_send_dao_ack_buf; -static ipv6_hdr_t *ipv6_send_buf; +static ipv6_legacy_hdr_t *ipv6_legacy_send_buf; static struct rpl_dio_t *rpl_send_dio_buf; static struct rpl_dao_t *rpl_send_dao_buf; static rpl_opt_dodag_conf_t *rpl_send_opt_dodag_conf_buf; @@ -54,7 +54,7 @@ static rpl_opt_target_t *rpl_send_opt_target_buf; static rpl_opt_transit_t *rpl_send_opt_transit_buf; /* RECEIVE BUFFERS */ -static ipv6_hdr_t *ipv6_buf; +static ipv6_legacy_hdr_t *ipv6_legacy_buf; static struct rpl_dio_t *rpl_dio_buf; static struct rpl_dao_t *rpl_dao_buf; static struct rpl_dao_ack_t *rpl_dao_ack_buf; @@ -68,109 +68,109 @@ static rpl_opt_solicited_t *rpl_opt_solicited_buf; /* SEND BUFFERS */ static icmpv6_hdr_t *get_rpl_send_icmpv6_buf(uint8_t ext_len) { - return ((icmpv6_hdr_t *) & (rpl_send_buffer[IPV6_HDR_LEN + ext_len])); + return ((icmpv6_hdr_t *) & (rpl_send_buffer[IPV6_LEGACY_HDR_LEN + ext_len])); } static struct rpl_dao_ack_t *get_rpl_send_dao_ack_buf(void) { - return ((struct rpl_dao_ack_t *) & (rpl_send_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN])); + return ((struct rpl_dao_ack_t *) & (rpl_send_buffer[IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN])); } static struct rpl_dis_t *get_rpl_send_dis_buf(void) { - return ((struct rpl_dis_t *) & (rpl_send_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN])); + return ((struct rpl_dis_t *) & (rpl_send_buffer[IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN])); } -static ipv6_hdr_t *get_rpl_send_ipv6_buf(void) +static ipv6_legacy_hdr_t *get_rpl_send_ipv6_legacy_buf(void) { - return ((ipv6_hdr_t *) & (rpl_send_buffer[0])); + return ((ipv6_legacy_hdr_t *) & (rpl_send_buffer[0])); } static uint8_t *get_rpl_send_payload_buf(uint8_t ext_len) { - return &(rpl_send_buffer[IPV6_HDR_LEN + ext_len]); + return &(rpl_send_buffer[IPV6_LEGACY_HDR_LEN + ext_len]); } static struct rpl_dio_t *get_rpl_send_dio_buf(void) { - return ((struct rpl_dio_t *) & (rpl_send_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN])); + return ((struct rpl_dio_t *) & (rpl_send_buffer[IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN])); } static struct rpl_dao_t *get_rpl_send_dao_buf(void) { - return ((struct rpl_dao_t *) & (rpl_send_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN])); + return ((struct rpl_dao_t *) & (rpl_send_buffer[IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN])); } static rpl_opt_dodag_conf_t *get_rpl_send_opt_dodag_conf_buf(uint8_t rpl_msg_len) { - return ((rpl_opt_dodag_conf_t *) & (rpl_send_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len])); + return ((rpl_opt_dodag_conf_t *) & (rpl_send_buffer[IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len])); } static rpl_opt_target_t *get_rpl_send_opt_target_buf(uint8_t rpl_msg_len) { - return ((rpl_opt_target_t *) & (rpl_send_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len])); + return ((rpl_opt_target_t *) & (rpl_send_buffer[IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len])); } static rpl_opt_transit_t *get_rpl_send_opt_transit_buf(uint8_t rpl_msg_len) { - return ((rpl_opt_transit_t *) & (rpl_send_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len])); + return ((rpl_opt_transit_t *) & (rpl_send_buffer[IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len])); } /* RECEIVE BUFFERS */ -static ipv6_hdr_t *get_rpl_ipv6_buf(void) +static ipv6_legacy_hdr_t *get_rpl_ipv6_legacy_buf(void) { - return ((ipv6_hdr_t *) & (rpl_buffer[0])); + return ((ipv6_legacy_hdr_t *) & (rpl_buffer[0])); } static rpl_opt_target_t *get_rpl_opt_target_buf(uint8_t rpl_msg_len) { - return ((rpl_opt_target_t *) & (rpl_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len])); + return ((rpl_opt_target_t *) & (rpl_buffer[IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len])); } static rpl_opt_transit_t *get_rpl_opt_transit_buf(uint8_t rpl_msg_len) { - return ((rpl_opt_transit_t *) & (rpl_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len])); + return ((rpl_opt_transit_t *) & (rpl_buffer[IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len])); } static rpl_opt_dodag_conf_t *get_rpl_opt_dodag_conf_buf(uint8_t rpl_msg_len) { - return ((rpl_opt_dodag_conf_t *) & (rpl_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len])); + return ((rpl_opt_dodag_conf_t *) & (rpl_buffer[IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len])); } static struct rpl_dio_t *get_rpl_dio_buf(void) { - return ((struct rpl_dio_t *) & (rpl_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN])); + return ((struct rpl_dio_t *) & (rpl_buffer[IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN])); } static struct rpl_dao_t *get_rpl_dao_buf(void) { - return ((struct rpl_dao_t *) & (rpl_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN])); + return ((struct rpl_dao_t *) & (rpl_buffer[IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN])); } static struct rpl_dao_ack_t *get_rpl_dao_ack_buf(void) { - return ((struct rpl_dao_ack_t *) & (buffer[(LL_HDR_LEN + IPV6_HDR_LEN + ICMPV6_HDR_LEN)])); + return ((struct rpl_dao_ack_t *) & (buffer[(LL_HDR_LEN + IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN)])); } static struct rpl_dis_t *get_rpl_dis_buf(void) { - return ((struct rpl_dis_t *) & (rpl_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN])); + return ((struct rpl_dis_t *) & (rpl_buffer[IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN])); } static rpl_opt_t *get_rpl_opt_buf(uint8_t rpl_msg_len) { - return ((rpl_opt_t *) & (rpl_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len])); + return ((rpl_opt_t *) & (rpl_buffer[IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len])); } static rpl_opt_solicited_t *get_rpl_opt_solicited_buf(uint8_t rpl_msg_len) { - return ((rpl_opt_solicited_t *) & (rpl_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len])); + return ((rpl_opt_solicited_t *) & (rpl_buffer[IPV6_LEGACY_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len])); } -void rpl_init_mode(ipv6_addr_t *init_address) +void rpl_init_mode(ipv6_legacy_addr_t *init_address) { - memcpy(&my_address, init_address, sizeof(ipv6_addr_t)); + memcpy(&my_address, init_address, sizeof(ipv6_legacy_addr_t)); } void rpl_init_root_mode(void) @@ -226,10 +226,10 @@ uint8_t rpl_is_root_mode(void) return i_am_root; } -void rpl_send_DIO_mode(ipv6_addr_t *destination) +void rpl_send_DIO_mode(ipv6_legacy_addr_t *destination) { rpl_dodag_t *mydodag; - icmp_send_buf = get_rpl_send_icmpv6_buf(ipv6_ext_hdr_len); + icmp_send_buf = get_rpl_send_icmpv6_buf(ipv6_legacy_ext_hdr_len); mydodag = rpl_get_my_dodag(); @@ -276,10 +276,10 @@ void rpl_send_DIO_mode(ipv6_addr_t *destination) opt_hdr_len += RPL_OPT_DODAG_CONF_LEN; uint16_t plen = ICMPV6_HDR_LEN + DIO_BASE_LEN + opt_hdr_len; - rpl_send(destination, (uint8_t *)icmp_send_buf, plen, IPV6_PROTO_NUM_ICMPV6); + rpl_send(destination, (uint8_t *)icmp_send_buf, plen, IPV6_LEGACY_PROTO_NUM_ICMPV6); } -void rpl_send_DAO_mode(ipv6_addr_t *destination, uint8_t lifetime, bool default_lifetime, uint8_t start_index) +void rpl_send_DAO_mode(ipv6_legacy_addr_t *destination, uint8_t lifetime, bool default_lifetime, uint8_t start_index) { if (i_am_root) { return; @@ -305,7 +305,7 @@ void rpl_send_DAO_mode(ipv6_addr_t *destination, uint8_t lifetime, bool default_ lifetime = my_dodag->default_lifetime; } - icmp_send_buf = get_rpl_send_icmpv6_buf(ipv6_ext_hdr_len); + icmp_send_buf = get_rpl_send_icmpv6_buf(ipv6_legacy_ext_hdr_len); icmp_send_buf->type = ICMPV6_TYPE_RPL_CONTROL; icmp_send_buf->code = ICMP_CODE_DAO; @@ -328,7 +328,7 @@ void rpl_send_DAO_mode(ipv6_addr_t *destination, uint8_t lifetime, bool default_ rpl_send_opt_target_buf->flags = 0x00; rpl_send_opt_target_buf->prefix_length = RPL_DODAG_ID_LEN; memcpy(&rpl_send_opt_target_buf->target, &rpl_get_routing_table()[i].address, - sizeof(ipv6_addr_t)); + sizeof(ipv6_legacy_addr_t)); opt_len += RPL_OPT_TARGET_LEN; rpl_send_opt_transit_buf = get_rpl_send_opt_transit_buf(DAO_BASE_LEN + opt_len); rpl_send_opt_transit_buf->type = RPL_OPT_TRANSIT; @@ -355,7 +355,7 @@ void rpl_send_DAO_mode(ipv6_addr_t *destination, uint8_t lifetime, bool default_ rpl_send_opt_target_buf->length = RPL_OPT_TARGET_LEN; rpl_send_opt_target_buf->flags = 0x00; rpl_send_opt_target_buf->prefix_length = RPL_DODAG_ID_LEN; - memcpy(&rpl_send_opt_target_buf->target, &my_address, sizeof(ipv6_addr_t)); + memcpy(&rpl_send_opt_target_buf->target, &my_address, sizeof(ipv6_legacy_addr_t)); opt_len += RPL_OPT_TARGET_LEN; rpl_send_opt_transit_buf = get_rpl_send_opt_transit_buf(DAO_BASE_LEN + opt_len); @@ -368,16 +368,16 @@ void rpl_send_DAO_mode(ipv6_addr_t *destination, uint8_t lifetime, bool default_ opt_len += RPL_OPT_TRANSIT_LEN; uint16_t plen = ICMPV6_HDR_LEN + DAO_BASE_LEN + opt_len; - rpl_send(destination, (uint8_t *)icmp_send_buf, plen, IPV6_PROTO_NUM_ICMPV6); + rpl_send(destination, (uint8_t *)icmp_send_buf, plen, IPV6_LEGACY_PROTO_NUM_ICMPV6); if (continue_index > 1) { rpl_send_DAO(destination, lifetime, default_lifetime, continue_index); } } -void rpl_send_DIS_mode(ipv6_addr_t *destination) +void rpl_send_DIS_mode(ipv6_legacy_addr_t *destination) { - icmp_send_buf = get_rpl_send_icmpv6_buf(ipv6_ext_hdr_len); + icmp_send_buf = get_rpl_send_icmpv6_buf(ipv6_legacy_ext_hdr_len); icmp_send_buf->type = ICMPV6_TYPE_RPL_CONTROL; icmp_send_buf->code = ICMP_CODE_DIS; @@ -385,10 +385,10 @@ void rpl_send_DIS_mode(ipv6_addr_t *destination) rpl_send_dis_buf = get_rpl_send_dis_buf(); uint16_t plen = ICMPV6_HDR_LEN + DIS_BASE_LEN; - rpl_send(destination, (uint8_t *)icmp_send_buf, plen, IPV6_PROTO_NUM_ICMPV6); + rpl_send(destination, (uint8_t *)icmp_send_buf, plen, IPV6_LEGACY_PROTO_NUM_ICMPV6); } -void rpl_send_DAO_ACK_mode(ipv6_addr_t *destination) +void rpl_send_DAO_ACK_mode(ipv6_legacy_addr_t *destination) { rpl_dodag_t *my_dodag; my_dodag = rpl_get_my_dodag(); @@ -397,7 +397,7 @@ void rpl_send_DAO_ACK_mode(ipv6_addr_t *destination) return; } - icmp_send_buf = get_rpl_send_icmpv6_buf(ipv6_ext_hdr_len); + icmp_send_buf = get_rpl_send_icmpv6_buf(ipv6_legacy_ext_hdr_len); icmp_send_buf->type = ICMPV6_TYPE_RPL_CONTROL; icmp_send_buf->code = ICMP_CODE_DAO_ACK; @@ -409,12 +409,12 @@ void rpl_send_DAO_ACK_mode(ipv6_addr_t *destination) rpl_send_dao_ack_buf->status = 0; uint16_t plen = ICMPV6_HDR_LEN + DAO_ACK_LEN; - rpl_send(destination, (uint8_t *)icmp_send_buf, plen, IPV6_PROTO_NUM_ICMPV6); + rpl_send(destination, (uint8_t *)icmp_send_buf, plen, IPV6_LEGACY_PROTO_NUM_ICMPV6); } void rpl_recv_DIO_mode(void) { - ipv6_buf = get_rpl_ipv6_buf(); + ipv6_legacy_buf = get_rpl_ipv6_legacy_buf(); rpl_dio_buf = get_rpl_dio_buf(); DEBUGF("instance %04X ", rpl_dio_buf->rpl_instanceid); @@ -466,10 +466,10 @@ void rpl_recv_DIO_mode(void) uint8_t has_dodag_conf_opt = 0; /* Parse until all options are consumed. - * ipv6_buf->length contains the packet length minus ipv6 and + * ipv6_legacy_buf->length contains the packet length minus ipv6_legacy and * icmpv6 header, so only ICMPV6_HDR_LEN remains to be * subtracted. */ - while (len < (NTOHS(ipv6_buf->length) - ICMPV6_HDR_LEN)) { + while (len < (NTOHS(ipv6_legacy_buf->length) - ICMPV6_HDR_LEN)) { DEBUGF("parsing DIO options\n"); rpl_opt_buf = get_rpl_opt_buf(len); @@ -539,7 +539,7 @@ void rpl_recv_DIO_mode(void) if (my_dodag == NULL) { if (!has_dodag_conf_opt) { DEBUGF("send DIS\n"); - rpl_send_DIS(&ipv6_buf->srcaddr); + rpl_send_DIS(&ipv6_legacy_buf->srcaddr); } if (rpl_dio_buf->rank < ROOT_RANK) { @@ -556,7 +556,7 @@ void rpl_recv_DIO_mode(void) if (rpl_dio_buf->rank != INFINITE_RANK) { DEBUGF("Will join DODAG\n"); - rpl_join_dodag(&dio_dodag, &ipv6_buf->srcaddr, rpl_dio_buf->rank); + rpl_join_dodag(&dio_dodag, &ipv6_legacy_buf->srcaddr, rpl_dio_buf->rank); } else { DEBUGF("Cannot access DODAG because of DIO with infinite rank\n"); @@ -575,7 +575,7 @@ void rpl_recv_DIO_mode(void) } else { DEBUGF("my dodag has no preferred_parent yet - seems to be odd since I have a parent.\n"); - rpl_global_repair(&dio_dodag, &ipv6_buf->srcaddr, rpl_dio_buf->rank); + rpl_global_repair(&dio_dodag, &ipv6_legacy_buf->srcaddr, rpl_dio_buf->rank); } return; @@ -604,11 +604,11 @@ void rpl_recv_DIO_mode(void) /********************* Parent Handling *********************/ rpl_parent_t *parent; - parent = rpl_find_parent(&ipv6_buf->srcaddr); + parent = rpl_find_parent(&ipv6_legacy_buf->srcaddr); if (parent == NULL) { /* add new parent candidate */ - parent = rpl_new_parent(my_dodag, &ipv6_buf->srcaddr, rpl_dio_buf->rank); + parent = rpl_new_parent(my_dodag, &ipv6_legacy_buf->srcaddr, rpl_dio_buf->rank); if (parent == NULL) { return; @@ -644,7 +644,7 @@ void rpl_recv_DAO_mode(void) return; } - ipv6_buf = get_rpl_ipv6_buf(); + ipv6_legacy_buf = get_rpl_ipv6_legacy_buf(); rpl_dao_buf = get_rpl_dao_buf(); DEBUG("instance %04X ", rpl_dao_buf->rpl_instanceid); DEBUG("sequence %04X\n", rpl_dao_buf->dao_sequence); @@ -652,7 +652,7 @@ void rpl_recv_DAO_mode(void) int len = DAO_BASE_LEN; uint8_t increment_seq = 0; - while (len < (NTOHS(ipv6_buf->length) - ICMPV6_HDR_LEN)) { + while (len < (NTOHS(ipv6_legacy_buf->length) - ICMPV6_HDR_LEN)) { rpl_opt_buf = get_rpl_opt_buf(len); switch (rpl_opt_buf->type) { @@ -693,10 +693,10 @@ void rpl_recv_DAO_mode(void) /* route lifetime seconds = (DAO lifetime) * (Unit Lifetime) */ DEBUG("Adding routing information: Target: %s, Source: %s, Lifetime: %u\n", - ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &rpl_opt_target_buf->target), - ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &ipv6_buf->srcaddr), + ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, &rpl_opt_target_buf->target), + ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, &ipv6_legacy_buf->srcaddr), (rpl_opt_transit_buf->path_lifetime * my_dodag->lifetime_unit)); - rpl_add_routing_entry(&rpl_opt_target_buf->target, &ipv6_buf->srcaddr, + rpl_add_routing_entry(&rpl_opt_target_buf->target, &ipv6_legacy_buf->srcaddr, rpl_opt_transit_buf->path_lifetime * my_dodag->lifetime_unit); increment_seq = 1; break; @@ -717,7 +717,7 @@ void rpl_recv_DAO_mode(void) } } - rpl_send_DAO_ACK(&ipv6_buf->srcaddr); + rpl_send_DAO_ACK(&ipv6_legacy_buf->srcaddr); if (increment_seq) { RPL_COUNTER_INCREMENT(my_dodag->dao_seq); @@ -733,11 +733,11 @@ void rpl_recv_DIS_mode(void) return; } - ipv6_buf = get_rpl_ipv6_buf(); + ipv6_legacy_buf = get_rpl_ipv6_legacy_buf(); rpl_dis_buf = get_rpl_dis_buf(); int len = DIS_BASE_LEN; - while (len < (NTOHS(ipv6_buf->length) - ICMPV6_HDR_LEN)) { + while (len < (NTOHS(ipv6_legacy_buf->length) - ICMPV6_HDR_LEN)) { rpl_opt_buf = get_rpl_opt_buf(len); switch (rpl_opt_buf->type) { @@ -788,7 +788,7 @@ void rpl_recv_DIS_mode(void) } } - rpl_send_DIO(&ipv6_buf->srcaddr); + rpl_send_DIO(&ipv6_legacy_buf->srcaddr); } @@ -815,24 +815,24 @@ void rpl_recv_dao_ack_mode(void) } /* obligatory for each mode. normally not modified */ -void rpl_send(ipv6_addr_t *destination, uint8_t *payload, uint16_t p_len, uint8_t next_header) +void rpl_send(ipv6_legacy_addr_t *destination, uint8_t *payload, uint16_t p_len, uint8_t next_header) { uint8_t *p_ptr; - ipv6_send_buf = get_rpl_send_ipv6_buf(); - p_ptr = get_rpl_send_payload_buf(ipv6_ext_hdr_len); + ipv6_legacy_send_buf = get_rpl_send_ipv6_legacy_buf(); + p_ptr = get_rpl_send_payload_buf(ipv6_legacy_ext_hdr_len); - ipv6_send_buf->version_trafficclass = IPV6_VER; - ipv6_send_buf->trafficclass_flowlabel = 0; - ipv6_send_buf->flowlabel = 0; - ipv6_send_buf->nextheader = next_header; - ipv6_send_buf->hoplimit = MULTIHOP_HOPLIMIT; - ipv6_send_buf->length = HTONS(p_len); + ipv6_legacy_send_buf->version_trafficclass = IPV6_LEGACY_VER; + ipv6_legacy_send_buf->trafficclass_flowlabel = 0; + ipv6_legacy_send_buf->flowlabel = 0; + ipv6_legacy_send_buf->nextheader = next_header; + ipv6_legacy_send_buf->hoplimit = MULTIHOP_HOPLIMIT; + ipv6_legacy_send_buf->length = HTONS(p_len); - memcpy(&(ipv6_send_buf->destaddr), destination, 16); - ipv6_net_if_get_best_src_addr(&(ipv6_send_buf->srcaddr), &(ipv6_send_buf->destaddr)); + memcpy(&(ipv6_legacy_send_buf->destaddr), destination, 16); + ipv6_legacy_net_if_get_best_src_addr(&(ipv6_legacy_send_buf->srcaddr), &(ipv6_legacy_send_buf->destaddr)); - icmp_send_buf = get_rpl_send_icmpv6_buf(ipv6_ext_hdr_len); - icmp_send_buf->checksum = icmpv6_csum(ipv6_send_buf, icmp_send_buf); + icmp_send_buf = get_rpl_send_icmpv6_buf(ipv6_legacy_ext_hdr_len); + icmp_send_buf->checksum = icmpv6_csum(ipv6_legacy_send_buf, icmp_send_buf); /* The packet was "assembled" in rpl_%mode%.c. Therefore rpl_send_buf was used. * Therefore memcpy is not needed because the payload is at the @@ -842,17 +842,17 @@ void rpl_send(ipv6_addr_t *destination, uint8_t *payload, uint16_t p_len, uint8_ memcpy(p_ptr, payload, p_len); } - if (ipv6_addr_is_multicast(&ipv6_send_buf->destaddr)) { - ipv6_send_packet(ipv6_send_buf, NULL); + if (ipv6_legacy_addr_is_multicast(&ipv6_legacy_send_buf->destaddr)) { + ipv6_legacy_send_packet(ipv6_legacy_send_buf, NULL); } else { /* find appropriate next hop before sending */ - ipv6_addr_t *next_hop = rpl_get_next_hop(&ipv6_send_buf->destaddr); + ipv6_legacy_addr_t *next_hop = rpl_get_next_hop(&ipv6_legacy_send_buf->destaddr); if (next_hop == NULL) { if (i_am_root) { - DEBUGF("[Error] destination unknown: %s\n", ipv6_addr_to_str(addr_str, - IPV6_MAX_ADDR_STR_LEN, &ipv6_send_buf->destaddr)); + DEBUGF("[Error] destination unknown: %s\n", ipv6_legacy_addr_to_str(addr_str, + IPV6_LEGACY_MAX_ADDR_STR_LEN, &ipv6_legacy_send_buf->destaddr)); return; } else { @@ -865,7 +865,7 @@ void rpl_send(ipv6_addr_t *destination, uint8_t *payload, uint16_t p_len, uint8_ } } - ipv6_send_packet(ipv6_send_buf, NULL); + ipv6_legacy_send_packet(ipv6_legacy_send_buf, NULL); } } diff --git a/sys/net/routing/rpl/trickle.c b/sys/net/routing/rpl/trickle.c index 9195917930f89..6adcc8c55cf07 100644 --- a/sys/net/routing/rpl/trickle.c +++ b/sys/net/routing/rpl/trickle.c @@ -133,8 +133,8 @@ static void *trickle_timer_over(void *arg) { (void) arg; - ipv6_addr_t mcast; - ipv6_addr_set_all_nodes_addr(&mcast); + ipv6_legacy_addr_t mcast; + ipv6_legacy_addr_set_all_nodes_addr(&mcast); while (1) { thread_sleep(); diff --git a/sys/net/transport_layer/socket_base/socket.c b/sys/net/transport_layer/socket_base/socket.c index 18a9ba456e5d3..62300adba5990 100644 --- a/sys/net/transport_layer/socket_base/socket.c +++ b/sys/net/transport_layer/socket_base/socket.c @@ -23,7 +23,7 @@ #include #include "hwtimer.h" -#include "ipv6.h" +#include "ipv6_legacy.h" #include "thread.h" #include "vtimer.h" @@ -152,16 +152,16 @@ int __attribute__((weak)) tcp_teardown(socket_internal_t *current_socket) void socket_base_print_socket(socket_t *current_socket) { - char addr_str[IPV6_MAX_ADDR_STR_LEN]; + char addr_str[IPV6_LEGACY_MAX_ADDR_STR_LEN]; printf("Domain: %i, Type: %i, Protocol: %i \n", current_socket->domain, current_socket->type, current_socket->protocol); printf("Local address: %s\n", - ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, + ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, ¤t_socket->local_address.sin6_addr)); printf("Foreign address: %s\n", - ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, + ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, ¤t_socket->foreign_address.sin6_addr)); printf("Local Port: %u, Foreign Port: %u\n", NTOHS(current_socket->local_address.sin6_port), diff --git a/sys/net/transport_layer/tcp/tcp.c b/sys/net/transport_layer/tcp/tcp.c index 1b666614750a8..5eaf2d25584a6 100644 --- a/sys/net/transport_layer/tcp/tcp.c +++ b/sys/net/transport_layer/tcp/tcp.c @@ -21,7 +21,7 @@ #include #include -#include "sixlowpan.h" +#include "sixlowpan_legacy.h" #include "thread.h" #include "vtimer.h" @@ -48,7 +48,7 @@ char tcp_stack_buffer[TCP_STACK_SIZE]; char tcp_timer_stack[TCP_TIMER_STACKSIZE]; void set_socket_address(sockaddr6_t *sockaddr, uint8_t sin6_family, - uint16_t sin6_port, uint32_t sin6_flowinfo, ipv6_addr_t *sin6_addr) + uint16_t sin6_port, uint32_t sin6_flowinfo, ipv6_legacy_addr_t *sin6_addr) { sockaddr->sin6_family = sin6_family; sockaddr->sin6_port = sin6_port; @@ -127,19 +127,19 @@ void print_tcp_cb(tcp_cb_t *cb) timex_uint64(timex_sub(now, cb->last_packet_time)), cb->no_of_retries, cb->state); } -void print_tcp_status(int in_or_out, ipv6_hdr_t *ipv6_header, +void print_tcp_status(int in_or_out, ipv6_legacy_hdr_t *ipv6_legacy_header, tcp_hdr_t *tcp_header, socket_t *tcp_socket) { - char addr_str[IPV6_MAX_ADDR_STR_LEN]; + char addr_str[IPV6_LEGACY_MAX_ADDR_STR_LEN]; printf("--- %s TCP packet: ---\n", (in_or_out == INC_PACKET ? "Incoming" : "Outgoing")); printf("IPv6 Source: %s\n", - ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, - &ipv6_header->srcaddr)); + ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, + &ipv6_legacy_header->srcaddr)); printf("IPv6 Dest: %s\n", - ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, - &ipv6_header->destaddr)); - printf("TCP Length: %x\n", NTOHS(ipv6_header->length) - TCP_HDR_LEN); + ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, + &ipv6_legacy_header->destaddr)); + printf("TCP Length: %x\n", NTOHS(ipv6_legacy_header->length) - TCP_HDR_LEN); printf("Source Port: %x, Dest. Port: %x\n", NTOHS(tcp_header->src_port), NTOHS(tcp_header->dst_port)); printf("Source Port: %u, Dest. Port: %u\n", @@ -155,13 +155,13 @@ void print_tcp_status(int in_or_out, ipv6_hdr_t *ipv6_header, #endif } -uint16_t tcp_csum(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header) +uint16_t tcp_csum(ipv6_legacy_hdr_t *ipv6_legacy_header, tcp_hdr_t *tcp_header) { uint16_t sum; - uint16_t len = NTOHS(ipv6_header->length); + uint16_t len = NTOHS(ipv6_legacy_header->length); sum = len + IPPROTO_TCP; - sum = csum(sum, (uint8_t *)&ipv6_header->srcaddr, 2 * sizeof(ipv6_addr_t)); + sum = csum(sum, (uint8_t *)&ipv6_legacy_header->srcaddr, 2 * sizeof(ipv6_legacy_addr_t)); sum = csum(sum, (uint8_t *)tcp_header, len); return (sum == 0) ? 0xffff : HTONS(sum); } @@ -239,7 +239,7 @@ void set_tcp_packet(tcp_hdr_t *tcp_hdr, uint16_t src_port, uint16_t dst_port, } int send_tcp(socket_internal_t *current_socket, tcp_hdr_t *current_tcp_packet, - ipv6_hdr_t *temp_ipv6_header, uint8_t flags, uint8_t payload_length) + ipv6_legacy_hdr_t *temp_ipv6_legacy_header, uint8_t flags, uint8_t payload_length) { socket_t *current_tcp_socket = ¤t_socket->socket_values; uint8_t header_length = TCP_HDR_LEN / 4; @@ -262,20 +262,20 @@ int send_tcp(socket_internal_t *current_socket, tcp_hdr_t *current_tcp_packet, current_tcp_socket->tcp_control.rcv_wnd, 0, 0); /* Fill IPv6 Header */ - memcpy(&(temp_ipv6_header->destaddr), + memcpy(&(temp_ipv6_legacy_header->destaddr), ¤t_tcp_socket->foreign_address.sin6_addr, 16); - memcpy(&(temp_ipv6_header->srcaddr), + memcpy(&(temp_ipv6_legacy_header->srcaddr), ¤t_tcp_socket->local_address.sin6_addr, 16); - temp_ipv6_header->length = HTONS(header_length * 4 + payload_length); + temp_ipv6_legacy_header->length = HTONS(header_length * 4 + payload_length); - current_tcp_packet->checksum = ~tcp_csum(temp_ipv6_header, current_tcp_packet); + current_tcp_packet->checksum = ~tcp_csum(temp_ipv6_legacy_header, current_tcp_packet); #ifdef TCP_HC uint16_t compressed_size; compressed_size = compress_tcp_packet(current_socket, (uint8_t *)current_tcp_packet, - temp_ipv6_header, flags, + temp_ipv6_legacy_header, flags, payload_length); if (compressed_size == 0) { @@ -283,30 +283,30 @@ int send_tcp(socket_internal_t *current_socket, tcp_hdr_t *current_tcp_packet, return -1; } - return ipv6_sendto(¤t_tcp_socket->foreign_address.sin6_addr, + return ipv6_legacy_sendto(¤t_tcp_socket->foreign_address.sin6_addr, IPPROTO_TCP, (uint8_t *)(current_tcp_packet), compressed_size); #else switch_tcp_packet_byte_order(current_tcp_packet); - return ipv6_sendto(¤t_tcp_socket->foreign_address.sin6_addr, + return ipv6_legacy_sendto(¤t_tcp_socket->foreign_address.sin6_addr, IPPROTO_TCP, (uint8_t *)(current_tcp_packet), header_length * 4 + payload_length, NULL); #endif } -bool is_four_touple(socket_internal_t *current_socket, ipv6_hdr_t *ipv6_header, +bool is_four_touple(socket_internal_t *current_socket, ipv6_legacy_hdr_t *ipv6_legacy_header, tcp_hdr_t *tcp_header) { - return (ipv6_addr_is_equal(¤t_socket->socket_values.local_address.sin6_addr, - &ipv6_header->destaddr) && + return (ipv6_legacy_addr_is_equal(¤t_socket->socket_values.local_address.sin6_addr, + &ipv6_legacy_header->destaddr) && (current_socket->socket_values.local_address.sin6_port == tcp_header->dst_port) && - ipv6_addr_is_equal(¤t_socket->socket_values.foreign_address.sin6_addr, - &ipv6_header->srcaddr) && + ipv6_legacy_addr_is_equal(¤t_socket->socket_values.foreign_address.sin6_addr, + &ipv6_legacy_header->srcaddr) && (current_socket->socket_values.foreign_address.sin6_port == tcp_header->src_port)); } socket_internal_t *get_waiting_connection_socket(int socket, - ipv6_hdr_t *ipv6_header, + ipv6_legacy_hdr_t *ipv6_legacy_header, tcp_hdr_t *tcp_header) { int i; @@ -320,8 +320,8 @@ socket_internal_t *get_waiting_connection_socket(int socket, } /* Connection establishment ACK, Check for 4 touple and state */ - if ((ipv6_header != NULL) && (tcp_header != NULL)) { - if (is_four_touple(current_socket, ipv6_header, tcp_header) && + if ((ipv6_legacy_header != NULL) && (tcp_header != NULL)) { + if (is_four_touple(current_socket, ipv6_legacy_header, tcp_header) && (current_socket->socket_values.tcp_control.state == TCP_SYN_RCVD)) { return current_socket; } @@ -339,7 +339,7 @@ socket_internal_t *get_waiting_connection_socket(int socket, return NULL; } -socket_internal_t *new_tcp_queued_socket(ipv6_hdr_t *ipv6_header, +socket_internal_t *new_tcp_queued_socket(ipv6_legacy_hdr_t *ipv6_legacy_header, tcp_hdr_t *tcp_header) { int queued_socket_id; @@ -349,13 +349,13 @@ socket_internal_t *new_tcp_queued_socket(ipv6_hdr_t *ipv6_header, /* Foreign address */ set_socket_address(¤t_queued_socket->socket_values.foreign_address, - AF_INET6, tcp_header->src_port, ipv6_header->flowlabel, - &ipv6_header->srcaddr); + AF_INET6, tcp_header->src_port, ipv6_legacy_header->flowlabel, + &ipv6_legacy_header->srcaddr); /* Local address */ set_socket_address(¤t_queued_socket->socket_values.local_address, AF_INET6, tcp_header->dst_port, 0, - &ipv6_header->destaddr); + &ipv6_legacy_header->destaddr); /* Foreign TCP information */ if ((tcp_header->data_offset * 4 > TCP_HDR_LEN) && @@ -383,7 +383,7 @@ socket_internal_t *new_tcp_queued_socket(ipv6_hdr_t *ipv6_header, return current_queued_socket; } -socket_internal_t *get_tcp_socket(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header) +socket_internal_t *get_tcp_socket(ipv6_legacy_hdr_t *ipv6_legacy_header, tcp_hdr_t *tcp_header) { uint8_t i = 1; socket_internal_t *current_socket = NULL; @@ -395,7 +395,7 @@ socket_internal_t *get_tcp_socket(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header current_socket = socket_base_get_socket(i); /* Check for matching 4 touple, TCP_ESTABLISHED connection */ - if (tcp_socket_compliancy(i) && is_four_touple(current_socket, ipv6_header, + if (tcp_socket_compliancy(i) && is_four_touple(current_socket, ipv6_legacy_header, tcp_header)) { return current_socket; } @@ -404,7 +404,7 @@ socket_internal_t *get_tcp_socket(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header ((current_socket->socket_values.tcp_control.state == TCP_LISTEN) || (current_socket->socket_values.tcp_control.state == TCP_SYN_RCVD)) && (current_socket->socket_values.local_address.sin6_addr.uint8[15] == - ipv6_header->destaddr.uint8[15]) && + ipv6_legacy_header->destaddr.uint8[15]) && (current_socket->socket_values.local_address.sin6_port == tcp_header->dst_port) && (current_socket->socket_values.foreign_address.sin6_addr.uint8[15] == @@ -420,13 +420,13 @@ socket_internal_t *get_tcp_socket(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header return listening_socket; } -uint8_t handle_payload(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header, +uint8_t handle_payload(ipv6_legacy_hdr_t *ipv6_legacy_header, tcp_hdr_t *tcp_header, socket_internal_t *tcp_socket, uint8_t *payload) { (void) tcp_header; msg_t m_send_tcp, m_recv_tcp; - uint8_t tcp_payload_len = NTOHS(ipv6_header->length) - TCP_HDR_LEN; + uint8_t tcp_payload_len = NTOHS(ipv6_legacy_header->length) - TCP_HDR_LEN; uint8_t acknowledged_bytes = 0; if (tcp_payload_len > tcp_socket->socket_values.tcp_control.rcv_wnd) { @@ -457,7 +457,7 @@ uint8_t handle_payload(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header, return acknowledged_bytes; } -void handle_tcp_ack_packet(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header, +void handle_tcp_ack_packet(ipv6_legacy_hdr_t *ipv6_legacy_header, tcp_hdr_t *tcp_header, socket_internal_t *tcp_socket) { msg_t m_recv_tcp, m_send_tcp; @@ -473,7 +473,7 @@ void handle_tcp_ack_packet(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header, msg_try_send(&m_send_tcp, tcp_socket->send_pid); return; } - else if (get_waiting_connection_socket(tcp_socket->socket_id, ipv6_header, + else if (get_waiting_connection_socket(tcp_socket->socket_id, ipv6_legacy_header, tcp_header) != NULL) { m_send_tcp.content.ptr = (char *)tcp_header; socket_base_net_msg_send_recv(&m_send_tcp, &m_recv_tcp, tcp_socket->recv_pid, TCP_ACK); @@ -490,23 +490,23 @@ void handle_tcp_ack_packet(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header, printf("NO WAY OF HANDLING THIS ACK!\n"); } -void handle_tcp_rst_packet(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header, +void handle_tcp_rst_packet(ipv6_legacy_hdr_t *ipv6_legacy_header, tcp_hdr_t *tcp_header, socket_internal_t *tcp_socket) { - (void) ipv6_header; + (void) ipv6_legacy_header; (void) tcp_header; (void) tcp_socket; /* TODO: Reset connection */ } -void handle_tcp_syn_packet(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header, +void handle_tcp_syn_packet(ipv6_legacy_hdr_t *ipv6_legacy_header, tcp_hdr_t *tcp_header, socket_internal_t *tcp_socket) { msg_t m_send_tcp; if (tcp_socket->socket_values.tcp_control.state == TCP_LISTEN) { - socket_internal_t *new_socket = new_tcp_queued_socket(ipv6_header, + socket_internal_t *new_socket = new_tcp_queued_socket(ipv6_legacy_header, tcp_header); if (new_socket != NULL) { @@ -529,10 +529,10 @@ void handle_tcp_syn_packet(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header, } } -void handle_tcp_syn_ack_packet(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header, +void handle_tcp_syn_ack_packet(ipv6_legacy_hdr_t *ipv6_legacy_header, tcp_hdr_t *tcp_header, socket_internal_t *tcp_socket) { - (void) ipv6_header; + (void) ipv6_legacy_header; msg_t m_send_tcp; @@ -545,16 +545,16 @@ void handle_tcp_syn_ack_packet(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header, } } -void handle_tcp_fin_packet(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header, +void handle_tcp_fin_packet(ipv6_legacy_hdr_t *ipv6_legacy_header, tcp_hdr_t *tcp_header, socket_internal_t *tcp_socket) { - (void) ipv6_header; + (void) ipv6_legacy_header; msg_t m_send; socket_t *current_tcp_socket = &tcp_socket->socket_values; uint8_t send_buffer[BUFFER_SIZE]; - ipv6_hdr_t *temp_ipv6_header = ((ipv6_hdr_t *)(&send_buffer)); - tcp_hdr_t *current_tcp_packet = ((tcp_hdr_t *)(&send_buffer[IPV6_HDR_LEN])); + ipv6_legacy_hdr_t *temp_ipv6_legacy_header = ((ipv6_legacy_hdr_t *)(&send_buffer)); + tcp_hdr_t *current_tcp_packet = ((tcp_hdr_t *)(&send_buffer[IPV6_LEGACY_HDR_LEN])); set_tcp_cb(¤t_tcp_socket->tcp_control, tcp_header->seq_nr + 1, current_tcp_socket->tcp_control.send_wnd, tcp_header->ack_nr + 1, @@ -567,27 +567,27 @@ void handle_tcp_fin_packet(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header, if (current_tcp_socket->tcp_control.state == TCP_FIN_WAIT_1) { current_tcp_socket->tcp_control.state = TCP_CLOSING; - send_tcp(tcp_socket, current_tcp_packet, temp_ipv6_header, TCP_FIN_ACK, 0); + send_tcp(tcp_socket, current_tcp_packet, temp_ipv6_legacy_header, TCP_FIN_ACK, 0); } else { current_tcp_socket->tcp_control.state = TCP_LAST_ACK; - send_tcp(tcp_socket, current_tcp_packet, temp_ipv6_header, TCP_FIN_ACK, 0); + send_tcp(tcp_socket, current_tcp_packet, temp_ipv6_legacy_header, TCP_FIN_ACK, 0); } socket_base_net_msg_send(&m_send, tcp_socket->recv_pid, 0, CLOSE_CONN); } -void handle_tcp_fin_ack_packet(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header, +void handle_tcp_fin_ack_packet(ipv6_legacy_hdr_t *ipv6_legacy_header, tcp_hdr_t *tcp_header, socket_internal_t *tcp_socket) { - (void) ipv6_header; + (void) ipv6_legacy_header; msg_t m_send; socket_t *current_tcp_socket = &tcp_socket->socket_values; uint8_t send_buffer[BUFFER_SIZE]; - ipv6_hdr_t *temp_ipv6_header = ((ipv6_hdr_t *)(&send_buffer)); - tcp_hdr_t *current_tcp_packet = ((tcp_hdr_t *)(&send_buffer[IPV6_HDR_LEN])); + ipv6_legacy_hdr_t *temp_ipv6_legacy_header = ((ipv6_legacy_hdr_t *)(&send_buffer)); + tcp_hdr_t *current_tcp_packet = ((tcp_hdr_t *)(&send_buffer[IPV6_LEGACY_HDR_LEN])); current_tcp_socket->tcp_control.state = TCP_CLOSED; @@ -599,22 +599,22 @@ void handle_tcp_fin_ack_packet(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header, current_tcp_socket->tcp_control.tcp_context.hc_type = COMPRESSED_HEADER; #endif - send_tcp(tcp_socket, current_tcp_packet, temp_ipv6_header, TCP_ACK, 0); + send_tcp(tcp_socket, current_tcp_packet, temp_ipv6_legacy_header, TCP_ACK, 0); msg_try_send(&m_send, tcp_socket->send_pid); msg_try_send(&m_send, tcp_socket->recv_pid); } -void handle_tcp_no_flags_packet(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header, +void handle_tcp_no_flags_packet(ipv6_legacy_hdr_t *ipv6_legacy_header, tcp_hdr_t *tcp_header, socket_internal_t *tcp_socket, uint8_t *payload, uint8_t tcp_payload_len) { socket_t *current_tcp_socket = &tcp_socket->socket_values; uint8_t send_buffer[BUFFER_SIZE]; - ipv6_hdr_t *temp_ipv6_header = ((ipv6_hdr_t *)(&send_buffer)); - tcp_hdr_t *current_tcp_packet = ((tcp_hdr_t *)(&send_buffer[IPV6_HDR_LEN])); + ipv6_legacy_hdr_t *temp_ipv6_legacy_header = ((ipv6_legacy_hdr_t *)(&send_buffer)); + tcp_hdr_t *current_tcp_packet = ((tcp_hdr_t *)(&send_buffer[IPV6_LEGACY_HDR_LEN])); if (check_tcp_consistency(current_tcp_socket, tcp_header, tcp_payload_len) == PACKET_OK) { - uint8_t read_bytes = handle_payload(ipv6_header, tcp_header, tcp_socket, payload); + uint8_t read_bytes = handle_payload(ipv6_legacy_header, tcp_header, tcp_socket, payload); /* Refresh TCP status values */ current_tcp_socket->tcp_control.state = TCP_ESTABLISHED; @@ -631,7 +631,7 @@ void handle_tcp_no_flags_packet(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header, #ifdef TCP_HC current_tcp_socket->tcp_control.tcp_context.hc_type = COMPRESSED_HEADER; #endif - send_tcp(tcp_socket, current_tcp_packet, temp_ipv6_header, TCP_ACK, 0); + send_tcp(tcp_socket, current_tcp_packet, temp_ipv6_legacy_header, TCP_ACK, 0); } /* ACK packet probably got lost */ else { @@ -639,7 +639,7 @@ void handle_tcp_no_flags_packet(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header, #ifdef TCP_HC current_tcp_socket->tcp_control.tcp_context.hc_type = FULL_HEADER; #endif - send_tcp(tcp_socket, current_tcp_packet, temp_ipv6_header, TCP_ACK, 0); + send_tcp(tcp_socket, current_tcp_packet, temp_ipv6_legacy_header, TCP_ACK, 0); } } @@ -653,17 +653,17 @@ void *tcp_packet_handler(void *arg) while (1) { msg_receive(&m_recv_ip); - ipv6_hdr_t *ipv6_header = ((ipv6_hdr_t *)m_recv_ip.content.ptr); - tcp_hdr_t *tcp_header = ((tcp_hdr_t *)(m_recv_ip.content.ptr + IPV6_HDR_LEN)); + ipv6_legacy_hdr_t *ipv6_legacy_header = ((ipv6_legacy_hdr_t *)m_recv_ip.content.ptr); + tcp_hdr_t *tcp_header = ((tcp_hdr_t *)(m_recv_ip.content.ptr + IPV6_LEGACY_HDR_LEN)); #ifdef TCP_HC - tcp_socket = decompress_tcp_packet(ipv6_header); + tcp_socket = decompress_tcp_packet(ipv6_legacy_header); #else switch_tcp_packet_byte_order(tcp_header); - tcp_socket = get_tcp_socket(ipv6_header, tcp_header); + tcp_socket = get_tcp_socket(ipv6_legacy_header, tcp_header); #endif - uint16_t chksum = tcp_csum(ipv6_header, tcp_header); + uint16_t chksum = tcp_csum(ipv6_legacy_header, tcp_header); - uint8_t *payload = (uint8_t *)(m_recv_ip.content.ptr + IPV6_HDR_LEN + tcp_header->data_offset * 4); + uint8_t *payload = (uint8_t *)(m_recv_ip.content.ptr + IPV6_LEGACY_HDR_LEN + tcp_header->data_offset * 4); if ((chksum == 0xffff) && (tcp_socket != NULL)) { #ifdef TCP_HC @@ -673,18 +673,18 @@ void *tcp_packet_handler(void *arg) switch (tcp_header->reserved_flags) { case TCP_ACK: { /* only ACK Bit set */ - uint8_t tcp_payload_len = NTOHS(ipv6_header->length) - TCP_HDR_LEN; + uint8_t tcp_payload_len = NTOHS(ipv6_legacy_header->length) - TCP_HDR_LEN; uint8_t state = tcp_socket->socket_values.tcp_control.state; if ((tcp_payload_len > 0) && (state == TCP_ESTABLISHED)) { /* handle data segments only when the connection was established successfully */ - handle_tcp_no_flags_packet(ipv6_header, tcp_header, tcp_socket, payload, tcp_payload_len); + handle_tcp_no_flags_packet(ipv6_legacy_header, tcp_header, tcp_socket, payload, tcp_payload_len); } else if (tcp_payload_len == 0 && (state == TCP_ESTABLISHED || state == TCP_SYN_RCVD || state == TCP_CLOSING || state == TCP_LAST_ACK)) { /* no payload, acknowledging data only */ - handle_tcp_ack_packet(ipv6_header, tcp_header, tcp_socket); + handle_tcp_ack_packet(ipv6_legacy_header, tcp_header, tcp_socket); } break; } @@ -692,7 +692,7 @@ void *tcp_packet_handler(void *arg) case TCP_RST: { printf("RST Bit set!\n"); /* only RST Bit set */ - handle_tcp_rst_packet(ipv6_header, tcp_header, tcp_socket); + handle_tcp_rst_packet(ipv6_legacy_header, tcp_header, tcp_socket); break; } @@ -700,14 +700,14 @@ void *tcp_packet_handler(void *arg) /* only SYN Bit set, look for matching, listening socket * and request new queued socket */ printf("SYN Bit set!\n"); - handle_tcp_syn_packet(ipv6_header, tcp_header, tcp_socket); + handle_tcp_syn_packet(ipv6_legacy_header, tcp_header, tcp_socket); break; } case TCP_SYN_ACK: { /* only SYN and ACK Bit set, complete three way handshake * when socket in state TCP_SYN_SENT */ - handle_tcp_syn_ack_packet(ipv6_header, tcp_header, tcp_socket); + handle_tcp_syn_ack_packet(ipv6_legacy_header, tcp_header, tcp_socket); break; } @@ -715,11 +715,11 @@ void *tcp_packet_handler(void *arg) if (tcp_socket->socket_values.tcp_control.state == TCP_ESTABLISHED) { /* this is the first FIN */ printf("FIN ACK Bit set!\n"); - handle_tcp_fin_packet(ipv6_header, tcp_header, tcp_socket); + handle_tcp_fin_packet(ipv6_legacy_header, tcp_header, tcp_socket); } else { /* this is the response to FIN */ - handle_tcp_fin_ack_packet(ipv6_header, tcp_header, tcp_socket); + handle_tcp_fin_ack_packet(ipv6_legacy_header, tcp_header, tcp_socket); } break; } @@ -732,7 +732,7 @@ void *tcp_packet_handler(void *arg) else { printf("Wrong checksum (%x) or no corresponding socket found!\n", chksum); - print_tcp_status(INC_PACKET, ipv6_header, tcp_header, + print_tcp_status(INC_PACKET, ipv6_legacy_header, tcp_header, &tcp_socket->socket_values); } @@ -825,8 +825,8 @@ int handle_new_tcp_connection(socket_internal_t *current_queued_int_socket, msg_t msg_recv_client_ack, msg_send_client_ack; socket_t *current_queued_socket = ¤t_queued_int_socket->socket_values; uint8_t send_buffer[BUFFER_SIZE]; - ipv6_hdr_t *temp_ipv6_header = ((ipv6_hdr_t *)(&send_buffer)); - tcp_hdr_t *syn_ack_packet = ((tcp_hdr_t *)(&send_buffer[IPV6_HDR_LEN])); + ipv6_legacy_hdr_t *temp_ipv6_legacy_header = ((ipv6_legacy_hdr_t *)(&send_buffer)); + tcp_hdr_t *syn_ack_packet = ((tcp_hdr_t *)(&send_buffer[IPV6_LEGACY_HDR_LEN])); current_queued_int_socket->recv_pid = thread_getpid(); #ifdef TCP_HC @@ -848,7 +848,7 @@ int handle_new_tcp_connection(socket_internal_t *current_queued_int_socket, while (msg_recv_client_ack.type == TCP_RETRY) { /* Send packet */ - send_tcp(current_queued_int_socket, syn_ack_packet, temp_ipv6_header, + send_tcp(current_queued_int_socket, syn_ack_packet, temp_ipv6_legacy_header, TCP_SYN_ACK, 0); /* wait for ACK from Client */ @@ -916,8 +916,8 @@ int32_t tcp_send(int s, const void *buf, uint32_t len, int flags) socket_t *current_tcp_socket; uint8_t send_buffer[BUFFER_SIZE]; memset(send_buffer, 0, BUFFER_SIZE); - ipv6_hdr_t *temp_ipv6_header = ((ipv6_hdr_t *)(&send_buffer)); - tcp_hdr_t *current_tcp_packet = ((tcp_hdr_t *)(&send_buffer[IPV6_HDR_LEN])); + ipv6_legacy_hdr_t *temp_ipv6_legacy_header = ((ipv6_legacy_hdr_t *)(&send_buffer)); + tcp_hdr_t *current_tcp_packet = ((tcp_hdr_t *)(&send_buffer[IPV6_LEGACY_HDR_LEN])); /* Check if socket exists and is TCP socket */ if (!tcp_socket_compliancy(s)) { @@ -954,13 +954,13 @@ int32_t tcp_send(int s, const void *buf, uint32_t len, int flags) current_tcp_socket->tcp_control.mss) { /* Window size > Maximum Segment Size */ if ((len - total_sent_bytes) > current_tcp_socket->tcp_control.mss) { - memcpy(&send_buffer[IPV6_HDR_LEN + TCP_HDR_LEN], buf, + memcpy(&send_buffer[IPV6_LEGACY_HDR_LEN + TCP_HDR_LEN], buf, current_tcp_socket->tcp_control.mss); sent_bytes = current_tcp_socket->tcp_control.mss; total_sent_bytes += sent_bytes; } else { - memcpy(&send_buffer[IPV6_HDR_LEN + TCP_HDR_LEN], + memcpy(&send_buffer[IPV6_LEGACY_HDR_LEN + TCP_HDR_LEN], (uint8_t *) buf + total_sent_bytes, len - total_sent_bytes); sent_bytes = len - total_sent_bytes; total_sent_bytes = len; @@ -969,13 +969,13 @@ int32_t tcp_send(int s, const void *buf, uint32_t len, int flags) else { /* Window size <= Maximum Segment Size */ if ((len - total_sent_bytes) > current_tcp_socket->tcp_control.send_wnd) { - memcpy(&send_buffer[IPV6_HDR_LEN + TCP_HDR_LEN], buf, + memcpy(&send_buffer[IPV6_LEGACY_HDR_LEN + TCP_HDR_LEN], buf, current_tcp_socket->tcp_control.send_wnd); sent_bytes = current_tcp_socket->tcp_control.send_wnd; total_sent_bytes += sent_bytes; } else { - memcpy(&send_buffer[IPV6_HDR_LEN + TCP_HDR_LEN], + memcpy(&send_buffer[IPV6_LEGACY_HDR_LEN + TCP_HDR_LEN], (uint8_t *) buf + total_sent_bytes, len - total_sent_bytes); sent_bytes = len - total_sent_bytes; total_sent_bytes = len; @@ -986,7 +986,7 @@ int32_t tcp_send(int s, const void *buf, uint32_t len, int flags) current_tcp_socket->tcp_control.send_wnd -= sent_bytes; if (send_tcp(current_int_tcp_socket, current_tcp_packet, - temp_ipv6_header, TCP_ACK, sent_bytes) < 0) { + temp_ipv6_legacy_header, TCP_ACK, sent_bytes) < 0) { /* Error while sending tcp data */ current_tcp_socket->tcp_control.send_nxt -= sent_bytes; current_tcp_socket->tcp_control.send_wnd += sent_bytes; @@ -1118,13 +1118,13 @@ int tcp_connect(int socket, sockaddr6_t *addr, uint32_t addrlen) (void) addrlen; /* Variables */ - ipv6_addr_t src_addr; + ipv6_legacy_addr_t src_addr; socket_internal_t *current_int_tcp_socket; socket_t *current_tcp_socket; msg_t msg_from_server; uint8_t send_buffer[BUFFER_SIZE]; - ipv6_hdr_t *temp_ipv6_header = ((ipv6_hdr_t *)(&send_buffer)); - tcp_hdr_t *current_tcp_packet = ((tcp_hdr_t *)(&send_buffer[IPV6_HDR_LEN])); + ipv6_legacy_hdr_t *temp_ipv6_legacy_header = ((ipv6_legacy_hdr_t *)(&send_buffer)); + tcp_hdr_t *current_tcp_packet = ((tcp_hdr_t *)(&send_buffer[IPV6_LEGACY_HDR_LEN])); /* Check if socket exists */ current_int_tcp_socket = socket_base_get_socket(socket); @@ -1138,7 +1138,7 @@ int tcp_connect(int socket, sockaddr6_t *addr, uint32_t addrlen) current_int_tcp_socket->recv_pid = thread_getpid(); /* Local address information */ - ipv6_net_if_get_best_src_addr(&src_addr, &addr->sin6_addr); + ipv6_legacy_net_if_get_best_src_addr(&src_addr, &addr->sin6_addr); set_socket_address(¤t_tcp_socket->local_address, PF_INET6, HTONS(socket_base_get_free_source_port(IPPROTO_TCP)), 0, &src_addr); @@ -1183,7 +1183,7 @@ int tcp_connect(int socket, sockaddr6_t *addr, uint32_t addrlen) while (msg_from_server.type == TCP_RETRY) { /* Send packet */ - send_tcp(current_int_tcp_socket, current_tcp_packet, temp_ipv6_header, + send_tcp(current_int_tcp_socket, current_tcp_packet, temp_ipv6_legacy_header, TCP_SYN, 0); /* wait for SYN ACK or RETRY */ @@ -1250,7 +1250,7 @@ int tcp_connect(int socket, sockaddr6_t *addr, uint32_t addrlen) while (msg_from_server.type != TCP_RETRY) { /* Send packet */ - send_tcp(current_int_tcp_socket, current_tcp_packet, temp_ipv6_header, + send_tcp(current_int_tcp_socket, current_tcp_packet, temp_ipv6_legacy_header, TCP_ACK, 0); msg_receive(&msg_from_server); @@ -1367,8 +1367,8 @@ int tcp_teardown(socket_internal_t *current_socket) /* Variables */ msg_t m_recv; uint8_t send_buffer[BUFFER_SIZE]; - ipv6_hdr_t *temp_ipv6_header = ((ipv6_hdr_t *)(&send_buffer)); - tcp_hdr_t *current_tcp_packet = ((tcp_hdr_t *)(&send_buffer[IPV6_HDR_LEN])); + ipv6_legacy_hdr_t *temp_ipv6_legacy_header = ((ipv6_legacy_hdr_t *)(&send_buffer)); + tcp_hdr_t *current_tcp_packet = ((tcp_hdr_t *)(&send_buffer[IPV6_LEGACY_HDR_LEN])); /* Check for TCP_ESTABLISHED STATE */ if (current_socket->socket_values.tcp_control.state != TCP_ESTABLISHED) { @@ -1385,7 +1385,7 @@ int tcp_teardown(socket_internal_t *current_socket) COMPRESSED_HEADER; #endif - send_tcp(current_socket, current_tcp_packet, temp_ipv6_header, + send_tcp(current_socket, current_tcp_packet, temp_ipv6_legacy_header, TCP_FIN_ACK, 0); msg_receive(&m_recv); memset(current_socket, 0, sizeof(socket_internal_t)); @@ -1411,7 +1411,7 @@ int tcp_init_transport_layer(void) return -1; } - ipv6_register_next_header_handler(IPV6_PROTO_NUM_TCP, tcp_thread_pid); + ipv6_legacy_register_next_header_handler(IPV6_LEGACY_PROTO_NUM_TCP, tcp_thread_pid); if (thread_create(tcp_timer_stack, TCP_TIMER_STACKSIZE, PRIORITY_MAIN + 1, CREATE_STACKTEST, tcp_general_timer, NULL, "tcp_general_timer") < 0) { diff --git a/sys/net/transport_layer/tcp/tcp.h b/sys/net/transport_layer/tcp/tcp.h index 6b72cba99e917..0c07f41d4862f 100644 --- a/sys/net/transport_layer/tcp/tcp.h +++ b/sys/net/transport_layer/tcp/tcp.h @@ -17,7 +17,7 @@ #ifndef TCP_H_ #define TCP_H_ -#include "ipv6.h" +#include "ipv6_legacy.h" #include "socket_base/types.h" #include "socket.h" diff --git a/sys/net/transport_layer/tcp/tcp_hc.c b/sys/net/transport_layer/tcp/tcp_hc.c index 85cbaf0a6ac2e..4a46552d2a8d7 100644 --- a/sys/net/transport_layer/tcp/tcp_hc.c +++ b/sys/net/transport_layer/tcp/tcp_hc.c @@ -20,7 +20,7 @@ #include #include -#include "ipv6.h" +#include "ipv6_legacy.h" #include "net_help.h" @@ -31,7 +31,7 @@ #ifdef TCP_HC -socket_internal_t *get_tcp_socket_by_context(ipv6_hdr_t *current_ipv6_header, +socket_internal_t *get_tcp_socket_by_context(ipv6_legacy_hdr_t *current_ipv6_legacy_header, uint16_t current_context) { socket_internal_t *temp_socket; @@ -40,10 +40,10 @@ socket_internal_t *get_tcp_socket_by_context(ipv6_hdr_t *current_ipv6_header, temp_socket = socket_base_get_socket(i); if ((temp_socket != NULL) && - ipv6_addr_is_equal(&temp_socket->socket_values.foreign_address.sin6_addr, - ¤t_ipv6_header->srcaddr) && - ipv6_addr_is_equal(&temp_socket->socket_values.local_address.sin6_addr, - ¤t_ipv6_header->destaddr) && + ipv6_legacy_addr_is_equal(&temp_socket->socket_values.foreign_address.sin6_addr, + ¤t_ipv6_legacy_header->srcaddr) && + ipv6_legacy_addr_is_equal(&temp_socket->socket_values.local_address.sin6_addr, + ¤t_ipv6_legacy_header->destaddr) && (temp_socket->socket_values.tcp_control.tcp_context.context_id == current_context)) { return temp_socket; @@ -73,7 +73,7 @@ void update_tcp_hc_context(bool incoming, socket_internal_t *current_socket, uint16_t compress_tcp_packet(socket_internal_t *current_socket, uint8_t *current_tcp_packet, - ipv6_hdr_t *temp_ipv6_header, + ipv6_legacy_hdr_t *temp_ipv6_legacy_header, uint8_t flags, uint8_t payload_length) { @@ -405,32 +405,32 @@ uint16_t compress_tcp_packet(socket_internal_t *current_socket, return 0; } -socket_internal_t *decompress_tcp_packet(ipv6_hdr_t *temp_ipv6_header) +socket_internal_t *decompress_tcp_packet(ipv6_legacy_hdr_t *temp_ipv6_legacy_header) { - uint8_t *packet_buffer = ((uint8_t *)temp_ipv6_header) + IPV6_HDR_LEN; + uint8_t *packet_buffer = ((uint8_t *)temp_ipv6_legacy_header) + IPV6_LEGACY_HDR_LEN; uint16_t tcp_hc_header; socket_internal_t *current_socket = NULL; /* Full header TCP segment */ - if (*(((uint8_t *)temp_ipv6_header) + IPV6_HDR_LEN) == 0x01) { - switch_tcp_packet_byte_order(((tcp_hdr_t *)(((uint8_t *)temp_ipv6_header) + - IPV6_HDR_LEN + 3))); - current_socket = get_tcp_socket(temp_ipv6_header, - ((tcp_hdr_t *)(((uint8_t *)temp_ipv6_header) + - IPV6_HDR_LEN + 3))); + if (*(((uint8_t *)temp_ipv6_legacy_header) + IPV6_LEGACY_HDR_LEN) == 0x01) { + switch_tcp_packet_byte_order(((tcp_hdr_t *)(((uint8_t *)temp_ipv6_legacy_header) + + IPV6_LEGACY_HDR_LEN + 3))); + current_socket = get_tcp_socket(temp_ipv6_legacy_header, + ((tcp_hdr_t *)(((uint8_t *)temp_ipv6_legacy_header) + + IPV6_LEGACY_HDR_LEN + 3))); if (current_socket != NULL) { if (current_socket->socket_values.tcp_control.state == LISTEN) { memcpy(¤t_socket->socket_values.tcp_control.tcp_context.context_id, - ((uint8_t *)temp_ipv6_header) + IPV6_HDR_LEN + 1, 2); + ((uint8_t *)temp_ipv6_legacy_header) + IPV6_LEGACY_HDR_LEN + 1, 2); current_socket->socket_values.tcp_control.tcp_context.context_id = NTOHS(current_socket->socket_values.tcp_control.tcp_context.context_id); } - memmove(((uint8_t *)temp_ipv6_header) + IPV6_HDR_LEN, - (((uint8_t *)temp_ipv6_header) + IPV6_HDR_LEN + 3), - temp_ipv6_header->length - 3); - temp_ipv6_header->length -= 3; + memmove(((uint8_t *)temp_ipv6_legacy_header) + IPV6_LEGACY_HDR_LEN, + (((uint8_t *)temp_ipv6_legacy_header) + IPV6_LEGACY_HDR_LEN + 3), + temp_ipv6_legacy_header->length - 3); + temp_ipv6_legacy_header->length -= 3; return current_socket; } else { @@ -474,7 +474,7 @@ socket_internal_t *decompress_tcp_packet(ipv6_hdr_t *temp_ipv6_header) /* Current socket */ socket_internal_t *current_socket = - get_tcp_socket_by_context(temp_ipv6_header, current_context); + get_tcp_socket_by_context(temp_ipv6_legacy_header, current_context); if (current_socket == NULL) { printf("Current Socket == NULL!\n"); @@ -620,15 +620,15 @@ socket_internal_t *decompress_tcp_packet(ipv6_hdr_t *temp_ipv6_header) full_tcp_header.data_offset = TCP_HDR_LEN / 4; /* Move payload to end of tcp header */ - memmove(((uint8_t *)temp_ipv6_header) + IPV6_HDR_LEN + TCP_HDR_LEN, - packet_buffer, temp_ipv6_header->length - packet_size); + memmove(((uint8_t *)temp_ipv6_legacy_header) + IPV6_LEGACY_HDR_LEN + TCP_HDR_LEN, + packet_buffer, temp_ipv6_legacy_header->length - packet_size); /* Copy TCP uncompressed header in front of payload */ - memcpy(((uint8_t *)temp_ipv6_header) + IPV6_HDR_LEN, &full_tcp_header, + memcpy(((uint8_t *)temp_ipv6_legacy_header) + IPV6_LEGACY_HDR_LEN, &full_tcp_header, TCP_HDR_LEN); - /* Set IPV6 header length */ - temp_ipv6_header->length = temp_ipv6_header->length - packet_size + + /* Set IPV6_LEGACY header length */ + temp_ipv6_legacy_header->length = temp_ipv6_legacy_header->length - packet_size + TCP_HDR_LEN; return current_socket; } diff --git a/sys/net/transport_layer/tcp/tcp_hc.h b/sys/net/transport_layer/tcp/tcp_hc.h index 4052c333f8ca8..b858ab15750ad 100644 --- a/sys/net/transport_layer/tcp/tcp_hc.h +++ b/sys/net/transport_layer/tcp/tcp_hc.h @@ -14,7 +14,7 @@ #ifndef TCP_HC_H_ #define TCP_HC_H_ -#include "sixlowpan.h" +#include "sixlowpan_legacy.h" #include "socket_base/socket.h" @@ -31,8 +31,8 @@ extern "C" { #define COMPRESSED_HEADER 3 void update_tcp_hc_context(bool incoming, socket_internal_t *current_socket, tcp_hdr_t *current_tcp_packet); -uint16_t compress_tcp_packet(socket_internal_t *current_socket, uint8_t *current_tcp_packet, ipv6_hdr_t *temp_ipv6_header, uint8_t flags, uint8_t payload_length); -socket_internal_t *decompress_tcp_packet(ipv6_hdr_t *temp_ipv6_header); +uint16_t compress_tcp_packet(socket_internal_t *current_socket, uint8_t *current_tcp_packet, ipv6_legacy_hdr_t *temp_ipv6_legacy_header, uint8_t flags, uint8_t payload_length); +socket_internal_t *decompress_tcp_packet(ipv6_legacy_hdr_t *temp_ipv6_legacy_header); #endif #ifdef __cplusplus diff --git a/sys/net/transport_layer/tcp/tcp_timer.c b/sys/net/transport_layer/tcp/tcp_timer.c index 25e4cb553420d..2d39d02c5c1c4 100644 --- a/sys/net/transport_layer/tcp/tcp_timer.c +++ b/sys/net/transport_layer/tcp/tcp_timer.c @@ -19,7 +19,7 @@ #include #include -#include "sixlowpan.h" +#include "sixlowpan_legacy.h" #include "thread.h" #include "vtimer.h" diff --git a/sys/net/transport_layer/udp/udp.c b/sys/net/transport_layer/udp/udp.c index afd0b76a328a5..489757f7fa386 100644 --- a/sys/net/transport_layer/udp/udp.c +++ b/sys/net/transport_layer/udp/udp.c @@ -19,9 +19,9 @@ #include #include -#include "ipv6.h" +#include "ipv6_legacy.h" #include "msg.h" -#include "sixlowpan.h" +#include "sixlowpan_legacy.h" #include "thread.h" #include "socket_base/in.h" @@ -37,13 +37,13 @@ msg_t udp_msg_queue[UDP_PKT_RECV_BUF_SIZE]; char udp_stack_buffer[UDP_STACK_SIZE]; -uint16_t udp_csum(ipv6_hdr_t *ipv6_header, udp_hdr_t *udp_header) +uint16_t udp_csum(ipv6_legacy_hdr_t *ipv6_legacy_header, udp_hdr_t *udp_header) { uint16_t sum; uint16_t len = NTOHS(udp_header->length); sum = len + IPPROTO_UDP; - sum = net_help_csum(sum, (uint8_t *)&ipv6_header->srcaddr, 2 * sizeof(ipv6_addr_t)); + sum = net_help_csum(sum, (uint8_t *)&ipv6_legacy_header->srcaddr, 2 * sizeof(ipv6_legacy_addr_t)); sum = net_help_csum(sum, (uint8_t *)udp_header, len); return (sum == 0) ? 0xffff : HTONS(sum); } @@ -76,16 +76,16 @@ void *udp_packet_handler(void *arg) while (1) { msg_receive(&m_recv_ip); - ipv6_hdr_t *ipv6_header = ((ipv6_hdr_t *)m_recv_ip.content.ptr); - udp_hdr_t *udp_header = ((udp_hdr_t *)(m_recv_ip.content.ptr + IPV6_HDR_LEN)); + ipv6_legacy_hdr_t *ipv6_legacy_header = ((ipv6_legacy_hdr_t *)m_recv_ip.content.ptr); + udp_hdr_t *udp_header = ((udp_hdr_t *)(m_recv_ip.content.ptr + IPV6_LEGACY_HDR_LEN)); - uint16_t chksum = ipv6_csum(ipv6_header, (uint8_t*) udp_header, NTOHS(udp_header->length), IPPROTO_UDP); + uint16_t chksum = ipv6_legacy_csum(ipv6_legacy_header, (uint8_t*) udp_header, NTOHS(udp_header->length), IPPROTO_UDP); if (chksum == 0xffff) { udp_socket = get_udp_socket(udp_header); if (udp_socket != NULL) { - m_send_udp.content.ptr = (char *)ipv6_header; + m_send_udp.content.ptr = (char *)ipv6_legacy_header; msg_send_receive(&m_send_udp, &m_recv_udp, udp_socket->recv_pid); } @@ -140,16 +140,16 @@ int32_t udp_recvfrom(int s, void *buf, uint32_t len, int flags, sockaddr6_t *fro (void) flags; msg_t m_recv, m_send; - ipv6_hdr_t *ipv6_header; + ipv6_legacy_hdr_t *ipv6_legacy_header; udp_hdr_t *udp_header; uint8_t *payload; socket_base_get_socket(s)->recv_pid = thread_getpid(); msg_receive(&m_recv); - ipv6_header = ((ipv6_hdr_t *)m_recv.content.ptr); - udp_header = ((udp_hdr_t *)(m_recv.content.ptr + IPV6_HDR_LEN)); - payload = (uint8_t *)(m_recv.content.ptr + IPV6_HDR_LEN + UDP_HDR_LEN); + ipv6_legacy_header = ((ipv6_legacy_hdr_t *)m_recv.content.ptr); + udp_header = ((udp_hdr_t *)(m_recv.content.ptr + IPV6_LEGACY_HDR_LEN)); + payload = (uint8_t *)(m_recv.content.ptr + IPV6_LEGACY_HDR_LEN + UDP_HDR_LEN); memset(buf, 0, len); /* cppcheck: the memset sets parts of the buffer to 0 even though it will @@ -160,7 +160,7 @@ int32_t udp_recvfrom(int s, void *buf, uint32_t len, int flags, sockaddr6_t *fro */ /* cppcheck-suppress redundantCopy */ memcpy(buf, payload, NTOHS(udp_header->length) - UDP_HDR_LEN); - memcpy(&from->sin6_addr, &ipv6_header->srcaddr, 16); + memcpy(&from->sin6_addr, &ipv6_legacy_header->srcaddr, 16); from->sin6_family = AF_INET6; from->sin6_flowinfo = 0; from->sin6_port = udp_header->src_port; @@ -180,12 +180,12 @@ int32_t udp_sendto(int s, const void *buf, uint32_t len, int flags, (socket_base_get_socket(s)->socket_values.foreign_address.sin6_port == 0)) { uint8_t send_buffer[BUFFER_SIZE]; - ipv6_hdr_t *temp_ipv6_header = ((ipv6_hdr_t *)(&send_buffer)); - udp_hdr_t *current_udp_packet = ((udp_hdr_t *)(&send_buffer[IPV6_HDR_LEN])); - uint8_t *payload = &send_buffer[IPV6_HDR_LEN + UDP_HDR_LEN]; + ipv6_legacy_hdr_t *temp_ipv6_legacy_header = ((ipv6_legacy_hdr_t *)(&send_buffer)); + udp_hdr_t *current_udp_packet = ((udp_hdr_t *)(&send_buffer[IPV6_LEGACY_HDR_LEN])); + uint8_t *payload = &send_buffer[IPV6_LEGACY_HDR_LEN + UDP_HDR_LEN]; - memcpy(&(temp_ipv6_header->destaddr), &to->sin6_addr, 16); - ipv6_net_if_get_best_src_addr(&(temp_ipv6_header->srcaddr), &(temp_ipv6_header->destaddr)); + memcpy(&(temp_ipv6_legacy_header->destaddr), &to->sin6_addr, 16); + ipv6_legacy_net_if_get_best_src_addr(&(temp_ipv6_legacy_header->srcaddr), &(temp_ipv6_legacy_header->destaddr)); current_udp_packet->src_port = socket_base_get_free_source_port(IPPROTO_UDP); current_udp_packet->dst_port = to->sin6_port; @@ -193,14 +193,14 @@ int32_t udp_sendto(int s, const void *buf, uint32_t len, int flags, memcpy(payload, buf, len); current_udp_packet->length = HTONS(UDP_HDR_LEN + len); - temp_ipv6_header->length = UDP_HDR_LEN + len; + temp_ipv6_legacy_header->length = UDP_HDR_LEN + len; - current_udp_packet->checksum = ~ipv6_csum(temp_ipv6_header, + current_udp_packet->checksum = ~ipv6_legacy_csum(temp_ipv6_legacy_header, (uint8_t *) current_udp_packet, UDP_HDR_LEN + len, IPPROTO_UDP); - return ipv6_sendto(&to->sin6_addr, IPPROTO_UDP, + return ipv6_legacy_sendto(&to->sin6_addr, IPPROTO_UDP, (uint8_t *)(current_udp_packet), NTOHS(current_udp_packet->length), NULL); } @@ -222,7 +222,7 @@ int udp_init_transport_layer(void) return -1; } - ipv6_register_next_header_handler(IPV6_PROTO_NUM_UDP, udp_thread_pid); + ipv6_legacy_register_next_header_handler(IPV6_LEGACY_PROTO_NUM_UDP, udp_thread_pid); return 0; } diff --git a/sys/net/transport_layer/udp/udp.h b/sys/net/transport_layer/udp/udp.h index 561bc35c080b5..6d21dcdee160d 100644 --- a/sys/net/transport_layer/udp/udp.h +++ b/sys/net/transport_layer/udp/udp.h @@ -18,7 +18,7 @@ #ifndef UDP_H_ #define UDP_H_ -#include "ipv6.h" +#include "ipv6_legacy.h" #include "socket_base/types.h" #ifdef __cplusplus diff --git a/sys/posix/pnet/include/netinet/in.h b/sys/posix/pnet/include/netinet/in.h index 69d552e34b998..2aaebcaef387a 100644 --- a/sys/posix/pnet/include/netinet/in.h +++ b/sys/posix/pnet/include/netinet/in.h @@ -26,7 +26,7 @@ #include #include #include -#include "ipv6.h" +#include "ipv6_legacy.h" #include "socket_base/socket.h" #ifdef __cplusplus @@ -49,7 +49,7 @@ struct in6_addr { /** * Private RIOT-internal data, needs not to be touched by the user. */ - ipv6_addr_t __in6_u; + ipv6_legacy_addr_t __in6_u; /** * IPv6 Address represented as sequence of 8-bit numbers. Member of @@ -145,7 +145,7 @@ extern const struct sockaddr_in6 in6addr_loopback; * The Open Group Base Specification Issue 7, setsockopt * */ -#define IPV6_MULTICAST_HOPS 0x12 +#define IPV6_LEGACY_MULTICAST_HOPS 0x12 /** * Test for IPv6 multicast address. diff --git a/sys/shell/commands/sc_net_if.c b/sys/shell/commands/sc_net_if.c index 2210bdc4339de..e029a5b02d4c1 100644 --- a/sys/shell/commands/sc_net_if.c +++ b/sys/shell/commands/sc_net_if.c @@ -29,18 +29,18 @@ #include "net_if.h" #include "transceiver.h" -#ifndef MODULE_SIXLOWPAN +#ifndef MODULE_SIXLOWPAN_LEGACY #define ADDR_REGISTERED_MAX (6) #define ADDRS_LEN_MAX (16) static uint8_t addr_registered = 0; static uint8_t addrs[ADDR_REGISTERED_MAX][ADDRS_LEN_MAX]; #else -#include "ipv6.h" +#include "ipv6_legacy.h" #endif void _net_if_ifconfig_add(int if_id, int argc, char **argv); -void _net_if_ifconfig_add_ipv6(int if_id, int argc, char **argv); +void _net_if_ifconfig_add_ipv6_legacy(int if_id, int argc, char **argv); void _net_if_ifconfig_set(int if_id, char *key, char *value); void _net_if_ifconfig_set_srcaddrmode(int if_id, char *mode); void _net_if_ifconfig_set_eui64(int if_id, char *addr); @@ -48,7 +48,7 @@ void _net_if_ifconfig_set_hwaddr(int if_id, char *addr); void _net_if_ifconfig_set_pan_id(int if_id, char *pan_id); void _net_if_ifconfig_set_channel(int if_id, char *channel); void _net_if_ifconfig_create(char *transceivers_str); -int _net_if_ifconfig_ipv6_addr_convert(net_if_addr_t *addr, void *addr_data, +int _net_if_ifconfig_ipv6_legacy_addr_convert(net_if_addr_t *addr, void *addr_data, char *type, char *addr_data_str, char *addr_data_len); void _net_if_ifconfig_list(int if_id); @@ -96,7 +96,7 @@ char *addr_data_to_str(char *addr_str, const uint8_t *addr, uint8_t addr_len) void add_usage(void) { - puts("Usage: ifconfig add ipv6 [multicast|anycast] "); + puts("Usage: ifconfig add ipv6_legacy [multicast|anycast] "); } void set_usage(void) @@ -316,7 +316,7 @@ void _net_if_ifconfig_set(int if_id, char *key, char *value) } } -void _net_if_ifconfig_add_ipv6(int if_id, int argc, char **argv) +void _net_if_ifconfig_add_ipv6_legacy(int if_id, int argc, char **argv) { char *type; char *addr_str; @@ -339,9 +339,9 @@ void _net_if_ifconfig_add_ipv6(int if_id, int argc, char **argv) type = NULL; } -#ifdef MODULE_SIXLOWPAN - ipv6_addr_t ipv6_addr; - void *addr_data = &ipv6_addr; +#ifdef MODULE_SIXLOWPAN_LEGACY + ipv6_legacy_addr_t ipv6_legacy_addr; + void *addr_data = &ipv6_legacy_addr; #else void *addr_data = (void *)&addrs[addr_registered][0]; #endif @@ -349,16 +349,16 @@ void _net_if_ifconfig_add_ipv6(int if_id, int argc, char **argv) addr_data_str = strtok(addr_str, "/"); addr_data_len = strtok(NULL, "/"); - if (!_net_if_ifconfig_ipv6_addr_convert(&addr, addr_data, type, + if (!_net_if_ifconfig_ipv6_legacy_addr_convert(&addr, addr_data, type, addr_data_str, addr_data_len)) { add_usage(); return; } -#ifdef MODULE_SIXLOWPAN +#ifdef MODULE_SIXLOWPAN_LEGACY - if (addr.addr_protocol & NET_IF_L3P_IPV6_PREFIX) { - if (ndp_add_prefix_info(if_id, &ipv6_addr, addr.addr_len, + if (addr.addr_protocol & NET_IF_L3P_IPV6_LEGACY_PREFIX) { + if (ndp_add_prefix_info(if_id, &ipv6_legacy_addr, addr.addr_len, NDP_OPT_PI_VLIFETIME_INFINITE, NDP_OPT_PI_PLIFETIME_INFINITE, 1, ICMPV6_NDP_OPT_PI_FLAG_AUTONOM) != SIXLOWERROR_SUCCESS) { @@ -366,14 +366,14 @@ void _net_if_ifconfig_add_ipv6(int if_id, int argc, char **argv) return; } } - else if (addr.addr_protocol & NET_IF_L3P_IPV6_ADDR) { + else if (addr.addr_protocol & NET_IF_L3P_IPV6_LEGACY_ADDR) { uint8_t is_anycast = 0; - if (addr.addr_protocol & NET_IF_L3P_IPV6_ANYCAST) { + if (addr.addr_protocol & NET_IF_L3P_IPV6_LEGACY_ANYCAST) { is_anycast = 1; } - if (!ipv6_net_if_add_addr(if_id, &ipv6_addr, NDP_ADDR_STATE_PREFERRED, + if (!ipv6_legacy_net_if_add_addr(if_id, &ipv6_legacy_addr, NDP_ADDR_STATE_PREFERRED, 0, 0, is_anycast)) { add_usage(); return; @@ -397,8 +397,8 @@ void _net_if_ifconfig_add_ipv6(int if_id, int argc, char **argv) void _net_if_ifconfig_add(int if_id, int argc, char **argv) { - if (strcmp(argv[3], "ipv6") == 0) { - _net_if_ifconfig_add_ipv6(if_id, argc, argv); + if (strcmp(argv[3], "ipv6_legacy") == 0) { + _net_if_ifconfig_add_ipv6_legacy(if_id, argc, argv); } else { add_usage(); @@ -457,8 +457,8 @@ void _net_if_ifconfig_create(char *transceivers_str) static inline int _is_multicast(uint8_t *addr) { -#ifdef MODULE_SIXLOWPAN - return ipv6_addr_is_multicast((ipv6_addr_t *) addr); +#ifdef MODULE_SIXLOWPAN_LEGACY + return ipv6_legacy_addr_is_multicast((ipv6_legacy_addr_t *) addr); #else return *addr == 0xff; #endif @@ -466,8 +466,8 @@ static inline int _is_multicast(uint8_t *addr) static inline int _is_link_local(uint8_t *addr) { -#ifdef MODULE_SIXLOWPAN - return ipv6_addr_is_link_local((ipv6_addr_t *) addr); +#ifdef MODULE_SIXLOWPAN_LEGACY + return ipv6_legacy_addr_is_link_local((ipv6_legacy_addr_t *) addr); #else return (addr[0] == 0xfe && addr[1] == 0x80) || (_is_multicast(addr) && (addr[1] & 0x0f) == 2); @@ -479,28 +479,28 @@ int _set_protocol_from_type(char *type, net_if_addr_t *addr) if (type != NULL) { if ((strcmp(type, "multicast") == 0) && _is_multicast((uint8_t *)addr->addr_data)) { - addr->addr_protocol |= NET_IF_L3P_IPV6_MULTICAST; + addr->addr_protocol |= NET_IF_L3P_IPV6_LEGACY_MULTICAST; return 1; } else if ((strcmp(type, "anycast") == 0) && - addr->addr_protocol & NET_IF_L3P_IPV6_PREFIX) { - addr->addr_protocol |= NET_IF_L3P_IPV6_ANYCAST; + addr->addr_protocol & NET_IF_L3P_IPV6_LEGACY_PREFIX) { + addr->addr_protocol |= NET_IF_L3P_IPV6_LEGACY_ANYCAST; return 1; } return 0; } else if (_is_multicast((uint8_t *)addr->addr_data)) { - addr->addr_protocol |= NET_IF_L3P_IPV6_MULTICAST; + addr->addr_protocol |= NET_IF_L3P_IPV6_LEGACY_MULTICAST; return 1; } else { - addr->addr_protocol |= NET_IF_L3P_IPV6_UNICAST; + addr->addr_protocol |= NET_IF_L3P_IPV6_LEGACY_UNICAST; return 1; } } -int _net_if_ifconfig_ipv6_addr_convert(net_if_addr_t *addr, void *addr_data, +int _net_if_ifconfig_ipv6_legacy_addr_convert(net_if_addr_t *addr, void *addr_data, char *type, char *addr_data_str, char *addr_data_len) { @@ -524,7 +524,7 @@ int _net_if_ifconfig_ipv6_addr_convert(net_if_addr_t *addr, void *addr_data, } else { addr->addr_len = atoi(addr_data_len); - addr->addr_protocol = NET_IF_L3P_IPV6_PREFIX; + addr->addr_protocol = NET_IF_L3P_IPV6_LEGACY_PREFIX; if (addr->addr_len > 128 || !_set_protocol_from_type(type, addr)) { return 0; @@ -627,13 +627,13 @@ void _net_if_ifconfig_list(int if_id) puts("\n"); } -#ifdef MODULE_SIXLOWPAN - if (addr_ptr->addr_protocol & NET_IF_L3P_IPV6) { - char addr_str[IPV6_MAX_ADDR_STR_LEN]; +#ifdef MODULE_SIXLOWPAN_LEGACY + if (addr_ptr->addr_protocol & NET_IF_L3P_IPV6_LEGACY) { + char addr_str[IPV6_LEGACY_MAX_ADDR_STR_LEN]; printf(" inet6 addr: "); if (inet_ntop(AF_INET6, addr_ptr->addr_data, addr_str, - IPV6_MAX_ADDR_STR_LEN)) { + IPV6_LEGACY_MAX_ADDR_STR_LEN)) { printf("%s/%d", addr_str, addr_ptr->addr_len); printf(" scope: "); @@ -644,13 +644,13 @@ void _net_if_ifconfig_list(int if_id) printf("global"); } - if (!(addr_ptr->addr_protocol & NET_IF_L3P_IPV6_UNICAST)) { + if (!(addr_ptr->addr_protocol & NET_IF_L3P_IPV6_LEGACY_UNICAST)) { printf(" "); - if (addr_ptr->addr_protocol & NET_IF_L3P_IPV6_MULTICAST) { + if (addr_ptr->addr_protocol & NET_IF_L3P_IPV6_LEGACY_MULTICAST) { printf("[multicast]"); } - else if (addr_ptr->addr_protocol & NET_IF_L3P_IPV6_ANYCAST) { + else if (addr_ptr->addr_protocol & NET_IF_L3P_IPV6_LEGACY_ANYCAST) { printf("[anycast]"); } } diff --git a/sys/shell/commands/sc_rpl.c b/sys/shell/commands/sc_rpl.c index b5a282dd3e8f2..3fe879a3571e7 100644 --- a/sys/shell/commands/sc_rpl.c +++ b/sys/shell/commands/sc_rpl.c @@ -20,7 +20,7 @@ #include "rpl.h" -static char addr_str[IPV6_MAX_ADDR_STR_LEN]; +static char addr_str[IPV6_LEGACY_MAX_ADDR_STR_LEN]; void _rpl_route_handler(int argc, char **argv) { @@ -38,9 +38,9 @@ void _rpl_route_handler(int argc, char **argv) for (int i = 0; i < rpl_max_routing_entries; i++) { if (rtable[i].used) { c++; - printf(" %03d: %-18s ", i, ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, + printf(" %03d: %-18s ", i, ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, (&rtable[i].address))); - printf("%-18s ", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, + printf("%-18s ", ipv6_legacy_addr_to_str(addr_str, IPV6_LEGACY_MAX_ADDR_STR_LEN, (&rtable[i].next_hop))); printf("%d\n", rtable[i].lifetime); diff --git a/tests/net_if/main.c b/tests/net_if/main.c index 3d07a0f3abfaf..666dcf467c043 100644 --- a/tests/net_if/main.c +++ b/tests/net_if/main.c @@ -33,14 +33,14 @@ int main(void) net_if_addr_t addr1 = { .addr_next = NULL, .addr_prev = NULL, - .addr_protocol = NET_IF_L3P_IPV6_MULTICAST, + .addr_protocol = NET_IF_L3P_IPV6_LEGACY_MULTICAST, .addr_data = (void *)addr1_data, .addr_len = (strlen(addr1_data) + 1) * 8 }; net_if_addr_t addr2 = { .addr_next = NULL, .addr_prev = NULL, - .addr_protocol = NET_IF_L3P_IPV6_PREFIX, + .addr_protocol = NET_IF_L3P_IPV6_LEGACY_PREFIX, .addr_data = (void *)addr2_data, .addr_len = (strlen(addr2_data) + 1) * 8 }; @@ -138,7 +138,7 @@ int test_net_if_initialization(int iface) int test_net_if_get_add_l3p_types(int iface) { - if (net_if_add_l3p_types(iface + 1, NET_IF_L3P_IPV6_UNICAST)) { + if (net_if_add_l3p_types(iface + 1, NET_IF_L3P_IPV6_LEGACY_UNICAST)) { printf("FAILED: expected net_if_add_l3p_types to fail for iface %d.\n", iface + 1); return 0; @@ -151,24 +151,24 @@ int test_net_if_get_add_l3p_types(int iface) } - if (!net_if_add_l3p_types(iface, NET_IF_L3P_IPV6_UNICAST)) { + if (!net_if_add_l3p_types(iface, NET_IF_L3P_IPV6_LEGACY_UNICAST)) { printf("FAILED: expected net_if_add_l3p_types to succeed for iface %d and no type\n", iface); return 0; } - if (!(net_if_get_l3p_types(iface) & NET_IF_L3P_IPV6_UNICAST)) { + if (!(net_if_get_l3p_types(iface) & NET_IF_L3P_IPV6_LEGACY_UNICAST)) { printf("FAILED: L3 type IPv6 unicast expected on interface %d.\n", iface); return 0; } - if (net_if_get_l3p_types(iface) & ~NET_IF_L3P_IPV6_UNICAST) { + if (net_if_get_l3p_types(iface) & ~NET_IF_L3P_IPV6_LEGACY_UNICAST) { printf("FAILED: L3 type other than IPv6 unicast not expected on interface %d.\n", iface); return 0; } - if (net_if_del_l3p_types(iface + 1, NET_IF_L3P_IPV6_UNICAST)) { + if (net_if_del_l3p_types(iface + 1, NET_IF_L3P_IPV6_LEGACY_UNICAST)) { printf("FAILED: expected net_if_del_l3p_types to fail for iface %d.\n", iface + 1); return 0; @@ -180,7 +180,7 @@ int test_net_if_get_add_l3p_types(int iface) return 0; } - if (!net_if_del_l3p_types(iface, NET_IF_L3P_IPV6_UNICAST)) { + if (!net_if_del_l3p_types(iface, NET_IF_L3P_IPV6_LEGACY_UNICAST)) { printf("FAILED: expected net_if_del_l3p_types to succeed for iface %d and no type\n", iface); return 0; @@ -217,12 +217,12 @@ int test_net_if_add_address(int iface, net_if_addr_t *addr1, return 0; } - if (!(net_if_get_l3p_types(iface) & NET_IF_L3P_IPV6_MULTICAST)) { + if (!(net_if_get_l3p_types(iface) & NET_IF_L3P_IPV6_LEGACY_MULTICAST)) { printf("FAILED: L3 type IPv6 multicast expected on interface %d.\n", iface); return 0; } - if (net_if_get_l3p_types(iface) & ~NET_IF_L3P_IPV6_MULTICAST) { + if (net_if_get_l3p_types(iface) & ~NET_IF_L3P_IPV6_LEGACY_MULTICAST) { printf("FAILED: L3 type other than IPv6 multicast not expected on interface %d.\n", iface); return 0; @@ -233,17 +233,17 @@ int test_net_if_add_address(int iface, net_if_addr_t *addr1, return 0; } - if (!(net_if_get_l3p_types(iface) & NET_IF_L3P_IPV6_MULTICAST)) { + if (!(net_if_get_l3p_types(iface) & NET_IF_L3P_IPV6_LEGACY_MULTICAST)) { printf("FAILED: L3 type IPv6 multcast expected on interface %d.\n", iface); return 0; } - if (!(net_if_get_l3p_types(iface) & NET_IF_L3P_IPV6_PREFIX)) { + if (!(net_if_get_l3p_types(iface) & NET_IF_L3P_IPV6_LEGACY_PREFIX)) { printf("FAILED: L3 type IPv6 prefix expected on interface %d.\n", iface); return 0; } - if (net_if_get_l3p_types(iface) & ~(NET_IF_L3P_IPV6_MULTICAST | NET_IF_L3P_IPV6_PREFIX)) { + if (net_if_get_l3p_types(iface) & ~(NET_IF_L3P_IPV6_LEGACY_MULTICAST | NET_IF_L3P_IPV6_LEGACY_PREFIX)) { printf("FAILED: L3 type other than IPv6 multicast and IPv6 prefix not expected on interface %d.\n", iface); return 0; diff --git a/tests/netdev/main.c b/tests/netdev/main.c index 3d1b4758f7120..d790e85162cc2 100644 --- a/tests/netdev/main.c +++ b/tests/netdev/main.c @@ -628,7 +628,7 @@ static int check_protocol(void) puts("Got protocol: 6LoWPAN"); return 1; - case NETDEV_PROTO_IPV6: + case NETDEV_PROTO_IPV6_LEGACY: puts("Got protocol: IPv6"); return 1; diff --git a/tests/pnet/main.c b/tests/pnet/main.c index c5b6500feeee9..0505193c501cc 100644 --- a/tests/pnet/main.c +++ b/tests/pnet/main.c @@ -28,8 +28,8 @@ #include #include "net_if.h" -#include "sixlowpan.h" -#include "ipv6.h" +#include "sixlowpan_legacy.h" +#include "ipv6_legacy.h" #ifndef R_ADDR #define R_ADDR (1) @@ -41,12 +41,12 @@ int init_local_address(uint16_t r_addr) { - ipv6_addr_t std_addr; - ipv6_addr_init(&std_addr, 0xabcd, 0xef12, 0, 0, 0x1034, 0x00ff, 0xfe00, + ipv6_legacy_addr_t std_addr; + ipv6_legacy_addr_init(&std_addr, 0xabcd, 0xef12, 0, 0, 0x1034, 0x00ff, 0xfe00, 0); net_if_set_src_address_mode(0, NET_IF_TRANS_ADDR_M_SHORT); return net_if_set_hardware_address(0, r_addr) && - sixlowpan_lowpan_init_adhoc_interface(0, &std_addr); + sixlowpan_legacy_lowpan_init_adhoc_interface(0, &std_addr); } int main(void)