forked from acouzens/open5gs
Update identation
This commit is contained in:
parent
971f41d951
commit
16fdc0d989
|
@ -1,6 +1,25 @@
|
|||
#include <mongoc.h>
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include <yaml.h>
|
||||
|
||||
#include <mongoc.h>
|
||||
#include "ogs-sctp.h"
|
||||
|
||||
#include "asn1c/s1ap-message.h"
|
||||
|
@ -2174,10 +2193,8 @@ mme_ue_t* mme_ue_find_by_message(nas_message_t *message)
|
|||
break;
|
||||
}
|
||||
case NAS_DETACH_REQUEST:
|
||||
{
|
||||
/* TODO */
|
||||
break;
|
||||
}
|
||||
case NAS_TRACKING_AREA_UPDATE_REQUEST:
|
||||
{
|
||||
nas_tracking_area_update_request_t *tau_request =
|
||||
|
|
|
@ -1,5 +1,24 @@
|
|||
#ifndef __MME_CONTEXT__
|
||||
#define __MME_CONTEXT__
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#ifndef MME_CONTEXT
|
||||
#define MME_CONTEXT
|
||||
|
||||
#include "ogs-crypt.h"
|
||||
#include "base/types.h"
|
||||
|
@ -14,7 +33,7 @@
|
|||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
#define MAX_PLMN_ID 6
|
||||
#define GRP_PER_MME 256 /* According to spec it is 65535 */
|
||||
|
@ -707,6 +726,6 @@ int mme_m_tmsi_free(mme_m_tmsi_t *tmsi);
|
|||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
#endif /* __MME_CONTEXT__ */
|
||||
#endif /* MME_CONTEXT */
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include <mongoc.h>
|
||||
#include <yaml.h>
|
||||
|
||||
|
@ -90,7 +109,7 @@ void pgw_context_final()
|
|||
context_initiaized = 0;
|
||||
}
|
||||
|
||||
pgw_context_t* pgw_self()
|
||||
pgw_context_t *pgw_self()
|
||||
{
|
||||
return &self;
|
||||
}
|
||||
|
@ -813,18 +832,18 @@ void pgw_sess_remove_all()
|
|||
}
|
||||
}
|
||||
|
||||
pgw_sess_t* pgw_sess_find(uint32_t index)
|
||||
pgw_sess_t *pgw_sess_find(uint32_t index)
|
||||
{
|
||||
ogs_assert(index);
|
||||
return ogs_pool_find(&pgw_sess_pool, index);
|
||||
}
|
||||
|
||||
pgw_sess_t* pgw_sess_find_by_teid(uint32_t teid)
|
||||
pgw_sess_t *pgw_sess_find_by_teid(uint32_t teid)
|
||||
{
|
||||
return pgw_sess_find(teid);
|
||||
}
|
||||
|
||||
pgw_sess_t* pgw_sess_find_by_imsi_apn(
|
||||
pgw_sess_t *pgw_sess_find_by_imsi_apn(
|
||||
uint8_t *imsi, int imsi_len, char *apn)
|
||||
{
|
||||
uint8_t keybuf[MAX_IMSI_LEN+MAX_APN_LEN+1];
|
||||
|
@ -911,13 +930,13 @@ pgw_sess_t *pgw_sess_add_by_message(gtp_message_t *message)
|
|||
return sess;
|
||||
}
|
||||
|
||||
ogs_hash_index_t* pgw_sess_first()
|
||||
ogs_hash_index_t *pgw_sess_first()
|
||||
{
|
||||
ogs_assert(self.sess_hash);
|
||||
return ogs_hash_first(self.sess_hash);
|
||||
}
|
||||
|
||||
ogs_hash_index_t* pgw_sess_next(ogs_hash_index_t *hi)
|
||||
ogs_hash_index_t *pgw_sess_next(ogs_hash_index_t *hi)
|
||||
{
|
||||
return ogs_hash_next(hi);
|
||||
}
|
||||
|
@ -928,7 +947,7 @@ pgw_sess_t *pgw_sess_this(ogs_hash_index_t *hi)
|
|||
return ogs_hash_this_val(hi);
|
||||
}
|
||||
|
||||
pgw_bearer_t* pgw_bearer_add(pgw_sess_t *sess)
|
||||
pgw_bearer_t *pgw_bearer_add(pgw_sess_t *sess)
|
||||
{
|
||||
pgw_bearer_t *bearer = NULL;
|
||||
|
||||
|
@ -980,18 +999,18 @@ void pgw_bearer_remove_all(pgw_sess_t *sess)
|
|||
pgw_bearer_remove(bearer);
|
||||
}
|
||||
|
||||
pgw_bearer_t* pgw_bearer_find(uint32_t index)
|
||||
pgw_bearer_t *pgw_bearer_find(uint32_t index)
|
||||
{
|
||||
ogs_assert(index);
|
||||
return ogs_pool_find(&pgw_bearer_pool, index);
|
||||
}
|
||||
|
||||
pgw_bearer_t* pgw_bearer_find_by_pgw_s5u_teid(uint32_t pgw_s5u_teid)
|
||||
pgw_bearer_t *pgw_bearer_find_by_pgw_s5u_teid(uint32_t pgw_s5u_teid)
|
||||
{
|
||||
return pgw_bearer_find(pgw_s5u_teid);
|
||||
}
|
||||
|
||||
pgw_bearer_t* pgw_bearer_find_by_ebi(pgw_sess_t *sess, uint8_t ebi)
|
||||
pgw_bearer_t *pgw_bearer_find_by_ebi(pgw_sess_t *sess, uint8_t ebi)
|
||||
{
|
||||
pgw_bearer_t *bearer = NULL;
|
||||
|
||||
|
@ -1008,7 +1027,7 @@ pgw_bearer_t* pgw_bearer_find_by_ebi(pgw_sess_t *sess, uint8_t ebi)
|
|||
return bearer;
|
||||
}
|
||||
|
||||
pgw_bearer_t* pgw_bearer_find_by_name(pgw_sess_t *sess, char *name)
|
||||
pgw_bearer_t *pgw_bearer_find_by_name(pgw_sess_t *sess, char *name)
|
||||
{
|
||||
pgw_bearer_t *bearer = NULL;
|
||||
|
||||
|
@ -1026,7 +1045,7 @@ pgw_bearer_t* pgw_bearer_find_by_name(pgw_sess_t *sess, char *name)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
pgw_bearer_t* pgw_bearer_find_by_qci_arp(pgw_sess_t *sess,
|
||||
pgw_bearer_t *pgw_bearer_find_by_qci_arp(pgw_sess_t *sess,
|
||||
uint8_t qci,
|
||||
uint8_t priority_level,
|
||||
uint8_t pre_emption_capability,
|
||||
|
@ -1064,18 +1083,18 @@ pgw_bearer_t* pgw_bearer_find_by_qci_arp(pgw_sess_t *sess,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
pgw_bearer_t* pgw_default_bearer_in_sess(pgw_sess_t *sess)
|
||||
pgw_bearer_t *pgw_default_bearer_in_sess(pgw_sess_t *sess)
|
||||
{
|
||||
return pgw_bearer_first(sess);
|
||||
}
|
||||
|
||||
pgw_bearer_t* pgw_bearer_first(pgw_sess_t *sess)
|
||||
pgw_bearer_t *pgw_bearer_first(pgw_sess_t *sess)
|
||||
{
|
||||
ogs_assert(sess);
|
||||
return ogs_list_first(&sess->bearer_list);
|
||||
}
|
||||
|
||||
pgw_bearer_t* pgw_bearer_next(pgw_bearer_t *bearer)
|
||||
pgw_bearer_t *pgw_bearer_next(pgw_bearer_t *bearer)
|
||||
{
|
||||
return ogs_list_next(bearer);
|
||||
}
|
||||
|
@ -1117,7 +1136,7 @@ void pgw_pf_remove_all(pgw_bearer_t *bearer)
|
|||
pgw_pf_remove(pf);
|
||||
}
|
||||
|
||||
pgw_pf_t* pgw_pf_find_by_id(pgw_bearer_t *bearer, uint8_t id)
|
||||
pgw_pf_t *pgw_pf_find_by_id(pgw_bearer_t *bearer, uint8_t id)
|
||||
{
|
||||
pgw_pf_t *pf = NULL;
|
||||
|
||||
|
@ -1132,12 +1151,12 @@ pgw_pf_t* pgw_pf_find_by_id(pgw_bearer_t *bearer, uint8_t id)
|
|||
return OGS_OK;
|
||||
}
|
||||
|
||||
pgw_pf_t* pgw_pf_first(pgw_bearer_t *bearer)
|
||||
pgw_pf_t *pgw_pf_first(pgw_bearer_t *bearer)
|
||||
{
|
||||
return ogs_list_first(&bearer->pf_list);
|
||||
}
|
||||
|
||||
pgw_pf_t* pgw_pf_next(pgw_pf_t *pf)
|
||||
pgw_pf_t *pgw_pf_next(pgw_pf_t *pf)
|
||||
{
|
||||
return ogs_list_next(pf);
|
||||
}
|
||||
|
@ -1323,7 +1342,7 @@ void pgw_dev_remove_all()
|
|||
pgw_dev_remove(dev);
|
||||
}
|
||||
|
||||
pgw_dev_t* pgw_dev_find_by_ifname(const char *ifname)
|
||||
pgw_dev_t *pgw_dev_find_by_ifname(const char *ifname)
|
||||
{
|
||||
pgw_dev_t *dev = NULL;
|
||||
|
||||
|
@ -1340,12 +1359,12 @@ pgw_dev_t* pgw_dev_find_by_ifname(const char *ifname)
|
|||
return OGS_OK;
|
||||
}
|
||||
|
||||
pgw_dev_t* pgw_dev_first()
|
||||
pgw_dev_t *pgw_dev_first()
|
||||
{
|
||||
return ogs_list_first(&self.dev_list);
|
||||
}
|
||||
|
||||
pgw_dev_t* pgw_dev_next(pgw_dev_t *dev)
|
||||
pgw_dev_t *pgw_dev_next(pgw_dev_t *dev)
|
||||
{
|
||||
return ogs_list_next(dev);
|
||||
}
|
||||
|
@ -1413,12 +1432,12 @@ void pgw_subnet_remove_all()
|
|||
pgw_subnet_remove(subnet);
|
||||
}
|
||||
|
||||
pgw_subnet_t* pgw_subnet_first()
|
||||
pgw_subnet_t *pgw_subnet_first()
|
||||
{
|
||||
return ogs_list_first(&self.subnet_list);
|
||||
}
|
||||
|
||||
pgw_subnet_t* pgw_subnet_next(pgw_subnet_t *subnet)
|
||||
pgw_subnet_t *pgw_subnet_next(pgw_subnet_t *subnet)
|
||||
{
|
||||
return ogs_list_next(subnet);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,31 @@
|
|||
#ifndef __PGW_CONTEXT_H__
|
||||
#define __PGW_CONTEXT_H__
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#ifndef PGW_CONTEXT_H
|
||||
#define PGW_CONTEXT_H
|
||||
|
||||
#include "gtp/gtp-types.h"
|
||||
#include "gtp/gtp-message.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
#define MAX_NUM_OF_DEV 16
|
||||
#define MAX_NUM_OF_SUBNET 16
|
||||
|
@ -29,15 +48,15 @@ typedef struct pgw_context_s {
|
|||
|
||||
ogs_list_t gtpc_list; /* PGW GTPC IPv4 Server List */
|
||||
ogs_list_t gtpc_list6; /* PGW GTPC IPv6 Server List */
|
||||
ogs_sock_t *gtpc_sock; /* PGW GTPC IPv4 Socket */
|
||||
ogs_sock_t *gtpc_sock6; /* PGW GTPC IPv6 Socket */
|
||||
ogs_sock_t *gtpc_sock; /* PGW GTPC IPv4 Socket */
|
||||
ogs_sock_t *gtpc_sock6; /* PGW GTPC IPv6 Socket */
|
||||
ogs_sockaddr_t *gtpc_addr; /* PGW GTPC IPv4 Address */
|
||||
ogs_sockaddr_t *gtpc_addr6; /* PGW GTPC IPv6 Address */
|
||||
|
||||
ogs_list_t gtpu_list; /* PGW GTPU IPv4 Server List */
|
||||
ogs_list_t gtpu_list6; /* PGW GTPU IPv6 Server List */
|
||||
ogs_sock_t *gtpu_sock; /* PGW GTPU IPv4 Socket */
|
||||
ogs_sock_t *gtpu_sock6; /* PGW GTPU IPv6 Socket */
|
||||
ogs_sock_t *gtpu_sock; /* PGW GTPU IPv4 Socket */
|
||||
ogs_sock_t *gtpu_sock6; /* PGW GTPU IPv6 Socket */
|
||||
ogs_sockaddr_t *gtpu_addr; /* PGW GTPU IPv4 Address */
|
||||
ogs_sockaddr_t *gtpu_addr6; /* PGW GTPU IPv6 Address */
|
||||
|
||||
|
@ -60,11 +79,11 @@ typedef struct pgw_context_s {
|
|||
int num_of_p_cscf6;
|
||||
int p_cscf6_index;
|
||||
|
||||
ogs_list_t sgw_s5c_list; /* SGW GTPC Node List */
|
||||
ogs_list_t sgw_s5u_list; /* SGW GTPU Node List */
|
||||
ogs_list_t sgw_s5c_list; /* SGW GTPC Node List */
|
||||
ogs_list_t sgw_s5u_list; /* SGW GTPU Node List */
|
||||
ogs_list_t ip_pool_list;
|
||||
|
||||
ogs_hash_t *sess_hash; /* hash table (IMSI+APN) */
|
||||
ogs_hash_t *sess_hash; /* hash table (IMSI+APN) */
|
||||
} pgw_context_t;
|
||||
|
||||
typedef struct pgw_subnet_s pgw_subnet_t;
|
||||
|
@ -88,12 +107,12 @@ typedef struct pgw_dev_s {
|
|||
typedef struct pgw_subnet_s {
|
||||
ogs_lnode_t node;
|
||||
|
||||
ogs_ipsubnet_t sub; /* Subnet : cafe::0/64 */
|
||||
ogs_ipsubnet_t gw; /* Gateway : cafe::1 */
|
||||
char apn[MAX_APN_LEN]; /* APN : "internet", "volte", .. */
|
||||
ogs_ipsubnet_t sub; /* Subnet : cafe::0/64 */
|
||||
ogs_ipsubnet_t gw; /* Gateway : cafe::1 */
|
||||
char apn[MAX_APN_LEN]; /* APN : "internet", "volte", .. */
|
||||
|
||||
int family; /* AF_INET or AF_INET6 */
|
||||
uint8_t prefixlen; /* prefixlen */
|
||||
int family; /* AF_INET or AF_INET6 */
|
||||
uint8_t prefixlen; /* prefixlen */
|
||||
OGS_POOL(pool, pgw_ue_ip_t);
|
||||
|
||||
/* Related Context */
|
||||
|
@ -259,6 +278,6 @@ pgw_subnet_t *gw_subnet_next(pgw_subnet_t *subnet);
|
|||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
#endif /* __PGW_CONTEXT_H__ */
|
||||
#endif /* PGW_CONTEXT_H */
|
||||
|
|
|
@ -48,6 +48,17 @@ void pgw_state_final(ogs_fsm_t *s, pgw_event_t *e)
|
|||
void pgw_state_operational(ogs_fsm_t *s, pgw_event_t *e)
|
||||
{
|
||||
int rv;
|
||||
ogs_pkbuf_t *recvbuf = NULL;
|
||||
ogs_pkbuf_t *copybuf = NULL;
|
||||
uint16_t copybuf_len = 0;
|
||||
gtp_xact_t *xact = NULL;
|
||||
gtp_message_t *message = NULL;
|
||||
pgw_sess_t *sess = NULL;
|
||||
ogs_index_t sess_index;
|
||||
ogs_pkbuf_t *gxbuf = NULL;
|
||||
gx_message_t *gx_message = NULL;
|
||||
uint32_t xact_index;
|
||||
ogs_pkbuf_t *gtpbuf = NULL;
|
||||
|
||||
pgw_sm_debug(e);
|
||||
|
||||
|
@ -63,15 +74,6 @@ void pgw_state_operational(ogs_fsm_t *s, pgw_event_t *e)
|
|||
pgw_gtp_close();
|
||||
break;
|
||||
case PGW_EVT_S5C_MESSAGE:
|
||||
{
|
||||
int rv;
|
||||
ogs_pkbuf_t *recvbuf = NULL;
|
||||
ogs_pkbuf_t *copybuf = NULL;
|
||||
uint16_t copybuf_len = 0;
|
||||
gtp_xact_t *xact = NULL;
|
||||
gtp_message_t *message = NULL;
|
||||
pgw_sess_t *sess = NULL;
|
||||
|
||||
ogs_assert(e);
|
||||
recvbuf = e->gtpbuf;
|
||||
ogs_assert(recvbuf);
|
||||
|
@ -137,14 +139,8 @@ void pgw_state_operational(ogs_fsm_t *s, pgw_event_t *e)
|
|||
}
|
||||
ogs_pkbuf_free(recvbuf);
|
||||
break;
|
||||
}
|
||||
case PGW_EVT_GX_MESSAGE:
|
||||
{
|
||||
ogs_index_t sess_index;
|
||||
pgw_sess_t *sess = NULL;
|
||||
ogs_pkbuf_t *gxbuf = NULL;
|
||||
gx_message_t *gx_message = NULL;
|
||||
|
||||
case PGW_EVT_GX_MESSAGE:
|
||||
ogs_assert(e);
|
||||
|
||||
gxbuf = e->gxbuf;
|
||||
|
@ -158,13 +154,6 @@ void pgw_state_operational(ogs_fsm_t *s, pgw_event_t *e)
|
|||
|
||||
switch(gx_message->cmd_code) {
|
||||
case GX_CMD_CODE_CREDIT_CONTROL:
|
||||
{
|
||||
uint32_t xact_index;
|
||||
gtp_xact_t *xact = NULL;
|
||||
|
||||
ogs_pkbuf_t *gtpbuf = NULL;
|
||||
gtp_message_t *message = NULL;
|
||||
|
||||
xact_index = e->xact_index;
|
||||
ogs_assert(xact_index);
|
||||
xact = gtp_xact_find(xact_index);
|
||||
|
@ -196,7 +185,6 @@ void pgw_state_operational(ogs_fsm_t *s, pgw_event_t *e)
|
|||
|
||||
ogs_pkbuf_free(gtpbuf);
|
||||
break;
|
||||
}
|
||||
case GX_CMD_RE_AUTH:
|
||||
pgw_gx_handle_re_auth_request(sess, gx_message);
|
||||
break;
|
||||
|
@ -208,7 +196,6 @@ void pgw_state_operational(ogs_fsm_t *s, pgw_event_t *e)
|
|||
gx_message_free(gx_message);
|
||||
ogs_pkbuf_free(gxbuf);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ogs_error("No handler for event %s", pgw_event_get_name(e));
|
||||
break;
|
||||
|
|
|
@ -1,11 +1,30 @@
|
|||
#ifndef __PGW_SM_H__
|
||||
#define __PGW_SM_H__
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#ifndef PGW_SM_H
|
||||
#define PGW_SM_H
|
||||
|
||||
#include "pgw-event.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
void pgw_state_initial(ogs_fsm_t *s, pgw_event_t *e);
|
||||
void pgw_state_final(ogs_fsm_t *s, pgw_event_t *e);
|
||||
|
@ -17,6 +36,6 @@ void pgw_state_exception(ogs_fsm_t *s, pgw_event_t *e);
|
|||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
#endif /* !__PGW_SM_H__ */
|
||||
#endif /* PGW_SM_H */
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include <mongoc.h>
|
||||
#include <yaml.h>
|
||||
|
||||
|
@ -73,7 +92,7 @@ void sgw_context_final()
|
|||
context_initialized = 0;
|
||||
}
|
||||
|
||||
sgw_context_t* sgw_self()
|
||||
sgw_context_t *sgw_self()
|
||||
{
|
||||
return &self;
|
||||
}
|
||||
|
@ -89,15 +108,13 @@ static int sgw_context_prepare()
|
|||
static int sgw_context_validation()
|
||||
{
|
||||
if (ogs_list_empty(&self.gtpc_list) &&
|
||||
ogs_list_empty(&self.gtpc_list6))
|
||||
{
|
||||
ogs_list_empty(&self.gtpc_list6)) {
|
||||
ogs_error("No sgw.gtpc in '%s'",
|
||||
context_self()->config.path);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
if (ogs_list_empty(&self.gtpu_list) &&
|
||||
ogs_list_empty(&self.gtpu_list6))
|
||||
{
|
||||
ogs_list_empty(&self.gtpu_list6)) {
|
||||
ogs_error("No sgw.gtpu in '%s'",
|
||||
context_self()->config.path);
|
||||
return OGS_RETRY;
|
||||
|
@ -159,8 +176,7 @@ int sgw_context_parse_config()
|
|||
const char *gtpc_key =
|
||||
ogs_yaml_iter_key(>pc_iter);
|
||||
ogs_assert(gtpc_key);
|
||||
if (!strcmp(gtpc_key, "family"))
|
||||
{
|
||||
if (!strcmp(gtpc_key, "family")) {
|
||||
const char *v = ogs_yaml_iter_value(>pc_iter);
|
||||
if (v) family = atoi(v);
|
||||
if (family != AF_UNSPEC &&
|
||||
|
@ -198,8 +214,7 @@ int sgw_context_parse_config()
|
|||
}
|
||||
} else if (!strcmp(gtpc_key, "dev")) {
|
||||
dev = ogs_yaml_iter_value(>pc_iter);
|
||||
}
|
||||
else
|
||||
} else
|
||||
ogs_warn("unknown key `%s`", gtpc_key);
|
||||
}
|
||||
|
||||
|
@ -493,7 +508,7 @@ void sgw_ue_remove_all()
|
|||
}
|
||||
}
|
||||
|
||||
sgw_ue_t* sgw_ue_find_by_imsi_bcd(char *imsi_bcd)
|
||||
sgw_ue_t *sgw_ue_find_by_imsi_bcd(char *imsi_bcd)
|
||||
{
|
||||
uint8_t imsi[MAX_IMSI_LEN];
|
||||
int imsi_len = 0;
|
||||
|
@ -505,14 +520,14 @@ sgw_ue_t* sgw_ue_find_by_imsi_bcd(char *imsi_bcd)
|
|||
return sgw_ue_find_by_imsi(imsi, imsi_len);
|
||||
}
|
||||
|
||||
sgw_ue_t* sgw_ue_find_by_imsi(uint8_t *imsi, int imsi_len)
|
||||
sgw_ue_t *sgw_ue_find_by_imsi(uint8_t *imsi, int imsi_len)
|
||||
{
|
||||
ogs_assert(imsi && imsi_len);
|
||||
|
||||
return (sgw_ue_t *)ogs_hash_get(self.imsi_ue_hash, imsi, imsi_len);
|
||||
}
|
||||
|
||||
sgw_ue_t* sgw_ue_find_by_teid(uint32_t teid)
|
||||
sgw_ue_t *sgw_ue_find_by_teid(uint32_t teid)
|
||||
{
|
||||
return ogs_pool_find(&sgw_ue_pool, teid);
|
||||
}
|
||||
|
@ -686,12 +701,12 @@ void sgw_bearer_remove_all(sgw_sess_t *sess)
|
|||
sgw_bearer_remove(bearer);
|
||||
}
|
||||
|
||||
sgw_bearer_t* sgw_bearer_find_by_sgw_s5u_teid(uint32_t sgw_s5u_teid)
|
||||
sgw_bearer_t *sgw_bearer_find_by_sgw_s5u_teid(uint32_t sgw_s5u_teid)
|
||||
{
|
||||
return ogs_pool_find(&sgw_bearer_pool, sgw_s5u_teid);
|
||||
}
|
||||
|
||||
sgw_bearer_t* sgw_bearer_find_by_sess_ebi(sgw_sess_t *sess, uint8_t ebi)
|
||||
sgw_bearer_t *sgw_bearer_find_by_sess_ebi(sgw_sess_t *sess, uint8_t ebi)
|
||||
{
|
||||
sgw_bearer_t *bearer = NULL;
|
||||
|
||||
|
@ -706,7 +721,7 @@ sgw_bearer_t* sgw_bearer_find_by_sess_ebi(sgw_sess_t *sess, uint8_t ebi)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
sgw_bearer_t* sgw_bearer_find_by_ue_ebi(sgw_ue_t *sgw_ue, uint8_t ebi)
|
||||
sgw_bearer_t *sgw_bearer_find_by_ue_ebi(sgw_ue_t *sgw_ue, uint8_t ebi)
|
||||
{
|
||||
sgw_sess_t *sess = NULL;
|
||||
sgw_bearer_t *bearer = NULL;
|
||||
|
@ -724,23 +739,23 @@ sgw_bearer_t* sgw_bearer_find_by_ue_ebi(sgw_ue_t *sgw_ue, uint8_t ebi)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
sgw_bearer_t* sgw_default_bearer_in_sess(sgw_sess_t *sess)
|
||||
sgw_bearer_t *sgw_default_bearer_in_sess(sgw_sess_t *sess)
|
||||
{
|
||||
return sgw_bearer_first(sess);
|
||||
}
|
||||
|
||||
sgw_bearer_t* sgw_bearer_first(sgw_sess_t *sess)
|
||||
sgw_bearer_t *sgw_bearer_first(sgw_sess_t *sess)
|
||||
{
|
||||
ogs_assert(sess);
|
||||
return ogs_list_first(&sess->bearer_list);
|
||||
}
|
||||
|
||||
sgw_bearer_t* sgw_bearer_next(sgw_bearer_t *bearer)
|
||||
sgw_bearer_t *sgw_bearer_next(sgw_bearer_t *bearer)
|
||||
{
|
||||
return ogs_list_next(bearer);
|
||||
}
|
||||
|
||||
sgw_tunnel_t* sgw_tunnel_add(sgw_bearer_t *bearer, uint8_t interface_type)
|
||||
sgw_tunnel_t *sgw_tunnel_add(sgw_bearer_t *bearer, uint8_t interface_type)
|
||||
{
|
||||
sgw_tunnel_t *tunnel = NULL;
|
||||
|
||||
|
@ -782,12 +797,12 @@ void sgw_tunnel_remove_all(sgw_bearer_t *bearer)
|
|||
sgw_tunnel_remove(tunnel);
|
||||
}
|
||||
|
||||
sgw_tunnel_t* sgw_tunnel_find_by_teid(uint32_t teid)
|
||||
sgw_tunnel_t *sgw_tunnel_find_by_teid(uint32_t teid)
|
||||
{
|
||||
return ogs_pool_find(&sgw_tunnel_pool, teid);
|
||||
}
|
||||
|
||||
sgw_tunnel_t* sgw_tunnel_find_by_interface_type(
|
||||
sgw_tunnel_t *sgw_tunnel_find_by_interface_type(
|
||||
sgw_bearer_t *bearer, uint8_t interface_type)
|
||||
{
|
||||
sgw_tunnel_t *tunnel = NULL;
|
||||
|
@ -806,24 +821,24 @@ sgw_tunnel_t* sgw_tunnel_find_by_interface_type(
|
|||
return NULL;
|
||||
}
|
||||
|
||||
sgw_tunnel_t* sgw_s1u_tunnel_in_bearer(sgw_bearer_t *bearer)
|
||||
sgw_tunnel_t *sgw_s1u_tunnel_in_bearer(sgw_bearer_t *bearer)
|
||||
{
|
||||
return sgw_tunnel_find_by_interface_type(
|
||||
bearer, GTP_F_TEID_S1_U_SGW_GTP_U);
|
||||
}
|
||||
sgw_tunnel_t* sgw_s5u_tunnel_in_bearer(sgw_bearer_t *bearer)
|
||||
sgw_tunnel_t *sgw_s5u_tunnel_in_bearer(sgw_bearer_t *bearer)
|
||||
{
|
||||
return sgw_tunnel_find_by_interface_type(
|
||||
bearer, GTP_F_TEID_S5_S8_SGW_GTP_U);
|
||||
}
|
||||
|
||||
sgw_tunnel_t* sgw_tunnel_first(sgw_bearer_t *bearer)
|
||||
sgw_tunnel_t *sgw_tunnel_first(sgw_bearer_t *bearer)
|
||||
{
|
||||
ogs_assert(bearer);
|
||||
return ogs_list_first(&bearer->tunnel_list);
|
||||
}
|
||||
|
||||
sgw_tunnel_t* sgw_tunnel_next(sgw_tunnel_t *tunnel)
|
||||
sgw_tunnel_t *sgw_tunnel_next(sgw_tunnel_t *tunnel)
|
||||
{
|
||||
return ogs_list_next(tunnel);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,24 @@
|
|||
#ifndef __SGW_CONTEXT_H__
|
||||
#define __SGW_CONTEXT_H__
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#ifndef SGW_CONTEXT_H
|
||||
#define SGW_CONTEXT_H
|
||||
|
||||
#include "ogs-core.h"
|
||||
|
||||
|
@ -9,7 +28,7 @@
|
|||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
extern int __sgw_log_domain;
|
||||
|
||||
|
@ -25,15 +44,15 @@ typedef struct sgw_context_s {
|
|||
|
||||
ogs_list_t gtpc_list; /* SGW GTPC IPv4 Server List */
|
||||
ogs_list_t gtpc_list6; /* SGW GTPC IPv6 Server List */
|
||||
ogs_sock_t *gtpc_sock; /* SGW GTPC IPv4 Socket */
|
||||
ogs_sock_t *gtpc_sock6; /* SGW GTPC IPv6 Socket */
|
||||
ogs_sock_t *gtpc_sock; /* SGW GTPC IPv4 Socket */
|
||||
ogs_sock_t *gtpc_sock6; /* SGW GTPC IPv6 Socket */
|
||||
ogs_sockaddr_t *gtpc_addr; /* SGW GTPC IPv4 Address */
|
||||
ogs_sockaddr_t *gtpc_addr6; /* SGW GTPC IPv6 Address */
|
||||
|
||||
ogs_list_t gtpu_list; /* SGW GTPU IPv4 Server List */
|
||||
ogs_list_t gtpu_list6; /* SGW GTPU IPv6 Server List */
|
||||
ogs_sock_t *gtpu_sock; /* SGW GTPU IPv4 Socket */
|
||||
ogs_sock_t *gtpu_sock6; /* SGW GTPU IPv6 Socket */
|
||||
ogs_sock_t *gtpu_sock; /* SGW GTPU IPv4 Socket */
|
||||
ogs_sock_t *gtpu_sock6; /* SGW GTPU IPv6 Socket */
|
||||
ogs_sockaddr_t *gtpu_addr; /* SGW GTPU IPv4 Address */
|
||||
ogs_sockaddr_t *gtpu_addr6; /* SGW GTPU IPv6 Address */
|
||||
|
||||
|
@ -137,13 +156,13 @@ int sgw_context_parse_config(void);
|
|||
gtp_node_t *sgw_mme_add_by_message(gtp_message_t *message);
|
||||
sgw_ue_t *sgw_ue_add_by_message(gtp_message_t *message);
|
||||
|
||||
sgw_ue_t* sgw_ue_add(uint8_t *imsi, int imsi_len);
|
||||
sgw_ue_t *sgw_ue_add(uint8_t *imsi, int imsi_len);
|
||||
int sgw_ue_remove(sgw_ue_t *sgw_ue);
|
||||
void sgw_ue_remove_all();
|
||||
|
||||
sgw_ue_t* sgw_ue_find_by_imsi(uint8_t *imsi, int imsi_len);
|
||||
sgw_ue_t* sgw_ue_find_by_imsi_bcd(char *imsi_bcd);
|
||||
sgw_ue_t* sgw_ue_find_by_teid(uint32_t teid);
|
||||
sgw_ue_t *sgw_ue_find_by_imsi(uint8_t *imsi, int imsi_len);
|
||||
sgw_ue_t *sgw_ue_find_by_imsi_bcd(char *imsi_bcd);
|
||||
sgw_ue_t *sgw_ue_find_by_teid(uint32_t teid);
|
||||
|
||||
ogs_hash_index_t *sgw_ue_first();
|
||||
ogs_hash_index_t *sgw_ue_next(ogs_hash_index_t *hi);
|
||||
|
@ -187,6 +206,6 @@ sgw_tunnel_t *sgw_tunnel_next(sgw_tunnel_t *tunnel);
|
|||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
#endif /* __SGW_CONTEXT_H__ */
|
||||
#endif /* SGW_CONTEXT_H */
|
||||
|
|
312
src/sgw/sgw-sm.c
312
src/sgw/sgw-sm.c
|
@ -1,3 +1,22 @@
|
|||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include "gtp/gtp-node.h"
|
||||
|
||||
#include "sgw-context.h"
|
||||
|
@ -26,183 +45,156 @@ void sgw_state_final(ogs_fsm_t *s, sgw_event_t *e)
|
|||
void sgw_state_operational(ogs_fsm_t *s, sgw_event_t *e)
|
||||
{
|
||||
int rv;
|
||||
ogs_pkbuf_t *pkbuf = NULL;
|
||||
gtp_xact_t *xact = NULL;
|
||||
gtp_message_t message;
|
||||
sgw_ue_t *sgw_ue = NULL;
|
||||
sgw_sess_t *sess = NULL;
|
||||
sgw_bearer_t *bearer = NULL;
|
||||
|
||||
sgw_sm_debug(e);
|
||||
|
||||
ogs_assert(s);
|
||||
|
||||
switch (e->id)
|
||||
{
|
||||
case OGS_FSM_ENTRY_SIG:
|
||||
{
|
||||
rv = sgw_gtp_open();
|
||||
if (rv != OGS_OK)
|
||||
{
|
||||
ogs_error("Can't establish SGW path");
|
||||
break;
|
||||
}
|
||||
switch (e->id) {
|
||||
case OGS_FSM_ENTRY_SIG:
|
||||
rv = sgw_gtp_open();
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("Can't establish SGW path");
|
||||
break;
|
||||
}
|
||||
case OGS_FSM_EXIT_SIG:
|
||||
{
|
||||
sgw_gtp_close();
|
||||
break;
|
||||
break;
|
||||
case OGS_FSM_EXIT_SIG:
|
||||
sgw_gtp_close();
|
||||
break;
|
||||
case SGW_EVT_S11_MESSAGE:
|
||||
ogs_assert(e);
|
||||
pkbuf = e->pkbuf;
|
||||
ogs_assert(pkbuf);
|
||||
rv = gtp_parse_msg(&message, pkbuf);
|
||||
ogs_assert(rv == OGS_OK);
|
||||
|
||||
if (message.h.teid == 0) {
|
||||
gtp_node_t *mme = sgw_mme_add_by_message(&message);
|
||||
ogs_assert(mme);
|
||||
sgw_ue = sgw_ue_add_by_message(&message);
|
||||
SETUP_GTP_NODE(sgw_ue, mme);
|
||||
} else {
|
||||
sgw_ue = sgw_ue_find_by_teid(message.h.teid);
|
||||
}
|
||||
case SGW_EVT_S11_MESSAGE:
|
||||
{
|
||||
int rv;
|
||||
ogs_pkbuf_t *pkbuf = NULL;
|
||||
gtp_xact_t *xact = NULL;
|
||||
gtp_message_t message;
|
||||
sgw_ue_t *sgw_ue = NULL;
|
||||
ogs_assert(sgw_ue);
|
||||
|
||||
ogs_assert(e);
|
||||
pkbuf = e->pkbuf;
|
||||
ogs_assert(pkbuf);
|
||||
rv = gtp_parse_msg(&message, pkbuf);
|
||||
ogs_assert(rv == OGS_OK);
|
||||
|
||||
if (message.h.teid == 0)
|
||||
{
|
||||
gtp_node_t *mme = sgw_mme_add_by_message(&message);
|
||||
ogs_assert(mme);
|
||||
sgw_ue = sgw_ue_add_by_message(&message);
|
||||
SETUP_GTP_NODE(sgw_ue, mme);
|
||||
}
|
||||
else
|
||||
{
|
||||
sgw_ue = sgw_ue_find_by_teid(message.h.teid);
|
||||
}
|
||||
ogs_assert(sgw_ue);
|
||||
|
||||
rv = gtp_xact_receive(sgw_ue->gnode, &message.h, &xact);
|
||||
if (rv != OGS_OK)
|
||||
{
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
break;
|
||||
}
|
||||
|
||||
switch(message.h.type)
|
||||
{
|
||||
case GTP_CREATE_SESSION_REQUEST_TYPE:
|
||||
sgw_s11_handle_create_session_request(xact, sgw_ue,
|
||||
&message);
|
||||
break;
|
||||
case GTP_MODIFY_BEARER_REQUEST_TYPE:
|
||||
sgw_s11_handle_modify_bearer_request(xact, sgw_ue,
|
||||
&message.modify_bearer_request);
|
||||
break;
|
||||
case GTP_DELETE_SESSION_REQUEST_TYPE:
|
||||
sgw_s11_handle_delete_session_request(xact, sgw_ue,
|
||||
&message);
|
||||
break;
|
||||
case GTP_CREATE_BEARER_RESPONSE_TYPE:
|
||||
sgw_s11_handle_create_bearer_response(xact, sgw_ue,
|
||||
&message);
|
||||
break;
|
||||
case GTP_UPDATE_BEARER_RESPONSE_TYPE:
|
||||
sgw_s11_handle_update_bearer_response(xact, sgw_ue,
|
||||
&message);
|
||||
break;
|
||||
case GTP_DELETE_BEARER_RESPONSE_TYPE:
|
||||
sgw_s11_handle_delete_bearer_response(xact, sgw_ue,
|
||||
&message);
|
||||
break;
|
||||
case GTP_RELEASE_ACCESS_BEARERS_REQUEST_TYPE:
|
||||
sgw_s11_handle_release_access_bearers_request(xact, sgw_ue,
|
||||
&message.release_access_bearers_request);
|
||||
break;
|
||||
case GTP_DOWNLINK_DATA_NOTIFICATION_ACKNOWLEDGE_TYPE:
|
||||
sgw_s11_handle_downlink_data_notification_ack(xact, sgw_ue,
|
||||
&message.downlink_data_notification_acknowledge);
|
||||
break;
|
||||
case GTP_CREATE_INDIRECT_DATA_FORWARDING_TUNNEL_REQUEST_TYPE:
|
||||
sgw_s11_handle_create_indirect_data_forwarding_tunnel_request(
|
||||
xact, sgw_ue,
|
||||
&message.
|
||||
create_indirect_data_forwarding_tunnel_request);
|
||||
break;
|
||||
case GTP_DELETE_INDIRECT_DATA_FORWARDING_TUNNEL_REQUEST_TYPE:
|
||||
sgw_s11_handle_delete_indirect_data_forwarding_tunnel_request(
|
||||
xact, sgw_ue);
|
||||
break;
|
||||
default:
|
||||
ogs_warn("Not implmeneted(type:%d)", message.h.type);
|
||||
break;
|
||||
}
|
||||
rv = gtp_xact_receive(sgw_ue->gnode, &message.h, &xact);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
break;
|
||||
}
|
||||
case SGW_EVT_S5C_MESSAGE:
|
||||
{
|
||||
int rv;
|
||||
ogs_pkbuf_t *pkbuf = NULL;
|
||||
gtp_xact_t *xact = NULL;
|
||||
gtp_message_t message;
|
||||
sgw_sess_t *sess = NULL;
|
||||
|
||||
ogs_assert(e);
|
||||
pkbuf = e->pkbuf;
|
||||
|
||||
ogs_assert(pkbuf);
|
||||
rv = gtp_parse_msg(&message, pkbuf);
|
||||
ogs_assert(rv == OGS_OK);
|
||||
|
||||
sess = sgw_sess_find_by_teid(message.h.teid);
|
||||
ogs_assert(sess);
|
||||
|
||||
rv = gtp_xact_receive(sess->gnode, &message.h, &xact);
|
||||
if (rv != OGS_OK)
|
||||
{
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
break;
|
||||
}
|
||||
|
||||
switch(message.h.type)
|
||||
{
|
||||
case GTP_CREATE_SESSION_RESPONSE_TYPE:
|
||||
sgw_s5c_handle_create_session_response(xact, sess,
|
||||
&message);
|
||||
break;
|
||||
case GTP_DELETE_SESSION_RESPONSE_TYPE:
|
||||
sgw_s5c_handle_delete_session_response(xact, sess,
|
||||
&message);
|
||||
break;
|
||||
case GTP_CREATE_BEARER_REQUEST_TYPE:
|
||||
sgw_s5c_handle_create_bearer_request(xact, sess,
|
||||
&message);
|
||||
break;
|
||||
case GTP_UPDATE_BEARER_REQUEST_TYPE:
|
||||
sgw_s5c_handle_update_bearer_request(xact, sess,
|
||||
&message);
|
||||
break;
|
||||
case GTP_DELETE_BEARER_REQUEST_TYPE:
|
||||
sgw_s5c_handle_delete_bearer_request(xact, sess,
|
||||
&message);
|
||||
break;
|
||||
default:
|
||||
ogs_warn("Not implmeneted(type:%d)", message.h.type);
|
||||
break;
|
||||
}
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
switch(message.h.type) {
|
||||
case GTP_CREATE_SESSION_REQUEST_TYPE:
|
||||
sgw_s11_handle_create_session_request(xact, sgw_ue,
|
||||
&message);
|
||||
break;
|
||||
}
|
||||
case SGW_EVT_LO_DLDATA_NOTI:
|
||||
{
|
||||
sgw_bearer_t* bearer = NULL;
|
||||
ogs_assert(e);
|
||||
|
||||
bearer = e->bearer;
|
||||
ogs_assert(bearer);
|
||||
|
||||
sgw_s11_handle_lo_dldata_notification(bearer);
|
||||
|
||||
case GTP_MODIFY_BEARER_REQUEST_TYPE:
|
||||
sgw_s11_handle_modify_bearer_request(xact, sgw_ue,
|
||||
&message.modify_bearer_request);
|
||||
break;
|
||||
case GTP_DELETE_SESSION_REQUEST_TYPE:
|
||||
sgw_s11_handle_delete_session_request(xact, sgw_ue,
|
||||
&message);
|
||||
break;
|
||||
case GTP_CREATE_BEARER_RESPONSE_TYPE:
|
||||
sgw_s11_handle_create_bearer_response(xact, sgw_ue,
|
||||
&message);
|
||||
break;
|
||||
case GTP_UPDATE_BEARER_RESPONSE_TYPE:
|
||||
sgw_s11_handle_update_bearer_response(xact, sgw_ue,
|
||||
&message);
|
||||
break;
|
||||
case GTP_DELETE_BEARER_RESPONSE_TYPE:
|
||||
sgw_s11_handle_delete_bearer_response(xact, sgw_ue,
|
||||
&message);
|
||||
break;
|
||||
case GTP_RELEASE_ACCESS_BEARERS_REQUEST_TYPE:
|
||||
sgw_s11_handle_release_access_bearers_request(xact, sgw_ue,
|
||||
&message.release_access_bearers_request);
|
||||
break;
|
||||
case GTP_DOWNLINK_DATA_NOTIFICATION_ACKNOWLEDGE_TYPE:
|
||||
sgw_s11_handle_downlink_data_notification_ack(xact, sgw_ue,
|
||||
&message.downlink_data_notification_acknowledge);
|
||||
break;
|
||||
case GTP_CREATE_INDIRECT_DATA_FORWARDING_TUNNEL_REQUEST_TYPE:
|
||||
sgw_s11_handle_create_indirect_data_forwarding_tunnel_request(
|
||||
xact, sgw_ue,
|
||||
&message.
|
||||
create_indirect_data_forwarding_tunnel_request);
|
||||
break;
|
||||
case GTP_DELETE_INDIRECT_DATA_FORWARDING_TUNNEL_REQUEST_TYPE:
|
||||
sgw_s11_handle_delete_indirect_data_forwarding_tunnel_request(
|
||||
xact, sgw_ue);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
ogs_error("No handler for event %s", sgw_event_get_name(e));
|
||||
ogs_warn("Not implmeneted(type:%d)", message.h.type);
|
||||
break;
|
||||
}
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
break;
|
||||
|
||||
case SGW_EVT_S5C_MESSAGE:
|
||||
ogs_assert(e);
|
||||
pkbuf = e->pkbuf;
|
||||
|
||||
ogs_assert(pkbuf);
|
||||
rv = gtp_parse_msg(&message, pkbuf);
|
||||
ogs_assert(rv == OGS_OK);
|
||||
|
||||
sess = sgw_sess_find_by_teid(message.h.teid);
|
||||
ogs_assert(sess);
|
||||
|
||||
rv = gtp_xact_receive(sess->gnode, &message.h, &xact);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
break;
|
||||
}
|
||||
|
||||
switch(message.h.type) {
|
||||
case GTP_CREATE_SESSION_RESPONSE_TYPE:
|
||||
sgw_s5c_handle_create_session_response(xact, sess,
|
||||
&message);
|
||||
break;
|
||||
case GTP_DELETE_SESSION_RESPONSE_TYPE:
|
||||
sgw_s5c_handle_delete_session_response(xact, sess,
|
||||
&message);
|
||||
break;
|
||||
case GTP_CREATE_BEARER_REQUEST_TYPE:
|
||||
sgw_s5c_handle_create_bearer_request(xact, sess,
|
||||
&message);
|
||||
break;
|
||||
case GTP_UPDATE_BEARER_REQUEST_TYPE:
|
||||
sgw_s5c_handle_update_bearer_request(xact, sess,
|
||||
&message);
|
||||
break;
|
||||
case GTP_DELETE_BEARER_REQUEST_TYPE:
|
||||
sgw_s5c_handle_delete_bearer_request(xact, sess,
|
||||
&message);
|
||||
break;
|
||||
default:
|
||||
ogs_warn("Not implmeneted(type:%d)", message.h.type);
|
||||
break;
|
||||
}
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
break;
|
||||
case SGW_EVT_LO_DLDATA_NOTI:
|
||||
ogs_assert(e);
|
||||
|
||||
bearer = e->bearer;
|
||||
ogs_assert(bearer);
|
||||
|
||||
sgw_s11_handle_lo_dldata_notification(bearer);
|
||||
|
||||
break;
|
||||
default:
|
||||
ogs_error("No handler for event %s", sgw_event_get_name(e));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,30 @@
|
|||
#ifndef __SGW_SM_H__
|
||||
#define __SGW_SM_H__
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#ifndef SGW_SM_H
|
||||
#define SGW_SM_H
|
||||
|
||||
#include "sgw-event.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
void sgw_state_initial(ogs_fsm_t *s, sgw_event_t *e);
|
||||
void sgw_state_final(ogs_fsm_t *s, sgw_event_t *e);
|
||||
|
@ -17,6 +36,6 @@ void sgw_state_exception(ogs_fsm_t *s, sgw_event_t *e);
|
|||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
#endif /* !__SGW_SM_H__ */
|
||||
#endif /* !SGW_SM_H */
|
||||
|
|
Loading…
Reference in New Issue