libcoap 4.3.5-develop-19cef11
|
Generic resource handling. More...
Go to the source code of this file.
Macros | |
#define | COAP_RESOURCE_CHECK_TIME 2 |
The interval in seconds to check if resources have changed. More... | |
#define | COAP_ATTR_FLAGS_RELEASE_NAME 0x1 |
#define | COAP_ATTR_FLAGS_RELEASE_VALUE 0x2 |
#define | COAP_RESOURCE_FLAGS_RELEASE_URI 0x1 |
The URI passed to coap_resource_init() is free'd by coap_delete_resource(). More... | |
#define | COAP_RESOURCE_FLAGS_NOTIFY_NON 0x0 |
Observe Notifications will be sent non-confirmable by default. More... | |
#define | COAP_RESOURCE_FLAGS_NOTIFY_CON 0x2 |
Observe Notifications will be sent confirmable. More... | |
#define | COAP_RESOURCE_FLAGS_NOTIFY_NON_ALWAYS 0x4 |
Observe Notifications will always be sent non-confirmable. More... | |
#define | COAP_RESOURCE_FLAGS_HAS_MCAST_SUPPORT 0x8 |
This resource has support for multicast requests. More... | |
#define | COAP_RESOURCE_FLAGS_LIB_DIS_MCAST_DELAYS 0x10 |
Disable libcoap library from adding in delays to multicast requests before releasing the response back to the client. More... | |
#define | COAP_RESOURCE_FLAGS_LIB_ENA_MCAST_SUPPRESS_2_05 0x20 |
Enable libcoap library suppression of 205 multicast responses that are empty (overridden by RFC7969 No-Response option) for multicast requests. More... | |
#define | COAP_RESOURCE_FLAGS_LIB_ENA_MCAST_SUPPRESS_2_XX 0x40 |
Enable libcoap library suppressing 2.xx multicast responses (overridden by RFC7969 No-Response option) for multicast requests. More... | |
#define | COAP_RESOURCE_FLAGS_LIB_DIS_MCAST_SUPPRESS_4_XX 0x80 |
Disable libcoap library suppressing 4.xx multicast responses (overridden by RFC7969 No-Response option) for multicast requests. More... | |
#define | COAP_RESOURCE_FLAGS_LIB_DIS_MCAST_SUPPRESS_5_XX 0x100 |
Disable libcoap library suppressing 5.xx multicast responses (overridden by RFC7969 No-Response option) for multicast requests. More... | |
#define | COAP_RESOURCE_FLAGS_MCAST_LIST |
#define | COAP_RESOURCE_FLAGS_FORCE_SINGLE_BODY 0x200 |
Force all large traffic to this resource to be presented as a single body to the request handler. More... | |
#define | COAP_RESOURCE_FLAGS_OSCORE_ONLY 0x400 |
Define this resource as an OSCORE enabled access only. More... | |
#define | COAP_RESOURCE_HANDLE_WELLKNOWN_CORE 0x800 |
Define this when invoking coap_resource_unknown_init2() if .well-known/core is to be passed to the unknown URI handler rather than processed locally. More... | |
#define | COAP_PRINT_STATUS_MASK 0xF0000000UL |
#define | COAP_PRINT_STATUS_MAX 0x0FFFFFFFUL |
#define | COAP_PRINT_OUTPUT_LENGTH(v) ((v) & COAP_PRINT_STATUS_MAX) |
#define | COAP_PRINT_STATUS_ERROR 0x80000000UL |
#define | COAP_PRINT_STATUS_TRUNC 0x40000000UL |
Typedefs | |
typedef void(* | coap_method_handler_t) (coap_resource_t *resource, coap_session_t *session, const coap_pdu_t *request, const coap_string_t *query, coap_pdu_t *response) |
Definition of message handler function. More... | |
typedef void(* | coap_resource_release_userdata_handler_t) (void *user_data) |
Definition of release resource user_data callback function. More... | |
typedef uint32_t | coap_print_status_t |
Status word to encode the result of conditional print or copy operations such as coap_print_link(). More... | |
Functions | |
coap_resource_t * | coap_resource_init (coap_str_const_t *uri_path, int flags) |
Creates a new resource object and initializes the link field to the string uri_path . More... | |
coap_resource_t * | coap_resource_unknown_init (coap_method_handler_t put_handler) |
Creates a new resource object for the unknown resource handler with support for PUT. More... | |
coap_resource_t * | coap_resource_unknown_init2 (coap_method_handler_t put_handler, int flags) |
Creates a new resource object for the unknown resource handler with support for PUT and configurable control over multicast requests packets. More... | |
coap_resource_t * | coap_resource_proxy_uri_init (coap_method_handler_t handler, size_t host_name_count, const char *host_name_list[]) |
Creates a new resource object for handling proxy URIs. More... | |
coap_resource_t * | coap_resource_proxy_uri_init2 (coap_method_handler_t handler, size_t host_name_count, const char *host_name_list[], int flags) |
Creates a new resource object for handling proxy URIs with configurable control over multicast request packets. More... | |
coap_resource_t * | coap_resource_reverse_proxy_init (coap_method_handler_t handler, int flags) |
Creates a new resource object for the reverse-proxy resource handler with control over multicast request packets. More... | |
COAP_API coap_resource_t * | coap_get_resource_from_uri_path (coap_context_t *context, coap_str_const_t *uri_path) |
Returns the resource identified by the unique string uri_path . More... | |
coap_str_const_t * | coap_resource_get_uri_path (coap_resource_t *resource) |
Get the uri_path from a resource . More... | |
void | coap_resource_set_mode (coap_resource_t *resource, int mode) |
Sets the notification message type of resource resource to given mode . More... | |
void | coap_resource_set_userdata (coap_resource_t *resource, void *data) |
Sets the user_data. More... | |
void * | coap_resource_get_userdata (coap_resource_t *resource) |
Gets the user_data. More... | |
void | coap_resource_release_userdata_handler (coap_context_t *context, coap_resource_release_userdata_handler_t callback) |
Defines the context wide callback to use to when the resource is deleted to release the data held in the resource's user_data. More... | |
COAP_API void | coap_add_resource (coap_context_t *context, coap_resource_t *resource) |
Registers the given resource for context . More... | |
COAP_API int | coap_delete_resource (coap_context_t *context, coap_resource_t *resource) |
Deletes a resource identified by resource . More... | |
void | coap_register_handler (coap_resource_t *resource, coap_request_t method, coap_method_handler_t handler) |
Registers the specified handler as message handler for the request type method . More... | |
void | coap_register_request_handler (coap_resource_t *resource, coap_request_t method, coap_method_handler_t handler) |
Registers the specified handler as message handler for the request type method . More... | |
coap_attr_t * | coap_add_attr (coap_resource_t *resource, coap_str_const_t *name, coap_str_const_t *value, int flags) |
Registers a new attribute with the given resource . More... | |
coap_attr_t * | coap_find_attr (coap_resource_t *resource, coap_str_const_t *name) |
Returns resource's coap_attr_t object with given name if found, NULL otherwise. More... | |
coap_str_const_t * | coap_attr_get_value (coap_attr_t *attribute) |
Returns attribute's value. More... | |
coap_print_status_t | coap_print_link (const coap_resource_t *resource, unsigned char *buf, size_t *len, size_t *offset) |
Writes a description of this resource in link-format to given text buffer. More... | |
COAP_API coap_print_status_t | coap_print_wellknown (coap_context_t *context, unsigned char *buf, size_t *buflen, size_t offset, const coap_string_t *query_filter) |
Prints the names of all known resources for context to buf . More... | |
COAP_DEPRECATED COAP_API int | coap_resource_set_dirty (coap_resource_t *r, const coap_string_t *query) |
Generic resource handling.
Definition in file coap_resource.h.
#define COAP_RESOURCE_CHECK_TIME 2 |
The interval in seconds to check if resources have changed.
Definition at line 22 of file coap_resource.h.
COAP_DEPRECATED COAP_API int coap_resource_set_dirty | ( | coap_resource_t * | r, |
const coap_string_t * | query | ||
) |