Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/coap/coapclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ static void recv_fn(void*);
#endif
int write_option( uint8_t *buf, uint16_t buf_len, coap_option_t this_option, coap_option_t *last_option,
const uint8_t* option_buf, uint32_t option_len, uint32_t *written_len );
void process_response(uint8_t* data, uint16_t len, struct sockaddr_in6 *from);
void coap_option_map(uint32_t val, uint8_t *map);

int coapclient_stop()
Expand Down Expand Up @@ -264,14 +263,14 @@ static void recv_fn(void* arg)
DPRINTF("coapclient.Socket.recvfrom - Got %u-byte response from ",len);
osal_print_formatted_ip(&from);

process_response(data, len, &from );
coapclient_process_response(data, len, &from );
}
#if defined(OSAL_LINUX)
return NULL;
#endif
}

void process_response(uint8_t* data, uint16_t len, struct sockaddr_in6 *from)
void coapclient_process_response(uint8_t* data, uint16_t len, struct sockaddr_in6 *from)
{
uint8_t* cur = data;
coap_header_t *hdr;
Expand Down
8 changes: 8 additions & 0 deletions src/coap/coapclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,12 @@ int coapclient_request(const osal_sockaddr_t *to,
const coap_uri_seg_t *query, uint32_t query_cnt,
const void *body, uint16_t body_len);

/**
* @brief process a response for the CoAP client
*
* @param data response data
* @param len response data length
* @param from response sender
*/
void coapclient_process_response(uint8_t* data, uint16_t len, struct sockaddr_in6 *from);
#endif
5 changes: 2 additions & 3 deletions src/coap/coapserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ static osal_basetype_t m_sockfd = 0;
static bool m_server_opened = false;
static recv_handler_t m_recv_handler = NULL;

void process_datagram(void *data, uint16_t len, struct sockaddr_in6 *from );
void send_internal_response(const struct sockaddr_in6 *from, uint16_t tx_id,
uint8_t token_length, uint8_t *token, uint16_t status);
#if defined(OSAL_LINUX)
Expand Down Expand Up @@ -129,7 +128,7 @@ static void recv_thread(void* arg)
((uint16_t)from.sin6_addr.s6_addr[14] << 8) | from.sin6_addr.s6_addr[15],
from.sin6_scope_id, ntohs(from.sin6_port));

process_datagram(data, len, &from );
coapserver_process_datagram(data, len, &from );
}
#if defined(OSAL_LINUX)
return NULL;
Expand Down Expand Up @@ -207,7 +206,7 @@ int coapserver_response(const struct sockaddr_in6 *to,
return 0;
}

void process_datagram(void *data, uint16_t len, struct sockaddr_in6 *from )
void coapserver_process_datagram(uint8_t* data, uint16_t len, struct sockaddr_in6 *from )
{
uint8_t* cur = data;
uint16_t buf_used = 0;
Expand Down
8 changes: 8 additions & 0 deletions src/coap/coapserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,12 @@ int coapserver_response(const struct sockaddr_in6 *to,
uint16_t status,
const void* body, uint16_t body_len);

/**
* @brief process a datagram for the CoAP server
*
* @param data datagram data
* @param len datagram data length
* @param from datagram sender
*/
void coapserver_process_datagram(uint8_t* data, uint16_t len, struct sockaddr_in6 *from);
#endif