forked from acouzens/open5gs
update it
This commit is contained in:
parent
120716eeeb
commit
83830a9411
|
@ -128,6 +128,7 @@ static char EVT_NAME_LO_ENB_S1AP_CONNREFUSED[] = "LO_ENB_S1AP_CONNREFUSED";
|
|||
|
||||
static char EVT_NAME_MSG_ENB_S1AP[] = "MSG_ENB_S1AP";
|
||||
static char EVT_NAME_MSG_UE_EMM[] = "MSG_UE_EMM";
|
||||
static char EVT_NAME_MSG_MME_S11[] = "MSG_MME_S11";
|
||||
|
||||
static char EVT_NAME_UNKNOWN[] = "UNKNOWN";
|
||||
|
||||
|
@ -152,6 +153,8 @@ char* event_get_name(event_t *e)
|
|||
return EVT_NAME_MSG_ENB_S1AP;
|
||||
case EVT_MSG_UE_EMM:
|
||||
return EVT_NAME_MSG_UE_EMM;
|
||||
case EVT_MSG_MME_S11:
|
||||
return EVT_NAME_MSG_MME_S11;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -20,6 +20,7 @@ typedef enum {
|
|||
|
||||
EVT_MSG_ENB_S1AP,
|
||||
EVT_MSG_UE_EMM,
|
||||
EVT_MSG_MME_S11,
|
||||
|
||||
EVT_TOP,
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "context.h"
|
||||
#include "event.h"
|
||||
#include "s1ap_path.h"
|
||||
#include "s11_path.h"
|
||||
|
||||
void mme_state_initial(mme_sm_t *s, event_t *e)
|
||||
{
|
||||
|
@ -41,6 +42,12 @@ void mme_state_operational(mme_sm_t *s, event_t *e)
|
|||
d_error("Can't establish S1AP path");
|
||||
break;
|
||||
}
|
||||
rv = mme_s11_open();
|
||||
if (rv != CORE_OK)
|
||||
{
|
||||
d_error("Can't establish S11 path");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case FSM_EXIT_SIG:
|
||||
|
@ -51,6 +58,12 @@ void mme_state_operational(mme_sm_t *s, event_t *e)
|
|||
d_error("Can't close S1AP path");
|
||||
break;
|
||||
}
|
||||
rv = mme_s11_close();
|
||||
if (rv != CORE_OK)
|
||||
{
|
||||
d_error("Can't close S11 path");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EVT_LO_ENB_S1AP_ACCEPT:
|
||||
|
@ -117,6 +130,14 @@ void mme_state_operational(mme_sm_t *s, event_t *e)
|
|||
|
||||
break;
|
||||
}
|
||||
case EVT_MSG_MME_S11:
|
||||
{
|
||||
net_sock_t *sock = (net_sock_t *)event_get_param1(e);
|
||||
d_assert(sock, break, "Null param");
|
||||
|
||||
d_info("EVT_MSG_MME_S11 received");
|
||||
break;
|
||||
}
|
||||
case EVT_LO_ENB_S1AP_CONNREFUSED:
|
||||
{
|
||||
net_sock_t *sock = (net_sock_t *)event_get_param1(e);
|
||||
|
|
|
@ -4,19 +4,54 @@
|
|||
#include "core_net.h"
|
||||
|
||||
#include "3gpp_message.h"
|
||||
#include "gtp_path.h"
|
||||
|
||||
#include "context.h"
|
||||
#include "s11_path.h"
|
||||
|
||||
static int _mme_s11_recv_cb(net_sock_t *net_sock, void *data)
|
||||
{
|
||||
event_t e;
|
||||
int rc;
|
||||
pkbuf_t *pkbuf = NULL;
|
||||
d_assert(net_sock, return -1, "Null param");
|
||||
|
||||
pkbuf = gtp_read(net_sock);
|
||||
if (pkbuf == NULL)
|
||||
{
|
||||
if (net_sock->sndrcv_errno == EAGAIN)
|
||||
return 0;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
d_trace(1, "S11_PDU is received from SGW\n");
|
||||
d_trace_hex(1, pkbuf->payload, pkbuf->len);
|
||||
|
||||
event_set(&e, EVT_MSG_MME_S11);
|
||||
event_set_param1(&e, (c_uintptr_t)net_sock);
|
||||
event_set_param2(&e, (c_uintptr_t)pkbuf);
|
||||
|
||||
rc = event_send(mme_self()->queue_id, &e);
|
||||
if (rc <= 0)
|
||||
return rc;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
status_t mme_s11_open()
|
||||
{
|
||||
return CORE_OK;
|
||||
return gtp_open(&mme_self()->s11_sock, _mme_s11_recv_cb, NULL,
|
||||
mme_self()->sgw_remote_addr, mme_self()->s11_local_port);
|
||||
}
|
||||
|
||||
status_t mme_s11_close()
|
||||
{
|
||||
return CORE_OK;
|
||||
return gtp_close(mme_self()->s11_sock);
|
||||
}
|
||||
|
||||
status_t mme_s11_send_to_sgw(pkbuf_t *pkbuf)
|
||||
{
|
||||
return CORE_OK;
|
||||
return gtp_send(mme_self()->s11_sock, pkbuf,
|
||||
mme_self()->sgw_remote_addr, mme_self()->s11_remote_port);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue