patched rest-code for econotag

This commit is contained in:
joxe 2011-01-12 18:32:36 +00:00
parent 20f8777fd6
commit ce46b7c6cb
3 changed files with 11 additions and 6 deletions

View file

@ -5,10 +5,7 @@
* Author: dogan * Author: dogan
*/ */
#ifdef CONTIKI_TARGET_SKY #ifdef CONTIKI_TARGET_NETSIM
#include "contiki.h"
#include "contiki-net.h"
#else
#include <stdio.h> #include <stdio.h>
#include <iostream> #include <iostream>
#include <cstring> #include <cstring>
@ -21,6 +18,10 @@
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <netdb.h> #include <netdb.h>
#else
#include "contiki.h"
#include "contiki-net.h"
#include <string.h>
#endif #endif
#include "coap-common.h" #include "coap-common.h"
@ -81,7 +82,8 @@ int serialize_packet(coap_packet_t* packet, uint8_t* buffer)
} }
buffer[index] = (delta) << COAP_HEADER_OPTION_DELTA_POSITION; buffer[index] = (delta) << COAP_HEADER_OPTION_DELTA_POSITION;
PRINTF("option %u len %u option diff %u option_value addr %x option addr %x next option addr %x", option->option, option->len, option->option - option_delta, (uint16_t) option->value, (uint16_t)option, (uint16_t)option->next); PRINTF("option %u len %u option diff %u option_value addr %x option addr %x next option addr %x", option->option, option->len, option->option - option_delta, (unsigned int) option->value, (unsigned int)option, (unsigned int)option->next);
int i = 0; int i = 0;
for ( ; i < option->len ; i++ ){ for ( ; i < option->len ; i++ ){
PRINTF(" (%u)", option->value[i]); PRINTF(" (%u)", option->value[i]);

View file

@ -1,5 +1,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include <ctype.h> /*for isxdigit*/ #include <ctype.h> /*for isxdigit*/
#include "contiki.h" #include "contiki.h"
#include "contiki-net.h" #include "contiki-net.h"
@ -204,7 +205,8 @@ coap_set_option(coap_packet_t* packet, option_type option_type, uint16_t len, ui
packet->option_count++; packet->option_count++;
PRINTF("option->len %u option->option %u option->value %x next %x\n", option->len, option->option, (uint16_t) option->value, (uint16_t)option->next); PRINTF("option->len %u option->option %u option->value %x next %x\n", option->len, option->option, (unsigned int) option->value, (unsigned int)option->next);
int i = 0; int i = 0;
for ( ; i < option->len ; i++ ){ for ( ; i < option->len ; i++ ){
PRINTF(" (%u)", option->value[i]); PRINTF(" (%u)", option->value[i]);

View file

@ -7,6 +7,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdint.h>
#include "buffer.h" #include "buffer.h"
uint8_t* data_buffer; uint8_t* data_buffer;