mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
b918924fc1
* flow control outsourced to flowcontrol.*
84 lines
2.2 KiB
C
84 lines
2.2 KiB
C
/* 6LoWPAN Border Router header file */
|
|
|
|
#ifndef SIXLOWBORDER_H
|
|
#define SIXLOWBORDER_H
|
|
|
|
#include <stdint.h>
|
|
#include <mutex.h>
|
|
#include "sixlowip.h"
|
|
#include "sixlowpan.h"
|
|
#include "sixlownd.h"
|
|
#include "semaphore.h"
|
|
|
|
/* packet types of uart-packets */
|
|
#define BORDER_PACKET_RAW_TYPE 0
|
|
#define BORDER_PACKET_CONF_TYPE 2
|
|
#define BORDER_PACKET_L3_TYPE 3
|
|
|
|
/* configuration types */
|
|
#define BORDER_CONF_CONTEXT 2
|
|
#define BORDER_CONF_IPADDR 3
|
|
|
|
/* ethertypes for L3 packets */
|
|
#define BORDER_ETHERTYPE_IPV6 0x86DD
|
|
|
|
typedef struct __attribute__ ((packed)) border_packet_t {
|
|
uint8_t reserved;
|
|
uint8_t type;
|
|
uint8_t seq_num;
|
|
} border_packet_t;
|
|
|
|
typedef struct __attribute__ ((packed)) border_l3_header_t {
|
|
uint8_t reserved;
|
|
uint8_t type;
|
|
uint8_t seq_num;
|
|
uint16_t ethertype;
|
|
} border_l3_header_t;
|
|
|
|
typedef struct __attribute__ ((packed)) border_conf_header_t {
|
|
uint8_t reserved;
|
|
uint8_t type;
|
|
uint8_t seq_num;
|
|
uint8_t conftype;
|
|
} border_conf_header_t;
|
|
|
|
typedef struct __attribute__ ((packed)) border_addr_packet_t {
|
|
uint8_t reserved;
|
|
uint8_t type;
|
|
uint8_t seq_num;
|
|
uint8_t conftype;
|
|
ipv6_addr_t addr;
|
|
} border_addr_packet_t;
|
|
|
|
typedef struct __attribute__ ((packed)) border_context_packet_t {
|
|
uint8_t reserved;
|
|
uint8_t type;
|
|
uint8_t seq_num;
|
|
uint8_t conftype;
|
|
struct border_context_t {
|
|
uint8_t cid;
|
|
ipv6_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) + MTU)
|
|
|
|
uint16_t border_get_serial_reader();
|
|
uint8_t *get_serial_out_buffer(int offset);
|
|
uint8_t *get_serial_in_buffer(int offset);
|
|
|
|
uint8_t border_initialize(transceiver_type_t trans,ipv6_addr_t *border_router_addr);
|
|
void demultiplex(border_packet_t *packet, int len);
|
|
void multiplex_send_ipv6_over_uart(struct ipv6_hdr_t *packet);
|
|
void multiplex_send_addr_over_uart(ipv6_addr_t *addr);
|
|
void border_send_ipv6_over_lowpan(struct ipv6_hdr_t *packet, uint8_t aro_flag, uint8_t sixco_flag);
|
|
void border_process_lowpan(void);
|
|
|
|
int readpacket(uint8_t *packet_buf, int size);
|
|
int writepacket(uint8_t *packet_buf, size_t size);
|
|
|
|
#endif /* SIXLOWBORDER_H*/
|