| 1 | /* |
| 2 | * Copyright (c) 2005-2017 Lev Walkin <[email protected]>. All rights reserved. |
| 3 | * Redistribution and modifications are permitted subject to BSD license. |
| 4 | */ |
| 5 | #ifndef ASN_BIT_DATA |
| 6 | #define ASN_BIT_DATAcxx . . $ `lib/s1ap/asn1c/asn_bit_data.h:6:9`! |
| 7 | |
| 8 | #include <asn_system.h>cxx . . $ `<file>/lib/s1ap/asn1c/asn_system.h`/ /* Platform-specific types */ |
| 9 | |
| 10 | #ifdef __cplusplus |
| 11 | extern "C" { |
| 12 | #endif |
| 13 | |
| 14 | /* |
| 15 | * This structure describes a position inside an incoming PER bit stream. |
| 16 | */ |
| 17 | typedef struct asn_bit_data_scxx . . $ asn_bit_data_s# { |
| 18 | const uint8_tcxx . . $ uint8_t# *buffercxx . . $ asn_bit_data_s#buffer.; /* Pointer to the octet stream */ |
| 19 | size_t nboffcxx . . $ asn_bit_data_s#nboff.; /* Bit offset to the meaningful bit */ |
| 20 | size_t nbitscxx . . $ asn_bit_data_s#nbits.; /* Number of bits in the stream */ |
| 21 | size_t movedcxx . . $ asn_bit_data_s#moved.; /* Number of bits moved through this bit stream */ |
| 22 | int (*refillcxx . . $ asn_bit_data_s#refill.)(struct asn_bit_data_scxx . . $ asn_bit_data_s# *); |
| 23 | void *refill_keycxx . . $ asn_bit_data_s#refill_key.; |
| 24 | } asn_bit_data_tcxx . . $ asn_bit_data_t#; |
| 25 | |
| 26 | /* |
| 27 | * Create a contiguous non-refillable bit data structure. |
| 28 | * Can be freed by FREEMEM(). |
| 29 | */ |
| 30 | asn_bit_data_tcxx . . $ asn_bit_data_t# *asn_bit_data_new_contiguouscxx . . $ asn_bit_data_new_contiguous(94a55c959dc1f4ef).(const void *data, size_t size_bits); |
| 31 | |
| 32 | /* |
| 33 | * Extract a small number of bits (<= 31) from the specified PER data pointer. |
| 34 | * This function returns -1 if the specified number of bits could not be |
| 35 | * extracted due to EOD or other conditions. |
| 36 | */ |
| 37 | int32_tcxx . . $ int32_t# asn_get_few_bitscxx . . $ asn_get_few_bits(5c7a91be40ca4551).(asn_bit_data_tcxx . . $ asn_bit_data_t# *, int get_nbits); |
| 38 | |
| 39 | /* Undo the immediately preceeding "get_few_bits" operation */ |
| 40 | void asn_get_undocxx . . $ asn_get_undo(40776eea2f17b4e8).(asn_bit_data_tcxx . . $ asn_bit_data_t# *, int get_nbits); |
| 41 | |
| 42 | /* |
| 43 | * Extract a large number of bits from the specified PER data pointer. |
| 44 | * This function returns -1 if the specified number of bits could not be |
| 45 | * extracted due to EOD or other conditions. |
| 46 | */ |
| 47 | int asn_get_many_bitscxx . . $ asn_get_many_bits(53efe911a84d0b33).(asn_bit_data_tcxx . . $ asn_bit_data_t# *, uint8_tcxx . . $ uint8_t# *dst, int right_align, |
| 48 | int get_nbits); |
| 49 | |
| 50 | /* Non-thread-safe debugging function, don't use it */ |
| 51 | char *asn_bit_data_stringcxx . . $ asn_bit_data_string(9e8ce53319bf6a2).(asn_bit_data_tcxx . . $ asn_bit_data_t# *); |
| 52 | |
| 53 | /* |
| 54 | * This structure supports forming bit output. |
| 55 | */ |
| 56 | typedef struct asn_bit_outp_scxx . . $ asn_bit_outp_s# { |
| 57 | uint8_tcxx . . $ uint8_t# *buffercxx . . $ asn_bit_outp_s#buffer.; /* Pointer into the (tmpspace) */ |
| 58 | size_t nboffcxx . . $ asn_bit_outp_s#nboff.; /* Bit offset to the meaningful bit */ |
| 59 | size_t nbitscxx . . $ asn_bit_outp_s#nbits.; /* Number of bits left in (tmpspace) */ |
| 60 | uint8_tcxx . . $ uint8_t# tmpspacecxx . . $ asn_bit_outp_s#tmpspace.[32]; /* Preliminary storage to hold data */ |
| 61 | int (*outputcxx . . $ asn_bit_outp_s#output.)(const void *data, size_t size, void *op_key); |
| 62 | void *op_keycxx . . $ asn_bit_outp_s#op_key.; /* Key for (output) data callback */ |
| 63 | size_t flushed_bytescxx . . $ asn_bit_outp_s#flushed_bytes.; /* Bytes already flushed through (output) */ |
| 64 | } asn_bit_outp_tcxx . . $ asn_bit_outp_t#; |
| 65 | |
| 66 | /* Output a small number of bits (<= 31) */ |
| 67 | int asn_put_few_bitscxx . . $ asn_put_few_bits(c0e02e62874a8481).(asn_bit_outp_tcxx . . $ asn_bit_outp_t# *, uint32_tcxx . . $ uint32_t# bits, int obits); |
| 68 | |
| 69 | /* Output a large number of bits */ |
| 70 | int asn_put_many_bitscxx . . $ asn_put_many_bits(d373bafe0808586c).(asn_bit_outp_tcxx . . $ asn_bit_outp_t# *, const uint8_tcxx . . $ uint8_t# *src, int put_nbits); |
| 71 | |
| 72 | /* |
| 73 | * Flush whole bytes (0 or more) through (outper) member. |
| 74 | * The least significant bits which are not used are guaranteed to be set to 0. |
| 75 | * Returns -1 if callback returns -1. Otherwise, 0. |
| 76 | */ |
| 77 | int asn_put_aligned_flushcxx . . $ asn_put_aligned_flush(8263f7cdac5e5af7).(asn_bit_outp_tcxx . . $ asn_bit_outp_t# *); |
| 78 | |
| 79 | #ifdef __cplusplus |
| 80 | } |
| 81 | #endif |
| 82 | |
| 83 | #endif /* ASN_BIT_DATA */ |