From bb90e293a2713632be6a06c767208fa08b94b467 Mon Sep 17 00:00:00 2001 From: Hauke Petersen Date: Fri, 26 May 2017 16:34:40 +0200 Subject: [PATCH] net/gcoap: make input parameters const --- sys/include/net/gcoap.h | 12 +++++++----- sys/net/application_layer/coap/gcoap.c | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/sys/include/net/gcoap.h b/sys/include/net/gcoap.h index e91748d11..bd475c74c 100644 --- a/sys/include/net/gcoap.h +++ b/sys/include/net/gcoap.h @@ -472,8 +472,9 @@ static inline ssize_t gcoap_request(coap_pkt_t *pdu, uint8_t *buf, size_t len, * @return length of the packet * @return 0 if cannot send */ -size_t gcoap_req_send2(uint8_t *buf, size_t len, sock_udp_ep_t *remote, - gcoap_resp_handler_t resp_handler); +size_t gcoap_req_send2(const uint8_t *buf, size_t len, + const sock_udp_ep_t *remote, + gcoap_resp_handler_t resp_handler); /** * @brief Sends a buffer containing a CoAP request to the provided host/port. @@ -489,8 +490,8 @@ size_t gcoap_req_send2(uint8_t *buf, size_t len, sock_udp_ep_t *remote, * @return length of the packet * @return 0 if cannot send */ -size_t gcoap_req_send(uint8_t *buf, size_t len, ipv6_addr_t *addr, uint16_t port, - gcoap_resp_handler_t resp_handler); +size_t gcoap_req_send(const uint8_t *buf, size_t len, const ipv6_addr_t *addr, + uint16_t port, gcoap_resp_handler_t resp_handler); /** * @brief Initializes a CoAP response packet on a buffer. @@ -557,7 +558,8 @@ int gcoap_obs_init(coap_pkt_t *pdu, uint8_t *buf, size_t len, * @return length of the packet * @return 0 if cannot send */ -size_t gcoap_obs_send(uint8_t *buf, size_t len, const coap_resource_t *resource); +size_t gcoap_obs_send(const uint8_t *buf, size_t len, + const coap_resource_t *resource); /** * @brief Provides important operational statistics. diff --git a/sys/net/application_layer/coap/gcoap.c b/sys/net/application_layer/coap/gcoap.c index 3e518bc5d..d441820f9 100644 --- a/sys/net/application_layer/coap/gcoap.c +++ b/sys/net/application_layer/coap/gcoap.c @@ -661,8 +661,8 @@ ssize_t gcoap_finish(coap_pkt_t *pdu, size_t payload_len, unsigned format) return _finish_pdu(pdu, (uint8_t *)pdu->hdr, len); } -size_t gcoap_req_send(uint8_t *buf, size_t len, ipv6_addr_t *addr, uint16_t port, - gcoap_resp_handler_t resp_handler) +size_t gcoap_req_send(const uint8_t *buf, size_t len, const ipv6_addr_t *addr, + uint16_t port, gcoap_resp_handler_t resp_handler) { sock_udp_ep_t remote; @@ -675,8 +675,9 @@ size_t gcoap_req_send(uint8_t *buf, size_t len, ipv6_addr_t *addr, uint16_t port return gcoap_req_send2(buf, len, &remote, resp_handler); } -size_t gcoap_req_send2(uint8_t *buf, size_t len, sock_udp_ep_t *remote, - gcoap_resp_handler_t resp_handler) +size_t gcoap_req_send2(const uint8_t *buf, size_t len, + const sock_udp_ep_t *remote, + gcoap_resp_handler_t resp_handler) { gcoap_request_memo_t *memo = NULL; assert(remote != NULL); @@ -775,7 +776,8 @@ int gcoap_obs_init(coap_pkt_t *pdu, uint8_t *buf, size_t len, } } -size_t gcoap_obs_send(uint8_t *buf, size_t len, const coap_resource_t *resource) +size_t gcoap_obs_send(const uint8_t *buf, size_t len, + const coap_resource_t *resource) { gcoap_observe_memo_t *memo = NULL;