From 969d5125467369154b9c5d6ec4ca90999348988c Mon Sep 17 00:00:00 2001 From: Matthias Kovatsch Date: Thu, 15 May 2014 19:56:29 +0200 Subject: [PATCH] Removed references to missing DTLS implementation. --- apps/er-coap/er-coap-constants.h | 4 ---- apps/er-coap/er-coap-engine.c | 19 ------------------- apps/er-coap/er-coap.c | 11 +++++------ apps/er-coap/er-coap.h | 8 ++++---- 4 files changed, 9 insertions(+), 33 deletions(-) diff --git a/apps/er-coap/er-coap-constants.h b/apps/er-coap/er-coap-constants.h index 4ed0b8212..cfa73abcf 100644 --- a/apps/er-coap/er-coap-constants.h +++ b/apps/er-coap/er-coap-constants.h @@ -39,11 +39,7 @@ #ifndef ER_COAP_CONSTANTS_H_ #define ER_COAP_CONSTANTS_H_ -#ifdef WITH_DTLS -#define COAP_DEFAULT_PORT 5684 -#else #define COAP_DEFAULT_PORT 5683 -#endif #define COAP_DEFAULT_MAX_AGE 60 #define COAP_RESPONSE_TIMEOUT 3 diff --git a/apps/er-coap/er-coap-engine.c b/apps/er-coap/er-coap-engine.c index b45a3c3f4..3a7af5e5f 100644 --- a/apps/er-coap/er-coap-engine.c +++ b/apps/er-coap/er-coap-engine.c @@ -40,9 +40,6 @@ #include #include #include "er-coap-engine.h" -#ifdef WITH_DTLS -#include "er-dtls.h" -#endif #define DEBUG 0 #if DEBUG @@ -86,18 +83,8 @@ coap_receive(void) PRINTF(":%u\n Length: %u\n", uip_ntohs(UIP_UDP_BUF->srcport), uip_datalen()); -#ifdef WITH_DTLS - CoapData_t coapdata = { 0, NULL, 0 }; - dtls_parse_message(uip_appdata, uip_datalen(), &coapdata); - if(!coapdata.valid) { - return NO_ERROR; - } - erbium_status_code = - coap_parse_message(message, coapdata.data, coapdata.data_len); -#else erbium_status_code = coap_parse_message(message, uip_appdata, uip_datalen()); -#endif if(erbium_status_code == NO_ERROR) { @@ -337,15 +324,9 @@ extern resource_t res_dtls; PROCESS_THREAD(coap_engine, ev, data) { PROCESS_BEGIN(); -#ifdef WITH_DTLS - aes_init(); -#endif PRINTF("Starting %s receiver...\n", coap_rest_implementation.name); rest_activate_resource(&res_well_known_core, ".well-known/core"); -#ifdef WITH_DTLS - rest_activate_resource(&res_dtls, "dtls"); -#endif coap_register_as_transaction_handler(); coap_init_connection(SERVER_LISTEN_PORT); diff --git a/apps/er-coap/er-coap.c b/apps/er-coap/er-coap.c index dbcdbbb7f..f73b04186 100644 --- a/apps/er-coap/er-coap.c +++ b/apps/er-coap/er-coap.c @@ -331,8 +331,10 @@ coap_serialize_message(void *packet, uint8_t *buffer) /* empty packet, dont need to do more stuff */ if(!coap_pkt->code) { + PRINTF("-Done serializing empty message at %p-\n", option); return 4; } + /* set Token */ PRINTF("Token (len %u)", coap_pkt->token_len); option = coap_pkt->buffer + COAP_HEADER_LEN; @@ -423,11 +425,8 @@ coap_send_message(uip_ipaddr_t *addr, uint16_t port, uint8_t *data, uip_ipaddr_copy(&udp_conn->ripaddr, addr); udp_conn->rport = port; -#ifdef WITH_DTLS - dtls_send_message(udp_conn, data, length); -#else uip_udp_packet_send(udp_conn, data, length); -#endif + PRINTF("-sent UDP datagram (%u)-\n", length); /* restore server socket to allow data from any node */ @@ -1040,8 +1039,8 @@ coap_get_header_block2(void *packet, uint32_t *num, uint8_t *more, if(!IS_OPTION(coap_pkt, COAP_OPTION_BLOCK2)) { return 0; - /* pointers may be NULL to get only specific block parameters */ } + /* pointers may be NULL to get only specific block parameters */ if(num != NULL) { *num = coap_pkt->block2_num; } @@ -1087,8 +1086,8 @@ coap_get_header_block1(void *packet, uint32_t *num, uint8_t *more, if(!IS_OPTION(coap_pkt, COAP_OPTION_BLOCK1)) { return 0; - /* pointers may be NULL to get only specific block parameters */ } + /* pointers may be NULL to get only specific block parameters */ if(num != NULL) { *num = coap_pkt->block1_num; } diff --git a/apps/er-coap/er-coap.h b/apps/er-coap/er-coap.h index 53eb39f2e..e74e521d2 100644 --- a/apps/er-coap/er-coap.h +++ b/apps/er-coap/er-coap.h @@ -59,10 +59,10 @@ #define COAP_MAX_BLOCK_SIZE (REST_MAX_CHUNK_SIZE < 32 ? 16 : \ (REST_MAX_CHUNK_SIZE < 64 ? 32 : \ (REST_MAX_CHUNK_SIZE < 128 ? 64 : \ - (REST_MAX_CHUNK_SIZE < 256 ? 128 : \ - (REST_MAX_CHUNK_SIZE < 512 ? 256 : \ - (REST_MAX_CHUNK_SIZE < 1024 ? 512 : \ - (REST_MAX_CHUNK_SIZE < 2048 ? 1024 : 2048))))))) + (REST_MAX_CHUNK_SIZE < 256 ? 128 : \ + (REST_MAX_CHUNK_SIZE < 512 ? 256 : \ + (REST_MAX_CHUNK_SIZE < 1024 ? 512 : \ + (REST_MAX_CHUNK_SIZE < 2048 ? 1024 : 2048))))))) #endif /* COAP_MAX_BLOCK_SIZE */ /* direct access into the buffer */