KNX IoT
KNX IoT Point API stack implementation
oc_ri.h File Reference

resource internals More...

#include "oc_config.h"
#include "oc_endpoint.h"
#include "oc_rep.h"
#include "oc_uuid.h"
#include "util/oc_etimer.h"

Go to the source code of this file.

Data Structures

struct  oc_event_callback_s
 event callback More...
 
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...
 
struct  oc_response_t
 response type More...
 

Macros

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

More...
 
#define oc_ri_create_const_resource_final(resource_name, ...)
 
#define oc_ri_create_const_resource_internal( next_resource, resource_name, device_index, name, uri, dpt, iface_mask, content_format, properties, get_cb, put_cb, post_cb, delete_cb, ctx, observe_period, instance, ...)
 
#define oc_ri_create_const_resource_linked(next_resource, ...)
 

Typedefs

typedef struct oc_event_callback_s oc_event_callback_t
 event callback More...
 
typedef void(* oc_get_properties_cb_t) (oc_resource_t *, oc_interface_mask_t, void *)
 get properties callback More...
 
typedef struct oc_link_s oc_link_t
 
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_data_t oc_resource_data_t
 
typedef struct oc_resource_dummy_s oc_resource_dummy_t
 
typedef struct oc_resource_s oc_resource_t
 
typedef struct oc_response_buffer_s oc_response_buffer_t
 response buffer type More...
 
typedef struct oc_response_t oc_response_t
 response type More...
 
typedef struct oc_separate_response_s oc_separate_response_t
 separate response type More...
 
typedef bool(* oc_set_properties_cb_t) (oc_resource_t *, 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 , APPLICATION_PKCS7_CMC_REQUEST ,
  APPLICATION_PKCS7_CMC_RESPONSE , APPLICATION_PKCS8 = 284 , APPLICATION_CRATTRS = 285 , APPLICATION_PKCS10 = 286 ,
  APPLICATION_PKIX_CERT = 287 , 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 , CONTENT_NONE = 99999
}
 payload content formats More...
 
enum  oc_core_resource_t {
  OC_DEV_SN = 0 , OC_DEV_HWV , OC_DEV_FWV , OC_DEV_HWT ,
  OC_DEV_MODEL , OC_DEV_HOSTNAME , OC_DEV_IID , OC_DEV_PM ,
  OC_DEV_IPV6 , OC_DEV_SA , OC_DEV_DA , OC_DEV_FID ,
  OC_DEV_PORT , OC_DEV_MPORT , OC_DEV_MID , OC_DEV ,
  OC_APP , OC_APP_X , OC_A_LSM , OC_KNX_SPAKE ,
  OC_KNX_IDEVID , OC_KNX_LDEVID , OC_KNX_K , OC_KNX_FINGERPRINT ,
  OC_KNX_IA , OC_KNX_OSN , OC_KNX , OC_KNX_FP_G ,
  OC_KNX_FP_G_X , OC_KNX_FP_R , OC_KNX_FP_R_X , OC_KNX_P ,
  OC_KNX_F , OC_KNX_F_X , OC_KNX_SWU_PROTOCOL , OC_KNX_SWU_MAXDEFER ,
  OC_KNX_SWU_METHOD , OC_KNX_LASTUPDATE , OC_KNX_SWU_RESULT , OC_KNX_SWU_STATE ,
  OC_KNX_SWU_UPDATE , OC_KNX_SWU_PKGV , OC_KNX_SWU_PKGCMD , OC_KNX_SWU_PKGBYTES ,
  OC_KNX_SWU_PKGQURL , OC_KNX_SWU_PKGNAMES , OC_KNX_SWU , OC_KNX_SUB ,
  OC_KNX_A_SEN , OC_KNX_AUTH_O_REPLWDO , OC_KNX_AUTH_O_OSNDELAY , OC_KNX_AUTH_O ,
  OC_KNX_AUTH_AT , OC_KNX_AUTH_AT_X , OC_KNX_AUTH , WELLKNOWNCORE
}
 core resource numbers More...
 
enum  oc_event_callback_retval_t { OC_EVENT_DONE = 0 , OC_EVENT_CONTINUE }
 callback return values More...
 
enum  oc_interface_mask_t {
  OC_IF_NONE = 0 , OC_IF_I = (1 << 1) , OC_IF_O = (1 << 2) , OC_IF_G = (1 << 3) ,
  OC_IF_C = (1 << 4) , OC_IF_P = (1 << 5) , OC_IF_D = (1 << 6) , OC_IF_A = (1 << 7) ,
  OC_IF_S = (1 << 8) , OC_IF_LI = (1 << 9) , OC_IF_B = (1 << 10) , OC_IF_SEC = (1 << 11) ,
  OC_IF_SWU = (1 << 12) , OC_IF_PM = (1 << 13) , OC_IF_M = (1 << 14)
}
 interface masks security access scopes defined as interfaces note that scope = 1 is not used. 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_UNDISCOVERABLE = 0 , OC_DISCOVERABLE = (1 << 0) , OC_OBSERVABLE = (1 << 1) , OC_SECURE = (1 << 4) ,
  OC_PERIODIC = (1 << 6) , OC_SECURE_MCAST = (1 << 8)
}
 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
}
 CoAP status codes. More...
 

Functions

const char * get_interface_string (oc_interface_mask_t mask)
 Get the interface string object Note: should be called with a single interface as mask only. More...
 
const char * get_method_name (oc_method_t method)
 Get the method name object. More...
 
bool oc_check_accept_header (oc_request_t *request, oc_content_format_t accept)
 checks if the accept header is correct note that if the accept header is not there, this check is a pass More...
 
int oc_get_interface_in_mask_in_string_array (oc_interface_mask_t iface_mask, int nr_entries, oc_string_array_t interface_array)
 sets all interfaces in the mask in the string array More...
 
void oc_print_interface (oc_interface_mask_t iface_mask)
 prints all interfaces in the mask to stdout More...
 
bool oc_ri_add_resource (oc_resource_t *resource)
 add resource to the system More...
 
bool oc_ri_add_resource_block (const oc_resource_t *resource)
 add resource block 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...
 
oc_resource_toc_ri_alloc_resource (void)
 allocate a resource structure More...
 
oc_resource_data_t * oc_ri_alloc_resource_data (void)
 allocate a resource structure More...
 
bool oc_ri_delete_resource (const oc_resource_t *resource)
 remove the resource from the list of application resources More...
 
bool oc_ri_delete_resource_block (const oc_resource_t *resource)
 remove the resource block from the list of application resources More...
 
void oc_ri_free_resource_properties (oc_resource_t *resource)
 free the properties of the resource More...
 
const 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...
 
const oc_resource_toc_ri_get_app_resources (void)
 retrieve list of resources More...
 
oc_interface_mask_t oc_ri_get_interface_mask (char *iface, size_t if_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, char **key, size_t *key_len, 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, char **value)
 retrieve the value of the query parameter "key" More...
 
void oc_ri_init (void)
 initialize the resource implementation handler More...
 
bool oc_ri_is_app_resource_valid (const oc_resource_t *resource)
 checks if the resource is valid More...
 
bool oc_ri_new_request_from_request (oc_request_t *new_request, oc_request_t *request, oc_response_buffer_t *response_buffer, oc_response_t *response_obj)
 create a new request from the old request is used internally only for redirection of: More...
 
int oc_ri_query_exists (const char *query, size_t query_len, const char *key)
 checks if key exist in query More...
 
int oc_ri_query_nth_key_exists (const char *query, size_t query_len, char **key, size_t *key_len, size_t n)
 check if the nth key exists More...
 
void oc_ri_remove_timed_event_callback (void *cb_data, oc_trigger_t event_callback)
 remove the timed event callback More...
 
const oc_resource_toc_ri_resource_next (const oc_resource_t *resource)
 get the next resource More...
 
void oc_ri_shutdown (void)
 shut down the resource implementation handler More...
 
int oc_status_code (oc_status_t key)
 convert the (internal) status code to coap status as integer More...
 
int oc_total_interface_in_mask (oc_interface_mask_t iface_mask)
 total interfaces in the interface mask Note calculates the if.g.s.a only 1 More...
 

Detailed Description

resource internals

Definition in file oc_ri.h.

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

Definition at line 566 of file oc_ri.h.

◆ oc_ri_create_const_resource_final

#define oc_ri_create_const_resource_final (   resource_name,
  ... 
)
Value:
oc_resource_dummy_t resource_block_end##resource_name = { NULL, -1 }; \
\
oc_ri_create_const_resource_internal(resource_block_end##resource_name, \
resource_name, __VA_ARGS__)

Definition at line 110 of file oc_ri.h.

◆ oc_ri_create_const_resource_internal

#define oc_ri_create_const_resource_internal (   next_resource,
  resource_name,
  device_index,
  name,
  uri,
  dpt,
  iface_mask,
  content_format,
  properties,
  get_cb,
  put_cb,
  post_cb,
  delete_cb,
  ctx,
  observe_period,
  instance,
  ... 
)
Value:
oc_resource_data_t resource_name##_data; \
const oc_resource_t resource_name = { \
/*next*/ (oc_resource_t *)&next_resource, \
/*device*/ device_index, \
/*name*/ oc_string_create_const(name), \
/*uri*/ oc_string_create_const(uri), /*types*/ \
oc_string_array_create_const(__VA_ARGS__), \
/*dpt*/ oc_string_create_const(dpt), \
/*interfaces*/ iface_mask, \
/*content_type*/ content_format, \
/*properties*/ properties, \
/*get_handler*/ { get_cb, ctx }, \
/*put_handler*/ { put_cb, ctx }, \
/*post_handler*/ { post_cb, ctx }, \
/*delete_handler*/ { delete_cb, ctx }, \
/*get_properties*/ { NULL, NULL }, \
/*set_properties*/ { NULL, NULL }, \
/*observe_period_seconds*/ observe_period, \
/*fb_instance*/ instance, \
/*is_const*/ true, \
/*runtime_data*/ &resource_name##_data, \
};
resource structure
Definition: oc_ri.h:482

Definition at line 64 of file oc_ri.h.

◆ oc_ri_create_const_resource_linked

#define oc_ri_create_const_resource_linked (   next_resource,
  ... 
)
Value:
extern const oc_resource_t next_resource; \
oc_ri_create_const_resource_internal(next_resource, __VA_ARGS__)

Definition at line 98 of file oc_ri.h.

Typedef Documentation

◆ oc_event_callback_t

event callback

◆ oc_get_properties_cb_t

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

get properties callback

Definition at line 456 of file oc_ri.h.

◆ 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

Definition at line 433 of file oc_ri.h.

◆ oc_request_handler_t

request handler type

◆ oc_request_t

typedef struct oc_request_t oc_request_t

request information structure

◆ oc_response_buffer_t

typedef struct oc_response_buffer_s oc_response_buffer_t

response buffer type

Definition at line 1 of file oc_ri.h.

◆ oc_response_t

typedef struct oc_response_t oc_response_t

response type

◆ oc_separate_response_t

typedef struct oc_separate_response_s oc_separate_response_t

separate response type

Definition at line 1 of file oc_ri.h.

◆ oc_set_properties_cb_t

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

set properties callback

Definition at line 450 of file oc_ri.h.

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_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_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

CONTENT_NONE 

no content format

Definition at line 184 of file oc_ri.h.

184  {
185  TEXT_PLAIN = 0,
186  TEXT_XML = 1,
187  TEXT_CSV = 2,
188  TEXT_HTML = 3,
189  IMAGE_GIF = 21,
190  IMAGE_JPEG = 22,
191  IMAGE_PNG = 23,
192  IMAGE_TIFF = 24,
193  AUDIO_RAW = 25,
194  VIDEO_RAW = 26,
196  APPLICATION_XML = 41,
198  APPLICATION_RDF_XML = 43,
199  APPLICATION_SOAP_XML = 44,
200  APPLICATION_ATOM_XML = 45,
201  APPLICATION_XMPP_XML = 46,
202  APPLICATION_EXI = 47,
205  APPLICATION_JSON = 50,
207  APPLICATION_CBOR = 60,
208  APPLICATION_SENML_JSON = 110,
210  APPLICATION_SENML_CBOR = 112,
212  APPLICATION_SENML_EXI = 114,
213  APPLICATION_SENSML_EXI = 115,
215  280,
216  APPLICATION_PKCS7_CO =
217  281,
219  282,
221  283,
222  APPLICATION_PKCS8 = 284,
223  APPLICATION_CRATTRS = 285,
224  APPLICATION_PKCS10 = 286,
225  APPLICATION_PKIX_CERT = 287,
226  APPLICATION_VND_OCF_CBOR = 10000,
227  APPLICATION_OSCORE = 10001,
231  CONTENT_NONE = 99999
oc_content_format_t
payload content formats
Definition: oc_ri.h:184
@ TEXT_PLAIN
text/plain
Definition: oc_ri.h:185
@ APPLICATION_VND_OMA_LWM2M_JSON
application/vnd.oma.lwm2m+json
Definition: oc_ri.h:229
@ APPLICATION_SOAP_FASTINFOSET
application
Definition: oc_ri.h:204
@ APPLICATION_RDF_XML
application - not used
Definition: oc_ri.h:198
@ APPLICATION_CRATTRS
application/csrattrs
Definition: oc_ri.h:223
@ APPLICATION_PKCS7_CMC_RESPONSE
application/pkcs7-mime; smime-type=CMC-Response
Definition: oc_ri.h:220
@ APPLICATION_FASTINFOSET
application
Definition: oc_ri.h:203
@ APPLICATION_OCTET_STREAM
application/octet-stream
Definition: oc_ri.h:197
@ APPLICATION_SENSML_CBOR
application/sensml+cbor
Definition: oc_ri.h:211
@ APPLICATION_VND_OMA_LWM2M_CBOR
application/vnd.oma.lwm2m+cbor
Definition: oc_ri.h:230
@ AUDIO_RAW
audio/raw - not used
Definition: oc_ri.h:193
@ APPLICATION_PKCS7_SGK
application/pkcs7-mime; smime-type=server-generated-key
Definition: oc_ri.h:214
@ APPLICATION_PKIX_CERT
application/pkix-cert
Definition: oc_ri.h:225
@ IMAGE_PNG
image/png - not used
Definition: oc_ri.h:191
@ APPLICATION_PKCS8
application/pkcs8
Definition: oc_ri.h:222
@ APPLICATION_SENML_CBOR
application/senml+cbor
Definition: oc_ri.h:210
@ APPLICATION_OSCORE
application/oscore
Definition: oc_ri.h:227
@ APPLICATION_ATOM_XML
application - not used
Definition: oc_ri.h:200
@ IMAGE_GIF
image/gif - not used
Definition: oc_ri.h:189
@ APPLICATION_CBOR
application/cbor
Definition: oc_ri.h:207
@ APPLICATION_VND_OCF_CBOR
application/vnd.ocf+cbor
Definition: oc_ri.h:226
@ APPLICATION_SENSML_EXI
application/sensml-exi
Definition: oc_ri.h:213
@ APPLICATION_SENML_EXI
application/senml-exi
Definition: oc_ri.h:212
@ APPLICATION_PKCS7_CMC_REQUEST
application/pkcs7-mime; smime-type=CMC-Request
Definition: oc_ri.h:218
@ APPLICATION_X_OBIX_BINARY
application - not used
Definition: oc_ri.h:206
@ CONTENT_NONE
no content format
Definition: oc_ri.h:231
@ APPLICATION_LINK_FORMAT
application/link-format
Definition: oc_ri.h:195
@ APPLICATION_SENSML_JSON
application/sensml+json
Definition: oc_ri.h:209
@ APPLICATION_VND_OMA_LWM2M_TLV
application/vnd.oma.lwm2m+tlv
Definition: oc_ri.h:228
@ APPLICATION_SENML_JSON
application/senml+json
Definition: oc_ri.h:208
@ IMAGE_TIFF
image/tiff - not used
Definition: oc_ri.h:192
@ TEXT_CSV
text/csv
Definition: oc_ri.h:187
@ APPLICATION_PKCS10
application/pkcs10
Definition: oc_ri.h:224
@ APPLICATION_JSON
application/json
Definition: oc_ri.h:205
@ TEXT_HTML
text/html
Definition: oc_ri.h:188
@ APPLICATION_SOAP_XML
application/soap - not used
Definition: oc_ri.h:199
@ IMAGE_JPEG
image/jpeg - not used
Definition: oc_ri.h:190
@ APPLICATION_XMPP_XML
application - not used
Definition: oc_ri.h:201
@ TEXT_XML
text/xml
Definition: oc_ri.h:186
@ VIDEO_RAW
video/raw - not used
Definition: oc_ri.h:194
@ APPLICATION_EXI
application/exi
Definition: oc_ri.h:202
@ APPLICATION_XML
application/xml
Definition: oc_ri.h:196

◆ oc_core_resource_t

core resource numbers

Enumerator
OC_DEV_SN 

Device serial number.

OC_DEV_HWV 

Hardware version.

OC_DEV_FWV 

Firmware version.

OC_DEV_HWT 

The hardware type is a manufacture specific id for a device type (MaC uses this id for compatibility checks)

OC_DEV_MODEL 

Device model.

OC_DEV_HOSTNAME 

Device host name for DNS resolution.

OC_DEV_IID 

KNX installation ID.

OC_DEV_PM 

Programming Mode.

OC_DEV_IPV6 

IPV6.

OC_DEV_SA 

/dev/sa subnet address

OC_DEV_DA 

/dev/da device address

OC_DEV_FID 

/dev/fid the fabric ID

OC_DEV_PORT 

/dev/port the coap port number

OC_DEV_MPORT 

/dev/mport the multicast port number

OC_DEV_MID 

/dev/mid the manufacturer ID

OC_DEV 

core link

OC_APP 

application ID (list)

OC_APP_X 

application ID entry

OC_A_LSM 

load state machine

OC_KNX_SPAKE 

spake

OC_KNX_IDEVID 

IDevID.

OC_KNX_LDEVID 

LDevID.

OC_KNX_K 

k (renamed) .knx resource

OC_KNX_FINGERPRINT 

FINGERPRINT value of loaded contents.

OC_KNX_IA 

.well-known / knx / ia

OC_KNX_OSN 

.well-known / knx / osn

OC_KNX 

.well-known / knx

OC_KNX_FP_G 

FP/G.

OC_KNX_FP_G_X 

FP/G/X.

OC_KNX_FP_R 

FP/R.

OC_KNX_FP_R_X 

FP/R/X.

OC_KNX_P 

P.

OC_KNX_F 

/f

OC_KNX_F_X 

/f/X

OC_KNX_SWU_PROTOCOL 

software update protocol

OC_KNX_SWU_MAXDEFER 

swu max defer

OC_KNX_SWU_METHOD 

sw method

OC_KNX_LASTUPDATE 

sw last update

OC_KNX_SWU_RESULT 

sw result

OC_KNX_SWU_STATE 

sw state

OC_KNX_SWU_UPDATE 

sw update

OC_KNX_SWU_PKGV 

sw package version

OC_KNX_SWU_PKGCMD 

sw package command

OC_KNX_SWU_PKGBYTES 

sw package bytes

OC_KNX_SWU_PKGQURL 

sw query url

OC_KNX_SWU_PKGNAMES 

sw package names

OC_KNX_SWU 

swu top level

OC_KNX_SUB 

delete all device subscriptions

OC_KNX_A_SEN 

a/sen resource

OC_KNX_AUTH_O_REPLWDO 

oscore replay window

OC_KNX_AUTH_O_OSNDELAY 

oscore osn delay

OC_KNX_AUTH_O 

auth/o oscore functional block properties list

OC_KNX_AUTH_AT 

auth/at resource listing auth/at/X

OC_KNX_AUTH_AT_X 

auth/at/X resources

OC_KNX_AUTH 

auth list all sub resources

WELLKNOWNCORE 

well-known/core resource

Definition at line 330 of file oc_ri.h.

330  {
331  OC_DEV_SN = 0,
332  OC_DEV_HWV,
333  OC_DEV_FWV,
334  OC_DEV_HWT,
336  OC_DEV_MODEL,
338  OC_DEV_IID,
339  OC_DEV_PM,
340  OC_DEV_IPV6,
341  OC_DEV_SA,
342  OC_DEV_DA,
343  OC_DEV_FID,
344  OC_DEV_PORT,
345  OC_DEV_MPORT,
346  OC_DEV_MID,
347  OC_DEV,
348  OC_APP,
349  OC_APP_X,
350  OC_A_LSM,
351  OC_KNX_SPAKE,
352  OC_KNX_IDEVID,
353  OC_KNX_LDEVID,
354  OC_KNX_K,
356  OC_KNX_IA,
357  OC_KNX_OSN,
358  OC_KNX,
359  OC_KNX_FP_G,
360  OC_KNX_FP_G_X,
361 #ifdef OC_PUBLISHER_TABLE
362  OC_KNX_FP_P,
363  OC_KNX_FP_P_X,
364 #endif
365  OC_KNX_FP_R,
366  OC_KNX_FP_R_X,
367  OC_KNX_P,
368  OC_KNX_F,
369  OC_KNX_F_X,
382 #if 0 // THIS SHOULD BE IMPLEMENTED IF INCLUDED
383  OC_KNX_SWU_PKG,
384 #endif
385  OC_KNX_SWU,
386  OC_KNX_SUB,
387  OC_KNX_A_SEN,
390  OC_KNX_AUTH_O,
393  OC_KNX_AUTH,
394 #ifdef OC_IOT_ROUTER
395  OC_KNX_FP_GM,
396  OC_KNX_FP_GM_X,
397 #endif
398  /* List of resources on a logical device: start */
400  /* List of resources on a logical device: end */
oc_core_resource_t
core resource numbers
Definition: oc_ri.h:330
@ OC_KNX_F
/f
Definition: oc_ri.h:368
@ OC_A_LSM
load state machine
Definition: oc_ri.h:350
@ OC_DEV_IID
KNX installation ID.
Definition: oc_ri.h:338
@ OC_KNX_SWU_PKGV
sw package version
Definition: oc_ri.h:377
@ OC_DEV_HOSTNAME
Device host name for DNS resolution.
Definition: oc_ri.h:337
@ OC_KNX_A_SEN
a/sen resource
Definition: oc_ri.h:387
@ OC_KNX_SWU_PROTOCOL
software update protocol
Definition: oc_ri.h:370
@ OC_KNX_AUTH_O_OSNDELAY
oscore osn delay
Definition: oc_ri.h:389
@ OC_KNX_SWU_MAXDEFER
swu max defer
Definition: oc_ri.h:371
@ OC_DEV_FWV
Firmware version.
Definition: oc_ri.h:333
@ OC_KNX
.well-known / knx
Definition: oc_ri.h:358
@ OC_KNX_SWU
swu top level
Definition: oc_ri.h:385
@ OC_DEV_IPV6
IPV6.
Definition: oc_ri.h:340
@ OC_KNX_K
k (renamed) .knx resource
Definition: oc_ri.h:354
@ OC_KNX_FP_R_X
FP/R/X.
Definition: oc_ri.h:366
@ OC_KNX_SWU_PKGBYTES
sw package bytes
Definition: oc_ri.h:379
@ OC_KNX_SUB
delete all device subscriptions
Definition: oc_ri.h:386
@ OC_KNX_F_X
/f/X
Definition: oc_ri.h:369
@ OC_KNX_SWU_PKGCMD
sw package command
Definition: oc_ri.h:378
@ OC_KNX_FP_G_X
FP/G/X.
Definition: oc_ri.h:360
@ OC_KNX_LASTUPDATE
sw last update
Definition: oc_ri.h:373
@ OC_KNX_SWU_RESULT
sw result
Definition: oc_ri.h:374
@ OC_DEV_HWV
Hardware version.
Definition: oc_ri.h:332
@ OC_DEV_SA
/dev/sa subnet address
Definition: oc_ri.h:341
@ OC_KNX_SWU_METHOD
sw method
Definition: oc_ri.h:372
@ OC_DEV
core link
Definition: oc_ri.h:347
@ OC_APP_X
application ID entry
Definition: oc_ri.h:349
@ OC_KNX_IDEVID
IDevID.
Definition: oc_ri.h:352
@ OC_DEV_SN
Device serial number.
Definition: oc_ri.h:331
@ OC_DEV_DA
/dev/da device address
Definition: oc_ri.h:342
@ OC_DEV_HWT
The hardware type is a manufacture specific id for a device type (MaC uses this id for compatibility ...
Definition: oc_ri.h:334
@ OC_DEV_PORT
/dev/port the coap port number
Definition: oc_ri.h:344
@ OC_DEV_FID
/dev/fid the fabric ID
Definition: oc_ri.h:343
@ OC_KNX_AUTH_O
auth/o oscore functional block properties list
Definition: oc_ri.h:390
@ OC_APP
application ID (list)
Definition: oc_ri.h:348
@ OC_DEV_MODEL
Device model.
Definition: oc_ri.h:336
@ OC_KNX_IA
.well-known / knx / ia
Definition: oc_ri.h:356
@ OC_DEV_MID
/dev/mid the manufacturer ID
Definition: oc_ri.h:346
@ OC_KNX_SWU_STATE
sw state
Definition: oc_ri.h:375
@ OC_DEV_MPORT
/dev/mport the multicast port number
Definition: oc_ri.h:345
@ OC_KNX_SWU_PKGNAMES
sw package names
Definition: oc_ri.h:381
@ OC_KNX_AUTH_O_REPLWDO
oscore replay window
Definition: oc_ri.h:388
@ OC_KNX_FP_R
FP/R.
Definition: oc_ri.h:365
@ OC_KNX_SWU_PKGQURL
sw query url
Definition: oc_ri.h:380
@ OC_KNX_P
P.
Definition: oc_ri.h:367
@ OC_KNX_FP_G
FP/G.
Definition: oc_ri.h:359
@ OC_KNX_LDEVID
LDevID.
Definition: oc_ri.h:353
@ OC_KNX_AUTH
auth list all sub resources
Definition: oc_ri.h:393
@ OC_KNX_SWU_UPDATE
sw update
Definition: oc_ri.h:376
@ OC_DEV_PM
Programming Mode.
Definition: oc_ri.h:339
@ OC_KNX_OSN
.well-known / knx / osn
Definition: oc_ri.h:357
@ OC_KNX_AUTH_AT
auth/at resource listing auth/at/X
Definition: oc_ri.h:391
@ OC_KNX_AUTH_AT_X
auth/at/X resources
Definition: oc_ri.h:392
@ WELLKNOWNCORE
well-known/core resource
Definition: oc_ri.h:399
@ OC_KNX_SPAKE
spake
Definition: oc_ri.h:351
@ OC_KNX_FINGERPRINT
FINGERPRINT value of loaded contents.
Definition: oc_ri.h:355

◆ oc_event_callback_retval_t

callback return values

Enumerator
OC_EVENT_DONE 

callback done, e.g.

don't call again

OC_EVENT_CONTINUE 

callbacks continue

Definition at line 517 of file oc_ri.h.

517  {
518  OC_EVENT_DONE = 0,
oc_event_callback_retval_t
callback return values
Definition: oc_ri.h:517
@ OC_EVENT_DONE
callback done, e.g.
Definition: oc_ri.h:518
@ OC_EVENT_CONTINUE
callbacks continue
Definition: oc_ri.h:519

◆ oc_interface_mask_t

interface masks security access scopes defined as interfaces note that scope = 1 is not used.

Enumerator
OC_IF_NONE 

no interface defined

OC_IF_I 

if.i (2)

OC_IF_O 

if.o (4)

OC_IF_G 

if.g.s.

[ga] (8)

OC_IF_C 

if.c (16)

OC_IF_P 

if.p (32)

OC_IF_D 

if.d (64)

OC_IF_A 

if.a (128)

OC_IF_S 

if.s (256)

OC_IF_LI 

if.ll (512)

OC_IF_B 

if.b (1024)

OC_IF_SEC 

if.sec (2048)

OC_IF_SWU 

if.swu (4096)

OC_IF_PM 

if.pm (8192)

OC_IF_M 

if.m (manufacturer) (16384)

Definition at line 261 of file oc_ri.h.

261  {
262  OC_IF_NONE = 0,
263  OC_IF_I = (1 << 1),
264  OC_IF_O = (1 << 2),
265  OC_IF_G = (1 << 3),
266  OC_IF_C = (1 << 4),
267  OC_IF_P = (1 << 5),
268  OC_IF_D = (1 << 6),
269  OC_IF_A = (1 << 7),
270  OC_IF_S = (1 << 8),
271  OC_IF_LI = (1 << 9),
272  OC_IF_B = (1 << 10),
273  OC_IF_SEC = (1 << 11),
274  OC_IF_SWU = (1 << 12),
275  OC_IF_PM = (1 << 13),
276  OC_IF_M = (1 << 14)
oc_interface_mask_t
interface masks security access scopes defined as interfaces note that scope = 1 is not used.
Definition: oc_ri.h:261
@ OC_IF_M
if.m (manufacturer) (16384)
Definition: oc_ri.h:276
@ OC_IF_PM
if.pm (8192)
Definition: oc_ri.h:275
@ OC_IF_SWU
if.swu (4096)
Definition: oc_ri.h:274
@ OC_IF_P
if.p (32)
Definition: oc_ri.h:267
@ OC_IF_S
if.s (256)
Definition: oc_ri.h:270
@ OC_IF_B
if.b (1024)
Definition: oc_ri.h:272
@ OC_IF_NONE
no interface defined
Definition: oc_ri.h:262
@ OC_IF_A
if.a (128)
Definition: oc_ri.h:269
@ OC_IF_G
if.g.s.
Definition: oc_ri.h:265
@ OC_IF_O
if.o (4)
Definition: oc_ri.h:264
@ OC_IF_D
if.d (64)
Definition: oc_ri.h:268
@ OC_IF_I
if.i (2)
Definition: oc_ri.h:263
@ OC_IF_C
if.c (16)
Definition: oc_ri.h:266
@ OC_IF_LI
if.ll (512)
Definition: oc_ri.h:271
@ OC_IF_SEC
if.sec (2048)
Definition: oc_ri.h:273

◆ oc_method_t

CoAP methods.

Enumerator
OC_GET 

GET.

OC_POST 

POST.

OC_PUT 

PUT.

OC_DELETE 

DELETE.

OC_FETCH 

FETCH.

Definition at line 124 of file oc_ri.h.

124  {
125  OC_GET = 1,
126  OC_POST,
127  OC_PUT,
128  OC_DELETE,
129  OC_FETCH
130 } oc_method_t;
oc_method_t
CoAP methods.
Definition: oc_ri.h:124
@ OC_POST
POST.
Definition: oc_ri.h:126
@ OC_DELETE
DELETE.
Definition: oc_ri.h:128
@ OC_PUT
PUT.
Definition: oc_ri.h:127
@ OC_GET
GET.
Definition: oc_ri.h:125
@ OC_FETCH
FETCH.
Definition: oc_ri.h:129

◆ oc_resource_properties_t

resource properties (bit mask)

Enumerator
OC_UNDISCOVERABLE 

parameter

OC_DISCOVERABLE 

datapoint

OC_OBSERVABLE 

observable

OC_SECURE 

secure

OC_PERIODIC 

periodical update

OC_SECURE_MCAST 

secure multi cast (OSCORE)

Definition at line 136 of file oc_ri.h.

136  {
137  OC_UNDISCOVERABLE = 0,
138  OC_DISCOVERABLE = (1 << 0),
139  OC_OBSERVABLE = (1 << 1),
140  OC_SECURE = (1 << 4),
141  OC_PERIODIC = (1 << 6),
142  OC_SECURE_MCAST = (1 << 8)
oc_resource_properties_t
resource properties (bit mask)
Definition: oc_ri.h:136
@ OC_SECURE_MCAST
secure multi cast (OSCORE)
Definition: oc_ri.h:142
@ OC_UNDISCOVERABLE
parameter
Definition: oc_ri.h:137
@ OC_OBSERVABLE
observable
Definition: oc_ri.h:139
@ OC_DISCOVERABLE
datapoint
Definition: oc_ri.h:138
@ OC_PERIODIC
periodical update
Definition: oc_ri.h:141
@ OC_SECURE
secure
Definition: oc_ri.h:140

◆ oc_status_t

CoAP status codes.

Note: can be translated to HTTP or CoAP.

See also
oc_status_code for translation to to the CoAP status codes
Enumerator
OC_STATUS_OK 

OK 2.00.

OC_STATUS_CREATED 

Created 2.01.

OC_STATUS_CHANGED 

Changed 2.04.

OC_STATUS_DELETED 

Deleted 2.02.

OC_STATUS_NOT_MODIFIED 

Not Modified (VALID 2.03)

OC_STATUS_BAD_REQUEST 

Bad Request 4.00.

OC_STATUS_UNAUTHORIZED 

Unauthorized 4.01.

OC_STATUS_BAD_OPTION 

Bad Option 4.02.

OC_STATUS_FORBIDDEN 

Forbidden 4.03.

OC_STATUS_NOT_FOUND 

Not Found 4.04.

OC_STATUS_METHOD_NOT_ALLOWED 

Method Not Allowed 4.05.

OC_STATUS_NOT_ACCEPTABLE 

Not Acceptable 4.06.

OC_STATUS_REQUEST_ENTITY_TOO_LARGE 

Request Entity Too Large 4.13.

OC_STATUS_UNSUPPORTED_MEDIA_TYPE 

Unsupported Media Type 4.15.

OC_STATUS_INTERNAL_SERVER_ERROR 

Internal Server Error 5.00.

OC_STATUS_NOT_IMPLEMENTED 

Not Implemented 5.01.

OC_STATUS_BAD_GATEWAY 

Bad Gateway 5.02.

OC_STATUS_SERVICE_UNAVAILABLE 

Service Unavailable 5.03.

OC_STATUS_GATEWAY_TIMEOUT 

Gateway Timeout 5.04.

OC_STATUS_PROXYING_NOT_SUPPORTED 

Proxying not supported 5.05.

OC_IGNORE 

Ignore: do not respond to request.

OC_PING_TIMEOUT 

Ping Time out.

Definition at line 152 of file oc_ri.h.

152  {
153  OC_STATUS_OK = 0,
173  __NUM_OC_STATUS_CODES__,
174  OC_IGNORE,
176 } oc_status_t;
oc_status_t
CoAP status codes.
Definition: oc_ri.h:152
@ OC_STATUS_NOT_IMPLEMENTED
Not Implemented 5.01.
Definition: oc_ri.h:168
@ OC_STATUS_REQUEST_ENTITY_TOO_LARGE
Request Entity Too Large 4.13.
Definition: oc_ri.h:165
@ OC_STATUS_BAD_REQUEST
Bad Request 4.00.
Definition: oc_ri.h:158
@ OC_IGNORE
Ignore: do not respond to request.
Definition: oc_ri.h:174
@ OC_STATUS_OK
OK 2.00.
Definition: oc_ri.h:153
@ OC_STATUS_INTERNAL_SERVER_ERROR
Internal Server Error 5.00.
Definition: oc_ri.h:167
@ OC_STATUS_NOT_FOUND
Not Found 4.04.
Definition: oc_ri.h:162
@ OC_STATUS_GATEWAY_TIMEOUT
Gateway Timeout 5.04.
Definition: oc_ri.h:171
@ OC_STATUS_NOT_ACCEPTABLE
Not Acceptable 4.06.
Definition: oc_ri.h:164
@ OC_STATUS_DELETED
Deleted 2.02.
Definition: oc_ri.h:156
@ OC_STATUS_CREATED
Created 2.01.
Definition: oc_ri.h:154
@ OC_STATUS_METHOD_NOT_ALLOWED
Method Not Allowed 4.05.
Definition: oc_ri.h:163
@ OC_STATUS_PROXYING_NOT_SUPPORTED
Proxying not supported 5.05.
Definition: oc_ri.h:172
@ OC_STATUS_NOT_MODIFIED
Not Modified (VALID 2.03)
Definition: oc_ri.h:157
@ OC_STATUS_CHANGED
Changed 2.04.
Definition: oc_ri.h:155
@ OC_STATUS_BAD_OPTION
Bad Option 4.02.
Definition: oc_ri.h:160
@ OC_STATUS_UNAUTHORIZED
Unauthorized 4.01.
Definition: oc_ri.h:159
@ OC_STATUS_UNSUPPORTED_MEDIA_TYPE
Unsupported Media Type 4.15.
Definition: oc_ri.h:166
@ OC_PING_TIMEOUT
Ping Time out.
Definition: oc_ri.h:175
@ OC_STATUS_BAD_GATEWAY
Bad Gateway 5.02.
Definition: oc_ri.h:169
@ OC_STATUS_SERVICE_UNAVAILABLE
Service Unavailable 5.03.
Definition: oc_ri.h:170
@ OC_STATUS_FORBIDDEN
Forbidden 4.03.
Definition: oc_ri.h:161

Function Documentation

◆ get_interface_string()

const char* get_interface_string ( oc_interface_mask_t  mask)

Get the interface string object Note: should be called with a single interface as mask only.

Parameters
maskthe interface mask (access scope)
Returns
const char* the interface as string e.g. "if.i"

◆ get_method_name()

const char* get_method_name ( oc_method_t  method)

Get the method name object.

Parameters
methodthe input method
Returns
const char* the method as string e.g. "GET"

◆ oc_check_accept_header()

bool oc_check_accept_header ( oc_request_t request,
oc_content_format_t  accept 
)

checks if the accept header is correct note that if the accept header is not there, this check is a pass

Parameters
requestthe request
acceptthe content type of the resource
Returns
true content type is ok
false content type is not ok

◆ oc_get_interface_in_mask_in_string_array()

int oc_get_interface_in_mask_in_string_array ( oc_interface_mask_t  iface_mask,
int  nr_entries,
oc_string_array_t  interface_array 
)

sets all interfaces in the mask in the string array

Parameters
iface_maskthe interface mask
nr_entriesexpected number of entries in the array
interface_arraythe string array to place the individual interface names in
Returns
int the amount of interfaces filled in the interface_arry

◆ oc_print_interface()

void oc_print_interface ( oc_interface_mask_t  iface_mask)

prints all interfaces in the mask to stdout

Parameters
iface_maskthe interface mask names in

◆ 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_resource_block()

bool oc_ri_add_resource_block ( const oc_resource_t resource)

add resource block to the system

Parameters
resourcethe resource block 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
tickstime in ticks

◆ oc_ri_alloc_resource()

oc_resource_t* oc_ri_alloc_resource ( void  )

allocate a resource structure

Returns
oc_resource_t*

◆ oc_ri_alloc_resource_data()

oc_resource_data_t* oc_ri_alloc_resource_data ( void  )

allocate a resource structure

Returns
oc_resource_t*

◆ oc_ri_delete_resource()

bool oc_ri_delete_resource ( const 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_delete_resource_block()

bool oc_ri_delete_resource_block ( const oc_resource_t resource)

remove the resource block from the list of application resources

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

◆ oc_ri_free_resource_properties()

void oc_ri_free_resource_properties ( oc_resource_t resource)

free the properties of the resource

Parameters
resourcethe resource

◆ oc_ri_get_app_resource_by_uri()

const 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()

const 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 ( char *  iface,
size_t  if_len 
)

retrieve the interface mask from the interface name

Parameters
ifacethe interface (e.g. "if=if.s")
if_lenthe interface length
Returns
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,
char **  key,
size_t *  key_len,
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
keythe key
key_lenthe length of the key
valuethe value belonging to the key
value_lenthe length of the value
nthe position to query
Returns
int the position of the next key value pair in the query or NULL

◆ oc_ri_get_query_value()

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

retrieve the value of the query parameter "key"

Parameters
querythe input query
query_lenthe query length
keythe wanted key
valuethe returned value
Returns
int the length of the value

◆ oc_ri_init()

void oc_ri_init ( void  )

initialize the resource implementation handler

◆ 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
resourceThe resource to be tested
Returns
true valid
false not valid

◆ oc_ri_new_request_from_request()

bool oc_ri_new_request_from_request ( oc_request_t new_request,
oc_request_t request,
oc_response_buffer_t response_buffer,
oc_response_t response_obj 
)

create a new request from the old request is used internally only for redirection of:

  • k
  • p
Parameters
new_requestthe original request
requestthe new request
response_bufferthe dummy response buffer for the new request
response_objthe dummy response object
Returns
true new request valid
false new request invalid

◆ 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

Parameters
[in]querythe query to inspect
[in]query_lenthe length of the query
[in]keythe key to be checked if exist, key is null terminated
Returns
int -1 = not exist

◆ oc_ri_query_nth_key_exists()

int oc_ri_query_nth_key_exists ( const char *  query,
size_t  query_len,
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
key_lenthe key length
n
Returns
int

◆ oc_ri_remove_timed_event_callback()

void oc_ri_remove_timed_event_callback ( void *  cb_data,
oc_trigger_t  event_callback 
)

remove the timed event callback

Parameters
cb_datathe timed event callback info
event_callbackthe callback

◆ oc_ri_resource_next()

const oc_resource_t* oc_ri_resource_next ( const oc_resource_t resource)

get the next resource

Parameters
resourcecurrent resource
Returns
next resource or NULL if at end skips over dummy resources

◆ oc_ri_shutdown()

void oc_ri_shutdown ( void  )

shut down the resource implementation handler

◆ oc_status_code()

int oc_status_code ( oc_status_t  key)

convert the (internal) status code to coap status as integer

Parameters
keythe application level key of the code
Returns
int the CoAP status code

Referenced by get_o_1_1().

◆ oc_total_interface_in_mask()

int oc_total_interface_in_mask ( oc_interface_mask_t  iface_mask)

total interfaces in the interface mask Note calculates the if.g.s.a only 1

Parameters
iface_maskthe interface mask
Returns
int the amount of interfaces in the mask