mirror of
https://github.com/open5gs/open5gs.git
synced 2025-11-03 05:23:38 +00:00
gtp interface update
This commit is contained in:
@@ -36,7 +36,7 @@ extern "C" {
|
|||||||
|
|
||||||
/* This is default diameter configuration if there is no config file
|
/* This is default diameter configuration if there is no config file
|
||||||
* The Configuration : No TLS, Only TCP */
|
* The Configuration : No TLS, Only TCP */
|
||||||
typedef struct _fd_config_t {
|
typedef struct fd_config_s {
|
||||||
/* Diameter Identity of the local peer (FQDN -- ASCII) */
|
/* Diameter Identity of the local peer (FQDN -- ASCII) */
|
||||||
const char *cnf_diamid;
|
const char *cnf_diamid;
|
||||||
/* Diameter realm of the local peer, default to realm part of cnf_diamid */
|
/* Diameter realm of the local peer, default to realm part of cnf_diamid */
|
||||||
|
|||||||
@@ -36,11 +36,11 @@ int gtp_node_final(void)
|
|||||||
return OGS_OK;
|
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)
|
ogs_sockaddr_t *all_list, int no_ipv4, int no_ipv6, int prefer_ipv4)
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
gtp_node_t *new_node = NULL;
|
gtp_node_t *node = NULL;
|
||||||
ogs_sockaddr_t *preferred_list = NULL;
|
ogs_sockaddr_t *preferred_list = NULL;
|
||||||
|
|
||||||
ogs_assert(all_list);
|
ogs_assert(all_list);
|
||||||
@@ -68,21 +68,18 @@ int gtp_create_node(gtp_node_t **node,
|
|||||||
ogs_assert(rv == OGS_OK);
|
ogs_assert(rv == OGS_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preferred_list)
|
ogs_assert(preferred_list);
|
||||||
{
|
|
||||||
ogs_pool_alloc(&pool, &new_node);
|
|
||||||
ogs_assert(new_node);
|
|
||||||
memset(new_node, 0, sizeof(gtp_node_t));
|
|
||||||
|
|
||||||
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);
|
node->sa_list = preferred_list;
|
||||||
ogs_list_init(&new_node->remote_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)
|
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);
|
rv = gtp_f_teid_to_sockaddr(f_teid, port, &sa_list);
|
||||||
ogs_assert(rv == OGS_OK);
|
ogs_assert(rv == OGS_OK);
|
||||||
|
|
||||||
rv = gtp_create_node(&node, sa_list, no_ipv4, no_ipv6, prefer_ipv4);
|
node = gtp_create_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;
|
|
||||||
}
|
|
||||||
ogs_list_add(list, node);
|
ogs_list_add(list, node);
|
||||||
|
|
||||||
rv = gtp_f_teid_to_ip(f_teid, &node->ip);
|
rv = gtp_f_teid_to_ip(f_teid, &node->ip);
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ extern "C" {
|
|||||||
/**
|
/**
|
||||||
* This structure represents the commonalities of GTP node such as MME, SGW,
|
* 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 */
|
* 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_lnode_t node; /* A node of list_t */
|
||||||
|
|
||||||
ogs_sockaddr_t *sa_list; /* Socket Address List */
|
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_init(void);
|
||||||
int gtp_node_final(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);
|
ogs_sockaddr_t *all_list, int no_ipv4, int no_ipv6, int prefer_ipv4);
|
||||||
int gtp_delete_node(gtp_node_t *node);
|
int gtp_delete_node(gtp_node_t *node);
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
#ifndef __GTP_PATH_H__
|
#ifndef __GTP_PATH_H__
|
||||||
#define __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
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ typedef enum {
|
|||||||
TLV_MESSAGE,
|
TLV_MESSAGE,
|
||||||
} tlv_type_e;
|
} tlv_type_e;
|
||||||
|
|
||||||
typedef struct _tlv_desc_t {
|
typedef struct tlv_desc_s {
|
||||||
tlv_type_e ctype;
|
tlv_type_e ctype;
|
||||||
char *name;
|
char *name;
|
||||||
uint16_t type;
|
uint16_t type;
|
||||||
@@ -72,49 +72,49 @@ extern tlv_desc_t tlv_desc_more8;
|
|||||||
typedef uint64_t tlv_presence_t;
|
typedef uint64_t tlv_presence_t;
|
||||||
|
|
||||||
/* 8-bit Unsigned integer */
|
/* 8-bit Unsigned integer */
|
||||||
typedef struct _tlv_uint8_t {
|
typedef struct tlv_uint8_s {
|
||||||
tlv_presence_t presence;
|
tlv_presence_t presence;
|
||||||
uint8_t u8;
|
uint8_t u8;
|
||||||
} tlv_uint8_t;
|
} tlv_uint8_t;
|
||||||
|
|
||||||
/* 16-bit Unsigned integer */
|
/* 16-bit Unsigned integer */
|
||||||
typedef struct _tlv_uint16_t {
|
typedef struct tlv_uint16_s {
|
||||||
tlv_presence_t presence;
|
tlv_presence_t presence;
|
||||||
uint16_t u16;
|
uint16_t u16;
|
||||||
} tlv_uint16_t;
|
} tlv_uint16_t;
|
||||||
|
|
||||||
/* 24-bit Unsigned integer */
|
/* 24-bit Unsigned integer */
|
||||||
typedef struct _tlv_uint24_t {
|
typedef struct tlv_uint24_s {
|
||||||
tlv_presence_t presence;
|
tlv_presence_t presence;
|
||||||
uint32_t u24; /* Only 3 bytes valid */
|
uint32_t u24; /* Only 3 bytes valid */
|
||||||
} tlv_uint24_t;
|
} tlv_uint24_t;
|
||||||
|
|
||||||
/* 32-bit Unsigned integer */
|
/* 32-bit Unsigned integer */
|
||||||
typedef struct _tlv_uint32_t {
|
typedef struct tlv_uint32_s {
|
||||||
tlv_presence_t presence;
|
tlv_presence_t presence;
|
||||||
uint32_t u32;
|
uint32_t u32;
|
||||||
} tlv_uint32_t;
|
} tlv_uint32_t;
|
||||||
|
|
||||||
/* 8-bit Signed integer */
|
/* 8-bit Signed integer */
|
||||||
typedef struct _tlv_int8_t {
|
typedef struct tlv_int8_s {
|
||||||
tlv_presence_t presence;
|
tlv_presence_t presence;
|
||||||
int8_t i8;
|
int8_t i8;
|
||||||
} tlv_int8_t;
|
} tlv_int8_t;
|
||||||
|
|
||||||
/* 16-bit Signed integer */
|
/* 16-bit Signed integer */
|
||||||
typedef struct _tlv_int16t {
|
typedef struct tlv_int16_s {
|
||||||
tlv_presence_t presence;
|
tlv_presence_t presence;
|
||||||
int16_t i16;
|
int16_t i16;
|
||||||
} tlv_int16_t;
|
} tlv_int16_t;
|
||||||
|
|
||||||
/* 24-bit Signed integer */
|
/* 24-bit Signed integer */
|
||||||
typedef struct _tlv_int24_t {
|
typedef struct tlv_int24_s {
|
||||||
tlv_presence_t presence;
|
tlv_presence_t presence;
|
||||||
int32_t i24; /* Only 3 bytes valid */
|
int32_t i24; /* Only 3 bytes valid */
|
||||||
} tlv_int24_t;
|
} tlv_int24_t;
|
||||||
|
|
||||||
/* 32-bit Signed integer */
|
/* 32-bit Signed integer */
|
||||||
typedef struct _tlv_int32_t {
|
typedef struct tlv_int32_s {
|
||||||
tlv_presence_t presence;
|
tlv_presence_t presence;
|
||||||
int32_t i32;
|
int32_t i32;
|
||||||
} tlv_int32_t;
|
} tlv_int32_t;
|
||||||
@@ -142,14 +142,14 @@ typedef struct _tlv_int32_t {
|
|||||||
(__dST)->data = ogs_calloc((__dST)->len, sizeof(uint8_t)); \
|
(__dST)->data = ogs_calloc((__dST)->len, sizeof(uint8_t)); \
|
||||||
memcpy((__dST)->data, (__sRC)->data, (__dST)->len); \
|
memcpy((__dST)->data, (__sRC)->data, (__dST)->len); \
|
||||||
} while(0)
|
} while(0)
|
||||||
typedef struct _tlv_octet_t {
|
typedef struct tlv_octet_s {
|
||||||
tlv_presence_t presence;
|
tlv_presence_t presence;
|
||||||
void *data;
|
void *data;
|
||||||
uint32_t len;
|
uint32_t len;
|
||||||
} tlv_octet_t;
|
} tlv_octet_t;
|
||||||
|
|
||||||
/* No value */
|
/* No value */
|
||||||
typedef struct _tlv_null {
|
typedef struct tlv_null_s {
|
||||||
tlv_presence_t presence;
|
tlv_presence_t presence;
|
||||||
} tlv_null_t;
|
} tlv_null_t;
|
||||||
|
|
||||||
|
|||||||
@@ -26,12 +26,12 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
typedef struct _gtp_node_t gtp_node_t;
|
typedef struct gtp_node_s gtp_node_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transaction context
|
* Transaction context
|
||||||
*/
|
*/
|
||||||
typedef struct _gtp_xact_t {
|
typedef struct gtp_xact_s {
|
||||||
ogs_lnode_t node; /**< A node of list */
|
ogs_lnode_t node; /**< A node of list */
|
||||||
ogs_index_t index;
|
ogs_index_t index;
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ typedef struct _gtp_xact_t {
|
|||||||
ogs_timer_t *tm_holding; /**< Timer waiting for holding message */
|
ogs_timer_t *tm_holding; /**< Timer waiting for holding message */
|
||||||
uint8_t holding_rcount;
|
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) \
|
#define GTP_XACT_STORE_SESSION(xact, session) \
|
||||||
do { \
|
do { \
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ typedef struct _hss_db_auth_info_t {
|
|||||||
uint64_t sqn;
|
uint64_t sqn;
|
||||||
} hss_db_auth_info_t;
|
} 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 {
|
typedef struct _hss_context_t {
|
||||||
const char *fd_conf_path; /* HSS freeDiameter conf path */
|
const char *fd_conf_path; /* HSS freeDiameter conf path */
|
||||||
fd_config_t *fd_config; /* HSS freeDiameter config */
|
fd_config_t *fd_config; /* HSS freeDiameter config */
|
||||||
|
|||||||
@@ -1234,8 +1234,6 @@ int mme_context_parse_config()
|
|||||||
context_self()->config.parameter.no_ipv4,
|
context_self()->config.parameter.no_ipv4,
|
||||||
context_self()->config.parameter.no_ipv6,
|
context_self()->config.parameter.no_ipv6,
|
||||||
context_self()->config.parameter.prefer_ipv4);
|
context_self()->config.parameter.prefer_ipv4);
|
||||||
ogs_assert(sgw);
|
|
||||||
|
|
||||||
sgw->num_of_tac = num_of_tac;
|
sgw->num_of_tac = num_of_tac;
|
||||||
if (num_of_tac != 0)
|
if (num_of_tac != 0)
|
||||||
memcpy(sgw->tac, tac, sizeof(sgw->tac));
|
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_ipv4,
|
||||||
context_self()->config.parameter.no_ipv6,
|
context_self()->config.parameter.no_ipv6,
|
||||||
context_self()->config.parameter.prefer_ipv4);
|
context_self()->config.parameter.prefer_ipv4);
|
||||||
ogs_assert(pgw);
|
|
||||||
pgw->apn = apn;
|
pgw->apn = apn;
|
||||||
|
|
||||||
ogs_freeaddrinfo(list);
|
ogs_freeaddrinfo(list);
|
||||||
@@ -1372,7 +1369,6 @@ int mme_context_parse_config()
|
|||||||
mme_sgw_t *mme_sgw_add(
|
mme_sgw_t *mme_sgw_add(
|
||||||
ogs_sockaddr_t *all_list, int no_ipv4, int no_ipv6, int prefer_ipv4)
|
ogs_sockaddr_t *all_list, int no_ipv4, int no_ipv6, int prefer_ipv4)
|
||||||
{
|
{
|
||||||
int rv;
|
|
||||||
mme_sgw_t *sgw = NULL;
|
mme_sgw_t *sgw = NULL;
|
||||||
|
|
||||||
ogs_assert(all_list);
|
ogs_assert(all_list);
|
||||||
@@ -1381,16 +1377,7 @@ mme_sgw_t *mme_sgw_add(
|
|||||||
ogs_assert(sgw);
|
ogs_assert(sgw);
|
||||||
memset(sgw, 0, sizeof *sgw);
|
memset(sgw, 0, sizeof *sgw);
|
||||||
|
|
||||||
rv = gtp_create_node(&sgw->gnode, all_list, no_ipv4, no_ipv6, prefer_ipv4);
|
sgw->gnode = gtp_create_node(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;
|
|
||||||
}
|
|
||||||
|
|
||||||
ogs_list_add(&self.sgw_list, sgw);
|
ogs_list_add(&self.sgw_list, sgw);
|
||||||
|
|
||||||
return sgw;
|
return sgw;
|
||||||
@@ -1422,7 +1409,6 @@ void mme_sgw_remove_all()
|
|||||||
mme_pgw_t *mme_pgw_add(
|
mme_pgw_t *mme_pgw_add(
|
||||||
ogs_sockaddr_t *all_list, int no_ipv4, int no_ipv6, int prefer_ipv4)
|
ogs_sockaddr_t *all_list, int no_ipv4, int no_ipv6, int prefer_ipv4)
|
||||||
{
|
{
|
||||||
int rv;
|
|
||||||
mme_pgw_t *pgw = NULL;
|
mme_pgw_t *pgw = NULL;
|
||||||
|
|
||||||
ogs_assert(all_list);
|
ogs_assert(all_list);
|
||||||
@@ -1430,15 +1416,7 @@ mme_pgw_t *mme_pgw_add(
|
|||||||
ogs_pool_alloc(&mme_pgw_pool, &pgw);
|
ogs_pool_alloc(&mme_pgw_pool, &pgw);
|
||||||
ogs_assert(pgw);
|
ogs_assert(pgw);
|
||||||
|
|
||||||
rv = gtp_create_node(&pgw->gnode, all_list, no_ipv4, no_ipv6, prefer_ipv4);
|
pgw->gnode = gtp_create_node(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;
|
|
||||||
}
|
|
||||||
|
|
||||||
ogs_list_add(&self.pgw_list, pgw);
|
ogs_list_add(&self.pgw_list, pgw);
|
||||||
|
|
||||||
return pgw;
|
return pgw;
|
||||||
|
|||||||
@@ -39,10 +39,10 @@ typedef struct mme_pgw_s mme_pgw_t;
|
|||||||
typedef struct enb_ue_s enb_ue_t;
|
typedef struct enb_ue_s enb_ue_t;
|
||||||
typedef struct mme_ue_s mme_ue_t;
|
typedef struct mme_ue_s mme_ue_t;
|
||||||
|
|
||||||
typedef struct _gtp_node_t gtp_node_t;
|
typedef struct gtp_node_s gtp_node_t;
|
||||||
typedef struct _gtp_xact_t gtp_xact_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;
|
typedef uint32_t mme_m_tmsi_t;
|
||||||
|
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ extern int __pcrf_log_domain;
|
|||||||
#undef OGS_LOG_DOMAIN
|
#undef OGS_LOG_DOMAIN
|
||||||
#define OGS_LOG_DOMAIN __pcrf_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;
|
struct session;
|
||||||
|
|
||||||
typedef struct _pcrf_context_t {
|
typedef struct pcrf_context_s {
|
||||||
const char *fd_conf_path; /* PCRF freeDiameter conf path */
|
const char *fd_conf_path; /* PCRF freeDiameter conf path */
|
||||||
fd_config_t *fd_config; /* PCRF freeDiameter config */
|
fd_config_t *fd_config; /* PCRF freeDiameter config */
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ extern int __pgw_log_domain;
|
|||||||
#undef OGS_LOG_DOMAIN
|
#undef OGS_LOG_DOMAIN
|
||||||
#define OGS_LOG_DOMAIN __pgw_log_domain
|
#define OGS_LOG_DOMAIN __pgw_log_domain
|
||||||
|
|
||||||
typedef struct _gtp_node_t gtp_node_t;
|
typedef struct gtp_node_s gtp_node_t;
|
||||||
typedef struct _fd_config_t fd_config_t;
|
typedef struct fd_config_s fd_config_t;
|
||||||
|
|
||||||
typedef struct _pgw_context_t {
|
typedef struct _pgw_context_t {
|
||||||
const char* fd_conf_path; /* PGW freeDiameter conf path */
|
const char* fd_conf_path; /* PGW freeDiameter conf path */
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
typedef struct _gtp_xact_t gtp_xact_t;
|
typedef struct gtp_xact_s gtp_xact_t;
|
||||||
|
|
||||||
int pgw_fd_init(void);
|
int pgw_fd_init(void);
|
||||||
void pgw_fd_final(void);
|
void pgw_fd_final(void);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ extern int __sgw_log_domain;
|
|||||||
#define OGS_LOG_DOMAIN __sgw_log_domain
|
#define OGS_LOG_DOMAIN __sgw_log_domain
|
||||||
|
|
||||||
typedef struct _sgw_tunnel_t sgw_tunnel_t;
|
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 {
|
typedef struct _sgw_context_t {
|
||||||
uint32_t gtpc_port; /* Default GTPC port */
|
uint32_t gtpc_port; /* Default GTPC port */
|
||||||
|
|||||||
Reference in New Issue
Block a user