mirror of https://github.com/PentHertz/srsLTE.git
Added s1ap_tx_pdu function. This function will record to pcap if PCAP is enabled.
This commit is contained in:
parent
b89ad628e2
commit
151efc61d5
|
@ -67,6 +67,7 @@ public:
|
|||
|
||||
void delete_enb_ctx(int32_t assoc_id);
|
||||
|
||||
bool s1ap_tx_pdu(srslte::byte_buffer_t *pdu, struct sctp_sndrcvinfo *enb_sri);
|
||||
bool handle_s1ap_rx_pdu(srslte::byte_buffer_t *pdu, struct sctp_sndrcvinfo *enb_sri);
|
||||
bool handle_initiating_message(LIBLTE_S1AP_INITIATINGMESSAGE_STRUCT *msg, struct sctp_sndrcvinfo *enb_sri);
|
||||
bool handle_successful_outcome(LIBLTE_S1AP_SUCCESSFULOUTCOME_STRUCT *msg);
|
||||
|
|
|
@ -209,6 +209,22 @@ s1ap::enb_listen()
|
|||
return sock_fd;
|
||||
}
|
||||
|
||||
bool
|
||||
s1ap::s1ap_tx_pdu(srslte::byte_buffer_t *pdu, struct sctp_sndrcvinfo *enb_sri)
|
||||
{
|
||||
ssize_t n_sent = sctp_send(m_s1mme, pdu->msg, pdu->N_bytes, enb_sri, 0);
|
||||
if(n_sent == -1)
|
||||
{
|
||||
m_s1ap_log->console("Failed to send S1AP PDU.\n");
|
||||
m_s1ap_log->error("Failed to send S1AP PDU. \n");
|
||||
return false;
|
||||
}
|
||||
if(m_pcap_enable)
|
||||
{
|
||||
m_pcap.write_s1ap(pdu->msg,pdu->N_bytes);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
s1ap::handle_s1ap_rx_pdu(srslte::byte_buffer_t *pdu, struct sctp_sndrcvinfo *enb_sri)
|
||||
|
@ -251,6 +267,7 @@ s1ap::handle_initiating_message(LIBLTE_S1AP_INITIATINGMESSAGE_STRUCT *msg, stru
|
|||
{
|
||||
bool reply_flag = false;
|
||||
srslte::byte_buffer_t * reply_buffer = m_pool->allocate();
|
||||
bool ret = false;
|
||||
|
||||
switch(msg->choice_type) {
|
||||
case LIBLTE_S1AP_INITIATINGMESSAGE_CHOICE_S1SETUPREQUEST:
|
||||
|
@ -276,17 +293,10 @@ s1ap::handle_initiating_message(LIBLTE_S1AP_INITIATINGMESSAGE_STRUCT *msg, stru
|
|||
//Send Reply to eNB
|
||||
if(reply_flag == true)
|
||||
{
|
||||
ssize_t n_sent = sctp_send(m_s1mme,reply_buffer->msg, reply_buffer->N_bytes, enb_sri, 0);
|
||||
if(n_sent == -1)
|
||||
{
|
||||
m_s1ap_log->console("Failed to send S1AP Initiating Reply.\n");
|
||||
m_s1ap_log->error("Failed to send S1AP Initiating Reply. \n");
|
||||
m_pool->deallocate(reply_buffer);
|
||||
return false;
|
||||
}
|
||||
ret = s1ap_tx_pdu(reply_buffer, enb_sri);
|
||||
}
|
||||
m_pool->deallocate(reply_buffer);
|
||||
return true;
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -178,11 +178,9 @@ s1ap_ctx_mngmt_proc::send_initial_context_setup_request(ue_emm_ctx_t *emm_ctx,
|
|||
return false;
|
||||
}
|
||||
|
||||
//Send Reply to eNB
|
||||
ssize_t n_sent = sctp_send(s1mme,reply_buffer->msg, reply_buffer->N_bytes, &ecm_ctx->enb_sri, 0);
|
||||
if(n_sent == -1)
|
||||
if(!m_s1ap->s1ap_tx_pdu(reply_buffer,&ecm_ctx->enb_sri))
|
||||
{
|
||||
m_s1ap_log->error("Failed to send Initial Context Setup Request\n");
|
||||
m_s1ap_log->error("Error sending Initial Context Setup Request.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -345,14 +343,12 @@ s1ap_ctx_mngmt_proc::send_ue_context_release_command(ue_ecm_ctx_t *ecm_ctx, srsl
|
|||
return false;
|
||||
}
|
||||
//Send Reply to eNB
|
||||
int n_sent = sctp_send(s1mme,reply_buffer->msg, reply_buffer->N_bytes, &ecm_ctx->enb_sri, 0);
|
||||
if(n_sent == -1)
|
||||
if(!m_s1ap->s1ap_tx_pdu(reply_buffer,&ecm_ctx->enb_sri))
|
||||
{
|
||||
m_s1ap_log->error("Failed to send Initial Context Setup Request\n");
|
||||
m_s1ap_log->error("Error sending UE Context Release command.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue