diff --git a/lib/dbi/ims.c b/lib/dbi/ims.c index 927f2ce91..69ec50303 100644 --- a/lib/dbi/ims.c +++ b/lib/dbi/ims.c @@ -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) { @@ -202,3 +203,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 diff --git a/lib/dbi/ogs-mongoc.c b/lib/dbi/ogs-mongoc.c index 69fbdf61b..b3a9bee22 100644 --- a/lib/dbi/ogs-mongoc.c +++ b/lib/dbi/ogs-mongoc.c @@ -17,12 +17,14 @@ * along with this program. If not, see . */ -#include - #include "ogs-dbi.h" int __ogs_dbi_domain; +#ifdef OGS_DBI_WITH_MONGODB +#include + + static ogs_mongoc_t self; /* @@ -220,3 +222,28 @@ int ogs_dbi_collection_watch_init(void) return OGS_ERROR; #endif } + +#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 diff --git a/lib/dbi/ogs-mongoc.h b/lib/dbi/ogs-mongoc.h index 372289038..e278339d5 100644 --- a/lib/dbi/ogs-mongoc.h +++ b/lib/dbi/ogs-mongoc.h @@ -24,8 +24,6 @@ #ifndef OGS_MONGOC_H #define OGS_MONGOC_H -#include - #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ diff --git a/lib/dbi/session.c b/lib/dbi/session.c index b1e695b21..9b5b7a084 100644 --- a/lib/dbi/session.c +++ b/lib/dbi/session.c @@ -19,6 +19,7 @@ #include "ogs-dbi.h" +#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) { @@ -503,3 +504,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 */ diff --git a/lib/dbi/subscription.c b/lib/dbi/subscription.c index e37bf6675..4b710aef3 100644 --- a/lib/dbi/subscription.c +++ b/lib/dbi/subscription.c @@ -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; @@ -816,3 +817,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 */ diff --git a/meson.build b/meson.build index 1854a0ea8..2b4a5ac14 100644 --- a/meson.build +++ b/meson.build @@ -127,7 +127,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 diff --git a/meson_options.txt b/meson_options.txt index 2acd9beab..ebb225204 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,2 +1,4 @@ option('fuzzing', type: 'boolean', value: false, description: 'Enable fuzzing tests') option('lib_fuzzing_engine', type : 'string', value : '', description : 'Path to the libFuzzer engine library') +option('metrics_impl', type : 'combo', choices : ['void', 'prometheus'], value : 'void', description : 'libogsmetrics implementation') +option('mongodb', type : 'boolean', value : 'false', description : 'build with mongo db support')