Commit c6bcfb9e authored by liuyu's avatar liuyu

edge amf->dege smf-> center amf->edge smf -> edge amf is ok

parent 17dee6c9
......@@ -132,9 +132,9 @@ class ngap_app : public sctp_application {
* @return void
*/
void remove_gnb_context(const long& gnb_id);
sctp_server sctp_s_38412;
protected:
sctp_server sctp_s_38412;
uint32_t ppid_;
std::map<sctp_assoc_id_t, std::shared_ptr<gnb_context>> assoc2gnbContext;
mutable std::shared_mutex m_assoc2gnbContext;
......
......@@ -23,10 +23,13 @@
#include "bstrlib.h"
#include "sstream"
#include "amf_n2.hpp"
#include "sctp_server.hpp"
extern "C" {
#include "Ngap_InitiatingMessage.h"
#include "Ngap_NGAP-PDU.h"
}
using namespace amf_application;
using namespace ngap;
using namespace std;
extern amf_n2 *amf_n2_inst;
bool priority = true;
......@@ -188,6 +191,17 @@ void udp_server::handle_receive_udp(int r,uint8_t udp_recv[]){
if(priority==true)
{
Logger::ngap().info("synchronize context");
sctp_stream_id_t stream;
sctp_assoc_id_t assoc_id;
assoc_id = udp_recv[r-2];
stream = udp_recv[r-1];
uint8_t buffer[2048];
for(int i=0;i<r-2;i++){
buffer[i] = udp_recv[i];
}
bstring b = blk2bstr(buffer, r-2);
amf_n2_inst->sctp_s_38412.sctp_send_msg(assoc_id, stream, &b);
}
else{
......@@ -231,22 +245,6 @@ void udp_server::handle_receive_udp(int r,uint8_t udp_recv[]){
amf_n2_inst->handle_sctp_new_association(assoc_id,10,8);
}
ngap_app("0",0).handle_receive(payload,assoc_id,stream,0,0,buffer,r-2);
// Ngap_NGAP_PDU_t* ngap_msg_pdu =
// (Ngap_NGAP_PDU_t*) calloc(1, sizeof(Ngap_NGAP_PDU_t));
// Logger::ngap().info("start decode");
// asn_dec_rval_t rc = asn_decode(
// NULL, ATS_ALIGNED_CANONICAL_PER, &asn_DEF_Ngap_NGAP_PDU,
// (void**) &ngap_msg_pdu, bdata(payload), blength(payload));
// Logger::ngap().debug(
// "Decoded UDP message, procedure code %d, present %d",
// ngap_msg_pdu->choice.initiatingMessage->procedureCode,
// ngap_msg_pdu->present);
// asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, ngap_msg_pdu);
// (*messages_callback[ngap_msg_pdu->choice.initiatingMessage->procedureCode]
// [ngap_msg_pdu->present - 1])(
// assoc_id, stream, ngap_msg_pdu);
}
......
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