API for checking session encryption

This commit is contained in:
Magdalena Szumny authored and Jon Shallow committed 2026-02-17 09:57:28 +00:00
1 parent 146e0bbe77
commit e80fe9edd2
6 files changed
+30

No files matched your search

+9
View File
@@ -198,6 +198,15 @@ coap_proto_t coap_session_get_proto(const coap_session_t *session);
*/
coap_session_type_t coap_session_get_type(const coap_session_t *session);
/**
* Check if the session is using OSCORE.
*
* @param session The CoAP session.
*
* @return @c 1 if the session is using OSCORE, @c 0 otherwise.
*/
int coap_session_is_oscore(const coap_session_t *session);
/**
* Get the session state
*
+1
View File
@@ -299,6 +299,7 @@ global:
coap_session_get_tls;
coap_session_get_type;
coap_session_init_token;
coap_session_is_oscore;
coap_session_max_pdu_size;
coap_session_new_token;
coap_session_reference;
+1
View File
@@ -297,6 +297,7 @@ coap_session_get_state
coap_session_get_tls
coap_session_get_type
coap_session_init_token
coap_session_is_oscore
coap_session_max_pdu_size
coap_session_new_token
coap_session_reference
+1
View File
@@ -232,6 +232,7 @@ install-man: install-man3 install-man5 install-man7
@echo ".so man3/coap_session.3" > coap_session_get_state.3
@echo ".so man3/coap_session.3" > coap_session_get_tls.3
@echo ".so man3/coap_session.3" > coap_session_get_type.3
@echo ".so man3/coap_session.3" > coap_session_is_oscore.3
@echo ".so man3/coap_string.3" > coap_delete_bin_const.3
@echo ".so man3/coap_string.3" > coap_make_str_const.3
@echo ".so man3/coap_string.3" > coap_string_equal.3
+8
View File
@@ -26,6 +26,7 @@ coap_session_get_proto,
coap_session_get_state,
coap_session_get_tls,
coap_session_get_type,
coap_session_is_oscore,
coap_session_get_psk_hint,
coap_session_get_psk_key,
coap_endpoint_set_app_data,
@@ -71,6 +72,8 @@ coap_tls_library_t *tls_lib);*
*coap_session_type_t coap_session_get_type(const coap_session_t *_session_);*
*int coap_session_is_oscore(const coap_session_t *_session_);*
*const coap_bin_const_t *coap_session_get_psk_hint(
const coap_session_t *_session_);*
@@ -249,6 +252,9 @@ COAP_SESSION_TYPE_HELLO /* Negotiating a (D)TLS session */
The *coap_session_get_type*() function is used to get the session type from the
_session_.
The *coap_session_is_oscore*() function returns whether the _session_ is
using OSCORE. Returns 1 if the session is using OSCORE, 0 otherwise.
The *coap_session_get_psk_hint*() function is used to get the current server
_session_'s pre-shared-key identity hint.
@@ -289,6 +295,8 @@ error.
*coap_session_get_type*() returns the current session's type or 0 on error.
*coap_session_is_oscore*() returns 1 if the session is using OSCORE, 0 otherwise.
*coap_session_get_psk_hint*() returns the current server session's
pre-shared-key identity hint, or NULL if not defined.
+10
View File
@@ -2338,6 +2338,16 @@ coap_session_get_type(const coap_session_t *session) {
return 0;
}
int
coap_session_is_oscore(const coap_session_t *session) {
#if COAP_OSCORE_SUPPORT
return (session && session->oscore_encryption != 0) ? 1 : 0;
#else
(void)session;
return 0;
#endif
}
COAP_API int
coap_session_set_type_client(coap_session_t *session) {
int ret;