Compare commits

..

5 Commits

Author SHA1 Message Date
Alexander Couzens 1151c6ac0f [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-12 00:04:54 +02:00
Alexander Couzens 8960372ed3 [pcrf]: Gx: parse 3GPP Charging Characteristic
Also pass the 3GPP-Charging-Characteristics to the dbi session_data call
2022-09-12 00:04:54 +02:00
Alexander Couzens 1a6ceca4b5 [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-12 00:04:54 +02:00
Alexander Couzens 9d7737c4b7 [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-12 00:04:54 +02:00
Alexander Couzens 0d6ef1e8ac [dbi] add database backend json
Add json based database backend.

TODO: add example json interface
2022-09-12 00:04:54 +02:00
1 changed files with 14 additions and 4 deletions

View File

@ -230,7 +230,7 @@ int ogs_dbi_json_init(const char *filepath, const char *apn)
goto fail;
}
buf = malloc(filesize);
buf = ogs_malloc(filesize);
if (!buf) {
ret = -ENOMEM;
goto fail;
@ -265,7 +265,6 @@ 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");
@ -287,7 +286,6 @@ 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;
@ -340,11 +338,23 @@ 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)
free(buf);
ogs_free(buf);
fclose(filefp);
return ret;