#include <avsystem/commons/avs_stream.h>
#include <avsystem/commons/avs_stream_md5.h>
#include <anjay/bootstrapper.h>
Go to the source code of this file.
◆ anjay_sim_bootstrap_perform_command_cb_t
typedef int anjay_sim_bootstrap_perform_command_cb_t(void *arg, const void *cmd, size_t cmd_length, void *out_buf, size_t out_buf_size, size_t *out_response_size) |
A callback that shall execute a command on the SIM card.
A common way to implement through a cellular modem is to hexlify the cmd
parameter and pass it otherwise as-is to the standard AT+CSIM=xx,"..."
AT command. The response string from the +CSIM: xx,"..."
response would then be unhexlified and also passed otherwise as-is.
- Parameters
-
arg | Opaque user context argument; the value passed as perform_command_cb_arg to anjay_sim_bootstrap_stream_create or anjay_sim_bootstrap_perform will be passed as-is. |
cmd | Pointer to binary command data. Contains CLA, INS, P1, P2 and optionally Lc, Data and Le bytes according to the APD structure specification as defined in ETSI TS 102 221. |
cmd_length | Number of bytes at the cmd pointer which are valid and actually form the command. |
out_buf | Pointer to a buffer in which the response (including optional data bytes as well as SW1 and SW2) shall be stored. |
out_buf_size | Size of the buffer pointed to by out_buf (number of bytes that can be safely accessed by the function). |
out_response_size | Pointer to a variable that, on successful return from this function, will be filled with the number of bytes in out_buf (never more than out_buf_size ) that actually form the response from the SIM card. |
- Returns
- 0 on success, or a nonzero value in case of error.
◆ anjay_sim_bootstrap_calculate_md5()
avs_error_t anjay_sim_bootstrap_calculate_md5 |
( |
avs_stream_t * |
stream, |
|
|
uint8_t(*) |
md5[AVS_COMMONS_MD5_LENGTH] |
|
) |
| |
Calulates MD5 hash value of a Bootstrap Information stored in an avs_stream_t object previously created with anjay_sim_bootstrap_stream_create().
- Parameters
-
stream | Stream to opeate on. avs_stream_reset() is called on it on function exit. |
md5 | Pointer to an array of AVS_COMMONS_MD5_LENGTH size that will be filled with MD5 hash value |
- Returns
- AVS_OK in case of success, or an error code.
◆ anjay_sim_bootstrap_perform()
◆ anjay_sim_bootstrap_stream_create()
Creates an input stream object that reads the LwM2M bootstrap information file (EF LwM2M_Bootstrap) from the SIM card.
The stream object will be allocated on the heap and can be freed using avs_stream_cleanup()
.
- Parameters
-
perform_command_cb | Callback function to use for performing raw commands on the smartcard. |
perform_command_cb_arg | Opaque argument that will be passed to perform_command_cb . |
- Returns
- The newly created stream object, or
NULL
in case of error.