libcoap
4.3.0
|
CoAP Observe Subscription Structures, Enums and Functions that are not exposed to applications. More...
Data Structures | |
struct | coap_subscription_t |
Subscriber information. More... | |
Macros | |
#define | COAP_OBS_MAX_NON 5 |
Number of notifications that may be sent non-confirmable before a confirmable message is sent to detect if observers are alive. More... | |
#define | COAP_OBS_MAX_FAIL 3 |
Number of confirmable notifications that may fail (i.e. More... | |
Functions | |
void | coap_subscription_init (coap_subscription_t *) |
void | coap_handle_failed_notify (coap_context_t *context, coap_session_t *session, const coap_binary_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_binary_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_binary_t *token) |
Returns a subscription object for given peer . More... | |
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. More... | |
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. More... | |
void | coap_delete_observers (coap_context_t *context, coap_session_t *session) |
Removes any subscription for session and releases the allocated storage. More... | |
CoAP Observe Subscription Structures, Enums and Functions that are not exposed to applications.
#define COAP_OBS_MAX_FAIL 3 |
Number of confirmable notifications that may fail (i.e.
time out without being ACKed) before an observer is removed. The maximum value for COAP_OBS_MAX_FAIL is 3
.
Definition at line 43 of file coap_subscribe_internal.h.
#define COAP_OBS_MAX_NON 5 |
Number of notifications that may be sent non-confirmable before a confirmable message is sent to detect if observers are alive.
The maximum allowed value here is 15
.
Definition at line 34 of file coap_subscribe_internal.h.
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
.
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.
resource | The observed resource. |
session | The observer's session |
token | The token that identifies this subscription. |
pdu | The requesting pdu. |
NULL
on error. Definition at line 721 of file resource.c.
void coap_check_notify | ( | coap_context_t * | context | ) |
Checks all known resources to see if they are dirty and then notifies subscribed observers.
context | The context to check for dirty resources. |
Definition at line 1062 of file resource.c.
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.
The result is 1
if an observation relationship with observer
and token
existed, 0
otherwise.
resource | The observed resource. |
session | The observer's session. |
token | The token that identifies this subscription or NULL for any token. |
1
if the observer has been deleted, 0
otherwise. Definition at line 816 of file resource.c.
void coap_delete_observers | ( | coap_context_t * | context, |
coap_session_t * | session | ||
) |
Removes any subscription for session
and releases the allocated storage.
context | The CoAP context to use. |
session | The observer's session. |
Definition at line 842 of file resource.c.
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
.
resource | The observed resource. |
session | The observer's session |
token | The token that identifies this subscription or NULL for any token. |
NULL
otherwise. Definition at line 686 of file resource.c.
void coap_handle_failed_notify | ( | coap_context_t * | context, |
coap_session_t * | session, | ||
const coap_binary_t * | token | ||
) |
Handles a failed observe notify.
context | The context holding the resource. |
session | The session that the observe notify failed on. |
token | The token used when the observe notify failed. |
Definition at line 1125 of file resource.c.
void coap_subscription_init | ( | coap_subscription_t * | s | ) |
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.
context | The CoAP context to use. |
session | The observer's session |
token | The corresponding token that has been used for the subscription. |
Definition at line 803 of file resource.c.