1 #include "odu_common_codec.h"
3 /*******************************************************************
5 * @brief Writes the encoded chunks into a buffer
9 * Function : PrepFinalEncBuf
11 * Functionality:Fills the encoded buffer
13 * @params[in] void *buffer,initial encoded data
14 * @params[in] size_t size,size of buffer
15 * @params[in] void *encodedBuf,final buffer
16 * @return ROK - success
19 * ****************************************************************/
20 int PrepFinalEncBuf(const void *buffer, size_t size, void *encodedBuf)
22 memcpy(encodedBuf + encBufSize, buffer, size);
25 } /* PrepFinalEncBuf */
27 /*******************************************************************
29 * @brief Builds PLMN ID
33 * Function : plmnBuildId
35 * Functionality: Building the PLMN ID
37 * @params[in] PLMNID plmn
38 * OCTET_STRING_t *octe
39 * @return ROK - success
42 * ****************************************************************/
43 S16 buildPlmnId(Plmn plmn, OCTET_STRING_t *octe)
47 octe->buf[0] = ((plmn.mcc[1] << 4) | (plmn.mcc[0]));
50 octe->buf[1] = ((0xf0) | (plmn.mcc[2]));
51 octe->buf[2] = ((plmn.mnc[1] << 4) | (plmn.mnc[0]));
55 octe->buf[1] = ((plmn.mnc[0] << 4) | (plmn.mcc[2]));
56 octe->buf[2] = ((plmn.mnc[2] << 4) | (plmn.mnc[1]));
61 /*******************************************************************
63 * @brief Fills the RicId
67 * Function : FillRicId
69 * Functionality: Fills the RicId
71 * @params[in] BIT_STRING_t *nbid,
76 * @return ROK - success
79 * ****************************************************************/
81 S16 fillBitString(BIT_STRING_t *id, U8 unusedBits, U8 byteSize, U8 val)
89 for (tmp = 0 ; tmp < (byteSize-1); tmp++)
93 id->buf[byteSize-1] = val;
94 id->bits_unused = unusedBits;
99 /**********************************************************************
101 **********************************************************************/