2013-06-22 05:11:53 +02:00
|
|
|
/**
|
|
|
|
* IPv6 constants, data structs, and prototypes
|
|
|
|
*
|
|
|
|
* Copyright (C) 2013 INRIA.
|
|
|
|
*
|
|
|
|
* This file subject to the terms and conditions of the GNU Lesser General
|
|
|
|
* Public License. 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>
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2010-10-12 21:42:03 +02:00
|
|
|
/* 6LoWPAN IP header file */
|
|
|
|
|
2013-08-05 16:10:54 +02:00
|
|
|
#ifndef _SIXLOWPAN_IP_H
|
|
|
|
#define _SIXLOWPAN_IP_H
|
2010-10-17 16:03:48 +02:00
|
|
|
|
2010-10-12 21:42:03 +02:00
|
|
|
#include <stdint.h>
|
2013-08-08 13:39:00 +02:00
|
|
|
|
|
|
|
#include "timex.h"
|
|
|
|
#include "mutex.h"
|
2010-10-12 21:42:03 +02:00
|
|
|
|
2013-08-13 06:41:05 +02:00
|
|
|
#include "sixlowpan/ip.h"
|
2013-08-08 16:22:37 +02:00
|
|
|
#include "sixlowpan/types.h"
|
|
|
|
|
2013-06-22 05:11:53 +02:00
|
|
|
/* IPv6 field values */
|
2013-08-13 06:41:05 +02:00
|
|
|
#define IPV6_VER (0x60)
|
2010-10-17 16:03:48 +02:00
|
|
|
/* size of global buffer */
|
2013-08-13 06:41:05 +02:00
|
|
|
#define BUFFER_SIZE (LL_HDR_LEN + IPV6_MTU)
|
2010-10-19 23:06:47 +02:00
|
|
|
|
2013-08-13 06:41:05 +02:00
|
|
|
#define MULTIHOP_HOPLIMIT (64)
|
2013-07-27 15:04:51 +02:00
|
|
|
|
|
|
|
#define SIXLOWIP_MAX_REGISTERED (4)
|
|
|
|
|
2011-01-07 23:38:42 +01:00
|
|
|
/* extern variables */
|
2010-10-17 16:03:48 +02:00
|
|
|
extern uint8_t ipv6_ext_hdr_len;
|
2011-02-22 13:19:16 +01:00
|
|
|
|
2010-11-09 22:20:26 +01:00
|
|
|
/* base header lengths */
|
2013-08-13 06:41:05 +02:00
|
|
|
#define LL_HDR_LEN (0x4)
|
|
|
|
#define ICMPV6_HDR_LEN (0x4)
|
|
|
|
#define IPV6_HDR_LEN (0x28)
|
|
|
|
|
|
|
|
#define IFACE_ADDR_LIST_LEN (10) // maybe to much
|
2011-01-18 11:02:48 +01:00
|
|
|
|
2010-11-30 10:21:29 +01:00
|
|
|
/* buffer */
|
2011-06-24 02:31:55 +02:00
|
|
|
extern uint8_t buffer[BUFFER_SIZE];
|
2010-11-30 10:21:29 +01:00
|
|
|
|
2013-07-27 15:04:51 +02:00
|
|
|
extern int sixlowip_reg[SIXLOWIP_MAX_REGISTERED];
|
2010-11-30 10:21:29 +01:00
|
|
|
|
2013-06-22 05:11:53 +02:00
|
|
|
typedef struct __attribute__((packed)) {
|
2013-08-13 06:41:05 +02:00
|
|
|
ipv6_addr_t addr;
|
|
|
|
ipv6_addr_type_t type;
|
|
|
|
ndp_addr_state_t state;
|
2012-01-11 17:02:43 +01:00
|
|
|
timex_t val_ltime;
|
|
|
|
timex_t pref_ltime;
|
2011-01-18 11:02:48 +01:00
|
|
|
} addr_list_t;
|
|
|
|
|
2013-06-22 05:11:53 +02:00
|
|
|
typedef struct __attribute__((packed)) {
|
2011-01-07 23:38:42 +01:00
|
|
|
ieee_802154_short_t saddr;
|
|
|
|
ieee_802154_long_t laddr;
|
2011-01-18 11:02:48 +01:00
|
|
|
addr_list_t addr_list[IFACE_ADDR_LIST_LEN];
|
|
|
|
uint8_t adv_cur_hop_limit;
|
|
|
|
uint32_t adv_reachable_time;
|
|
|
|
uint32_t adv_retrans_timer;
|
2011-01-07 23:38:42 +01:00
|
|
|
} iface_t;
|
|
|
|
|
|
|
|
extern iface_t iface;
|
|
|
|
|
2010-11-09 22:20:26 +01:00
|
|
|
/* function prototypes */
|
2013-08-13 06:41:05 +02:00
|
|
|
void ipv6_send_bytes(ipv6_hdr_t *bytes);
|
|
|
|
icmpv6_hdr_t *get_icmpv6_buf(uint8_t ext_len);
|
2013-06-22 05:11:53 +02:00
|
|
|
uint8_t *get_payload_buf(uint8_t ext_len);
|
|
|
|
uint8_t *get_payload_buf_send(uint8_t ext_len);
|
2010-11-22 12:52:56 +01:00
|
|
|
|
2013-08-13 06:41:05 +02:00
|
|
|
int icmpv6_demultiplex(const icmpv6_hdr_t *hdr);
|
2011-06-22 12:34:32 +02:00
|
|
|
void ipv6_init_iface_as_router(void);
|
2011-01-24 22:41:32 +01:00
|
|
|
void ipv6_process(void);
|
2013-06-22 05:11:53 +02:00
|
|
|
addr_list_t *ipv6_iface_addr_prefix_eq(ipv6_addr_t *addr);
|
2013-08-13 06:41:05 +02:00
|
|
|
addr_list_t *ipv6_iface_addr_match(const ipv6_addr_t *addr);
|
2012-01-11 17:02:43 +01:00
|
|
|
uint32_t get_remaining_time(timex_t *t);
|
|
|
|
void set_remaining_time(timex_t *t, uint32_t time);
|
2013-08-13 06:41:05 +02:00
|
|
|
|
2013-08-05 16:10:54 +02:00
|
|
|
#endif /* _SIXLOWPAN_IP_H*/
|