mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
send router solicitation method inserted
This commit is contained in:
parent
53a5560bb8
commit
e118393cc2
6
sys/net/sixlowpan/sixlowip.c
Normal file
6
sys/net/sixlowpan/sixlowip.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include "sixlowpan.h"
|
||||
#include <stdio.h>
|
||||
|
||||
void create_all_routers_multicast_addr(void){
|
||||
|
||||
}
|
23
sys/net/sixlowpan/sixlowip.h
Normal file
23
sys/net/sixlowpan/sixlowip.h
Normal file
@ -0,0 +1,23 @@
|
||||
/* 6LoWPAN IP header file */
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define IPV6_VERSION 0x60
|
||||
#define ICMP_NEXTHEADER 0x3A
|
||||
#define NEIGHBOR_DISCOVERY_HOPLIMIT 255
|
||||
|
||||
|
||||
typedef struct icmp_hdr{
|
||||
uint8_t type;
|
||||
uint8_t code;
|
||||
uint16_t checksum;
|
||||
} icmp_hdr;
|
||||
|
||||
typedef struct ip_hdr{
|
||||
uint8_t version_trafficclass;
|
||||
uint8_t trafficclass_flowlabel;
|
||||
uint16_t flowlabel;
|
||||
uint16_t length;
|
||||
uint8_t nextheader;
|
||||
uint8_t hoplimit;
|
||||
} ip_hdr;
|
28
sys/net/sixlowpan/sixlownd.c
Normal file
28
sys/net/sixlowpan/sixlownd.c
Normal file
@ -0,0 +1,28 @@
|
||||
/* 6LoWPAN/IPv6 Neighbor Discovery implementation*/
|
||||
|
||||
#include "sixlowip.h"
|
||||
#include <stdio.h>
|
||||
|
||||
/* send router solicitation message - RFC4861 section 4.1 */
|
||||
void send_rs(icmp_hdr *icmphdr, ip_hdr *iphdr){
|
||||
create_all_routers_multicast_addr();
|
||||
|
||||
icmphdr->type = ICMP_ROUTER_SOLICITATION;
|
||||
icmphdr->code = 0;
|
||||
icmphdr->checksum = calc_icmpv6_checksum();
|
||||
|
||||
iphdr->version_trafficclass = IPV6_VERSION;
|
||||
iphdr->trafficclass_flowlabel = 0;
|
||||
iphdr->flowlabel = 0;
|
||||
iphdr->nextheader = ICMP_NEXTHEADER;
|
||||
iphdr->hoplimit = NEIGHBOR_DISCOVERY_HOPLIMIT;
|
||||
|
||||
}
|
||||
|
||||
void recv_rs(void){
|
||||
|
||||
}
|
||||
|
||||
void calc_icmpv6_checksum(void){
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user