Removed references to missing DTLS implementation.
This commit is contained in:
parent
ee493dd6af
commit
969d512546
|
@ -39,11 +39,7 @@
|
||||||
#ifndef ER_COAP_CONSTANTS_H_
|
#ifndef ER_COAP_CONSTANTS_H_
|
||||||
#define ER_COAP_CONSTANTS_H_
|
#define ER_COAP_CONSTANTS_H_
|
||||||
|
|
||||||
#ifdef WITH_DTLS
|
|
||||||
#define COAP_DEFAULT_PORT 5684
|
|
||||||
#else
|
|
||||||
#define COAP_DEFAULT_PORT 5683
|
#define COAP_DEFAULT_PORT 5683
|
||||||
#endif
|
|
||||||
|
|
||||||
#define COAP_DEFAULT_MAX_AGE 60
|
#define COAP_DEFAULT_MAX_AGE 60
|
||||||
#define COAP_RESPONSE_TIMEOUT 3
|
#define COAP_RESPONSE_TIMEOUT 3
|
||||||
|
|
|
@ -40,9 +40,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "er-coap-engine.h"
|
#include "er-coap-engine.h"
|
||||||
#ifdef WITH_DTLS
|
|
||||||
#include "er-dtls.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DEBUG 0
|
#define DEBUG 0
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
@ -86,18 +83,8 @@ coap_receive(void)
|
||||||
PRINTF(":%u\n Length: %u\n", uip_ntohs(UIP_UDP_BUF->srcport),
|
PRINTF(":%u\n Length: %u\n", uip_ntohs(UIP_UDP_BUF->srcport),
|
||||||
uip_datalen());
|
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 =
|
erbium_status_code =
|
||||||
coap_parse_message(message, uip_appdata, uip_datalen());
|
coap_parse_message(message, uip_appdata, uip_datalen());
|
||||||
#endif
|
|
||||||
|
|
||||||
if(erbium_status_code == NO_ERROR) {
|
if(erbium_status_code == NO_ERROR) {
|
||||||
|
|
||||||
|
@ -337,15 +324,9 @@ extern resource_t res_dtls;
|
||||||
PROCESS_THREAD(coap_engine, ev, data)
|
PROCESS_THREAD(coap_engine, ev, data)
|
||||||
{
|
{
|
||||||
PROCESS_BEGIN();
|
PROCESS_BEGIN();
|
||||||
#ifdef WITH_DTLS
|
|
||||||
aes_init();
|
|
||||||
#endif
|
|
||||||
PRINTF("Starting %s receiver...\n", coap_rest_implementation.name);
|
PRINTF("Starting %s receiver...\n", coap_rest_implementation.name);
|
||||||
|
|
||||||
rest_activate_resource(&res_well_known_core, ".well-known/core");
|
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_register_as_transaction_handler();
|
||||||
coap_init_connection(SERVER_LISTEN_PORT);
|
coap_init_connection(SERVER_LISTEN_PORT);
|
||||||
|
|
|
@ -331,8 +331,10 @@ coap_serialize_message(void *packet, uint8_t *buffer)
|
||||||
|
|
||||||
/* empty packet, dont need to do more stuff */
|
/* empty packet, dont need to do more stuff */
|
||||||
if(!coap_pkt->code) {
|
if(!coap_pkt->code) {
|
||||||
|
PRINTF("-Done serializing empty message at %p-\n", option);
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set Token */
|
/* set Token */
|
||||||
PRINTF("Token (len %u)", coap_pkt->token_len);
|
PRINTF("Token (len %u)", coap_pkt->token_len);
|
||||||
option = coap_pkt->buffer + COAP_HEADER_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);
|
uip_ipaddr_copy(&udp_conn->ripaddr, addr);
|
||||||
udp_conn->rport = port;
|
udp_conn->rport = port;
|
||||||
|
|
||||||
#ifdef WITH_DTLS
|
|
||||||
dtls_send_message(udp_conn, data, length);
|
|
||||||
#else
|
|
||||||
uip_udp_packet_send(udp_conn, data, length);
|
uip_udp_packet_send(udp_conn, data, length);
|
||||||
#endif
|
|
||||||
PRINTF("-sent UDP datagram (%u)-\n", length);
|
PRINTF("-sent UDP datagram (%u)-\n", length);
|
||||||
|
|
||||||
/* restore server socket to allow data from any node */
|
/* 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)) {
|
if(!IS_OPTION(coap_pkt, COAP_OPTION_BLOCK2)) {
|
||||||
return 0;
|
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) {
|
if(num != NULL) {
|
||||||
*num = coap_pkt->block2_num;
|
*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)) {
|
if(!IS_OPTION(coap_pkt, COAP_OPTION_BLOCK1)) {
|
||||||
return 0;
|
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) {
|
if(num != NULL) {
|
||||||
*num = coap_pkt->block1_num;
|
*num = coap_pkt->block1_num;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,10 +59,10 @@
|
||||||
#define COAP_MAX_BLOCK_SIZE (REST_MAX_CHUNK_SIZE < 32 ? 16 : \
|
#define COAP_MAX_BLOCK_SIZE (REST_MAX_CHUNK_SIZE < 32 ? 16 : \
|
||||||
(REST_MAX_CHUNK_SIZE < 64 ? 32 : \
|
(REST_MAX_CHUNK_SIZE < 64 ? 32 : \
|
||||||
(REST_MAX_CHUNK_SIZE < 128 ? 64 : \
|
(REST_MAX_CHUNK_SIZE < 128 ? 64 : \
|
||||||
(REST_MAX_CHUNK_SIZE < 256 ? 128 : \
|
(REST_MAX_CHUNK_SIZE < 256 ? 128 : \
|
||||||
(REST_MAX_CHUNK_SIZE < 512 ? 256 : \
|
(REST_MAX_CHUNK_SIZE < 512 ? 256 : \
|
||||||
(REST_MAX_CHUNK_SIZE < 1024 ? 512 : \
|
(REST_MAX_CHUNK_SIZE < 1024 ? 512 : \
|
||||||
(REST_MAX_CHUNK_SIZE < 2048 ? 1024 : 2048)))))))
|
(REST_MAX_CHUNK_SIZE < 2048 ? 1024 : 2048)))))))
|
||||||
#endif /* COAP_MAX_BLOCK_SIZE */
|
#endif /* COAP_MAX_BLOCK_SIZE */
|
||||||
|
|
||||||
/* direct access into the buffer */
|
/* direct access into the buffer */
|
||||||
|
|
Loading…
Reference in a new issue