gtp interface update

This commit is contained in:
Sukchan Lee
2019-05-28 14:47:06 +09:00
parent 244770de65
commit 7c1c320141
13 changed files with 41 additions and 74 deletions

View File

@@ -36,7 +36,7 @@ extern "C" {
/* This is default diameter configuration if there is no config file
* The Configuration : No TLS, Only TCP */
typedef struct _fd_config_t {
typedef struct fd_config_s {
/* Diameter Identity of the local peer (FQDN -- ASCII) */
const char *cnf_diamid;
/* Diameter realm of the local peer, default to realm part of cnf_diamid */

View File

@@ -36,11 +36,11 @@ int gtp_node_final(void)
return OGS_OK;
}
int gtp_create_node(gtp_node_t **node,
gtp_node_t *gtp_create_node(
ogs_sockaddr_t *all_list, int no_ipv4, int no_ipv6, int prefer_ipv4)
{
int rv;
gtp_node_t *new_node = NULL;
gtp_node_t *node = NULL;
ogs_sockaddr_t *preferred_list = NULL;
ogs_assert(all_list);
@@ -68,21 +68,18 @@ int gtp_create_node(gtp_node_t **node,
ogs_assert(rv == OGS_OK);
}
if (preferred_list)
{
ogs_pool_alloc(&pool, &new_node);
ogs_assert(new_node);
memset(new_node, 0, sizeof(gtp_node_t));
ogs_assert(preferred_list);
new_node->sa_list = preferred_list;
ogs_pool_alloc(&pool, &node);
ogs_assert(node);
memset(node, 0, sizeof(gtp_node_t));
ogs_list_init(&new_node->local_list);
ogs_list_init(&new_node->remote_list);
}
node->sa_list = preferred_list;
*node = new_node;
ogs_list_init(&node->local_list);
ogs_list_init(&node->remote_list);
return OGS_OK;
return node;
}
int gtp_delete_node(gtp_node_t *node)
@@ -114,15 +111,7 @@ gtp_node_t *gtp_add_node(ogs_list_t *list, gtp_f_teid_t *f_teid,
rv = gtp_f_teid_to_sockaddr(f_teid, port, &sa_list);
ogs_assert(rv == OGS_OK);
rv = gtp_create_node(&node, sa_list, no_ipv4, no_ipv6, prefer_ipv4);
ogs_assert(rv == OGS_OK);
if (node == NULL)
{
ogs_error("Invalid Parameter : "
"port[%d], no_ipv4[%d], no_ipv6[%d], prefer_ipv4[%d]",
port, no_ipv4, no_ipv6, prefer_ipv4);
return NULL;
}
node = gtp_create_node(sa_list, no_ipv4, no_ipv6, prefer_ipv4);
ogs_list_add(list, node);
rv = gtp_f_teid_to_ip(f_teid, &node->ip);

View File

@@ -36,7 +36,7 @@ extern "C" {
/**
* This structure represents the commonalities of GTP node such as MME, SGW,
* PGW gateway. Some of members may not be used by the specific type of node */
typedef struct _gtp_node_t {
typedef struct gtp_node_s {
ogs_lnode_t node; /* A node of list_t */
ogs_sockaddr_t *sa_list; /* Socket Address List */
@@ -52,7 +52,7 @@ typedef struct _gtp_node_t {
int gtp_node_init(void);
int gtp_node_final(void);
int gtp_create_node(gtp_node_t **node,
gtp_node_t *gtp_create_node(
ogs_sockaddr_t *all_list, int no_ipv4, int no_ipv6, int prefer_ipv4);
int gtp_delete_node(gtp_node_t *node);

View File

@@ -20,7 +20,7 @@
#ifndef __GTP_PATH_H__
#define __GTP_PATH_H__
typedef struct _gtp_node_t gtp_node_t;
typedef struct gtp_node_s gtp_node_t;
#ifdef __cplusplus
extern "C" {

View File

@@ -50,7 +50,7 @@ typedef enum {
TLV_MESSAGE,
} tlv_type_e;
typedef struct _tlv_desc_t {
typedef struct tlv_desc_s {
tlv_type_e ctype;
char *name;
uint16_t type;
@@ -72,49 +72,49 @@ extern tlv_desc_t tlv_desc_more8;
typedef uint64_t tlv_presence_t;
/* 8-bit Unsigned integer */
typedef struct _tlv_uint8_t {
typedef struct tlv_uint8_s {
tlv_presence_t presence;
uint8_t u8;
} tlv_uint8_t;
/* 16-bit Unsigned integer */
typedef struct _tlv_uint16_t {
typedef struct tlv_uint16_s {
tlv_presence_t presence;
uint16_t u16;
} tlv_uint16_t;
/* 24-bit Unsigned integer */
typedef struct _tlv_uint24_t {
typedef struct tlv_uint24_s {
tlv_presence_t presence;
uint32_t u24; /* Only 3 bytes valid */
} tlv_uint24_t;
/* 32-bit Unsigned integer */
typedef struct _tlv_uint32_t {
typedef struct tlv_uint32_s {
tlv_presence_t presence;
uint32_t u32;
} tlv_uint32_t;
/* 8-bit Signed integer */
typedef struct _tlv_int8_t {
typedef struct tlv_int8_s {
tlv_presence_t presence;
int8_t i8;
} tlv_int8_t;
/* 16-bit Signed integer */
typedef struct _tlv_int16t {
typedef struct tlv_int16_s {
tlv_presence_t presence;
int16_t i16;
} tlv_int16_t;
/* 24-bit Signed integer */
typedef struct _tlv_int24_t {
typedef struct tlv_int24_s {
tlv_presence_t presence;
int32_t i24; /* Only 3 bytes valid */
} tlv_int24_t;
/* 32-bit Signed integer */
typedef struct _tlv_int32_t {
typedef struct tlv_int32_s {
tlv_presence_t presence;
int32_t i32;
} tlv_int32_t;
@@ -142,14 +142,14 @@ typedef struct _tlv_int32_t {
(__dST)->data = ogs_calloc((__dST)->len, sizeof(uint8_t)); \
memcpy((__dST)->data, (__sRC)->data, (__dST)->len); \
} while(0)
typedef struct _tlv_octet_t {
typedef struct tlv_octet_s {
tlv_presence_t presence;
void *data;
uint32_t len;
} tlv_octet_t;
/* No value */
typedef struct _tlv_null {
typedef struct tlv_null_s {
tlv_presence_t presence;
} tlv_null_t;

View File

@@ -26,12 +26,12 @@
extern "C" {
#endif /* __cplusplus */
typedef struct _gtp_node_t gtp_node_t;
typedef struct gtp_node_s gtp_node_t;
/**
* Transaction context
*/
typedef struct _gtp_xact_t {
typedef struct gtp_xact_s {
ogs_lnode_t node; /**< A node of list */
ogs_index_t index;
@@ -57,7 +57,7 @@ typedef struct _gtp_xact_t {
ogs_timer_t *tm_holding; /**< Timer waiting for holding message */
uint8_t holding_rcount;
struct _gtp_xact_t *assoc_xact; /**< Associated transaction */
struct gtp_xact_s *assoc_xact; /**< Associated transaction */
#define GTP_XACT_STORE_SESSION(xact, session) \
do { \

View File

@@ -27,7 +27,7 @@ typedef struct _hss_db_auth_info_t {
uint64_t sqn;
} hss_db_auth_info_t;
typedef struct _fd_config_t fd_config_t;
typedef struct fd_config_s fd_config_t;
typedef struct _hss_context_t {
const char *fd_conf_path; /* HSS freeDiameter conf path */
fd_config_t *fd_config; /* HSS freeDiameter config */

View File

@@ -1234,8 +1234,6 @@ int mme_context_parse_config()
context_self()->config.parameter.no_ipv4,
context_self()->config.parameter.no_ipv6,
context_self()->config.parameter.prefer_ipv4);
ogs_assert(sgw);
sgw->num_of_tac = num_of_tac;
if (num_of_tac != 0)
memcpy(sgw->tac, tac, sizeof(sgw->tac));
@@ -1352,7 +1350,6 @@ int mme_context_parse_config()
context_self()->config.parameter.no_ipv4,
context_self()->config.parameter.no_ipv6,
context_self()->config.parameter.prefer_ipv4);
ogs_assert(pgw);
pgw->apn = apn;
ogs_freeaddrinfo(list);
@@ -1372,7 +1369,6 @@ int mme_context_parse_config()
mme_sgw_t *mme_sgw_add(
ogs_sockaddr_t *all_list, int no_ipv4, int no_ipv6, int prefer_ipv4)
{
int rv;
mme_sgw_t *sgw = NULL;
ogs_assert(all_list);
@@ -1381,16 +1377,7 @@ mme_sgw_t *mme_sgw_add(
ogs_assert(sgw);
memset(sgw, 0, sizeof *sgw);
rv = gtp_create_node(&sgw->gnode, all_list, no_ipv4, no_ipv6, prefer_ipv4);
ogs_assert(rv == OGS_OK);
if (sgw->gnode == NULL)
{
ogs_error("Invalid Parameter : "
"no_ipv4[%d], no_ipv6[%d], prefer_ipv4[%d]",
no_ipv4, no_ipv6, prefer_ipv4);
return NULL;
}
sgw->gnode = gtp_create_node(all_list, no_ipv4, no_ipv6, prefer_ipv4);
ogs_list_add(&self.sgw_list, sgw);
return sgw;
@@ -1422,7 +1409,6 @@ void mme_sgw_remove_all()
mme_pgw_t *mme_pgw_add(
ogs_sockaddr_t *all_list, int no_ipv4, int no_ipv6, int prefer_ipv4)
{
int rv;
mme_pgw_t *pgw = NULL;
ogs_assert(all_list);
@@ -1430,15 +1416,7 @@ mme_pgw_t *mme_pgw_add(
ogs_pool_alloc(&mme_pgw_pool, &pgw);
ogs_assert(pgw);
rv = gtp_create_node(&pgw->gnode, all_list, no_ipv4, no_ipv6, prefer_ipv4);
ogs_assert(rv == OGS_OK);
if (pgw->gnode == NULL) {
ogs_error("Invalid Parameter : "
"no_ipv4[%d], no_ipv6[%d], prefer_ipv4[%d]",
no_ipv4, no_ipv6, prefer_ipv4);
return NULL;
}
pgw->gnode = gtp_create_node(all_list, no_ipv4, no_ipv6, prefer_ipv4);
ogs_list_add(&self.pgw_list, pgw);
return pgw;

View File

@@ -39,10 +39,10 @@ typedef struct mme_pgw_s mme_pgw_t;
typedef struct enb_ue_s enb_ue_t;
typedef struct mme_ue_s mme_ue_t;
typedef struct _gtp_node_t gtp_node_t;
typedef struct _gtp_xact_t gtp_xact_t;
typedef struct gtp_node_s gtp_node_t;
typedef struct gtp_xact_s gtp_xact_t;
typedef struct _fd_config_t fd_config_t;
typedef struct fd_config_s fd_config_t;
typedef uint32_t mme_m_tmsi_t;

View File

@@ -12,10 +12,10 @@ extern int __pcrf_log_domain;
#undef OGS_LOG_DOMAIN
#define OGS_LOG_DOMAIN __pcrf_log_domain
typedef struct _fd_config_t fd_config_t;
typedef struct fd_config_s fd_config_t;
struct session;
typedef struct _pcrf_context_t {
typedef struct pcrf_context_s {
const char *fd_conf_path; /* PCRF freeDiameter conf path */
fd_config_t *fd_config; /* PCRF freeDiameter config */

View File

@@ -16,8 +16,8 @@ extern int __pgw_log_domain;
#undef OGS_LOG_DOMAIN
#define OGS_LOG_DOMAIN __pgw_log_domain
typedef struct _gtp_node_t gtp_node_t;
typedef struct _fd_config_t fd_config_t;
typedef struct gtp_node_s gtp_node_t;
typedef struct fd_config_s fd_config_t;
typedef struct _pgw_context_t {
const char* fd_conf_path; /* PGW freeDiameter conf path */

View File

@@ -7,7 +7,7 @@
extern "C" {
#endif /* __cplusplus */
typedef struct _gtp_xact_t gtp_xact_t;
typedef struct gtp_xact_s gtp_xact_t;
int pgw_fd_init(void);
void pgw_fd_final(void);

View File

@@ -17,7 +17,7 @@ extern int __sgw_log_domain;
#define OGS_LOG_DOMAIN __sgw_log_domain
typedef struct _sgw_tunnel_t sgw_tunnel_t;
typedef struct _gtp_node_t gtp_node_t;
typedef struct gtp_node_s gtp_node_t;
typedef struct _sgw_context_t {
uint32_t gtpc_port; /* Default GTPC port */