Unverified Commit 09710882 authored by Simon Duquennoy's avatar Simon Duquennoy Committed by GitHub
Browse files

Merge pull request #167 from nfi/contrib/coap-lwm2m-dtls

Updated CoAP and LWM2M with added DTLS support
parents 9db7245d 63a96752
......@@ -13,3 +13,9 @@
[submodule "tools/cooja"]
path = tools/cooja
url = https://github.com/contiki-ng/cooja.git
[submodule "os/net/security/tinydtls"]
path = os/net/security/tinydtls
url = https://github.com/contiki-ng/tinydtls.git
[submodule "tests/18-coap-lwm2m/example-lwm2m-standalone"]
path = tests/18-coap-lwm2m/example-lwm2m-standalone
url = https://github.com/contiki-ng/example-lwm2m-standalone.git
......@@ -26,6 +26,7 @@ env:
- TEST_NAME='rpl-lite'
- TEST_NAME='rpl-classic'
- TEST_NAME='tun-rpl-br'
- TEST_NAME='coap-lwm2m'
- TEST_NAME='simulation-base'
- TEST_NAME='ieee802154'
- TEST_NAME='compile-nxp-ports'
......
......@@ -360,6 +360,9 @@ viewconf:
@echo "##### \"MAKE_MAC\": ______________________________ $(MAKE_MAC)"
@echo "##### \"MAKE_NET\": ______________________________ $(MAKE_NET)"
@echo "##### \"MAKE_ROUTING\": __________________________ $(MAKE_ROUTING)"
ifdef MAKE_COAP_DTLS_KEYSTORE
@echo "##### \"MAKE_COAP_DTLS_KEYSTORE\": _______________ $(MAKE_COAP_DTLS_KEYSTORE)"
endif
@echo "----------------- C variables: -----------------"
$(Q)$(CC) $(CFLAGS) -E $(CONTIKI)/tools/viewconf.c | grep \#\#\#\#\#
@echo "------------------------------------------------"
......
......@@ -9,24 +9,13 @@ ifeq ($(TARGET),native)
MODULES_REL += ./resources-plugtest
endif
MODULES_REL += ./resources
MODULES_REL += $(TARGET)
# Include the CoAP implementation
MODULES += os/net/app-layer/coap
# optional rules to get assembly
#CUSTOM_RULE_C_TO_OBJECTDIR_O = 1
#CUSTOM_RULE_S_TO_OBJECTDIR_O = 1
include $(CONTIKI)/Makefile.include
# optional rules to get assembly
#$(OBJECTDIR)/%.o: asmdir/%.S
# $(CC) $(CFLAGS) -MMD -c $< -o $@
# @$(FINALIZE_DEPENDENCY)
#
#asmdir/%.S: %.c
# $(CC) $(CFLAGS) -MMD -S $< -o $@
# border router rules
$(CONTIKI)/tools/tunslip6: $(CONTIKI)/tools/tunslip6.c
(cd $(CONTIKI)/tools && $(MAKE) tunslip6)
......@@ -37,8 +26,8 @@ connect-router: $(CONTIKI)/tools/tunslip6
connect-router-cooja: $(CONTIKI)/tools/tunslip6
sudo $(CONTIKI)/tools/tunslip6 -a 127.0.0.1 -p 60001 fd00::1/64
connect-router-native: $(CONTIKI)/examples/native-border-router/border-router.native
sudo $(CONTIKI)/examples/native-border-router/border-router.native -a 127.0.0.1 -p 60001 fd00::1/64
connect-router-native: $(CONTIKI)/examples/rpl-border-router/border-router.native
sudo $(CONTIKI)/examples/rpl-border-router/border-router.native -a 127.0.0.1 -p 60001 fd00::1/64
connect-minimal:
sudo ip address add fdfd::1/64 dev tap0
connect-native:
sudo ip address add fdfd::1/64 dev tun0
A Quick Introduction to the Erbium (Er) REST Engine
A Quick Introduction to the Erbium (Er) CoAP Engine
===================================================
EXAMPLE FILES
-------------
- coap-example-server.c: A RESTful server example showing how to use the REST
layer to develop server-side applications (at the moment only CoAP is
implemented for the REST Engine).
- coap-example-server.c: A CoAP server example showing how to use the CoAP
layer to develop server-side applications.
- coap-example-client.c: A CoAP client that polls the /actuators/toggle resource
every 10 seconds and cycles through 4 resources on button press (target
address is hard-coded).
- plugtest-server.c: The server used for draft compliance testing at ETSI
IoT CoAP Plugtests. Erbium (Er) participated in Paris, France, March 2012 and
Sophia-Antipolis, France, November 2012 (configured for minimal-net).
Sophia-Antipolis, France, November 2012 (configured for native).
PRELIMINARIES
-------------
- Make sure rpl-border-router has the same stack and fits into mote memory:
You can disable RDC in border-router project-conf.h (not really required as BR keeps radio turned on).
#define NETSTACK_CONF_RDC nullrdc_driver
- Alternatively, you can use the native-border-router together with the slip-radio.
- For convenience, define the Cooja addresses in /etc/hosts
fd00::0212:7401:0001:0101 cooja1
fd00::0212:7402:0002:0202 cooja2
...
- Get the Copper (Cu) CoAP user-agent from
[https://addons.mozilla.org/en-US/firefox/addon/copper-270430](https://addons.mozilla.org/en-US/firefox/addon/copper-270430)
- Optional: Save your target as default target
make TARGET=sky savetarget
COOJA HOWTO
-----------
TMOTE SKY HOWTO
---------------
###Server only:
The CoAP example no longer fits in the limited ROM of the Tmote Sky.
Please use a platform with larger ROM instead.
make TARGET=cooja server-only.csc
Open new terminal
make connect-router-cooja
- Start Copper and discover resources at coap://cooja2:5683/
- Choose "Click button on Sky 2" from the context menu of mote 2 (server) after
requesting /test/separate
- Do the same when observing /test/event
###With client:
make TARGET=cooja server-client.csc
Open new terminal
make connect-router-cooja
- Wait until red LED toggles on mote 2 (server)
- Choose "Click button on Sky 3" from the context menu of mote 3 (client) and
watch serial output
TMOTES HOWTO
NATIVE HOWTO
------------
###Server:
1. Connect two Tmote Skys (check with $ make TARGET=sky sky-motelist)
make TARGET=sky coap-example-server.upload MOTE=2
make TARGET=sky login MOTE=2
2. Press reset button, get address, abort with Ctrl+C:
Line: "Tentative link-local IPv6 address fe80:0000:0000:0000:____:____:____:____"
cd ../rpl-border-router/
make TARGET=sky border-router.upload MOTE=1
make connect-router
For a BR tty other than USB0:
make connect-router-port PORT=X
3. Start Copper and discover resources at:
coap://[fd00::____:____:____:____]:5683/
### Add a client:
1. Change the hard-coded server address in coap-example-client.c to fd00::____:____:____:____
2. Connect a third Tmote Sky
make TARGET=sky coap-example-client.upload MOTE=3
MINIMAL-NET HOWTO
-----------------
With the target minimal-net you can test your CoAP applications without
With the target native you can test your CoAP applications without
constraints, i.e., with large buffers, debug output, memory protection, etc.
The plugtest-server is thought for the minimal-net platform, as it requires
The plugtest-server is thought for the native platform, as it requires
an 1280-byte IP buffer and 1024-byte blocks.
make TARGET=minimal-net plugtest-server
sudo ./plugtest-server.minimal-net
make TARGET=native plugtest-server
sudo ./plugtest-server.native
Open new terminal
make connect-minimal
make connect-native
- Start Copper and discover resources at coap://[fdfd::ff:fe00:10]:5683/
- You can enable the ETSI Plugtest menu in Copper's preferences
......@@ -130,12 +65,12 @@ in coap-example-server.c. In general, coap supports:
- All draft-18 header options
- CON Retransmissions (note COAP_MAX_OPEN_TRANSACTIONS)
- Blockwise Transfers (note REST_MAX_CHUNK_SIZE, see plugtest-server.c for
- Blockwise Transfers (note COAP_MAX_CHUNK_SIZE, see plugtest-server.c for
Block1 uploads)
- Separate Responses (no rest_set_pre_handler() required anymore, note
coap_separate_accept(), _reject(), and _resume())
- Resource Discovery
- Observing Resources (see EVENT_ and PRERIODIC_RESOURCE, note
- Observing Resources (see EVENT_ and PERIODIC_RESOURCE, note
COAP_MAX_OBSERVERS)
TODOs
......
......@@ -42,33 +42,22 @@
#include "contiki.h"
#include "contiki-net.h"
#include "coap-engine.h"
#include "coap-blocking-api.h"
#include "dev/button-sensor.h"
#define DEBUG 0
#if DEBUG
#include <stdio.h>
#define PRINTF(...) printf(__VA_ARGS__)
#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])
#define PRINTLLADDR(lladdr) PRINTF("[%02x:%02x:%02x:%02x:%02x:%02x]", (lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3], (lladdr)->addr[4], (lladdr)->addr[5])
#else
#define PRINTF(...)
#define PRINT6ADDR(addr)
#define PRINTLLADDR(addr)
#endif
/* Log configuration */
#include "coap-log.h"
#define LOG_MODULE "client"
#define LOG_LEVEL LOG_LEVEL_COAP
/* FIXME: This server address is hard-coded for Cooja and link-local for unconnected border router. */
#define SERVER_NODE(ipaddr) uip_ip6addr(ipaddr, 0xfe80, 0, 0, 0, 0x0212, 0x7402, 0x0002, 0x0202) /* cooja2 */
/* #define SERVER_NODE(ipaddr) uip_ip6addr(ipaddr, 0xbbbb, 0, 0, 0, 0, 0, 0, 0x1) */
#define LOCAL_PORT UIP_HTONS(COAP_DEFAULT_PORT + 1)
#define REMOTE_PORT UIP_HTONS(COAP_DEFAULT_PORT)
#define SERVER_EP "coap://[fe80::212:7402:0002:0202]"
#define TOGGLE_INTERVAL 10
PROCESS(er_example_client, "Erbium Example Client");
AUTOSTART_PROCESSES(&er_example_client);
uip_ipaddr_t server_ipaddr;
static struct etimer et;
/* Example URIs that can be queried. */
......@@ -82,7 +71,7 @@ static int uri_switch = 0;
/* This function is will be passed to COAP_BLOCKING_REQUEST() to handle responses. */
void
client_chunk_handler(void *response)
client_chunk_handler(coap_message_t *response)
{
const uint8_t *chunk;
......@@ -92,14 +81,15 @@ client_chunk_handler(void *response)
}
PROCESS_THREAD(er_example_client, ev, data)
{
coap_endpoint_t server_ep;
PROCESS_BEGIN();
static coap_packet_t request[1]; /* This way the packet can be treated as pointer as usual. */
static coap_message_t request[1]; /* This way the packet can be treated as pointer as usual. */
SERVER_NODE(&server_ipaddr);
coap_endpoint_parse(SERVER_EP, strlen(SERVER_EP), &server_ep);
/* receives all CoAP messages */
coap_init_engine();
coap_engine_init();
etimer_set(&et, TOGGLE_INTERVAL * CLOCK_SECOND);
......@@ -122,11 +112,10 @@ PROCESS_THREAD(er_example_client, ev, data)
coap_set_payload(request, (uint8_t *)msg, sizeof(msg) - 1);
PRINT6ADDR(&server_ipaddr);
PRINTF(" : %u\n", UIP_HTONS(REMOTE_PORT));
LOG_INFO_COAP_EP(&server_ep);
LOG_INFO_("\n");
COAP_BLOCKING_REQUEST(&server_ipaddr, REMOTE_PORT, request,
client_chunk_handler);
COAP_BLOCKING_REQUEST(&server_ep, request, client_chunk_handler);
printf("\n--Done--\n");
......@@ -142,10 +131,10 @@ PROCESS_THREAD(er_example_client, ev, data)
printf("--Requesting %s--\n", service_urls[uri_switch]);
PRINT6ADDR(&server_ipaddr);
PRINTF(" : %u\n", UIP_HTONS(REMOTE_PORT));
LOG_INFO_COAP_EP(&server_ep);
LOG_INFO_("\n");
COAP_BLOCKING_REQUEST(&server_ipaddr, REMOTE_PORT, request,
COAP_BLOCKING_REQUEST(&server_ep, request,
client_chunk_handler);
printf("\n--Done--\n");
......
......@@ -49,19 +49,8 @@
#if DEBUG
#define PRINTF(...) printf(__VA_ARGS__)
#define PRINTFLN(format, ...) printf(format "\n", ##__VA_ARGS__)
#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])
#else
#define PRINTF(...)
#define PRINT6ADDR(addr)
#define PRINTFLN(...)
#endif
......
......@@ -31,7 +31,7 @@
/**
* \file
* Erbium (Er) REST Engine example.
* Erbium (Er) CoAP Engine example.
* \author
* Matthias Kovatsch <kovatsch@inf.ethz.ch>
*/
......@@ -40,8 +40,7 @@
#include <stdlib.h>
#include <string.h>
#include "contiki.h"
#include "contiki-net.h"
#include "rest-engine.h"
#include "coap-engine.h"
#if PLATFORM_HAS_BUTTON
#include "dev/button-sensor.h"
......@@ -51,19 +50,15 @@
#if DEBUG
#include <stdio.h>
#define PRINTF(...) printf(__VA_ARGS__)
#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])
#define PRINTLLADDR(lladdr) PRINTF("[%02x:%02x:%02x:%02x:%02x:%02x]", (lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3], (lladdr)->addr[4], (lladdr)->addr[5])
#else
#define PRINTF(...)
#define PRINT6ADDR(addr)
#define PRINTLLADDR(addr)
#endif
/*
* Resources to be activated need to be imported through the extern keyword.
* The build system automatically compiles the resources in the corresponding sub-directory.
*/
extern resource_t
extern coap_resource_t
res_hello,
res_mirror,
res_chunks,
......@@ -73,29 +68,29 @@ extern resource_t
res_sub,
res_b1_sep_b2;
#if PLATFORM_HAS_LEDS
extern resource_t res_leds, res_toggle;
extern coap_resource_t res_leds, res_toggle;
#endif
#if PLATFORM_HAS_LIGHT
#include "dev/light-sensor.h"
extern resource_t res_light;
extern coap_resource_t res_light;
#endif
#if PLATFORM_HAS_BATTERY
#include "dev/battery-sensor.h"
extern resource_t res_battery;
extern coap_resource_t res_battery;
#endif
#if PLATFORM_HAS_TEMPERATURE
#include "dev/temperature-sensor.h"
extern resource_t res_temperature;
extern coap_resource_t res_temperature;
#endif
/*
extern resource_t res_battery;
extern coap_resource_t res_battery;
#endif
#if PLATFORM_HAS_RADIO
extern resource_t res_radio;
extern coap_resource_t res_radio;
#endif
#if PLATFORM_HAS_SHT11
#include "dev/sht11/sht11-sensor.h"
extern resource_t res_sht11;
extern coap_resource_t res_sht11;
#endif
*/
......@@ -120,47 +115,49 @@ PROCESS_THREAD(er_example_server, ev, data)
PRINTF("uIP buffer: %u\n", UIP_BUFSIZE);
PRINTF("LL header: %u\n", UIP_LLH_LEN);
PRINTF("IP+UDP header: %u\n", UIP_IPUDPH_LEN);
PRINTF("REST max chunk: %u\n", REST_MAX_CHUNK_SIZE);
PRINTF("CoAP max chunk: %u\n", COAP_MAX_CHUNK_SIZE);
/* Initialize the REST engine. */
rest_init_engine();
coap_engine_init();
/*
* Bind the resources to their Uri-Path.
* WARNING: Activating twice only means alternate path, not two instances!
* All static variables are the same for each URI path.
*/
rest_activate_resource(&res_hello, "test/hello");
/* rest_activate_resource(&res_mirror, "debug/mirror"); */
/* rest_activate_resource(&res_chunks, "test/chunks"); */
/* rest_activate_resource(&res_separate, "test/separate"); */
rest_activate_resource(&res_push, "test/push");
/* rest_activate_resource(&res_event, "sensors/button"); */
/* rest_activate_resource(&res_sub, "test/sub"); */
/* rest_activate_resource(&res_b1_sep_b2, "test/b1sepb2"); */
coap_activate_resource(&res_hello, "test/hello");
coap_activate_resource(&res_mirror, "debug/mirror");
coap_activate_resource(&res_chunks, "test/chunks");
coap_activate_resource(&res_separate, "test/separate");
coap_activate_resource(&res_push, "test/push");
#if PLATFORM_HAS_BUTTON
coap_activate_resource(&res_event, "sensors/button");
#endif /* PLATFORM_HAS_BUTTON */
coap_activate_resource(&res_sub, "test/sub");
coap_activate_resource(&res_b1_sep_b2, "test/b1sepb2");
#if PLATFORM_HAS_LEDS
/* rest_activate_resource(&res_leds, "actuators/leds"); */
rest_activate_resource(&res_toggle, "actuators/toggle");
/* coap_activate_resource(&res_leds, "actuators/leds"); */
coap_activate_resource(&res_toggle, "actuators/toggle");
#endif
#if PLATFORM_HAS_LIGHT
rest_activate_resource(&res_light, "sensors/light");
SENSORS_ACTIVATE(light_sensor);
coap_activate_resource(&res_light, "sensors/light");
SENSORS_ACTIVATE(light_sensor);
#endif
#if PLATFORM_HAS_BATTERY
rest_activate_resource(&res_battery, "sensors/battery");
SENSORS_ACTIVATE(battery_sensor);
coap_activate_resource(&res_battery, "sensors/battery");
SENSORS_ACTIVATE(battery_sensor);
#endif
#if PLATFORM_HAS_TEMPERATURE
rest_activate_resource(&res_temperature, "sensors/temperature");
SENSORS_ACTIVATE(temperature_sensor);
coap_activate_resource(&res_temperature, "sensors/temperature");
SENSORS_ACTIVATE(temperature_sensor);
#endif
/*
#if PLATFORM_HAS_RADIO
rest_activate_resource(&res_radio, "sensors/radio");
coap_activate_resource(&res_radio, "sensors/radio");
#endif
#if PLATFORM_HAS_SHT11
rest_activate_resource(&res_sht11, "sensors/sht11");
SENSORS_ACTIVATE(sht11_sensor);
coap_activate_resource(&res_sht11, "sensors/sht11");
SENSORS_ACTIVATE(sht11_sensor);
#endif
*/
......
21,23c21
< #ifdef __INSIDE_CYGWIN__
< uint32_t __s6_addr32[4];
< #endif
---
> u_int __s6_addr32[4];
36d33
< #ifdef __INSIDE_CYGWIN__
39d35
< #endif
......@@ -44,7 +44,7 @@
#include "coap.h"
#include "coap-transactions.h"
#include "coap-separate.h"
#include "rest-engine.h"
#include "coap-engine.h"
#include "plugtest.h"
/*
......@@ -52,7 +52,7 @@
* The build system automatically compiles the resources in the corresponding
* sub-directory.
*/
extern resource_t
extern coap_resource_t
res_plugtest_test,
res_plugtest_validate,
res_plugtest_create1,
......@@ -95,29 +95,29 @@ PROCESS_THREAD(plugtest_server, ev, data)
PRINTF("REST max chunk: %u\n", REST_MAX_CHUNK_SIZE);
/* Initialize the REST engine. */
rest_init_engine();
coap_engine_init();
/* Activate the application-specific resources. */
rest_activate_resource(&res_plugtest_test, "test");
rest_activate_resource(&res_plugtest_validate, "validate");
rest_activate_resource(&res_plugtest_create1, "create1");
rest_activate_resource(&res_plugtest_create2, "create2");
rest_activate_resource(&res_plugtest_create3, "create3");
rest_activate_resource(&res_plugtest_longpath, "seg1/seg2/seg3");
rest_activate_resource(&res_plugtest_query, "query");
rest_activate_resource(&res_plugtest_locquery, "location-query");
rest_activate_resource(&res_plugtest_multi, "multi-format");
rest_activate_resource(&res_plugtest_link1, "link1");
rest_activate_resource(&res_plugtest_link2, "link2");
rest_activate_resource(&res_plugtest_link3, "link3");
rest_activate_resource(&res_plugtest_path, "path");
rest_activate_resource(&res_plugtest_separate, "separate");
rest_activate_resource(&res_plugtest_large, "large");
rest_activate_resource(&res_plugtest_large_update, "large-update");
rest_activate_resource(&res_plugtest_large_create, "large-create");
rest_activate_resource(&res_plugtest_obs, "obs");
coap_activate_resource(&res_plugtest_test, "test");
coap_activate_resource(&res_plugtest_validate, "validate");
coap_activate_resource(&res_plugtest_create1, "create1");
coap_activate_resource(&res_plugtest_create2, "create2");
coap_activate_resource(&res_plugtest_create3, "create3");
coap_activate_resource(&res_plugtest_longpath, "seg1/seg2/seg3");
coap_activate_resource(&res_plugtest_query, "query");
coap_activate_resource(&res_plugtest_locquery, "location-query");
coap_activate_resource(&res_plugtest_multi, "multi-format");
coap_activate_resource(&res_plugtest_link1, "link1");
coap_activate_resource(&res_plugtest_link2, "link2");
coap_activate_resource(&res_plugtest_link3, "link3");
coap_activate_resource(&res_plugtest_path, "path");
coap_activate_resource(&res_plugtest_separate, "separate");
coap_activate_resource(&res_plugtest_large, "large");
coap_activate_resource(&res_plugtest_large_update, "large-update");
coap_activate_resource(&res_plugtest_large_create, "large-create");
coap_activate_resource(&res_plugtest_obs, "obs");
rest_activate_resource(&res_mirror, "mirror");
coap_activate_resource(&res_mirror, "mirror");
/* Define application-specific events here. */
while(1) {
......
......@@ -47,12 +47,8 @@
#if DEBUG
#include <stdio.h>
#define PRINTF(...) printf(__VA_ARGS__)
#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])
#define PRINTLLADDR(lladdr) PRINTF("[%02x:%02x:%02x:%02x:%02x:%02x]", (lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3], (lladdr)->addr[4], (lladdr)->addr[5])
#else
#define PRINTF(...)
#define PRINT6ADDR(addr)
#define PRINTLLADDR(addr)
#endif
/* double expansion */
......
......@@ -36,43 +36,37 @@
* Matthias Kovatsch <kovatsch@inf.ethz.ch>
*/
#ifndef __PROJECT_ERBIUM_CONF_H__
#define __PROJECT_ERBIUM_CONF_H__
#ifndef PROJECT_ERBIUM_CONF_H_
#define PROJECT_ERBIUM_CONF_H_
/* Custom channel and PAN ID configuration for your project. */
/*
#define RF_CHANNEL 26
#define IEEE802154_CONF_PANID 0xABCD
*/
/* #define RF_CHANNEL 26 */
/* #define IEEE802154_CONF_PANID 0xABCD */
/* IP buffer size must match all other hops, in particular the border router. */
/*
#define UIP_CONF_BUFFER_SIZE 256
*/
/* #define UIP_CONF_BUFFER_SIZE 256 */
/* Increase rpl-border-router IP-buffer when using more than 64. */
#define REST_MAX_CHUNK_SIZE 48
#define COAP_MAX_CHUNK_SIZE 48
/* Estimate your header size, especially when using Proxy-Uri. */
/*
#define COAP_MAX_HEADER_SIZE 70
*/
/* #define COAP_MAX_HEADER_SIZE 70 */
/* Multiplies with chunk size, be aware of memory constraints. */
#ifndef COAP_MAX_OPEN_TRANSACTIONS
#define COAP_MAX_OPEN_TRANSACTIONS 4
#endif /* COAP_MAX_OPEN_TRANSACTIONS */
/* Must be <= open transactions, default is COAP_MAX_OPEN_TRANSACTIONS-1. */
/*
#define COAP_MAX_OBSERVERS 2
*/
/* #define COAP_MAX_OBSERVERS 2 */
/* Filtering .well-known/core per query can be disabled to save space. */
#define COAP_LINK_FORMAT_FILTERING 0
#define COAP_PROXY_OPTION_PROCESSING 0
/* Turn off DAO-ACK to make code smaller */
#define RPL_CONF_WITH_DAO_ACK 0
/* Enable client-side support for COAP observe */
#define COAP_OBSERVE_CLIENT 1
#endif /* __PROJECT_ERBIUM_CONF_H__ */
#ifndef COAP_OBSERVE_CLIENT
#define COAP_OBSERVE_CLIENT 1
#endif /* COAP_OBSERVE_CLIENT */
#endif /* PROJECT_ERBIUM_CONF_H_ */