Skip to content

Commit 15889cb

Browse files
author
Arto Kinnunen
committed
Use Mbed OS coding style
Use astyle 3.1 with aastylerc from Mbed OS. astyle updates
1 parent d6eff5c commit 15889cb

File tree

5 files changed

+24
-23
lines changed

5 files changed

+24
-23
lines changed

source/coap_connection_handler.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,12 +1039,12 @@ int coap_connection_handler_msg_prevalidate_callback_set(coap_conn_handler_t *ha
10391039

10401040
coap_conn_handler_t *coap_connection_handler_find_by_socket_port(uint16_t listen_port)
10411041
{
1042-
ns_list_foreach(internal_socket_t, cur_ptr, &socket_list) {
1043-
if (cur_ptr->listen_port == listen_port) {
1044-
return cur_ptr->parent;
1045-
}
1046-
}
1047-
return NULL;
1042+
ns_list_foreach(internal_socket_t, cur_ptr, &socket_list) {
1043+
if (cur_ptr->listen_port == listen_port) {
1044+
return cur_ptr->parent;
1045+
}
1046+
}
1047+
return NULL;
10481048
}
10491049

10501050
cch_func_cb *coap_connection_handler_msg_prevalidate_callback_get(coap_conn_handler_t *handler, uint16_t *listen_socket_port)

source/coap_service_api.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#include "coap_message_handler.h"
3737
#include "mbed-coap/sn_coap_protocol.h"
3838

39-
static int16_t coap_msg_process_callback(int8_t socket_id, int8_t recv_if_id, sn_coap_hdr_s *coap_message, coap_transaction_t *transaction_ptr, const uint8_t * local_addr);
39+
static int16_t coap_msg_process_callback(int8_t socket_id, int8_t recv_if_id, sn_coap_hdr_s *coap_message, coap_transaction_t *transaction_ptr, const uint8_t *local_addr);
4040

4141
typedef struct uri_registration {
4242
char *uri_ptr;
@@ -218,7 +218,7 @@ static void service_event_handler(arm_event_s *event)
218218
eventOS_event_timer_request((uint8_t)COAP_TICK_TIMER, ARM_LIB_SYSTEM_TIMER_EVENT, tasklet_id, 1000);
219219
}
220220

221-
static int16_t coap_msg_process_callback(int8_t socket_id, int8_t recv_if_id, sn_coap_hdr_s *coap_message, coap_transaction_t *transaction_ptr, const uint8_t * local_addr)
221+
static int16_t coap_msg_process_callback(int8_t socket_id, int8_t recv_if_id, sn_coap_hdr_s *coap_message, coap_transaction_t *transaction_ptr, const uint8_t *local_addr)
222222
{
223223
coap_service_t *this;
224224
coap_service_msg_prevalidate_cb *msg_prevalidate_callback;
@@ -239,14 +239,14 @@ static int16_t coap_msg_process_callback(int8_t socket_id, int8_t recv_if_id, sn
239239
}
240240
}
241241

242-
msg_prevalidate_callback = (coap_service_msg_prevalidate_cb*)coap_connection_handler_msg_prevalidate_callback_get(this->conn_handler, &listen_socket_port);
242+
msg_prevalidate_callback = (coap_service_msg_prevalidate_cb *)coap_connection_handler_msg_prevalidate_callback_get(this->conn_handler, &listen_socket_port);
243243
if (msg_prevalidate_callback) {
244244
// message prevalidation activated for the port
245245
char request_uri[coap_message->uri_path_len + 1];
246246
memcpy(request_uri, coap_message->uri_path_ptr, coap_message->uri_path_len);
247247
request_uri[coap_message->uri_path_len] = 0;
248248

249-
int msg_prevalidate_status = msg_prevalidate_callback(this->interface_id, (uint8_t*)local_addr, listen_socket_port, recv_if_id, transaction_ptr->remote_address, transaction_ptr->remote_port, request_uri);
249+
int msg_prevalidate_status = msg_prevalidate_callback(this->interface_id, (uint8_t *)local_addr, listen_socket_port, recv_if_id, transaction_ptr->remote_address, transaction_ptr->remote_port, request_uri);
250250
if (msg_prevalidate_status >= 1) {
251251
tr_deep("Drop CoAP msg %s from %s to %s", request_uri, trace_ipv6(transaction_ptr->remote_address), trace_ipv6(local_addr));
252252
return -1;
@@ -664,7 +664,7 @@ int8_t coap_service_msg_prevalidate_callback_set(uint16_t listen_socket, coap_se
664664
{
665665
coap_conn_handler_t *conn_handler = coap_connection_handler_find_by_socket_port(listen_socket);
666666
if (conn_handler) {
667-
return (int8_t)coap_connection_handler_msg_prevalidate_callback_set(conn_handler, (cch_func_cb*)msg_prevalidate_cb);
667+
return (int8_t)coap_connection_handler_msg_prevalidate_callback_set(conn_handler, (cch_func_cb *)msg_prevalidate_cb);
668668
}
669669
return -1;
670670
}

source/include/coap_message_handler.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ typedef struct coap_transaction {
8585
*
8686
* \return 0 for success / -1 for failure
8787
*/
88-
typedef int16_t coap_msg_process_cb(int8_t socket_id, int8_t recv_if_id, sn_coap_hdr_s *coap_message, coap_transaction_t *transaction_ptr, const uint8_t * local_addr);
88+
typedef int16_t coap_msg_process_cb(int8_t socket_id, int8_t recv_if_id, sn_coap_hdr_s *coap_message, coap_transaction_t *transaction_ptr, const uint8_t *local_addr);
8989

9090
extern coap_msg_handler_t *coap_message_handler_init(void *(*used_malloc_func_ptr)(uint16_t), void (*used_free_func_ptr)(void *),
9191
uint8_t (*used_tx_callback_ptr)(uint8_t *, uint16_t, sn_nsdl_addr_s *, void *));
@@ -97,7 +97,7 @@ extern coap_transaction_t *coap_message_handler_transaction_valid(coap_transacti
9797
extern coap_transaction_t *coap_message_handler_find_transaction(uint8_t *address_ptr, uint16_t port);
9898

9999
extern int16_t coap_message_handler_coap_msg_process(coap_msg_handler_t *handle, int8_t socket_id, int8_t recv_if_id, const uint8_t source_addr_ptr[static 16], uint16_t port,
100-
const uint8_t dst_addr_ptr[static 16], uint8_t *data_ptr, uint16_t data_len, coap_msg_process_cb *msg_process_callback);
100+
const uint8_t dst_addr_ptr[static 16], uint8_t *data_ptr, uint16_t data_len, coap_msg_process_cb *msg_process_callback);
101101

102102
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],
103103
uint16_t destination_port, sn_coap_msg_type_e msg_type, sn_coap_msg_code_e msg_code, const char *uri, sn_coap_content_format_e cont_type,

test/coap-service/unittest/stub/coap_message_handler_stub.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ coap_transaction_t *coap_message_handler_find_transaction(uint8_t *address_ptr,
5656
}
5757

5858
extern int16_t coap_message_handler_coap_msg_process(coap_msg_handler_t *handle, int8_t socket_id, int8_t recv_if_id, const uint8_t source_addr_ptr[static 16], uint16_t port,
59-
const uint8_t dst_addr_ptr[static 16], uint8_t *data_ptr, uint16_t data_len, coap_msg_process_cb *msg_process_callback)
59+
const uint8_t dst_addr_ptr[static 16], uint8_t *data_ptr, uint16_t data_len, coap_msg_process_cb *msg_process_callback)
6060
{
6161
coap_message_handler_stub.msg_process_cb = msg_process_callback;
6262
return coap_message_handler_stub.int16_value;

test/coap-service/unittest/stub/mbedtls_stub.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ void mbedtls_ssl_conf_max_version(mbedtls_ssl_config *conf, int major, int minor
5959

6060
}
6161

62-
void mbedtls_ssl_conf_transport( mbedtls_ssl_config *conf, int transport )
62+
void mbedtls_ssl_conf_transport(mbedtls_ssl_config *conf, int transport)
6363
{
6464

6565
}
6666

67-
void mbedtls_ssl_config_init( mbedtls_ssl_config *a )
67+
void mbedtls_ssl_config_init(mbedtls_ssl_config *a)
6868
{
6969

7070
}
@@ -203,12 +203,12 @@ int mbedtls_ssl_write(mbedtls_ssl_context *a, const unsigned char *b, size_t c)
203203
return mbedtls_stub.expected_int;
204204
}
205205

206-
int mbedtls_ssl_set_hostname( mbedtls_ssl_context *ssl, const char *hostname )
206+
int mbedtls_ssl_set_hostname(mbedtls_ssl_context *ssl, const char *hostname)
207207
{
208208
return 0;
209209
}
210210

211-
const mbedtls_x509_crt *mbedtls_ssl_get_peer_cert( const mbedtls_ssl_context *ssl )
211+
const mbedtls_x509_crt *mbedtls_ssl_get_peer_cert(const mbedtls_ssl_context *ssl)
212212
{
213213
return NULL;
214214
}
@@ -267,14 +267,14 @@ int mbedtls_x509_crt_parse(mbedtls_x509_crt *a, const unsigned char *b, size_t c
267267
return mbedtls_stub.expected_int;
268268
}
269269

270-
int mbedtls_x509_crt_info( char *buf, size_t size, const char *prefix,
271-
const mbedtls_x509_crt *crt )
270+
int mbedtls_x509_crt_info(char *buf, size_t size, const char *prefix,
271+
const mbedtls_x509_crt *crt)
272272
{
273273
return 0;
274274
}
275275

276-
int mbedtls_x509_crt_verify_info( char *buf, size_t size, const char *prefix,
277-
uint32_t flags )
276+
int mbedtls_x509_crt_verify_info(char *buf, size_t size, const char *prefix,
277+
uint32_t flags)
278278
{
279279
return 0;
280280
}
@@ -384,5 +384,6 @@ int mbedtls_ssl_session_reset(mbedtls_ssl_context *ssl)
384384
return mbedtls_stub.expected_int;
385385
}
386386

387-
void mbedtls_strerror( int ret, char *buf, size_t buflen ){
387+
void mbedtls_strerror(int ret, char *buf, size_t buflen)
388+
{
388389
}

0 commit comments

Comments
 (0)