2019-04-27 14:54:30 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
|
|
|
|
*
|
|
|
|
* This file is part of Open5GS.
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2019-06-11 09:28:25 +00:00
|
|
|
#ifndef GTP_NODE_H
|
|
|
|
#define GTP_NODE_H
|
2017-11-30 11:13:15 +00:00
|
|
|
|
2019-06-11 09:28:25 +00:00
|
|
|
#include "gtp-types.h"
|
2017-12-01 15:44:07 +00:00
|
|
|
|
2017-11-30 11:13:15 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
2019-06-11 09:28:25 +00:00
|
|
|
#endif
|
2017-11-30 11:13:15 +00:00
|
|
|
|
2017-12-06 08:58:38 +00:00
|
|
|
#define SETUP_GTP_NODE(__cTX, __gNODE) \
|
|
|
|
do { \
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert((__cTX)); \
|
|
|
|
ogs_assert((__gNODE)); \
|
2017-12-06 08:58:38 +00:00
|
|
|
(__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 */
|
2019-05-28 05:47:06 +00:00
|
|
|
typedef struct gtp_node_s {
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_lnode_t node; /* A node of list_t */
|
2017-12-04 10:45:02 +00:00
|
|
|
|
2019-06-05 12:13:18 +00:00
|
|
|
ogs_sockaddr_t *addr; /* Socket Address List */
|
2017-12-04 10:45:02 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_sock_t *sock; /* Socket instance */
|
2017-12-07 06:04:35 +00:00
|
|
|
ip_t ip; /* Socket Address */
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_sockaddr_t conn; /* Connected Address */
|
2017-12-04 10:45:02 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_list_t local_list;
|
|
|
|
ogs_list_t remote_list;
|
2017-11-30 11:13:15 +00:00
|
|
|
} gtp_node_t;
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
int gtp_node_init(void);
|
|
|
|
int gtp_node_final(void);
|
2017-12-02 05:17:32 +00:00
|
|
|
|
2019-06-05 12:13:18 +00:00
|
|
|
gtp_node_t *gtp_node_new(ogs_sockaddr_t *addr);
|
2019-05-30 10:58:27 +00:00
|
|
|
void gtp_node_free(gtp_node_t *node);
|
2018-09-23 04:16:40 +00:00
|
|
|
|
2019-05-30 10:58:27 +00:00
|
|
|
gtp_node_t *gtp_node_add(
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_list_t *list, gtp_f_teid_t *f_teid,
|
|
|
|
uint16_t port, int no_ipv4, int no_ipv6, int prefer_ipv4);
|
2019-05-30 10:58:27 +00:00
|
|
|
void gtp_node_remove(ogs_list_t *list, gtp_node_t *node);
|
|
|
|
void gtp_node_remove_all(ogs_list_t *list);
|
2017-12-06 11:52:32 +00:00
|
|
|
|
2019-05-30 10:58:27 +00:00
|
|
|
gtp_node_t *gtp_node_find(ogs_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
|
|
|
|
}
|
2019-06-11 09:28:25 +00:00
|
|
|
#endif
|
2017-11-30 11:13:15 +00:00
|
|
|
|
2019-06-11 09:28:25 +00:00
|
|
|
#endif /* GTP_NODE_H */
|