net/gcoap: make input parameters const

This commit is contained in:
Hauke Petersen 2017-05-26 16:34:40 +02:00
parent 3b7252c7de
commit bb90e293a2
2 changed files with 14 additions and 10 deletions

View File

@ -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 length of the packet
* @return 0 if cannot send * @return 0 if cannot send
*/ */
size_t gcoap_req_send2(uint8_t *buf, size_t len, sock_udp_ep_t *remote, size_t gcoap_req_send2(const uint8_t *buf, size_t len,
gcoap_resp_handler_t resp_handler); 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. * @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 length of the packet
* @return 0 if cannot send * @return 0 if cannot send
*/ */
size_t gcoap_req_send(uint8_t *buf, size_t len, ipv6_addr_t *addr, uint16_t port, size_t gcoap_req_send(const uint8_t *buf, size_t len, const ipv6_addr_t *addr,
gcoap_resp_handler_t resp_handler); uint16_t port, gcoap_resp_handler_t resp_handler);
/** /**
* @brief Initializes a CoAP response packet on a buffer. * @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 length of the packet
* @return 0 if cannot send * @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. * @brief Provides important operational statistics.

View File

@ -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); 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, size_t gcoap_req_send(const uint8_t *buf, size_t len, const ipv6_addr_t *addr,
gcoap_resp_handler_t resp_handler) uint16_t port, gcoap_resp_handler_t resp_handler)
{ {
sock_udp_ep_t remote; 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); 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, size_t gcoap_req_send2(const uint8_t *buf, size_t len,
gcoap_resp_handler_t resp_handler) const sock_udp_ep_t *remote,
gcoap_resp_handler_t resp_handler)
{ {
gcoap_request_memo_t *memo = NULL; gcoap_request_memo_t *memo = NULL;
assert(remote != 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; gcoap_observe_memo_t *memo = NULL;