Internal API for handling CoAP Observe Subscriptions (RFC7641)
More...
|
struct | coap_subscription_t |
| Number of notifications that may be sent non-confirmable before a confirmable message is sent to detect if observers are alive. More...
|
|
|
void | coap_subscription_init (coap_subscription_t *) |
|
void | coap_handle_failed_notify (coap_context_t *context, coap_session_t *session, const coap_bin_const_t *token) |
| Handles a failed observe notify. More...
|
|
void | coap_check_notify (coap_context_t *context) |
| Checks all known resources to see if they are dirty and then notifies subscribed observers. More...
|
|
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 . More...
|
|
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 . More...
|
|
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. More...
|
|
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. More...
|
|
void | coap_delete_observers (coap_context_t *context, coap_session_t *session) |
| Removes any subscription for session and releases the allocated storage. More...
|
|
void | coap_persist_cleanup (coap_context_t *context) |
| Close down persist tracking, releasing any memory used. More...
|
|
Internal API for handling CoAP Observe Subscriptions (RFC7641)
◆ coap_add_observer()
Adds the specified peer as observer for resource
.
The subscription is identified by the given token
. This function returns the registered subscription information if the observer
has been added, or NULL
on error.
- Parameters
-
resource | The observed resource. |
session | The observer's session |
token | The token that identifies this subscription. |
pdu | The requesting pdu. |
- Returns
- A pointer to the added/updated subscription information or
NULL
on error.
◆ coap_check_notify()
Checks all known resources to see if they are dirty and then notifies subscribed observers.
- Parameters
-
context | The context to check for dirty resources. |
◆ coap_delete_observer()
Removes any subscription for observer
from resource
and releases the allocated storage.
The result is 1
if an observation relationship with observer
and token
existed, 0
otherwise.
- Parameters
-
resource | The observed resource. |
session | The observer's session. |
token | The token that identifies this subscription or NULL for any token. |
- Returns
1
if the observer has been deleted, 0
otherwise.
◆ coap_delete_observers()
Removes any subscription for session
and releases the allocated storage.
- Parameters
-
context | The CoAP context to use. |
session | The observer's session. |
◆ coap_find_observer()
Returns a subscription object for given peer
.
- Parameters
-
resource | The observed resource. |
session | The observer's session |
token | The token that identifies this subscription or NULL for any token. |
- Returns
- A valid subscription if exists or
NULL
otherwise.
◆ coap_handle_failed_notify()
Handles a failed observe notify.
- Parameters
-
context | The context holding the resource. |
session | The session that the observe notify failed on. |
token | The token used when the observe notify failed. |
◆ coap_persist_cleanup()
Close down persist tracking, releasing any memory used.
- Parameters
-
context | The current CoAP context. |
◆ coap_subscription_init()
◆ coap_touch_observer()
Flags that data is ready to be sent to observers.
- Parameters
-
context | The CoAP context to use. |
session | The observer's session |
token | The corresponding token that has been used for the subscription. |