Functions for reasing ASN.1 data back into C structs.
More...
|
int16_t | asn_read_short (const uint8_t *asn_buffer, int32_t idx) SECTION_ASN |
| Read short object in asn_buffer.
|
|
int16_t | asn_read_int (uint8_t *int_buffer, uint8_t buffer_sz, uint8_t flags, const uint8_t *asn_buffer, int32_t idx) SECTION_ASN |
| Read int object in asn_buffer into buffer.
|
|
int16_t | asn_read_string (char *str_buffer, int16_t str_buffer_sz, const uint8_t *asn_buffer, int32_t idx) SECTION_ASN |
| Read string object in asn_buffer into str_buffer.
|
|
int16_t | asn_read_meta_ptr (const uint8_t *buffer, int32_t idx, uint8_t *type_out, int32_t *sz_out) SECTION_ASN |
| Get metadata for the object at idx in buffer.
|
|
Functions for reasing ASN.1 data back into C structs.
These functions generally take a locked MEMORY_PTR to the ASN.1 data. This may seem inconsistent with Writing ASN.1 Data, but since the ASN.1 buffer is finalized and won't change size, locking the buffer once and passing it around is faster and simpler.
◆ asn_read_int()
int16_t asn_read_int |
( |
uint8_t * |
int_buffer, |
|
|
uint8_t |
buffer_sz, |
|
|
uint8_t |
flags, |
|
|
const uint8_t * |
asn_buffer, |
|
|
int32_t |
idx |
|
) |
| |
Read int object in asn_buffer into buffer.
- Parameters
-
int_buffer | Buffer in which to place parsed integer. |
buffer_sz | Size of output integer buffer in bytes. |
flags | ASN.1 Function Flags to alter function behavior. |
asn_buffer | Buffer containing ASN data to parse. |
idx | Index of integer object (starting at type byte) in asn_buffer. |
- Returns
- Count of bytes parsed in asn_buffer or ASN.1 Error Codes.
◆ asn_read_meta_ptr()
int16_t asn_read_meta_ptr |
( |
const uint8_t * |
buffer, |
|
|
int32_t |
idx, |
|
|
uint8_t * |
type_out, |
|
|
int32_t * |
sz_out |
|
) |
| |
Get metadata for the object at idx in buffer.
- Parameters
-
buffer | |
idx | |
type_out | |
sz_out | |
- Returns
◆ asn_read_short()
int16_t asn_read_short |
( |
const uint8_t * |
asn_buffer, |
|
|
int32_t |
idx |
|
) |
| |
Read short object in asn_buffer.
- Parameters
-
int_buffer | Buffer in which to place parsed integer. |
asn_buffer | Buffer containing ASN data to parse. |
idx | Index of integer object (starting at type byte) in asn_buffer. |
- Returns
- Count of bytes parsed in asn_buffer or ASN.1 Error Codes.
- Deprecated:
- Should be worked into asn_read_int using flags at some point.
◆ asn_read_string()
int16_t asn_read_string |
( |
char * |
str_buffer, |
|
|
int16_t |
str_buffer_sz, |
|
|
const uint8_t * |
asn_buffer, |
|
|
int32_t |
idx |
|
) |
| |
Read string object in asn_buffer into str_buffer.
- Parameters
-
str_buffer | Buffer in which to place parsed string. |
str_buffer_sz | Size of output string buffer in bytes. |
asn_buffer | Buffer containing ASN data to parse. |
idx | Index of string object (starting at type byte) in asn_buffer. |
- Returns
- Count of bytes parsed in asn_buffer or ASN.1 Error Codes.