Warnings cleaned.

pull/3240/head
Tero Heinonen 2016-01-12 09:59:15 +02:00
parent 6c6e672630
commit 685e08d7d5
5 changed files with 13 additions and 22 deletions

View File

@ -228,7 +228,7 @@ extern int8_t coap_service_unregister_uri(int8_t service_id, const char *uri);
* *
* \return msg_id Id number of the current message. * \return msg_id Id number of the current message.
*/ */
extern uint16_t coap_service_request_send(int8_t service_id, uint8_t options, const uint8_t destination_addr[static 16], uint16_t destination_port, uint8_t msg_type, uint8_t msg_code, const char *uri, extern uint16_t coap_service_request_send(int8_t service_id, uint8_t options, const uint8_t destination_addr[static 16], uint16_t destination_port, sn_coap_msg_type_e msg_type, sn_coap_msg_code_e msg_code, const char *uri,
uint8_t cont_type, const uint8_t *payload_ptr, uint16_t payload_len, coap_service_response_recv *request_response_cb); uint8_t cont_type, const uint8_t *payload_ptr, uint16_t payload_len, coap_service_response_recv *request_response_cb);
/** /**

View File

@ -31,18 +31,6 @@ static void own_free(void *ptr)
static NS_LIST_DEFINE(request_list, coap_transaction_t, link); static NS_LIST_DEFINE(request_list, coap_transaction_t, link);
static coap_transaction_t *transaction_find_client(uint16_t msg_id)
{
coap_transaction_t *this = NULL;
ns_list_foreach(coap_transaction_t, cur_ptr, &request_list) {
if (cur_ptr->msg_id == msg_id && cur_ptr->client_request) {
this = cur_ptr;
break;
}
}
return this;
}
static coap_transaction_t *transaction_find_client_by_token(uint8_t token[4]) static coap_transaction_t *transaction_find_client_by_token(uint8_t token[4])
{ {
coap_transaction_t *this = NULL; coap_transaction_t *this = NULL;
@ -246,7 +234,7 @@ int16_t coap_message_handler_coap_msg_process(coap_msg_handler_t *handle, int8_t
} }
uint16_t coap_message_handler_request_send(coap_msg_handler_t *handle, int8_t service_id, uint8_t options, const uint8_t destination_addr[static 16], uint16_t coap_message_handler_request_send(coap_msg_handler_t *handle, int8_t service_id, uint8_t options, const uint8_t destination_addr[static 16],
uint16_t destination_port, uint8_t msg_type, uint8_t msg_code, const char *uri, uint16_t destination_port, sn_coap_msg_type_e msg_type, sn_coap_msg_code_e msg_code, const char *uri,
uint8_t cont_type, const uint8_t *payload_ptr, uint16_t payload_len, coap_message_handler_response_recv *request_response_cb) uint8_t cont_type, const uint8_t *payload_ptr, uint16_t payload_len, coap_message_handler_response_recv *request_response_cb)
{ {
coap_transaction_t *transaction_ptr; coap_transaction_t *transaction_ptr;
@ -279,7 +267,7 @@ uint16_t coap_message_handler_request_send(coap_msg_handler_t *handle, int8_t se
request.msg_code = msg_code; request.msg_code = msg_code;
request.uri_path_ptr = (uint8_t *)uri; request.uri_path_ptr = (uint8_t *)uri;
request.uri_path_len = strlen(uri); request.uri_path_len = strlen(uri);
coap_service_build_content_format(&request, cont_type); coap_service_build_content_format(&request, (sn_coap_content_format_e)cont_type);
do{ do{
randLIB_get_n_bytes_random(token,4); randLIB_get_n_bytes_random(token,4);
@ -344,7 +332,7 @@ int8_t coap_message_handler_response_send(coap_msg_handler_t *handle, int8_t ser
} }
response->payload_len = payload_len; response->payload_len = payload_len;
response->payload_ptr = (uint8_t *) payload_ptr; // Cast away const and trust that nsdl doesn't modify... response->payload_ptr = (uint8_t *) payload_ptr; // Cast away const and trust that nsdl doesn't modify...
coap_service_build_content_format(response, content_type); coap_service_build_content_format(response, (sn_coap_content_format_e)content_type);
data_len = sn_coap_builder_calc_needed_packet_data_size(response); data_len = sn_coap_builder_calc_needed_packet_data_size(response);
data_ptr = own_alloc(data_len); data_ptr = own_alloc(data_len);

View File

@ -352,10 +352,13 @@ int thread_security_send_close_alert(coap_security_t *sec)
if( !sec ){ if( !sec ){
return -1; return -1;
} }
return mbedtls_ssl_close_notify(&sec->_ssl);
coap_security_handler_reset(sec); if(!mbedtls_ssl_close_notify(&sec->_ssl)){
coap_security_handler_init(sec); coap_security_handler_reset(sec);
coap_security_handler_init(sec);
return 0;
}
return -1;
} }
int coap_security_handler_read(coap_security_t *sec, unsigned char* buffer, size_t len){ int coap_security_handler_read(coap_security_t *sec, unsigned char* buffer, size_t len){
@ -392,7 +395,7 @@ int entropy_poll( void *ctx, unsigned char *output, size_t len,
} }
memset(c, 0, len); memset(c, 0, len);
for(uint16_t i=0; i < len; i++){ for(uint16_t i=0; i < len; i++){
c[i] = (char)randLIB_get_8bit; *(c + 1) = (char)randLIB_get_8bit();
} }
memmove(output, c, len); memmove(output, c, len);
*olen = len; *olen = len;

View File

@ -437,7 +437,7 @@ int8_t coap_service_unregister_uri(int8_t service_id, const char *uri)
return 0; return 0;
} }
uint16_t coap_service_request_send(int8_t service_id, uint8_t options, const uint8_t destination_addr[static 16], uint16_t destination_port, uint8_t msg_type, uint8_t msg_code, const char *uri, uint16_t coap_service_request_send(int8_t service_id, uint8_t options, const uint8_t destination_addr[static 16], uint16_t destination_port, sn_coap_msg_type_e msg_type, sn_coap_msg_code_e msg_code, const char *uri,
uint8_t cont_type, const uint8_t *payload_ptr, uint16_t payload_len, coap_service_response_recv *request_response_cb){ uint8_t cont_type, const uint8_t *payload_ptr, uint16_t payload_len, coap_service_response_recv *request_response_cb){
//TODO: coap_service_response_recv is an ugly cast, this should be refactored away + sn_coap_hdr_s MUST NOT be exposed to users of coap-service! //TODO: coap_service_response_recv is an ugly cast, this should be refactored away + sn_coap_hdr_s MUST NOT be exposed to users of coap-service!
//Callback would be still needed, but where to store callback? //Callback would be still needed, but where to store callback?

View File

@ -57,7 +57,7 @@ extern int16_t coap_message_handler_coap_msg_process(coap_msg_handler_t *handle,
uint8_t *data_ptr, uint16_t data_len, int16_t (cb)(int8_t, sn_coap_hdr_s *, coap_transaction_t *)); uint8_t *data_ptr, uint16_t data_len, int16_t (cb)(int8_t, sn_coap_hdr_s *, coap_transaction_t *));
extern uint16_t coap_message_handler_request_send(coap_msg_handler_t *handle, int8_t service_id, uint8_t options, const uint8_t destination_addr[static 16], extern uint16_t coap_message_handler_request_send(coap_msg_handler_t *handle, int8_t service_id, uint8_t options, const uint8_t destination_addr[static 16],
uint16_t destination_port, uint8_t msg_type, uint8_t msg_code, const char *uri, uint8_t cont_type, uint16_t destination_port, sn_coap_msg_type_e msg_type, sn_coap_msg_code_e msg_code, const char *uri, uint8_t cont_type,
const uint8_t *payload_ptr, uint16_t payload_len, coap_message_handler_response_recv *request_response_cb); const uint8_t *payload_ptr, uint16_t payload_len, coap_message_handler_response_recv *request_response_cb);
extern int8_t coap_message_handler_response_send(coap_msg_handler_t *handle, int8_t service_id, uint8_t options, sn_coap_hdr_s *request_ptr, sn_coap_msg_code_e message_code, extern int8_t coap_message_handler_response_send(coap_msg_handler_t *handle, int8_t service_id, uint8_t options, sn_coap_hdr_s *request_ptr, sn_coap_msg_code_e message_code,