Compare commits

..

5 Commits

Author SHA1 Message Date
Alexander Couzens d973dc1eea [dbi]: allow to build without mongodb
The tests won't be build as they depend on mongodb.
To build without mongodb do

meson configure -Dmongodb=false
2022-09-11 22:49:07 +02:00
Alexander Couzens 0accea361c [pcrf]: Gx: parse 3GPP Charging Characteristic
Also pass the 3GPP-Charging-Characteristics to the dbi session_data call
2022-09-11 22:38:46 +02:00
Alexander Couzens 6b1813131c [app/pcrf]: parse json database configuration
To make use of the new json database backend, allow the pcrf to
parse json backend configuration.
2022-09-11 22:38:46 +02:00
Alexander Couzens eabb847a48 [dbi] session_data(): add argument charging characteristics
Add the charging characteristics to the dbi function to allow the
backend to decide the profile based on it.
The charging characteristics can be filled by the HSS and will
be passed by the PCEF towards the PCRF.

This is an API dbi breakage.
2022-09-11 21:59:16 +02:00
Alexander Couzens 973c64804a [dbi] add database backend json
Add json based database backend.

TODO: add example json interface
2022-09-11 21:55:17 +02:00
1 changed files with 4 additions and 14 deletions

View File

@ -230,7 +230,7 @@ int ogs_dbi_json_init(const char *filepath, const char *apn)
goto fail;
}
buf = ogs_malloc(filesize);
buf = malloc(filesize);
if (!buf) {
ret = -ENOMEM;
goto fail;
@ -265,6 +265,7 @@ int ogs_dbi_json_init(const char *filepath, const char *apn)
goto fail;
}
/* TODO: replace free with alloc */
db_apn = ogs_dbi_static_alloc_apn();
if (!db_apn) {
ogs_error("Too many APNs\n");
@ -286,6 +287,7 @@ int ogs_dbi_json_init(const char *filepath, const char *apn)
entry = ogs_dbi_static_get_apn_profile(db_apn, profile_id);
if (entry) {
/* TODO: improve error handling!*/
ogs_error("Doublicated profile with id %d\n", profile_id);
ret = -1;
goto fail;
@ -338,23 +340,11 @@ int ogs_dbi_json_init(const char *filepath, const char *apn)
entry->valid = true;
}
if (profiles)
cJSON_Delete(profiles);
if (buf)
ogs_free(buf);
return 0;
fail:
if (db_apn->apn)
ogs_free(db_apn->apn);
if (profiles)
cJSON_Delete(profiles);
if (buf)
ogs_free(buf);
free(buf);
fclose(filefp);
return ret;