Code Review
/
o-du
/
l2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
CU testing fixes
[o-du/l2.git]
/
src
/
codec_utils
/
common
/
odu_common_codec.c
diff --git
a/src/codec_utils/common/odu_common_codec.c
b/src/codec_utils/common/odu_common_codec.c
index
98f0023
..
5ea3c8d
100644
(file)
--- a/
src/codec_utils/common/odu_common_codec.c
+++ b/
src/codec_utils/common/odu_common_codec.c
@@
-1,3
+1,7
@@
+#include "common_def.h"
+#include "OCTET_STRING.h"
+#include "BIT_STRING.h"
+#include "asn_codecs.h"
#include "odu_common_codec.h"
/*******************************************************************
#include "odu_common_codec.h"
/*******************************************************************
@@
-26,76
+30,86
@@
int PrepFinalEncBuf(const void *buffer, size_t size, void *encodedBuf)
/*******************************************************************
*
/*******************************************************************
*
- * @brief
Builds PLMN ID
+ * @brief
Fills the RicId
*
* @details
*
*
* @details
*
- * Function : plmnBuildId
+ * Function : FillRicId
+ *
+ * Functionality: Fills the RicId
*
*
- * Functionality: Building the PLMN ID
+ * @params[in] BIT_STRING_t *nbid,
+ * uint8_t unusedBits
+ * uint8_t byteSize
+ * uint8_t val
*
*
- * @params[in] PLMNID plmn
- * OCTET_STRING_t *octe
* @return ROK - success
* RFAILED - failure
*
* ****************************************************************/
* @return ROK - success
* RFAILED - failure
*
* ****************************************************************/
-S16 buildPlmnId(Plmn plmn, OCTET_STRING_t *octe)
+
+uint8_t fillBitString(BIT_STRING_t *id, uint8_t unusedBits, uint8_t byteSize, uint8_t val)
{
{
- U8 mncCnt;
- mncCnt = 2;
- octe->buf[0] = ((plmn.mcc[1] << 4) | (plmn.mcc[0]));
- if(mncCnt == 2)
+ uint8_t tmp;
+ if(id->buf == NULLP)
{
{
- octe->buf[1] = ((0xf0) | (plmn.mcc[2]));
- octe->buf[2] = ((plmn.mnc[1] << 4) | (plmn.mnc[0]));
+ return RFAILED;
}
}
- else
+
+ for (tmp = 0 ; tmp < (byteSize-1); tmp++)
{
{
- octe->buf[1] = ((plmn.mnc[0] << 4) | (plmn.mcc[2]));
- octe->buf[2] = ((plmn.mnc[2] << 4) | (plmn.mnc[1]));
+ id->buf[tmp] = tmp;
}
}
- RETVALUE(ROK);
+ id->buf[byteSize-1] = val;
+ id->bits_unused = unusedBits;
+ return ROK;
}
/*******************************************************************
*
}
/*******************************************************************
*
- * @brief
Fills the RicId
+ * @brief
Converts bit strings to integer
*
* @details
*
*
* @details
*
- * Function : FillRicId
- *
- * Functionality: Fills the RicId
+ * Function : bitStringToInt
*
*
- * @params[in] BIT_STRING_t *nbid,
- * U8 unusedBits
- * U8 byteSize
- * U8 val
+ * Functionality:
+ * - Converts ASN bit string format IEs to integer type
*
*
+ * @params[in] void
* @return ROK - success
* RFAILED - failure
*
* ****************************************************************/
* @return ROK - success
* RFAILED - failure
*
* ****************************************************************/
-
-S16 fillBitString(BIT_STRING_t *id, U8 unusedBits, U8 byteSize, U8 val)
+uint8_t bitStringToInt(BIT_STRING_t *bitString, void *value)
{
{
- U8 tmp;
- if(id->buf == NULLP)
+ uint16_t idx;
+ uint32_t *val = NULLP;
+
+ if(bitString->buf == NULL || bitString->size <= 0)
{
{
- RETVALUE(RFAILED);
+ DU_LOG("\nDU_APP : Bit string is empty");
+ return RFAILED;
}
}
- for (tmp = 0 ; tmp < (byteSize-1); tmp++)
+ if(value)
+ val = (uint32_t *)value;
+ else
+ return RFAILED;
+
+ for(idx=0; idx< bitString->size-1; idx++)
{
{
- id->buf[tmp] = tmp;
- }
- id->buf[byteSize-1] = val;
- id->bits_unused = unusedBits;
- RETVALUE(ROK);
+ *val |= bitString->buf[idx];
+ *val <<= 8;
+ }
+ *val |= bitString->buf[idx];
+ *val >>= bitString->bits_unused;
+
+ return ROK;
}
}
+
/**********************************************************************
End of file
**********************************************************************/
/**********************************************************************
End of file
**********************************************************************/