X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Flib%2Fgscphftaaux%2Fhfta_runtime_library.cc;fp=src%2Flib%2Fgscphftaaux%2Fhfta_runtime_library.cc;h=9d9f0b073b9bd35f702e9228b5b33cac9e35a38d;hb=989d19428b3d21982b048cf256f625a8ca664c2e;hp=c4bcc64c3984e20724f9d293fe25d66216c3d98a;hpb=52bf6cf53a585197f998187399ebfd88681d4490;p=com%2Fgs-lite.git diff --git a/src/lib/gscphftaaux/hfta_runtime_library.cc b/src/lib/gscphftaaux/hfta_runtime_library.cc index c4bcc64..9d9f0b0 100644 --- a/src/lib/gscphftaaux/hfta_runtime_library.cc +++ b/src/lib/gscphftaaux/hfta_runtime_library.cc @@ -661,3 +661,27 @@ gs_param_handle_t deregister_handle_for_int_to_string_map_slot_1(gs_param_handle delete map_struct; } +// --------------------------------------------------- +// Return a (binary, non-ascii) string in its hex representation + +static char hexmap[16] = { + '0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f' +}; + +gs_retval_t to_hex_string(vstring *result, vstring *val){ + result->length = 2*(val->length); + result->offset = (gs_p_t)malloc(result->length); + result->reserved = INTERNAL; + unsigned char *rs = (unsigned char *)(result->offset); + unsigned char *vs = (unsigned char *)(val->offset); + + for(int c=0;clength; ++c){ + rs[2*c] = hexmap[vs[c] >> 4]; + rs[2*c+1] = hexmap[vs[c] & 0x0f]; + } + + return 0; +} + + +