anjay
Loading...
Searching...
No Matches
io.h
Go to the documentation of this file.
1/*
2 * Copyright 2017-2024 AVSystem <avsystem@avsystem.com>
3 * AVSystem Anjay LwM2M SDK
4 * All rights reserved.
5 *
6 * Licensed under the AVSystem-5-clause License.
7 * See the attached LICENSE file for details.
8 */
9
10#ifndef ANJAY_INCLUDE_ANJAY_IO_H
11#define ANJAY_INCLUDE_ANJAY_IO_H
12
13#include <anjay/core.h>
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
22typedef struct anjay_dm_list_ctx_struct anjay_dm_list_ctx_t;
23
35void anjay_dm_emit(anjay_dm_list_ctx_t *ctx, uint16_t id);
36
40typedef struct anjay_dm_resource_list_ctx_struct anjay_dm_resource_list_ctx_t;
41
88
104
118 anjay_rid_t rid,
121
123typedef struct anjay_output_ctx_struct anjay_output_ctx_t;
124
128typedef struct anjay_ret_bytes_ctx_struct anjay_ret_bytes_ctx_t;
129
167 size_t length);
168
184 const void *data,
185 size_t length);
186
200int anjay_ret_bytes(anjay_output_ctx_t *ctx, const void *data, size_t length);
201
210int anjay_ret_string(anjay_output_ctx_t *ctx, const char *value);
211
224int anjay_ret_i64(anjay_output_ctx_t *ctx, int64_t value);
225
238static inline int anjay_ret_i32(anjay_output_ctx_t *ctx, int32_t value) {
239 return anjay_ret_i64(ctx, value);
240}
241
242#ifdef ANJAY_WITH_LWM2M11
255int anjay_ret_u64(anjay_output_ctx_t *ctx, uint64_t value);
256
269static inline int anjay_ret_u32(anjay_output_ctx_t *ctx, uint32_t value) {
270 return anjay_ret_u64(ctx, value);
271}
272#endif // ANJAY_WITH_LWM2M11
273
285int anjay_ret_double(anjay_output_ctx_t *ctx, double value);
286
295static inline int anjay_ret_float(anjay_output_ctx_t *ctx, float value) {
296 return anjay_ret_double(ctx, value);
297}
298
307int anjay_ret_bool(anjay_output_ctx_t *ctx, bool value);
308
320
321#ifdef ANJAY_WITH_SECURITY_STRUCTURED
344 avs_crypto_certificate_chain_info_t certificate_chain_info);
345
365 avs_crypto_private_key_info_t private_key_info);
366
388 avs_crypto_psk_identity_info_t psk_identity_info);
389
409 avs_crypto_psk_key_info_t psk_key_info);
410#endif // ANJAY_WITH_SECURITY_STRUCTURED
411
413typedef struct anjay_input_ctx_struct anjay_input_ctx_t;
414
415#define ANJAY_EXECUTE_GET_ARG_END 1
417typedef struct anjay_execute_ctx_struct anjay_execute_ctx_t;
418
443 int *out_arg,
444 bool *out_has_value);
445
480 size_t *out_bytes_read,
481 char *out_buf,
482 size_t buf_size);
483
522 size_t *out_bytes_read,
523 bool *out_message_finished,
524 void *out_buf,
525 size_t buf_size);
526
527#define ANJAY_BUFFER_TOO_SHORT 1
547int anjay_get_string(anjay_input_ctx_t *ctx, char *out_buf, size_t buf_size);
548
558int anjay_get_i32(anjay_input_ctx_t *ctx, int32_t *out);
559
569int anjay_get_i64(anjay_input_ctx_t *ctx, int64_t *out);
570
571#ifdef ANJAY_WITH_LWM2M11
582int anjay_get_u32(anjay_input_ctx_t *ctx, uint32_t *out);
583
594int anjay_get_u64(anjay_input_ctx_t *ctx, uint64_t *out);
595#endif // ANJAY_WITH_LWM2M11
596
606int anjay_get_float(anjay_input_ctx_t *ctx, float *out);
607
617int anjay_get_double(anjay_input_ctx_t *ctx, double *out);
618
629
644 anjay_oid_t *out_oid,
645 anjay_iid_t *out_iid);
646
647#ifdef __cplusplus
648} /* extern "C" */
649#endif
650
651#endif /*ANJAY_INCLUDE_ANJAY_IO_H*/
uint16_t anjay_oid_t
Definition core.h:1182
uint16_t anjay_rid_t
Definition core.h:1188
uint16_t anjay_iid_t
Definition core.h:1185
int anjay_get_double(anjay_input_ctx_t *ctx, double *out)
int anjay_execute_get_next_arg(anjay_execute_ctx_t *ctx, int *out_arg, bool *out_has_value)
int anjay_ret_psk_identity_info(anjay_output_ctx_t *ctx, avs_crypto_psk_identity_info_t psk_identity_info)
int anjay_get_i32(anjay_input_ctx_t *ctx, int32_t *out)
void anjay_dm_emit_res(anjay_dm_resource_list_ctx_t *ctx, anjay_rid_t rid, anjay_dm_resource_kind_t kind, anjay_dm_resource_presence_t presence)
void anjay_dm_emit(anjay_dm_list_ctx_t *ctx, uint16_t id)
static int anjay_ret_float(anjay_output_ctx_t *ctx, float value)
Definition io.h:295
int anjay_ret_u64(anjay_output_ctx_t *ctx, uint64_t value)
int anjay_ret_i64(anjay_output_ctx_t *ctx, int64_t value)
struct anjay_ret_bytes_ctx_struct anjay_ret_bytes_ctx_t
Definition io.h:128
static int anjay_ret_u32(anjay_output_ctx_t *ctx, uint32_t value)
Definition io.h:269
int anjay_ret_bool(anjay_output_ctx_t *ctx, bool value)
int anjay_get_i64(anjay_input_ctx_t *ctx, int64_t *out)
int anjay_get_u64(anjay_input_ctx_t *ctx, uint64_t *out)
anjay_dm_resource_kind_t
Definition io.h:45
@ ANJAY_DM_RES_RM
Definition io.h:66
@ ANJAY_DM_RES_WM
Definition io.h:71
@ ANJAY_DM_RES_RWM
Definition io.h:76
@ ANJAY_DM_RES_RW
Definition io.h:60
@ ANJAY_DM_RES_E
Definition io.h:81
@ ANJAY_DM_RES_BS_RW
Definition io.h:86
@ ANJAY_DM_RES_W
Definition io.h:55
@ ANJAY_DM_RES_R
Definition io.h:50
int anjay_get_float(anjay_input_ctx_t *ctx, float *out)
int anjay_ret_bytes(anjay_output_ctx_t *ctx, const void *data, size_t length)
int anjay_ret_private_key_info(anjay_output_ctx_t *ctx, avs_crypto_private_key_info_t private_key_info)
static int anjay_ret_i32(anjay_output_ctx_t *ctx, int32_t value)
Definition io.h:238
struct anjay_dm_resource_list_ctx_struct anjay_dm_resource_list_ctx_t
Definition io.h:40
int anjay_execute_get_arg_value(anjay_execute_ctx_t *ctx, size_t *out_bytes_read, char *out_buf, size_t buf_size)
int anjay_get_bytes(anjay_input_ctx_t *ctx, size_t *out_bytes_read, bool *out_message_finished, void *out_buf, size_t buf_size)
int anjay_get_string(anjay_input_ctx_t *ctx, char *out_buf, size_t buf_size)
anjay_dm_resource_presence_t
Definition io.h:92
@ ANJAY_DM_RES_PRESENT
Definition io.h:102
@ ANJAY_DM_RES_ABSENT
Definition io.h:97
struct anjay_input_ctx_struct anjay_input_ctx_t
Definition io.h:413
struct anjay_dm_list_ctx_struct anjay_dm_list_ctx_t
Definition io.h:22
int anjay_get_u32(anjay_input_ctx_t *ctx, uint32_t *out)
anjay_ret_bytes_ctx_t * anjay_ret_bytes_begin(anjay_output_ctx_t *ctx, size_t length)
int anjay_ret_bytes_append(anjay_ret_bytes_ctx_t *ctx, const void *data, size_t length)
int anjay_get_objlnk(anjay_input_ctx_t *ctx, anjay_oid_t *out_oid, anjay_iid_t *out_iid)
struct anjay_output_ctx_struct anjay_output_ctx_t
Definition io.h:123
int anjay_get_bool(anjay_input_ctx_t *ctx, bool *out)
struct anjay_execute_ctx_struct anjay_execute_ctx_t
Definition io.h:417
int anjay_ret_objlnk(anjay_output_ctx_t *ctx, anjay_oid_t oid, anjay_iid_t iid)
int anjay_ret_certificate_chain_info(anjay_output_ctx_t *ctx, avs_crypto_certificate_chain_info_t certificate_chain_info)
int anjay_ret_string(anjay_output_ctx_t *ctx, const char *value)
int anjay_ret_double(anjay_output_ctx_t *ctx, double value)
int anjay_ret_psk_key_info(anjay_output_ctx_t *ctx, avs_crypto_psk_key_info_t psk_key_info)