Commit 62847c81 authored by luhan Wang's avatar luhan Wang

Merge branch 'master' of http://git.opensource5g.org/openxg/amf

parents 135a390e c76cc89b
...@@ -604,7 +604,9 @@ void amf_n1::service_request_handle( ...@@ -604,7 +604,9 @@ void amf_n1::service_request_handle(
if(serReq->getNasMessageContainer(nas_container)){ if(serReq->getNasMessageContainer(nas_container)){
Logger::amf_n1().debug("try to get pdu-session-status value from nas message container(length: %d)", blength(nas_container)); Logger::amf_n1().debug("try to get pdu-session-status value from nas message container(length: %d)", blength(nas_container));
uint8_t *buf = (uint8_t*)bdata(nas_container); uint8_t *buf = (uint8_t*)bdata(nas_container);
pdu_session_status = buf[18]<<8 | buf[19]; ServiceRequest *tmp = new ServiceRequest();
tmp->decodefrombuffer(nullptr, (uint8_t*) bdata(nas_container), blength(nas_container));
pdu_session_status = tmp->getPduSessionStatus();
Logger::amf_n1().debug("Get pdu-session-status value: 0x%x", pdu_session_status); Logger::amf_n1().debug("Get pdu-session-status value: 0x%x", pdu_session_status);
} }
ServiceAccept* serApt = new ServiceAccept(); ServiceAccept* serApt = new ServiceAccept();
...@@ -673,7 +675,8 @@ void amf_n1::service_request_handle( ...@@ -673,7 +675,8 @@ void amf_n1::service_request_handle(
if(pdu_session_status == 0x00){ if(pdu_session_status == 0x00){
serApt->setPDU_session_status(0x0000); serApt->setPDU_session_status(0x0000);
}else{ }else{
serApt->setPDU_session_status(pdu_session_status); //serApt->setPDU_session_status(pdu_session_status);
serApt->setPDU_session_status(0x2000);
} }
serApt->setPDU_session_reactivation_result(0x0000); serApt->setPDU_session_reactivation_result(0x0000);
uint8_t buffer[BUFFER_SIZE_256]; uint8_t buffer[BUFFER_SIZE_256];
......
...@@ -86,30 +86,36 @@ int _5GSMobilityIdentity::_5g_s_tmsi_decodefrombuffer(uint8_t* buf, int len) { ...@@ -86,30 +86,36 @@ int _5GSMobilityIdentity::_5g_s_tmsi_decodefrombuffer(uint8_t* buf, int len) {
int decoded_size = 1; int decoded_size = 1;
_5g_s_tmsi = (_5G_S_TMSI_t*) calloc(1, sizeof(_5G_S_TMSI_t)); _5g_s_tmsi = (_5G_S_TMSI_t*) calloc(1, sizeof(_5G_S_TMSI_t));
uint8_t octet = *(buf + decoded_size); uint8_t octet = *(buf + decoded_size);
Logger::nas_mm().debug("first octet 0x%x",octet);
decoded_size++; decoded_size++;
_5g_s_tmsi->amf_set_id = 0x0000 | ((uint16_t) octet) << 2; _5g_s_tmsi->amf_set_id = 0x0000 | ((uint16_t) octet) << 2;
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("second octet 0x%x",octet);
decoded_size++; decoded_size++;
_5g_s_tmsi->amf_set_id |= (octet & 0xc0) >> 6; _5g_s_tmsi->amf_set_id |= (octet & 0xc0) >> 6;
_5g_s_tmsi->amf_pointer = octet & 0x3f; _5g_s_tmsi->amf_pointer = octet & 0x3f;
uint32_t tmsi = 0; uint32_t tmsi = 0;
uint8_t digit[4]; uint8_t digit[4];
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("third octet 0x%x",octet);
decoded_size++; decoded_size++;
Logger::nas_mm().debug("Octet 0x%x", octet); Logger::nas_mm().debug("Octet 0x%x", octet);
digit[0] = octet; digit[0] = octet;
tmsi |= octet; tmsi |= octet;
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("fourth octet 0x%x",octet);
decoded_size++; decoded_size++;
Logger::nas_mm().debug("Octet 0x%x", octet); Logger::nas_mm().debug("Octet 0x%x", octet);
digit[1] = octet; digit[1] = octet;
tmsi |= octet << 8; tmsi |= octet << 8;
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("fifth octet 0x%x",octet);
decoded_size++; decoded_size++;
Logger::nas_mm().debug("Octet 0x%x", octet); Logger::nas_mm().debug("Octet 0x%x", octet);
digit[2] = octet; digit[2] = octet;
tmsi |= octet << 16; tmsi |= octet << 16;
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("sixth octet 0x%x",octet);
decoded_size++; decoded_size++;
Logger::nas_mm().debug("Octet 0x%x", octet); Logger::nas_mm().debug("Octet 0x%x", octet);
digit[3] = octet; digit[3] = octet;
...@@ -497,6 +503,7 @@ int _5GSMobilityIdentity::decodefrombuffer( ...@@ -497,6 +503,7 @@ int _5GSMobilityIdentity::decodefrombuffer(
typeOfIdentity = _5G_S_TMSI; typeOfIdentity = _5G_S_TMSI;
decoded_size += decoded_size +=
_5g_s_tmsi_decodefrombuffer(buf + decoded_size, len - decoded_size); _5g_s_tmsi_decodefrombuffer(buf + decoded_size, len - decoded_size);
Logger::amf_n1().debug("Decoded 5GSMobilityIdentity %d octets",decoded_size);
return decoded_size; return decoded_size;
} break; } break;
} }
......
...@@ -35,6 +35,7 @@ using namespace nas; ...@@ -35,6 +35,7 @@ using namespace nas;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
ServiceRequest::ServiceRequest() { ServiceRequest::ServiceRequest() {
ie_nas_message_container = nullptr; ie_nas_message_container = nullptr;
ie_PDU_session_status = nullptr;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -195,7 +196,7 @@ int ServiceRequest::decodefrombuffer( ...@@ -195,7 +196,7 @@ int ServiceRequest::decodefrombuffer(
buf + decoded_size, len - decoded_size, false); buf + decoded_size, len - decoded_size, false);
uint8_t octet = *(buf + decoded_size); uint8_t octet = *(buf + decoded_size);
Logger::nas_mm().debug("First optional IE (0x%x)", octet); Logger::nas_mm().debug("First optional IE (0x%x)", octet);
while (!octet) { while (octet) {
switch (octet) { switch (octet) {
case 0x40: { case 0x40: {
Logger::nas_mm().debug("Decoding ie_uplink_data_status (IEI: 0x40)"); Logger::nas_mm().debug("Decoding ie_uplink_data_status (IEI: 0x40)");
......
...@@ -39,7 +39,7 @@ extern "C" { ...@@ -39,7 +39,7 @@ extern "C" {
#include <vector> #include <vector>
#include <iostream> #include <iostream>
#define SCTP_RECV_BUFFER_SIZE 1024 #define SCTP_RECV_BUFFER_SIZE 2048
#define SCTP_RC_ERROR -1 #define SCTP_RC_ERROR -1
#define SCTP_RC_NORMAL_READ 0 #define SCTP_RC_NORMAL_READ 0
#define SCTP_RC_DISCONNECT 1 #define SCTP_RC_DISCONNECT 1
......
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