diff --git a/sys/include/net/coap.h b/sys/include/net/coap.h index 8b5816a4df..f2322f49aa 100644 --- a/sys/include/net/coap.h +++ b/sys/include/net/coap.h @@ -180,11 +180,11 @@ extern "C" { * This value is for the response to the *initial* confirmable message. The * timeout doubles for subsequent retries. To avoid synchronization of resends * across hosts, the actual timeout is chosen randomly between - * @ref COAP_ACK_TIMEOUT and - * (@ref COAP_ACK_TIMEOUT * @ref COAP_RANDOM_FACTOR_1000 / 1000). + * @ref CONFIG_COAP_ACK_TIMEOUT and + * (@ref CONFIG_COAP_ACK_TIMEOUT * @ref COAP_RANDOM_FACTOR_1000 / 1000). */ -#ifndef COAP_ACK_TIMEOUT -#define COAP_ACK_TIMEOUT (2U) +#ifndef CONFIG_COAP_ACK_TIMEOUT +#define CONFIG_COAP_ACK_TIMEOUT (2U) #endif /** @@ -194,7 +194,7 @@ extern "C" { * ([RFC 7252, section 4.2](https://tools.ietf.org/html/rfc7252#section-4.2)) * multiplied by 1000, to avoid floating point arithmetic. * - * See @ref COAP_ACK_TIMEOUT + * See @ref CONFIG_COAP_ACK_TIMEOUT */ #ifndef COAP_RANDOM_FACTOR_1000 #define COAP_RANDOM_FACTOR_1000 (1500) diff --git a/sys/include/net/gcoap.h b/sys/include/net/gcoap.h index d2c104a65e..896cfe346b 100644 --- a/sys/include/net/gcoap.h +++ b/sys/include/net/gcoap.h @@ -517,7 +517,7 @@ extern "C" { * In normal operations the timeout between retransmissions doubles. When * CONFIG_GCOAP_NO_RETRANS_BACKOFF is defined this doubling does not happen. * - * @see COAP_ACK_TIMEOUT + * @see CONFIG_COAP_ACK_TIMEOUT */ #define CONFIG_GCOAP_NO_RETRANS_BACKOFF #endif diff --git a/sys/net/application_layer/gcoap/gcoap.c b/sys/net/application_layer/gcoap/gcoap.c index 5c3bd4ba9b..13137afe71 100644 --- a/sys/net/application_layer/gcoap/gcoap.c +++ b/sys/net/application_layer/gcoap/gcoap.c @@ -42,7 +42,7 @@ #define GCOAP_RESOURCE_NO_PATH -2 /* End of the range to pick a random timeout */ -#define TIMEOUT_RANGE_END (COAP_ACK_TIMEOUT * COAP_RANDOM_FACTOR_1000 / 1000) +#define TIMEOUT_RANGE_END (CONFIG_COAP_ACK_TIMEOUT * COAP_RANDOM_FACTOR_1000 / 1000) /* Internal functions */ static void *_event_loop(void *arg); @@ -249,7 +249,7 @@ static void _on_resp_timeout(void *arg) { #else unsigned i = COAP_MAX_RETRANSMIT - memo->send_limit; #endif - uint32_t timeout = ((uint32_t)COAP_ACK_TIMEOUT << i) * US_PER_SEC; + uint32_t timeout = ((uint32_t)CONFIG_COAP_ACK_TIMEOUT << i) * US_PER_SEC; #if COAP_RANDOM_FACTOR_1000 > 1000 uint32_t end = ((uint32_t)TIMEOUT_RANGE_END << i) * US_PER_SEC; timeout = random_uint32_range(timeout, end); @@ -773,7 +773,7 @@ size_t gcoap_req_send(const uint8_t *buf, size_t len, } if (memo->msg.data.pdu_buf) { memo->send_limit = COAP_MAX_RETRANSMIT; - timeout = (uint32_t)COAP_ACK_TIMEOUT * US_PER_SEC; + timeout = (uint32_t)CONFIG_COAP_ACK_TIMEOUT * US_PER_SEC; #if COAP_RANDOM_FACTOR_1000 > 1000 timeout = random_uint32_range(timeout, TIMEOUT_RANGE_END * US_PER_SEC); #endif diff --git a/sys/net/application_layer/nanocoap/sock.c b/sys/net/application_layer/nanocoap/sock.c index 82bad67e2b..bfd4fcc4c9 100644 --- a/sys/net/application_layer/nanocoap/sock.c +++ b/sys/net/application_layer/nanocoap/sock.c @@ -48,7 +48,7 @@ ssize_t nanocoap_request(coap_pkt_t *pkt, sock_udp_ep_t *local, sock_udp_ep_t *r /* TODO: timeout random between between ACK_TIMEOUT and (ACK_TIMEOUT * * ACK_RANDOM_FACTOR) */ - uint32_t timeout = COAP_ACK_TIMEOUT * US_PER_SEC; + uint32_t timeout = CONFIG_COAP_ACK_TIMEOUT * US_PER_SEC; unsigned tries_left = COAP_MAX_RETRANSMIT + 1; /* add 1 for initial transmit */ while (tries_left) { diff --git a/sys/suit/transport/coap.c b/sys/suit/transport/coap.c index ed710afd0a..18fbcddc14 100644 --- a/sys/suit/transport/coap.c +++ b/sys/suit/transport/coap.c @@ -136,7 +136,7 @@ static ssize_t _nanocoap_request(sock_udp_t *sock, coap_pkt_t *pkt, size_t len) /* TODO: timeout random between between ACK_TIMEOUT and (ACK_TIMEOUT * * ACK_RANDOM_FACTOR) */ - uint32_t timeout = COAP_ACK_TIMEOUT * US_PER_SEC; + uint32_t timeout = CONFIG_COAP_ACK_TIMEOUT * US_PER_SEC; uint32_t deadline = deadline_from_interval(timeout); /* add 1 for initial transmit */