EVE 1.0
ASN.1 decoder
Collaboration diagram for ASN.1 decoder:

Data Structures

struct  asn1_dec_state_t
 
struct  asn1_result_t
 

Macros

#define ASN1_SEQUENCE   (0x30)
 
#define ASN1_INTEGER   (0x02)
 
#define ASN1_LENGTH(x)   ((uint8_t)((x) >> 0)), ((uint8_t)((x) >> 8)), ((uint8_t)((x) >> 16)), ((uint8_t)((x) >> 24))
 

Enumerations

Functions

void asn1_dec_init (struct asn1_dec_state_t *s)
 
enum asn1_rc_t asn1_dec (struct asn1_dec_state_t *s, const uint8_t *tplt, struct asn1_result_t *result, uint8_t ch)
 

Detailed Description

EVE ASN.1 decoder

Macro Definition Documentation

#define ASN1_SEQUENCE   (0x30)

Search for a SEQUENCE in ASN.1 data

Definition at line 51 of file asn1.h.

#define ASN1_INTEGER   (0x02)

Search for a INTEGER in the ASN.1 data

Definition at line 55 of file asn1.h.

#define ASN1_LENGTH (   x)    ((uint8_t)((x) >> 0)), ((uint8_t)((x) >> 8)), ((uint8_t)((x) >> 16)), ((uint8_t)((x) >> 24))

Encodes length of the integer

Definition at line 59 of file asn1.h.

Enumeration Type Documentation

enum asn1_rc_t

ASN.1 decoder return codes

Enumerator
ASN1_STATE_IDLE 

Processing of the ASN.1 data was not finished yet

ASN1_STATE_RDY 

Processing of the ASN.1 data was finished according to template

ASN1_STATE_ERROR 

The ASN.1 data or template is not valid

Definition at line 63 of file asn1.h.

ASN.1 decoder state type, used internally by the decoder

Definition at line 71 of file asn1.h.

Function Documentation

void asn1_dec_init ( struct asn1_dec_state_t s)

Initializes the ASN.1 decoder structure.

Parameters
spointer to the ASN.1 decoder structure
enum asn1_rc_t asn1_dec ( struct asn1_dec_state_t s,
const uint8_t *  tplt,
struct asn1_result_t result,
uint8_t  ch 
)

Feeds the encoder with a single character.

Parameters
spointer to the base64 encoder structure
tpltparsing template, zero-terminated string of ASN1_XXX macroes
resultparsing result desctiptors, an array of asn1_result_t elements
chthe character to be fed to the encoder
Returns
ASN1_STATE_ERROR when the character was not accepted
ASN1_STATE_IDLE whan the character was accepted, but the processing was not finished
ASN1_STATE_RDY whan the character was accepted and result is available in the result array