open5gs/src/hss/hss-context.h

106 lines
3.2 KiB
C
Raw Normal View History

2019-07-11 13:16:32 +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/>.
*/
#ifndef HSS_CONTEXT_H
#define HSS_CONTEXT_H
2017-03-02 02:43:26 +00:00
#include "ogs-diameter-s6a.h"
2021-04-05 08:09:39 +00:00
#include "ogs-diameter-cx.h"
2021-06-21 13:36:38 +00:00
#include "ogs-diameter-swx.h"
#include "ogs-dbi.h"
2019-09-13 12:07:47 +00:00
#include "ogs-app.h"
2024-04-08 15:04:15 +00:00
#include "metrics.h"
2017-03-02 02:43:26 +00:00
#ifdef __cplusplus
extern "C" {
2019-07-11 13:16:32 +00:00
#endif
2017-03-02 02:43:26 +00:00
2019-04-27 14:54:30 +00:00
extern int __hss_log_domain;
#undef OGS_LOG_DOMAIN
#define OGS_LOG_DOMAIN __hss_log_domain
2017-04-06 11:44:52 +00:00
typedef struct _hss_context_t {
2021-04-05 08:09:39 +00:00
const char *diam_conf_path;/* HSS Diameter conf path */
ogs_diam_config_t *diam_config; /* HSS Diameter config */
const char *sms_over_ims; /* SMS over IMS */
int use_mongodb_change_stream;
2017-08-17 05:15:08 +00:00
2019-09-13 12:07:47 +00:00
ogs_thread_mutex_t db_lock;
2021-04-05 08:09:39 +00:00
ogs_thread_mutex_t cx_lock;
/* S6A Interface */
ogs_list_t imsi_list;
ogs_hash_t *imsi_hash; /* hash table (IMSI) */
/* CX Interface */
2021-04-05 08:09:39 +00:00
ogs_list_t impi_list;
ogs_hash_t *impi_hash; /* hash table (IMPI) */
2021-04-07 12:46:05 +00:00
ogs_hash_t *impu_hash; /* hash table (IMPU) */
2017-04-06 11:44:52 +00:00
} hss_context_t;
2017-03-02 02:43:26 +00:00
2019-05-06 11:43:50 +00:00
void hss_context_init(void);
void hss_context_final(void);
2019-07-11 13:16:32 +00:00
hss_context_t *hss_self(void);
2017-03-02 13:47:43 +00:00
2019-04-27 14:54:30 +00:00
int hss_context_parse_config(void);
2017-07-30 13:29:27 +00:00
int hss_db_auth_info(char *imsi_bcd, ogs_dbi_auth_info_t *auth_info);
2021-04-05 08:09:39 +00:00
int hss_db_update_sqn(char *imsi_bcd, uint8_t *rand, uint64_t sqn);
2019-04-27 14:54:30 +00:00
int hss_db_increment_sqn(char *imsi_bcd);
int hss_db_update_imeisv(char *imsi_bcd, char *imeisv);
int hss_db_update_mme(char *imsi_bcd, char *mme_host, char *mme_realm,
2022-09-13 08:03:18 +00:00
bool purge_flag);
2017-07-22 00:44:42 +00:00
2019-04-27 14:54:30 +00:00
int hss_db_subscription_data(
char *imsi_bcd, ogs_subscription_data_t *subscription_data);
2017-03-02 02:43:26 +00:00
2021-04-07 12:46:05 +00:00
int hss_db_msisdn_data(
char *imsi_or_msisdn_bcd, ogs_msisdn_data_t *msisdn_data);
int hss_db_ims_data(char *imsi_bcd, ogs_ims_data_t *ims_data);
2021-04-05 08:09:39 +00:00
void hss_cx_associate_identity(char *user_name, char *public_identity);
bool hss_cx_identity_is_associated(char *user_name, char *public_identity);
void hss_cx_set_imsi_bcd(char *user_name,
char *imsi_bcd, char *visited_network_identifier);
2021-04-07 12:46:05 +00:00
char *hss_cx_get_imsi_bcd(char *public_identity);
char *hss_cx_get_visited_network_identifier(char *public_identity);
char *hss_cx_get_user_name(char *public_identity);
2021-04-07 12:46:05 +00:00
char *hss_cx_get_server_name(char *public_identity);
2021-04-05 08:09:39 +00:00
void hss_cx_set_server_name(
2021-04-07 12:46:05 +00:00
char *public_identity, char *server_name, bool overwrite);
char *hss_cx_download_user_data(
char *user_name, char *visited_network_identifier,
ogs_ims_data_t *ims_data);
2021-04-07 12:46:05 +00:00
int hss_db_poll_change_stream(void);
int hss_handle_change_event(const bson_t *document);
2021-04-05 08:09:39 +00:00
2017-03-02 02:43:26 +00:00
#ifdef __cplusplus
}
2019-07-11 13:16:32 +00:00
#endif
2017-03-02 02:43:26 +00:00
2019-07-11 13:16:32 +00:00
#endif /* HSS_CONTEXT_H */