KNX IoT
KNX IoT Point API stack implementation
oc_ri.h
Go to the documentation of this file.
1 /*
2 // Copyright (c) 2016-2019 Intel Corporation
3 // Copyright (c) 2021 Cascoda Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 */
21 #ifndef OC_RI_H
22 #define OC_RI_H
23 
24 #include "oc_config.h"
25 #include "oc_endpoint.h"
26 #include "oc_rep.h"
27 #include "oc_uuid.h"
28 #include "util/oc_etimer.h"
29 #if defined _MSC_VER && !defined __INTEL_COMPILER
30 #define oc_ri_internal_expand(...) __VA_ARGS__
31 #define oc_ri_internal_expand_call(fn, ...) \
32  oc_ri_internal_expand_call2(fn, (__VA_ARGS__))
33 #define oc_ri_internal_expand_call2(fn, args) fn args
34 #endif
35 
36 #if defined _MSC_VER && !defined __INTEL_COMPILER
37 #define oc_ri_create_const_resource_internal( \
38  next_resource, resource_name, device_index, name, uri, dpt, iface_mask, \
39  content_format, properties, get_cb, put_cb, post_cb, delete_cb, ctx, \
40  observe_period, instance, ...) \
41  oc_resource_data_t resource_name##_data; \
42  const oc_resource_t resource_name = { \
43  /*next*/ (oc_resource_t *)&next_resource, \
44  /*device*/ device_index, \
45  /*name*/ oc_string_create_const(name), \
46  /*uri*/ oc_string_create_const(uri), /*types*/ \
47  oc_ri_internal_expand_call(oc_string_array_create_const, __VA_ARGS__), \
48  /*dpt*/ oc_string_create_const(dpt), \
49  /*interfaces*/ iface_mask, \
50  /*content_type*/ content_format, \
51  /*properties*/ properties, \
52  /*get_handler*/ { get_cb, ctx }, \
53  /*put_handler*/ { put_cb, ctx }, \
54  /*post_handler*/ { post_cb, ctx }, \
55  /*delete_handler*/ { delete_cb, ctx }, \
56  /*get_properties*/ { NULL, NULL }, \
57  /*set_properties*/ { NULL, NULL }, \
58  /*observe_period_seconds*/ observe_period, \
59  /*fb_instance*/ instance, \
60  /*is_const*/ true, \
61  /*runtime_data*/ &resource_name##_data, \
62  };
63 #else
64 #define oc_ri_create_const_resource_internal( \
65  next_resource, resource_name, device_index, name, uri, dpt, iface_mask, \
66  content_format, properties, get_cb, put_cb, post_cb, delete_cb, ctx, \
67  observe_period, instance, ...) \
68  oc_resource_data_t resource_name##_data; \
69  const oc_resource_t resource_name = { \
70  /*next*/ (oc_resource_t *)&next_resource, \
71  /*device*/ device_index, \
72  /*name*/ oc_string_create_const(name), \
73  /*uri*/ oc_string_create_const(uri), /*types*/ \
74  oc_string_array_create_const(__VA_ARGS__), \
75  /*dpt*/ oc_string_create_const(dpt), \
76  /*interfaces*/ iface_mask, \
77  /*content_type*/ content_format, \
78  /*properties*/ properties, \
79  /*get_handler*/ { get_cb, ctx }, \
80  /*put_handler*/ { put_cb, ctx }, \
81  /*post_handler*/ { post_cb, ctx }, \
82  /*delete_handler*/ { delete_cb, ctx }, \
83  /*get_properties*/ { NULL, NULL }, \
84  /*set_properties*/ { NULL, NULL }, \
85  /*observe_period_seconds*/ observe_period, \
86  /*fb_instance*/ instance, \
87  /*is_const*/ true, \
88  /*runtime_data*/ &resource_name##_data, \
89  };
90 #endif
91 
92 #if defined _MSC_VER && !defined __INTEL_COMPILER
93 #define oc_ri_create_const_resource_linked(next_resource, ...) \
94  extern const oc_resource_t next_resource; \
95  oc_ri_internal_expand_call(oc_ri_create_const_resource_internal, \
96  next_resource, __VA_ARGS__)
97 #else
98 #define oc_ri_create_const_resource_linked(next_resource, ...) \
99  extern const oc_resource_t next_resource; \
100  oc_ri_create_const_resource_internal(next_resource, __VA_ARGS__)
101 #endif
102 
103 #if defined _MSC_VER && !defined __INTEL_COMPILER
104 #define oc_ri_create_const_resource_final(resource_name, ...) \
105  oc_resource_dummy_t resource_block_end##resource_name = { NULL, -1 }; \
106  oc_ri_internal_expand_call(oc_ri_create_const_resource_internal, \
107  resource_block_end##resource_name, resource_name, \
108  __VA_ARGS__)
109 #else
110 #define oc_ri_create_const_resource_final(resource_name, ...) \
111  oc_resource_dummy_t resource_block_end##resource_name = { NULL, -1 }; \
112  \
113  oc_ri_create_const_resource_internal(resource_block_end##resource_name, \
114  resource_name, __VA_ARGS__)
115 #endif
116 #ifdef __cplusplus
117 extern "C" {
118 #endif
119 
124 typedef enum {
125  OC_GET = 1,
129  OC_FETCH
131 
136 typedef enum {
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)
144 
152 typedef enum {
173  __NUM_OC_STATUS_CODES__,
177 
184 typedef enum {
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,
215  280,
216  APPLICATION_PKCS7_CO =
217  281,
219  282,
221  283,
231  CONTENT_NONE = 99999
233 
238 typedef struct oc_separate_response_s oc_separate_response_t;
239 
244 typedef struct oc_response_buffer_s oc_response_buffer_t;
245 
250 typedef struct oc_response_t
251 {
255 
261 typedef enum {
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)
278 
279 #define OC_MAX_IF_MASKS 14
280 
288 
295 const char *get_method_name(oc_method_t method);
296 
304 
315  int nr_entries,
316  oc_string_array_t interface_array);
317 
325 
330 typedef enum {
331  OC_DEV_SN = 0,
334  OC_DEV_HWT,
361 #ifdef OC_PUBLISHER_TABLE
362  OC_KNX_FP_P,
363  OC_KNX_FP_P_X,
364 #endif
382 #if 0 // THIS SHOULD BE IMPLEMENTED IF INCLUDED
383  OC_KNX_SWU_PKG,
384 #endif
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 */
402 
403 #define OC_NUM_CORE_RESOURCES_PER_DEVICE (1 + WELLKNOWNCORE)
404 
405 typedef struct oc_resource_s oc_resource_t;
406 
411 typedef struct oc_request_t
412 {
415  const char *query;
416  size_t query_len;
417  const char *uri_path;
418  size_t uri_path_len;
420  const uint8_t *_payload;
421  size_t _payload_len;
428 
434  void *);
435 
440 typedef struct oc_request_handler_s
441 {
443  void *user_data;
445 
450 typedef bool (*oc_set_properties_cb_t)(oc_resource_t *, oc_rep_t *, void *);
451 
457  void *);
458 
463 typedef struct oc_properties_cb_t
464 {
465  union {
466  oc_set_properties_cb_t set_props;
467  oc_get_properties_cb_t get_props;
468  } cb;
469  void *user_data;
471 
472 typedef struct oc_resource_data_t
473 {
474  uint8_t num_observers;
475 } oc_resource_data_t;
476 
482 {
483  struct oc_resource_s *next;
484  size_t device;
485  oc_string_t name;
486  oc_string_t uri;
487  oc_string_array_t types;
488  oc_string_t dpt;
500  uint8_t fb_instance;
501  const bool is_const;
502  oc_resource_data_t *runtime_data;
503 };
504 
505 typedef struct oc_resource_dummy_s
506 {
507  struct oc_resource_s *next;
508  size_t device;
509 } oc_resource_dummy_t;
510 
511 typedef struct oc_link_s oc_link_t;
512 
517 typedef enum {
521 
522 typedef oc_event_callback_retval_t (*oc_trigger_t)(void *);
523 
528 typedef struct oc_event_callback_s
529 {
531  struct oc_etimer timer;
532  oc_trigger_t callback;
533  void *data;
535 
540 void oc_ri_init(void);
541 
546 void oc_ri_shutdown(void);
547 
556  oc_trigger_t event_callback,
557  oc_clock_time_t ticks);
558 
566 #define oc_ri_add_timed_event_callback_seconds(cb_data, event_callback, \
567  seconds) \
568  do { \
569  oc_ri_add_timed_event_callback_ticks(cb_data, event_callback, \
570  (oc_clock_time_t)(seconds) * \
571  (oc_clock_time_t)OC_CLOCK_SECOND); \
572  } while (0)
573 
581  oc_trigger_t event_callback);
582 
590 
600 
610  size_t uri_len,
611  size_t device);
612 
619 
620 #ifdef OC_SERVER
632 oc_resource_data_t *oc_ri_alloc_resource_data(void);
650 
659 bool oc_ri_delete_resource(const oc_resource_t *resource);
669 #endif /* OC_SERVER */
670 
677 
686 
699 int oc_ri_get_query_nth_key_value(const char *query, size_t query_len,
700  char **key, size_t *key_len, char **value,
701  size_t *value_len, size_t n);
702 
712 int oc_ri_get_query_value(const char *query, size_t query_len, const char *key,
713  char **value);
714 
723 int oc_ri_query_exists(const char *query, size_t query_len, const char *key);
724 
735 int oc_ri_query_nth_key_exists(const char *query, size_t query_len, char **key,
736  size_t *key_len, size_t n);
737 
745 oc_interface_mask_t oc_ri_get_interface_mask(char *iface, size_t if_len);
746 
755 
770  oc_request_t *request,
771  oc_response_buffer_t *response_buffer,
772  oc_response_t *response_obj);
773 
774 #ifdef __cplusplus
775 }
776 #endif
777 
778 #endif /* OC_RI_H */
end point implementation, e.g.
request and response payload handling in cbor
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
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
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
const oc_resource_t * oc_ri_get_app_resources(void)
retrieve list of resources
bool oc_ri_delete_resource(const oc_resource_t *resource)
remove the resource from the list of application resources
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,...
int oc_ri_query_exists(const char *query, size_t query_len, const char *key)
checks if key exist in query
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.
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
struct oc_response_buffer_s oc_response_buffer_t
response buffer type
Definition: oc_ri.h:244
bool oc_ri_add_resource(oc_resource_t *resource)
add resource to the system
void oc_ri_free_resource_properties(oc_resource_t *resource)
free the properties of the resource
const char * get_method_name(oc_method_t method)
Get the method name object.
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_data_t * oc_ri_alloc_resource_data(void)
allocate a resource structure
struct oc_request_handler_s oc_request_handler_t
request handler type
void oc_ri_remove_timed_event_callback(void *cb_data, oc_trigger_t event_callback)
remove the timed event callback
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
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:
oc_interface_mask_t oc_ri_get_interface_mask(char *iface, size_t if_len)
retrieve the interface mask from the interface name
oc_resource_t * oc_ri_alloc_resource(void)
allocate a resource structure
const oc_resource_t * oc_ri_resource_next(const oc_resource_t *resource)
get the next resource
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"
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
void oc_ri_init(void)
initialize the resource implementation handler
struct oc_event_callback_s oc_event_callback_t
event callback
int oc_status_code(oc_status_t key)
convert the (internal) status code to coap status as integer
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_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
struct oc_separate_response_s oc_separate_response_t
separate response type
Definition: oc_ri.h:238
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
bool oc_ri_add_resource_block(const oc_resource_t *resource)
add resource block to the system
struct oc_request_t oc_request_t
request information structure
void oc_print_interface(oc_interface_mask_t iface_mask)
prints all interfaces in the mask to stdout
bool oc_ri_delete_resource_block(const oc_resource_t *resource)
remove the resource block from the list of application resources
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
struct oc_properties_cb_t oc_properties_cb_t
properties callback structure
void(* oc_request_callback_t)(oc_request_t *, oc_interface_mask_t, void *)
request callback
Definition: oc_ri.h:433
void(* oc_get_properties_cb_t)(oc_resource_t *, oc_interface_mask_t, void *)
get properties callback
Definition: oc_ri.h:456
bool(* oc_set_properties_cb_t)(oc_resource_t *, oc_rep_t *, void *)
set properties callback
Definition: oc_ri.h:450
bool oc_ri_is_app_resource_valid(const oc_resource_t *resource)
checks if the resource is valid
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
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
struct oc_response_t oc_response_t
response type
void oc_ri_shutdown(void)
shut down the resource implementation handler
uuid implementationGenerate and work with UUIDs as specified in RFC 4122.
the endpoint information
Definition: oc_endpoint.h:78
event callback
Definition: oc_ri.h:529
struct oc_event_callback_s * next
next callback
Definition: oc_ri.h:530
void * data
data for the callback
Definition: oc_ri.h:533
oc_trigger_t callback
callback to be invoked
Definition: oc_ri.h:532
struct oc_etimer timer
timer
Definition: oc_ri.h:531
properties callback structure
Definition: oc_ri.h:464
parsed entry of a cbor object This represents a link list of response values one can iterate over the...
Definition: oc_rep.h:1642
request handler type
Definition: oc_ri.h:441
request information structure
Definition: oc_ri.h:412
size_t uri_path_len
path length
Definition: oc_ri.h:418
size_t query_len
query length
Definition: oc_ri.h:416
oc_endpoint_t * origin
origin of the request
Definition: oc_ri.h:413
oc_response_t * response
pointer to the response
Definition: oc_ri.h:426
oc_content_format_t content_format
content format (of the payload in the request)
Definition: oc_ri.h:423
const char * uri_path
path (as string)
Definition: oc_ri.h:417
oc_content_format_t accept
accept header, e.g the format to be returned on the request
Definition: oc_ri.h:425
const uint8_t * _payload
payload of the request
Definition: oc_ri.h:420
const char * query
query (as string)
Definition: oc_ri.h:415
size_t _payload_len
payload size
Definition: oc_ri.h:421
oc_rep_t * request_payload
request payload structure
Definition: oc_ri.h:419
const oc_resource_t * resource
resource structure
Definition: oc_ri.h:414
resource structure
Definition: oc_ri.h:482
struct oc_resource_s * next
next resource
Definition: oc_ri.h:483
oc_string_t name
name of the resource (e.g.
Definition: oc_ri.h:485
oc_content_format_t content_type
the content format that the resource supports, e.g.
Definition: oc_ri.h:490
oc_request_handler_t post_handler
callback for POST
Definition: oc_ri.h:495
const bool is_const
Whether the associated resource data is readonly.
Definition: oc_ri.h:501
uint8_t fb_instance
function block instance, default = 0
Definition: oc_ri.h:500
oc_interface_mask_t interfaces
supported interfaces
Definition: oc_ri.h:489
oc_resource_properties_t properties
properties (as bit mask)
Definition: oc_ri.h:492
oc_properties_cb_t set_properties
callback for set properties
Definition: oc_ri.h:498
oc_request_handler_t delete_handler
callback for DELETE
Definition: oc_ri.h:496
oc_request_handler_t get_handler
callback for GET
Definition: oc_ri.h:493
size_t device
device index
Definition: oc_ri.h:484
oc_properties_cb_t get_properties
callback for get properties
Definition: oc_ri.h:497
oc_string_t dpt
dpt of the resource
Definition: oc_ri.h:488
uint16_t observe_period_seconds
observe period in seconds
Definition: oc_ri.h:499
oc_string_t uri
uri of the resource
Definition: oc_ri.h:486
oc_string_array_t types
"rt" types of the resource
Definition: oc_ri.h:487
oc_request_handler_t put_handler
callback for PUT
Definition: oc_ri.h:494
oc_resource_data_t * runtime_data
Runtime modifiable data.
Definition: oc_ri.h:502
response type
Definition: oc_ri.h:251
oc_separate_response_t * separate_response
separate response
Definition: oc_ri.h:252
oc_response_buffer_t * response_buffer
response buffer
Definition: oc_ri.h:253