1 #include "common_def.h"
2 #include "OCTET_STRING.h"
3 #include "BIT_STRING.h"
4 #include "asn_codecs.h"
5 #include "odu_common_codec.h"
7 /*******************************************************************
9 * @brief Writes the encoded chunks into a buffer
13 * Function : PrepFinalEncBuf
15 * Functionality:Fills the encoded buffer
17 * @params[in] void *buffer,initial encoded data
18 * @params[in] size_t size,size of buffer
19 * @params[in] void *encodedBuf,final buffer
20 * @return ROK - success
23 * ****************************************************************/
24 int PrepFinalEncBuf(const void *buffer, size_t size, void *encodedBuf)
26 memcpy(encodedBuf + encBufSize, buffer, size);
29 } /* PrepFinalEncBuf */
31 /*******************************************************************
33 * @brief Fills the RicId
37 * Function : FillRicId
39 * Functionality: Fills the RicId
41 * @params[in] BIT_STRING_t *nbid,
46 * @return ROK - success
49 * ****************************************************************/
51 uint8_t fillBitString(BIT_STRING_t *id, uint8_t unusedBits, uint8_t byteSize, uint8_t val)
59 for (tmp = 0 ; tmp < (byteSize-1); tmp++)
63 id->buf[byteSize-1] = val;
64 id->bits_unused = unusedBits;
68 /*******************************************************************
70 * @brief Converts bit strings to integer
74 * Function : bitStringToInt
77 * - Converts ASN bit string format IEs to integer type
80 * @return ROK - success
83 * ****************************************************************/
84 uint8_t bitStringToInt(BIT_STRING_t *bitString, void *value)
87 uint32_t *val = NULLP;
89 if(bitString->buf == NULL || bitString->size <= 0)
91 DU_LOG("\nDU_APP : Bit string is empty");
96 val = (uint32_t *)value;
100 for(idx=0; idx< bitString->size-1; idx++)
102 *val |= bitString->buf[idx];
105 *val |= bitString->buf[idx];
106 *val >>= bitString->bits_unused;
113 /**********************************************************************
115 **********************************************************************/