Fix bug in setting the OpenSSL log level make its use consistent with tinydtls

Rename session.c and session.h to coap_session.c and coap_session.h
Use length to PSK hint and identity
Improve packet loss testing
This commit is contained in:
jcmichelou committed 2017-06-22 16:02:03 +02:00
1 parent 99925a1a97
commit 9490a0c8ab
16 files changed
+1396 -1355

No files matched your search

+1 -1
View File
@@ -11,7 +11,7 @@
#define _COAP_DTLS_H_
#include "net.h"
#include "session.h"
#include "coap_session.h"
#include "pdu.h"
/**
@@ -1,4 +1,4 @@
/* session.h -- Session management for libcoap
/* coap_session.h -- Session management for libcoap
*
* Copyright (C) 2017 Jean-Claue Michelou <jcm@spinetix.com>
*
@@ -61,9 +61,10 @@ typedef struct coap_session_t {
struct coap_context_t *context; /**< session's context */
void *tls; /**< security parameters */
coap_pdu_queue_t *sendqueue; /**< list of messages waiting to be sent */
char *psk_identity;
uint8_t *psk_identity;
size_t psk_identity_len;
uint8_t *psk_key;
unsigned psk_key_len;
size_t psk_key_len;
} coap_session_t;
/**
+2 -2
View File
@@ -69,7 +69,7 @@ void coap_show_pdu(const coap_pdu_t *);
struct coap_address_t;
size_t coap_print_addr(const struct coap_address_t *, unsigned char *, size_t);
void coap_debug_set_packet_loss( const char *loss_level );
int coap_debug_send_packet();
int coap_debug_set_packet_loss(const char *loss_level);
int coap_debug_send_packet(void);
#endif /* _COAP_DEBUG_H_ */
+7 -6
View File
@@ -29,7 +29,7 @@
#include "option.h"
#include "pdu.h"
#include "prng.h"
#include "session.h"
#include "coap_session.h"
struct coap_queue_t;
@@ -131,14 +131,15 @@ typedef struct coap_context_t {
ssize_t (*network_read)(coap_socket_t *sock, struct coap_packet_t **packet);
unsigned (*get_client_psk)( const coap_session_t *session, const char *hint, char *identity, unsigned max_identity_len, uint8_t *psk, unsigned max_psk_len );
unsigned (*get_server_psk)( const coap_session_t *session, const char *identity, uint8_t *psk, unsigned max_psk_len );
int (*get_server_hint)( const coap_session_t *session, char *hint, unsigned max_hint_len );
size_t(*get_client_psk)(const coap_session_t *session, const uint8_t *hint, size_t hint_len, uint8_t *identity, size_t *identity_len, size_t max_identity_len, uint8_t *psk, size_t max_psk_len);
size_t(*get_server_psk)(const coap_session_t *session, const uint8_t *identity, size_t identity_len, uint8_t *psk, size_t max_psk_len);
size_t(*get_server_hint)(const coap_session_t *session, uint8_t *hint, size_t max_hint_len);
void *dtls_context;
char *psk_hint;
uint8_t *psk_hint;
size_t psk_hint_len;
uint8_t *psk_key;
unsigned psk_key_len;
size_t psk_key_len;
void *app; /**< application-specific data */
} coap_context_t;