Create macro to do ntoh for 3 bytes

use it in NSSAI parsing function
This commit is contained in:
Sakthivel Velumani
2023-11-01 21:13:20 -04:00
parent dc95e838eb
commit 21b269fa99
2 changed files with 8 additions and 4 deletions
+5 -4
View File
@@ -52,6 +52,7 @@
#include <openair1/SIMULATION/ETH_TRANSPORT/proto.h>
#include "openair2/SDAP/nr_sdap/nr_sdap.h"
#include "openair3/SECU/nas_stream_eia2.h"
#include "openair3/UTILS/conversions.h"
uint8_t *registration_request_buf;
uint32_t registration_request_len;
@@ -937,14 +938,14 @@ static void parse_allowed_nssai(nr_nas_msg_snssai_t nssaiList[8], const uint8_t
case 4:
nssai->sst = *buf++;
nssai->sd = 0xffffff & (buf[2] | buf[1] << 8 | buf[0] << 16);
nssai->sd = 0xffffff & ntoh_int24_buf(buf);
buf += 3;
nssai_cnt++;
break;
case 5:
nssai->sst = *buf++;
nssai->sd = 0xffffff & (buf[2] | buf[1] << 8 | buf[0] << 16);
nssai->sd = 0xffffff & ntoh_int24_buf(buf);
buf += 3;
nssai->hplmn_sst = *buf++;
nssai_cnt++;
@@ -952,10 +953,10 @@ static void parse_allowed_nssai(nr_nas_msg_snssai_t nssaiList[8], const uint8_t
case 8:
nssai->sst = *buf++;
nssai->sd = 0xffffff & (buf[2] | buf[1] << 8 | buf[0] << 16);
nssai->sd = 0xffffff & ntoh_int24_buf(buf);
buf += 3;
nssai->hplmn_sst = *buf++;
nssai->hplmn_sd = 0xffffff & (buf[2] | buf[1] << 8 | buf[0] << 16);
nssai->hplmn_sd = 0xffffff & ntoh_int24_buf(buf);
buf += 3;
nssai_cnt++;
break;
+3
View File
@@ -41,6 +41,9 @@
# define hton_int16(x) (x)
#endif
#define ntoh_int24_buf(bUF) \
((*bUF << 16) | ((*(bUF + 1)) << 8) | (*(bUF + 2)))
#define IN_ADDR_TO_BUFFER(X,bUFF) INT32_TO_BUFFER((X).s_addr,(char*)bUFF)
#define IN6_ADDR_TO_BUFFER(X,bUFF) \