Contiki 3.x
contiki-cooja-main.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010, Swedish Institute of Computer Science.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the Institute nor the names of its contributors
14  * may be used to endorse or promote products derived from this software
15  * without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  *
29  */
30 
31 /**
32  * \file
33  * COOJA Contiki mote main file.
34  * \author
35  * Fredrik Osterlind <fros@sics.se>
36  */
37 
38 #include <jni.h>
39 #include <stdio.h>
40 #include <string.h>
41 
42 #include "contiki.h"
43 #include "sys/cc.h"
44 
45 #include "sys/clock.h"
46 #include "sys/etimer.h"
47 #include "sys/cooja_mt.h"
48 #include "sys/autostart.h"
49 
50 #include "lib/random.h"
51 #include "lib/simEnvChange.h"
52 
53 #include "net/rime/rime.h"
54 #include "net/netstack.h"
55 
56 #include "dev/eeprom.h"
57 #include "dev/serial-line.h"
58 #include "dev/cooja-radio.h"
59 #include "dev/button-sensor.h"
60 #include "dev/pir-sensor.h"
61 #include "dev/vib-sensor.h"
62 
63 #include "sys/node-id.h"
64 
65 
66 /* JNI-defined functions, depends on the environment variable CLASSNAME */
67 #ifndef CLASSNAME
68 #error CLASSNAME is undefined, required by contiki-cooja-main.c
69 #endif /* CLASSNAME */
70 #define COOJA__QUOTEME(a,b,c) COOJA_QUOTEME(a,b,c)
71 #define COOJA_QUOTEME(a,b,c) a##b##c
72 #define COOJA_JNI_PATH Java_org_contikios_cooja_corecomm_
73 #define Java_org_contikios_cooja_corecomm_CLASSNAME_init COOJA__QUOTEME(COOJA_JNI_PATH,CLASSNAME,_init)
74 #define Java_org_contikios_cooja_corecomm_CLASSNAME_getMemory COOJA__QUOTEME(COOJA_JNI_PATH,CLASSNAME,_getMemory)
75 #define Java_org_contikios_cooja_corecomm_CLASSNAME_setMemory COOJA__QUOTEME(COOJA_JNI_PATH,CLASSNAME,_setMemory)
76 #define Java_org_contikios_cooja_corecomm_CLASSNAME_tick COOJA__QUOTEME(COOJA_JNI_PATH,CLASSNAME,_tick)
77 #define Java_org_contikios_cooja_corecomm_CLASSNAME_setReferenceAddress COOJA__QUOTEME(COOJA_JNI_PATH,CLASSNAME,_setReferenceAddress)
78 
79 #ifndef NETSTACK_CONF_WITH_IPV4
80 #define NETSTACK_CONF_WITH_IPV4 0
81 #endif
82 #if NETSTACK_CONF_WITH_IPV4
83 #include "dev/rs232.h"
84 #include "dev/slip.h"
85 #include "net/ip/uip.h"
86 #include "net/ipv4/uip-fw.h"
87 #include "net/uip-fw-drv.h"
88 #include "net/ipv4/uip-over-mesh.h"
89 static struct uip_fw_netif slipif =
90  {UIP_FW_NETIF(0,0,0,0, 255,255,255,255, slip_send)};
91 static struct uip_fw_netif meshif =
92  {UIP_FW_NETIF(172,16,0,0, 255,255,0,0, uip_over_mesh_send)};
93 
94 #define UIP_OVER_MESH_CHANNEL 8
95 static uint8_t is_gateway;
96 #endif /* NETSTACK_CONF_WITH_IPV4 */
97 
98 #ifndef NETSTACK_CONF_WITH_IPV6
99 #define NETSTACK_CONF_WITH_IPV6 0
100 #endif
101 #if NETSTACK_CONF_WITH_IPV6
102 #include "net/ip/uip.h"
103 #include "net/ipv6/uip-ds6.h"
104 #define PRINT6ADDR(addr) printf("%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15])
105 #endif /* NETSTACK_CONF_WITH_IPV6 */
106 
107 /* Simulation mote interfaces */
108 SIM_INTERFACE_NAME(moteid_interface);
109 SIM_INTERFACE_NAME(vib_interface);
110 SIM_INTERFACE_NAME(rs232_interface);
111 SIM_INTERFACE_NAME(simlog_interface);
112 SIM_INTERFACE_NAME(beep_interface);
113 SIM_INTERFACE_NAME(radio_interface);
114 SIM_INTERFACE_NAME(button_interface);
115 SIM_INTERFACE_NAME(pir_interface);
116 SIM_INTERFACE_NAME(clock_interface);
117 SIM_INTERFACE_NAME(leds_interface);
118 SIM_INTERFACE_NAME(cfs_interface);
119 SIM_INTERFACE_NAME(eeprom_interface);
120 SIM_INTERFACES(&vib_interface, &moteid_interface, &rs232_interface, &simlog_interface, &beep_interface, &radio_interface, &button_interface, &pir_interface, &clock_interface, &leds_interface, &cfs_interface, &eeprom_interface);
121 /* Example: manually add mote interfaces */
122 //SIM_INTERFACE_NAME(dummy_interface);
123 //SIM_INTERFACES(..., &dummy_interface);
124 
125 /* Sensors */
126 SENSORS(&button_sensor, &pir_sensor, &vib_sensor);
127 
128 /*
129  * referenceVar is used for comparing absolute and process relative memory.
130  * (this must not be static due to memory locations)
131  */
132 long referenceVar;
133 
134 /*
135  * Contiki and rtimer threads.
136  */
137 static struct cooja_mt_thread rtimer_thread;
138 static struct cooja_mt_thread process_run_thread;
139 
140 /*---------------------------------------------------------------------------*/
141 #if NETSTACK_CONF_WITH_IPV4
142 static void
143 set_gateway(void)
144 {
145  if(!is_gateway) {
146  printf("%d.%d: making myself the IP network gateway.\n\n",
148  printf("IPv4 address of the gateway: %d.%d.%d.%d\n\n",
149  uip_ipaddr_to_quad(&uip_hostaddr));
150  uip_over_mesh_set_gateway(&linkaddr_node_addr);
151  uip_over_mesh_make_announced_gateway();
152  is_gateway = 1;
153  }
154 }
155 #endif /* NETSTACK_CONF_WITH_IPV4 */
156 /*---------------------------------------------------------------------------*/
157 static void
158 print_processes(struct process * const processes[])
159 {
160  /* const struct process * const * p = processes;*/
161  printf("Starting");
162  while(*processes != NULL) {
163  printf(" '%s'", (*processes)->name);
164  processes++;
165  }
166  putchar('\n');
167 }
168 /*---------------------------------------------------------------------------*/
169 static void
170 rtimer_thread_loop(void *data)
171 {
172  while(1)
173  {
174  rtimer_arch_check();
175 
176  /* Return to COOJA */
177  cooja_mt_yield();
178  }
179 }
180 /*---------------------------------------------------------------------------*/
181 static void
182 set_rime_addr(void)
183 {
184  linkaddr_t addr;
185  int i;
186 
187  memset(&addr, 0, sizeof(linkaddr_t));
188 #if NETSTACK_CONF_WITH_IPV6
189  for(i = 0; i < sizeof(uip_lladdr.addr); i += 2) {
190  addr.u8[i + 1] = node_id & 0xff;
191  addr.u8[i + 0] = node_id >> 8;
192  }
193 #else /* NETSTACK_CONF_WITH_IPV6 */
194  addr.u8[0] = node_id & 0xff;
195  addr.u8[1] = node_id >> 8;
196 #endif /* NETSTACK_CONF_WITH_IPV6 */
197  linkaddr_set_node_addr(&addr);
198  printf("Rime started with address ");
199  for(i = 0; i < sizeof(addr.u8) - 1; i++) {
200  printf("%d.", addr.u8[i]);
201  }
202  printf("%d\n", addr.u8[i]);
203 }
204 /*---------------------------------------------------------------------------*/
205 void
206 contiki_init()
207 {
208  /* Initialize random generator (moved to moteid.c) */
209 
210  /* Start process handler */
211  process_init();
212 
213 
214  /* Start Contiki processes */
215 
216  process_start(&etimer_process, NULL);
217  process_start(&sensors_process, NULL);
218  ctimer_init();
219 
220  /* Print startup information */
221  printf(CONTIKI_VERSION_STRING " started. ");
222  if(node_id > 0) {
223  printf("Node id is set to %u.\n", node_id);
224  } else {
225  printf("Node id is not set.\n");
226  }
227 
228  set_rime_addr();
229  {
230  uint8_t longaddr[8];
231 
232  memset(longaddr, 0, sizeof(longaddr));
233  linkaddr_copy((linkaddr_t *)&longaddr, &linkaddr_node_addr);
234  printf("MAC %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x ",
235  longaddr[0], longaddr[1], longaddr[2], longaddr[3],
236  longaddr[4], longaddr[5], longaddr[6], longaddr[7]);
237  }
238 
239  queuebuf_init();
240 
241  /* Initialize communication stack */
242  netstack_init();
243  printf("%s/%s/%s, channel check rate %lu Hz\n",
244  NETSTACK_NETWORK.name, NETSTACK_MAC.name, NETSTACK_RDC.name,
245  CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1:
246  NETSTACK_RDC.channel_check_interval()));
247 
248 #if NETSTACK_CONF_WITH_IPV4
249  /* IPv4 CONFIGURATION */
250  {
251  uip_ipaddr_t hostaddr, netmask;
252 
253  process_start(&tcpip_process, NULL);
254  process_start(&uip_fw_process, NULL);
255  process_start(&slip_process, NULL);
256 
257  slip_set_input_callback(set_gateway);
258 
259  uip_init();
260  uip_fw_init();
261  uip_ipaddr(&hostaddr, 172,16,linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1]);
262  uip_ipaddr(&netmask, 255,255,0,0);
263  uip_ipaddr_copy(&meshif.ipaddr, &hostaddr);
264 
265  uip_sethostaddr(&hostaddr);
266  uip_setnetmask(&netmask);
267  uip_over_mesh_set_net(&hostaddr, &netmask);
268  uip_over_mesh_set_gateway_netif(&slipif);
269  uip_fw_default(&meshif);
270  uip_over_mesh_init(UIP_OVER_MESH_CHANNEL);
271 
273  printf("IPv4 address: %d.%d.%d.%d\n", uip_ipaddr_to_quad(&hostaddr));
274  }
275 #endif /* NETSTACK_CONF_WITH_IPV4 */
276 
277 #if NETSTACK_CONF_WITH_IPV6
278  /* IPv6 CONFIGURATION */
279  {
280  int i;
281  uint8_t addr[sizeof(uip_lladdr.addr)];
282  for(i = 0; i < sizeof(uip_lladdr.addr); i += 2) {
283  addr[i + 1] = node_id & 0xff;
284  addr[i + 0] = node_id >> 8;
285  }
286  linkaddr_copy((linkaddr_t *)addr, &linkaddr_node_addr);
287  memcpy(&uip_lladdr.addr, addr, sizeof(uip_lladdr.addr));
288 
289  process_start(&tcpip_process, NULL);
290 
291  printf("Tentative link-local IPv6 address ");
292  {
293  uip_ds6_addr_t *lladdr;
294  int i;
295  lladdr = uip_ds6_get_link_local(-1);
296  for(i = 0; i < 7; ++i) {
297  printf("%02x%02x:", lladdr->ipaddr.u8[i * 2],
298  lladdr->ipaddr.u8[i * 2 + 1]);
299  }
300  printf("%02x%02x\n", lladdr->ipaddr.u8[14],
301  lladdr->ipaddr.u8[15]);
302  }
303 
304  if(1) {
305  uip_ipaddr_t ipaddr;
306  int i;
307  uip_ip6addr(&ipaddr, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0, 0, 0, 0);
308  uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr);
309  uip_ds6_addr_add(&ipaddr, 0, ADDR_TENTATIVE);
310  printf("Tentative global IPv6 address ");
311  for(i = 0; i < 7; ++i) {
312  printf("%02x%02x:",
313  ipaddr.u8[i * 2], ipaddr.u8[i * 2 + 1]);
314  }
315  printf("%02x%02x\n",
316  ipaddr.u8[7 * 2], ipaddr.u8[7 * 2 + 1]);
317  }
318  }
319 #endif /* NETSTACK_CONF_WITH_IPV6 */
320 
321  /* Initialize eeprom */
322  eeprom_init();
323 
324  /* Start serial process */
325  serial_line_init();
326 
327  /* Start autostart processes (defined in Contiki application) */
328  print_processes(autostart_processes);
329  autostart_start(autostart_processes);
330 }
331 /*---------------------------------------------------------------------------*/
332 static void
333 process_run_thread_loop(void *data)
334 {
335  /* Yield once during bootup */
336  simProcessRunValue = 1;
337  cooja_mt_yield();
338 
339  contiki_init();
340 
341  while(1)
342  {
343  simProcessRunValue = process_run();
344  while(simProcessRunValue-- > 0) {
345  process_run();
346  }
347  simProcessRunValue = process_nevents();
348 
349  /* Check if we must stay awake */
350  if(simDontFallAsleep) {
351  simDontFallAsleep=0;
352  simProcessRunValue = 1;
353  }
354 
355  /* Return to COOJA */
356  cooja_mt_yield();
357  }
358 }
359 /*---------------------------------------------------------------------------*/
360 /**
361  * \brief Initialize a mote by starting processes etc.
362  * \param env JNI Environment interface pointer
363  * \param obj unused
364  *
365  * This function initializes a mote by starting certain
366  * processes and setting up the environment.
367  *
368  * This is a JNI function and should only be called via the
369  * responsible Java part (MoteType.java).
370  */
371 JNIEXPORT void JNICALL
373 {
374  /* Create rtimers and Contiki threads */
375  cooja_mt_start(&rtimer_thread, &rtimer_thread_loop, NULL);
376  cooja_mt_start(&process_run_thread, &process_run_thread_loop, NULL);
377  }
378 /*---------------------------------------------------------------------------*/
379 /**
380  * \brief Get a segment from the process memory.
381  * \param env JNI Environment interface pointer
382  * \param obj unused
383  * \param rel_addr Start address of segment
384  * \param length Size of memory segment
385  * \param mem_arr Byte array destination for the fetched memory segment
386  * \return Java byte array containing a copy of memory segment.
387  *
388  * Fetches a memory segment from the process memory starting at
389  * (rel_addr), with size (length). This function does not perform
390  * ANY error checking, and the process may crash if addresses are
391  * not available/readable.
392  *
393  * This is a JNI function and should only be called via the
394  * responsible Java part (MoteType.java).
395  */
396 JNIEXPORT void JNICALL
397 Java_org_contikios_cooja_corecomm_CLASSNAME_getMemory(JNIEnv *env, jobject obj, jint rel_addr, jint length, jbyteArray mem_arr)
398 {
399  (*env)->SetByteArrayRegion(
400  env,
401  mem_arr,
402  0,
403  (size_t) length,
404  (jbyte *) (((long)rel_addr) + referenceVar)
405  );
406 }
407 /*---------------------------------------------------------------------------*/
408 /**
409  * \brief Replace a segment of the process memory with given byte array.
410  * \param env JNI Environment interface pointer
411  * \param obj unused
412  * \param rel_addr Start address of segment
413  * \param length Size of memory segment
414  * \param mem_arr Byte array contaning new memory
415  *
416  * Replaces a process memory segment with given byte array.
417  * This function does not perform ANY error checking, and the
418  * process may crash if addresses are not available/writable.
419  *
420  * This is a JNI function and should only be called via the
421  * responsible Java part (MoteType.java).
422  */
423 JNIEXPORT void JNICALL
424 Java_org_contikios_cooja_corecomm_CLASSNAME_setMemory(JNIEnv *env, jobject obj, jint rel_addr, jint length, jbyteArray mem_arr)
425 {
426  jbyte *mem = (*env)->GetByteArrayElements(env, mem_arr, 0);
427  memcpy((char*) (((long)rel_addr) + referenceVar),
428  mem,
429  length);
430  (*env)->ReleaseByteArrayElements(env, mem_arr, mem, 0);
431 }
432 /*---------------------------------------------------------------------------*/
433 /**
434  * \brief Let mote execute one "block" of code (tick mote).
435  * \param env JNI Environment interface pointer
436  * \param obj unused
437  *
438  * Let mote defined by the active contiki processes and current
439  * process memory execute some program code. This code must not block
440  * or else this function will never return. A typical contiki
441  * process will return when it executes PROCESS_WAIT..() statements.
442  *
443  * Before the control is left to contiki processes, any messages
444  * from the Java part are handled. These may for example be
445  * incoming network data. After the contiki processes return control,
446  * messages to the Java part are also handled (those which may need
447  * special attention).
448  *
449  * This is a JNI function and should only be called via the
450  * responsible Java part (MoteType.java).
451  */
452 JNIEXPORT void JNICALL
454 {
455  clock_time_t nextEtimer;
456  rtimer_clock_t nextRtimer;
457 
458  simProcessRunValue = 0;
459 
460  /* Let all simulation interfaces act first */
461  doActionsBeforeTick();
462 
463  /* Poll etimer process */
464  if(etimer_pending()) {
466  }
467 
468  /* Let rtimers run.
469  * Sets simProcessRunValue */
470  cooja_mt_exec(&rtimer_thread);
471 
472  if(simProcessRunValue == 0) {
473  /* Rtimers done: Let Contiki handle a few events.
474  * Sets simProcessRunValue */
475  cooja_mt_exec(&process_run_thread);
476  }
477 
478  /* Let all simulation interfaces act before returning to java */
479  doActionsAfterTick();
480 
481  /* Do we have any pending timers */
482  simEtimerPending = etimer_pending() || rtimer_arch_pending();
483  if(!simEtimerPending) {
484  return;
485  }
486 
487  /* Save nearest expiration time */
488  nextEtimer = etimer_next_expiration_time() - (clock_time_t) simCurrentTime;
489  nextRtimer = rtimer_arch_next() - (rtimer_clock_t) simCurrentTime;
490  if(etimer_pending() && rtimer_arch_pending()) {
491  simNextExpirationTime = MIN(nextEtimer, nextRtimer);
492  } else if(etimer_pending()) {
493  simNextExpirationTime = nextEtimer;
494  } else if(rtimer_arch_pending()) {
495  simNextExpirationTime = nextRtimer;
496  }
497 }
498 /*---------------------------------------------------------------------------*/
499 /**
500  * \brief Set the relative memory address of the reference variable.
501  * \param env JNI Environment interface pointer
502  * \param obj unused
503  * \param addr Relative memory address
504  *
505  * This is a JNI function and should only be called via the
506  * responsible Java part (MoteType.java).
507  */
508 JNIEXPORT void JNICALL
510 {
511  referenceVar = (((long)&referenceVar) - ((long)addr));
512 }
JNIEXPORT void JNICALL Java_org_contikios_cooja_corecomm_CLASSNAME_getMemory(JNIEnv *env, jobject obj, jint rel_addr, jint length, jbyteArray mem_arr)
Get a segment from the process memory.
#define uip_sethostaddr(addr)
Set the IP address of this host.
Definition: uip.h:192
static uip_ipaddr_t ipaddr
Pointer to prefix information option in uip_buf.
Definition: uip-nd6.c:129
JNIEXPORT void JNICALL Java_org_contikios_cooja_corecomm_CLASSNAME_setMemory(JNIEnv *env, jobject obj, jint rel_addr, jint length, jbyteArray mem_arr)
Replace a segment of the process memory with given byte array.
#define uip_ipaddr(addr, addr0, addr1, addr2, addr3)
Construct an IP address from four bytes.
Definition: uip.h:956
JNIEXPORT void JNICALL Java_org_contikios_cooja_corecomm_CLASSNAME_init(JNIEnv *env, jobject obj)
Initialize a mote by starting processes etc.
clock_time_t etimer_next_expiration_time(void)
Get next event timer expiration time.
Definition: etimer.c:237
static uip_ds6_addr_t * addr
Pointer to a router list entry.
Definition: uip-nd6.c:124
uint8_t slip_send(void)
Send an IP packet from the uIP buffer with SLIP.
Definition: slip.c:193
Header file for IPv6-related data structures.
void etimer_request_poll(void)
Make the event timer aware that the clock has changed.
Definition: etimer.c:145
int etimer_pending(void)
Check if there are any non-expired event timers.
Definition: etimer.c:231
Default definitions of C compiler quirk work-arounds.
uip_ipaddr_t ipaddr
The IP address of this interface.
Definition: uip-fw.h:57
void eeprom_init(void)
Initialize the EEPROM module.
Definition: eeprom.c:72
int slip_input_byte(unsigned char c)
Input a SLIP byte.
Definition: slip.c:361
Header file for tunnelling uIP over Rime mesh
#define uip_ipaddr_copy(dest, src)
Copy an IP address from one place to another.
Definition: uip.h:1027
int process_run(void)
Run the system once - call poll handlers and process one event.
Definition: process.c:302
Unicast address structure.
Definition: uip-ds6.h:202
void uip_fw_init(void)
Initialize the uIP packet forwarding module.
Definition: uip-fw.c:185
void slip_set_input_callback(void(*c)(void))
Set a function to be called when there is activity on the SLIP interface; used for detecting if a nod...
Definition: slip.c:143
Header file for the Rime stack
JNIEXPORT void JNICALL Java_org_contikios_cooja_corecomm_CLASSNAME_setReferenceAddress(JNIEnv *env, jobject obj, jint addr)
Set the relative memory address of the reference variable.
#define uip_setnetmask(addr)
Set the netmask.
Definition: uip.h:236
EEPROM functions.
#define NULL
The null pointer.
#define uip_ipaddr_to_quad(a)
Convert an IP address to four bytes separated by commas.
Definition: uip.h:928
uIP packet forwarding header file.
void linkaddr_set_node_addr(linkaddr_t *t)
Set the address of the current node.
Definition: linkaddr.c:72
#define UIP_FW_NETIF(ip1, ip2, ip3, ip4, nm1, nm2, nm3, nm4, outputfunc)
Instantiating macro for a uIP network interface.
Definition: uip-fw.h:80
#define ADDR_TENTATIVE
Possible states for the an address (RFC 4862)
Definition: uip-ds6.h:153
#define CLOCK_SECOND
A second, measured in system clock time.
Definition: clock.h:82
void rs232_set_input(int(*f)(unsigned char))
Set an input handler for incoming RS232 data.
Definition: rs232.c:56
#define uip_ip6addr(addr, addr0, addr1, addr2, addr3, addr4, addr5, addr6, addr7)
Construct an IPv6 address from eight 16-bit words.
Definition: uip.h:970
Header file for the uIP TCP/IP stack.
void process_start(struct process *p, process_data_t data)
Start a process.
Definition: process.c:99
Event timer header file.
uip_ds6_addr_t * uip_ds6_addr_add(uip_ipaddr_t *ipaddr, unsigned long vlifetime, uint8_t type)
Add a unicast address to the interface.
Definition: uip-ds6.c:326
Header file for module for automatically starting and exiting a list of processes.
Generic serial I/O process header filer.
CCIF uip_lladdr_t uip_lladdr
Host L2 address.
Definition: uip.c:118
void uip_init(void)
uIP initialization function.
Definition: uip.c:363
int process_nevents(void)
Number of events waiting to be processed.
Definition: process.c:316
void process_init(void)
Initialize the process module.
Definition: process.c:208
void ctimer_init(void)
Initialize the callback timer library.
Definition: ctimer.c:91
void linkaddr_copy(linkaddr_t *dest, const linkaddr_t *src)
Copy a Rime address.
Definition: linkaddr.c:60
linkaddr_t linkaddr_node_addr
The Rime address of the node.
Definition: linkaddr.c:48
Include file for the Contiki low-layer network stack (NETSTACK)
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
Definition: uip-ds6.c:542
void uip_fw_default(struct uip_fw_netif *netif)
Register a default network interface.
Definition: uip-fw.c:515
JNIEXPORT void JNICALL Java_org_contikios_cooja_corecomm_CLASSNAME_tick(JNIEnv *env, jobject obj)
Let mote execute one "block" of code (tick mote).
Representation of a uIP network interface.
Definition: uip-fw.h:54