34 #include "net/uip-debug.h"
52 coap_address_t listen_addr;
59 uip_ip6addr(&listen_addr.addr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0);
60 uip_ds6_set_addr_iid(&listen_addr.addr, &uip_lladdr);
61 uip_ds6_addr_add(&listen_addr.addr, 0, ADDR_AUTOCONF);
63 uip_debug_lladdr_print(&uip_lladdr);
65 uip_debug_ipaddr_print(&listen_addr.addr);
70 printf(
"tentative address: [%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]:%d\r\n",
71 listen_addr.addr.u8[0], listen_addr.addr.u8[1],
72 listen_addr.addr.u8[2], listen_addr.addr.u8[3],
73 listen_addr.addr.u8[4], listen_addr.addr.u8[5],
74 listen_addr.addr.u8[6], listen_addr.addr.u8[7],
75 listen_addr.addr.u8[8], listen_addr.addr.u8[9],
76 listen_addr.addr.u8[10], listen_addr.addr.u8[11],
77 listen_addr.addr.u8[12], listen_addr.addr.u8[13],
78 listen_addr.addr.u8[14], listen_addr.addr.u8[15] ,
79 uip_ntohs(listen_addr.port));
87 coap_log(LOG_CRIT,
"cannot create CoAP context\r\n");
92 # define min(a,b) ((a) < (b) ? (a) : (b))
100 unsigned char buf[2];
137 response->
length += snprintf((
char *)response->
data,
139 "%u", (
unsigned int)now);
149 coap_add_attr(r, (
unsigned char *)
"ct", 2, (
unsigned char *)
"0", 1, 0);
150 coap_add_attr(r, (
unsigned char *)
"title", 5, (
unsigned char *)
"\"General Info\"", 14, 0);
167 coap_add_attr(r, (
unsigned char *)
"ct", 2, (
unsigned char *)
"0", 1, 0);
169 coap_add_attr(r, (
unsigned char *)
"rt", 2, (
unsigned char *)
"\"Ticks\"", 7, 0);
170 coap_add_attr(r, (
unsigned char *)
"if", 2, (
unsigned char *)
"\"clock\"", 7, 0);
174 #ifndef WITHOUT_ASYNC
178 coap_add_attr(r, (
unsigned char *)
"ct", 2, (
unsigned char *)
"0", 1, 0);
185 coap_log(LOG_CRIT,
"cannot create resource\n");
200 coap_log(LOG_EMERG,
"cannot create context\n");
209 if(ev == tcpip_event) {
212 }
else if (ev == PROCESS_EVENT_TIMER && etimer_expired(&
dirty_timer)) {
213 time_resource->
dirty = 1;