[SGsAP] Not tested
This commit is contained in:
parent
eca47a2773
commit
95586eaf09
|
@ -7,7 +7,7 @@ libmme_la_SOURCES = \
|
|||
mme-event.h mme-context.h \
|
||||
ogs-sctp.h \
|
||||
s1ap-build.h s1ap-handler.h s1ap-conv.h s1ap-path.h \
|
||||
sgsap-path.h \
|
||||
sgsap-build.h sgsap-conv.h sgsap-path.h \
|
||||
mme-fd-path.h mme-s6a-handler.h \
|
||||
nas-conv.h nas-security.h nas-path.h \
|
||||
emm-handler.h emm-build.h \
|
||||
|
@ -18,7 +18,7 @@ libmme_la_SOURCES = \
|
|||
mme-init.c mme-event.c mme-context.c \
|
||||
ogs-sctp.c \
|
||||
s1ap-sm.c s1ap-build.c s1ap-handler.c s1ap-conv.c s1ap-path.c \
|
||||
sgsap-sm.c sgsap-path.c \
|
||||
sgsap-sm.c sgsap-build.c sgsap-conv.c sgsap-path.c \
|
||||
mme-fd-path.c mme-s6a-handler.c \
|
||||
nas-conv.c nas-security.c nas-path.c \
|
||||
emm-sm.c emm-handler.c emm-build.c \
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "mme-gtp-path.h"
|
||||
#include "nas-path.h"
|
||||
#include "mme-fd-path.h"
|
||||
#include "sgsap-path.h"
|
||||
|
||||
#include "mme-s11-build.h"
|
||||
#include "mme-s11-handler.h"
|
||||
|
@ -111,18 +112,13 @@ void mme_s11_handle_create_session_response(
|
|||
if (OGS_FSM_CHECK(&mme_ue->sm, emm_state_initial_context_setup)) {
|
||||
mme_vlr_t *vlr = mme_vlr_find_by_tai(&mme_ue->tai);
|
||||
mme_ue->vlr = vlr;
|
||||
#if 0
|
||||
if (mme_ue->vlr) {
|
||||
sgsap_send_location_update_request(mme_ue);
|
||||
} else {
|
||||
#endif
|
||||
rv = nas_send_attach_accept(mme_ue);
|
||||
ogs_assert(rv == OGS_OK);
|
||||
#if 0
|
||||
nas_send_attach_accept(mme_ue);
|
||||
}
|
||||
#endif
|
||||
} else if (OGS_FSM_CHECK(&mme_ue->sm, emm_state_registered)) {
|
||||
rv = nas_send_activate_default_bearer_context_request(bearer);
|
||||
ogs_assert(rv == OGS_OK);
|
||||
nas_send_activate_default_bearer_context_request(bearer);
|
||||
} else
|
||||
ogs_assert_if_reached();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
* 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 "mme-context.h"
|
||||
|
||||
#include "sgsap-build.h"
|
||||
#include "sgsap-conv.h"
|
||||
|
||||
#define SGSAP_IE_IMSI_TYPE 1
|
||||
#define SGSAP_IE_IMSI_LEN MAX_IMSI_LEN
|
||||
#define SGSAP_IE_VLR_NAME_TYPE 2
|
||||
#define SGSAP_IE_VLR_NAME_LEN 256
|
||||
#define SGSAP_IE_LAI_TYPE 4
|
||||
#define SGSAP_IE_LAI_LEN 5
|
||||
#define SGSAP_IE_MME_NAME_TYPE 9
|
||||
#define SGSAP_IE_MME_NAME_LEN 55
|
||||
#define SGSAP_IE_EPS_UPDATE_TYPE 10
|
||||
#define SGSAP_IE_EPS_UPDATE_LEN 1
|
||||
#define SGSAP_IE_MOBILE_IDENTITY_TYPE 14
|
||||
#define SGSAP_IE_MOBILE_IDENTITY_LEN 5
|
||||
#define SGSAP_IE_SERVICE_INDICATOR_TYPE 32
|
||||
#define SGSAP_IE_SERVICE_INDICATOR_LEN 1
|
||||
#define SGSAP_IE_UE_EMM_MODE_TYPE 37
|
||||
#define SGSAP_IE_UE_EMM_MODE_LEN 1
|
||||
|
||||
#define SGSAP_EPS_UPDATE_IMSI_ATTACH 1
|
||||
#define SGSAP_EPS_UPDATE_NORMAL 2
|
||||
|
||||
ogs_pkbuf_t *sgsap_build_location_update_request(mme_ue_t *mme_ue)
|
||||
{
|
||||
mme_vlr_t *vlr = NULL;
|
||||
ogs_tlv_t *root = NULL;
|
||||
ogs_pkbuf_t *pkbuf = NULL;
|
||||
|
||||
char mme_name[SGSAP_IE_MME_NAME_LEN+1];
|
||||
served_gummei_t *served_gummei = &mme_self()->served_gummei[0];
|
||||
char eps_update_type;
|
||||
uint32_t len;
|
||||
const char *p;
|
||||
|
||||
ogs_assert(mme_ue);
|
||||
vlr = mme_ue->vlr;
|
||||
ogs_assert(vlr);
|
||||
|
||||
root = ogs_tlv_add(NULL, SGSAP_IE_IMSI_TYPE, SGSAP_IE_IMSI_LEN, 0,
|
||||
mme_ue->imsi);
|
||||
|
||||
sgsap_to_mme_name(mme_name, SGSAP_IE_MME_NAME_LEN+1,
|
||||
served_gummei->mme_code[0],
|
||||
served_gummei->mme_gid[0],
|
||||
&served_gummei->plmn_id[0]);;
|
||||
ogs_tlv_add(root, SGSAP_IE_MME_NAME_TYPE, strlen(mme_name), 0,
|
||||
(uint8_t *)mme_name);
|
||||
eps_update_type = SGSAP_EPS_UPDATE_IMSI_ATTACH;
|
||||
ogs_tlv_add(root, SGSAP_IE_EPS_UPDATE_TYPE, SGSAP_IE_EPS_UPDATE_LEN, 0,
|
||||
(uint8_t *)&eps_update_type);
|
||||
ogs_tlv_add(root, SGSAP_IE_LAI_TYPE, SGSAP_IE_LAI_LEN, 0,
|
||||
(uint8_t *)&vlr->lai);
|
||||
|
||||
pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN);
|
||||
ogs_pkbuf_put(pkbuf, MAX_SDU_LEN);
|
||||
len = ogs_tlv_render(root,
|
||||
pkbuf->data+1, MAX_SDU_LEN-1, OGS_TLV_MODE_T1_L1);
|
||||
p = pkbuf->data;
|
||||
ogs_pkbuf_trim(pkbuf, len+1);
|
||||
printf("len = %d\n", len);
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < len; i++) {
|
||||
const char *p = pkbuf->data;
|
||||
printf("%x\n", p[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return pkbuf;
|
||||
}
|
||||
ogs_pkbuf_t *sgsap_build_tmsi_reallocation_complete(mme_ue_t *mme_ue)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
ogs_pkbuf_t *sgsap_build_service_request(mme_ue_t *mme_ue)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
ogs_pkbuf_t *sgsap_build_mo_csfb_indication(mme_ue_t *mme_ue)
|
||||
{
|
||||
return NULL;
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* 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 SGSAP_BUILD_H
|
||||
#define SGSAP_BUILD_H
|
||||
|
||||
#include "asn1c/s1ap-message.h"
|
||||
#include "mme-context.h"
|
||||
|
||||
#include "sbc-message.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define SGSAP_PAGING_REQUEST 1
|
||||
#define SGSAP_SERVICE_REQUEST 6
|
||||
#define SGSAP_LOCATION_UPDATE_REQUEST 9
|
||||
#define SGSAP_LOCATION_UPDATE_ACCEPT 10
|
||||
#define SGSAP_TMSI_REALLOCATION_COMPLETE 12
|
||||
#define SGSAP_MO_CSFB_INDICIATION 24
|
||||
|
||||
ogs_pkbuf_t *sgsap_build_location_update_request(mme_ue_t *mme_ue);
|
||||
ogs_pkbuf_t *sgsap_build_tmsi_reallocation_complete(mme_ue_t *mme_ue);
|
||||
ogs_pkbuf_t *sgsap_build_service_request(mme_ue_t *mme_ue);
|
||||
ogs_pkbuf_t *sgsap_build_mo_csfb_indication(mme_ue_t *mme_ue);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SGSAP_BUILD_H */
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* 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 "sgsap-conv.h"
|
||||
|
||||
char *sgsap_to_mme_name(char *buf, size_t size,
|
||||
uint32_t mme_code, uint16_t mme_gid, plmn_id_t *plmn_id)
|
||||
{
|
||||
ogs_assert(buf);
|
||||
ogs_assert(plmn_id);
|
||||
if (ogs_snprintf(buf, size,
|
||||
"mmec%02d.mmegi%04d.mme.epc.mnc%03d.mcc%03d.3gppnetwork.org",
|
||||
mme_code, mme_gid, plmn_id_mnc(plmn_id), plmn_id_mcc(plmn_id) < 0)) {
|
||||
ogs_error("Cannot make MME name");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* 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 SGSAP_CONV_H
|
||||
#define SGSAP_CONV_H
|
||||
|
||||
#include "base/types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
char *sgsap_to_mme_name(char *buf, size_t size,
|
||||
uint32_t mme_code, uint16_t mme_gid, plmn_id_t *plmn_id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SGSAP_CONV_H */
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include "mme-event.h"
|
||||
#include "mme-sm.h"
|
||||
|
||||
#include "sgsap-build.h"
|
||||
#include "sgsap-path.h"
|
||||
|
||||
int sgsap_open()
|
||||
|
@ -114,3 +116,17 @@ int sgsap_send_to_vlr(mme_ue_t *mme_ue, ogs_pkbuf_t *pkbuf)
|
|||
|
||||
return sgsap_send_to_vlr_with_sid(vlr, pkbuf, mme_ue->vlr_ostream_id);
|
||||
}
|
||||
|
||||
int sgsap_send_location_update_request(mme_ue_t *mme_ue)
|
||||
{
|
||||
int rv;
|
||||
ogs_pkbuf_t *pkbuf = NULL;
|
||||
ogs_assert(mme_ue);
|
||||
|
||||
pkbuf = sgsap_build_location_update_request(mme_ue);
|
||||
|
||||
rv = sgsap_send_to_vlr(mme_ue, pkbuf);
|
||||
ogs_assert(rv == OGS_OK);
|
||||
|
||||
return OGS_OK;
|
||||
}
|
||||
|
|
|
@ -39,6 +39,8 @@ int sgsap_send_to_vlr_with_sid(
|
|||
mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf, uint16_t stream_no);
|
||||
int sgsap_send_to_vlr(mme_ue_t *mme_ue, ogs_pkbuf_t *pkbuf);
|
||||
|
||||
int sgsap_send_location_update_request(mme_ue_t *mme_ue);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
#include "test-packet.h"
|
||||
|
||||
extern ogs_socknode_t *sgsap;
|
||||
|
||||
static void test1_func(abts_case *tc, void *data)
|
||||
{
|
||||
int rv;
|
||||
|
@ -199,6 +201,10 @@ static void test1_func(abts_case *tc, void *data)
|
|||
rv = testenb_s1ap_send(s1ap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
recvbuf = testvlr_sgsap_read(sgsap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
ogs_pkbuf_free(recvbuf);
|
||||
#if 0
|
||||
/* Receive Initial Context Setup Request +
|
||||
* Attach Accept +
|
||||
* Activate Default Bearer Context Request */
|
||||
|
@ -304,6 +310,7 @@ static void test1_func(abts_case *tc, void *data)
|
|||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
rv = testenb_s1ap_send(s1ap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
#endif
|
||||
|
||||
/********** Remove Subscriber in Database */
|
||||
doc = BCON_NEW("imsi", BCON_UTF8("262420000118139"));
|
||||
|
|
|
@ -18,7 +18,7 @@ static ogs_proc_mutex_t *sgw_sem2 = NULL;
|
|||
static ogs_proc_mutex_t *hss_sem1 = NULL;
|
||||
static ogs_proc_mutex_t *hss_sem2 = NULL;
|
||||
|
||||
static ogs_socknode_t *sgsap = NULL;
|
||||
ogs_socknode_t *sgsap = NULL;
|
||||
|
||||
int test_epc_initialize(app_param_t *param);
|
||||
|
||||
|
|
Loading…
Reference in New Issue