1c87c5fbaSopenharmony_ci// -*- mode:doc; -*-
2c87c5fbaSopenharmony_ci// vim: set syntax=asciidoc tw=0
3c87c5fbaSopenharmony_ci
4c87c5fbaSopenharmony_cicoap_recovery(3)
5c87c5fbaSopenharmony_ci================
6c87c5fbaSopenharmony_ci:doctype: manpage
7c87c5fbaSopenharmony_ci:man source:   coap_recovery
8c87c5fbaSopenharmony_ci:man version:  @PACKAGE_VERSION@
9c87c5fbaSopenharmony_ci:man manual:   libcoap Manual
10c87c5fbaSopenharmony_ci
11c87c5fbaSopenharmony_ciNAME
12c87c5fbaSopenharmony_ci----
13c87c5fbaSopenharmony_cicoap_recovery,
14c87c5fbaSopenharmony_cicoap_session_set_ack_random_factor,
15c87c5fbaSopenharmony_cicoap_session_get_ack_random_factor,
16c87c5fbaSopenharmony_cicoap_session_set_ack_timeout,
17c87c5fbaSopenharmony_cicoap_session_get_ack_timeout,
18c87c5fbaSopenharmony_cicoap_session_set_default_leisure,
19c87c5fbaSopenharmony_cicoap_session_get_default_leisure,
20c87c5fbaSopenharmony_cicoap_session_set_max_payloads,
21c87c5fbaSopenharmony_cicoap_session_get_max_payloads,
22c87c5fbaSopenharmony_cicoap_session_set_max_retransmit,
23c87c5fbaSopenharmony_cicoap_session_get_max_retransmit,
24c87c5fbaSopenharmony_cicoap_session_set_non_max_retransmit,
25c87c5fbaSopenharmony_cicoap_session_get_non_max_retransmit,
26c87c5fbaSopenharmony_cicoap_session_set_non_receive_timeout,
27c87c5fbaSopenharmony_cicoap_session_get_non_receive_timeout,
28c87c5fbaSopenharmony_cicoap_session_set_non_timeout,
29c87c5fbaSopenharmony_cicoap_session_get_non_timeout,
30c87c5fbaSopenharmony_cicoap_session_set_nstart,
31c87c5fbaSopenharmony_cicoap_session_get_nstart,
32c87c5fbaSopenharmony_cicoap_session_set_probing_rate,
33c87c5fbaSopenharmony_cicoap_session_get_probing_rate,
34c87c5fbaSopenharmony_cicoap_debug_set_packet_loss
35c87c5fbaSopenharmony_ci- Work with CoAP packet transmissions
36c87c5fbaSopenharmony_ci
37c87c5fbaSopenharmony_ciSYNOPSIS
38c87c5fbaSopenharmony_ci--------
39c87c5fbaSopenharmony_ci*#include <coap@LIBCOAP_API_VERSION@/coap.h>*
40c87c5fbaSopenharmony_ci
41c87c5fbaSopenharmony_ci*void coap_session_set_ack_random_factor(coap_session_t *_session_,
42c87c5fbaSopenharmony_cicoap_fixed_point_t _value_)*;
43c87c5fbaSopenharmony_ci
44c87c5fbaSopenharmony_ci*coap_fixed_point_t coap_session_get_ack_random_factor(
45c87c5fbaSopenharmony_ciconst coap_session_t *_session_)*;
46c87c5fbaSopenharmony_ci
47c87c5fbaSopenharmony_ci*void coap_session_set_ack_timeout(coap_session_t *_session_,
48c87c5fbaSopenharmony_cicoap_fixed_point_t _value_)*;
49c87c5fbaSopenharmony_ci
50c87c5fbaSopenharmony_ci*coap_fixed_point_t coap_session_get_ack_timeout(
51c87c5fbaSopenharmony_ciconst coap_session_t *_session_)*;
52c87c5fbaSopenharmony_ci
53c87c5fbaSopenharmony_ci*void coap_session_set_default_leisure(coap_session_t *_session_,
54c87c5fbaSopenharmony_cicoap_fixed_point_t _value_)*;
55c87c5fbaSopenharmony_ci
56c87c5fbaSopenharmony_ci*coap_fixed_point_t coap_session_get_default_leisure(
57c87c5fbaSopenharmony_ciconst coap_session_t *_session_)*;
58c87c5fbaSopenharmony_ci
59c87c5fbaSopenharmony_ci*void coap_session_set_max_payloads(coap_session_t *_session_,
60c87c5fbaSopenharmony_ciuint16_t _value_)*;
61c87c5fbaSopenharmony_ci
62c87c5fbaSopenharmony_ci*uint16_t coap_session_get_max_payloads(const coap_session_t *_session_)*;
63c87c5fbaSopenharmony_ci
64c87c5fbaSopenharmony_ci*void coap_session_set_max_retransmit(coap_session_t *_session_,
65c87c5fbaSopenharmony_ciuint16_t _value_)*;
66c87c5fbaSopenharmony_ci
67c87c5fbaSopenharmony_ci*uint16_t coap_session_get_max_retransmit(const coap_session_t *_session_)*;
68c87c5fbaSopenharmony_ci
69c87c5fbaSopenharmony_ci*void coap_session_set_non_max_retransmit(coap_session_t *_session_,
70c87c5fbaSopenharmony_ciuint16_t _value_)*;
71c87c5fbaSopenharmony_ci
72c87c5fbaSopenharmony_ci*uint16_t coap_session_get_non_max_retransmit(const coap_session_t *_session_)*;
73c87c5fbaSopenharmony_ci
74c87c5fbaSopenharmony_ci*void coap_session_set_non_receive_timeout(coap_session_t *_session_,
75c87c5fbaSopenharmony_cicoap_fixed_point_t _value_)*;
76c87c5fbaSopenharmony_ci
77c87c5fbaSopenharmony_ci*coap_fixed_point_t coap_session_get_non_receive_timeout(
78c87c5fbaSopenharmony_ciconst coap_session_t *_session_)*;
79c87c5fbaSopenharmony_ci
80c87c5fbaSopenharmony_ci*void coap_session_set_non_timeout(coap_session_t *_session_,
81c87c5fbaSopenharmony_cicoap_fixed_point_t _value_)*;
82c87c5fbaSopenharmony_ci
83c87c5fbaSopenharmony_ci*coap_fixed_point_t coap_session_get_non_timeout(
84c87c5fbaSopenharmony_ciconst coap_session_t *_session_)*;
85c87c5fbaSopenharmony_ci
86c87c5fbaSopenharmony_ci*void coap_session_set_nstart(coap_session_t *_session_, uint16_t _value_)*;
87c87c5fbaSopenharmony_ci
88c87c5fbaSopenharmony_ci*uint16_t coap_session_get_nstart(const coap_session_t *_session_)*;
89c87c5fbaSopenharmony_ci
90c87c5fbaSopenharmony_ci*void coap_session_set_probing_rate(coap_session_t *_session_,
91c87c5fbaSopenharmony_ciuint32_t _value_)*;
92c87c5fbaSopenharmony_ci
93c87c5fbaSopenharmony_ci*uint32_t coap_session_get_probing_rate(const coap_session_t *_session_)*;
94c87c5fbaSopenharmony_ci
95c87c5fbaSopenharmony_ci*int coap_debug_set_packet_loss(const char *_loss_level_)*;
96c87c5fbaSopenharmony_ci
97c87c5fbaSopenharmony_ciFor specific (D)TLS library support, link with
98c87c5fbaSopenharmony_ci*-lcoap-@LIBCOAP_API_VERSION@-notls*, *-lcoap-@LIBCOAP_API_VERSION@-gnutls*,
99c87c5fbaSopenharmony_ci*-lcoap-@LIBCOAP_API_VERSION@-openssl*, *-lcoap-@LIBCOAP_API_VERSION@-mbedtls*
100c87c5fbaSopenharmony_cior *-lcoap-@LIBCOAP_API_VERSION@-tinydtls*.   Otherwise, link with
101c87c5fbaSopenharmony_ci*-lcoap-@LIBCOAP_API_VERSION@* to get the default (D)TLS library support.
102c87c5fbaSopenharmony_ci
103c87c5fbaSopenharmony_ciDESCRIPTION
104c87c5fbaSopenharmony_ci-----------
105c87c5fbaSopenharmony_ciThere is CoAP Confirmable message transmission recovery as defined in
106c87c5fbaSopenharmony_cihttps://rfc-editor.org/rfc/rfc7252[RFC7252], as well CoAP Non-Confirmable
107c87c5fbaSopenharmony_cisplit into blocks  message transmission recovery support as defined in
108c87c5fbaSopenharmony_cihttps://rfc-editor.org/rfc/rfc9177[RFC9177].
109c87c5fbaSopenharmony_ci
110c87c5fbaSopenharmony_ciFor CoAP Confirmable messages, it is possible to define the retry counts,
111c87c5fbaSopenharmony_cirepeat rate etc. for error recovery.  Further information can be found in
112c87c5fbaSopenharmony_ci"https://rfc-editor.org/rfc/rfc7252#section-4.2[RFC7272 4.2. Messages
113c87c5fbaSopenharmony_ciTransmitted Reliably]",
114c87c5fbaSopenharmony_ciwith the default values defined in
115c87c5fbaSopenharmony_ci"https://rfc-editor.org/rfc/rfc7252#section-4.8[RFC7272 4.8. Transmission
116c87c5fbaSopenharmony_ciParameters]".
117c87c5fbaSopenharmony_ci
118c87c5fbaSopenharmony_ciIt is not recommended that the suggested default setting are changed, but
119c87c5fbaSopenharmony_cithere may be some special requirements that need different values and the
120c87c5fbaSopenharmony_ciconsequences of changing these values is fully understood.
121c87c5fbaSopenharmony_ci
122c87c5fbaSopenharmony_ciSome of the parameters or return values are in fixed point format as defined
123c87c5fbaSopenharmony_ciby the coap_fixed_point_t structure as below
124c87c5fbaSopenharmony_ci----
125c87c5fbaSopenharmony_citypedef struct coap_fixed_point_t {
126c87c5fbaSopenharmony_ci  uint16_t integer_part;    /* Integer part of fixed point variable */
127c87c5fbaSopenharmony_ci  uint16_t fractional_part; /* Fractional part of fixed point variable
128c87c5fbaSopenharmony_ci                               1/1000 (3 points) precision */
129c87c5fbaSopenharmony_ci} coap_fixed_point_t;
130c87c5fbaSopenharmony_ci----
131c87c5fbaSopenharmony_ci
132c87c5fbaSopenharmony_ciThe CoAP Confirmable message retry rules are (with the default values to
133c87c5fbaSopenharmony_cicompute the time)
134c87c5fbaSopenharmony_ci----
135c87c5fbaSopenharmony_ci1st retransmit after 1 * ack_timeout * ack_random factor (3 seconds)
136c87c5fbaSopenharmony_ci2nd retransmit after 2 * ack_timeout * ack_random factor (6 seconds)
137c87c5fbaSopenharmony_ci3rd retransmit after 3 * ack_timeout * ack_random factor (12 seconds)
138c87c5fbaSopenharmony_ci4th retransmit after 4 * ack_timeout * ack_random factor (24 seconds)
139c87c5fbaSopenharmony_ci5th retransmit after 5 * ack_timeout * ack_random factor (48 seconds)
140c87c5fbaSopenharmony_ci
141c87c5fbaSopenharmony_ciAs max_retransmit (by default) is 4, then the 5th retransmit does not get sent,
142c87c5fbaSopenharmony_cibut at that point COAP_NACK_TOO_MANY_RETRIES gets raised in the nack_handler
143c87c5fbaSopenharmony_ci(if defined). Note that the sum of the seconds is 93 matching
144c87c5fbaSopenharmony_ci"https://rfc-editor.org/rfc/rfc7252#section-4.8.2[RFC7252 4.8.2.
145c87c5fbaSopenharmony_ciMAX_TRANSMIT_WAIT]".
146c87c5fbaSopenharmony_ci----
147c87c5fbaSopenharmony_ci
148c87c5fbaSopenharmony_ciIt should be noted that these retries are separate from the DTLS or TLS
149c87c5fbaSopenharmony_ciencrypted session setup retry timeouts. For DTLS, the initial requesting
150c87c5fbaSopenharmony_cipacket will get sent max_retransmit times before reporting failure.
151c87c5fbaSopenharmony_ciFor TLS the initial TCP connection will timeout before reporting failure.
152c87c5fbaSopenharmony_ci
153c87c5fbaSopenharmony_ciFor CoAP Non-Confirmable messages with
154c87c5fbaSopenharmony_cihttps://rfc-editor.org/rfc/rfc9177[RFC9177] enabled at both ends of a
155c87c5fbaSopenharmony_cisession, it is possible to define the retry counts etc. for data recovery.
156c87c5fbaSopenharmony_ciFurther information can be found in
157c87c5fbaSopenharmony_ci"https://rfc-editor.org/rfc/rfc9177#section-7.2[RFC9177
158c87c5fbaSopenharmony_ci7.2. Non-confirmable (NON)]".
159c87c5fbaSopenharmony_ci
160c87c5fbaSopenharmony_ciIt is also possible to set up packet losses, for both confirmable, and
161c87c5fbaSopenharmony_cinon-confirmable messages.  This can be used for stress testing packet
162c87c5fbaSopenharmony_citransmission recovery as well as application handling of lossy networks.
163c87c5fbaSopenharmony_ci
164c87c5fbaSopenharmony_ciFUNCTIONS
165c87c5fbaSopenharmony_ci---------
166c87c5fbaSopenharmony_ci
167c87c5fbaSopenharmony_ciThe following functions reflect the https://rfc-editor.org/rfc/rfc7252[RFC7252]
168c87c5fbaSopenharmony_ciand https://rfc-editor.org/rfc/rfc9177[RFC9177] uppercase names
169c87c5fbaSopenharmony_ciin lowercase following the coap_session_set_ or coap_session_get_ function
170c87c5fbaSopenharmony_ciprefix.
171c87c5fbaSopenharmony_ci
172c87c5fbaSopenharmony_ci*Function: coap_session_set_ack_random_factor()*
173c87c5fbaSopenharmony_ci
174c87c5fbaSopenharmony_ciThe *coap_session_set_ack_random_factor*() function updates the _session_ ack
175c87c5fbaSopenharmony_cirandom wait factor, used to randomize re-transmissions, with the new _value_.
176c87c5fbaSopenharmony_ciThe default value is 1.5 (RFC7252).
177c87c5fbaSopenharmony_ci
178c87c5fbaSopenharmony_ci*Function: coap_session_get_ack_random_factor()*
179c87c5fbaSopenharmony_ci
180c87c5fbaSopenharmony_ciThe *coap_session_get_ack_random_factor*() function returns the current
181c87c5fbaSopenharmony_ci_session_ ack random wait factor (RFC7252).
182c87c5fbaSopenharmony_ci
183c87c5fbaSopenharmony_ci*Function: coap_session_set_ack_timeout()*
184c87c5fbaSopenharmony_ci
185c87c5fbaSopenharmony_ciThe *coap_session_set_ack_timeout*() function updates the _session_ initial
186c87c5fbaSopenharmony_ciack or response timeout with the new _value_.  The default value is 2.0
187c87c5fbaSopenharmony_ci(RFC7252).
188c87c5fbaSopenharmony_ci
189c87c5fbaSopenharmony_ci*Function: coap_session_get_ack_timeout()*
190c87c5fbaSopenharmony_ci
191c87c5fbaSopenharmony_ciThe *coap_session_get_ack_timeout*() function returns the current _session_
192c87c5fbaSopenharmony_ciinitial ack or response timeout (RFC7252).
193c87c5fbaSopenharmony_ci
194c87c5fbaSopenharmony_ci*Function: coap_session_set_default_leisure()*
195c87c5fbaSopenharmony_ci
196c87c5fbaSopenharmony_ciThe *coap_session_set_default_leisure*() function updates the _session_
197c87c5fbaSopenharmony_cidefault leisure time with the new _value_.  The default value is 5.0 (RFC7252).
198c87c5fbaSopenharmony_ci
199c87c5fbaSopenharmony_ci*Function: coap_session_get_default_leisure()*
200c87c5fbaSopenharmony_ci
201c87c5fbaSopenharmony_ciThe *coap_session_get_default_leisure*() function returns the current _session_
202c87c5fbaSopenharmony_cidefault leisure time (RFC7252).
203c87c5fbaSopenharmony_ci
204c87c5fbaSopenharmony_ci*Function: coap_session_set_max_payloads()*
205c87c5fbaSopenharmony_ci
206c87c5fbaSopenharmony_ciThe *coap_session_set_max_payloads*() function updates the _session_ maximum
207c87c5fbaSopenharmony_cipayloads count with the new _value_.  The default value is 10 (RFC9177).
208c87c5fbaSopenharmony_ci
209c87c5fbaSopenharmony_ci*NOTE:* Both ends of the session must have the same maximum payloads value to
210c87c5fbaSopenharmony_ciminimize any recovery times.
211c87c5fbaSopenharmony_ci
212c87c5fbaSopenharmony_ci*Function: coap_session_get_max_payloads()*
213c87c5fbaSopenharmony_ci
214c87c5fbaSopenharmony_ciThe *coap_session_get_max_payloads*() function returns the current _session_
215c87c5fbaSopenharmony_cimaximum payloads count (RFC9177).
216c87c5fbaSopenharmony_ci
217c87c5fbaSopenharmony_ci*Function: coap_session_set_max_retransmit()*
218c87c5fbaSopenharmony_ci
219c87c5fbaSopenharmony_ciThe *coap_session_set_max_retransmit*() function updates the _session_ maximum
220c87c5fbaSopenharmony_ciretransmit count with the new _value_.  The default value is 4 (RFC7252).
221c87c5fbaSopenharmony_ci
222c87c5fbaSopenharmony_ci*Function: coap_session_get_max_retransmit()*
223c87c5fbaSopenharmony_ci
224c87c5fbaSopenharmony_ciThe *coap_session_get_max_retransmit*() function returns the current _session_
225c87c5fbaSopenharmony_cimaximum retransmit count (RFC7252).
226c87c5fbaSopenharmony_ci
227c87c5fbaSopenharmony_ci*Function: coap_session_set_non_max_retransmit()*
228c87c5fbaSopenharmony_ci
229c87c5fbaSopenharmony_ciThe *coap_session_set_non_max_retransmit*() function updates the _session_
230c87c5fbaSopenharmony_cimaximum non retransmit count with the new _value_.  The default value is 4
231c87c5fbaSopenharmony_ci(RFC9177).
232c87c5fbaSopenharmony_ci
233c87c5fbaSopenharmony_ci*Function: coap_session_get_non_max_retransmit()*
234c87c5fbaSopenharmony_ci
235c87c5fbaSopenharmony_ciThe *coap_session_get_non_max_retransmit*() function returns the current
236c87c5fbaSopenharmony_ci_session_ maximum non retransmit count (RFC9177).
237c87c5fbaSopenharmony_ci
238c87c5fbaSopenharmony_ci*Function: coap_session_set_non_receive_timeout()*
239c87c5fbaSopenharmony_ci
240c87c5fbaSopenharmony_ciThe *coap_session_set_non_receive_timeout*() function updates the _session_
241c87c5fbaSopenharmony_cinon receive timeout with the new _value_.  The default value is 4.0
242c87c5fbaSopenharmony_ci(RFC9177).
243c87c5fbaSopenharmony_ci
244c87c5fbaSopenharmony_ci*Function: coap_session_get_non_receive_timeout()*
245c87c5fbaSopenharmony_ci
246c87c5fbaSopenharmony_ciThe *coap_session_get_non_receive_timeout*() function returns the current
247c87c5fbaSopenharmony_ci_session_ non receive timeout (RFC9177).
248c87c5fbaSopenharmony_ci
249c87c5fbaSopenharmony_ci*Function: coap_session_set_non_timeout()*
250c87c5fbaSopenharmony_ci
251c87c5fbaSopenharmony_ciThe *coap_session_set_non_timeout*() function updates the _session_
252c87c5fbaSopenharmony_cinon timeout with the new _value_.  The default value is 2.0
253c87c5fbaSopenharmony_ci(RFC9177).
254c87c5fbaSopenharmony_ci
255c87c5fbaSopenharmony_ci*Function: coap_session_get_non_timeout()*
256c87c5fbaSopenharmony_ci
257c87c5fbaSopenharmony_ciThe *coap_session_get_non_timeout*() function returns the current
258c87c5fbaSopenharmony_ci_session_ non timeout (RFC9177).
259c87c5fbaSopenharmony_ci
260c87c5fbaSopenharmony_ci*Function: coap_session_set_nstart()*
261c87c5fbaSopenharmony_ci
262c87c5fbaSopenharmony_ciThe *coap_session_set_nstart*() function updates the _session_ nstart
263c87c5fbaSopenharmony_ciwith the new _value_.  The default value is 1 (RFC7252).
264c87c5fbaSopenharmony_ci
265c87c5fbaSopenharmony_ci*Function: coap_session_set_probing_rate()*
266c87c5fbaSopenharmony_ci
267c87c5fbaSopenharmony_ciThe *coap_session_get_nstart*() function returns the current _session_
268c87c5fbaSopenharmony_cinstart value (RFC7252).
269c87c5fbaSopenharmony_ci
270c87c5fbaSopenharmony_ci*Function: coap_session_set_probing_rate()*
271c87c5fbaSopenharmony_ci
272c87c5fbaSopenharmony_ciThe *coap_session_set_probing_rate*() function updates the _session_ probing
273c87c5fbaSopenharmony_cirate with the new _value_.  The default value is 1 byte per second (RFC7252).
274c87c5fbaSopenharmony_ci
275c87c5fbaSopenharmony_ci*Function: coap_session_get_probing_rate()*
276c87c5fbaSopenharmony_ci
277c87c5fbaSopenharmony_ciThe *coap_session_get_probing_rate*() function returns the current _session_
278c87c5fbaSopenharmony_ciprobing rate value (RFC7252).
279c87c5fbaSopenharmony_ci
280c87c5fbaSopenharmony_ci*Function: coap_debug_set_packet_loss()*
281c87c5fbaSopenharmony_ci
282c87c5fbaSopenharmony_ciThe *coap_debug_set_packet_loss*() function is uses to set the packet loss
283c87c5fbaSopenharmony_cilevels as defined in _loss_level_.  _loss_level_ can be set as a percentage
284c87c5fbaSopenharmony_cifrom "0%" to "100%".
285c87c5fbaSopenharmony_ciAlternatively, it is possible to specify which packets of a packet sequence
286c87c5fbaSopenharmony_ciare dropped.  A definition of "1,5-9,11-20,101" means that packets 1, 5
287c87c5fbaSopenharmony_cithrough 9, 11 through 20 and 101 will get dropped. A maximum of 10 different
288c87c5fbaSopenharmony_cipacket sets is supported.  The packet count is reset to 0 when
289c87c5fbaSopenharmony_ci*coap_debug_set_packet_loss*() is called.
290c87c5fbaSopenharmony_ciTo remove any packet losses, set the _loss_level_ to "0%".
291c87c5fbaSopenharmony_ci
292c87c5fbaSopenharmony_ciRETURN VALUES
293c87c5fbaSopenharmony_ci-------------
294c87c5fbaSopenharmony_ci*coap_session_get_ack_random_factor*(), *coap_session_get_ack_timeout*(),
295c87c5fbaSopenharmony_ci*coap_session_get_default_leisure*(), *coap_session_get_max_payloads*(),
296c87c5fbaSopenharmony_ci*coap_session_get_max_retransmit*(), *coap_session_get_non_max_retransmit*(),
297c87c5fbaSopenharmony_ci*coap_session_get_non_receive_timeout*(), *coap_session_get_non_timeout*(),
298c87c5fbaSopenharmony_ci*coap_session_get_nstart*() and *coap_session_get_probing_rate*() return their
299c87c5fbaSopenharmony_cirespective current values.
300c87c5fbaSopenharmony_ci
301c87c5fbaSopenharmony_ci*coap_debug_set_packet_loss*() returns 0 if _loss_level_ does not parse
302c87c5fbaSopenharmony_cicorrectly, otherwise 1 if successful.
303c87c5fbaSopenharmony_ci
304c87c5fbaSopenharmony_ciTESTING
305c87c5fbaSopenharmony_ci-------
306c87c5fbaSopenharmony_ci
307c87c5fbaSopenharmony_ciThe libcoap RFC7252 recovery/re-transmit logic will only work for confirmable
308c87c5fbaSopenharmony_cirequests or if RFC9177 support is enabled for non-confirmable large body
309c87c5fbaSopenharmony_citransmissions that need to span multiple packets.
310c87c5fbaSopenharmony_ci
311c87c5fbaSopenharmony_ciTo see what is happening (other than by sniffing the network traffic), the
312c87c5fbaSopenharmony_cilogging level needs to be set to COAP_LOG_DEBUG in the client by using
313c87c5fbaSopenharmony_ci*coap_set_log_level*(COAP_LOG_DEBUG) and
314c87c5fbaSopenharmony_ci*coap_dtls_set_log_level*(COAP_LOG_DEBUG).
315c87c5fbaSopenharmony_ci
316c87c5fbaSopenharmony_ciThe server can either be stopped, or if packet loss levels are set to 100% by
317c87c5fbaSopenharmony_ciusing *coap_debug_set_packet_loss*("100%") when receiving the client requests.
318c87c5fbaSopenharmony_ci
319c87c5fbaSopenharmony_ci*NOTE:* If the server end of the connection is returning ICMP unreachable
320c87c5fbaSopenharmony_cipackets after being turned off, you will get a debug message of the form
321c87c5fbaSopenharmony_ci"coap_network_read: unreachable", so libcoap will stop doing the retries.  If
322c87c5fbaSopenharmony_cithis is the case, then you need to make use of (on the server)
323c87c5fbaSopenharmony_ci*coap_debug_set_packet_loss*("100%") or put in some packet filtering to drop the
324c87c5fbaSopenharmony_cipackets.
325c87c5fbaSopenharmony_ci
326c87c5fbaSopenharmony_ciFor confirmable transmissions, the client should then restart transmitting the
327c87c5fbaSopenharmony_cirequests based on the ack_timeout, ack_random_factor and max_retransmit values.
328c87c5fbaSopenharmony_ciThe client's nack_handler will get called with COAP_NACK_TOO_MANY_RETRIES when
329c87c5fbaSopenharmony_cithe confirmable request cannot be successfully transmitted.
330c87c5fbaSopenharmony_ci
331c87c5fbaSopenharmony_ciFor non-confirmable block transmissions (RFC9177 enabled), the client should
332c87c5fbaSopenharmony_cithen restart transmitting the missing requests based on the max_payloads,
333c87c5fbaSopenharmony_cinon_timeout, non_receive_timeout, and non_max_retransmit values. The client's
334c87c5fbaSopenharmony_cinack_handler will get called with COAP_NACK_TOO_MANY_RETRIES when
335c87c5fbaSopenharmony_cithe non-confirmable large body request cannot be successfully transmitted.
336c87c5fbaSopenharmony_ci
337c87c5fbaSopenharmony_ci
338c87c5fbaSopenharmony_ciFURTHER INFORMATION
339c87c5fbaSopenharmony_ci-------------------
340c87c5fbaSopenharmony_ciSee
341c87c5fbaSopenharmony_ci
342c87c5fbaSopenharmony_ci"https://rfc-editor.org/rfc/rfc7252[RFC7252: The Constrained Application Protocol (CoAP)]"
343c87c5fbaSopenharmony_ci
344c87c5fbaSopenharmony_ci"https://rfc-editor.org/rfc/rfc9177[RFC9177: Constrained Application Protocol (CoAP) Block-Wise Transfer Options Supporting Robust Transmission]"
345c87c5fbaSopenharmony_ci
346c87c5fbaSopenharmony_cifor further information.
347c87c5fbaSopenharmony_ci
348c87c5fbaSopenharmony_ciBUGS
349c87c5fbaSopenharmony_ci----
350c87c5fbaSopenharmony_ciPlease report bugs on the mailing list for libcoap:
351c87c5fbaSopenharmony_cilibcoap-developers@lists.sourceforge.net or raise an issue on GitHub at
352c87c5fbaSopenharmony_cihttps://github.com/obgm/libcoap/issues
353c87c5fbaSopenharmony_ci
354c87c5fbaSopenharmony_ciAUTHORS
355c87c5fbaSopenharmony_ci-------
356c87c5fbaSopenharmony_ciThe libcoap project <libcoap-developers@lists.sourceforge.net>
357