43 #include <avr/pgmspace.h>
47 #include "dev/rs232.h"
54 #include "dev/ds2401.h"
55 #include "sys/node-id.h"
64 #include "net/uip-fw-drv.h"
69 {
UIP_FW_NETIF(172,16,0,0, 255,255,0,0, uip_over_mesh_send)};
71 static uint8_t is_gateway;
75 #define UIP_OVER_MESH_CHANNEL 8
84 memset(&addr, 0,
sizeof(linkaddr_t));
86 memcpy(addr.u8, ds2401_id,
sizeof(addr.u8));
89 for(i = 0; i <
sizeof(linkaddr_t); ++i) {
90 addr.u8[i] = ds2401_id[7 - i];
93 addr.u8[0] = node_id & 0xff;
94 addr.u8[1] = node_id >> 8;
98 printf_P(PSTR(
"Rime started with address "));
99 for(i = 0; i <
sizeof(addr.u8) - 1; i++) {
100 printf_P(PSTR(
"%d."), addr.u8[i]);
102 printf_P(PSTR(
"%d\n"), addr.u8[i]);
112 printf_P(PSTR(
"%d.%d: making myself the IP network gateway.\n\n"),
114 printf_P(PSTR(
"IPv4 address of the gateway: %d.%d.%d.%d\n\n"),
117 uip_over_mesh_make_announced_gateway();
135 memset(longaddr, 0,
sizeof(longaddr));
137 printf_P(PSTR(
"MAC %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n"),
138 longaddr[0], longaddr[1], longaddr[2], longaddr[3],
139 longaddr[4], longaddr[5], longaddr[6], longaddr[7]);
141 cc2420_set_pan_addr(IEEE802154_PANID, shortaddr, longaddr);
154 NETSTACK_NETWORK.init();
156 printf_P(PSTR(
"%s %s, channel check rate %d Hz, radio channel %d\n"),
157 NETSTACK_MAC.name, NETSTACK_RDC.name,
158 CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1:
159 NETSTACK_RDC.channel_check_interval()),
160 CC2420_CONF_CHANNEL);
164 printf_P(PSTR(
"Tentative link-local IPv6 address "));
168 lladdr = uip_ds6_get_link_local(-1);
169 for(i = 0; i < 7; ++i) {
170 printf_P(PSTR(
"%02x%02x:"), lladdr->ipaddr.u8[i * 2],
171 lladdr->ipaddr.u8[i * 2 + 1]);
173 printf_P(PSTR(
"%02x%02x\n"), lladdr->ipaddr.u8[14], lladdr->ipaddr.u8[15]);
176 if(!UIP_CONF_IPV6_RPL) {
182 printf_P(PSTR(
"Tentative global IPv6 address "));
183 for(i = 0; i < 7; ++i) {
184 printf_P(PSTR(
"%02x%02x:"),
185 ipaddr.u8[i * 2], ipaddr.u8[i * 2 + 1]);
187 printf_P(PSTR(
"%02x%02x\n"),
188 ipaddr.u8[7 * 2], ipaddr.u8[7 * 2 + 1]);
195 NETSTACK_NETWORK.init();
197 printf_P(PSTR(
"%s %s, channel check rate %d Hz, radio channel %d\n"),
198 NETSTACK_MAC.name, NETSTACK_RDC.name,
199 CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0? 1:
200 NETSTACK_RDC.channel_check_interval()),
201 CC2420_CONF_CHANNEL);
206 uip_ipaddr_t hostaddr,
netmask;
215 slip_set_input_callback(set_gateway);
229 uip_over_mesh_set_net(&hostaddr, &netmask);
233 uip_over_mesh_set_gateway_netif(&slipif);
236 uip_over_mesh_init(UIP_OVER_MESH_CHANNEL);
237 printf_P(PSTR(
"uIP started with IP address %d.%d.%d.%d\n"),
#define uip_sethostaddr(addr)
Set the IP address of this host.
linkaddr_t linkaddr_node_addr
The Rime address of the node.
uIP packet forwarding header file.
CCIF uip_lladdr_t uip_lladdr
Host L2 address.
802.15.4 frame creation and parsing functions
#define UIP_FW_NETIF(ip1, ip2, ip3, ip4, nm1, nm2, nm3, nm4, outputfunc)
Instantiating macro for a uIP network interface.
Representation of a uIP network interface.
#define LEDS_RED
LED1 (Red) -> PC0.
Unicast address structure.
uip_ipaddr_t ipaddr
The IP address of this interface.
Header file for the uIP TCP/IP stack.
void uip_ds6_set_addr_iid(uip_ipaddr_t *ipaddr, uip_lladdr_t *lladdr)
set the last 64 bits of an IP address based on the MAC address
void uip_fw_init(void)
Initialize the uIP packet forwarding module.
Network interface and stateless autoconfiguration (RFC 4862)
#define NULL
The null pointer.
Header file for tunnelling uIP over Rime mesh
void linkaddr_copy(linkaddr_t *dest, const linkaddr_t *src)
Copy a Rime address.
#define uip_ipaddr_copy(dest, src)
Copy an IP address from one place to another.
#define uip_ipaddr_to_quad(a)
Convert an IP address to four bytes separated by commas.
void uip_init(void)
uIP initialization function.
void uip_fw_default(struct uip_fw_netif *netif)
Register a default network interface.
uip_ipaddr_t netmask
The netmask of the interface.
void process_start(struct process *p, process_data_t data)
Start a process.
#define ADDR_TENTATIVE
Possible states for the an address (RFC 4862)
void linkaddr_set_node_addr(linkaddr_t *t)
Set the address of the current node.
#define uip_ipaddr(addr, addr0, addr1, addr2, addr3)
Construct an IP address from four bytes.
#define uip_ip6addr(addr, addr0, addr1, addr2, addr3, addr4, addr5, addr6, addr7)
Construct an IPv6 address from eight 16-bit words.
#define uip_setnetmask(addr)
Set the netmask.
Include file for the Contiki low-layer network stack (NETSTACK)
#define CLOCK_SECOND
A second, measured in system clock time.
Header file for the Rime address representation