From e118393cc23cc401ae4a0c7e33ac5c7995114c25 Mon Sep 17 00:00:00 2001 From: Stephan Zeisberg Date: Tue, 12 Oct 2010 21:42:03 +0200 Subject: [PATCH] send router solicitation method inserted --- sys/net/sixlowpan/sixlowip.c | 6 ++++++ sys/net/sixlowpan/sixlowip.h | 23 +++++++++++++++++++++++ sys/net/sixlowpan/sixlownd.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 sys/net/sixlowpan/sixlowip.c create mode 100644 sys/net/sixlowpan/sixlowip.h create mode 100644 sys/net/sixlowpan/sixlownd.c diff --git a/sys/net/sixlowpan/sixlowip.c b/sys/net/sixlowpan/sixlowip.c new file mode 100644 index 0000000000..7084d67ae3 --- /dev/null +++ b/sys/net/sixlowpan/sixlowip.c @@ -0,0 +1,6 @@ +#include "sixlowpan.h" +#include + +void create_all_routers_multicast_addr(void){ + +} diff --git a/sys/net/sixlowpan/sixlowip.h b/sys/net/sixlowpan/sixlowip.h new file mode 100644 index 0000000000..63cff9e235 --- /dev/null +++ b/sys/net/sixlowpan/sixlowip.h @@ -0,0 +1,23 @@ +/* 6LoWPAN IP header file */ + +#include + +#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; diff --git a/sys/net/sixlowpan/sixlownd.c b/sys/net/sixlowpan/sixlownd.c new file mode 100644 index 0000000000..6056cfa5cc --- /dev/null +++ b/sys/net/sixlowpan/sixlownd.c @@ -0,0 +1,28 @@ +/* 6LoWPAN/IPv6 Neighbor Discovery implementation*/ + +#include "sixlowip.h" +#include + +/* 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){ + +}