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