libcoap 4.3.5-develop-b61cb76
Loading...
Searching...
No Matches
coap_subscribe_internal.h
Go to the documentation of this file.
1/*
2 * coap_subscribe_internal.h -- Structures, Enums & Functions that are not
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_SUBSCRIBE_INTERNAL_H_
19#define COAP_SUBSCRIBE_INTERNAL_H_
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
31
32#if COAP_SERVER_SUPPORT
38#ifndef COAP_OBS_MAX_NON
39#define COAP_OBS_MAX_NON 5
40#endif /* COAP_OBS_MAX_NON */
41#if COAP_OBS_MAX_NON > 255
42#error COAP_OBS_MAX_NON is too large
43#endif /* COAP_OBS_MAX_NON > 255 */
44
50#ifndef COAP_OBS_MAX_FAIL
51#define COAP_OBS_MAX_FAIL 1
52#endif /* COAP_OBS_MAX_FAIL */
53#if COAP_OBS_MAX_FAIL > 255
54#error COAP_OBS_MAX_FAIL is too large
55#endif /* COAP_OBS_MAX_FAIL > 255 */
56
59 struct coap_subscription_t *next;
60 struct coap_session_t *session;
61 coap_address_t local_if;
62
63 uint8_t non_cnt;
64 uint8_t fail_cnt;
65 uint8_t dirty;
68 coap_cache_key_t *cache_key;
69 coap_pdu_t *pdu;
70};
71
72void coap_subscription_init(coap_subscription_t *);
73
81void coap_handle_failed_notify(coap_context_t *context,
82 coap_session_t *session,
83 const coap_bin_const_t *token);
84
99coap_subscription_t *coap_add_observer(coap_resource_t *resource,
100 coap_session_t *session,
101 const coap_bin_const_t *token,
102 const coap_pdu_t *pdu);
103
114coap_subscription_t *coap_find_observer(coap_resource_t *resource,
115 coap_session_t *session,
116 const coap_bin_const_t *token);
117
126void coap_touch_observer(coap_context_t *context,
127 coap_session_t *session,
128 const coap_bin_const_t *token);
129
142int coap_delete_observer(coap_resource_t *resource,
143 coap_session_t *session,
144 const coap_bin_const_t *token);
145
161int coap_delete_observer_request(coap_resource_t *resource,
162 coap_session_t *session,
163 const coap_bin_const_t *token,
164 coap_pdu_t *request,
165 int large_fetch);
166
173void coap_delete_observers(coap_context_t *context, coap_session_t *session);
174
183void coap_delete_observer_internal(coap_resource_t *resource,
184 coap_session_t *session,
185 coap_subscription_t *subscription);
186
198int coap_resource_notify_observers_lkd(coap_resource_t *resource,
199 coap_deleting_resource_t deleting);
200
209void coap_check_notify_lkd(coap_context_t *context);
210
216void coap_persist_cleanup(coap_context_t *context);
217
238coap_subscription_t *coap_persist_observe_add_lkd(coap_context_t *context,
239 coap_proto_t e_proto,
240 const coap_address_t *e_listen_addr,
241 const coap_addr_tuple_t *s_addr_info,
242 const coap_bin_const_t *raw_packet,
243 const coap_bin_const_t *oscore_info);
244
264int coap_persist_startup_lkd(coap_context_t *context,
265 const char *dyn_resource_save_file,
266 const char *observe_save_file,
267 const char *obs_cnt_save_file,
268 uint32_t save_freq);
269
284void coap_persist_stop_lkd(coap_context_t *context);
285
286#endif /* COAP_SERVER_SUPPORT */
287
288#if COAP_CLIENT_SUPPORT
289
305int coap_cancel_observe_lkd(coap_session_t *session, coap_binary_t *token,
306 coap_pdu_type_t message_type);
307
308#endif /* COAP_CLIENT_SUPPORT */
309
311
312#ifdef __cplusplus
313}
314#endif
315
316#endif /* COAP_SUBSCRIBE_INTERNAL_H_ */
struct coap_cache_key_t coap_cache_key_t
struct coap_pdu_t coap_pdu_t
PDU information.
struct coap_address_t coap_address_t
struct coap_subscription_t coap_subscription_t
struct coap_resource_t coap_resource_t
struct coap_session_t coap_session_t
coap_proto_t
CoAP protocol types Note: coap_layers_coap[] needs updating if extended.
Definition coap_pdu.h:234
coap_pdu_type_t
CoAP PDU message type definitions.
Definition coap_pdu.h:70
Multi-purpose address abstraction.
CoAP binary data definition with const data.
Definition coap_str.h:65
CoAP binary data definition.
Definition coap_str.h:57
The CoAP stack's global state is stored in a coap_context_t object.
structure for CoAP PDUs
Abstraction of virtual session that can be attached to coap_context_t (client) or coap_endpoint_t (se...
coap_context_t * context
session's context