Commit 094d85e1 authored by liuyu's avatar liuyu

json

parent 75ff49e5
......@@ -740,9 +740,10 @@ smf_procedure_code session_create_sm_context_procedure::run(
Logger::smf_app().info("-----------------udpsend",sm_context_req->scid);
nlohmann::json udpsmfcontext;
udpsmfcontext["scid"] = sm_context_req->scid;
udpsmfcontext["supi"] = smf_supi_to_string(scf.get()->supi);
udpsmfcontext["pdu_session_id"] = scf.get()->pdu_session_id;
UdpSend_smf(udpsmfcontext,"10.103.239.31", 2023);
UdpSend_smf(udpsmfcontext,"10.103.239.31", 20023);
return send_n4_session_establishment_request();
......
......@@ -154,16 +154,32 @@ int udp_server_coop::udp_read_from_peer_smf() {
printf("smf receive context from ground smf\n");
std::string received_data(reinterpret_cast<char*>(udp_recv), bytes_received);
nlohmann::json smfcontext = nlohmann::json::parse(received_data);
supi_t supi = {.length = 0};
scid_t scid = smfcontext["scid"];
if (!smf_app_inst->is_scid_2_smf_context(scid)) {
Logger::smf_app().warn("SM Context associated with this id " SCID_FMT " does not exit!", scid);
std::shared_ptr<smf_context_ref> scf = std::shared_ptr<smf_context_ref>(new smf_context_ref());
// supi_t supi = smreq->req.get_supi();
// scf.get()->supi = smfcontext["supi"];
std::string supiudp = smfcontext["supi"];
smf_string_to_supi(&supi, supiudp.c_str());
scf.get()->supi = supi;
scf.get()->pdu_session_id = smfcontext["pdu_session_id"];
smf_app_inst->set_scid_2_smf_context(scid, scf);
}
supi64_t supi64 = smf_supi_to_u64(supi);
std::shared_ptr<smf_context> sc = {};
if (!is_supi_2_smf_context(supi64)) {
Logger::smf_app().debug(
"Create a new SMF context with SUPI " SUPI_64_FMT "", supi64);
sc = std::shared_ptr<smf_context>(new smf_context());
sc.get()->set_supi(supi);
sc.get()->set_supi_prefix(supi_prefix);
set_supi_2_smf_context(supi64, sc);
sc.get()->set_plmn(smreq->req.get_plmn()); // PLMN
}
}
}
......
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