libcoap 4.3.5-develop-bd47692
Loading...
Searching...
No Matches
coap_oscore.h
Go to the documentation of this file.
1/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
3/*
4 * coap_oscore.h -- Object Security for Constrained RESTful Environments
5 * (OSCORE) support for libcoap
6 *
7 * Copyright (C) 2019-2026 Olaf Bergmann <bergmann@tzi.org>
8 * Copyright (C) 2021-2026 Jon Shallow <supjps-libcoap@jpshallow.com>
9 *
10 * SPDX-License-Identifier: BSD-2-Clause
11 *
12 * This file is part of the CoAP library libcoap. Please see README for terms
13 * of use.
14 */
15
21#ifndef COAP_OSCORE_H_
22#define COAP_OSCORE_H_
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
54typedef coap_oscore_conf_t *(*coap_oscore_find_handler_t)(
55 const coap_session_t *session,
56 const coap_bin_const_t *rcpkey_id,
57 const coap_bin_const_t *ctxkey_id
58);
59
78 const coap_session_t *session,
79 const coap_bin_const_t *rcpkey_id,
80 const coap_bin_const_t *ctxkey_id,
81 uint64_t receiver_seq_num,
82 uint64_t seq_num_window
83);
84
107 const coap_address_t *local_if,
108 const coap_address_t *server,
109 coap_proto_t proto,
110 coap_oscore_conf_t *oscore_conf);
111
144 const coap_address_t *local_if,
145 const coap_address_t *server,
146 coap_proto_t proto,
147 coap_oscore_conf_t *oscore_conf,
148 void *app_data,
150 coap_str_const_t *ws_host);
151
174 const coap_address_t *local_if,
175 const coap_address_t *server,
176 coap_proto_t proto,
177 coap_dtls_cpsk_t *psk_data,
178 coap_oscore_conf_t *oscore_conf);
179
213 const coap_address_t *local_if,
214 const coap_address_t *server,
215 coap_proto_t proto,
216 coap_dtls_cpsk_t *psk_data,
217 coap_oscore_conf_t *oscore_conf,
218 void *app_data,
220 coap_str_const_t *ws_host);
221
244 const coap_address_t *local_if,
245 const coap_address_t *server,
246 coap_proto_t proto,
247 coap_dtls_pki_t *pki_data,
248 coap_oscore_conf_t *oscore_conf);
249
283 const coap_address_t *local_if,
284 const coap_address_t *server,
285 coap_proto_t proto,
286 coap_dtls_pki_t *pki_data,
287 coap_oscore_conf_t *oscore_conf,
288 void *app_data,
290 coap_str_const_t *ws_host);
291
302 coap_oscore_conf_t *oscore_conf);
303
314typedef int (*coap_oscore_save_seq_num_t)(uint64_t sender_seq_num, void *param);
315
333 coap_oscore_save_seq_num_t save_seq_num_func,
334 void *save_seq_num_func_param,
335 uint64_t start_seq_num);
336
345
368 coap_context_t *context,
369 coap_oscore_find_handler_t find_handler,
370 coap_oscore_update_seq_num_handler_t update_seq_num_handler);
371
385 coap_bin_const_t *recipient_id);
386
399 coap_bin_const_t *recipient_id);
400
413 const coap_bin_const_t *recipient_id,
414 uint64_t last_seq,
415 uint64_t seq_window);
416
419#ifdef __cplusplus
420}
421#endif
422
423#endif /* COAP_OSCORE_H */
#define COAP_API
COAP_API int coap_oscore_recipient_set_latest_seq(coap_oscore_conf_t *oscore_conf, const coap_bin_const_t *recipient_id, uint64_t last_seq, uint64_t seq_window)
Set the latest sequence number and sliding window for the specified recipient id in the compiled conf...
coap_oscore_conf_t * coap_new_oscore_conf(coap_str_const_t conf_mem, coap_oscore_save_seq_num_t save_seq_num_func, void *save_seq_num_func_param, uint64_t start_seq_num)
Parse an OSCORE configuration (held in memory) and populate a OSCORE configuration structure.
COAP_API coap_session_t * coap_new_client_session_oscore_psk(coap_context_t *ctx, const coap_address_t *local_if, const coap_address_t *server, coap_proto_t proto, coap_dtls_cpsk_t *psk_data, coap_oscore_conf_t *oscore_conf)
Creates a new client session to the designated server with PSK credentials as well as protecting the ...
COAP_API coap_session_t * coap_new_client_session_oscore_psk3(coap_context_t *ctx, const coap_address_t *local_if, const coap_address_t *server, coap_proto_t proto, coap_dtls_cpsk_t *psk_data, coap_oscore_conf_t *oscore_conf, void *app_data, coap_app_data_free_callback_t callback, coap_str_const_t *ws_host)
Creates a new client session to the designated server, with PSK credentials protecting the data using...
int(* coap_oscore_update_seq_num_handler_t)(const coap_session_t *session, const coap_bin_const_t *rcpkey_id, const coap_bin_const_t *ctxkey_id, uint64_t receiver_seq_num, uint64_t seq_num_window)
Callback function type for persisting the OSCORE receiver sequence number and anti-replay sliding win...
Definition coap_oscore.h:77
int coap_delete_oscore_conf(coap_oscore_conf_t *oscore_conf)
Release all the information associated with the OSCORE configuration.
COAP_API coap_session_t * coap_new_client_session_oscore(coap_context_t *ctx, const coap_address_t *local_if, const coap_address_t *server, coap_proto_t proto, coap_oscore_conf_t *oscore_conf)
Creates a new client session to the designated server, protecting the data using OSCORE.
COAP_API int coap_context_oscore_server(coap_context_t *context, coap_oscore_conf_t *oscore_conf)
Set the context's default OSCORE configuration for a server.
coap_oscore_conf_t *(* coap_oscore_find_handler_t)(const coap_session_t *session, const coap_bin_const_t *rcpkey_id, const coap_bin_const_t *ctxkey_id)
Callback function type for overriding oscore_find_context().
Definition coap_oscore.h:54
COAP_API coap_session_t * coap_new_client_session_oscore_pki(coap_context_t *ctx, const coap_address_t *local_if, const coap_address_t *server, coap_proto_t proto, coap_dtls_pki_t *pki_data, coap_oscore_conf_t *oscore_conf)
Creates a new client session to the designated server with PKI credentials as well as protecting the ...
COAP_API coap_session_t * coap_new_client_session_oscore3(coap_context_t *ctx, const coap_address_t *local_if, const coap_address_t *server, coap_proto_t proto, coap_oscore_conf_t *oscore_conf, void *app_data, coap_app_data_free_callback_t callback, coap_str_const_t *ws_host)
Creates a new client session to the designated server, protecting the data using OSCORE,...
COAP_API int coap_new_oscore_recipient(coap_context_t *context, coap_bin_const_t *recipient_id)
Add in the specific Recipient ID into the OSCORE context (server only).
int(* coap_oscore_save_seq_num_t)(uint64_t sender_seq_num, void *param)
Definition of the function used to save the current Sender Sequence Number.
COAP_API int coap_delete_oscore_recipient(coap_context_t *context, coap_bin_const_t *recipient_id)
Release all the information associated for the specific Recipient ID (and hence stop any further OSCO...
COAP_API void coap_oscore_register_external_handlers(coap_context_t *context, coap_oscore_find_handler_t find_handler, coap_oscore_update_seq_num_handler_t update_seq_num_handler)
Register external storage handlers for OSCORE session state.
COAP_API coap_session_t * coap_new_client_session_oscore_pki3(coap_context_t *ctx, const coap_address_t *local_if, const coap_address_t *server, coap_proto_t proto, coap_dtls_pki_t *pki_data, coap_oscore_conf_t *oscore_conf, void *app_data, coap_app_data_free_callback_t callback, coap_str_const_t *ws_host)
Creates a new client session to the designated server, with PKI credentials protecting the data using...
coap_proto_t
CoAP protocol types Note: coap_layers_coap[] needs updating if extended.
Definition coap_pdu.h:317
void(* coap_app_data_free_callback_t)(void *data)
Callback to free off the app data when the entry is being deleted / freed off.
Multi-purpose address abstraction.
CoAP binary data definition with const data.
Definition coap_str.h:65
The CoAP stack's global state is stored in a coap_context_t object.
The structure used for defining the Client PSK setup data to be used.
Definition coap_dtls.h:414
The structure used for defining the PKI setup data to be used.
Definition coap_dtls.h:316
The structure used to hold the OSCORE configuration information.
Abstraction of virtual session that can be attached to coap_context_t (client) or coap_endpoint_t (se...
CoAP string data definition with const data.
Definition coap_str.h:47