2017-11-30 11:13:15 +00:00
|
|
|
#ifndef __GTP_NODE_H__
|
|
|
|
#define __GTP_NODE_H__
|
|
|
|
|
|
|
|
#include "core_list.h"
|
|
|
|
#include "core_network.h"
|
|
|
|
|
2017-12-01 15:44:07 +00:00
|
|
|
#include "gtp_types.h"
|
|
|
|
|
2017-11-30 11:13:15 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2017-12-06 08:58:38 +00:00
|
|
|
#define SETUP_GTP_NODE(__cTX, __gNODE) \
|
|
|
|
do { \
|
|
|
|
d_assert((__cTX), break, "Null param"); \
|
|
|
|
d_assert((__gNODE), break, "Null param"); \
|
|
|
|
(__cTX)->gnode = __gNODE; \
|
|
|
|
} while(0)
|
|
|
|
|
2017-11-30 11:13:15 +00:00
|
|
|
/**
|
|
|
|
* 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 {
|
2017-12-05 04:28:34 +00:00
|
|
|
lnode_t node; /* A node of list_t */
|
2017-12-04 10:45:02 +00:00
|
|
|
|
2017-12-05 04:28:34 +00:00
|
|
|
c_sockaddr_t *sa_list; /* Socket Address List */
|
2017-12-04 10:45:02 +00:00
|
|
|
|
2017-12-05 04:28:34 +00:00
|
|
|
sock_id sock; /* Socket instance */
|
2017-12-07 06:04:35 +00:00
|
|
|
ip_t ip; /* Socket Address */
|
2017-12-04 10:45:02 +00:00
|
|
|
|
2017-11-30 11:13:15 +00:00
|
|
|
list_t local_list;
|
|
|
|
list_t remote_list;
|
|
|
|
} gtp_node_t;
|
|
|
|
|
2017-12-02 05:17:32 +00:00
|
|
|
CORE_DECLARE(status_t) gtp_node_init(void);
|
|
|
|
CORE_DECLARE(status_t) gtp_node_final(void);
|
|
|
|
|
2018-09-23 04:16:40 +00:00
|
|
|
CORE_DECLARE(status_t) gtp_create_node(gtp_node_t **node,
|
|
|
|
c_sockaddr_t *all_list, int no_ipv4, int no_ipv6, int prefer_ipv4);
|
|
|
|
CORE_DECLARE(status_t) gtp_delete_node(gtp_node_t *node);
|
|
|
|
|
|
|
|
CORE_DECLARE(gtp_node_t *) gtp_add_node(
|
2018-01-09 06:25:49 +00:00
|
|
|
list_t *list, gtp_f_teid_t *f_teid,
|
|
|
|
c_uint16_t port, int no_ipv4, int no_ipv6, int prefer_ipv4);
|
2017-12-02 05:17:32 +00:00
|
|
|
CORE_DECLARE(status_t) gtp_remove_node(list_t *list, gtp_node_t *node);
|
|
|
|
CORE_DECLARE(status_t) gtp_remove_all_nodes(list_t *list);
|
2017-12-06 11:52:32 +00:00
|
|
|
|
2017-12-06 14:42:37 +00:00
|
|
|
CORE_DECLARE(gtp_node_t *) gtp_find_node(list_t *list, gtp_f_teid_t *f_teid);
|
2017-12-02 05:17:32 +00:00
|
|
|
|
2017-11-30 11:13:15 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
|
#endif /* __GTP_NODE_H__ */
|