open5gs/src/pgw/pgw_context.c

53 lines
1.1 KiB
C

#define TRACE_MODULE _pgw_context
#include "core_debug.h"
#include "core_pool.h"
#include "core_index.h"
#include "gtp_path.h"
#include "pgw_context.h"
static pgw_context_t self;
static int context_initiaized = 0;
status_t pgw_context_init()
{
d_assert(context_initiaized == 0, return CORE_ERROR,
"MME context already has been initialized");
memset(&self, 0, sizeof(pgw_context_t));
self.s5c_addr = inet_addr("127.0.0.1");
self.s5c_port = GTPV2_C_UDP_PORT + 3;
self.s5c_node.addr = inet_addr("127.0.0.1");
self.s5c_node.port = GTPV2_C_UDP_PORT + 2;
list_init(&self.s5c_node.local_list);
list_init(&self.s5c_node.remote_list);
self.s5u_addr = inet_addr("127.0.0.1");
self.s5u_port = GTPV1_U_UDP_PORT + 1;
self.s5u_node.addr = inet_addr("127.0.0.1");
self.s5u_node.port = GTPV1_U_UDP_PORT;
context_initiaized = 1;
return CORE_OK;
}
status_t pgw_context_final()
{
d_assert(context_initiaized == 1, return CORE_ERROR,
"HyperCell context already has been finalized");
context_initiaized = 0;
return CORE_OK;
}
pgw_context_t* pgw_self()
{
return &self;
}