Compare commits

...

5 Commits

Author SHA1 Message Date
Alexander Couzens d88e657d55 dbi: allow to use ogs_dbi_init() 2022-06-15 01:08:03 +02:00
root 1b877e8c05 libsctp: add HAVE_NETINET_SCTP_H 2022-06-14 21:56:22 +00:00
Alexander Couzens 77affb1112 step meson options 2022-06-14 23:33:57 +02:00
Alexander Couzens 64e9506555 step: fix meson 2022-06-14 23:20:50 +02:00
Alexander Couzens 32b0253a55 dbi 2022-06-14 22:11:25 +02:00
9 changed files with 122 additions and 6 deletions

View File

@ -1,5 +1,36 @@
db_uri: mongodb://localhost/open5gs
db_json:
default:
af:
ambr:
up: 10000
down: 10000
gmbr:
up: 1000
down: 1000
qci: 4
normal:
ambr:
up: 10000
down: 10000
gmbr:
up: 10000
down: 10000
qci: 5
charging_profiles:
af:
- 1
- 2
- 3
- 4
normal:
- 1
- 2
- 3
- 4
dir:
normal: "/tmp/profiles"
af: "/tmp/profiles_af"
#
# logger:
#

View File

@ -19,6 +19,7 @@
#include "ogs-dbi.h"
#ifdef OGS_DBI_WITH_MONGODB
int ogs_dbi_msisdn_data(
char *imsi_or_msisdn_bcd, ogs_msisdn_data_t *msisdn_data)
{
@ -212,3 +213,15 @@ out:
return rv;
}
#else /* OGS_DBI_WITH_MONGODB */
int ogs_dbi_msisdn_data(
char *imsi_or_msisdn_bcd, ogs_msisdn_data_t *msisdn_data)
{
return OGS_ERROR;
}
int ogs_dbi_ims_data(char *supi, ogs_ims_data_t *ims_data)
{
return OGS_ERROR;
}
#endif

View File

@ -17,12 +17,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <mongoc.h>
#include "ogs-dbi.h"
int __ogs_dbi_domain;
#ifdef OGS_DBI_WITH_MONGODB
#include <mongoc.h>
static ogs_mongoc_t self;
/*
@ -184,3 +186,28 @@ void ogs_dbi_final()
ogs_mongoc_final();
}
#else /* OGS_DBI_WITH_MONGODB */
int ogs_mongoc_init(const char *db_uri)
{
return OGS_ERROR;
}
void ogs_mongoc_final(void)
{
}
ogs_mongoc_t *ogs_mongoc(void)
{
return NULL;
}
int ogs_dbi_init(const char *db_uri)
{
return OGS_OK;
}
void ogs_dbi_final()
{
}
#endif

View File

@ -24,12 +24,11 @@
#ifndef OGS_MONGOC_H
#define OGS_MONGOC_H
#include <mongoc.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
typedef struct ogs_mongoc_s {
bool initialized;
const char *name;

View File

@ -19,6 +19,12 @@
#include "ogs-dbi.h"
/* how does this function work?!
*
*
*/
#ifdef OGS_DBI_WITH_MONGODB
int ogs_dbi_session_data(char *supi, ogs_s_nssai_t *s_nssai, char *dnn,
ogs_session_data_t *session_data)
{
@ -500,3 +506,12 @@ out:
return rv;
}
#else /* OGS_DBI_WITH_MONGODB */
int ogs_dbi_session_data(char *supi, ogs_s_nssai_t *s_nssai, char *dnn,
ogs_session_data_t *session_data)
{
return OGS_ERROR;
}
#endif /* OGS_DBI_WITH_MONGODB */

View File

@ -19,6 +19,7 @@
#include "ogs-dbi.h"
#ifdef OGS_DBI_WITH_MONGODB
int ogs_dbi_auth_info(char *supi, ogs_dbi_auth_info_t *auth_info)
{
int rv = OGS_OK;
@ -661,3 +662,31 @@ out:
return rv;
}
#else
int ogs_dbi_auth_info(char *supi, ogs_dbi_auth_info_t *auth_info)
{
return OGS_ERROR;
}
int ogs_dbi_update_sqn(char *supi, uint64_t sqn)
{
return OGS_ERROR;
}
int ogs_dbi_update_imeisv(char *supi, char *imeisv)
{
return OGS_ERROR;
}
int ogs_dbi_increment_sqn(char *supi)
{
return OGS_ERROR;
}
int ogs_dbi_subscription_data(char *supi,
ogs_subscription_data_t *subscription_data)
{
return OGS_ERROR;
}
#endif /* OGS_DBI_WITH_MONGODB */

View File

@ -46,6 +46,7 @@ if host_system == 'darwin'
libsctp_sources += files('ogs-usrsctp.c')
libsctp_conf.set('HAVE_USRSCTP', 1)
else
libsctp_conf.set('HAVE_NETINET_SCTP_H', 1)
sctp_dep = cc.find_library('sctp', required : false)
libsctp_sources += files('ogs-lksctp.c')
endif

View File

@ -115,7 +115,7 @@ subdir('src')
subdir('misc')
# Don't build the tests unless we can run them (either natively or in an exe wrapper)
build_tests = not meson.is_cross_build() or (meson.is_cross_build() and meson.has_exe_wrapper())
if build_tests
if build_tests and get_option('mongodb')
subdir('tests')
endif

1
meson_options.txt Normal file
View File

@ -0,0 +1 @@
option('mongodb', type : 'boolean', value : 'false', description : 'build with mongo db support')