mirror of
https://github.com/open5gs/open5gs.git
synced 2025-11-22 15:31:16 +00:00
[5GC] Added BSF(Binding Support Function)
This commit is contained in:
@@ -5,20 +5,18 @@
|
||||
#include "qos_notification_control_info.h"
|
||||
|
||||
OpenAPI_qos_notification_control_info_t *OpenAPI_qos_notification_control_info_create(
|
||||
OpenAPI_list_t *ref_pcc_rule_ids,
|
||||
OpenAPI_qos_notif_type_t *notif_type,
|
||||
int cont_ver,
|
||||
char *alt_qos_param_id
|
||||
OpenAPI_list_t *flows,
|
||||
char *alt_ser_req
|
||||
)
|
||||
{
|
||||
OpenAPI_qos_notification_control_info_t *qos_notification_control_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_qos_notification_control_info_t));
|
||||
if (!qos_notification_control_info_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
qos_notification_control_info_local_var->ref_pcc_rule_ids = ref_pcc_rule_ids;
|
||||
qos_notification_control_info_local_var->notif_type = notif_type;
|
||||
qos_notification_control_info_local_var->cont_ver = cont_ver;
|
||||
qos_notification_control_info_local_var->alt_qos_param_id = alt_qos_param_id;
|
||||
qos_notification_control_info_local_var->flows = flows;
|
||||
qos_notification_control_info_local_var->alt_ser_req = alt_ser_req;
|
||||
|
||||
return qos_notification_control_info_local_var;
|
||||
}
|
||||
@@ -29,12 +27,12 @@ void OpenAPI_qos_notification_control_info_free(OpenAPI_qos_notification_control
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_list_for_each(qos_notification_control_info->ref_pcc_rule_ids, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(qos_notification_control_info->ref_pcc_rule_ids);
|
||||
OpenAPI_qos_notif_type_free(qos_notification_control_info->notif_type);
|
||||
ogs_free(qos_notification_control_info->alt_qos_param_id);
|
||||
OpenAPI_list_for_each(qos_notification_control_info->flows, node) {
|
||||
OpenAPI_flows_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(qos_notification_control_info->flows);
|
||||
ogs_free(qos_notification_control_info->alt_ser_req);
|
||||
ogs_free(qos_notification_control_info);
|
||||
}
|
||||
|
||||
@@ -48,20 +46,6 @@ cJSON *OpenAPI_qos_notification_control_info_convertToJSON(OpenAPI_qos_notificat
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
cJSON *ref_pcc_rule_ids = cJSON_AddArrayToObject(item, "refPccRuleIds");
|
||||
if (ref_pcc_rule_ids == NULL) {
|
||||
ogs_error("OpenAPI_qos_notification_control_info_convertToJSON() failed [ref_pcc_rule_ids]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *ref_pcc_rule_ids_node;
|
||||
OpenAPI_list_for_each(qos_notification_control_info->ref_pcc_rule_ids, ref_pcc_rule_ids_node) {
|
||||
if (cJSON_AddStringToObject(ref_pcc_rule_ids, "", (char*)ref_pcc_rule_ids_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_qos_notification_control_info_convertToJSON() failed [ref_pcc_rule_ids]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *notif_type_local_JSON = OpenAPI_qos_notif_type_convertToJSON(qos_notification_control_info->notif_type);
|
||||
if (notif_type_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_qos_notification_control_info_convertToJSON() failed [notif_type]");
|
||||
@@ -73,16 +57,29 @@ cJSON *OpenAPI_qos_notification_control_info_convertToJSON(OpenAPI_qos_notificat
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (qos_notification_control_info->cont_ver) {
|
||||
if (cJSON_AddNumberToObject(item, "contVer", qos_notification_control_info->cont_ver) == NULL) {
|
||||
ogs_error("OpenAPI_qos_notification_control_info_convertToJSON() failed [cont_ver]");
|
||||
if (qos_notification_control_info->flows) {
|
||||
cJSON *flowsList = cJSON_AddArrayToObject(item, "flows");
|
||||
if (flowsList == NULL) {
|
||||
ogs_error("OpenAPI_qos_notification_control_info_convertToJSON() failed [flows]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *flows_node;
|
||||
if (qos_notification_control_info->flows) {
|
||||
OpenAPI_list_for_each(qos_notification_control_info->flows, flows_node) {
|
||||
cJSON *itemLocal = OpenAPI_flows_convertToJSON(flows_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_qos_notification_control_info_convertToJSON() failed [flows]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(flowsList, itemLocal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (qos_notification_control_info->alt_qos_param_id) {
|
||||
if (cJSON_AddStringToObject(item, "altQosParamId", qos_notification_control_info->alt_qos_param_id) == NULL) {
|
||||
ogs_error("OpenAPI_qos_notification_control_info_convertToJSON() failed [alt_qos_param_id]");
|
||||
if (qos_notification_control_info->alt_ser_req) {
|
||||
if (cJSON_AddStringToObject(item, "altSerReq", qos_notification_control_info->alt_ser_req) == NULL) {
|
||||
ogs_error("OpenAPI_qos_notification_control_info_convertToJSON() failed [alt_ser_req]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
@@ -94,29 +91,6 @@ end:
|
||||
OpenAPI_qos_notification_control_info_t *OpenAPI_qos_notification_control_info_parseFromJSON(cJSON *qos_notification_control_infoJSON)
|
||||
{
|
||||
OpenAPI_qos_notification_control_info_t *qos_notification_control_info_local_var = NULL;
|
||||
cJSON *ref_pcc_rule_ids = cJSON_GetObjectItemCaseSensitive(qos_notification_control_infoJSON, "refPccRuleIds");
|
||||
if (!ref_pcc_rule_ids) {
|
||||
ogs_error("OpenAPI_qos_notification_control_info_parseFromJSON() failed [ref_pcc_rule_ids]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_list_t *ref_pcc_rule_idsList;
|
||||
|
||||
cJSON *ref_pcc_rule_ids_local;
|
||||
if (!cJSON_IsArray(ref_pcc_rule_ids)) {
|
||||
ogs_error("OpenAPI_qos_notification_control_info_parseFromJSON() failed [ref_pcc_rule_ids]");
|
||||
goto end;
|
||||
}
|
||||
ref_pcc_rule_idsList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(ref_pcc_rule_ids_local, ref_pcc_rule_ids) {
|
||||
if (!cJSON_IsString(ref_pcc_rule_ids_local)) {
|
||||
ogs_error("OpenAPI_qos_notification_control_info_parseFromJSON() failed [ref_pcc_rule_ids]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(ref_pcc_rule_idsList, ogs_strdup(ref_pcc_rule_ids_local->valuestring));
|
||||
}
|
||||
|
||||
cJSON *notif_type = cJSON_GetObjectItemCaseSensitive(qos_notification_control_infoJSON, "notifType");
|
||||
if (!notif_type) {
|
||||
ogs_error("OpenAPI_qos_notification_control_info_parseFromJSON() failed [notif_type]");
|
||||
@@ -127,29 +101,42 @@ OpenAPI_qos_notification_control_info_t *OpenAPI_qos_notification_control_info_p
|
||||
|
||||
notif_type_local_nonprim = OpenAPI_qos_notif_type_parseFromJSON(notif_type);
|
||||
|
||||
cJSON *cont_ver = cJSON_GetObjectItemCaseSensitive(qos_notification_control_infoJSON, "contVer");
|
||||
cJSON *flows = cJSON_GetObjectItemCaseSensitive(qos_notification_control_infoJSON, "flows");
|
||||
|
||||
if (cont_ver) {
|
||||
if (!cJSON_IsNumber(cont_ver)) {
|
||||
ogs_error("OpenAPI_qos_notification_control_info_parseFromJSON() failed [cont_ver]");
|
||||
OpenAPI_list_t *flowsList;
|
||||
if (flows) {
|
||||
cJSON *flows_local_nonprimitive;
|
||||
if (!cJSON_IsArray(flows)) {
|
||||
ogs_error("OpenAPI_qos_notification_control_info_parseFromJSON() failed [flows]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
flowsList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(flows_local_nonprimitive, flows ) {
|
||||
if (!cJSON_IsObject(flows_local_nonprimitive)) {
|
||||
ogs_error("OpenAPI_qos_notification_control_info_parseFromJSON() failed [flows]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_flows_t *flowsItem = OpenAPI_flows_parseFromJSON(flows_local_nonprimitive);
|
||||
|
||||
OpenAPI_list_add(flowsList, flowsItem);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *alt_qos_param_id = cJSON_GetObjectItemCaseSensitive(qos_notification_control_infoJSON, "altQosParamId");
|
||||
cJSON *alt_ser_req = cJSON_GetObjectItemCaseSensitive(qos_notification_control_infoJSON, "altSerReq");
|
||||
|
||||
if (alt_qos_param_id) {
|
||||
if (!cJSON_IsString(alt_qos_param_id)) {
|
||||
ogs_error("OpenAPI_qos_notification_control_info_parseFromJSON() failed [alt_qos_param_id]");
|
||||
if (alt_ser_req) {
|
||||
if (!cJSON_IsString(alt_ser_req)) {
|
||||
ogs_error("OpenAPI_qos_notification_control_info_parseFromJSON() failed [alt_ser_req]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
qos_notification_control_info_local_var = OpenAPI_qos_notification_control_info_create (
|
||||
ref_pcc_rule_idsList,
|
||||
notif_type_local_nonprim,
|
||||
cont_ver ? cont_ver->valuedouble : 0,
|
||||
alt_qos_param_id ? ogs_strdup(alt_qos_param_id->valuestring) : NULL
|
||||
flows ? flowsList : NULL,
|
||||
alt_ser_req ? ogs_strdup(alt_ser_req->valuestring) : NULL
|
||||
);
|
||||
|
||||
return qos_notification_control_info_local_var;
|
||||
|
||||
Reference in New Issue
Block a user