Commit 450e72c5 authored by luhan Wang's avatar luhan Wang

try to support 5G Phone

parent 4c4ff252
...@@ -146,7 +146,29 @@ void util::string_to_bstring(const std::string& str, bstring bstr) { ...@@ -146,7 +146,29 @@ void util::string_to_bstring(const std::string& str, bstring bstr) {
} }
void util::string_to_dnn(const std::string& str, bstring bstr) { void util::string_to_dnn(const std::string& str, bstring bstr) {
std::string tmp = std::to_string(str.length()) + str; //std::string tmp = str + ".mnc011.mcc460.gprs";//for test ctnet
bstr->slen = tmp.length(); //std::string tmp = std::to_string(str.length()) + str;
memcpy((void*) bstr->data, (void*) tmp.c_str(), tmp.length()); //bstr->slen = str.length()+sizeof(".mnc011.mcc110.gprs");
/*
int n = 0, i=0;
bstr->data[i] = str.length(); i++;
n = str.length();
memcpy((void*) (bstr->data+i+1), (void*) str.c_str(), n); i += n;
bstr->data[i] = n;
std::string tmp = "mnc011"; n = tmp.length();
memcpy((void*) (bstr->data+i+1), (void*) tmp.c_str(), n); i += n;
bstr->data[i] = n;
tmp = "mcc460"; n = tmp.length();
memcpy((void*) (bstr->data+i+1), (void*) tmp.c_str(), n); i += n;
tmp = "gprs"; n = tmp.length();
memcpy((void*) (bstr->data+i+1), (void*) tmp.c_str(), n); i += n;
*/
//19 05 63 74 6e 65
uint8_t strB[6] = {0};
strB[0] = str.length();
memcpy(strB+1, str.c_str(), str.length());
bstr->slen = str.length() + 20;
uint8_t dnn[19]={0x06, 0x6d, 0x6e, 0x63, 0x30, 0x31, 0x31, 0x06, 0x6d, 0x63, 0x63, 0x34, 0x36, 0x30, 0x04, 0x67, 0x70, 0x72, 0x73};
memcpy((void*)(bstr->data), (void*)strB, str.length()+1);
memcpy((void*)(bstr->data+str.length()+1), (void*)dnn, 19);
} }
...@@ -44,6 +44,7 @@ int encode_snssai(SNSSAI snssai, uint8_t iei, uint8_t* buffer, uint32_t len) { ...@@ -44,6 +44,7 @@ int encode_snssai(SNSSAI snssai, uint8_t iei, uint8_t* buffer, uint32_t len) {
} }
ielen = snssai.len; ielen = snssai.len;
ielen = 1;
*(buffer + encoded) = ielen; *(buffer + encoded) = ielen;
encoded++; encoded++;
......
...@@ -36,10 +36,10 @@ int encode__pdu_session_type( ...@@ -36,10 +36,10 @@ int encode__pdu_session_type(
buffer, _PDU_SESSION_TYPE_MINIMUM_LENGTH, len); buffer, _PDU_SESSION_TYPE_MINIMUM_LENGTH, len);
if (iei > 0) { if (iei > 0) {
bitStream |= (iei & 0xf0); bitStream |= (iei & 0xf0) ;
} }
bitStream |= (_pdusessiontype.pdu_session_type_value & 0x07); bitStream |= ((_pdusessiontype.pdu_session_type_value & 0x07) | 0x10);
ENCODE_U8(buffer + encoded, bitStream, encoded); ENCODE_U8(buffer + encoded, bitStream, encoded);
return encoded; return encoded;
......
...@@ -215,6 +215,7 @@ int encode_pdu_session_establishment_accept( ...@@ -215,6 +215,7 @@ int encode_pdu_session_establishment_accept(
CHECK_PDU_POINTER_AND_LENGTH_ENCODER( CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, PDU_SESSION_ESTABLISHMENT_ACCEPT_MINIMUM_LENGTH, len); buffer, PDU_SESSION_ESTABLISHMENT_ACCEPT_MINIMUM_LENGTH, len);
if ((encoded_result = encode__pdu_session_type( if ((encoded_result = encode__pdu_session_type(
pdu_session_establishment_accept->_pdusessiontype, 0, pdu_session_establishment_accept->_pdusessiontype, 0,
buffer + encoded, len - encoded)) < 0) buffer + encoded, len - encoded)) < 0)
......
...@@ -102,11 +102,11 @@ bool smf_n1::create_n1_pdu_session_establishment_accept( ...@@ -102,11 +102,11 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
"PDU Session Type: %d", sm_msg->pdu_session_establishment_accept "PDU Session Type: %d", sm_msg->pdu_session_establishment_accept
._pdusessiontype.pdu_session_type_value); ._pdusessiontype.pdu_session_type_value);
sm_msg->pdu_session_establishment_accept.sscmode.ssc_mode_value = //sm_msg->pdu_session_establishment_accept.sscmode.ssc_mode_value =
SSC_MODE_1; // TODO: get from sm_context_res // SSC_MODE_1; // TODO: get from sm_context_res
Logger::smf_n1().debug( //Logger::smf_n1().debug(
"SSC Mode: %d", // "SSC Mode: %d",
sm_msg->pdu_session_establishment_accept.sscmode.ssc_mode_value); // sm_msg->pdu_session_establishment_accept.sscmode.ssc_mode_value);
// authorized QoS rules of the PDU session: QOSRules (Section 6.2.5@3GPP // authorized QoS rules of the PDU session: QOSRules (Section 6.2.5@3GPP
// TS 24.501) (Section 6.4.1.3@3GPP TS 24.501 V16.1.0) Make sure that the // TS 24.501) (Section 6.4.1.3@3GPP TS 24.501 V16.1.0) Make sure that the
...@@ -152,7 +152,7 @@ bool smf_n1::create_n1_pdu_session_establishment_accept( ...@@ -152,7 +152,7 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
return false; return false;
} }
sm_msg->pdu_session_establishment_accept.presence = 0x039a; sm_msg->pdu_session_establishment_accept.presence = 0x038a;
if (static_cast<uint8_t>(sm_cause) > 0) { if (static_cast<uint8_t>(sm_cause) > 0) {
sm_msg->pdu_session_establishment_accept.presence = 0x039b; sm_msg->pdu_session_establishment_accept.presence = 0x039b;
sm_msg->pdu_session_establishment_accept._5gsmcause = sm_msg->pdu_session_establishment_accept._5gsmcause =
...@@ -253,7 +253,7 @@ bool smf_n1::create_n1_pdu_session_establishment_accept( ...@@ -253,7 +253,7 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
// DNN // DNN
sm_msg->pdu_session_establishment_accept.dnn = sm_msg->pdu_session_establishment_accept.dnn =
bfromcstralloc(sm_context_res.get_dnn().length() + 1, "\0"); bfromcstralloc(sm_context_res.get_dnn().length() + 1 + 2 + sizeof(".mnc011.mcc110.gprs"), "\0");
util::string_to_dnn( util::string_to_dnn(
sm_context_res.get_dnn(), sm_msg->pdu_session_establishment_accept.dnn); sm_context_res.get_dnn(), sm_msg->pdu_session_establishment_accept.dnn);
Logger::smf_n1().debug("DNN %s", sm_context_res.get_dnn().c_str()); Logger::smf_n1().debug("DNN %s", sm_context_res.get_dnn().c_str());
......
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