Removed references to missing DTLS implementation.

This commit is contained in:
Matthias Kovatsch 2014-05-15 19:56:29 +02:00 committed by Matthias Kovatsch
parent ee493dd6af
commit 969d512546
4 changed files with 9 additions and 33 deletions

View File

@ -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

View File

@ -40,9 +40,6 @@
#include <stdlib.h>
#include <string.h>
#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);

View File

@ -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;
}

View File

@ -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 */