diff options
Diffstat (limited to 'skeletons/per_support.h')
-rw-r--r-- | skeletons/per_support.h | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/skeletons/per_support.h b/skeletons/per_support.h index 44f0bb40..747abe27 100644 --- a/skeletons/per_support.h +++ b/skeletons/per_support.h @@ -12,7 +12,7 @@ extern "C" { #endif /* - * This structure describes a position inside a PER bit stream. + * This structure describes a position inside an incoming PER bit stream. */ typedef struct asn_per_data_s { const uint8_t *buffer; /* Pointer to the octet stream */ @@ -21,12 +21,27 @@ typedef struct asn_per_data_s { } asn_per_data_t; /* + * This structure supports forming PER output. + */ +typedef struct asn_per_outp_s { + uint8_t *buffer; /* Pointer into the (tmpspace) */ + size_t nboff; /* Bit offset to the meaningful bit */ + size_t nbits; /* Number of bits left in (tmpspace) */ + uint8_t tmpspace[32]; /* Preliminary storage to hold data */ + int (*outper)(const void *data, size_t size, void *op_key); + void *op_key; +} asn_per_outp_t; + +/* * Extract a small number of bits (<= 31) from the specified PER data pointer. * This function returns -1 if the specified number of bits could not be * extracted due to EOD or other conditions. */ int32_t per_get_few_bits(asn_per_data_t *per_data, int get_nbits); +/* Output a small number of bits (<= 31) */ +int per_put_few_bits(asn_per_outp_t *per_data, uint32_t bits, int obits); + /* * Extract a large number of bits from the specified PER data pointer. * This function returns -1 if the specified number of bits could not be @@ -35,6 +50,9 @@ int32_t per_get_few_bits(asn_per_data_t *per_data, int get_nbits); int per_get_many_bits(asn_per_data_t *pd, uint8_t *dst, int right_align, int get_nbits); +/* Output a large number of bits */ +int per_put_many_bits(asn_per_outp_t *po, const uint8_t *src, int put_nbits); + /* * Get the length "n" from the Unaligned PER stream. */ @@ -43,10 +61,22 @@ ssize_t uper_get_length(asn_per_data_t *pd, int *repeat); /* + * Put the length "n" to the Unaligned PER stream. + * This function returns the number of units which may be flushed + * in the next units saving iteration. + */ +ssize_t uper_put_length(asn_per_outp_t *po, size_t whole_length); + +/* * Get the normally small non-negative whole number. */ ssize_t uper_get_nsnnwn(asn_per_data_t *pd); +/* + * Put the normally small non-negative whole number. + */ +int uper_put_nsnnwn(asn_per_outp_t *po, int n); + #ifdef __cplusplus } #endif |