1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/sys/net/network_layer/sixlowpan/ip.h
Fabian Brandt 12cd62c689 Introduction of RPL non-storing mode.
This implementation is based on RFC 6550 with addition of RFC 6554 (Source Routing Header for RPL). Both can be found under the following links:
- http://tools.ietf.org/html/rfc6550
- http://tools.ietf.org/html/rfc6554

The PR provides basic functionality for handling and forwarding packages in non-storing mode. In addition the structure of the previous implemented RPL storing mode is now revised, so that readability and modularity is increased. The following features are implemented:
- building function for a SRH and integration in common packets
- source-route build algorithm based on the structure of the DODAG
- an RPL-based interpretation of the SRH and removal at destination
- new structure for RPl-module with extracted beaconing-functionality
- leaf nodes are now supported

There are some missed goals and should be included in future updates:
- building a common routing table structure for different types of routing protocols
- routing tables are statically assigned via source code, future update should have an optional variable at build-time, which sets the size of the routing table depending on the desired functionality of a node in the network (root, node, leaf)
2014-11-27 21:42:40 +01:00

121 lines
2.9 KiB
C

/*
* IPv6 constants, data structs, and prototypes
*
* Copyright (C) 2013 INRIA.
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*
* @ingroup sixlowpan
* @{
* @file sixlowip.h
* @brief 6lowpan IP layer header
* @author Stephan Zeisberg <zeisberg@mi.fu-berlin.de>
* @author Martin Lenders <mlenders@inf.fu-berlin.de>
* @author Eric Engel <eric.engel@fu-berlin.de>
* @author Oliver Gesch <oliver.gesch@googlemail.com>
* @}
*/
/* 6LoWPAN IP header file */
#ifndef _SIXLOWPAN_IP_H
#define _SIXLOWPAN_IP_H
#include <stdint.h>
#include "kernel.h"
#include "timex.h"
#include "mutex.h"
#include "net_if.h"
#include "sixlowpan/ip.h"
#include "sixlowpan/types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* IPv6 field values */
#define IPV6_VER (0x60)
/* size of global buffer */
#define BUFFER_SIZE (LL_HDR_LEN + IPV6_MTU)
#define MULTIHOP_HOPLIMIT (64)
#define SIXLOWIP_MAX_REGISTERED (4)
#define IP_PROCESS_STACKSIZE (KERNEL_CONF_STACKSIZE_MAIN)
/* extern variables */
extern uint8_t ipv6_ext_hdr_len;
extern kernel_pid_t ip_process_pid;
#ifdef MODULE_RPL
extern int srh_handler_pid;
#endif
/* base header lengths */
#define LL_HDR_LEN (0x4)
#define ICMPV6_HDR_LEN (0x4)
#define IPV6_HDR_LEN (0x28)
#define IPV6_NET_IF_ADDR_LIST_LEN (10) // maybe to much
/* buffer */
extern uint8_t buffer[BUFFER_SIZE];
extern char ip_process_buf[IP_PROCESS_STACKSIZE];
extern kernel_pid_t sixlowip_reg[SIXLOWIP_MAX_REGISTERED];
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;
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;
typedef struct __attribute__((packed))
{
ipv6_net_if_addr_t *addr;
int if_id;
}
ipv6_net_if_hit_t;
typedef struct __attribute__((packed))
{
uint8_t prefix; ///< prefix length of the sub-net
uint8_t adv_cur_hop_limit;
uint32_t adv_reachable_time;
uint32_t adv_retrans_timer;
}
ipv6_net_if_ext_t;
/* function prototypes */
ipv6_net_if_ext_t *ipv6_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);
uint32_t get_remaining_time(timex_t *t);
void set_remaining_time(timex_t *t, uint32_t time);
#ifdef __cplusplus
}
#endif
#endif /* _SIXLOWPAN_IP_H*/