X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fcodec_utils%2Fcommon%2Fodu_common_codec.c;h=7ca79231b09277ed04421b6e25926948858d9eed;hb=45d134510deb6902b870b4a0fb574b6075fba601;hp=98f00230d21d22dbfea0e2fa7d4a3db82927b887;hpb=392607b7a8cbf1b7415b15517275dd1ef4e897a9;p=o-du%2Fl2.git diff --git a/src/codec_utils/common/odu_common_codec.c b/src/codec_utils/common/odu_common_codec.c index 98f00230d..7ca79231b 100644 --- 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" /******************************************************************* @@ -95,6 +99,43 @@ S16 fillBitString(BIT_STRING_t *id, U8 unusedBits, U8 byteSize, U8 val) RETVALUE(ROK); } +/******************************************************************* + * + * @brief Converts bit strings to integer + * + * @details + * + * Function : bitStringToInt + * + * Functionality: + * - Converts ASN bit string format IEs to integer type + * + * @params[in] void + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +S16 bitStringToInt(BIT_STRING_t *bitString, U16 *val) +{ + U16 idx; + if(bitString->buf == NULL || bitString->size <= 0) + { + DU_LOG("\nDU_APP : Bit string is empty"); + return RFAILED; + } + + for(idx=0; idx< bitString->size-1; idx++) + { + *val |= bitString->buf[idx]; + *val <<= 8; + } + *val |= bitString->buf[idx]; + *val >>= bitString->bits_unused; + + return ROK; +} + + /********************************************************************** End of file