Commit 76826d58 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

various small updates

parent a45fb135
......@@ -186,8 +186,8 @@ void IndividualSMContextApi::update_sm_context_handler(const Pistache::Rest::Req
unsigned int str_len = request.body().length();
unsigned char *data = (unsigned char *)malloc(str_len + 1);
memset(data,0,str_len + 1);
memcpy ((void *)data, (void *)request.body().c_str(),str_len);
memset(data, 0, str_len + 1);
memcpy ((void *)data, (void *)request.body().c_str(), str_len);
//if ((multipartparser_execute(&parser, &g_callbacks, request.body().c_str(), strlen(request.body().c_str())) != strlen(request.body().c_str())) or (!g_body_begin_called)){
if ((multipartparser_execute(&parser, &g_callbacks, reinterpret_cast<const char*>(data), str_len) != strlen(request.body().c_str())) or (!g_body_begin_called)){
......@@ -242,7 +242,7 @@ void IndividualSMContextApi::update_sm_context_handler(const Pistache::Rest::Req
return;
} catch (std::exception &e) {
//send a 500 error
Logger::smf_api_server().warn("Error (%s ), Send a msg with a 500 error code to AMF", e.what());
Logger::smf_api_server().warn("Error (%s ), send a msg with a 500 error code to AMF", e.what());
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
return;
}
......
......@@ -88,7 +88,6 @@ void IndividualSMContextApiImpl::update_sm_context(const std::string &smContextR
Logger::smf_api_server().info("Received a PDUSession_UpdateSMContext Request from AMF.");
smf::pdu_session_update_sm_context_request sm_context_req_msg = {};
SmContextUpdateData smContextUpdateData = smContextUpdateMessage.getJsonData();
if (smContextUpdateData.n2SmInfoIsSet()){
......
......@@ -78,7 +78,6 @@ typedef struct s_nssai // section 28.4, TS23.003
typedef uint8_t pdu_session_id;
//should move to 24.501
enum pdu_session_type_e {
PDU_SESSION_TYPE_E_UNKNOWN = 0,
PDU_SESSION_TYPE_E_IPV4 = 1,
......@@ -142,11 +141,16 @@ enum class session_management_procedures_type_e {
SERVICE_REQUEST_UE_TRIGGERED_STEP1 = 1,
SERVICE_REQUEST_UE_TRIGGERED_STEP2 = 2,
SERVICE_REQUEST_NETWORK_TRIGGERED = 3,
PDU_SESSION_MODIFICATION_UE_INITIATED = 4,
PDU_SESSION_MODIFICATION_SMF_REQUESTED = 5,
PDU_SESSION_MODIFICATION_AN_REQUESTED = 6,
PDU_SESSION_RELEASE_UE_REQUESTED = 7,
PDU_SESSION_RELEASE_NETWORK_REQUESTED = 8
PDU_SESSION_MODIFICATION_UE_INITIATED_STEP1 = 4,
PDU_SESSION_MODIFICATION_UE_INITIATED_STEP2 = 5,
PDU_SESSION_MODIFICATION_UE_INITIATED_STEP3 = 6,
PDU_SESSION_MODIFICATION_SMF_REQUESTED = 7,
PDU_SESSION_MODIFICATION_AN_REQUESTED = 8,
PDU_SESSION_RELEASE_UE_REQUESTED_STEP1 = 9,
PDU_SESSION_RELEASE_UE_REQUESTED_STEP2 = 10,
PDU_SESSION_RELEASE_UE_REQUESTED_STEP3 = 11,
PDU_SESSION_RELEASE_NETWORK_REQUESTED = 12,
PDU_SESSION_TEST = 13
};
static const std::vector<std::string> session_management_procedures_type_e2str = {
......@@ -154,10 +158,14 @@ static const std::vector<std::string> session_management_procedures_type_e2str =
"SERVICE_REQUEST_UE_TRIGGERED_STEP1",
"SERVICE_REQUEST_UE_TRIGGERED_STEP2",
"SERVICE_REQUEST_NETWORK_TRIGGERED",
"PDU_SESSION_MODIFICATION_UE_INITIATED",
"PDU_SESSION_MODIFICATION_UE_INITIATED_STEP1",
"PDU_SESSION_MODIFICATION_UE_INITIATED_STEP2",
"PDU_SESSION_MODIFICATION_UE_INITIATED_STEP3",
"PDU_SESSION_MODIFICATION_SMF_REQUESTED",
"PDU_SESSION_MODIFICATION_AN_REQUESTED",
"PDU_SESSION_RELEASE_UE_REQUESTED",
"PDU_SESSION_RELEASE_UE_REQUESTED_STEP1",
"PDU_SESSION_RELEASE_UE_REQUESTED_STEP2",
"PDU_SESSION_RELEASE_UE_REQUESTED_STEP3",
"PDU_SESSION_RELEASE_NETWORK_REQUESTED"
};
......@@ -169,16 +177,34 @@ typedef struct qos_profile_gbr_s {
// Maximum Packet Loss Rate (UL/DL)
} qos_profile_gbr_t;
//
enum class qos_profile_type_e {
NON_GBR = 0,
GBR = 1
};
//See Section 5.7.2@3GPP TS 23.501
typedef struct qos_profile_s {
uint8_t _5qi;
arp_5gc_t arp;
//union flow_bit_rate_type{
// reflective_qos_attribute_e rqa; //Reflective QoS Attribute (RQA)
// qos_profile_gbr_t qos_profile_gbr; //Attributes for GBR
// };
uint8_t priority_level;
qos_profile_type_e profile_type;
union parameter{
reflective_qos_attribute_e rqa; //Reflective QoS Attribute (RQA)
qos_profile_gbr_t qos_profile_gbr; //Attributes for GBR
};
} qos_profile_t;
enum class multipart_related_content_part_e {
JSON = 0,
NAS = 1,
NGAP = 2
};
static const std::vector<std::string> multipart_related_content_part_e2str = {
"JSON",
"NAS",
"NGAP"
};
#endif
......@@ -44,6 +44,13 @@
#define IPV4_ADDR_DISPLAY_8(aDDRESS) \
(aDDRESS)[0], (aDDRESS)[1], (aDDRESS)[2], (aDDRESS)[3]
/* Convert an integer on 32 bits to the given bUFFER */
#define INT32_TO_BUFFER(x, buf) \
(buf)[0] = (x) >> 24, \
(buf)[1] = (x) >> 16, \
(buf)[2] = (x) >> 8, \
(buf)[3] = (x)
class conv {
public:
......
......@@ -72,7 +72,7 @@ void send_pdu_session_establishment_request()
std::cout << "[AMF N11] PDU Session Establishment Request"<<std::endl;
nlohmann::json pdu_session_establishment_request;
std::string n1_msg = "2e0101c1ffff95";
std::string n1_msg = "2e0101c1ffff91";
std::string n2_msg;
//format string as hex
......@@ -433,9 +433,9 @@ int main(int argc, char* argv[])
{
send_pdu_session_establishment_request();
usleep(10000);
//send_pdu_session_update_sm_context_establishment();
send_pdu_session_update_sm_context_modification();
usleep(100000);
send_pdu_session_update_sm_context_establishment();
//send_pdu_session_update_sm_context_modification();
return 0;
}
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