libcoap 4.3.5-develop-5347a62
Loading...
Searching...
No Matches
coap_net_internal.h
Go to the documentation of this file.
1/*
2 * coap_net_internal.h -- CoAP context internal information
3 * exposed to application programming
4 *
5 * Copyright (C) 2010-2026 Olaf Bergmann <bergmann@tzi.org>
6 *
7 * SPDX-License-Identifier: BSD-2-Clause
8 *
9 * This file is part of the CoAP library libcoap. Please see README for terms
10 * of use.
11 */
12
17
18#ifndef COAP_NET_INTERNAL_H_
19#define COAP_NET_INTERNAL_H_
20
21#include "coap_subscribe.h"
22#include "coap_resource.h"
23#include "coap_oscore.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
35
51
57#if COAP_SERVER_SUPPORT
58 coap_resource_t *resources;
60 coap_resource_t *unknown_resource;
62 coap_resource_t *proxy_uri_resource;
67#endif /* COAP_SERVER_SUPPORT */
68
69#if COAP_ASYNC_SUPPORT
72 coap_async_t *async_state;
73 size_t async_count;
74 size_t max_async;
75 size_t max_async_per_session;
76 int async_state_traversing;
77#endif /* COAP_ASYNC_SUPPORT */
78
84#if COAP_SERVER_SUPPORT
85 coap_endpoint_t *endpoint;
86#endif /* COAP_SERVER_SUPPORT */
87#if COAP_CLIENT_SUPPORT
88 coap_session_t *sessions;
89#endif /* COAP_CLIENT_SUPPORT */
90
91#ifdef WITH_CONTIKI
92 struct uip_udp_conn *conn;
93 struct ctimer io_timer;
95#endif /* WITH_CONTIKI */
96
97#ifdef WITH_LWIP
98 coap_lwip_input_wait_handler_t input_wait_cb;
99 void *input_arg;
100 uint8_t timer_configured;
103#if NO_SYS == 0
104 sys_sem_t coap_io_timeout_sem;
105#endif /* NO_SYS == 0 */
106#endif /* WITH_LWIP */
107#ifdef RIOT_VERSION
108 thread_t *selecting_thread;
109#endif /* RIOT_VERSION */
110#if COAP_OSCORE_SUPPORT
111 struct oscore_ctx_t *p_osc_ctx;
112 coap_oscore_find_handler_t oscore_find_cb;
114 oscore_update_seq_num_cb;
115#endif /* COAP_OSCORE_SUPPORT */
116
117#if COAP_CLIENT_SUPPORT
118 coap_response_handler_t response_cb;
120#endif /* COAP_CLIENT_SUPPORT */
121#if COAP_PROXY_SUPPORT
122 coap_proxy_response_handler_t proxy_response_cb;
124#endif /* COAP_PROXY_SUPPORT */
130
131#if COAP_SERVER_SUPPORT
132 coap_observe_added_t observe_added_cb;
134 coap_observe_deleted_t observe_deleted_cb;
136 void *observe_user_data;
138 uint32_t observe_save_freq;
139 coap_track_observe_value_t track_observe_value_cb;
141 coap_dyn_resource_added_t dyn_resource_added_cb;
143 coap_resource_deleted_t resource_deleted_cb;
145#if COAP_WITH_OBSERVE_PERSIST
146 coap_bin_const_t *dyn_resource_save_file;
149 coap_bin_const_t *obs_cnt_save_file;
151 coap_bin_const_t *observe_save_file;
152 coap_pdu_t *unknown_pdu;
153 coap_session_t *unknown_session;
154#endif /* COAP_WITH_OBSERVE_PERSIST */
155#endif /* COAP_SERVER_SUPPORT */
156
162
164
165#if COAP_SERVER_SUPPORT
166 coap_dtls_spsk_t spsk_setup_data;
168#endif /* COAP_SERVER_SUPPORT */
169
170 unsigned int session_timeout;
173 unsigned int max_idle_sessions;
179 unsigned int ping_timeout;
182 uint32_t csm_timeout_ms;
185
186#if COAP_CLIENT_SUPPORT
187 unsigned int reconnect_time;
189 uint8_t retry_count;
191#endif /* COAP_CLIENT_SUPPORT */
192#if COAP_SERVER_SUPPORT
193 coap_cache_entry_t *cache;
194 uint16_t *cache_ignore_options;
196 size_t cache_ignore_count;
198#endif /* COAP_SERVER_SUPPORT */
199 void *app_data;
201 uint32_t max_token_size;
203#ifdef COAP_EPOLL_SUPPORT
204 int epfd;
205 int eptimerfd;
206#else /* ! COAP_EPOLL_SUPPORT */
207#if !defined(RIOT_VERSION) && !defined(WITH_CONTIKI)
208#if COAP_CONSTRAINED_STACK
209 fd_set readfds, writefds, exceptfds;
211#endif /* COAP_CONSTRAINED_STACK */
214 unsigned int num_sockets;
215#endif /* ! RIOT_VERSION && ! WITH_CONTIKI */
216#endif /* ! COAP_EPOLL_SUPPORT */
217#if COAP_SERVER_SUPPORT
218 uint8_t observe_pending;
219 uint8_t observe_no_clear;
221 uint8_t mcast_per_resource;
223 uint8_t shutdown_no_send_observe;
226 uint32_t lg_srcv_cnt;
227 size_t max_bodies_ram;
229 size_t cur_bodies_ram;
230#endif /* COAP_SERVER_SUPPORT */
231#if COAP_PROXY_SUPPORT
232 coap_proxy_entry_t *proxy_list;
233 size_t proxy_list_count;
234#endif /* COAP_PROXY_SUPPORT */
235#if COAP_CLIENT_SUPPORT
236 uint8_t testing_cids;
237#endif /* COAP_CLIENT_SUPPORT */
238#if COAP_SERVER_SUPPORT
239 uint8_t context_going_away;
240#endif /* COAP_SERVER_SUPPORT */
241 uint32_t block_mode;
243 uint32_t dynamic_cur;
244 uint32_t dynamic_max;
246#if COAP_THREAD_SAFE
247 pthread_t *thread_id;
248 uint32_t thread_id_count;
249#endif /* COAP_THREAD_SAFE */
251};
252
258
267int coap_insert_node(coap_queue_t **queue, coap_queue_t *node);
268
279
290
310 uint16_t port,
311 uint16_t secure_port,
312 uint16_t ws_port,
313 uint16_t ws_secure_port,
314 int ai_hints_flags,
315 int scheme_hint_bits,
317
325void coap_delete_all(coap_queue_t *queue);
326
333
339unsigned int coap_adjust_basetime(coap_context_t *ctx, coap_tick_t now);
340
345
350
361
375int coap_handle_dgram(coap_context_t *ctx, coap_session_t *session, uint8_t *data, size_t data_len);
376
388
397
406
417
436 coap_session_t *session,
437 coap_mid_t mid,
438 coap_bin_const_t *token,
439 coap_queue_t **node);
440
442 coap_queue_t *node);
443
453 coap_session_t *session,
454 coap_bin_const_t *token);
455
464 coap_session_t *session,
465 coap_nack_reason_t reason);
466
478uint16_t coap_new_message_id_lkd(coap_session_t *session);
479
483void coap_dispatch(coap_context_t *context, coap_session_t *session,
484 coap_pdu_t *pdu);
485
505 coap_pdu_t *pdu,
506 coap_opt_filter_t *unknown,
507 coap_crit_type_t is_proxy);
508
521 coap_session_t *session,
522 coap_pdu_t *request);
523
537unsigned int coap_calc_timeout(coap_session_t *session, unsigned char r);
538
548
567 coap_pdu_t *request_pdu);
568
578
590
609void *coap_context_set_app_data2_lkd(coap_context_t *context, void *data,
611
625 coap_event_t event,
626 coap_session_t *session);
627
641
658 coap_endpoint_t *endpoint,
659 const char *groupname,
660 const char *ifname);
661
676
689 const coap_dtls_pki_t *setup_data);
690
705 const char *ca_file,
706 const char *ca_dir);
707
718
735int coap_context_set_psk_lkd(coap_context_t *context, const char *hint,
736 const uint8_t *key, size_t key_len);
737
750 coap_dtls_spsk_t *setup_data);
751
753
760
775
789void coap_io_do_epoll_lkd(coap_context_t *ctx, struct epoll_event *events,
790 size_t nevents);
791
807
828
862unsigned int coap_io_prepare_io_lkd(coap_context_t *ctx,
863 coap_socket_t *sockets[],
864 unsigned int max_sockets,
865 unsigned int *num_sockets,
866 coap_tick_t now
867 );
868
900int coap_io_process_lkd(coap_context_t *ctx, uint32_t timeout_ms);
901
928 coap_io_process_thread_t main_loop_code,
929 void *main_loop_code_arg, uint32_t timeout_ms,
930 uint32_t thread_count);
931
940
941#if !defined(RIOT_VERSION) && !defined(WITH_CONTIKI)
971int coap_io_process_with_fds_lkd(coap_context_t *ctx, uint32_t timeout_ms,
972 int nfds, fd_set *readfds, fd_set *writefds,
973 fd_set *exceptfds);
974#endif /* ! RIOT_VERSION && ! WITH_CONTIKI */
975
976/*
977 * Get the current libcoap usage of file descriptors that are in a read or write pending state.
978 *
979 * Note: This function must be called in the locked state.
980 *
981 * @param context The current CoAP context.
982 * @param read_fds Array to populate with file descriptors in the read pending state.
983 * @param have_read_fds Updated with the number of fds found in read pending state.
984 * @param max_read_fds Maximum size of read_fds[] array.
985 * @param write_fds Array to populate with file descriptors in the write pending state.
986 * @param have_write_fds Updated with the number of fds found in write pending state.
987 * @param max_write_fds Maximum size of write_fds[] array.
988 * @param rem_timeout_ms Remaining timeout time to next libcoap activity in milli-secs.
989 *
990 * @return @c 1 if successful, else @c 0 if error.
991 */
992unsigned int coap_io_get_fds_lkd(coap_context_t *context, coap_fd_t read_fds[],
993 unsigned int *have_read_fds,
994 unsigned int max_read_fds,
995 coap_fd_t write_fds[],
996 unsigned int *have_write_fds,
997 unsigned int max_write_fds,
998 unsigned int *rem_timeout_ms);
999
1014
1015/*
1016 * Send a request PDU and wait for the response PDU.
1017 *
1018 * Note: This function must be called in the locked state.
1019 *
1020 * @param session The CoAP session.
1021 * @param request_pdu The requesting PDU. If this PDU contains the Observe
1022 * option, the unsolocited responses will get handled by the
1023 * defined response handler. This PDU must be freed off by the
1024 * caller after processing.
1025 * @param response_pdu If there is a response, the response PDU is put here.
1026 * This PDU must be freed off by the caller after processing.
1027 * @param timeout_ms Positive maximum number of milliseconds to wait for response
1028 * packet following the request. If there is a large block transfer
1029 * this timeout is for between each request and response.
1030 *
1031 * @return 0 or +ve Time in function in ms after successful transfer (which can be
1032 * bigger than timeout_ms).
1033 * -1 Invalid timeout parameter
1034 * -2 Failed to transmit PDU
1035 * -3 Nack or Event handler invoked, cancelling request
1036 * -4 coap_io_process returned error (fail to re-lock or select())
1037 * -5 Response not received in the given time
1038 * -6 Terminated by user
1039 * -7 Client mode code not enabled
1040 */
1041int coap_send_recv_lkd(coap_session_t *session, coap_pdu_t *request_pdu,
1042 coap_pdu_t **response_pdu, uint32_t timeout_ms);
1043
1062 const coap_pdu_t *request,
1063 coap_pdu_code_t code,
1064 coap_opt_filter_t *opts);
1065
1080 coap_pdu_type_t type);
1081
1095coap_mid_t coap_send_ack_lkd(coap_session_t *session, const coap_pdu_t *request);
1096
1110coap_mid_t coap_send_rst_lkd(coap_session_t *session, const coap_pdu_t *request);
1111
1113 coap_pdu_t *rcvd, void *body_free);
1114
1122
1124
1125extern int coap_started;
1126extern uint8_t coap_unique_id[8];
1127
1128#ifdef __cplusplus
1129}
1130#endif
1131
1132#endif /* COAP_NET_INTERNAL_H_ */
coap_resolve_type_t
coap_resolve_type_t values
struct coap_endpoint_t coap_endpoint_t
struct coap_async_t coap_async_t
Async Entry information.
struct coap_cache_entry_t coap_cache_entry_t
struct coap_proxy_entry_t coap_proxy_entry_t
Proxy information.
struct coap_resource_t coap_resource_t
coap_nack_reason_t
Definition coap_io.h:64
int coap_fd_t
Definition coap_io.h:49
#define COAP_API
int coap_started
Definition coap_net.c:5730
uint8_t coap_unique_id[8]
Definition coap_net.c:5731
uint16_t coap_option_num_t
Definition coap_option.h:37
CoAP OSCORE support.
Generic resource handling.
Defines the application visible subscribe information.
void coap_io_do_epoll_lkd(coap_context_t *ctx, struct epoll_event *events, size_t nevents)
Process all the epoll events.
Definition coap_net.c:3082
int coap_io_process_loop_lkd(coap_context_t *context, coap_io_process_thread_t main_loop_code, void *main_loop_code_arg, uint32_t timeout_ms, uint32_t thread_count)
Do the coap_io_process() across thread_count threads.
void coap_reset_doing_first(coap_session_t *session)
Reset doing the first packet state when testing for optional functionality.
coap_mid_t coap_send_rst_lkd(coap_session_t *session, const coap_pdu_t *request)
Sends an RST message with code 0 for the specified request to dst.
Definition coap_net.c:1239
coap_mid_t coap_send_message_type_lkd(coap_session_t *session, const coap_pdu_t *request, coap_pdu_type_t type)
Helper function to create and send a message with type (usually ACK or RST).
Definition coap_net.c:1368
int coap_io_pending_lkd(coap_context_t *context)
Check to see if there is any i/o pending for the context.
Definition coap_io.c:920
coap_mid_t coap_send_error_lkd(coap_session_t *session, const coap_pdu_t *request, coap_pdu_code_t code, coap_opt_filter_t *opts)
Sends an error response with code code for request request to dst.
Definition coap_net.c:1339
void coap_io_do_io_lkd(coap_context_t *ctx, coap_tick_t now)
Processes any outstanding read, write, accept or connect I/O as indicated in the coap_socket_t struct...
Definition coap_net.c:3010
int coap_send_recv_lkd(coap_session_t *session, coap_pdu_t *request_pdu, coap_pdu_t **response_pdu, uint32_t timeout_ms)
Definition coap_net.c:2404
void coap_io_process_remove_threads_lkd(coap_context_t *context)
Release the coap_io_process() worker threads.
unsigned int coap_io_get_fds_lkd(coap_context_t *context, coap_fd_t read_fds[], unsigned int *have_read_fds, unsigned int max_read_fds, coap_fd_t write_fds[], unsigned int *have_write_fds, unsigned int max_write_fds, unsigned int *rem_timeout_ms)
Definition coap_io.c:803
int coap_io_process_lkd(coap_context_t *ctx, uint32_t timeout_ms)
The main I/O processing function.
void coap_call_response_handler(coap_session_t *session, coap_pdu_t *sent, coap_pdu_t *rcvd, void *body_free)
int coap_io_process_with_fds_lkd(coap_context_t *ctx, uint32_t timeout_ms, int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds)
The main message processing loop with additional fds for internal select.
unsigned int coap_io_prepare_io_lkd(coap_context_t *ctx, coap_socket_t *sockets[], unsigned int max_sockets, unsigned int *num_sockets, coap_tick_t now)
Iterates through all the coap_socket_t structures embedded in endpoints or sessions associated with t...
Definition coap_io.c:331
unsigned int coap_io_prepare_epoll_lkd(coap_context_t *ctx, coap_tick_t now)
Any now timed out delayed packet is transmitted, along with any packets associated with requested obs...
Definition coap_io.c:219
coap_mid_t coap_send_lkd(coap_session_t *session, coap_pdu_t *pdu)
Sends a CoAP message to given peer.
Definition coap_net.c:1649
coap_mid_t coap_send_ack_lkd(coap_session_t *session, const coap_pdu_t *request)
Sends an ACK message with code 0 for the specified request to dst.
Definition coap_net.c:1256
void(* coap_io_process_thread_t)(void *arg)
Main thread coap_io_process_loop activity.
Definition coap_net.h:1048
uint64_t coap_tick_t
This data type represents internal timer ticks with COAP_TICKS_PER_SECOND resolution.
Definition coap_time.h:149
void(* coap_resource_release_userdata_handler_t)(void *user_data)
Definition of release resource user_data callback function.
int coap_handle_event_lkd(coap_context_t *context, coap_event_t event, coap_session_t *session)
Invokes the event handler of context for the given event and data.
Definition coap_net.c:5563
uint16_t coap_new_message_id_lkd(coap_session_t *session)
Returns a new message id and updates session->tx_mid accordingly.
unsigned int coap_adjust_basetime(coap_context_t *ctx, coap_tick_t now)
Set sendqueue_basetime in the given context object ctx to now.
Definition coap_net.c:119
int coap_delete_node_lkd(coap_queue_t *node)
Destroys specified node.
Definition coap_net.c:206
void coap_delete_all(coap_queue_t *queue)
Removes all items from given queue and frees the allocated storage.
Definition coap_net.c:226
int coap_context_set_psk2_lkd(coap_context_t *context, coap_dtls_spsk_t *setup_data)
Set the context's default PSK hint and/or key for a server.
void coap_register_option_lkd(coap_context_t *context, coap_option_num_t number)
Registers the option number number with the given context object context.
Definition coap_net.c:5882
coap_queue_t * coap_peek_next(coap_context_t *context)
Returns the next pdu to send without removing from sendqeue.
Definition coap_net.c:249
coap_pdu_t * coap_wellknown_response(coap_context_t *context, coap_session_t *session, coap_pdu_t *request)
Creates a new response for given request with the contents of .well-known/core.
coap_crit_type_t
COAP_API int coap_delete_node(coap_queue_t *node)
Destroys specified node.
Definition coap_net.c:193
int coap_client_delay_first(coap_session_t *session)
Delay the sending of the first client request until some other negotiation has completed.
Definition coap_net.c:1517
coap_queue_t * coap_remove_mid_from_delayq(coap_session_t *session, coap_mid_t mid)
This function removes the node with given mid from the delayqueue.
Definition coap_net.c:3283
int coap_context_set_psk_lkd(coap_context_t *context, const char *hint, const uint8_t *key, size_t key_len)
Set the context's default PSK hint and/or key for a server.
int coap_option_check_critical(coap_session_t *session, coap_pdu_t *pdu, coap_opt_filter_t *unknown, coap_crit_type_t is_proxy)
Verifies that pdu contains no unknown critical options, duplicate options or the options defined as R...
Definition coap_net.c:1037
coap_queue_t * coap_pop_next(coap_context_t *context)
Returns the next pdu to send and removes it from the sendqeue.
Definition coap_net.c:257
void coap_dispatch(coap_context_t *context, coap_session_t *session, coap_pdu_t *pdu)
Dispatches the PDUs from the receive queue in given context.
Definition coap_net.c:5453
int coap_insert_node(coap_queue_t **queue, coap_queue_t *node)
Adds node to given queue, ordered by variable t in node.
Definition coap_net.c:156
unsigned int coap_calc_timeout(coap_session_t *session, unsigned char r)
Calculates the initial timeout based on the session CoAP transmission parameters 'ack_timeout',...
Definition coap_net.c:1397
void coap_add_to_head_delayq(coap_session_t *session, coap_queue_t *node)
This function adds the node to the head of the delayqueue.
Definition coap_net.c:3329
void coap_free_context_lkd(coap_context_t *context)
CoAP stack context must be released with coap_free_context_lkd().
Definition coap_net.c:860
int coap_context_load_pki_trust_store_lkd(coap_context_t *context)
Load the context's default trusted CAs for a client or server.
Definition coap_net.c:447
coap_mid_t coap_send_internal(coap_session_t *session, coap_pdu_t *pdu, coap_pdu_t *request_pdu)
Sends a CoAP message to given peer.
Definition coap_net.c:2170
void * coap_context_set_app_data2_lkd(coap_context_t *context, void *data, coap_app_data_free_callback_t callback)
Stores data with the given context, returning the previously stored value or NULL.
Definition coap_net.c:727
int coap_can_exit_lkd(coap_context_t *context)
Returns 1 if there are no messages to send or to dispatch in the context's queues.
Definition coap_net.c:5656
coap_mid_t coap_retransmit(coap_context_t *context, coap_queue_t *node)
Handles retransmissions of confirmable messages.
Definition coap_net.c:2522
int coap_check_code_class(coap_session_t *session, coap_pdu_t *pdu)
Check whether the pdu contains a valid code class.
Definition coap_net.c:1584
coap_addr_info_t * coap_resolve_address_info_lkd(const coap_str_const_t *address, uint16_t port, uint16_t secure_port, uint16_t ws_port, uint16_t ws_secure_port, int ai_hints_flags, int scheme_hint_bits, coap_resolve_type_t type)
Resolve the specified address into a set of coap_address_t that can be used to bind() (local) or conn...
int coap_context_set_pki_root_cas_lkd(coap_context_t *context, const char *ca_file, const char *ca_dir)
Set the context's default Root CA information for a client or server.
Definition coap_net.c:427
int coap_join_mcast_group_intf_lkd(coap_context_t *ctx, coap_endpoint_t *endpoint, const char *groupname, const char *ifname)
Function interface for joining a multicast group for listening for the currently defined endpoints th...
coap_queue_t * coap_remove_first_from_delayq(coap_session_t *session)
This function removes the first node from the delayqueue.
Definition coap_net.c:3305
void coap_add_to_tail_delayq(coap_session_t *session, coap_queue_t *node)
This function adds the node to the tail of the delayqueue.
Definition coap_net.c:3318
coap_mid_t coap_wait_ack(coap_context_t *context, coap_session_t *session, coap_queue_t *node)
Definition coap_net.c:1423
coap_queue_t * coap_new_node(void)
Creates a new node suitable for adding to the CoAP sendqueue.
Definition coap_net.c:235
void coap_cancel_session_messages(coap_context_t *context, coap_session_t *session, coap_nack_reason_t reason)
Cancels all outstanding messages for session session.
Definition coap_net.c:3446
int coap_context_set_pki_lkd(coap_context_t *context, const coap_dtls_pki_t *setup_data)
Set the context's default PKI information for a server.
int coap_handle_dgram(coap_context_t *ctx, coap_session_t *session, uint8_t *data, size_t data_len)
Parses and interprets a CoAP datagram with context ctx.
Definition coap_net.c:3214
int coap_remove_from_queue(coap_queue_t **queue, coap_session_t *session, coap_mid_t mid, coap_bin_const_t *token, coap_queue_t **node)
This function removes the element with given mid from the list given list.
Definition coap_net.c:3337
void coap_cancel_all_messages(coap_context_t *context, coap_session_t *session, coap_bin_const_t *token)
Cancels all outstanding messages for session session that have the specified token.
Definition coap_net.c:3485
@ COAP_CRIT_NOT_PROXY
@ COAP_CRIT_PROXY
@ COAP_CRIT_UNKNOWN
void(* coap_pong_handler_t)(coap_session_t *session, const coap_pdu_t *received, const coap_mid_t mid)
Received Pong handler that is used as callback in coap_context_t.
Definition coap_net.h:103
coap_response_t(* coap_response_handler_t)(coap_session_t *session, const coap_pdu_t *sent, const coap_pdu_t *received, const coap_mid_t mid)
Response handler that is used as callback in coap_context_t.
Definition coap_net.h:67
coap_resource_t *(* coap_resource_dynamic_create_t)(coap_session_t *session, const coap_pdu_t *request)
Definition of resource dynamic creation handler function.
Definition coap_net.h:115
void(* coap_ping_handler_t)(coap_session_t *session, const coap_pdu_t *received, const coap_mid_t mid)
Received Ping handler that is used as callback in coap_context_t.
Definition coap_net.h:92
coap_response_t(* coap_block_data_handler_t)(coap_session_t *session, coap_pdu_t *pdu, coap_resource_t *resource, coap_binary_t **body_data, size_t length, const uint8_t *data, size_t offset, size_t total)
Definition of the block data handler function.
Definition coap_net.h:133
void(* coap_nack_handler_t)(coap_session_t *session, const coap_pdu_t *sent, const coap_nack_reason_t reason, const coap_mid_t mid)
Negative Acknowledge handler that is used as callback in coap_context_t.
Definition coap_net.h:80
coap_event_t
Scalar type to represent different events, e.g.
Definition coap_event.h:36
int(* coap_event_handler_t)(coap_session_t *session, const coap_event_t event)
Type for event handler functions that can be registered with a CoAP context using the function coap_s...
Definition coap_event.h:177
int(* coap_lwip_input_wait_handler_t)(void *arg, uint32_t milli_secs)
LwIP callback handler that can be used to wait / timeout for the next input packet.
Definition coap_net.h:1194
int(* coap_dyn_resource_added_t)(coap_session_t *session, coap_str_const_t *resource_name, coap_bin_const_t *raw_packet, void *user_data)
Callback handler definition called when a dynamic resource is getting created, as defined in coap_per...
int(* coap_resource_deleted_t)(coap_context_t *context, coap_str_const_t *resource_name, void *user_data)
Callback handler definition called when resource is removed, as defined in coap_persist_track_funcs()...
int(* coap_observe_added_t)(coap_session_t *session, coap_subscription_t *observe_key, coap_proto_t e_proto, coap_address_t *e_listen_addr, coap_addr_tuple_t *s_addr_info, coap_bin_const_t *raw_packet, coap_bin_const_t *oscore_info, void *user_data)
Callback handler definition called when a new observe has been set up, as defined in coap_persist_tra...
int(* coap_track_observe_value_t)(coap_context_t *context, coap_str_const_t *resource_name, uint32_t observe_num, void *user_data)
Callback handler definition called when an observe unsolicited response is being sent,...
int(* coap_observe_deleted_t)(coap_session_t *session, coap_subscription_t *observe_key, void *user_data)
Callback handler definition called when an observe is being removed, as defined in coap_persist_track...
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
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
int coap_mid_t
coap_mid_t is used to store the CoAP Message ID of a CoAP PDU.
Definition coap_pdu.h:195
coap_pdu_code_t
Set of codes available for a PDU.
Definition coap_pdu.h:259
coap_pdu_type_t
CoAP PDU message type definitions.
Definition coap_pdu.h:70
coap_pdu_t *(* coap_proxy_response_handler_t)(coap_session_t *session, const coap_pdu_t *sent, coap_pdu_t *received, coap_cache_key_t *cache_key)
Proxy response handler that is used as callback held in coap_context_t.
Definition coap_proxy.h:134
void(* coap_app_data_free_callback_t)(void *data)
Callback to free off the app data when the entry is being deleted / freed off.
Resolved addresses information.
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.
coap_tick_t sendqueue_basetime
The time stamp in the first element of the sendqeue is relative to sendqueue_basetime.
coap_socket_t * sockets[64]
Track different socket information in coap_io_process_with_fds_lkd().
coap_block_data_handler_t block_data_cb
Called with each block data during block transfers.
uint64_t rl_ticks_per_packet
If not 0, rate limit NON to ticks per packet.
uint32_t dynamic_cur
Current number of dynamic resources.
coap_app_data_free_callback_t app_cb
call-back to release app_data
coap_pong_handler_t pong_cb
Called when a ping response is received.
coap_nack_handler_t nack_cb
Called when a response issue has occurred.
coap_resource_dynamic_create_t dyn_create_handler
Dynamic resource create handler.
unsigned int num_sockets
Number of sockets being tracked.
void * app_data
application-specific data
unsigned int ping_timeout
Minimum inactivity time before sending a ping message.
uint32_t dynamic_max
Max number of dynamic resources or 0 is unlimited.
coap_event_handler_t event_cb
Callback function that is used to signal events to the application.
size_t max_body_size
Max supported body size or 0 is unlimited.
coap_opt_filter_t known_options
uint32_t csm_max_message_size
Value for CSM Max-Message-Size.
unsigned int max_handshake_sessions
Maximum number of simultaneous negotiating sessions per endpoint.
coap_ping_handler_t ping_cb
Called when a CoAP ping is received.
coap_queue_t * sendqueue
uint32_t max_token_size
Largest token size supported RFC8974.
uint32_t csm_timeout_ms
Timeout for waiting for a CSM from the remote side.
coap_tick_t next_timeout
When the next timeout is to occur.
unsigned int session_timeout
Number of seconds of inactivity after which an unused session will be closed.
uint32_t block_mode
Zero or more COAP_BLOCK_ or'd options.
unsigned int max_idle_sessions
Maximum number of simultaneous unused sessions per endpoint.
The structure used for defining the PKI setup data to be used.
Definition coap_dtls.h:317
The structure used for defining the Server PSK setup data to be used.
Definition coap_dtls.h:509
structure for CoAP PDUs
Queue entry.
coap_address_t remote
For re-transmission - where the node is going.
coap_session_t * session
the CoAP session
coap_pdu_t * pdu
the CoAP PDU to send
unsigned int timeout
the randomized timeout value
uint8_t is_mcast
Set if this is a queued mcast response.
struct coap_queue_t * next
coap_mid_t id
CoAP message id.
coap_tick_t t
when to send PDU for the next time
unsigned char retransmit_cnt
retransmission counter, will be removed when zero
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