libcoap 4.3.4
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-2023 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
18#ifndef COAP_SUBSCRIBE_INTERNAL_H_
19#define COAP_SUBSCRIBE_INTERNAL_H_
20
21#include "coap_internal.h"
22
23#if COAP_SERVER_SUPPORT
24
37#ifndef COAP_OBS_MAX_NON
38#define COAP_OBS_MAX_NON 5
39#endif /* COAP_OBS_MAX_NON */
40#if COAP_OBS_MAX_NON > 255
41#error COAP_OBS_MAX_NON is too large
42#endif /* COAP_OBS_MAX_NON > 255 */
43
49#ifndef COAP_OBS_MAX_FAIL
50#define COAP_OBS_MAX_FAIL 1
51#endif /* COAP_OBS_MAX_FAIL */
52#if COAP_OBS_MAX_FAIL > 255
53#error COAP_OBS_MAX_FAIL is too large
54#endif /* COAP_OBS_MAX_FAIL > 255 */
55
61 uint8_t non_cnt;
62 uint8_t fail_cnt;
63 uint8_t dirty;
68};
69
71
80 coap_session_t *session,
81 const coap_bin_const_t *token);
82
90
106 coap_session_t *session,
107 const coap_bin_const_t *token,
108 const coap_pdu_t *pdu);
109
120 coap_session_t *session,
121 const coap_bin_const_t *token);
122
132 coap_session_t *session,
133 const coap_bin_const_t *token);
134
147 coap_session_t *session,
148 const coap_bin_const_t *token);
149
157
164
167#endif /* COAP_SERVER_SUPPORT */
168#endif /* COAP_SUBSCRIBE_INTERNAL_H_ */
Pulls together all the internal only header files.
void coap_persist_cleanup(coap_context_t *context)
Close down persist tracking, releasing any memory used.
int coap_delete_observer(coap_resource_t *resource, coap_session_t *session, const coap_bin_const_t *token)
Removes any subscription for observer from resource and releases the allocated storage.
coap_subscription_t * coap_find_observer(coap_resource_t *resource, coap_session_t *session, const coap_bin_const_t *token)
Returns a subscription object for given peer.
void coap_delete_observers(coap_context_t *context, coap_session_t *session)
Removes any subscription for session and releases the allocated storage.
void coap_check_notify(coap_context_t *context)
Checks all known resources to see if they are dirty and then notifies subscribed observers.
void coap_handle_failed_notify(coap_context_t *context, coap_session_t *session, const coap_bin_const_t *token)
Handles a failed observe notify.
void coap_subscription_init(coap_subscription_t *)
coap_subscription_t * coap_add_observer(coap_resource_t *resource, coap_session_t *session, const coap_bin_const_t *token, const coap_pdu_t *pdu)
Adds the specified peer as observer for resource.
void coap_touch_observer(coap_context_t *context, coap_session_t *session, const coap_bin_const_t *token)
Flags that data is ready to be sent to observers.
CoAP binary data definition with const data.
Definition: coap_str.h:64
The CoAP stack's global state is stored in a coap_context_t object.
structure for CoAP PDUs
Abstraction of resource that can be attached to coap_context_t.
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
Number of notifications that may be sent non-confirmable before a confirmable message is sent to dete...
uint8_t dirty
set if the notification temporarily could not be sent (in that case, the resource's partially dirty f...
uint8_t non_cnt
up to 255 non-confirmable notifies allowed
coap_cache_key_t * cache_key
struct coap_session_t * session
subscriber session
uint8_t fail_cnt
up to 255 confirmable notifies can fail
struct coap_subscription_t * next
next element in linked list
coap_pdu_t * pdu
cache_key to identify requester