Commit b9b60fb1 authored by liuyu's avatar liuyu

json

parent 1b1a7ea9
......@@ -1169,18 +1169,18 @@ void amf_n2::handle_itti_message(
{
nlohmann::json aggregation = {};
std::string hex_str;
for (int i = 0; i < BUFFER_SIZE_4096; ++i) {
for (int i = 0; i < encoded_size; ++i) {
char hex[3];
snprintf(hex, sizeof(hex), "%02X", buffer[i]);
hex_str += hex;
}
aggregation["buffer"] = hex_str;
aggregation["encoded"] = encoded_size;
aggregation["message_type_id"] = "0";
aggregation["message_type_id"] = "29";
// nas-> json
aggregation["ran_ue_ngap_id"] = unc.get()->ran_ue_ngap_id;
aggregation["amf_ue_ngap_id"] = unc.get()->amf_ue_ngap_id;
aggregation["ran_ue_ngap_id"] = itti_msg.ran_ue_ngap_id;
aggregation["amf_ue_ngap_id"] = itti_msg.amf_ue_ngap_id;
aggregation["assoc_id"] = (gc->sctp_assoc_id);
aggregation["stream"] = (unc->sctp_stream_send);
......
......@@ -106,15 +106,12 @@ void UdpSend_downlink(nlohmann::json aggregation,string ip,int port){
cAddr.sin_family = AF_INET; //协议类型 和socket函数第一个参数一致
cAddr.sin_addr.s_addr = inet_addr(ipAddr); //将字符串转整数
cAddr.sin_port = htons(port); //整数转整数 小端转大端
//3.通信
char temp[256];
int r;
int len = sizeof cAddr;
int sendNum;
sendNum = sendto(clientSocket,jsonData.c_str(), jsonData.length(),0,
(struct sockaddr*)&cAddr,len);
close(clientSocket);
gettimeofday(&time, NULL);
Logger::ngap().info("udpsend complete, ms: %ld\n", (time.tv_sec*1000 + time.tv_usec/1000));
}
//------------------------------------------------------------------------------
......
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