libcoap 4.3.2rc2

Macros | Functions
Rate Control
Application API

API for updating transmission parameters for CoAP rate control. More...

## Macros
#define | COAP_DEFAULT_ACK_TIMEOUT ((coap_fixed_point_t){2,0})
| Number of seconds when to expect an ACK or a response to an outstanding CON message. More...
#define | COAP_DEFAULT_ACK_RANDOM_FACTOR ((coap_fixed_point_t){1,500})
| A factor that is used to randomize the wait time before a message is retransmitted to prevent synchronization effects. More...
#define | COAP_DEFAULT_MAX_RETRANSMIT (4U)
| Number of message retransmissions before message sending is stopped. More...
#define | COAP_DEFAULT_NSTART (1U)
| The number of simultaneous outstanding interactions that a client maintains to a given server. More...
#define | COAP_DEFAULT_DEFAULT_LEISURE ((coap_fixed_point_t){5,0})
| The number of seconds to use as bounds for multicast traffic RFC 7252, Section 4.8 Default value of DEFAULT_LEISURE is 5.0. More...
#define | COAP_DEFAULT_PROBING_RATE (1U)
| The number of bytes/second allowed when there is no response RFC 7252, Section 4.8 Default value of PROBING_RATE is 1. More...
#define | COAP_DEFAULT_MAX_PAYLOADS (10U)
| Number of Q-Block1 or Q-Block2 payloads that can be sent in a burst before a delay has to kick in. More...
#define | COAP_DEFAULT_NON_MAX_RETRANSMIT (4U)
| The number of times for requests for re-transmission of missing Q-Block1 when no response has been received. More...
#define | COAP_DEFAULT_NON_TIMEOUT ((coap_fixed_point_t){2,0})
| The delay (+ ACK_RANDOM_FACTOR) to introduce once NON MAX_PAYLOADS Q-Block1 or Q-Block2 have been sent to reduce congestion control. More...
#define | COAP_DEFAULT_NON_RECEIVE_TIMEOUT ((coap_fixed_point_t){4,0})
| The time to wait for any missing Q-Block1 or Q-Block2 packets before requesting re-transmission of missing packets. More...
#define | COAP_DEFAULT_MAX_LATENCY (100U)
| The MAX_LATENCY definition. More...

## Functions
void | coap_session_set_ack_timeout (coap_session_t *session, coap_fixed_point_t value)
| Set the CoAP initial ack response timeout before the next re-transmit. More...
coap_fixed_point_t | coap_session_get_ack_timeout (const coap_session_t *session)
| Get the CoAP initial ack response timeout before the next re-transmit. More...
void | coap_session_set_ack_random_factor (coap_session_t *session, coap_fixed_point_t value)
| Set the CoAP ack randomize factor. More...
coap_fixed_point_t | coap_session_get_ack_random_factor (const coap_session_t *session)
| Get the CoAP ack randomize factor. More...
void | coap_session_set_max_retransmit (coap_session_t *session, uint16_t value)
| Set the CoAP maximum retransmit count before failure. More...
uint16_t | coap_session_get_max_retransmit (const coap_session_t *session)
| Get the CoAP maximum retransmit before failure. More...
void | coap_session_set_nstart (coap_session_t *session, uint16_t value)
| Set the CoAP maximum concurrent transmission count of Confirmable messages RFC7252 NSTART. More...
uint16_t | coap_session_get_nstart (const coap_session_t *session)
| Get the CoAP maximum concurrent transmission count of Confirmable messages RFC7252 NSTART. More...
void | coap_session_set_default_leisure (coap_session_t *session, coap_fixed_point_t value)
| Set the CoAP default leisure time (for multicast) RFC7252 DEFAULT_LEISURE. More...
coap_fixed_point_t | coap_session_get_default_leisure (const coap_session_t *session)
| Get the CoAP default leisure time RFC7252 DEFAULT_LEISURE. More...
void | coap_session_set_probing_rate (coap_session_t *session, uint32_t value)
| Set the CoAP probing rate when there is no response RFC7252 PROBING_RATE. More...
uint32_t | coap_session_get_probing_rate (const coap_session_t *session)
| Get the CoAP probing rate when there is no response RFC7252 PROBING_RATE. More...
void | coap_session_set_max_payloads (coap_session_t *session, uint16_t value)
| Set the CoAP maximum payloads count of Q-Block1 or Q-Block2 before delay is introduced RFC9177 MAX_PAYLOADS. More...
uint16_t | coap_session_get_max_payloads (const coap_session_t *session)
| Get the CoAP maximum payloads count of Q-Block1 or Q-Block2 before delay is introduced RFC9177 MAX_PAYLOADS. More...
void | coap_session_set_non_max_retransmit (coap_session_t *session, uint16_t value)
| Set the CoAP NON maximum retransmit count of missing Q-Block1 or Q-Block2 requested before there is any response RFC9177 NON_MAX_RETRANSMIT. More...
uint16_t | coap_session_get_non_max_retransmit (const coap_session_t *session)
| Get the CoAP NON maximum retransmit count of missing Q-Block1 or Q-Block2 requested before there is any response RFC9177 NON_MAX_RETRANSMIT. More...
void | coap_session_set_non_timeout (coap_session_t *session, coap_fixed_point_t value)
| Set the CoAP non timeout delay timeout. More...
coap_fixed_point_t | coap_session_get_non_timeout (const coap_session_t *session)
| Get the CoAP MAX_PAYLOADS limit delay timeout. More...
void | coap_session_set_non_receive_timeout (coap_session_t *session, coap_fixed_point_t value)
| Set the CoAP non receive timeout delay timeout. More...
coap_fixed_point_t | coap_session_get_non_receive_timeout (const coap_session_t *session)
| Get the CoAP non receive timeout delay timeout. More...

## Detailed Description

API for updating transmission parameters for CoAP rate control.

The transmission parameters for CoAP rate control ("Congestion Control" in stream-oriented protocols) are defined in https://rfc-editor.org/rfc/rfc7252#section-4.8 and https://rfc-editor.org/rfc/rfc9177#section-6.2

## Macro Definition Documentation

## ◆ COAP_DEFAULT_ACK_RANDOM_FACTOR

#define COAP_DEFAULT_ACK_RANDOM_FACTOR ((coap_fixed_point_t){1,500})

A factor that is used to randomize the wait time before a message is retransmitted to prevent synchronization effects.

RFC 7252, Section 4.8 Default value of ACK_RANDOM_FACTOR is 1.5

Configurable using coap_session_set_ack_random_factor()

Definition at line 467 of file coap_session.h.

## ◆ COAP_DEFAULT_ACK_TIMEOUT

#define COAP_DEFAULT_ACK_TIMEOUT ((coap_fixed_point_t){2,0})

Number of seconds when to expect an ACK or a response to an outstanding CON message.

RFC 7252, Section 4.8 Default value of ACK_TIMEOUT is 2

Configurable using coap_session_set_ack_timeout()

Definition at line 458 of file coap_session.h.

## ◆ COAP_DEFAULT_DEFAULT_LEISURE

#define COAP_DEFAULT_DEFAULT_LEISURE ((coap_fixed_point_t){5,0})

The number of seconds to use as bounds for multicast traffic RFC 7252, Section 4.8 Default value of DEFAULT_LEISURE is 5.0.

Configurable using coap_session_set_default_leisure()

Definition at line 492 of file coap_session.h.

## ◆ COAP_DEFAULT_MAX_LATENCY

#define COAP_DEFAULT_MAX_LATENCY (100U)

The MAX_LATENCY definition.

RFC 7252, Section 4.8.2 MAX_LATENCY is 100.

Definition at line 542 of file coap_session.h.

## ◆ COAP_DEFAULT_MAX_PAYLOADS

#define COAP_DEFAULT_MAX_PAYLOADS (10U)

Number of Q-Block1 or Q-Block2 payloads that can be sent in a burst before a delay has to kick in.

RFC9177 Section 6.2 Default value of MAX_PAYLOAD is 10

Configurable using coap_session_set_max_payloads()

Definition at line 509 of file coap_session.h.

## ◆ COAP_DEFAULT_MAX_RETRANSMIT

#define COAP_DEFAULT_MAX_RETRANSMIT (4U)

Number of message retransmissions before message sending is stopped.

RFC 7252, Section 4.8 Default value of MAX_RETRANSMIT is 4

Configurable using coap_session_set_max_retransmit()

Definition at line 475 of file coap_session.h.

## ◆ COAP_DEFAULT_NON_MAX_RETRANSMIT

#define COAP_DEFAULT_NON_MAX_RETRANSMIT (4U)

The number of times for requests for re-transmission of missing Q-Block1 when no response has been received.

RFC9177 Section 6.2 Default value of NON_MAX_RETRANSMIT is 4

Configurable using coap_session_set_non_max_retransmit()

Definition at line 518 of file coap_session.h.

## ◆ COAP_DEFAULT_NON_RECEIVE_TIMEOUT

#define COAP_DEFAULT_NON_RECEIVE_TIMEOUT ((coap_fixed_point_t){4,0})

The time to wait for any missing Q-Block1 or Q-Block2 packets before requesting re-transmission of missing packets.

RFC9177 Section 6.2 Default value of NON_RECEIVE_TIMEOUT is 4.

Configurable using coap_session_set_non_receive_timeout()

Definition at line 536 of file coap_session.h.

## ◆ COAP_DEFAULT_NON_TIMEOUT

#define COAP_DEFAULT_NON_TIMEOUT ((coap_fixed_point_t){2,0})

The delay (+ ACK_RANDOM_FACTOR) to introduce once NON MAX_PAYLOADS Q-Block1 or Q-Block2 have been sent to reduce congestion control.

RFC9177 Section 6.2 Default value of NON_TIMEOUT is 2.

Configurable using coap_session_set_non_timeout()

Definition at line 527 of file coap_session.h.

## ◆ COAP_DEFAULT_NSTART

#define COAP_DEFAULT_NSTART (1U)

The number of simultaneous outstanding interactions that a client maintains to a given server.

RFC 7252, Section 4.8 Default value of NSTART is 1

Configurable using coap_session_set_nstart()

Definition at line 484 of file coap_session.h.

## ◆ COAP_DEFAULT_PROBING_RATE

#define COAP_DEFAULT_PROBING_RATE (1U)

The number of bytes/second allowed when there is no response RFC 7252, Section 4.8 Default value of PROBING_RATE is 1.

Configurable using coap_session_set_probing_rate()

Definition at line 500 of file coap_session.h.

## Function Documentation

## ◆ coap_session_get_ack_random_factor()

coap_fixed_point_t coap_session_get_ack_random_factor | ( | const coap_session_t * | session | ) |

Get the CoAP ack randomize factor.

A factor that is used to randomize the wait time before a message is retransmitted to prevent synchronization effects. RFC7252 ACK_RANDOM_FACTOR

Parameters

  session | The CoAP session.

Returns
  Current ack randomize value

Definition at line 283 of file coap_session.c.

## ◆ coap_session_get_ack_timeout()

coap_fixed_point_t coap_session_get_ack_timeout | ( | const coap_session_t * | session | ) |

Get the CoAP initial ack response timeout before the next re-transmit.

Number of seconds when to expect an ACK or a response to an outstanding CON message. RFC7252 ACK_TIMEOUT

Parameters

  session | The CoAP session.

Returns
  Current ack response timeout value

Definition at line 278 of file coap_session.c.

## ◆ coap_session_get_default_leisure()

coap_fixed_point_t coap_session_get_default_leisure | ( | const coap_session_t * | session | ) |

Get the CoAP default leisure time RFC7252 DEFAULT_LEISURE.

Parameters

  session | The CoAP session.

Returns
  Current default_leisure value

Definition at line 298 of file coap_session.c.

## ◆ coap_session_get_max_payloads()

uint16_t coap_session_get_max_payloads | ( | const coap_session_t * | session | ) |

Get the CoAP maximum payloads count of Q-Block1 or Q-Block2 before delay is introduced RFC9177 MAX_PAYLOADS.

Parameters

  session | The CoAP session.

Returns
  Current maximum payloads value

Definition at line 308 of file coap_session.c.

## ◆ coap_session_get_max_retransmit()

uint16_t coap_session_get_max_retransmit | ( | const coap_session_t * | session | ) |

Get the CoAP maximum retransmit before failure.

Number of message retransmissions before message sending is stopped RFC7252 MAX_RETRANSMIT

Parameters

  session | The CoAP session.

Returns
  Current maximum retransmit value

Definition at line 288 of file coap_session.c.

## ◆ coap_session_get_non_max_retransmit()

uint16_t coap_session_get_non_max_retransmit | ( | const coap_session_t * | session | ) |

Get the CoAP NON maximum retransmit count of missing Q-Block1 or Q-Block2 requested before there is any response RFC9177 NON_MAX_RETRANSMIT.

Parameters

  session | The CoAP session.

Returns
  Current maximum NON max retransmit value

Definition at line 318 of file coap_session.c.

## ◆ coap_session_get_non_receive_timeout()

coap_fixed_point_t coap_session_get_non_receive_timeout | ( | const coap_session_t * | session | ) |

Get the CoAP non receive timeout delay timeout.

Number of seconds to delay before requesting missing packets RFC9177 NON_RECEIVE_TIMEOUT

Parameters

  session | The CoAP session.

Returns
  NON_RECEIVE_TIMEOUT delay

Definition at line 338 of file coap_session.c.

## ◆ coap_session_get_non_timeout()

coap_fixed_point_t coap_session_get_non_timeout | ( | const coap_session_t * | session | ) |

Get the CoAP MAX_PAYLOADS limit delay timeout.

Number of seconds to delay (+ ACK_RANDOM_FACTOR) before sending off the next set of NON MAX_PAYLOADS RFC9177 NON_TIMEOUT

Parameters

  session | The CoAP session.

Returns
  NON MAX_PAYLOADS delay

Definition at line 328 of file coap_session.c.

## ◆ coap_session_get_nstart()

uint16_t coap_session_get_nstart | ( | const coap_session_t * | session | ) |

Get the CoAP maximum concurrent transmission count of Confirmable messages RFC7252 NSTART.

Parameters

  session | The CoAP session.

Returns
  Current nstart value

Definition at line 293 of file coap_session.c.

## ◆ coap_session_get_probing_rate()

uint32_t coap_session_get_probing_rate | ( | const coap_session_t * | session | ) |

Get the CoAP probing rate when there is no response RFC7252 PROBING_RATE.

Parameters

  session | The CoAP session.

Returns
  Current probing_rate value

Definition at line 303 of file coap_session.c.

## ◆ coap_session_set_ack_random_factor()

void coap_session_set_ack_random_factor | ( | coap_session_t * | session,
|  | coap_fixed_point_t | value
| ) |  |

Set the CoAP ack randomize factor.

A factor that is used to randomize the wait time before a message is retransmitted to prevent synchronization effects. RFC7252 ACK_RANDOM_FACTOR

Parameters

  session | The CoAP session.
  value | The value to set to. The default is 1.5 and should not normally get changed.

Definition at line 158 of file coap_session.c.

## ◆ coap_session_set_ack_timeout()

void coap_session_set_ack_timeout | ( | coap_session_t * | session,
|  | coap_fixed_point_t | value
| ) |  |

Set the CoAP initial ack response timeout before the next re-transmit.

Number of seconds when to expect an ACK or a response to an outstanding CON message. RFC7252 ACK_TIMEOUT

Parameters

  session | The CoAP session.
  value | The value to set to. The default is 2.0 and should not normally get changed.

Definition at line 148 of file coap_session.c.

## ◆ coap_session_set_default_leisure()

void coap_session_set_default_leisure | ( | coap_session_t * | session,
|  | coap_fixed_point_t | value
| ) |  |

Set the CoAP default leisure time (for multicast) RFC7252 DEFAULT_LEISURE.

Parameters

  session | The CoAP session.
  value | The value to set to. The default is 5.0 and should not normally get changed.

Definition at line 192 of file coap_session.c.

## ◆ coap_session_set_max_payloads()

void coap_session_set_max_payloads | ( | coap_session_t * | session,
|  | uint16_t | value
| ) |  |

Set the CoAP maximum payloads count of Q-Block1 or Q-Block2 before delay is introduced RFC9177 MAX_PAYLOADS.

Parameters

  session | The CoAP session.
  value | The value to set to. The default is 10 and should not normally get changed.

Definition at line 212 of file coap_session.c.

## ◆ coap_session_set_max_retransmit()

void coap_session_set_max_retransmit | ( | coap_session_t * | session,
|  | uint16_t | value
| ) |  |

Set the CoAP maximum retransmit count before failure.

Number of message retransmissions before message sending is stopped RFC7252 MAX_RETRANSMIT

Parameters

  session | The CoAP session.
  value | The value to set to. The default is 4 and should not normally get changed.

Definition at line 174 of file coap_session.c.

## ◆ coap_session_set_non_max_retransmit()

void coap_session_set_non_max_retransmit | ( | coap_session_t * | session,
|  | uint16_t | value
| ) |  |

Set the CoAP NON maximum retransmit count of missing Q-Block1 or Q-Block2 requested before there is any response RFC9177 NON_MAX_RETRANSMIT.

Parameters

  session | The CoAP session.
  value | The value to set to. The default is 4 and should not normally get changed.

Definition at line 228 of file coap_session.c.

## ◆ coap_session_set_non_receive_timeout()

void coap_session_set_non_receive_timeout | ( | coap_session_t * | session,
|  | coap_fixed_point_t | value
| ) |  |

Set the CoAP non receive timeout delay timeout.

Number of seconds to delay before requesting missing packets RFC9177 NON_RECEIVE_TIMEOUT

Parameters

  session | The CoAP session.
  value | The value to set to. The default is 4.0 and should not normally get changed. Must be 1 sec greater than NON_TIMEOUT_RANDOM

Definition at line 262 of file coap_session.c.

## ◆ coap_session_set_non_timeout()

void coap_session_set_non_timeout | ( | coap_session_t * | session,
|  | coap_fixed_point_t | value
| ) |  |

Set the CoAP non timeout delay timeout.

Number of seconds to delay (+ ACK_RANDOM_FACTOR) before sending off the next set of NON MAX_PAYLOADS RFC9177 NON_TIMEOUT

Parameters

  session | The CoAP session.
  value | The value to set to. The default is 2.0 and should not normally get changed.

Definition at line 244 of file coap_session.c.

## ◆ coap_session_set_nstart()

void coap_session_set_nstart | ( | coap_session_t * | session,
|  | uint16_t | value
| ) |  |

Set the CoAP maximum concurrent transmission count of Confirmable messages RFC7252 NSTART.

Parameters

  session | The CoAP session.
  value | The value to set to. The default is 1 and should not normally get changed.

Definition at line 183 of file coap_session.c.

## ◆ coap_session_set_probing_rate()

void coap_session_set_probing_rate | ( | coap_session_t * | session,
|  | uint32_t | value
| ) |  |

Set the CoAP probing rate when there is no response RFC7252 PROBING_RATE.

Parameters

  session | The CoAP session.
  value | The value to set to. The default is 1 and should not normally get changed.

Definition at line 203 of file coap_session.c.