IoTivity-Lite
oc_ri.h File Reference
#include "messaging/coap/constants.h"
#include "oc_config.h"
#include "oc_endpoint.h"
#include "oc_enums.h"
#include "oc_export.h"
#include "oc_rep.h"
#include "oc_uuid.h"
#include "port/oc_clock.h"
#include "util/oc_features.h"
#include "util/oc_compiler.h"
#include <stdbool.h>

Data Structures

struct  oc_properties_cb_t
 properties callback structure More...
 
struct  oc_request_handler_s
 request handler type More...
 
struct  oc_request_t
 request information structure More...
 
struct  oc_resource_s
 resource structure More...
 

Macros

#define OC_NUM_CORE_RESOURCES_PER_DEVICE   (1 + OCF_D)
 
#define oc_ri_add_timed_event_callback_seconds(cb_data, event_callback, seconds)
 add timed event callback in seconds

More...
 

Typedefs

typedef struct oc_collection_s oc_collection_t
 
typedef void(* oc_get_properties_cb_t) (const oc_resource_t *, oc_interface_mask_t, void *)
 get properties callback More...
 
typedef void(* oc_payload_callback_t) (void)
 application should define this callback which builds updated contents of pushable Resource More...
 
typedef struct oc_properties_cb_t oc_properties_cb_t
 properties callback structure More...
 
typedef void(* oc_request_callback_t) (oc_request_t *, oc_interface_mask_t, void *)
 request callback More...
 
typedef struct oc_request_handler_s oc_request_handler_t
 request handler type More...
 
typedef struct oc_request_t oc_request_t
 request information structure More...
 
typedef struct oc_resource_s oc_resource_t
 
typedef struct oc_response_s oc_response_t
 response type More...
 
typedef void(* oc_ri_delete_resource_cb_t) (oc_resource_t *resource)
 Callback invoked on resource before it is deleted by oc_delayed_delete_resource. More...
 
typedef bool(* oc_ri_timed_event_filter_t) (const void *cb_data, const void *filter_data)
 Filtering function used to match scheduled timed events by context data. More...
 
typedef void(* oc_ri_timed_event_on_delete_t) (void *cb_data)
 Function invoked with timed event context data before the timed event is deallocated. More...
 
typedef struct oc_separate_response_s oc_separate_response_t
 seperate response type More...
 
typedef bool(* oc_set_properties_cb_t) (const oc_resource_t *, const oc_rep_t *, void *)
 set properties callback More...
 
typedef oc_event_callback_retval_t(* oc_trigger_t) (void *)
 

Enumerations

enum  oc_content_format_t {
  TEXT_PLAIN = 0 , TEXT_XML = 1 , TEXT_CSV = 2 , TEXT_HTML = 3 ,
  IMAGE_GIF = 21 , IMAGE_JPEG = 22 , IMAGE_PNG = 23 , IMAGE_TIFF = 24 ,
  AUDIO_RAW = 25 , VIDEO_RAW = 26 , APPLICATION_LINK_FORMAT = 40 , APPLICATION_XML = 41 ,
  APPLICATION_OCTET_STREAM = 42 , APPLICATION_RDF_XML = 43 , APPLICATION_SOAP_XML = 44 , APPLICATION_ATOM_XML = 45 ,
  APPLICATION_XMPP_XML = 46 , APPLICATION_EXI = 47 , APPLICATION_FASTINFOSET = 48 , APPLICATION_SOAP_FASTINFOSET = 49 ,
  APPLICATION_JSON = 50 , APPLICATION_X_OBIX_BINARY = 51 , APPLICATION_CBOR = 60 , APPLICATION_SENML_JSON = 110 ,
  APPLICATION_SENSML_JSON = 111 , APPLICATION_SENML_CBOR = 112 , APPLICATION_SENSML_CBOR = 113 , APPLICATION_SENML_EXI = 114 ,
  APPLICATION_SENSML_EXI = 115 , APPLICATION_PKCS7_SGK , APPLICATION_PKCS7_CO = 281 , APPLICATION_PKCS7_CMC_REQUEST ,
  APPLICATION_PKCS7_CMC_RESPONSE , APPLICATION_PKCS8 = 284 , APPLICATION_CRATTRS = 285 , APPLICATION_PKCS10 = 286 ,
  APPLICATION_PKIX_CERT = 287 , APPLICATION_TD_JSON = 432 , APPLICATION_VND_OCF_CBOR = 10000 , APPLICATION_OSCORE = 10001 ,
  APPLICATION_VND_OMA_LWM2M_TLV = 11542 , APPLICATION_VND_OMA_LWM2M_JSON = 11543 , APPLICATION_VND_OMA_LWM2M_CBOR = 11544 , APPLICATION_NOT_DEFINED = 0xFFFF
}
 payload content formats More...
 
enum  oc_core_resource_t {
  OCF_P = 0 , PLGD_TIME , OCF_CON , OCF_RES ,
  OCF_MNT , OCF_COAPCLOUDCONF , OCF_SW_UPDATE , OCF_SEC_DOXM ,
  OCF_SEC_PSTAT , OCF_SEC_ACL , OCF_SEC_AEL , OCF_SEC_CRED ,
  OCF_SEC_SDI , OCF_SEC_SP , OCF_SEC_CSR , OCF_SEC_ROLES ,
  OCF_D
}
 
enum  oc_event_callback_retval_t { OC_EVENT_DONE = 0 , OC_EVENT_CONTINUE }
 
enum  oc_interface_mask_t {
  OC_IF_BASELINE = 1 << 1 , OC_IF_LL = 1 << 2 , OC_IF_B = 1 << 3 , OC_IF_R = 1 << 4 ,
  OC_IF_RW = 1 << 5 , OC_IF_A = 1 << 6 , OC_IF_S = 1 << 7 , OC_IF_CREATE = 1 << 8 ,
  OC_IF_W = 1 << 9 , OC_IF_STARTUP = 1 << 10 , OC_IF_STARTUP_REVERT = 1 << 11 , PLGD_IF_ETAG = 1 << 12
}
 interface masks More...
 
enum  oc_method_t {
  OC_GET = 1 , OC_POST , OC_PUT , OC_DELETE ,
  OC_FETCH
}
 CoAP methods. More...
 
enum  oc_resource_properties_t {
  OC_DISCOVERABLE = (1 << 0) , OC_OBSERVABLE = (1 << 1) , OC_PUSHABLE = (1 << 2) , OC_SECURE = (1 << 4) ,
  OC_PERIODIC = (1 << 6) , OC_SECURE_MCAST = (1 << 8) , OC_ACCESS_IN_RFOTM = (1 << 9)
}
 resource properties (bit mask) More...
 
enum  oc_status_t {
  OC_STATUS_OK = 0 , OC_STATUS_CREATED , OC_STATUS_CHANGED , OC_STATUS_DELETED ,
  OC_STATUS_NOT_MODIFIED , OC_STATUS_BAD_REQUEST , OC_STATUS_UNAUTHORIZED , OC_STATUS_BAD_OPTION ,
  OC_STATUS_FORBIDDEN , OC_STATUS_NOT_FOUND , OC_STATUS_METHOD_NOT_ALLOWED , OC_STATUS_NOT_ACCEPTABLE ,
  OC_STATUS_REQUEST_ENTITY_TOO_LARGE , OC_STATUS_UNSUPPORTED_MEDIA_TYPE , OC_STATUS_INTERNAL_SERVER_ERROR , OC_STATUS_NOT_IMPLEMENTED ,
  OC_STATUS_BAD_GATEWAY , OC_STATUS_SERVICE_UNAVAILABLE , OC_STATUS_GATEWAY_TIMEOUT , OC_STATUS_PROXYING_NOT_SUPPORTED ,
  __NUM_OC_STATUS_CODES__ , OC_IGNORE , OC_PING_TIMEOUT , OC_REQUEST_TIMEOUT ,
  OC_CONNECTION_CLOSED , OC_TRANSACTION_TIMEOUT , OC_CANCELLED
}
 response status can be translated to HTTP or CoAP. More...
 

Functions

int oc_coap_status_to_status (coap_status_t status)
 convert the CoAP status code to status code More...
 
const char * oc_method_to_str (oc_method_t method)
 Convert method to string. More...
 
bool oc_ri_add_resource (oc_resource_t *resource)
 add resource to the system More...
 
void oc_ri_add_timed_event_callback_ticks (void *cb_data, oc_trigger_t event_callback, oc_clock_time_t ticks)
 add timed event callback More...
 
bool oc_ri_delete_resource (oc_resource_t *resource)
 remove the resource from the list of application resources More...
 
oc_resource_toc_ri_get_app_resource_by_uri (const char *uri, size_t uri_len, size_t device)
 retrieve the resource by uri and device index More...
 
oc_resource_toc_ri_get_app_resources (void)
 retrieve list of resources More...
 
oc_interface_mask_t oc_ri_get_interface_mask (const char *iface, size_t iface_len)
 retrieve the interface mask from the interface name More...
 
int oc_ri_get_query_nth_key_value (const char *query, size_t query_len, const char **key, size_t *key_len, const char **value, size_t *value_len, size_t n)
 retrieve the query value at the nth position More...
 
int oc_ri_get_query_value (const char *query, size_t query_len, const char *key, const char **value)
 retrieve the value of the query parameter "key" More...
 
int oc_ri_get_query_value_v1 (const char *query, size_t query_len, const char *key, size_t key_len, const char **value)
 retrieve the value of the query parameter "key" More...
 
bool oc_ri_has_timed_event_callback (const void *cb_data, oc_trigger_t event_callback, bool ignore_cb_data)
 check if the timed event callback already exists. More...
 
bool oc_ri_is_app_resource_to_be_deleted (const oc_resource_t *resource)
 Check if the resource has been scheduled to by deleted by oc_delayed_delete_resource. More...
 
bool oc_ri_is_app_resource_valid (const oc_resource_t *resource)
 checks if the resource is valid More...
 
bool oc_ri_on_delete_resource_add_callback (oc_ri_delete_resource_cb_t cb)
 Add to the global list of callbacks invoked by oc_delayed_delete_resource before each resource is deleted. More...
 
bool oc_ri_on_delete_resource_remove_callback (oc_ri_delete_resource_cb_t cb)
 Remove callback from the list of callbacks invoked by oc_delayed_delete_resource. More...
 
int oc_ri_query_exists (const char *query, size_t query_len, const char *key)
 Checks if key exist in query. More...
 
bool oc_ri_query_exists_v1 (const char *query, size_t query_len, const char *key, size_t key_len)
 Checks if key exist in query. More...
 
int oc_ri_query_nth_key_exists (const char *query, size_t query_len, const char **key, size_t *key_len, size_t n)
 check if the nth key exists More...
 
void oc_ri_remove_timed_event_callback (const void *cb_data, oc_trigger_t event_callback)
 remove the timed event callback More...
 
void oc_ri_remove_timed_event_callback_by_filter (oc_trigger_t cb, oc_ri_timed_event_filter_t filter, const void *filter_data, bool match_all, oc_ri_timed_event_on_delete_t on_delete)
 remove the timed event callback by filter More...
 
int oc_status_code (oc_status_t key)
 convert the status code to CoAP status code More...
 
const char * oc_status_to_str (oc_status_t key)
 Convert the status code to string. More...
 

Macro Definition Documentation

◆ oc_ri_add_timed_event_callback_seconds

#define oc_ri_add_timed_event_callback_seconds (   cb_data,
  event_callback,
  seconds 
)
Value:
do { \
oc_ri_add_timed_event_callback_ticks(cb_data, event_callback, \
(oc_clock_time_t)(seconds) * \
(oc_clock_time_t)OC_CLOCK_SECOND); \
} while (0)

add timed event callback in seconds

Parameters
cb_datathe timed event callback info
event_callbackthe callback
secondstime in seconds

Typedef Documentation

◆ oc_get_properties_cb_t

typedef void(* oc_get_properties_cb_t) (const oc_resource_t *, oc_interface_mask_t, void *)

get properties callback

◆ oc_payload_callback_t

typedef void(* oc_payload_callback_t) (void)

application should define this callback which builds updated contents of pushable Resource

◆ oc_properties_cb_t

properties callback structure

◆ oc_request_callback_t

typedef void(* oc_request_callback_t) (oc_request_t *, oc_interface_mask_t, void *)

request callback

◆ oc_request_handler_t

request handler type

◆ oc_request_t

typedef struct oc_request_t oc_request_t

request information structure

◆ oc_response_t

typedef struct oc_response_s oc_response_t

response type

◆ oc_ri_delete_resource_cb_t

typedef void(* oc_ri_delete_resource_cb_t) (oc_resource_t *resource)

Callback invoked on resource before it is deleted by oc_delayed_delete_resource.

Parameters
resourceResource to be deleted

◆ oc_ri_timed_event_filter_t

typedef bool(* oc_ri_timed_event_filter_t) (const void *cb_data, const void *filter_data)

Filtering function used to match scheduled timed events by context data.

Parameters
cb_dataData for the timed event callback
filter_dataUser data passed from the caller to the filtering function
See also
oc_ri_remove_timed_event_callback_by_filter

◆ oc_ri_timed_event_on_delete_t

typedef void(* oc_ri_timed_event_on_delete_t) (void *cb_data)

Function invoked with timed event context data before the timed event is deallocated.

Note
Expected use case is for a dynamically allocated context to be deallocated by this callback.
See also
oc_ri_remove_timed_event_callback_by_filter

◆ oc_separate_response_t

typedef struct oc_separate_response_s oc_separate_response_t

seperate response type

◆ oc_set_properties_cb_t

typedef bool(* oc_set_properties_cb_t) (const oc_resource_t *, const oc_rep_t *, void *)

set properties callback

Enumeration Type Documentation

◆ oc_content_format_t

payload content formats

https://www.iana.org/assignments/core-parameters/core-parameters.xhtml#rd-parameters

Enumerator
TEXT_PLAIN 

text/plain

TEXT_XML 

text/xml

TEXT_CSV 

text/csv

TEXT_HTML 

text/html

IMAGE_GIF 

image/gif - not used

IMAGE_JPEG 

image/jpeg - not used

IMAGE_PNG 

image/png - not used

IMAGE_TIFF 

image/tiff - not used

AUDIO_RAW 

audio/raw - not used

VIDEO_RAW 

video/raw - not used

APPLICATION_LINK_FORMAT 

application/link-format

APPLICATION_XML 

application/xml

APPLICATION_OCTET_STREAM 

application/octet-stream

APPLICATION_RDF_XML 

application - not used

APPLICATION_SOAP_XML 

application/soap - not used

APPLICATION_ATOM_XML 

application - not used

APPLICATION_XMPP_XML 

application - not used

APPLICATION_EXI 

application/exi

APPLICATION_FASTINFOSET 

application

APPLICATION_SOAP_FASTINFOSET 

application

APPLICATION_JSON 

application/json

APPLICATION_X_OBIX_BINARY 

application - not used

APPLICATION_CBOR 

application/cbor

APPLICATION_SENML_JSON 

application/senml+json

APPLICATION_SENSML_JSON 

application/sensml+json

APPLICATION_SENML_CBOR 

application/senml+cbor

APPLICATION_SENSML_CBOR 

application/sensml+cbor

APPLICATION_SENML_EXI 

application/senml-exi

APPLICATION_SENSML_EXI 

application/sensml-exi

APPLICATION_PKCS7_SGK 

application/pkcs7-mime; smime-type=server-generated-key

APPLICATION_PKCS7_CO 

application/pkcs7-mime; smime-type=certs-only

APPLICATION_PKCS7_CMC_REQUEST 

application/pkcs7-mime; smime-type=CMC-Request

APPLICATION_PKCS7_CMC_RESPONSE 

application/pkcs7-mime; smime-type=CMC-Response

APPLICATION_PKCS8 

application/pkcs8

APPLICATION_CRATTRS 

application/csrattrs

APPLICATION_PKCS10 

application/pkcs10

APPLICATION_PKIX_CERT 

application/pkix-cert

APPLICATION_TD_JSON 

application/td+json

APPLICATION_VND_OCF_CBOR 

application/vnd.ocf+cbor

APPLICATION_OSCORE 

application/oscore

APPLICATION_VND_OMA_LWM2M_TLV 

application/vnd.oma.lwm2m+tlv

APPLICATION_VND_OMA_LWM2M_JSON 

application/vnd.oma.lwm2m+json

APPLICATION_VND_OMA_LWM2M_CBOR 

application/vnd.oma.lwm2m+cbor

APPLICATION_NOT_DEFINED 

not defined

◆ oc_interface_mask_t

interface masks

Enumerator
OC_IF_BASELINE 

oic.if.baseline

OC_IF_LL 

oic.if.ll

OC_IF_B 

oic.if.b

OC_IF_R 

oic.if.r

OC_IF_RW 

oic.if.rw

OC_IF_A 

oic.if.a

OC_IF_S 

oic.if.s

OC_IF_CREATE 

oic.if.create

OC_IF_W 

oic.if.w

OC_IF_STARTUP 

oic.if.startup

OC_IF_STARTUP_REVERT 

oic.if.startup.revert

PLGD_IF_ETAG 

x.plgd.if.etag

◆ oc_method_t

CoAP methods.

Enumerator
OC_GET 

GET.

OC_POST 

POST.

OC_PUT 

PUT.

OC_DELETE 

DELETE.

OC_FETCH 

FETCH.

◆ oc_resource_properties_t

resource properties (bit mask)

Enumerator
OC_DISCOVERABLE 

discoverable

OC_OBSERVABLE 

observable

OC_PUSHABLE 

pushable

OC_SECURE 

secure

OC_PERIODIC 

periodical update

OC_SECURE_MCAST 

secure multicast (oscore)

OC_ACCESS_IN_RFOTM 

allow access to resource in ready for ownership transfer method(RFOTM) state

◆ oc_status_t

response status can be translated to HTTP or CoAP.

Enumerator
OC_STATUS_OK 

OK.

OC_STATUS_CREATED 

Created.

OC_STATUS_CHANGED 

Changed.

OC_STATUS_DELETED 

Deleted.

OC_STATUS_NOT_MODIFIED 

Not Modified.

OC_STATUS_BAD_REQUEST 

Bad Request.

OC_STATUS_UNAUTHORIZED 

Unauthorized.

OC_STATUS_BAD_OPTION 

Bad Option.

OC_STATUS_FORBIDDEN 

Forbidden.

OC_STATUS_NOT_FOUND 

Not Found.

OC_STATUS_METHOD_NOT_ALLOWED 

Method Not Allowed.

OC_STATUS_NOT_ACCEPTABLE 

Not Acceptable.

OC_STATUS_REQUEST_ENTITY_TOO_LARGE 

Request Entity Too Large.

OC_STATUS_UNSUPPORTED_MEDIA_TYPE 

Unsupported Media Type.

OC_STATUS_INTERNAL_SERVER_ERROR 

Internal Server Error.

OC_STATUS_NOT_IMPLEMENTED 

Not Implemented.

OC_STATUS_BAD_GATEWAY 

Bad Gateway.

OC_STATUS_SERVICE_UNAVAILABLE 

Service Unavailable.

OC_STATUS_GATEWAY_TIMEOUT 

Gateway Timeout.

OC_STATUS_PROXYING_NOT_SUPPORTED 

Proxying not supported.

OC_IGNORE 

Ignore: do not respond to request.

OC_PING_TIMEOUT 

Ping Time out.

OC_REQUEST_TIMEOUT 

Timeout is returned when the timeout is reached for requests created by oc_do_get_with_timeout, oc_do_delete_with_timeout, oc_do_put_with_timeout, or oc_do_post_with_timeout.

OC_CONNECTION_CLOSED 

Connection closed by peer, or client.

eg. for invalid TLS handshake

OC_TRANSACTION_TIMEOUT 

Blockwise transaction timed out's.

OC_CANCELLED 

Cancelled: request was cancelled by the client.

Function Documentation

◆ oc_coap_status_to_status()

int oc_coap_status_to_status ( coap_status_t  status)

convert the CoAP status code to status code

Parameters
statusCoAP status code
Returns
-1 on failure
status code (oc_status_t) on success

◆ oc_method_to_str()

const char* oc_method_to_str ( oc_method_t  method)

Convert method to string.

It is thread safe.

Returns
Method in const char *.
Empty string for an invalid method value

◆ oc_ri_add_resource()

bool oc_ri_add_resource ( oc_resource_t resource)

add resource to the system

Parameters
resourcethe resource to be added to the list of application resources
Returns
true success
false failure

◆ oc_ri_add_timed_event_callback_ticks()

void oc_ri_add_timed_event_callback_ticks ( void *  cb_data,
oc_trigger_t  event_callback,
oc_clock_time_t  ticks 
)

add timed event callback

Parameters
cb_datathe timed event callback info
event_callbackthe callback (cannot be NULL)
tickstime in ticks

◆ oc_ri_delete_resource()

bool oc_ri_delete_resource ( oc_resource_t resource)

remove the resource from the list of application resources

Parameters
resourcethe resource to be removed from the list of application resources
Returns
true success
false failure

◆ oc_ri_get_app_resource_by_uri()

oc_resource_t* oc_ri_get_app_resource_by_uri ( const char *  uri,
size_t  uri_len,
size_t  device 
)

retrieve the resource by uri and device index

Parameters
urithe uri of the resource
uri_lenthe length of the uri
devicethe device index
Returns
oc_resource_t* the resource structure

◆ oc_ri_get_app_resources()

oc_resource_t* oc_ri_get_app_resources ( void  )

retrieve list of resources

Returns
oc_resource_t* the resource list

◆ oc_ri_get_interface_mask()

oc_interface_mask_t oc_ri_get_interface_mask ( const char *  iface,
size_t  iface_len 
)

retrieve the interface mask from the interface name

Parameters
ifacethe interface string (e.g. "oic.if.s", cannot be NULL)
iface_lenlength of the interface string
Returns
0 on failure
oc_interface_mask_t the mask value of the interface

◆ oc_ri_get_query_nth_key_value()

int oc_ri_get_query_nth_key_value ( const char *  query,
size_t  query_len,
const char **  key,
size_t *  key_len,
const char **  value,
size_t *  value_len,
size_t  n 
)

retrieve the query value at the nth position

Parameters
querythe input query
query_lenthe query length
[out]keythe key (cannot be NULL)
[out]key_lenthe length of the key (cannot be NULL)
[out]valuethe value belonging to the key
[out]value_lenthe length of the value
nthe position to query (must be > 0)
Returns
int the position of the next key value pair in the query
int -1 on failure

◆ oc_ri_get_query_value()

int oc_ri_get_query_value ( const char *  query,
size_t  query_len,
const char *  key,
const char **  value 
)

retrieve the value of the query parameter "key"

Deprecated:
replaced by oc_ri_get_query_value_v1 in v2.2.5.9

◆ oc_ri_get_query_value_v1()

int oc_ri_get_query_value_v1 ( const char *  query,
size_t  query_len,
const char *  key,
size_t  key_len,
const char **  value 
)

retrieve the value of the query parameter "key"

Parameters
querythe input query
query_lenthe query length
keythe wanted key (cannot be NULL)
key_lenthe length of the wanted key
valuethe returned value
Returns
-1 if the key is not found
the length of the value

◆ oc_ri_has_timed_event_callback()

bool oc_ri_has_timed_event_callback ( const void *  cb_data,
oc_trigger_t  event_callback,
bool  ignore_cb_data 
)

check if the timed event callback already exists.

Iterate through the list of timed event callbacks and check if a matching item is found. To match: 1) function pointers must be equal 2) the callback info pointers must be equal or ignore_cb_data must be true

Parameters
cb_datathe timed event callback info
event_callbackthe callback (cannot be NULL)
ignore_cb_datadon't compare the timed event callback info pointers
Returns
true matching timed event callback was found
false otherwise

◆ oc_ri_is_app_resource_to_be_deleted()

bool oc_ri_is_app_resource_to_be_deleted ( const oc_resource_t resource)

Check if the resource has been scheduled to by deleted by oc_delayed_delete_resource.

Such resource should not be used.

Parameters
resourceresource to be checked
Returns
true resource is about to be deleted
false otherwise
See also
oc_delayed_delete_resource

◆ oc_ri_is_app_resource_valid()

bool oc_ri_is_app_resource_valid ( const oc_resource_t resource)

checks if the resource is valid

Parameters
resourceresource to be tested
Returns
true valid
false not valid

◆ oc_ri_on_delete_resource_add_callback()

bool oc_ri_on_delete_resource_add_callback ( oc_ri_delete_resource_cb_t  cb)

Add to the global list of callbacks invoked by oc_delayed_delete_resource before each resource is deleted.

Parameters
cbthe callback to be added (cannot be NULL)
Returns
true on success
false on error

◆ oc_ri_on_delete_resource_remove_callback()

bool oc_ri_on_delete_resource_remove_callback ( oc_ri_delete_resource_cb_t  cb)

Remove callback from the list of callbacks invoked by oc_delayed_delete_resource.

Parameters
cbthe callback to be removed (cannot be NULL)
Returns
true callback was found and removed
false callback was not found

◆ oc_ri_query_exists()

int oc_ri_query_exists ( const char *  query,
size_t  query_len,
const char *  key 
)

Checks if key exist in query.

Returns
-1 if key does not exist
Deprecated:
replaced by oc_ri_query_exists_v1 in v2.2.5.9

◆ oc_ri_query_exists_v1()

bool oc_ri_query_exists_v1 ( const char *  query,
size_t  query_len,
const char *  key,
size_t  key_len 
)

Checks if key exist in query.

Parameters
querythe query to inspect
query_lenthe length of the query
keythe key to be checked if exist, key is null terminated (cannot be NULL)
key_lenthe key length
Returns
true if key exists

◆ oc_ri_query_nth_key_exists()

int oc_ri_query_nth_key_exists ( const char *  query,
size_t  query_len,
const char **  key,
size_t *  key_len,
size_t  n 
)

check if the nth key exists

Parameters
querythe query to inspect
query_lenthe length of the query
keythe key to be checked if exist, key is not null terminated (cannot be NULL)
key_lenthe key length (cannot be NULL)
nindex of the key (must be > 0)
Returns
-1 if key does not exist
>= 0 if key exists and the value is the position of the next key in the query or query_len if it is the last key

◆ oc_ri_remove_timed_event_callback()

void oc_ri_remove_timed_event_callback ( const void *  cb_data,
oc_trigger_t  event_callback 
)

remove the timed event callback

Parameters
cb_datatimed event callback info
event_callbacktimed event callback

◆ oc_ri_remove_timed_event_callback_by_filter()

void oc_ri_remove_timed_event_callback_by_filter ( oc_trigger_t  cb,
oc_ri_timed_event_filter_t  filter,
const void *  filter_data,
bool  match_all,
oc_ri_timed_event_on_delete_t  on_delete 
)

remove the timed event callback by filter

Parameters
cbtimed event callback (cannot be NULL)
filterfiltering function (cannot be NULL)
filter_datauser data provided to the filtering function
match_alliterate over all timed events (otherwise the iteration will stop after the first match)
on_deletefunction invoked with the context data of the timed event, before the event is deallocated
Note
if the matched timed event is currently being processed then the on_delete callback will be invoked when the processing is finished. So it might occurr some time after the call to oc_ri_remove_timed_event_callback_by_filter has finished.
See also
oc_ri_timed_event_filter_t

◆ oc_status_code()

int oc_status_code ( oc_status_t  key)

convert the status code to CoAP status code

Parameters
keythe application level key of the code
Returns
-1 on failure
CoAP status code (coap_status_t) on success

◆ oc_status_to_str()

const char* oc_status_to_str ( oc_status_t  key)

Convert the status code to string.

Parameters
[in]keykey the application level key of the code
Returns
CoAP status code in const char *
Empty string for an invalid status value