Loading...
Searching...
No Matches
coap_session_internal.h
Go to the documentation of this file.
/*
* coap_session_internal.h -- Structures, Enums & Functions that are not
* exposed to application programming
*
* Copyright (C) 2010-2024 Olaf Bergmann <bergmann@tzi.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*
* This file is part of the CoAP library libcoap. Please see README for terms
* of use.
*/
#ifndef COAP_SESSION_INTERNAL_H_
#define COAP_SESSION_INTERNAL_H_
#include "coap_internal.h"
#include "coap_io_internal.h"
#include "coap_ws_internal.h"
#define COAP_DEFAULT_SESSION_TIMEOUT 300
#define COAP_PARTIAL_SESSION_TIMEOUT_TICKS (30 * COAP_TICKS_PER_SECOND)
#define COAP_DEFAULT_MAX_HANDSHAKE_SESSIONS 100
struct coap_addr_hash_t {
coap_address_t remote;
uint16_t lport;
coap_proto_t proto;
};
typedef enum {
COAP_OSCORE_B_2_NONE = 0,
COAP_OSCORE_B_2_STEP_1,
COAP_OSCORE_B_2_STEP_2,
COAP_OSCORE_B_2_STEP_3,
COAP_OSCORE_B_2_STEP_4,
COAP_OSCORE_B_2_STEP_5,
} COAP_OSCORE_B_2_STEP;
typedef enum coap_ext_token_check_t {
COAP_EXT_T_NOT_CHECKED = 0,
COAP_EXT_T_CHECKED,
COAP_EXT_T_CHECKING,
} coap_ext_token_check_t;
struct coap_session_t {
coap_proto_t proto;
coap_session_type_t type;
coap_session_state_t state;
unsigned ref;
size_t tls_overhead;
size_t mtu;
size_t csm_rcv_mtu;
coap_addr_hash_t addr_hash;
UT_hash_handle hh;
coap_addr_tuple_t addr_info;
int ifindex;
coap_socket_t sock;
#if COAP_SERVER_SUPPORT
coap_endpoint_t *endpoint;
#endif /* COAP_SERVER_SUPPORT */
coap_context_t *context;
void *tls;
uint16_t tx_mid;
uint8_t con_active;
uint8_t csm_block_supported;
coap_mid_t last_ping_mid;
coap_queue_t *delayqueue;
coap_lg_xmit_t *lg_xmit;
#if COAP_CLIENT_SUPPORT
coap_lg_crcv_t *lg_crcv;
#endif /* COAP_CLIENT_SUPPORT */
#if COAP_SERVER_SUPPORT
coap_lg_srcv_t *lg_srcv;
#endif /* COAP_SERVER_SUPPORT */
size_t partial_write;
uint8_t read_header[8];
size_t partial_read;
coap_pdu_t *partial_pdu;
coap_tick_t last_rx_tx;
coap_tick_t last_tx_rst;
coap_tick_t last_ping;
coap_tick_t last_pong;
coap_tick_t csm_tx;
coap_dtls_cpsk_t cpsk_setup_data;
coap_bin_const_t *psk_identity;
coap_bin_const_t *psk_key;
coap_bin_const_t *psk_hint;
void *app;
coap_fixed_point_t ack_timeout;
coap_fixed_point_t ack_random_factor;
uint16_t max_retransmit;
uint16_t nstart;
coap_fixed_point_t default_leisure;
uint32_t probing_rate;
#if COAP_Q_BLOCK_SUPPORT
uint16_t max_payloads;
uint16_t non_max_retransmit;
coap_fixed_point_t non_timeout;
coap_fixed_point_t non_receive_timeout;
coap_fixed_point_t non_probing_wait_base;
coap_fixed_point_t non_partial_timeout;
#endif /* COAP_Q_BLOCK_SUPPORT */
unsigned int dtls_timeout_count;
int dtls_event;
uint32_t tx_rtag;
uint32_t block_mode;
uint8_t csm_bert_rem_support;
uint8_t csm_bert_loc_support;
uint8_t doing_first;
uint8_t proxy_session;
uint8_t delay_recursive;
uint8_t no_observe_cancel;
uint8_t csm_not_seen;
#if COAP_OSCORE_SUPPORT
uint8_t oscore_encryption;
COAP_OSCORE_B_2_STEP b_2_step;
oscore_recipient_ctx_t *recipient_ctx;
oscore_association_t *associations;
uint64_t oscore_r2;
#endif /* COAP_OSCORE_SUPPORT */
#if COAP_WS_SUPPORT
coap_ws_state_t *ws;
coap_str_const_t *ws_host;
#endif /* COAP_WS_SUPPORT */
#if COAP_OSCORE_SUPPORT
uint8_t done_b_1_2;
#endif /* COAP_OSCORE_SUPPORT */
volatile uint8_t max_token_checked;
#if COAP_CLIENT_SUPPORT
uint8_t negotiated_cid;
#endif /* COAP_CLIENT_SUPPORT */
uint8_t is_dtls13;
coap_mid_t remote_test_mid;
uint32_t max_token_size;
uint64_t tx_token;
coap_bin_const_t *last_token;
coap_bin_const_t *echo;
coap_mid_t last_ack_mid;
coap_mid_t last_con_mid;
coap_response_t last_con_handler_res;
#if COAP_SERVER_SUPPORT
coap_bin_const_t *client_cid;
#endif /* COAP_SERVER_SUPPORT */
};
#if COAP_SERVER_SUPPORT
struct coap_endpoint_t {
struct coap_endpoint_t *next;
coap_context_t *context;
coap_proto_t proto;
uint16_t default_mtu;
coap_socket_t sock;
coap_address_t bind_addr;
coap_session_t *sessions;
};
#endif /* COAP_SERVER_SUPPORT */
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);
coap_fixed_point_t coap_get_non_timeout_random(coap_session_t *session);
coap_tick_t coap_get_non_timeout_random_ticks(coap_session_t *session);
void coap_session_send_csm(coap_session_t *session);
void coap_session_connected(coap_session_t *session);
void coap_session_disconnected_lkd(coap_session_t *session,
coap_nack_reason_t reason);
coap_mid_t coap_session_send_ping_lkd(coap_session_t *session);
int coap_session_refresh_psk_hint(coap_session_t *session,
const coap_bin_const_t *psk_hint);
int coap_session_refresh_psk_key(coap_session_t *session,
const coap_bin_const_t *psk_key);
int coap_session_refresh_psk_identity(coap_session_t *session,
const coap_bin_const_t *psk_identity);
#if COAP_SERVER_SUPPORT
coap_session_t *coap_new_server_session(coap_context_t *ctx,
coap_endpoint_t *ep,
void *extra);
#endif /* COAP_SERVER_SUPPORT */
void coap_session_establish(coap_session_t *session);
coap_session_t *coap_session_reference_lkd(coap_session_t *session);
void coap_session_release_lkd(coap_session_t *session);
ssize_t coap_session_send_pdu(coap_session_t *session, coap_pdu_t *pdu);
ssize_t coap_session_delay_pdu(coap_session_t *session, coap_pdu_t *pdu,
coap_queue_t *node);
#if COAP_SERVER_SUPPORT
coap_session_t *coap_endpoint_get_session(coap_endpoint_t *endpoint,
const coap_packet_t *packet, coap_tick_t now);
coap_endpoint_t *coap_new_endpoint_lkd(coap_context_t *context, const coap_address_t *listen_addr,
coap_proto_t proto);
void coap_free_endpoint_lkd(coap_endpoint_t *endpoint);
#endif /* COAP_SERVER_SUPPORT */
size_t coap_session_max_pdu_rcv_size(const coap_session_t *session);
size_t coap_session_max_pdu_size_lkd(const coap_session_t *session);
coap_session_t *coap_new_client_session_lkd(
coap_context_t *ctx,
const coap_address_t *local_if,
const coap_address_t *server,
coap_proto_t proto
);
coap_session_t *coap_new_client_session_pki_lkd(coap_context_t *ctx,
const coap_address_t *local_if,
const coap_address_t *server,
coap_proto_t proto,
coap_dtls_pki_t *setup_data
);
coap_session_t *coap_new_client_session_psk_lkd(coap_context_t *ctx,
const coap_address_t *local_if,
const coap_address_t *server,
coap_proto_t proto,
const char *identity,
const uint8_t *key,
unsigned key_len
);
coap_session_t *coap_new_client_session_psk2_lkd(coap_context_t *ctx,
const coap_address_t *local_if,
const coap_address_t *server,
coap_proto_t proto,
coap_dtls_cpsk_t *setup_data
);
coap_session_t *coap_session_new_dtls_session(coap_session_t *session,
coap_tick_t now);
void coap_session_free(coap_session_t *session);
void coap_session_mfree(coap_session_t *session);
void coap_read_session(coap_context_t *ctx, coap_session_t *session, coap_tick_t now);
void coap_connect_session(coap_session_t *session, coap_tick_t now);
#define COAP_SESSION_REF(s) ((s)->ref
/* RFC7252 */
#define COAP_ACK_TIMEOUT(s) ((s)->ack_timeout)
#define COAP_ACK_RANDOM_FACTOR(s) ((s)->ack_random_factor)
#define COAP_MAX_RETRANSMIT(s) ((s)->max_retransmit)
#define COAP_NSTART(s) ((s)->nstart)
#define COAP_DEFAULT_LEISURE(s) ((s)->default_leisure)
#define COAP_PROBING_RATE(s) ((s)->probing_rate)
/* RFC9177 */
#define COAP_MAX_PAYLOADS(s) ((s)->max_payloads)
#define COAP_NON_MAX_RETRANSMIT(s) ((s)->non_max_retransmit)
#define COAP_NON_TIMEOUT(s) ((s)->non_timeout)
#define COAP_NON_TIMEOUT_TICKS(s) \
(COAP_NON_TIMEOUT(s).integer_part * COAP_TICKS_PER_SECOND + \
COAP_NON_TIMEOUT(s).fractional_part * COAP_TICKS_PER_SECOND / 1000)
#define COAP_NON_RECEIVE_TIMEOUT(s) ((s)->non_receive_timeout)
#define COAP_NON_PROBING_WAIT_BASE(s) ((s)->non_probing_wait_base)
#define COAP_NON_PARTIAL_TIMEOUT(s) ((s)->non_partial_timeout)
#define COAP_DEFAULT_LEISURE_TICKS(s) \
(COAP_DEFAULT_LEISURE(s).integer_part * COAP_TICKS_PER_SECOND + \
COAP_DEFAULT_LEISURE(s).fractional_part * COAP_TICKS_PER_SECOND / 1000)
#define COAP_MAX_TRANSMIT_SPAN(s) \
(((s)->ack_timeout.integer_part * 1000 + (s)->ack_timeout.fractional_part) * \
((1 << ((s)->max_retransmit)) -1) * \
((s)->ack_random_factor.integer_part * 1000 + \
(s)->ack_random_factor.fractional_part) \
/ 1000000)
#define COAP_MAX_TRANSMIT_WAIT(s) \
(((s)->ack_timeout.integer_part * 1000 + (s)->ack_timeout.fractional_part) * \
((1 << ((s)->max_retransmit + 1)) -1) * \
((s)->ack_random_factor.integer_part * 1000 + \
(s)->ack_random_factor.fractional_part) \
/ 1000000)
#define COAP_MAX_TRANSMIT_WAIT_TICKS(s) \
(COAP_MAX_TRANSMIT_WAIT(s) * COAP_TICKS_PER_SECOND)
#define COAP_PROCESSING_DELAY(s) \
(((s)->ack_timeout.integer_part * 1000 + (s)->ack_timeout.fractional_part + \
500) / 1000)
#define COAP_MAX_RTT(s) \
((2 * COAP_DEFAULT_MAX_LATENCY) + COAP_PROCESSING_DELAY(s))
#define COAP_EXCHANGE_LIFETIME(s) \
(COAP_MAX_TRANSMIT_SPAN(s) + (2 * COAP_DEFAULT_MAX_LATENCY) + \
COAP_PROCESSING_DELAY(s))
#define COAP_NON_LIFETIME(s) \
(COAP_MAX_TRANSMIT_SPAN(s) + COAP_DEFAULT_MAX_LATENCY)
#define COAP_NON_RECEIVE_TIMEOUT_TICKS(s) ( \
COAP_NON_RECEIVE_TIMEOUT(s).integer_part * COAP_TICKS_PER_SECOND + \
COAP_NON_RECEIVE_TIMEOUT(s).fractional_part * COAP_TICKS_PER_SECOND / 1000)
#define COAP_NON_PROBING_WAIT(s) \
coap_add_fixed_fixed(COAP_NON_PROBING_WAIT_BASE(s), \
COAP_NON_TIMEOUT_RANDOM(s))
#define COAP_NON_PROBING_WAIT_TICKS(s) \
(COAP_NON_PROBING_WAIT(s).integer_part * COAP_TICKS_PER_SECOND + \
COAP_NON_PROBING_WAIT(s).fractional_part * COAP_TICKS_PER_SECOND / 1000)
#define COAP_NON_PARTIAL_TIMEOUT_TICKS(s) \
(COAP_NON_PARTIAL_TIMEOUT(s).integer_part * COAP_TICKS_PER_SECOND + \
COAP_NON_PARTIAL_TIMEOUT(s).fractional_part * COAP_TICKS_PER_SECOND / 1000)
#define COAP_NON_TIMEOUT_RANDOM(s) \
coap_get_non_timeout_random(s)
#define SESSIONS_ADD(e, obj) \
HASH_ADD(hh, (e), addr_hash, sizeof((obj)->addr_hash), (obj))
#define SESSIONS_DELETE(e, obj) \
HASH_DELETE(hh, (e), (obj))
#define SESSIONS_ITER(e, el, rtmp) \
HASH_ITER(hh, (e), el, rtmp)
#define SESSIONS_ITER_SAFE(e, el, rtmp) \
for ((el) = (e); (el) && ((rtmp) = (el)->hh.next, 1); (el) = (rtmp))
#define SESSIONS_FIND(e, k, res) { \
HASH_FIND(hh, (e), &(k), sizeof(k), (res)); \
}
#endif /* COAP_SESSION_INTERNAL_H_ */
coap_internal.h
Pulls together all the internal only header files.
coap_nack_reason_t
coap_nack_reason_t
Definition coap_io.h:62
coap_io_internal.h
Internal network I/O functions.
coap_ws_internal.h
Internal CoAP WebSockets support.
coap_tick_t
uint64_t coap_tick_t
This data type represents internal timer ticks with COAP_TICKS_PER_SECOND resolution.
Definition coap_time.h:143
coap_response_t
coap_response_t
Definition coap_net.h:48
coap_session_new_dtls_session
coap_session_t * coap_session_new_dtls_session(coap_session_t *session, coap_tick_t now)
Create a new DTLS session for the session.
coap_mid_t
int coap_mid_t
coap_mid_t is used to store the CoAP Message ID of a CoAP PDU.
Definition coap_pdu.h:263
coap_proto_t
coap_proto_t
CoAP protocol types.
Definition coap_pdu.h:312
coap_connect_session
void coap_connect_session(coap_session_t *session, coap_tick_t now)
coap_session_delay_pdu
ssize_t coap_session_delay_pdu(coap_session_t *session, coap_pdu_t *pdu, coap_queue_t *node)
Definition coap_session.c:695
coap_session_refresh_psk_hint
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).
Definition coap_session.c:1665
coap_session_send_csm
void coap_session_send_csm(coap_session_t *session)
Notify session transport has just connected and CSM exchange can now start.
Definition coap_session.c:736
coap_new_client_session_psk2_lkd
coap_session_t * coap_new_client_session_psk2_lkd(coap_context_t *ctx, const coap_address_t *local_if, const coap_address_t *server, coap_proto_t proto, coap_dtls_cpsk_t *setup_data)
Creates a new client session to the designated server with PSK credentials.
coap_add_fixed_uint
coap_fixed_point_t coap_add_fixed_uint(coap_fixed_point_t fp1, uint32_t u2)
Definition coap_session.c:60
coap_session_max_pdu_rcv_size
size_t coap_session_max_pdu_rcv_size(const coap_session_t *session)
Get maximum acceptable receive PDU size.
Definition coap_session.c:626
coap_sub_fixed_uint
coap_fixed_point_t coap_sub_fixed_uint(coap_fixed_point_t fp1, uint32_t u2)
Definition coap_session.c:68
coap_endpoint_get_session
coap_session_t * coap_endpoint_get_session(coap_endpoint_t *endpoint, const coap_packet_t *packet, coap_tick_t now)
Lookup the server session for the packet received on an endpoint, or create a new one.
coap_free_endpoint_lkd
void coap_free_endpoint_lkd(coap_endpoint_t *endpoint)
Release an endpoint and all the structures associated with it.
coap_new_client_session_psk_lkd
coap_session_t * coap_new_client_session_psk_lkd(coap_context_t *ctx, const coap_address_t *local_if, const coap_address_t *server, coap_proto_t proto, const char *identity, const uint8_t *key, unsigned key_len)
Creates a new client session to the designated server with PSK credentials.
coap_ext_token_check_t
coap_ext_token_check_t
coap_ext_token_check_t values
Definition coap_session_internal.h:58
coap_read_session
void coap_read_session(coap_context_t *ctx, coap_session_t *session, coap_tick_t now)
Definition coap_net.c:2080
coap_session_establish
void coap_session_establish(coap_session_t *session)
Layer function interface for layer below session accept/connect being established.
Definition coap_session.c:1395
coap_new_client_session_pki_lkd
coap_session_t * coap_new_client_session_pki_lkd(coap_context_t *ctx, const coap_address_t *local_if, const coap_address_t *server, coap_proto_t proto, coap_dtls_pki_t *setup_data)
Creates a new client session to the designated server with PKI credentials.
coap_new_client_session_lkd
coap_session_t * coap_new_client_session_lkd(coap_context_t *ctx, const coap_address_t *local_if, const coap_address_t *server, coap_proto_t proto)
Creates a new client session to the designated server.
coap_add_fixed_fixed
coap_fixed_point_t coap_add_fixed_fixed(coap_fixed_point_t fp1, coap_fixed_point_t fp2)
Definition coap_session.c:50
coap_get_non_timeout_random_ticks
coap_tick_t coap_get_non_timeout_random_ticks(coap_session_t *session)
coap_session_refresh_psk_key
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).
Definition coap_session.c:1694
coap_session_connected
void coap_session_connected(coap_session_t *session)
Notify session that it has just connected or reconnected.
Definition coap_session.c:815
coap_multi_fixed_fixed
coap_fixed_point_t coap_multi_fixed_fixed(coap_fixed_point_t fp1, coap_fixed_point_t fp2)
Definition coap_session.c:30
coap_session_send_pdu
ssize_t coap_session_send_pdu(coap_session_t *session, coap_pdu_t *pdu)
Send a pdu according to the session's protocol.
Definition coap_net.c:1001
coap_session_max_pdu_size_lkd
size_t coap_session_max_pdu_size_lkd(const coap_session_t *session)
Get maximum acceptable PDU size.
Definition coap_session.c:652
coap_session_send_ping_lkd
coap_mid_t coap_session_send_ping_lkd(coap_session_t *session)
Send a ping message for the session.
Definition coap_session.c:793
coap_div_fixed_uint
coap_fixed_point_t coap_div_fixed_uint(coap_fixed_point_t fp1, uint32_t u2)
Definition coap_session.c:76
coap_session_free
void coap_session_free(coap_session_t *session)
Definition coap_session.c:570
coap_session_mfree
void coap_session_mfree(coap_session_t *session)
Definition coap_session.c:488
coap_session_release_lkd
void coap_session_release_lkd(coap_session_t *session)
Decrement reference counter on a session.
Definition coap_session.c:376
coap_session_refresh_psk_identity
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).
Definition coap_session.c:1722
coap_get_non_timeout_random
coap_fixed_point_t coap_get_non_timeout_random(coap_session_t *session)
COAP_OSCORE_B_2_STEP
COAP_OSCORE_B_2_STEP
Definition coap_session_internal.h:46
coap_session_reference_lkd
coap_session_t * coap_session_reference_lkd(coap_session_t *session)
Increment reference counter on a session.
Definition coap_session.c:356
coap_multi_fixed_uint
coap_fixed_point_t coap_multi_fixed_uint(coap_fixed_point_t fp1, uint32_t u2)
Definition coap_session.c:40
coap_session_disconnected_lkd
void coap_session_disconnected_lkd(coap_session_t *session, coap_nack_reason_t reason)
Notify session that it has failed.
Definition coap_session.c:911
coap_new_endpoint_lkd
coap_endpoint_t * coap_new_endpoint_lkd(coap_context_t *context, const coap_address_t *listen_addr, coap_proto_t proto)
Create a new endpoint for communicating with peers.
coap_new_server_session
coap_session_t * coap_new_server_session(coap_context_t *ctx, coap_endpoint_t *ep, void *extra)
Creates a new server session for the specified endpoint.
COAP_EXT_T_NOT_CHECKED
@ COAP_EXT_T_NOT_CHECKED
Not checked.
Definition coap_session_internal.h:59
COAP_EXT_T_CHECKING
@ COAP_EXT_T_CHECKING
Token size check request sent.
Definition coap_session_internal.h:61
COAP_EXT_T_CHECKED
@ COAP_EXT_T_CHECKED
Token size valid.
Definition coap_session_internal.h:60
COAP_OSCORE_B_2_NONE
@ COAP_OSCORE_B_2_NONE
Definition coap_session_internal.h:47
COAP_OSCORE_B_2_STEP_3
@ COAP_OSCORE_B_2_STEP_3
Definition coap_session_internal.h:50
COAP_OSCORE_B_2_STEP_1
@ COAP_OSCORE_B_2_STEP_1
Definition coap_session_internal.h:48
COAP_OSCORE_B_2_STEP_4
@ COAP_OSCORE_B_2_STEP_4
Definition coap_session_internal.h:51
COAP_OSCORE_B_2_STEP_5
@ COAP_OSCORE_B_2_STEP_5
Definition coap_session_internal.h:52
COAP_OSCORE_B_2_STEP_2
@ COAP_OSCORE_B_2_STEP_2
Definition coap_session_internal.h:49
coap_session_type_t
coap_session_type_t
coap_session_type_t values
Definition coap_session.h:44
coap_session_state_t
coap_session_state_t
coap_session_state_t values
Definition coap_session.h:55
coap_addr_hash_t
Only used for servers for hashing incoming packets.
Definition coap_session_internal.h:40
coap_addr_hash_t::lport
uint16_t lport
local port
Definition coap_session_internal.h:42
coap_addr_hash_t::remote
coap_address_t remote
remote address and port
Definition coap_session_internal.h:41
coap_addr_hash_t::proto
coap_proto_t proto
CoAP protocol.
Definition coap_session_internal.h:43
coap_addr_tuple_t
Definition coap_io.h:55
coap_address_t
Multi-purpose address abstraction.
Definition coap_address.h:148
coap_bin_const_t
CoAP binary data definition with const data.
Definition coap_str.h:64
coap_context_t
The CoAP stack's global state is stored in a coap_context_t object.
Definition coap_net_internal.h:50
coap_dtls_cpsk_t
The structure used for defining the Client PSK setup data to be used.
Definition coap_dtls.h:410
coap_dtls_pki_t
The structure used for defining the PKI setup data to be used.
Definition coap_dtls.h:312
coap_endpoint_t
Abstraction of virtual endpoint that can be attached to coap_context_t.
Definition coap_session_internal.h:232
coap_endpoint_t::context
coap_context_t * context
endpoint's context
Definition coap_session_internal.h:234
coap_endpoint_t::default_mtu
uint16_t default_mtu
default mtu for this interface
Definition coap_session_internal.h:236
coap_endpoint_t::sessions
coap_session_t * sessions
hash table or list of active sessions
Definition coap_session_internal.h:240
coap_endpoint_t::next
struct coap_endpoint_t * next
Definition coap_session_internal.h:233
coap_endpoint_t::bind_addr
coap_address_t bind_addr
local interface address
Definition coap_session_internal.h:239
coap_endpoint_t::sock
coap_socket_t sock
socket object for the interface, if any
Definition coap_session_internal.h:237
coap_endpoint_t::proto
coap_proto_t proto
protocol used on this interface
Definition coap_session_internal.h:235
coap_fixed_point_t
Abstraction of a fixed point number that can be used where necessary instead of a float.
Definition coap_session.h:31
coap_lg_crcv_t
Structure to hold large body (many blocks) client receive information.
Definition coap_block_internal.h:174
coap_lg_srcv_t
Structure to hold large body (many blocks) server receive information.
Definition coap_block_internal.h:207
coap_lg_xmit_t
Structure to hold large body (many blocks) transmission information.
Definition coap_block_internal.h:144
coap_packet_t
Definition coap_io_internal.h:225
coap_pdu_t
structure for CoAP PDUs
Definition coap_pdu_internal.h:135
coap_queue_t
Queue entry.
Definition coap_net_internal.h:35
coap_session_t
Abstraction of virtual session that can be attached to coap_context_t (client) or coap_endpoint_t (se...
Definition coap_session_internal.h:68
coap_session_t::last_pong
coap_tick_t last_pong
Definition coap_session_internal.h:114
coap_session_t::lg_xmit
coap_lg_xmit_t * lg_xmit
list of large transmissions
Definition coap_session_internal.h:96
coap_session_t::max_token_checked
volatile uint8_t max_token_checked
Check for max token size coap_ext_token_check_t.
Definition coap_session_internal.h:204
coap_session_t::csm_not_seen
uint8_t csm_not_seen
Set if timeout waiting for CSM.
Definition coap_session_internal.h:187
coap_session_t::dtls_timeout_count
unsigned int dtls_timeout_count
dtls setup retry counter
Definition coap_session_internal.h:175
coap_session_t::psk_key
coap_bin_const_t * psk_key
If client, this field contains the current pre-shared key for server; When this field is NULL,...
Definition coap_session_internal.h:127
coap_session_t::endpoint
coap_endpoint_t * endpoint
session's endpoint
Definition coap_session_internal.h:84
coap_session_t::block_mode
uint32_t block_mode
Zero or more COAP_BLOCK_ or'd options.
Definition coap_session_internal.h:179
coap_session_t::doing_first
uint8_t doing_first
Set if doing client's first request.
Definition coap_session_internal.h:182
coap_session_t::delay_recursive
uint8_t delay_recursive
Set if in coap_client_delay_first().
Definition coap_session_internal.h:184
coap_session_t::last_rx_tx
coap_tick_t last_rx_tx
Definition coap_session_internal.h:111
coap_session_t::sock
coap_socket_t sock
socket object for the session, if any
Definition coap_session_internal.h:81
coap_session_t::partial_pdu
coap_pdu_t * partial_pdu
incomplete incoming pdu
Definition coap_session_internal.h:110
coap_session_t::max_token_size
uint32_t max_token_size
Largest token size supported RFC8974.
Definition coap_session_internal.h:212
coap_session_t::nstart
uint16_t nstart
maximum concurrent confirmable xmits (default 1)
Definition coap_session_internal.h:152
coap_session_t::psk_identity
coap_bin_const_t * psk_identity
If client, this field contains the current identity for server; When this field is NULL,...
Definition coap_session_internal.h:118
coap_session_t::state
coap_session_state_t state
current state of relationship with peer
Definition coap_session_internal.h:71
coap_session_t::csm_bert_rem_support
uint8_t csm_bert_rem_support
CSM TCP BERT blocks supported (remote).
Definition coap_session_internal.h:180
coap_session_t::hh
UT_hash_handle hh
Definition coap_session_internal.h:78
coap_session_t::tx_token
uint64_t tx_token
Next token number to use.
Definition coap_session_internal.h:213
coap_session_t::client_cid
coap_bin_const_t * client_cid
Contains client CID or NULL.
Definition coap_session_internal.h:223
coap_session_t::remote_test_mid
coap_mid_t remote_test_mid
mid used for checking remote support
Definition coap_session_internal.h:210
coap_session_t::read_header
uint8_t read_header[8]
storage space for header of incoming message header
Definition coap_session_internal.h:106
coap_session_t::csm_bert_loc_support
uint8_t csm_bert_loc_support
CSM TCP BERT blocks supported (local).
Definition coap_session_internal.h:181
coap_session_t::addr_info
coap_addr_tuple_t addr_info
remote/local address info
Definition coap_session_internal.h:79
coap_session_t::proto
coap_proto_t proto
protocol used
Definition coap_session_internal.h:69
coap_session_t::tx_mid
uint16_t tx_mid
the last message id that was used in this session
Definition coap_session_internal.h:88
coap_session_t::is_dtls13
uint8_t is_dtls13
Set if session is DTLS1.3.
Definition coap_session_internal.h:209
coap_session_t::ref
unsigned ref
reference count from queues
Definition coap_session_internal.h:73
coap_session_t::csm_rcv_mtu
size_t csm_rcv_mtu
CSM mtu (rcv).
Definition coap_session_internal.h:76
coap_session_t::last_con_handler_res
coap_response_t last_con_handler_res
The result of calling the response handler of the last CON.
Definition coap_session_internal.h:220
coap_session_t::psk_hint
coap_bin_const_t * psk_hint
If client, this field contains the server provided identity hint.
Definition coap_session_internal.h:136
coap_session_t::last_token
coap_bin_const_t * last_token
Definition coap_session_internal.h:214
coap_session_t::cpsk_setup_data
coap_dtls_cpsk_t cpsk_setup_data
client provided PSK initial setup data
Definition coap_session_internal.h:116
coap_session_t::mtu
size_t mtu
path or CSM mtu (xmt)
Definition coap_session_internal.h:75
coap_session_t::negotiated_cid
uint8_t negotiated_cid
Set for a client if CID negotiated.
Definition coap_session_internal.h:207
coap_session_t::no_observe_cancel
uint8_t no_observe_cancel
Set if do not cancel observe on session close.
Definition coap_session_internal.h:185
coap_session_t::partial_read
size_t partial_read
if > 0 indicates number of bytes already read for an incoming message
Definition coap_session_internal.h:108
coap_session_t::dtls_event
int dtls_event
Tracking any (D)TLS events on this session.
Definition coap_session_internal.h:176
coap_session_t::tls
void * tls
security parameters
Definition coap_session_internal.h:87
coap_session_t::max_retransmit
uint16_t max_retransmit
maximum re-transmit count (default 4)
Definition coap_session_internal.h:150
coap_session_t::csm_block_supported
uint8_t csm_block_supported
CSM TCP blocks supported.
Definition coap_session_internal.h:91
coap_session_t::ack_random_factor
coap_fixed_point_t ack_random_factor
ack random factor backoff (default 1.5)
Definition coap_session_internal.h:148
coap_session_t::proxy_session
uint8_t proxy_session
Set if this is an ongoing proxy session.
Definition coap_session_internal.h:183
coap_session_t::con_active
uint8_t con_active
Active CON request sent.
Definition coap_session_internal.h:90
coap_session_t::delayqueue
coap_queue_t * delayqueue
list of delayed messages waiting to be sent
Definition coap_session_internal.h:94
coap_session_t::tls_overhead
size_t tls_overhead
overhead of TLS layer
Definition coap_session_internal.h:74
coap_session_t::app
void * app
application-specific data
Definition coap_session_internal.h:145
coap_session_t::tx_rtag
uint32_t tx_rtag
Next Request-Tag number to use.
Definition coap_session_internal.h:178
coap_session_t::last_ping_mid
coap_mid_t last_ping_mid
the last keepalive message id that was used in this session
Definition coap_session_internal.h:92
coap_session_t::lg_srcv
coap_lg_srcv_t * lg_srcv
Server list of expected large receives.
Definition coap_session_internal.h:101
coap_session_t::last_ping
coap_tick_t last_ping
Definition coap_session_internal.h:113
coap_session_t::lg_crcv
coap_lg_crcv_t * lg_crcv
Client list of expected large receives.
Definition coap_session_internal.h:98
coap_session_t::ack_timeout
coap_fixed_point_t ack_timeout
timeout waiting for ack (default 2.0 secs)
Definition coap_session_internal.h:146
coap_session_t::default_leisure
coap_fixed_point_t default_leisure
Mcast leisure time (default 5.0 secs).
Definition coap_session_internal.h:154
coap_session_t::last_con_mid
coap_mid_t last_con_mid
The last CON mid that has been been processed.
Definition coap_session_internal.h:218
coap_session_t::type
coap_session_type_t type
client or server side socket
Definition coap_session_internal.h:70
coap_session_t::probing_rate
uint32_t probing_rate
Max transfer wait when remote is not respoding (default 1 byte/sec).
Definition coap_session_internal.h:156
coap_session_t::last_ack_mid
coap_mid_t last_ack_mid
The last ACK mid that has been been processed.
Definition coap_session_internal.h:216
coap_session_t::last_tx_rst
coap_tick_t last_tx_rst
Definition coap_session_internal.h:112
coap_session_t::context
coap_context_t * context
session's context
Definition coap_session_internal.h:86
coap_session_t::partial_write
size_t partial_write
if > 0 indicates number of bytes already written from the pdu at the head of sendqueue
Definition coap_session_internal.h:103
coap_session_t::addr_hash
coap_addr_hash_t addr_hash
Address hash for server incoming packets.
Definition coap_session_internal.h:77
coap_session_t::csm_tx
coap_tick_t csm_tx
Definition coap_session_internal.h:115
coap_session_t::ifindex
int ifindex
interface index
Definition coap_session_internal.h:80
coap_session_t::echo
coap_bin_const_t * echo
last token used to make a request
Definition coap_session_internal.h:215
coap_socket_t
Definition coap_io_internal.h:38
coap_str_const_t
CoAP string data definition with const data.
Definition coap_str.h:46
coap_ws_state_t
WebSockets session state.
Definition coap_ws_internal.h:37
oscore_association_t
Definition oscore_context.h:142
oscore_recipient_ctx_t
Definition oscore_context.h:112