libcoap 4.3.0
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-2021 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
28#ifndef COAP_OBS_MAX_NON
34#define COAP_OBS_MAX_NON 5
35#endif /* COAP_OBS_MAX_NON */
36
37#ifndef COAP_OBS_MAX_FAIL
43#define COAP_OBS_MAX_FAIL 3
44#endif /* COAP_OBS_MAX_FAIL */
45
51 unsigned int non_cnt:4;
52 unsigned int fail_cnt:2;
53 unsigned int dirty:1;
58};
59
61
69void
71 coap_session_t *session,
72 const coap_binary_t *token);
73
81
97 coap_session_t *session,
98 const coap_binary_t *token,
99 const coap_pdu_t *pdu);
100
111 coap_session_t *session,
112 const coap_binary_t *token);
113
123 coap_session_t *session,
124 const coap_binary_t *token);
125
138 coap_session_t *session,
139 const coap_binary_t *token);
140
148
151#endif /* COAP_SUBSCRIBE_INTERNAL_H_ */
int coap_delete_observer(coap_resource_t *resource, coap_session_t *session, const coap_binary_t *token)
Removes any subscription for observer from resource and releases the allocated storage.
Definition: resource.c:816
coap_subscription_t * coap_add_observer(coap_resource_t *resource, coap_session_t *session, const coap_binary_t *token, const coap_pdu_t *pdu)
Adds the specified peer as observer for resource.
Definition: resource.c:721
void coap_delete_observers(coap_context_t *context, coap_session_t *session)
Removes any subscription for session and releases the allocated storage.
Definition: resource.c:842
void coap_check_notify(coap_context_t *context)
Checks all known resources to see if they are dirty and then notifies subscribed observers.
Definition: resource.c:1062
void coap_handle_failed_notify(coap_context_t *context, coap_session_t *session, const coap_binary_t *token)
Handles a failed observe notify.
Definition: resource.c:1125
void coap_subscription_init(coap_subscription_t *)
Definition: subscribe.c:15
void coap_touch_observer(coap_context_t *context, coap_session_t *session, const coap_binary_t *token)
Flags that data is ready to be sent to observers.
Definition: resource.c:803
coap_subscription_t * coap_find_observer(coap_resource_t *resource, coap_session_t *session, const coap_binary_t *token)
Returns a subscription object for given peer.
Definition: resource.c:686
CoAP binary data definition.
Definition: str.h:50
The CoAP stack's global state is stored in a coap_context_t object.
structure for CoAP PDUs token, if any, follows the fixed size header, then options until payload mark...
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
Subscriber information.
unsigned int fail_cnt
up to 3 confirmable notifies can fail
unsigned int non_cnt
up to 15 non-confirmable notifies allowed
coap_cache_key_t * cache_key
struct coap_session_t * session
subscriber session
unsigned int dirty
set if the notification temporarily could not be sent (in that case, the resource's partially dirty f...
struct coap_subscription_t * next
next element in linked list
coap_pdu_t * pdu
cache_key to identify requester