Loading...
Searching...
No Matches
coap_session.c File Reference

Session handling functions. More...

`#include "coap3/coap_libcoap_build.h"`
`#include <stdio.h>`
Include dependency graph for coap_session.c:

Go to the source code of this file.

## Macros

#define | COAP_SESSION_C_
#define | INET6_ADDRSTRLEN 46

## Functions

coap_fixed_point_t | coap_multi_fixed_fixed (coap_fixed_point_t fp1, coap_fixed_point_t fp2)
coap_fixed_point_t | coap_multi_fixed_uint (coap_fixed_point_t fp1, uint32_t u2)
coap_fixed_point_t | coap_add_fixed_fixed (coap_fixed_point_t fp1, coap_fixed_point_t fp2)
coap_fixed_point_t | coap_add_fixed_uint (coap_fixed_point_t fp1, uint32_t u2)
coap_fixed_point_t | coap_sub_fixed_uint (coap_fixed_point_t fp1, uint32_t u2)
coap_fixed_point_t | coap_div_fixed_uint (coap_fixed_point_t fp1, uint32_t u2)
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.
void | coap_session_set_ack_random_factor (coap_session_t *session, coap_fixed_point_t value)
| Set the CoAP ack randomize factor.
void | coap_session_set_max_retransmit (coap_session_t *session, uint16_t value)
| Set the CoAP maximum retransmit count before failure.
void | coap_session_set_nstart (coap_session_t *session, uint16_t value)
| Set the CoAP maximum concurrent transmission count of Confirmable messages RFC7252 NSTART.
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.
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.
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.
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.
void | coap_session_set_non_timeout (coap_session_t *session, coap_fixed_point_t value)
| Set the CoAP non timeout delay 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.
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.
coap_fixed_point_t | coap_session_get_ack_random_factor (const coap_session_t *session)
| Get the CoAP ack randomize factor.
uint16_t | coap_session_get_max_retransmit (const coap_session_t *session)
| Get the CoAP maximum retransmit before failure.
uint16_t | coap_session_get_nstart (const coap_session_t *session)
| Get the CoAP maximum concurrent transmission count of Confirmable messages RFC7252 NSTART.
coap_fixed_point_t | coap_session_get_default_leisure (const coap_session_t *session)
| Get the CoAP default leisure time RFC7252 DEFAULT_LEISURE.
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.
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.
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.
coap_fixed_point_t | coap_session_get_non_timeout (const coap_session_t *session)
| Get the CoAP MAX_PAYLOADS limit delay timeout.
coap_fixed_point_t | coap_session_get_non_receive_timeout (const coap_session_t *session)
| Get the CoAP non receive timeout delay timeout.
COAP_API coap_session_t * | coap_session_reference (coap_session_t *session)
| Increment reference counter on a session.
coap_session_t * | coap_session_reference_lkd (coap_session_t *session)
| Increment reference counter on a session.
COAP_API void | coap_session_release (coap_session_t *session)
| Decrement reference counter on a session.
void | coap_session_release_lkd (coap_session_t *session)
| Decrement reference counter on a session.
void | coap_session_set_app_data (coap_session_t *session, void *app_data)
| Stores `data` with the given session.
void * | coap_session_get_app_data (const coap_session_t *session)
| Returns any application-specific data that has been stored with `session` using the function coap_session_set_app_data().
static coap_session_t * | coap_make_session (coap_proto_t proto, coap_session_type_t type, const coap_addr_hash_t *addr_hash, const coap_address_t *local_addr, const coap_address_t *remote_addr, int ifindex, coap_context_t *context, coap_endpoint_t *endpoint)
void | coap_session_mfree (coap_session_t *session)
void | coap_session_free (coap_session_t *session)
static size_t | coap_session_max_pdu_size_internal (const coap_session_t *session, size_t max_with_header)
size_t | coap_session_max_pdu_rcv_size (const coap_session_t *session)
| Get maximum acceptable receive PDU size.
COAP_API size_t | coap_session_max_pdu_size (const coap_session_t *session)
| Get maximum acceptable PDU size.
size_t | coap_session_max_pdu_size_lkd (const coap_session_t *session)
| Get maximum acceptable PDU size.
void | coap_session_set_mtu (coap_session_t *session, unsigned mtu)
| Set the session MTU.
ssize_t | coap_session_delay_pdu (coap_session_t *session, coap_pdu_t *pdu, coap_queue_t *node)
void | coap_session_send_csm (coap_session_t *session)
| Notify session transport has just connected and CSM exchange can now start.
COAP_API coap_mid_t | coap_session_send_ping (coap_session_t *session)
| Send a ping message for the session.
coap_mid_t | coap_session_send_ping_lkd (coap_session_t *session)
| Send a ping message for the session.
void | coap_session_connected (coap_session_t *session)
| Notify session that it has just connected or reconnected.
static const char * | coap_nack_name (coap_nack_reason_t reason)
COAP_API void | coap_session_disconnected (coap_session_t *session, coap_nack_reason_t reason)
| Notify session that it has failed.
void | coap_session_disconnected_lkd (coap_session_t *session, coap_nack_reason_t reason)
| Notify session that it has failed.
void | coap_session_establish (coap_session_t *session)
| Layer function interface for layer below session accept/connect being established.
int | coap_session_refresh_psk_hint (coap_session_t *session, const coap_bin_const_t *psk_hint)
| Refresh the session's current Identity Hint (PSK).
int | coap_session_refresh_psk_key (coap_session_t *session, const coap_bin_const_t *psk_key)
| Refresh the session's current pre-shared key (PSK).
int | coap_session_refresh_psk_identity (coap_session_t *session, const coap_bin_const_t *psk_identity)
| Refresh the session's current pre-shared identity (PSK).
const coap_bin_const_t * | coap_session_get_psk_identity (const coap_session_t *session)
| Get the server session's current PSK identity (PSK).
const coap_bin_const_t * | coap_session_get_psk_key (const coap_session_t *session)
| Get the session's current pre-shared key (PSK).
void | coap_session_init_token (coap_session_t *session, size_t len, const uint8_t *data)
| Initializes the token value to use as a starting point.
void | coap_session_new_token (coap_session_t *session, size_t *len, uint8_t *data)
| Creates a new token for use.
COAP_API uint16_t | coap_new_message_id (coap_session_t *session)
| Returns a new message id and updates `session->tx_mid` accordingly.
uint16_t | coap_new_message_id_lkd (coap_session_t *session)
| Returns a new message id and updates `session->tx_mid` accordingly.
const coap_address_t * | coap_session_get_addr_remote (const coap_session_t *session)
| Get the remote IP address and port from the session.
const coap_address_t * | coap_session_get_addr_local (const coap_session_t *session)
| Get the local IP address and port from the session.
const coap_address_t * | coap_session_get_addr_mcast (const coap_session_t *session)
| Get the remote multicast IP address and port from the session if the original target IP was multicast.
coap_context_t * | coap_session_get_context (const coap_session_t *session)
| Get the session context.
coap_proto_t | coap_session_get_proto (const coap_session_t *session)
| Get the session protocol type.
coap_session_type_t | coap_session_get_type (const coap_session_t *session)
| Get the session type.
coap_session_state_t | coap_session_get_state (const coap_session_t *session)
| Get the session state.
int | coap_session_get_ifindex (const coap_session_t *session)
| Get the session if index.
void * | coap_session_get_tls (const coap_session_t *session, coap_tls_library_t *tls_lib)
| Get the session TLS security ptr (TLS type dependent).
static const char * | coap_proto_name (coap_proto_t proto)
coap_session_t * | coap_session_get_by_peer (const coap_context_t *ctx, const coap_address_t *remote_addr, int ifindex)
| Get the session associated with the specified `remote_addr` and `index`.
const char * | coap_session_str (const coap_session_t *session)
| Get session description.

## Detailed Description

Session handling functions.

Definition in file coap_session.c.

## Macro Definition Documentation

## COAP_SESSION_C_

#define COAP_SESSION_C_

Definition at line 20 of file coap_session.c.

## INET6_ADDRSTRLEN

#define INET6_ADDRSTRLEN 46

Definition at line 2231 of file coap_session.c.

## Function Documentation

## coap_make_session()

coap_session_t * coap_make_session | ( | coap_proto_t | proto,
|  | coap_session_type_t | type,
|  | const coap_addr_hash_t * | addr_hash,
|  | const coap_address_t * | local_addr,
|  | const coap_address_t * | remote_addr,
|  | int | ifindex,
|  | coap_context_t * | context,
|  | coap_endpoint_t * | endpoint )

static

Definition at line 411 of file coap_session.c.

Here is the call graph for this function:

## coap_nack_name()

const char * coap_nack_name | ( | coap_nack_reason_t | reason | ) |

static

Definition at line 877 of file coap_session.c.

Here is the caller graph for this function:

## coap_proto_name()

const char * coap_proto_name | ( | coap_proto_t | proto | ) |

static

Definition at line 2003 of file coap_session.c.

Here is the caller graph for this function:

## coap_session_max_pdu_size_internal()

size_t coap_session_max_pdu_size_internal | ( | const coap_session_t * | session,
|  | size_t | max_with_header )

static

Definition at line 603 of file coap_session.c.

Here is the caller graph for this function:

## coap_session_send_ping()

COAP_API coap_mid_t coap_session_send_ping | ( | coap_session_t * | session | ) |

Send a ping message for the session.

Parameters

  session | The CoAP session.

Returns
  COAP_INVALID_MID if there is an error

Definition at line 783 of file coap_session.c.

Here is the call graph for this function: