Commit 21b269fa authored by Sakthivel Velumani's avatar Sakthivel Velumani

Create macro to do ntoh for 3 bytes

use it in NSSAI parsing function
parent dc95e838
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#include <openair1/SIMULATION/ETH_TRANSPORT/proto.h> #include <openair1/SIMULATION/ETH_TRANSPORT/proto.h>
#include "openair2/SDAP/nr_sdap/nr_sdap.h" #include "openair2/SDAP/nr_sdap/nr_sdap.h"
#include "openair3/SECU/nas_stream_eia2.h" #include "openair3/SECU/nas_stream_eia2.h"
#include "openair3/UTILS/conversions.h"
uint8_t *registration_request_buf; uint8_t *registration_request_buf;
uint32_t registration_request_len; uint32_t registration_request_len;
...@@ -937,14 +938,14 @@ static void parse_allowed_nssai(nr_nas_msg_snssai_t nssaiList[8], const uint8_t ...@@ -937,14 +938,14 @@ static void parse_allowed_nssai(nr_nas_msg_snssai_t nssaiList[8], const uint8_t
case 4: case 4:
nssai->sst = *buf++; nssai->sst = *buf++;
nssai->sd = 0xffffff & (buf[2] | buf[1] << 8 | buf[0] << 16); nssai->sd = 0xffffff & ntoh_int24_buf(buf);
buf += 3; buf += 3;
nssai_cnt++; nssai_cnt++;
break; break;
case 5: case 5:
nssai->sst = *buf++; nssai->sst = *buf++;
nssai->sd = 0xffffff & (buf[2] | buf[1] << 8 | buf[0] << 16); nssai->sd = 0xffffff & ntoh_int24_buf(buf);
buf += 3; buf += 3;
nssai->hplmn_sst = *buf++; nssai->hplmn_sst = *buf++;
nssai_cnt++; nssai_cnt++;
...@@ -952,10 +953,10 @@ static void parse_allowed_nssai(nr_nas_msg_snssai_t nssaiList[8], const uint8_t ...@@ -952,10 +953,10 @@ static void parse_allowed_nssai(nr_nas_msg_snssai_t nssaiList[8], const uint8_t
case 8: case 8:
nssai->sst = *buf++; nssai->sst = *buf++;
nssai->sd = 0xffffff & (buf[2] | buf[1] << 8 | buf[0] << 16); nssai->sd = 0xffffff & ntoh_int24_buf(buf);
buf += 3; buf += 3;
nssai->hplmn_sst = *buf++; 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; buf += 3;
nssai_cnt++; nssai_cnt++;
break; break;
......
...@@ -41,6 +41,9 @@ ...@@ -41,6 +41,9 @@
# define hton_int16(x) (x) # define hton_int16(x) (x)
#endif #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 IN_ADDR_TO_BUFFER(X,bUFF) INT32_TO_BUFFER((X).s_addr,(char*)bUFF)
#define IN6_ADDR_TO_BUFFER(X,bUFF) \ #define IN6_ADDR_TO_BUFFER(X,bUFF) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment