Mistake on this page? Email us
secure_device_access.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // Copyright 2017-2019 ARM Ltd.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 // ----------------------------------------------------------------------------
16 
17 #ifndef __SECURE_DEVICE_ACCESS_H__
18 #define __SECURE_DEVICE_ACCESS_H__
19 
20 #include <stdlib.h>
21 #include <inttypes.h>
22 #include "sda_status.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
69 typedef void *sda_operation_ctx_h;
70 
72 typedef sda_status_e(*user_callback)(sda_operation_ctx_h, void *);
73 
74 // Type of operation command.
75 typedef enum {
76  SDA_OPERATION_NONE = 0,
77  SDA_OPERATION_FUNC_CALL = 1,//Name or reference to operation function.
78  SDA_OPERATION_LWM2M = 2 // Not supported.
79 } sda_command_type_e;
80 
82 #define SDA_RESPONSE_HEADER_SIZE 24
83 
91 
99 
123 sda_status_e sda_operation_process(const uint8_t *message,
124  size_t message_size,
125  user_callback callback,
126  void *callback_context,
127  uint8_t *response_buffer_out,
128  size_t response_buffer_out_max_size,
129  size_t *response_message_actual_size_out);
130 
148 sda_status_e sda_response_data_set(sda_operation_ctx_h handle, uint8_t *buffer,
149  size_t buffer_size);
150 
151 
152 
171 sda_status_e sda_scope_get_next(sda_operation_ctx_h handle, const uint8_t **scope_out,
172  size_t *scope_size_out);
173 
186 sda_status_e sda_command_type_get(sda_operation_ctx_h handle, sda_command_type_e *command_type);
187 
205 sda_status_e sda_func_call_name_get(sda_operation_ctx_h handle, const uint8_t **func_call_name_out,
206  size_t *func_call_name_size_out);
207 
222 sda_status_e sda_func_call_numeric_parameter_get(sda_operation_ctx_h handle, uint32_t index,
223  int64_t *num_param_out);
224 
241 sda_status_e sda_func_call_data_parameter_get(sda_operation_ctx_h handle, uint32_t index,
242  const uint8_t **data_param_out,
243  size_t *data_param_size_out);
244 
245 
246 #ifdef __cplusplus
247 }
248 #endif
249 
250 #endif //__SECURE_DEVICE_ACCESS_H__
sda_status_e sda_finalize(void)
Secure device access status/error codes. This list may grow as needed.
sda_status_e sda_command_type_get(sda_operation_ctx_h handle, sda_command_type_e *command_type)
sda_status_e sda_func_call_numeric_parameter_get(sda_operation_ctx_h handle, uint32_t index, int64_t *num_param_out)
sda_status_e sda_response_data_set(sda_operation_ctx_h handle, uint8_t *buffer, size_t buffer_size)
sda_status_e sda_operation_process(const uint8_t *message, size_t message_size, user_callback callback, void *callback_context, uint8_t *response_buffer_out, size_t response_buffer_out_max_size, size_t *response_message_actual_size_out)
sda_status_e sda_init(void)
sda_status_e sda_func_call_data_parameter_get(sda_operation_ctx_h handle, uint32_t index, const uint8_t **data_param_out, size_t *data_param_size_out)
sda_status_e(* user_callback)(sda_operation_ctx_h, void *)
User callback that defines and checks operation permissions and performs the operation.
Definition: secure_device_access.h:72
sda_status_e sda_scope_get_next(sda_operation_ctx_h handle, const uint8_t **scope_out, size_t *scope_size_out)
sda_status_e
Definition: sda_status.h:33
sda_status_e sda_func_call_name_get(sda_operation_ctx_h handle, const uint8_t **func_call_name_out, size_t *func_call_name_size_out)