mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-03 05:40:09 +00:00
Add PCF(Policy Control Function)
This commit is contained in:
parent
fb95725ca4
commit
198abc6e8b
299 changed files with 29050 additions and 1075 deletions
|
|
@ -643,6 +643,89 @@ libsbi_openapi_sources = files('''
|
|||
model/ue_reg_status_update_rsp_data.c
|
||||
model/v2x_context.c
|
||||
|
||||
model/acc_net_ch_id.c
|
||||
model/acc_net_charging_address.c
|
||||
model/accu_usage_report.c
|
||||
model/additional_access_info.c
|
||||
model/af_sig_protocol.c
|
||||
model/an_gw_address.c
|
||||
model/app_detection_info.c
|
||||
model/authorized_default_qos.c
|
||||
model/candidate_for_replacement.c
|
||||
model/charging_data.c
|
||||
model/condition_data.c
|
||||
model/credit_management_status.c
|
||||
model/error_report.c
|
||||
model/failure_cause.c
|
||||
model/failure_code.c
|
||||
model/final_unit_action.c
|
||||
model/flow_direction_rm.c
|
||||
model/flow_information.c
|
||||
model/flow_status.c
|
||||
model/ip_multicast_address_info.c
|
||||
model/ma_pdu_indication.c
|
||||
model/mapping_of_snssai.c
|
||||
model/metering_method.c
|
||||
model/packet_filter_info.c
|
||||
model/partial_success_report.c
|
||||
model/pcc_rule.c
|
||||
model/pdu_session_rel_cause.c
|
||||
model/policy_association.c
|
||||
model/policy_association_release_cause.c
|
||||
model/policy_association_request.c
|
||||
model/policy_association_update_request.c
|
||||
model/policy_control_request_trigger.c
|
||||
model/policy_update.c
|
||||
model/port_management_container.c
|
||||
model/presence_info_rm.c
|
||||
model/qos_characteristics.c
|
||||
model/qos_data.c
|
||||
model/qos_flow_usage.c
|
||||
model/qos_monitoring_data.c
|
||||
model/qos_monitoring_report.c
|
||||
model/qos_notif_type.c
|
||||
model/qos_notification_control_info.c
|
||||
model/ran_nas_rel_cause.c
|
||||
model/redirect_address_type.c
|
||||
model/redirect_information.c
|
||||
model/reporting_frequency.c
|
||||
model/reporting_level.c
|
||||
model/request_trigger.c
|
||||
model/requested_qos.c
|
||||
model/requested_qos_monitoring_parameter.c
|
||||
model/requested_rule_data.c
|
||||
model/requested_rule_data_type.c
|
||||
model/requested_usage_data.c
|
||||
model/rule_operation.c
|
||||
model/rule_report.c
|
||||
model/rule_status.c
|
||||
model/serving_nf_identity.c
|
||||
model/session_rule.c
|
||||
model/session_rule_failure_code.c
|
||||
model/session_rule_report.c
|
||||
model/sm_policy_association_release_cause.c
|
||||
model/sm_policy_context_data.c
|
||||
model/sm_policy_control.c
|
||||
model/sm_policy_decision.c
|
||||
model/sm_policy_delete_data.c
|
||||
model/sm_policy_notification.c
|
||||
model/sm_policy_update_context_data.c
|
||||
model/smf_selection_data.c
|
||||
model/steer_mode_value.c
|
||||
model/steering_functionality.c
|
||||
model/steering_mode.c
|
||||
model/termination_notification.c
|
||||
model/traffic_control_data.c
|
||||
model/tscai_input_container.c
|
||||
model/tsn_bridge_info.c
|
||||
model/tsn_port_identifier.c
|
||||
model/ue_camping_rep.c
|
||||
model/ue_initiated_resource_request.c
|
||||
model/up_path_chg_event.c
|
||||
model/usage_monitoring_data.c
|
||||
model/wireline_area.c
|
||||
model/wireline_service_area_restriction.c
|
||||
|
||||
'''.split())
|
||||
|
||||
libsbi_openapi_inc = include_directories('.')
|
||||
|
|
|
|||
171
lib/sbi/openapi/model/acc_net_ch_id.c
Normal file
171
lib/sbi/openapi/model/acc_net_ch_id.c
Normal file
|
|
@ -0,0 +1,171 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "acc_net_ch_id.h"
|
||||
|
||||
OpenAPI_acc_net_ch_id_t *OpenAPI_acc_net_ch_id_create(
|
||||
int acc_net_cha_id_value,
|
||||
OpenAPI_list_t *ref_pcc_rule_ids,
|
||||
int session_ch_scope
|
||||
)
|
||||
{
|
||||
OpenAPI_acc_net_ch_id_t *acc_net_ch_id_local_var = OpenAPI_malloc(sizeof(OpenAPI_acc_net_ch_id_t));
|
||||
if (!acc_net_ch_id_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
acc_net_ch_id_local_var->acc_net_cha_id_value = acc_net_cha_id_value;
|
||||
acc_net_ch_id_local_var->ref_pcc_rule_ids = ref_pcc_rule_ids;
|
||||
acc_net_ch_id_local_var->session_ch_scope = session_ch_scope;
|
||||
|
||||
return acc_net_ch_id_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_acc_net_ch_id_free(OpenAPI_acc_net_ch_id_t *acc_net_ch_id)
|
||||
{
|
||||
if (NULL == acc_net_ch_id) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_list_for_each(acc_net_ch_id->ref_pcc_rule_ids, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(acc_net_ch_id->ref_pcc_rule_ids);
|
||||
ogs_free(acc_net_ch_id);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_acc_net_ch_id_convertToJSON(OpenAPI_acc_net_ch_id_t *acc_net_ch_id)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (acc_net_ch_id == NULL) {
|
||||
ogs_error("OpenAPI_acc_net_ch_id_convertToJSON() failed [AccNetChId]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (!acc_net_ch_id->acc_net_cha_id_value) {
|
||||
ogs_error("OpenAPI_acc_net_ch_id_convertToJSON() failed [acc_net_cha_id_value]");
|
||||
goto end;
|
||||
}
|
||||
if (cJSON_AddNumberToObject(item, "accNetChaIdValue", acc_net_ch_id->acc_net_cha_id_value) == NULL) {
|
||||
ogs_error("OpenAPI_acc_net_ch_id_convertToJSON() failed [acc_net_cha_id_value]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (acc_net_ch_id->ref_pcc_rule_ids) {
|
||||
cJSON *ref_pcc_rule_ids = cJSON_AddArrayToObject(item, "refPccRuleIds");
|
||||
if (ref_pcc_rule_ids == NULL) {
|
||||
ogs_error("OpenAPI_acc_net_ch_id_convertToJSON() failed [ref_pcc_rule_ids]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *ref_pcc_rule_ids_node;
|
||||
OpenAPI_list_for_each(acc_net_ch_id->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_acc_net_ch_id_convertToJSON() failed [ref_pcc_rule_ids]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (acc_net_ch_id->session_ch_scope) {
|
||||
if (cJSON_AddBoolToObject(item, "sessionChScope", acc_net_ch_id->session_ch_scope) == NULL) {
|
||||
ogs_error("OpenAPI_acc_net_ch_id_convertToJSON() failed [session_ch_scope]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_acc_net_ch_id_t *OpenAPI_acc_net_ch_id_parseFromJSON(cJSON *acc_net_ch_idJSON)
|
||||
{
|
||||
OpenAPI_acc_net_ch_id_t *acc_net_ch_id_local_var = NULL;
|
||||
cJSON *acc_net_cha_id_value = cJSON_GetObjectItemCaseSensitive(acc_net_ch_idJSON, "accNetChaIdValue");
|
||||
if (!acc_net_cha_id_value) {
|
||||
ogs_error("OpenAPI_acc_net_ch_id_parseFromJSON() failed [acc_net_cha_id_value]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
if (!cJSON_IsNumber(acc_net_cha_id_value)) {
|
||||
ogs_error("OpenAPI_acc_net_ch_id_parseFromJSON() failed [acc_net_cha_id_value]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *ref_pcc_rule_ids = cJSON_GetObjectItemCaseSensitive(acc_net_ch_idJSON, "refPccRuleIds");
|
||||
|
||||
OpenAPI_list_t *ref_pcc_rule_idsList;
|
||||
if (ref_pcc_rule_ids) {
|
||||
cJSON *ref_pcc_rule_ids_local;
|
||||
if (!cJSON_IsArray(ref_pcc_rule_ids)) {
|
||||
ogs_error("OpenAPI_acc_net_ch_id_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_acc_net_ch_id_parseFromJSON() failed [ref_pcc_rule_ids]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(ref_pcc_rule_idsList, ogs_strdup(ref_pcc_rule_ids_local->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *session_ch_scope = cJSON_GetObjectItemCaseSensitive(acc_net_ch_idJSON, "sessionChScope");
|
||||
|
||||
if (session_ch_scope) {
|
||||
if (!cJSON_IsBool(session_ch_scope)) {
|
||||
ogs_error("OpenAPI_acc_net_ch_id_parseFromJSON() failed [session_ch_scope]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
acc_net_ch_id_local_var = OpenAPI_acc_net_ch_id_create (
|
||||
acc_net_cha_id_value->valuedouble,
|
||||
ref_pcc_rule_ids ? ref_pcc_rule_idsList : NULL,
|
||||
session_ch_scope ? session_ch_scope->valueint : 0
|
||||
);
|
||||
|
||||
return acc_net_ch_id_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_acc_net_ch_id_t *OpenAPI_acc_net_ch_id_copy(OpenAPI_acc_net_ch_id_t *dst, OpenAPI_acc_net_ch_id_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_acc_net_ch_id_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_acc_net_ch_id_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_acc_net_ch_id_free(dst);
|
||||
dst = OpenAPI_acc_net_ch_id_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
42
lib/sbi/openapi/model/acc_net_ch_id.h
Normal file
42
lib/sbi/openapi/model/acc_net_ch_id.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* acc_net_ch_id.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_acc_net_ch_id_H_
|
||||
#define _OpenAPI_acc_net_ch_id_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_acc_net_ch_id_s OpenAPI_acc_net_ch_id_t;
|
||||
typedef struct OpenAPI_acc_net_ch_id_s {
|
||||
int acc_net_cha_id_value;
|
||||
OpenAPI_list_t *ref_pcc_rule_ids;
|
||||
int session_ch_scope;
|
||||
} OpenAPI_acc_net_ch_id_t;
|
||||
|
||||
OpenAPI_acc_net_ch_id_t *OpenAPI_acc_net_ch_id_create(
|
||||
int acc_net_cha_id_value,
|
||||
OpenAPI_list_t *ref_pcc_rule_ids,
|
||||
int session_ch_scope
|
||||
);
|
||||
void OpenAPI_acc_net_ch_id_free(OpenAPI_acc_net_ch_id_t *acc_net_ch_id);
|
||||
OpenAPI_acc_net_ch_id_t *OpenAPI_acc_net_ch_id_parseFromJSON(cJSON *acc_net_ch_idJSON);
|
||||
cJSON *OpenAPI_acc_net_ch_id_convertToJSON(OpenAPI_acc_net_ch_id_t *acc_net_ch_id);
|
||||
OpenAPI_acc_net_ch_id_t *OpenAPI_acc_net_ch_id_copy(OpenAPI_acc_net_ch_id_t *dst, OpenAPI_acc_net_ch_id_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_acc_net_ch_id_H_ */
|
||||
|
||||
125
lib/sbi/openapi/model/acc_net_charging_address.c
Normal file
125
lib/sbi/openapi/model/acc_net_charging_address.c
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "acc_net_charging_address.h"
|
||||
|
||||
OpenAPI_acc_net_charging_address_t *OpenAPI_acc_net_charging_address_create(
|
||||
char *an_charg_ipv4_addr,
|
||||
char *an_charg_ipv6_addr
|
||||
)
|
||||
{
|
||||
OpenAPI_acc_net_charging_address_t *acc_net_charging_address_local_var = OpenAPI_malloc(sizeof(OpenAPI_acc_net_charging_address_t));
|
||||
if (!acc_net_charging_address_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
acc_net_charging_address_local_var->an_charg_ipv4_addr = an_charg_ipv4_addr;
|
||||
acc_net_charging_address_local_var->an_charg_ipv6_addr = an_charg_ipv6_addr;
|
||||
|
||||
return acc_net_charging_address_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_acc_net_charging_address_free(OpenAPI_acc_net_charging_address_t *acc_net_charging_address)
|
||||
{
|
||||
if (NULL == acc_net_charging_address) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(acc_net_charging_address->an_charg_ipv4_addr);
|
||||
ogs_free(acc_net_charging_address->an_charg_ipv6_addr);
|
||||
ogs_free(acc_net_charging_address);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_acc_net_charging_address_convertToJSON(OpenAPI_acc_net_charging_address_t *acc_net_charging_address)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (acc_net_charging_address == NULL) {
|
||||
ogs_error("OpenAPI_acc_net_charging_address_convertToJSON() failed [AccNetChargingAddress]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (acc_net_charging_address->an_charg_ipv4_addr) {
|
||||
if (cJSON_AddStringToObject(item, "anChargIpv4Addr", acc_net_charging_address->an_charg_ipv4_addr) == NULL) {
|
||||
ogs_error("OpenAPI_acc_net_charging_address_convertToJSON() failed [an_charg_ipv4_addr]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (acc_net_charging_address->an_charg_ipv6_addr) {
|
||||
if (cJSON_AddStringToObject(item, "anChargIpv6Addr", acc_net_charging_address->an_charg_ipv6_addr) == NULL) {
|
||||
ogs_error("OpenAPI_acc_net_charging_address_convertToJSON() failed [an_charg_ipv6_addr]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_acc_net_charging_address_t *OpenAPI_acc_net_charging_address_parseFromJSON(cJSON *acc_net_charging_addressJSON)
|
||||
{
|
||||
OpenAPI_acc_net_charging_address_t *acc_net_charging_address_local_var = NULL;
|
||||
cJSON *an_charg_ipv4_addr = cJSON_GetObjectItemCaseSensitive(acc_net_charging_addressJSON, "anChargIpv4Addr");
|
||||
|
||||
if (an_charg_ipv4_addr) {
|
||||
if (!cJSON_IsString(an_charg_ipv4_addr)) {
|
||||
ogs_error("OpenAPI_acc_net_charging_address_parseFromJSON() failed [an_charg_ipv4_addr]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *an_charg_ipv6_addr = cJSON_GetObjectItemCaseSensitive(acc_net_charging_addressJSON, "anChargIpv6Addr");
|
||||
|
||||
if (an_charg_ipv6_addr) {
|
||||
if (!cJSON_IsString(an_charg_ipv6_addr)) {
|
||||
ogs_error("OpenAPI_acc_net_charging_address_parseFromJSON() failed [an_charg_ipv6_addr]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
acc_net_charging_address_local_var = OpenAPI_acc_net_charging_address_create (
|
||||
an_charg_ipv4_addr ? ogs_strdup(an_charg_ipv4_addr->valuestring) : NULL,
|
||||
an_charg_ipv6_addr ? ogs_strdup(an_charg_ipv6_addr->valuestring) : NULL
|
||||
);
|
||||
|
||||
return acc_net_charging_address_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_acc_net_charging_address_t *OpenAPI_acc_net_charging_address_copy(OpenAPI_acc_net_charging_address_t *dst, OpenAPI_acc_net_charging_address_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_acc_net_charging_address_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_acc_net_charging_address_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_acc_net_charging_address_free(dst);
|
||||
dst = OpenAPI_acc_net_charging_address_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
40
lib/sbi/openapi/model/acc_net_charging_address.h
Normal file
40
lib/sbi/openapi/model/acc_net_charging_address.h
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* acc_net_charging_address.h
|
||||
*
|
||||
* Describes the network entity within the access network performing charging
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_acc_net_charging_address_H_
|
||||
#define _OpenAPI_acc_net_charging_address_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_acc_net_charging_address_s OpenAPI_acc_net_charging_address_t;
|
||||
typedef struct OpenAPI_acc_net_charging_address_s {
|
||||
char *an_charg_ipv4_addr;
|
||||
char *an_charg_ipv6_addr;
|
||||
} OpenAPI_acc_net_charging_address_t;
|
||||
|
||||
OpenAPI_acc_net_charging_address_t *OpenAPI_acc_net_charging_address_create(
|
||||
char *an_charg_ipv4_addr,
|
||||
char *an_charg_ipv6_addr
|
||||
);
|
||||
void OpenAPI_acc_net_charging_address_free(OpenAPI_acc_net_charging_address_t *acc_net_charging_address);
|
||||
OpenAPI_acc_net_charging_address_t *OpenAPI_acc_net_charging_address_parseFromJSON(cJSON *acc_net_charging_addressJSON);
|
||||
cJSON *OpenAPI_acc_net_charging_address_convertToJSON(OpenAPI_acc_net_charging_address_t *acc_net_charging_address);
|
||||
OpenAPI_acc_net_charging_address_t *OpenAPI_acc_net_charging_address_copy(OpenAPI_acc_net_charging_address_t *dst, OpenAPI_acc_net_charging_address_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_acc_net_charging_address_H_ */
|
||||
|
||||
|
|
@ -148,9 +148,6 @@ void OpenAPI_access_and_mobility_subscription_data_free(OpenAPI_access_and_mobil
|
|||
}
|
||||
OpenAPI_list_free(access_and_mobility_subscription_data->forbidden_areas);
|
||||
OpenAPI_service_area_restriction_free(access_and_mobility_subscription_data->service_area_restriction);
|
||||
OpenAPI_list_for_each(access_and_mobility_subscription_data->core_network_type_restrictions, node) {
|
||||
OpenAPI_core_network_type_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(access_and_mobility_subscription_data->core_network_type_restrictions);
|
||||
OpenAPI_sor_info_free(access_and_mobility_subscription_data->sor_info);
|
||||
OpenAPI_list_free(access_and_mobility_subscription_data->sor_update_indicator_list);
|
||||
|
|
@ -356,21 +353,16 @@ cJSON *OpenAPI_access_and_mobility_subscription_data_convertToJSON(OpenAPI_acces
|
|||
}
|
||||
|
||||
if (access_and_mobility_subscription_data->core_network_type_restrictions) {
|
||||
cJSON *core_network_type_restrictionsList = cJSON_AddArrayToObject(item, "coreNetworkTypeRestrictions");
|
||||
if (core_network_type_restrictionsList == NULL) {
|
||||
cJSON *core_network_type_restrictions = cJSON_AddArrayToObject(item, "coreNetworkTypeRestrictions");
|
||||
if (core_network_type_restrictions == NULL) {
|
||||
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [core_network_type_restrictions]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *core_network_type_restrictions_node;
|
||||
if (access_and_mobility_subscription_data->core_network_type_restrictions) {
|
||||
OpenAPI_list_for_each(access_and_mobility_subscription_data->core_network_type_restrictions, core_network_type_restrictions_node) {
|
||||
cJSON *itemLocal = OpenAPI_core_network_type_convertToJSON(core_network_type_restrictions_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [core_network_type_restrictions]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(core_network_type_restrictionsList, itemLocal);
|
||||
OpenAPI_list_for_each(access_and_mobility_subscription_data->core_network_type_restrictions, core_network_type_restrictions_node) {
|
||||
if (cJSON_AddStringToObject(core_network_type_restrictions, "", OpenAPI_core_network_type_ToString((OpenAPI_core_network_type_e)core_network_type_restrictions_node->data)) == NULL) {
|
||||
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [core_network_type_restrictions]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -970,13 +962,12 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
|
|||
core_network_type_restrictionsList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(core_network_type_restrictions_local_nonprimitive, core_network_type_restrictions ) {
|
||||
if (!cJSON_IsObject(core_network_type_restrictions_local_nonprimitive)) {
|
||||
if (!cJSON_IsString(core_network_type_restrictions_local_nonprimitive)) {
|
||||
ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [core_network_type_restrictions]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_core_network_type_t *core_network_type_restrictionsItem = OpenAPI_core_network_type_parseFromJSON(core_network_type_restrictions_local_nonprimitive);
|
||||
|
||||
OpenAPI_list_add(core_network_type_restrictionsList, core_network_type_restrictionsItem);
|
||||
OpenAPI_list_add(core_network_type_restrictionsList, (void *)OpenAPI_core_network_type_FromString(core_network_type_restrictions_local_nonprimitive->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
262
lib/sbi/openapi/model/accu_usage_report.c
Normal file
262
lib/sbi/openapi/model/accu_usage_report.c
Normal file
|
|
@ -0,0 +1,262 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "accu_usage_report.h"
|
||||
|
||||
OpenAPI_accu_usage_report_t *OpenAPI_accu_usage_report_create(
|
||||
char *ref_um_ids,
|
||||
long vol_usage,
|
||||
long vol_usage_uplink,
|
||||
long vol_usage_downlink,
|
||||
int time_usage,
|
||||
long next_vol_usage,
|
||||
long next_vol_usage_uplink,
|
||||
long next_vol_usage_downlink,
|
||||
int next_time_usage
|
||||
)
|
||||
{
|
||||
OpenAPI_accu_usage_report_t *accu_usage_report_local_var = OpenAPI_malloc(sizeof(OpenAPI_accu_usage_report_t));
|
||||
if (!accu_usage_report_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
accu_usage_report_local_var->ref_um_ids = ref_um_ids;
|
||||
accu_usage_report_local_var->vol_usage = vol_usage;
|
||||
accu_usage_report_local_var->vol_usage_uplink = vol_usage_uplink;
|
||||
accu_usage_report_local_var->vol_usage_downlink = vol_usage_downlink;
|
||||
accu_usage_report_local_var->time_usage = time_usage;
|
||||
accu_usage_report_local_var->next_vol_usage = next_vol_usage;
|
||||
accu_usage_report_local_var->next_vol_usage_uplink = next_vol_usage_uplink;
|
||||
accu_usage_report_local_var->next_vol_usage_downlink = next_vol_usage_downlink;
|
||||
accu_usage_report_local_var->next_time_usage = next_time_usage;
|
||||
|
||||
return accu_usage_report_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_accu_usage_report_free(OpenAPI_accu_usage_report_t *accu_usage_report)
|
||||
{
|
||||
if (NULL == accu_usage_report) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(accu_usage_report->ref_um_ids);
|
||||
ogs_free(accu_usage_report);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_accu_usage_report_convertToJSON(OpenAPI_accu_usage_report_t *accu_usage_report)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (accu_usage_report == NULL) {
|
||||
ogs_error("OpenAPI_accu_usage_report_convertToJSON() failed [AccuUsageReport]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (!accu_usage_report->ref_um_ids) {
|
||||
ogs_error("OpenAPI_accu_usage_report_convertToJSON() failed [ref_um_ids]");
|
||||
goto end;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "refUmIds", accu_usage_report->ref_um_ids) == NULL) {
|
||||
ogs_error("OpenAPI_accu_usage_report_convertToJSON() failed [ref_um_ids]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (accu_usage_report->vol_usage) {
|
||||
if (cJSON_AddNumberToObject(item, "volUsage", accu_usage_report->vol_usage) == NULL) {
|
||||
ogs_error("OpenAPI_accu_usage_report_convertToJSON() failed [vol_usage]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (accu_usage_report->vol_usage_uplink) {
|
||||
if (cJSON_AddNumberToObject(item, "volUsageUplink", accu_usage_report->vol_usage_uplink) == NULL) {
|
||||
ogs_error("OpenAPI_accu_usage_report_convertToJSON() failed [vol_usage_uplink]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (accu_usage_report->vol_usage_downlink) {
|
||||
if (cJSON_AddNumberToObject(item, "volUsageDownlink", accu_usage_report->vol_usage_downlink) == NULL) {
|
||||
ogs_error("OpenAPI_accu_usage_report_convertToJSON() failed [vol_usage_downlink]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (accu_usage_report->time_usage) {
|
||||
if (cJSON_AddNumberToObject(item, "timeUsage", accu_usage_report->time_usage) == NULL) {
|
||||
ogs_error("OpenAPI_accu_usage_report_convertToJSON() failed [time_usage]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (accu_usage_report->next_vol_usage) {
|
||||
if (cJSON_AddNumberToObject(item, "nextVolUsage", accu_usage_report->next_vol_usage) == NULL) {
|
||||
ogs_error("OpenAPI_accu_usage_report_convertToJSON() failed [next_vol_usage]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (accu_usage_report->next_vol_usage_uplink) {
|
||||
if (cJSON_AddNumberToObject(item, "nextVolUsageUplink", accu_usage_report->next_vol_usage_uplink) == NULL) {
|
||||
ogs_error("OpenAPI_accu_usage_report_convertToJSON() failed [next_vol_usage_uplink]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (accu_usage_report->next_vol_usage_downlink) {
|
||||
if (cJSON_AddNumberToObject(item, "nextVolUsageDownlink", accu_usage_report->next_vol_usage_downlink) == NULL) {
|
||||
ogs_error("OpenAPI_accu_usage_report_convertToJSON() failed [next_vol_usage_downlink]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (accu_usage_report->next_time_usage) {
|
||||
if (cJSON_AddNumberToObject(item, "nextTimeUsage", accu_usage_report->next_time_usage) == NULL) {
|
||||
ogs_error("OpenAPI_accu_usage_report_convertToJSON() failed [next_time_usage]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_accu_usage_report_t *OpenAPI_accu_usage_report_parseFromJSON(cJSON *accu_usage_reportJSON)
|
||||
{
|
||||
OpenAPI_accu_usage_report_t *accu_usage_report_local_var = NULL;
|
||||
cJSON *ref_um_ids = cJSON_GetObjectItemCaseSensitive(accu_usage_reportJSON, "refUmIds");
|
||||
if (!ref_um_ids) {
|
||||
ogs_error("OpenAPI_accu_usage_report_parseFromJSON() failed [ref_um_ids]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
if (!cJSON_IsString(ref_um_ids)) {
|
||||
ogs_error("OpenAPI_accu_usage_report_parseFromJSON() failed [ref_um_ids]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *vol_usage = cJSON_GetObjectItemCaseSensitive(accu_usage_reportJSON, "volUsage");
|
||||
|
||||
if (vol_usage) {
|
||||
if (!cJSON_IsNumber(vol_usage)) {
|
||||
ogs_error("OpenAPI_accu_usage_report_parseFromJSON() failed [vol_usage]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *vol_usage_uplink = cJSON_GetObjectItemCaseSensitive(accu_usage_reportJSON, "volUsageUplink");
|
||||
|
||||
if (vol_usage_uplink) {
|
||||
if (!cJSON_IsNumber(vol_usage_uplink)) {
|
||||
ogs_error("OpenAPI_accu_usage_report_parseFromJSON() failed [vol_usage_uplink]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *vol_usage_downlink = cJSON_GetObjectItemCaseSensitive(accu_usage_reportJSON, "volUsageDownlink");
|
||||
|
||||
if (vol_usage_downlink) {
|
||||
if (!cJSON_IsNumber(vol_usage_downlink)) {
|
||||
ogs_error("OpenAPI_accu_usage_report_parseFromJSON() failed [vol_usage_downlink]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *time_usage = cJSON_GetObjectItemCaseSensitive(accu_usage_reportJSON, "timeUsage");
|
||||
|
||||
if (time_usage) {
|
||||
if (!cJSON_IsNumber(time_usage)) {
|
||||
ogs_error("OpenAPI_accu_usage_report_parseFromJSON() failed [time_usage]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *next_vol_usage = cJSON_GetObjectItemCaseSensitive(accu_usage_reportJSON, "nextVolUsage");
|
||||
|
||||
if (next_vol_usage) {
|
||||
if (!cJSON_IsNumber(next_vol_usage)) {
|
||||
ogs_error("OpenAPI_accu_usage_report_parseFromJSON() failed [next_vol_usage]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *next_vol_usage_uplink = cJSON_GetObjectItemCaseSensitive(accu_usage_reportJSON, "nextVolUsageUplink");
|
||||
|
||||
if (next_vol_usage_uplink) {
|
||||
if (!cJSON_IsNumber(next_vol_usage_uplink)) {
|
||||
ogs_error("OpenAPI_accu_usage_report_parseFromJSON() failed [next_vol_usage_uplink]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *next_vol_usage_downlink = cJSON_GetObjectItemCaseSensitive(accu_usage_reportJSON, "nextVolUsageDownlink");
|
||||
|
||||
if (next_vol_usage_downlink) {
|
||||
if (!cJSON_IsNumber(next_vol_usage_downlink)) {
|
||||
ogs_error("OpenAPI_accu_usage_report_parseFromJSON() failed [next_vol_usage_downlink]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *next_time_usage = cJSON_GetObjectItemCaseSensitive(accu_usage_reportJSON, "nextTimeUsage");
|
||||
|
||||
if (next_time_usage) {
|
||||
if (!cJSON_IsNumber(next_time_usage)) {
|
||||
ogs_error("OpenAPI_accu_usage_report_parseFromJSON() failed [next_time_usage]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
accu_usage_report_local_var = OpenAPI_accu_usage_report_create (
|
||||
ogs_strdup(ref_um_ids->valuestring),
|
||||
vol_usage ? vol_usage->valuedouble : 0,
|
||||
vol_usage_uplink ? vol_usage_uplink->valuedouble : 0,
|
||||
vol_usage_downlink ? vol_usage_downlink->valuedouble : 0,
|
||||
time_usage ? time_usage->valuedouble : 0,
|
||||
next_vol_usage ? next_vol_usage->valuedouble : 0,
|
||||
next_vol_usage_uplink ? next_vol_usage_uplink->valuedouble : 0,
|
||||
next_vol_usage_downlink ? next_vol_usage_downlink->valuedouble : 0,
|
||||
next_time_usage ? next_time_usage->valuedouble : 0
|
||||
);
|
||||
|
||||
return accu_usage_report_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_accu_usage_report_t *OpenAPI_accu_usage_report_copy(OpenAPI_accu_usage_report_t *dst, OpenAPI_accu_usage_report_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_accu_usage_report_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_accu_usage_report_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_accu_usage_report_free(dst);
|
||||
dst = OpenAPI_accu_usage_report_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
54
lib/sbi/openapi/model/accu_usage_report.h
Normal file
54
lib/sbi/openapi/model/accu_usage_report.h
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* accu_usage_report.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_accu_usage_report_H_
|
||||
#define _OpenAPI_accu_usage_report_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_accu_usage_report_s OpenAPI_accu_usage_report_t;
|
||||
typedef struct OpenAPI_accu_usage_report_s {
|
||||
char *ref_um_ids;
|
||||
long vol_usage;
|
||||
long vol_usage_uplink;
|
||||
long vol_usage_downlink;
|
||||
int time_usage;
|
||||
long next_vol_usage;
|
||||
long next_vol_usage_uplink;
|
||||
long next_vol_usage_downlink;
|
||||
int next_time_usage;
|
||||
} OpenAPI_accu_usage_report_t;
|
||||
|
||||
OpenAPI_accu_usage_report_t *OpenAPI_accu_usage_report_create(
|
||||
char *ref_um_ids,
|
||||
long vol_usage,
|
||||
long vol_usage_uplink,
|
||||
long vol_usage_downlink,
|
||||
int time_usage,
|
||||
long next_vol_usage,
|
||||
long next_vol_usage_uplink,
|
||||
long next_vol_usage_downlink,
|
||||
int next_time_usage
|
||||
);
|
||||
void OpenAPI_accu_usage_report_free(OpenAPI_accu_usage_report_t *accu_usage_report);
|
||||
OpenAPI_accu_usage_report_t *OpenAPI_accu_usage_report_parseFromJSON(cJSON *accu_usage_reportJSON);
|
||||
cJSON *OpenAPI_accu_usage_report_convertToJSON(OpenAPI_accu_usage_report_t *accu_usage_report);
|
||||
OpenAPI_accu_usage_report_t *OpenAPI_accu_usage_report_copy(OpenAPI_accu_usage_report_t *dst, OpenAPI_accu_usage_report_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_accu_usage_report_H_ */
|
||||
|
||||
132
lib/sbi/openapi/model/additional_access_info.c
Normal file
132
lib/sbi/openapi/model/additional_access_info.c
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "additional_access_info.h"
|
||||
|
||||
OpenAPI_additional_access_info_t *OpenAPI_additional_access_info_create(
|
||||
OpenAPI_access_type_e access_type,
|
||||
OpenAPI_rat_type_e rat_type
|
||||
)
|
||||
{
|
||||
OpenAPI_additional_access_info_t *additional_access_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_additional_access_info_t));
|
||||
if (!additional_access_info_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
additional_access_info_local_var->access_type = access_type;
|
||||
additional_access_info_local_var->rat_type = rat_type;
|
||||
|
||||
return additional_access_info_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_additional_access_info_free(OpenAPI_additional_access_info_t *additional_access_info)
|
||||
{
|
||||
if (NULL == additional_access_info) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(additional_access_info);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_additional_access_info_convertToJSON(OpenAPI_additional_access_info_t *additional_access_info)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (additional_access_info == NULL) {
|
||||
ogs_error("OpenAPI_additional_access_info_convertToJSON() failed [AdditionalAccessInfo]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (!additional_access_info->access_type) {
|
||||
ogs_error("OpenAPI_additional_access_info_convertToJSON() failed [access_type]");
|
||||
goto end;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "accessType", OpenAPI_access_type_ToString(additional_access_info->access_type)) == NULL) {
|
||||
ogs_error("OpenAPI_additional_access_info_convertToJSON() failed [access_type]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (additional_access_info->rat_type) {
|
||||
if (cJSON_AddStringToObject(item, "ratType", OpenAPI_rat_type_ToString(additional_access_info->rat_type)) == NULL) {
|
||||
ogs_error("OpenAPI_additional_access_info_convertToJSON() failed [rat_type]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_additional_access_info_t *OpenAPI_additional_access_info_parseFromJSON(cJSON *additional_access_infoJSON)
|
||||
{
|
||||
OpenAPI_additional_access_info_t *additional_access_info_local_var = NULL;
|
||||
cJSON *access_type = cJSON_GetObjectItemCaseSensitive(additional_access_infoJSON, "accessType");
|
||||
if (!access_type) {
|
||||
ogs_error("OpenAPI_additional_access_info_parseFromJSON() failed [access_type]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_access_type_e access_typeVariable;
|
||||
|
||||
if (!cJSON_IsString(access_type)) {
|
||||
ogs_error("OpenAPI_additional_access_info_parseFromJSON() failed [access_type]");
|
||||
goto end;
|
||||
}
|
||||
access_typeVariable = OpenAPI_access_type_FromString(access_type->valuestring);
|
||||
|
||||
cJSON *rat_type = cJSON_GetObjectItemCaseSensitive(additional_access_infoJSON, "ratType");
|
||||
|
||||
OpenAPI_rat_type_e rat_typeVariable;
|
||||
if (rat_type) {
|
||||
if (!cJSON_IsString(rat_type)) {
|
||||
ogs_error("OpenAPI_additional_access_info_parseFromJSON() failed [rat_type]");
|
||||
goto end;
|
||||
}
|
||||
rat_typeVariable = OpenAPI_rat_type_FromString(rat_type->valuestring);
|
||||
}
|
||||
|
||||
additional_access_info_local_var = OpenAPI_additional_access_info_create (
|
||||
access_typeVariable,
|
||||
rat_type ? rat_typeVariable : 0
|
||||
);
|
||||
|
||||
return additional_access_info_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_additional_access_info_t *OpenAPI_additional_access_info_copy(OpenAPI_additional_access_info_t *dst, OpenAPI_additional_access_info_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_additional_access_info_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_additional_access_info_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_additional_access_info_free(dst);
|
||||
dst = OpenAPI_additional_access_info_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
42
lib/sbi/openapi/model/additional_access_info.h
Normal file
42
lib/sbi/openapi/model/additional_access_info.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* additional_access_info.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_additional_access_info_H_
|
||||
#define _OpenAPI_additional_access_info_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
#include "access_type.h"
|
||||
#include "rat_type.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_additional_access_info_s OpenAPI_additional_access_info_t;
|
||||
typedef struct OpenAPI_additional_access_info_s {
|
||||
OpenAPI_access_type_e access_type;
|
||||
OpenAPI_rat_type_e rat_type;
|
||||
} OpenAPI_additional_access_info_t;
|
||||
|
||||
OpenAPI_additional_access_info_t *OpenAPI_additional_access_info_create(
|
||||
OpenAPI_access_type_e access_type,
|
||||
OpenAPI_rat_type_e rat_type
|
||||
);
|
||||
void OpenAPI_additional_access_info_free(OpenAPI_additional_access_info_t *additional_access_info);
|
||||
OpenAPI_additional_access_info_t *OpenAPI_additional_access_info_parseFromJSON(cJSON *additional_access_infoJSON);
|
||||
cJSON *OpenAPI_additional_access_info_convertToJSON(OpenAPI_additional_access_info_t *additional_access_info);
|
||||
OpenAPI_additional_access_info_t *OpenAPI_additional_access_info_copy(OpenAPI_additional_access_info_t *dst, OpenAPI_additional_access_info_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_additional_access_info_H_ */
|
||||
|
||||
85
lib/sbi/openapi/model/af_sig_protocol.c
Normal file
85
lib/sbi/openapi/model/af_sig_protocol.c
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "af_sig_protocol.h"
|
||||
|
||||
OpenAPI_af_sig_protocol_t *OpenAPI_af_sig_protocol_create(
|
||||
)
|
||||
{
|
||||
OpenAPI_af_sig_protocol_t *af_sig_protocol_local_var = OpenAPI_malloc(sizeof(OpenAPI_af_sig_protocol_t));
|
||||
if (!af_sig_protocol_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return af_sig_protocol_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_af_sig_protocol_free(OpenAPI_af_sig_protocol_t *af_sig_protocol)
|
||||
{
|
||||
if (NULL == af_sig_protocol) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(af_sig_protocol);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_af_sig_protocol_convertToJSON(OpenAPI_af_sig_protocol_t *af_sig_protocol)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (af_sig_protocol == NULL) {
|
||||
ogs_error("OpenAPI_af_sig_protocol_convertToJSON() failed [AfSigProtocol]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_af_sig_protocol_t *OpenAPI_af_sig_protocol_parseFromJSON(cJSON *af_sig_protocolJSON)
|
||||
{
|
||||
OpenAPI_af_sig_protocol_t *af_sig_protocol_local_var = NULL;
|
||||
af_sig_protocol_local_var = OpenAPI_af_sig_protocol_create (
|
||||
);
|
||||
|
||||
return af_sig_protocol_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_af_sig_protocol_t *OpenAPI_af_sig_protocol_copy(OpenAPI_af_sig_protocol_t *dst, OpenAPI_af_sig_protocol_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_af_sig_protocol_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_af_sig_protocol_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_af_sig_protocol_free(dst);
|
||||
dst = OpenAPI_af_sig_protocol_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
37
lib/sbi/openapi/model/af_sig_protocol.h
Normal file
37
lib/sbi/openapi/model/af_sig_protocol.h
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* af_sig_protocol.h
|
||||
*
|
||||
* Possible values are - NO_INFORMATION: Indicate that no information about the AF signalling protocol is being provided. - SIP: Indicate that the signalling protocol is Session Initiation Protocol.
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_af_sig_protocol_H_
|
||||
#define _OpenAPI_af_sig_protocol_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
#include "null_value.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_af_sig_protocol_s OpenAPI_af_sig_protocol_t;
|
||||
typedef struct OpenAPI_af_sig_protocol_s {
|
||||
} OpenAPI_af_sig_protocol_t;
|
||||
|
||||
OpenAPI_af_sig_protocol_t *OpenAPI_af_sig_protocol_create(
|
||||
);
|
||||
void OpenAPI_af_sig_protocol_free(OpenAPI_af_sig_protocol_t *af_sig_protocol);
|
||||
OpenAPI_af_sig_protocol_t *OpenAPI_af_sig_protocol_parseFromJSON(cJSON *af_sig_protocolJSON);
|
||||
cJSON *OpenAPI_af_sig_protocol_convertToJSON(OpenAPI_af_sig_protocol_t *af_sig_protocol);
|
||||
OpenAPI_af_sig_protocol_t *OpenAPI_af_sig_protocol_copy(OpenAPI_af_sig_protocol_t *dst, OpenAPI_af_sig_protocol_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_af_sig_protocol_H_ */
|
||||
|
||||
125
lib/sbi/openapi/model/an_gw_address.c
Normal file
125
lib/sbi/openapi/model/an_gw_address.c
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "an_gw_address.h"
|
||||
|
||||
OpenAPI_an_gw_address_t *OpenAPI_an_gw_address_create(
|
||||
char *an_gw_ipv4_addr,
|
||||
char *an_gw_ipv6_addr
|
||||
)
|
||||
{
|
||||
OpenAPI_an_gw_address_t *an_gw_address_local_var = OpenAPI_malloc(sizeof(OpenAPI_an_gw_address_t));
|
||||
if (!an_gw_address_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
an_gw_address_local_var->an_gw_ipv4_addr = an_gw_ipv4_addr;
|
||||
an_gw_address_local_var->an_gw_ipv6_addr = an_gw_ipv6_addr;
|
||||
|
||||
return an_gw_address_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_an_gw_address_free(OpenAPI_an_gw_address_t *an_gw_address)
|
||||
{
|
||||
if (NULL == an_gw_address) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(an_gw_address->an_gw_ipv4_addr);
|
||||
ogs_free(an_gw_address->an_gw_ipv6_addr);
|
||||
ogs_free(an_gw_address);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_an_gw_address_convertToJSON(OpenAPI_an_gw_address_t *an_gw_address)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (an_gw_address == NULL) {
|
||||
ogs_error("OpenAPI_an_gw_address_convertToJSON() failed [AnGwAddress]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (an_gw_address->an_gw_ipv4_addr) {
|
||||
if (cJSON_AddStringToObject(item, "anGwIpv4Addr", an_gw_address->an_gw_ipv4_addr) == NULL) {
|
||||
ogs_error("OpenAPI_an_gw_address_convertToJSON() failed [an_gw_ipv4_addr]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (an_gw_address->an_gw_ipv6_addr) {
|
||||
if (cJSON_AddStringToObject(item, "anGwIpv6Addr", an_gw_address->an_gw_ipv6_addr) == NULL) {
|
||||
ogs_error("OpenAPI_an_gw_address_convertToJSON() failed [an_gw_ipv6_addr]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_an_gw_address_t *OpenAPI_an_gw_address_parseFromJSON(cJSON *an_gw_addressJSON)
|
||||
{
|
||||
OpenAPI_an_gw_address_t *an_gw_address_local_var = NULL;
|
||||
cJSON *an_gw_ipv4_addr = cJSON_GetObjectItemCaseSensitive(an_gw_addressJSON, "anGwIpv4Addr");
|
||||
|
||||
if (an_gw_ipv4_addr) {
|
||||
if (!cJSON_IsString(an_gw_ipv4_addr)) {
|
||||
ogs_error("OpenAPI_an_gw_address_parseFromJSON() failed [an_gw_ipv4_addr]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *an_gw_ipv6_addr = cJSON_GetObjectItemCaseSensitive(an_gw_addressJSON, "anGwIpv6Addr");
|
||||
|
||||
if (an_gw_ipv6_addr) {
|
||||
if (!cJSON_IsString(an_gw_ipv6_addr)) {
|
||||
ogs_error("OpenAPI_an_gw_address_parseFromJSON() failed [an_gw_ipv6_addr]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
an_gw_address_local_var = OpenAPI_an_gw_address_create (
|
||||
an_gw_ipv4_addr ? ogs_strdup(an_gw_ipv4_addr->valuestring) : NULL,
|
||||
an_gw_ipv6_addr ? ogs_strdup(an_gw_ipv6_addr->valuestring) : NULL
|
||||
);
|
||||
|
||||
return an_gw_address_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_an_gw_address_t *OpenAPI_an_gw_address_copy(OpenAPI_an_gw_address_t *dst, OpenAPI_an_gw_address_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_an_gw_address_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_an_gw_address_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_an_gw_address_free(dst);
|
||||
dst = OpenAPI_an_gw_address_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
40
lib/sbi/openapi/model/an_gw_address.h
Normal file
40
lib/sbi/openapi/model/an_gw_address.h
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* an_gw_address.h
|
||||
*
|
||||
* describes the address of the access network gateway control node
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_an_gw_address_H_
|
||||
#define _OpenAPI_an_gw_address_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_an_gw_address_s OpenAPI_an_gw_address_t;
|
||||
typedef struct OpenAPI_an_gw_address_s {
|
||||
char *an_gw_ipv4_addr;
|
||||
char *an_gw_ipv6_addr;
|
||||
} OpenAPI_an_gw_address_t;
|
||||
|
||||
OpenAPI_an_gw_address_t *OpenAPI_an_gw_address_create(
|
||||
char *an_gw_ipv4_addr,
|
||||
char *an_gw_ipv6_addr
|
||||
);
|
||||
void OpenAPI_an_gw_address_free(OpenAPI_an_gw_address_t *an_gw_address);
|
||||
OpenAPI_an_gw_address_t *OpenAPI_an_gw_address_parseFromJSON(cJSON *an_gw_addressJSON);
|
||||
cJSON *OpenAPI_an_gw_address_convertToJSON(OpenAPI_an_gw_address_t *an_gw_address);
|
||||
OpenAPI_an_gw_address_t *OpenAPI_an_gw_address_copy(OpenAPI_an_gw_address_t *dst, OpenAPI_an_gw_address_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_an_gw_address_H_ */
|
||||
|
||||
180
lib/sbi/openapi/model/app_detection_info.c
Normal file
180
lib/sbi/openapi/model/app_detection_info.c
Normal file
|
|
@ -0,0 +1,180 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "app_detection_info.h"
|
||||
|
||||
OpenAPI_app_detection_info_t *OpenAPI_app_detection_info_create(
|
||||
char *app_id,
|
||||
char *instance_id,
|
||||
OpenAPI_list_t *sdf_descriptions
|
||||
)
|
||||
{
|
||||
OpenAPI_app_detection_info_t *app_detection_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_app_detection_info_t));
|
||||
if (!app_detection_info_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
app_detection_info_local_var->app_id = app_id;
|
||||
app_detection_info_local_var->instance_id = instance_id;
|
||||
app_detection_info_local_var->sdf_descriptions = sdf_descriptions;
|
||||
|
||||
return app_detection_info_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_app_detection_info_free(OpenAPI_app_detection_info_t *app_detection_info)
|
||||
{
|
||||
if (NULL == app_detection_info) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(app_detection_info->app_id);
|
||||
ogs_free(app_detection_info->instance_id);
|
||||
OpenAPI_list_for_each(app_detection_info->sdf_descriptions, node) {
|
||||
OpenAPI_flow_information_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(app_detection_info->sdf_descriptions);
|
||||
ogs_free(app_detection_info);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_app_detection_info_convertToJSON(OpenAPI_app_detection_info_t *app_detection_info)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (app_detection_info == NULL) {
|
||||
ogs_error("OpenAPI_app_detection_info_convertToJSON() failed [AppDetectionInfo]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (!app_detection_info->app_id) {
|
||||
ogs_error("OpenAPI_app_detection_info_convertToJSON() failed [app_id]");
|
||||
goto end;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "appId", app_detection_info->app_id) == NULL) {
|
||||
ogs_error("OpenAPI_app_detection_info_convertToJSON() failed [app_id]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (app_detection_info->instance_id) {
|
||||
if (cJSON_AddStringToObject(item, "instanceId", app_detection_info->instance_id) == NULL) {
|
||||
ogs_error("OpenAPI_app_detection_info_convertToJSON() failed [instance_id]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (app_detection_info->sdf_descriptions) {
|
||||
cJSON *sdf_descriptionsList = cJSON_AddArrayToObject(item, "sdfDescriptions");
|
||||
if (sdf_descriptionsList == NULL) {
|
||||
ogs_error("OpenAPI_app_detection_info_convertToJSON() failed [sdf_descriptions]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *sdf_descriptions_node;
|
||||
if (app_detection_info->sdf_descriptions) {
|
||||
OpenAPI_list_for_each(app_detection_info->sdf_descriptions, sdf_descriptions_node) {
|
||||
cJSON *itemLocal = OpenAPI_flow_information_convertToJSON(sdf_descriptions_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_app_detection_info_convertToJSON() failed [sdf_descriptions]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(sdf_descriptionsList, itemLocal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_app_detection_info_t *OpenAPI_app_detection_info_parseFromJSON(cJSON *app_detection_infoJSON)
|
||||
{
|
||||
OpenAPI_app_detection_info_t *app_detection_info_local_var = NULL;
|
||||
cJSON *app_id = cJSON_GetObjectItemCaseSensitive(app_detection_infoJSON, "appId");
|
||||
if (!app_id) {
|
||||
ogs_error("OpenAPI_app_detection_info_parseFromJSON() failed [app_id]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
if (!cJSON_IsString(app_id)) {
|
||||
ogs_error("OpenAPI_app_detection_info_parseFromJSON() failed [app_id]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *instance_id = cJSON_GetObjectItemCaseSensitive(app_detection_infoJSON, "instanceId");
|
||||
|
||||
if (instance_id) {
|
||||
if (!cJSON_IsString(instance_id)) {
|
||||
ogs_error("OpenAPI_app_detection_info_parseFromJSON() failed [instance_id]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *sdf_descriptions = cJSON_GetObjectItemCaseSensitive(app_detection_infoJSON, "sdfDescriptions");
|
||||
|
||||
OpenAPI_list_t *sdf_descriptionsList;
|
||||
if (sdf_descriptions) {
|
||||
cJSON *sdf_descriptions_local_nonprimitive;
|
||||
if (!cJSON_IsArray(sdf_descriptions)) {
|
||||
ogs_error("OpenAPI_app_detection_info_parseFromJSON() failed [sdf_descriptions]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
sdf_descriptionsList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(sdf_descriptions_local_nonprimitive, sdf_descriptions ) {
|
||||
if (!cJSON_IsObject(sdf_descriptions_local_nonprimitive)) {
|
||||
ogs_error("OpenAPI_app_detection_info_parseFromJSON() failed [sdf_descriptions]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_flow_information_t *sdf_descriptionsItem = OpenAPI_flow_information_parseFromJSON(sdf_descriptions_local_nonprimitive);
|
||||
|
||||
OpenAPI_list_add(sdf_descriptionsList, sdf_descriptionsItem);
|
||||
}
|
||||
}
|
||||
|
||||
app_detection_info_local_var = OpenAPI_app_detection_info_create (
|
||||
ogs_strdup(app_id->valuestring),
|
||||
instance_id ? ogs_strdup(instance_id->valuestring) : NULL,
|
||||
sdf_descriptions ? sdf_descriptionsList : NULL
|
||||
);
|
||||
|
||||
return app_detection_info_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_app_detection_info_t *OpenAPI_app_detection_info_copy(OpenAPI_app_detection_info_t *dst, OpenAPI_app_detection_info_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_app_detection_info_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_app_detection_info_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_app_detection_info_free(dst);
|
||||
dst = OpenAPI_app_detection_info_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
43
lib/sbi/openapi/model/app_detection_info.h
Normal file
43
lib/sbi/openapi/model/app_detection_info.h
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* app_detection_info.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_app_detection_info_H_
|
||||
#define _OpenAPI_app_detection_info_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
#include "flow_information.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_app_detection_info_s OpenAPI_app_detection_info_t;
|
||||
typedef struct OpenAPI_app_detection_info_s {
|
||||
char *app_id;
|
||||
char *instance_id;
|
||||
OpenAPI_list_t *sdf_descriptions;
|
||||
} OpenAPI_app_detection_info_t;
|
||||
|
||||
OpenAPI_app_detection_info_t *OpenAPI_app_detection_info_create(
|
||||
char *app_id,
|
||||
char *instance_id,
|
||||
OpenAPI_list_t *sdf_descriptions
|
||||
);
|
||||
void OpenAPI_app_detection_info_free(OpenAPI_app_detection_info_t *app_detection_info);
|
||||
OpenAPI_app_detection_info_t *OpenAPI_app_detection_info_parseFromJSON(cJSON *app_detection_infoJSON);
|
||||
cJSON *OpenAPI_app_detection_info_convertToJSON(OpenAPI_app_detection_info_t *app_detection_info);
|
||||
OpenAPI_app_detection_info_t *OpenAPI_app_detection_info_copy(OpenAPI_app_detection_info_t *dst, OpenAPI_app_detection_info_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_app_detection_info_H_ */
|
||||
|
||||
303
lib/sbi/openapi/model/authorized_default_qos.c
Normal file
303
lib/sbi/openapi/model/authorized_default_qos.c
Normal file
|
|
@ -0,0 +1,303 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "authorized_default_qos.h"
|
||||
|
||||
OpenAPI_authorized_default_qos_t *OpenAPI_authorized_default_qos_create(
|
||||
int _5qi,
|
||||
OpenAPI_arp_t *arp,
|
||||
int priority_level,
|
||||
int aver_window,
|
||||
int max_data_burst_vol,
|
||||
char *maxbr_ul,
|
||||
char *maxbr_dl,
|
||||
char *gbr_ul,
|
||||
char *gbr_dl,
|
||||
int qnc,
|
||||
int ext_max_data_burst_vol
|
||||
)
|
||||
{
|
||||
OpenAPI_authorized_default_qos_t *authorized_default_qos_local_var = OpenAPI_malloc(sizeof(OpenAPI_authorized_default_qos_t));
|
||||
if (!authorized_default_qos_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
authorized_default_qos_local_var->_5qi = _5qi;
|
||||
authorized_default_qos_local_var->arp = arp;
|
||||
authorized_default_qos_local_var->priority_level = priority_level;
|
||||
authorized_default_qos_local_var->aver_window = aver_window;
|
||||
authorized_default_qos_local_var->max_data_burst_vol = max_data_burst_vol;
|
||||
authorized_default_qos_local_var->maxbr_ul = maxbr_ul;
|
||||
authorized_default_qos_local_var->maxbr_dl = maxbr_dl;
|
||||
authorized_default_qos_local_var->gbr_ul = gbr_ul;
|
||||
authorized_default_qos_local_var->gbr_dl = gbr_dl;
|
||||
authorized_default_qos_local_var->qnc = qnc;
|
||||
authorized_default_qos_local_var->ext_max_data_burst_vol = ext_max_data_burst_vol;
|
||||
|
||||
return authorized_default_qos_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_authorized_default_qos_free(OpenAPI_authorized_default_qos_t *authorized_default_qos)
|
||||
{
|
||||
if (NULL == authorized_default_qos) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_arp_free(authorized_default_qos->arp);
|
||||
ogs_free(authorized_default_qos->maxbr_ul);
|
||||
ogs_free(authorized_default_qos->maxbr_dl);
|
||||
ogs_free(authorized_default_qos->gbr_ul);
|
||||
ogs_free(authorized_default_qos->gbr_dl);
|
||||
ogs_free(authorized_default_qos);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_authorized_default_qos_convertToJSON(OpenAPI_authorized_default_qos_t *authorized_default_qos)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (authorized_default_qos == NULL) {
|
||||
ogs_error("OpenAPI_authorized_default_qos_convertToJSON() failed [AuthorizedDefaultQos]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (authorized_default_qos->_5qi) {
|
||||
if (cJSON_AddNumberToObject(item, "5qi", authorized_default_qos->_5qi) == NULL) {
|
||||
ogs_error("OpenAPI_authorized_default_qos_convertToJSON() failed [_5qi]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (authorized_default_qos->arp) {
|
||||
cJSON *arp_local_JSON = OpenAPI_arp_convertToJSON(authorized_default_qos->arp);
|
||||
if (arp_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_authorized_default_qos_convertToJSON() failed [arp]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "arp", arp_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_authorized_default_qos_convertToJSON() failed [arp]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (authorized_default_qos->priority_level) {
|
||||
if (cJSON_AddNumberToObject(item, "priorityLevel", authorized_default_qos->priority_level) == NULL) {
|
||||
ogs_error("OpenAPI_authorized_default_qos_convertToJSON() failed [priority_level]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (authorized_default_qos->aver_window) {
|
||||
if (cJSON_AddNumberToObject(item, "averWindow", authorized_default_qos->aver_window) == NULL) {
|
||||
ogs_error("OpenAPI_authorized_default_qos_convertToJSON() failed [aver_window]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (authorized_default_qos->max_data_burst_vol) {
|
||||
if (cJSON_AddNumberToObject(item, "maxDataBurstVol", authorized_default_qos->max_data_burst_vol) == NULL) {
|
||||
ogs_error("OpenAPI_authorized_default_qos_convertToJSON() failed [max_data_burst_vol]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (authorized_default_qos->maxbr_ul) {
|
||||
if (cJSON_AddStringToObject(item, "maxbrUl", authorized_default_qos->maxbr_ul) == NULL) {
|
||||
ogs_error("OpenAPI_authorized_default_qos_convertToJSON() failed [maxbr_ul]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (authorized_default_qos->maxbr_dl) {
|
||||
if (cJSON_AddStringToObject(item, "maxbrDl", authorized_default_qos->maxbr_dl) == NULL) {
|
||||
ogs_error("OpenAPI_authorized_default_qos_convertToJSON() failed [maxbr_dl]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (authorized_default_qos->gbr_ul) {
|
||||
if (cJSON_AddStringToObject(item, "gbrUl", authorized_default_qos->gbr_ul) == NULL) {
|
||||
ogs_error("OpenAPI_authorized_default_qos_convertToJSON() failed [gbr_ul]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (authorized_default_qos->gbr_dl) {
|
||||
if (cJSON_AddStringToObject(item, "gbrDl", authorized_default_qos->gbr_dl) == NULL) {
|
||||
ogs_error("OpenAPI_authorized_default_qos_convertToJSON() failed [gbr_dl]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (authorized_default_qos->qnc) {
|
||||
if (cJSON_AddBoolToObject(item, "qnc", authorized_default_qos->qnc) == NULL) {
|
||||
ogs_error("OpenAPI_authorized_default_qos_convertToJSON() failed [qnc]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (authorized_default_qos->ext_max_data_burst_vol) {
|
||||
if (cJSON_AddNumberToObject(item, "extMaxDataBurstVol", authorized_default_qos->ext_max_data_burst_vol) == NULL) {
|
||||
ogs_error("OpenAPI_authorized_default_qos_convertToJSON() failed [ext_max_data_burst_vol]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_authorized_default_qos_t *OpenAPI_authorized_default_qos_parseFromJSON(cJSON *authorized_default_qosJSON)
|
||||
{
|
||||
OpenAPI_authorized_default_qos_t *authorized_default_qos_local_var = NULL;
|
||||
cJSON *_5qi = cJSON_GetObjectItemCaseSensitive(authorized_default_qosJSON, "5qi");
|
||||
|
||||
if (_5qi) {
|
||||
if (!cJSON_IsNumber(_5qi)) {
|
||||
ogs_error("OpenAPI_authorized_default_qos_parseFromJSON() failed [_5qi]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *arp = cJSON_GetObjectItemCaseSensitive(authorized_default_qosJSON, "arp");
|
||||
|
||||
OpenAPI_arp_t *arp_local_nonprim = NULL;
|
||||
if (arp) {
|
||||
arp_local_nonprim = OpenAPI_arp_parseFromJSON(arp);
|
||||
}
|
||||
|
||||
cJSON *priority_level = cJSON_GetObjectItemCaseSensitive(authorized_default_qosJSON, "priorityLevel");
|
||||
|
||||
if (priority_level) {
|
||||
if (!cJSON_IsNumber(priority_level)) {
|
||||
ogs_error("OpenAPI_authorized_default_qos_parseFromJSON() failed [priority_level]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *aver_window = cJSON_GetObjectItemCaseSensitive(authorized_default_qosJSON, "averWindow");
|
||||
|
||||
if (aver_window) {
|
||||
if (!cJSON_IsNumber(aver_window)) {
|
||||
ogs_error("OpenAPI_authorized_default_qos_parseFromJSON() failed [aver_window]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *max_data_burst_vol = cJSON_GetObjectItemCaseSensitive(authorized_default_qosJSON, "maxDataBurstVol");
|
||||
|
||||
if (max_data_burst_vol) {
|
||||
if (!cJSON_IsNumber(max_data_burst_vol)) {
|
||||
ogs_error("OpenAPI_authorized_default_qos_parseFromJSON() failed [max_data_burst_vol]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *maxbr_ul = cJSON_GetObjectItemCaseSensitive(authorized_default_qosJSON, "maxbrUl");
|
||||
|
||||
if (maxbr_ul) {
|
||||
if (!cJSON_IsString(maxbr_ul)) {
|
||||
ogs_error("OpenAPI_authorized_default_qos_parseFromJSON() failed [maxbr_ul]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *maxbr_dl = cJSON_GetObjectItemCaseSensitive(authorized_default_qosJSON, "maxbrDl");
|
||||
|
||||
if (maxbr_dl) {
|
||||
if (!cJSON_IsString(maxbr_dl)) {
|
||||
ogs_error("OpenAPI_authorized_default_qos_parseFromJSON() failed [maxbr_dl]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *gbr_ul = cJSON_GetObjectItemCaseSensitive(authorized_default_qosJSON, "gbrUl");
|
||||
|
||||
if (gbr_ul) {
|
||||
if (!cJSON_IsString(gbr_ul)) {
|
||||
ogs_error("OpenAPI_authorized_default_qos_parseFromJSON() failed [gbr_ul]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *gbr_dl = cJSON_GetObjectItemCaseSensitive(authorized_default_qosJSON, "gbrDl");
|
||||
|
||||
if (gbr_dl) {
|
||||
if (!cJSON_IsString(gbr_dl)) {
|
||||
ogs_error("OpenAPI_authorized_default_qos_parseFromJSON() failed [gbr_dl]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *qnc = cJSON_GetObjectItemCaseSensitive(authorized_default_qosJSON, "qnc");
|
||||
|
||||
if (qnc) {
|
||||
if (!cJSON_IsBool(qnc)) {
|
||||
ogs_error("OpenAPI_authorized_default_qos_parseFromJSON() failed [qnc]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *ext_max_data_burst_vol = cJSON_GetObjectItemCaseSensitive(authorized_default_qosJSON, "extMaxDataBurstVol");
|
||||
|
||||
if (ext_max_data_burst_vol) {
|
||||
if (!cJSON_IsNumber(ext_max_data_burst_vol)) {
|
||||
ogs_error("OpenAPI_authorized_default_qos_parseFromJSON() failed [ext_max_data_burst_vol]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
authorized_default_qos_local_var = OpenAPI_authorized_default_qos_create (
|
||||
_5qi ? _5qi->valuedouble : 0,
|
||||
arp ? arp_local_nonprim : NULL,
|
||||
priority_level ? priority_level->valuedouble : 0,
|
||||
aver_window ? aver_window->valuedouble : 0,
|
||||
max_data_burst_vol ? max_data_burst_vol->valuedouble : 0,
|
||||
maxbr_ul ? ogs_strdup(maxbr_ul->valuestring) : NULL,
|
||||
maxbr_dl ? ogs_strdup(maxbr_dl->valuestring) : NULL,
|
||||
gbr_ul ? ogs_strdup(gbr_ul->valuestring) : NULL,
|
||||
gbr_dl ? ogs_strdup(gbr_dl->valuestring) : NULL,
|
||||
qnc ? qnc->valueint : 0,
|
||||
ext_max_data_burst_vol ? ext_max_data_burst_vol->valuedouble : 0
|
||||
);
|
||||
|
||||
return authorized_default_qos_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_authorized_default_qos_t *OpenAPI_authorized_default_qos_copy(OpenAPI_authorized_default_qos_t *dst, OpenAPI_authorized_default_qos_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_authorized_default_qos_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_authorized_default_qos_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_authorized_default_qos_free(dst);
|
||||
dst = OpenAPI_authorized_default_qos_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
59
lib/sbi/openapi/model/authorized_default_qos.h
Normal file
59
lib/sbi/openapi/model/authorized_default_qos.h
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* authorized_default_qos.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_authorized_default_qos_H_
|
||||
#define _OpenAPI_authorized_default_qos_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
#include "arp.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_authorized_default_qos_s OpenAPI_authorized_default_qos_t;
|
||||
typedef struct OpenAPI_authorized_default_qos_s {
|
||||
int _5qi;
|
||||
struct OpenAPI_arp_s *arp;
|
||||
int priority_level;
|
||||
int aver_window;
|
||||
int max_data_burst_vol;
|
||||
char *maxbr_ul;
|
||||
char *maxbr_dl;
|
||||
char *gbr_ul;
|
||||
char *gbr_dl;
|
||||
int qnc;
|
||||
int ext_max_data_burst_vol;
|
||||
} OpenAPI_authorized_default_qos_t;
|
||||
|
||||
OpenAPI_authorized_default_qos_t *OpenAPI_authorized_default_qos_create(
|
||||
int _5qi,
|
||||
OpenAPI_arp_t *arp,
|
||||
int priority_level,
|
||||
int aver_window,
|
||||
int max_data_burst_vol,
|
||||
char *maxbr_ul,
|
||||
char *maxbr_dl,
|
||||
char *gbr_ul,
|
||||
char *gbr_dl,
|
||||
int qnc,
|
||||
int ext_max_data_burst_vol
|
||||
);
|
||||
void OpenAPI_authorized_default_qos_free(OpenAPI_authorized_default_qos_t *authorized_default_qos);
|
||||
OpenAPI_authorized_default_qos_t *OpenAPI_authorized_default_qos_parseFromJSON(cJSON *authorized_default_qosJSON);
|
||||
cJSON *OpenAPI_authorized_default_qos_convertToJSON(OpenAPI_authorized_default_qos_t *authorized_default_qos);
|
||||
OpenAPI_authorized_default_qos_t *OpenAPI_authorized_default_qos_copy(OpenAPI_authorized_default_qos_t *dst, OpenAPI_authorized_default_qos_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_authorized_default_qos_H_ */
|
||||
|
||||
157
lib/sbi/openapi/model/candidate_for_replacement.c
Normal file
157
lib/sbi/openapi/model/candidate_for_replacement.c
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "candidate_for_replacement.h"
|
||||
|
||||
OpenAPI_candidate_for_replacement_t *OpenAPI_candidate_for_replacement_create(
|
||||
OpenAPI_snssai_t *snssai,
|
||||
OpenAPI_list_t *dnns
|
||||
)
|
||||
{
|
||||
OpenAPI_candidate_for_replacement_t *candidate_for_replacement_local_var = OpenAPI_malloc(sizeof(OpenAPI_candidate_for_replacement_t));
|
||||
if (!candidate_for_replacement_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
candidate_for_replacement_local_var->snssai = snssai;
|
||||
candidate_for_replacement_local_var->dnns = dnns;
|
||||
|
||||
return candidate_for_replacement_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_candidate_for_replacement_free(OpenAPI_candidate_for_replacement_t *candidate_for_replacement)
|
||||
{
|
||||
if (NULL == candidate_for_replacement) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_snssai_free(candidate_for_replacement->snssai);
|
||||
OpenAPI_list_for_each(candidate_for_replacement->dnns, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(candidate_for_replacement->dnns);
|
||||
ogs_free(candidate_for_replacement);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_candidate_for_replacement_convertToJSON(OpenAPI_candidate_for_replacement_t *candidate_for_replacement)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (candidate_for_replacement == NULL) {
|
||||
ogs_error("OpenAPI_candidate_for_replacement_convertToJSON() failed [CandidateForReplacement]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (!candidate_for_replacement->snssai) {
|
||||
ogs_error("OpenAPI_candidate_for_replacement_convertToJSON() failed [snssai]");
|
||||
goto end;
|
||||
}
|
||||
cJSON *snssai_local_JSON = OpenAPI_snssai_convertToJSON(candidate_for_replacement->snssai);
|
||||
if (snssai_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_candidate_for_replacement_convertToJSON() failed [snssai]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "snssai", snssai_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_candidate_for_replacement_convertToJSON() failed [snssai]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (candidate_for_replacement->dnns) {
|
||||
cJSON *dnns = cJSON_AddArrayToObject(item, "dnns");
|
||||
if (dnns == NULL) {
|
||||
ogs_error("OpenAPI_candidate_for_replacement_convertToJSON() failed [dnns]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *dnns_node;
|
||||
OpenAPI_list_for_each(candidate_for_replacement->dnns, dnns_node) {
|
||||
if (cJSON_AddStringToObject(dnns, "", (char*)dnns_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_candidate_for_replacement_convertToJSON() failed [dnns]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_candidate_for_replacement_t *OpenAPI_candidate_for_replacement_parseFromJSON(cJSON *candidate_for_replacementJSON)
|
||||
{
|
||||
OpenAPI_candidate_for_replacement_t *candidate_for_replacement_local_var = NULL;
|
||||
cJSON *snssai = cJSON_GetObjectItemCaseSensitive(candidate_for_replacementJSON, "snssai");
|
||||
if (!snssai) {
|
||||
ogs_error("OpenAPI_candidate_for_replacement_parseFromJSON() failed [snssai]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_snssai_t *snssai_local_nonprim = NULL;
|
||||
|
||||
snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(snssai);
|
||||
|
||||
cJSON *dnns = cJSON_GetObjectItemCaseSensitive(candidate_for_replacementJSON, "dnns");
|
||||
|
||||
OpenAPI_list_t *dnnsList;
|
||||
if (dnns) {
|
||||
cJSON *dnns_local;
|
||||
if (!cJSON_IsArray(dnns)) {
|
||||
ogs_error("OpenAPI_candidate_for_replacement_parseFromJSON() failed [dnns]");
|
||||
goto end;
|
||||
}
|
||||
dnnsList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(dnns_local, dnns) {
|
||||
if (!cJSON_IsString(dnns_local)) {
|
||||
ogs_error("OpenAPI_candidate_for_replacement_parseFromJSON() failed [dnns]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(dnnsList, ogs_strdup(dnns_local->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
candidate_for_replacement_local_var = OpenAPI_candidate_for_replacement_create (
|
||||
snssai_local_nonprim,
|
||||
dnns ? dnnsList : NULL
|
||||
);
|
||||
|
||||
return candidate_for_replacement_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_candidate_for_replacement_t *OpenAPI_candidate_for_replacement_copy(OpenAPI_candidate_for_replacement_t *dst, OpenAPI_candidate_for_replacement_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_candidate_for_replacement_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_candidate_for_replacement_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_candidate_for_replacement_free(dst);
|
||||
dst = OpenAPI_candidate_for_replacement_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
41
lib/sbi/openapi/model/candidate_for_replacement.h
Normal file
41
lib/sbi/openapi/model/candidate_for_replacement.h
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* candidate_for_replacement.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_candidate_for_replacement_H_
|
||||
#define _OpenAPI_candidate_for_replacement_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
#include "snssai.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_candidate_for_replacement_s OpenAPI_candidate_for_replacement_t;
|
||||
typedef struct OpenAPI_candidate_for_replacement_s {
|
||||
struct OpenAPI_snssai_s *snssai;
|
||||
OpenAPI_list_t *dnns;
|
||||
} OpenAPI_candidate_for_replacement_t;
|
||||
|
||||
OpenAPI_candidate_for_replacement_t *OpenAPI_candidate_for_replacement_create(
|
||||
OpenAPI_snssai_t *snssai,
|
||||
OpenAPI_list_t *dnns
|
||||
);
|
||||
void OpenAPI_candidate_for_replacement_free(OpenAPI_candidate_for_replacement_t *candidate_for_replacement);
|
||||
OpenAPI_candidate_for_replacement_t *OpenAPI_candidate_for_replacement_parseFromJSON(cJSON *candidate_for_replacementJSON);
|
||||
cJSON *OpenAPI_candidate_for_replacement_convertToJSON(OpenAPI_candidate_for_replacement_t *candidate_for_replacement);
|
||||
OpenAPI_candidate_for_replacement_t *OpenAPI_candidate_for_replacement_copy(OpenAPI_candidate_for_replacement_t *dst, OpenAPI_candidate_for_replacement_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_candidate_for_replacement_H_ */
|
||||
|
||||
332
lib/sbi/openapi/model/charging_data.c
Normal file
332
lib/sbi/openapi/model/charging_data.c
Normal file
|
|
@ -0,0 +1,332 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "charging_data.h"
|
||||
|
||||
OpenAPI_charging_data_t *OpenAPI_charging_data_create(
|
||||
char *chg_id,
|
||||
OpenAPI_metering_method_t *metering_method,
|
||||
int offline,
|
||||
int online,
|
||||
int sdf_handl,
|
||||
int rating_group,
|
||||
OpenAPI_reporting_level_t *reporting_level,
|
||||
int service_id,
|
||||
char *sponsor_id,
|
||||
char *app_svc_prov_id,
|
||||
int af_charging_identifier,
|
||||
char *af_charg_id
|
||||
)
|
||||
{
|
||||
OpenAPI_charging_data_t *charging_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_charging_data_t));
|
||||
if (!charging_data_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
charging_data_local_var->chg_id = chg_id;
|
||||
charging_data_local_var->metering_method = metering_method;
|
||||
charging_data_local_var->offline = offline;
|
||||
charging_data_local_var->online = online;
|
||||
charging_data_local_var->sdf_handl = sdf_handl;
|
||||
charging_data_local_var->rating_group = rating_group;
|
||||
charging_data_local_var->reporting_level = reporting_level;
|
||||
charging_data_local_var->service_id = service_id;
|
||||
charging_data_local_var->sponsor_id = sponsor_id;
|
||||
charging_data_local_var->app_svc_prov_id = app_svc_prov_id;
|
||||
charging_data_local_var->af_charging_identifier = af_charging_identifier;
|
||||
charging_data_local_var->af_charg_id = af_charg_id;
|
||||
|
||||
return charging_data_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_charging_data_free(OpenAPI_charging_data_t *charging_data)
|
||||
{
|
||||
if (NULL == charging_data) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(charging_data->chg_id);
|
||||
OpenAPI_metering_method_free(charging_data->metering_method);
|
||||
OpenAPI_reporting_level_free(charging_data->reporting_level);
|
||||
ogs_free(charging_data->sponsor_id);
|
||||
ogs_free(charging_data->app_svc_prov_id);
|
||||
ogs_free(charging_data->af_charg_id);
|
||||
ogs_free(charging_data);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_charging_data_convertToJSON(OpenAPI_charging_data_t *charging_data)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (charging_data == NULL) {
|
||||
ogs_error("OpenAPI_charging_data_convertToJSON() failed [ChargingData]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (!charging_data->chg_id) {
|
||||
ogs_error("OpenAPI_charging_data_convertToJSON() failed [chg_id]");
|
||||
goto end;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "chgId", charging_data->chg_id) == NULL) {
|
||||
ogs_error("OpenAPI_charging_data_convertToJSON() failed [chg_id]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (charging_data->metering_method) {
|
||||
cJSON *metering_method_local_JSON = OpenAPI_metering_method_convertToJSON(charging_data->metering_method);
|
||||
if (metering_method_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_charging_data_convertToJSON() failed [metering_method]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "meteringMethod", metering_method_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_charging_data_convertToJSON() failed [metering_method]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (charging_data->offline) {
|
||||
if (cJSON_AddBoolToObject(item, "offline", charging_data->offline) == NULL) {
|
||||
ogs_error("OpenAPI_charging_data_convertToJSON() failed [offline]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (charging_data->online) {
|
||||
if (cJSON_AddBoolToObject(item, "online", charging_data->online) == NULL) {
|
||||
ogs_error("OpenAPI_charging_data_convertToJSON() failed [online]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (charging_data->sdf_handl) {
|
||||
if (cJSON_AddBoolToObject(item, "sdfHandl", charging_data->sdf_handl) == NULL) {
|
||||
ogs_error("OpenAPI_charging_data_convertToJSON() failed [sdf_handl]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (charging_data->rating_group) {
|
||||
if (cJSON_AddNumberToObject(item, "ratingGroup", charging_data->rating_group) == NULL) {
|
||||
ogs_error("OpenAPI_charging_data_convertToJSON() failed [rating_group]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (charging_data->reporting_level) {
|
||||
cJSON *reporting_level_local_JSON = OpenAPI_reporting_level_convertToJSON(charging_data->reporting_level);
|
||||
if (reporting_level_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_charging_data_convertToJSON() failed [reporting_level]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "reportingLevel", reporting_level_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_charging_data_convertToJSON() failed [reporting_level]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (charging_data->service_id) {
|
||||
if (cJSON_AddNumberToObject(item, "serviceId", charging_data->service_id) == NULL) {
|
||||
ogs_error("OpenAPI_charging_data_convertToJSON() failed [service_id]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (charging_data->sponsor_id) {
|
||||
if (cJSON_AddStringToObject(item, "sponsorId", charging_data->sponsor_id) == NULL) {
|
||||
ogs_error("OpenAPI_charging_data_convertToJSON() failed [sponsor_id]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (charging_data->app_svc_prov_id) {
|
||||
if (cJSON_AddStringToObject(item, "appSvcProvId", charging_data->app_svc_prov_id) == NULL) {
|
||||
ogs_error("OpenAPI_charging_data_convertToJSON() failed [app_svc_prov_id]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (charging_data->af_charging_identifier) {
|
||||
if (cJSON_AddNumberToObject(item, "afChargingIdentifier", charging_data->af_charging_identifier) == NULL) {
|
||||
ogs_error("OpenAPI_charging_data_convertToJSON() failed [af_charging_identifier]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (charging_data->af_charg_id) {
|
||||
if (cJSON_AddStringToObject(item, "afChargId", charging_data->af_charg_id) == NULL) {
|
||||
ogs_error("OpenAPI_charging_data_convertToJSON() failed [af_charg_id]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_charging_data_t *OpenAPI_charging_data_parseFromJSON(cJSON *charging_dataJSON)
|
||||
{
|
||||
OpenAPI_charging_data_t *charging_data_local_var = NULL;
|
||||
cJSON *chg_id = cJSON_GetObjectItemCaseSensitive(charging_dataJSON, "chgId");
|
||||
if (!chg_id) {
|
||||
ogs_error("OpenAPI_charging_data_parseFromJSON() failed [chg_id]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
if (!cJSON_IsString(chg_id)) {
|
||||
ogs_error("OpenAPI_charging_data_parseFromJSON() failed [chg_id]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *metering_method = cJSON_GetObjectItemCaseSensitive(charging_dataJSON, "meteringMethod");
|
||||
|
||||
OpenAPI_metering_method_t *metering_method_local_nonprim = NULL;
|
||||
if (metering_method) {
|
||||
metering_method_local_nonprim = OpenAPI_metering_method_parseFromJSON(metering_method);
|
||||
}
|
||||
|
||||
cJSON *offline = cJSON_GetObjectItemCaseSensitive(charging_dataJSON, "offline");
|
||||
|
||||
if (offline) {
|
||||
if (!cJSON_IsBool(offline)) {
|
||||
ogs_error("OpenAPI_charging_data_parseFromJSON() failed [offline]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *online = cJSON_GetObjectItemCaseSensitive(charging_dataJSON, "online");
|
||||
|
||||
if (online) {
|
||||
if (!cJSON_IsBool(online)) {
|
||||
ogs_error("OpenAPI_charging_data_parseFromJSON() failed [online]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *sdf_handl = cJSON_GetObjectItemCaseSensitive(charging_dataJSON, "sdfHandl");
|
||||
|
||||
if (sdf_handl) {
|
||||
if (!cJSON_IsBool(sdf_handl)) {
|
||||
ogs_error("OpenAPI_charging_data_parseFromJSON() failed [sdf_handl]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *rating_group = cJSON_GetObjectItemCaseSensitive(charging_dataJSON, "ratingGroup");
|
||||
|
||||
if (rating_group) {
|
||||
if (!cJSON_IsNumber(rating_group)) {
|
||||
ogs_error("OpenAPI_charging_data_parseFromJSON() failed [rating_group]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *reporting_level = cJSON_GetObjectItemCaseSensitive(charging_dataJSON, "reportingLevel");
|
||||
|
||||
OpenAPI_reporting_level_t *reporting_level_local_nonprim = NULL;
|
||||
if (reporting_level) {
|
||||
reporting_level_local_nonprim = OpenAPI_reporting_level_parseFromJSON(reporting_level);
|
||||
}
|
||||
|
||||
cJSON *service_id = cJSON_GetObjectItemCaseSensitive(charging_dataJSON, "serviceId");
|
||||
|
||||
if (service_id) {
|
||||
if (!cJSON_IsNumber(service_id)) {
|
||||
ogs_error("OpenAPI_charging_data_parseFromJSON() failed [service_id]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *sponsor_id = cJSON_GetObjectItemCaseSensitive(charging_dataJSON, "sponsorId");
|
||||
|
||||
if (sponsor_id) {
|
||||
if (!cJSON_IsString(sponsor_id)) {
|
||||
ogs_error("OpenAPI_charging_data_parseFromJSON() failed [sponsor_id]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *app_svc_prov_id = cJSON_GetObjectItemCaseSensitive(charging_dataJSON, "appSvcProvId");
|
||||
|
||||
if (app_svc_prov_id) {
|
||||
if (!cJSON_IsString(app_svc_prov_id)) {
|
||||
ogs_error("OpenAPI_charging_data_parseFromJSON() failed [app_svc_prov_id]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *af_charging_identifier = cJSON_GetObjectItemCaseSensitive(charging_dataJSON, "afChargingIdentifier");
|
||||
|
||||
if (af_charging_identifier) {
|
||||
if (!cJSON_IsNumber(af_charging_identifier)) {
|
||||
ogs_error("OpenAPI_charging_data_parseFromJSON() failed [af_charging_identifier]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *af_charg_id = cJSON_GetObjectItemCaseSensitive(charging_dataJSON, "afChargId");
|
||||
|
||||
if (af_charg_id) {
|
||||
if (!cJSON_IsString(af_charg_id)) {
|
||||
ogs_error("OpenAPI_charging_data_parseFromJSON() failed [af_charg_id]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
charging_data_local_var = OpenAPI_charging_data_create (
|
||||
ogs_strdup(chg_id->valuestring),
|
||||
metering_method ? metering_method_local_nonprim : NULL,
|
||||
offline ? offline->valueint : 0,
|
||||
online ? online->valueint : 0,
|
||||
sdf_handl ? sdf_handl->valueint : 0,
|
||||
rating_group ? rating_group->valuedouble : 0,
|
||||
reporting_level ? reporting_level_local_nonprim : NULL,
|
||||
service_id ? service_id->valuedouble : 0,
|
||||
sponsor_id ? ogs_strdup(sponsor_id->valuestring) : NULL,
|
||||
app_svc_prov_id ? ogs_strdup(app_svc_prov_id->valuestring) : NULL,
|
||||
af_charging_identifier ? af_charging_identifier->valuedouble : 0,
|
||||
af_charg_id ? ogs_strdup(af_charg_id->valuestring) : NULL
|
||||
);
|
||||
|
||||
return charging_data_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_charging_data_t *OpenAPI_charging_data_copy(OpenAPI_charging_data_t *dst, OpenAPI_charging_data_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_charging_data_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_charging_data_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_charging_data_free(dst);
|
||||
dst = OpenAPI_charging_data_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
62
lib/sbi/openapi/model/charging_data.h
Normal file
62
lib/sbi/openapi/model/charging_data.h
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* charging_data.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_charging_data_H_
|
||||
#define _OpenAPI_charging_data_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
#include "metering_method.h"
|
||||
#include "reporting_level.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_charging_data_s OpenAPI_charging_data_t;
|
||||
typedef struct OpenAPI_charging_data_s {
|
||||
char *chg_id;
|
||||
struct OpenAPI_metering_method_s *metering_method;
|
||||
int offline;
|
||||
int online;
|
||||
int sdf_handl;
|
||||
int rating_group;
|
||||
struct OpenAPI_reporting_level_s *reporting_level;
|
||||
int service_id;
|
||||
char *sponsor_id;
|
||||
char *app_svc_prov_id;
|
||||
int af_charging_identifier;
|
||||
char *af_charg_id;
|
||||
} OpenAPI_charging_data_t;
|
||||
|
||||
OpenAPI_charging_data_t *OpenAPI_charging_data_create(
|
||||
char *chg_id,
|
||||
OpenAPI_metering_method_t *metering_method,
|
||||
int offline,
|
||||
int online,
|
||||
int sdf_handl,
|
||||
int rating_group,
|
||||
OpenAPI_reporting_level_t *reporting_level,
|
||||
int service_id,
|
||||
char *sponsor_id,
|
||||
char *app_svc_prov_id,
|
||||
int af_charging_identifier,
|
||||
char *af_charg_id
|
||||
);
|
||||
void OpenAPI_charging_data_free(OpenAPI_charging_data_t *charging_data);
|
||||
OpenAPI_charging_data_t *OpenAPI_charging_data_parseFromJSON(cJSON *charging_dataJSON);
|
||||
cJSON *OpenAPI_charging_data_convertToJSON(OpenAPI_charging_data_t *charging_data);
|
||||
OpenAPI_charging_data_t *OpenAPI_charging_data_copy(OpenAPI_charging_data_t *dst, OpenAPI_charging_data_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_charging_data_H_ */
|
||||
|
||||
|
|
@ -5,12 +5,12 @@
|
|||
#include "cn_assisted_ran_para.h"
|
||||
|
||||
OpenAPI_cn_assisted_ran_para_t *OpenAPI_cn_assisted_ran_para_create(
|
||||
OpenAPI_stationary_indication_t *stationary_indication,
|
||||
OpenAPI_stationary_indication_e stationary_indication,
|
||||
int communication_duration_time,
|
||||
int periodic_time,
|
||||
OpenAPI_scheduled_communication_time_t *scheduled_communication_time,
|
||||
OpenAPI_scheduled_communication_type_t *scheduled_communication_type,
|
||||
OpenAPI_traffic_profile_t *traffic_profile,
|
||||
OpenAPI_scheduled_communication_type_e scheduled_communication_type,
|
||||
OpenAPI_traffic_profile_e traffic_profile,
|
||||
OpenAPI_battery_indication_t *battery_indication
|
||||
)
|
||||
{
|
||||
|
|
@ -35,10 +35,7 @@ void OpenAPI_cn_assisted_ran_para_free(OpenAPI_cn_assisted_ran_para_t *cn_assist
|
|||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_stationary_indication_free(cn_assisted_ran_para->stationary_indication);
|
||||
OpenAPI_scheduled_communication_time_free(cn_assisted_ran_para->scheduled_communication_time);
|
||||
OpenAPI_scheduled_communication_type_free(cn_assisted_ran_para->scheduled_communication_type);
|
||||
OpenAPI_traffic_profile_free(cn_assisted_ran_para->traffic_profile);
|
||||
OpenAPI_battery_indication_free(cn_assisted_ran_para->battery_indication);
|
||||
ogs_free(cn_assisted_ran_para);
|
||||
}
|
||||
|
|
@ -54,13 +51,7 @@ cJSON *OpenAPI_cn_assisted_ran_para_convertToJSON(OpenAPI_cn_assisted_ran_para_t
|
|||
|
||||
item = cJSON_CreateObject();
|
||||
if (cn_assisted_ran_para->stationary_indication) {
|
||||
cJSON *stationary_indication_local_JSON = OpenAPI_stationary_indication_convertToJSON(cn_assisted_ran_para->stationary_indication);
|
||||
if (stationary_indication_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_cn_assisted_ran_para_convertToJSON() failed [stationary_indication]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "stationaryIndication", stationary_indication_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
if (cJSON_AddStringToObject(item, "stationaryIndication", OpenAPI_stationary_indication_ToString(cn_assisted_ran_para->stationary_indication)) == NULL) {
|
||||
ogs_error("OpenAPI_cn_assisted_ran_para_convertToJSON() failed [stationary_indication]");
|
||||
goto end;
|
||||
}
|
||||
|
|
@ -94,26 +85,14 @@ cJSON *OpenAPI_cn_assisted_ran_para_convertToJSON(OpenAPI_cn_assisted_ran_para_t
|
|||
}
|
||||
|
||||
if (cn_assisted_ran_para->scheduled_communication_type) {
|
||||
cJSON *scheduled_communication_type_local_JSON = OpenAPI_scheduled_communication_type_convertToJSON(cn_assisted_ran_para->scheduled_communication_type);
|
||||
if (scheduled_communication_type_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_cn_assisted_ran_para_convertToJSON() failed [scheduled_communication_type]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "scheduledCommunicationType", scheduled_communication_type_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
if (cJSON_AddStringToObject(item, "scheduledCommunicationType", OpenAPI_scheduled_communication_type_ToString(cn_assisted_ran_para->scheduled_communication_type)) == NULL) {
|
||||
ogs_error("OpenAPI_cn_assisted_ran_para_convertToJSON() failed [scheduled_communication_type]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (cn_assisted_ran_para->traffic_profile) {
|
||||
cJSON *traffic_profile_local_JSON = OpenAPI_traffic_profile_convertToJSON(cn_assisted_ran_para->traffic_profile);
|
||||
if (traffic_profile_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_cn_assisted_ran_para_convertToJSON() failed [traffic_profile]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "trafficProfile", traffic_profile_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
if (cJSON_AddStringToObject(item, "trafficProfile", OpenAPI_traffic_profile_ToString(cn_assisted_ran_para->traffic_profile)) == NULL) {
|
||||
ogs_error("OpenAPI_cn_assisted_ran_para_convertToJSON() failed [traffic_profile]");
|
||||
goto end;
|
||||
}
|
||||
|
|
@ -141,9 +120,13 @@ OpenAPI_cn_assisted_ran_para_t *OpenAPI_cn_assisted_ran_para_parseFromJSON(cJSON
|
|||
OpenAPI_cn_assisted_ran_para_t *cn_assisted_ran_para_local_var = NULL;
|
||||
cJSON *stationary_indication = cJSON_GetObjectItemCaseSensitive(cn_assisted_ran_paraJSON, "stationaryIndication");
|
||||
|
||||
OpenAPI_stationary_indication_t *stationary_indication_local_nonprim = NULL;
|
||||
OpenAPI_stationary_indication_e stationary_indicationVariable;
|
||||
if (stationary_indication) {
|
||||
stationary_indication_local_nonprim = OpenAPI_stationary_indication_parseFromJSON(stationary_indication);
|
||||
if (!cJSON_IsString(stationary_indication)) {
|
||||
ogs_error("OpenAPI_cn_assisted_ran_para_parseFromJSON() failed [stationary_indication]");
|
||||
goto end;
|
||||
}
|
||||
stationary_indicationVariable = OpenAPI_stationary_indication_FromString(stationary_indication->valuestring);
|
||||
}
|
||||
|
||||
cJSON *communication_duration_time = cJSON_GetObjectItemCaseSensitive(cn_assisted_ran_paraJSON, "communicationDurationTime");
|
||||
|
|
@ -173,16 +156,24 @@ OpenAPI_cn_assisted_ran_para_t *OpenAPI_cn_assisted_ran_para_parseFromJSON(cJSON
|
|||
|
||||
cJSON *scheduled_communication_type = cJSON_GetObjectItemCaseSensitive(cn_assisted_ran_paraJSON, "scheduledCommunicationType");
|
||||
|
||||
OpenAPI_scheduled_communication_type_t *scheduled_communication_type_local_nonprim = NULL;
|
||||
OpenAPI_scheduled_communication_type_e scheduled_communication_typeVariable;
|
||||
if (scheduled_communication_type) {
|
||||
scheduled_communication_type_local_nonprim = OpenAPI_scheduled_communication_type_parseFromJSON(scheduled_communication_type);
|
||||
if (!cJSON_IsString(scheduled_communication_type)) {
|
||||
ogs_error("OpenAPI_cn_assisted_ran_para_parseFromJSON() failed [scheduled_communication_type]");
|
||||
goto end;
|
||||
}
|
||||
scheduled_communication_typeVariable = OpenAPI_scheduled_communication_type_FromString(scheduled_communication_type->valuestring);
|
||||
}
|
||||
|
||||
cJSON *traffic_profile = cJSON_GetObjectItemCaseSensitive(cn_assisted_ran_paraJSON, "trafficProfile");
|
||||
|
||||
OpenAPI_traffic_profile_t *traffic_profile_local_nonprim = NULL;
|
||||
OpenAPI_traffic_profile_e traffic_profileVariable;
|
||||
if (traffic_profile) {
|
||||
traffic_profile_local_nonprim = OpenAPI_traffic_profile_parseFromJSON(traffic_profile);
|
||||
if (!cJSON_IsString(traffic_profile)) {
|
||||
ogs_error("OpenAPI_cn_assisted_ran_para_parseFromJSON() failed [traffic_profile]");
|
||||
goto end;
|
||||
}
|
||||
traffic_profileVariable = OpenAPI_traffic_profile_FromString(traffic_profile->valuestring);
|
||||
}
|
||||
|
||||
cJSON *battery_indication = cJSON_GetObjectItemCaseSensitive(cn_assisted_ran_paraJSON, "batteryIndication");
|
||||
|
|
@ -193,12 +184,12 @@ OpenAPI_cn_assisted_ran_para_t *OpenAPI_cn_assisted_ran_para_parseFromJSON(cJSON
|
|||
}
|
||||
|
||||
cn_assisted_ran_para_local_var = OpenAPI_cn_assisted_ran_para_create (
|
||||
stationary_indication ? stationary_indication_local_nonprim : NULL,
|
||||
stationary_indication ? stationary_indicationVariable : 0,
|
||||
communication_duration_time ? communication_duration_time->valuedouble : 0,
|
||||
periodic_time ? periodic_time->valuedouble : 0,
|
||||
scheduled_communication_time ? scheduled_communication_time_local_nonprim : NULL,
|
||||
scheduled_communication_type ? scheduled_communication_type_local_nonprim : NULL,
|
||||
traffic_profile ? traffic_profile_local_nonprim : NULL,
|
||||
scheduled_communication_type ? scheduled_communication_typeVariable : 0,
|
||||
traffic_profile ? traffic_profileVariable : 0,
|
||||
battery_indication ? battery_indication_local_nonprim : NULL
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -24,22 +24,22 @@ extern "C" {
|
|||
|
||||
typedef struct OpenAPI_cn_assisted_ran_para_s OpenAPI_cn_assisted_ran_para_t;
|
||||
typedef struct OpenAPI_cn_assisted_ran_para_s {
|
||||
struct OpenAPI_stationary_indication_s *stationary_indication;
|
||||
OpenAPI_stationary_indication_e stationary_indication;
|
||||
int communication_duration_time;
|
||||
int periodic_time;
|
||||
struct OpenAPI_scheduled_communication_time_s *scheduled_communication_time;
|
||||
struct OpenAPI_scheduled_communication_type_s *scheduled_communication_type;
|
||||
struct OpenAPI_traffic_profile_s *traffic_profile;
|
||||
OpenAPI_scheduled_communication_type_e scheduled_communication_type;
|
||||
OpenAPI_traffic_profile_e traffic_profile;
|
||||
struct OpenAPI_battery_indication_s *battery_indication;
|
||||
} OpenAPI_cn_assisted_ran_para_t;
|
||||
|
||||
OpenAPI_cn_assisted_ran_para_t *OpenAPI_cn_assisted_ran_para_create(
|
||||
OpenAPI_stationary_indication_t *stationary_indication,
|
||||
OpenAPI_stationary_indication_e stationary_indication,
|
||||
int communication_duration_time,
|
||||
int periodic_time,
|
||||
OpenAPI_scheduled_communication_time_t *scheduled_communication_time,
|
||||
OpenAPI_scheduled_communication_type_t *scheduled_communication_type,
|
||||
OpenAPI_traffic_profile_t *traffic_profile,
|
||||
OpenAPI_scheduled_communication_type_e scheduled_communication_type,
|
||||
OpenAPI_traffic_profile_e traffic_profile,
|
||||
OpenAPI_battery_indication_t *battery_indication
|
||||
);
|
||||
void OpenAPI_cn_assisted_ran_para_free(OpenAPI_cn_assisted_ran_para_t *cn_assisted_ran_para);
|
||||
|
|
|
|||
192
lib/sbi/openapi/model/condition_data.c
Normal file
192
lib/sbi/openapi/model/condition_data.c
Normal file
|
|
@ -0,0 +1,192 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "condition_data.h"
|
||||
|
||||
OpenAPI_condition_data_t *OpenAPI_condition_data_create(
|
||||
char *cond_id,
|
||||
char *activation_time,
|
||||
char *deactivation_time,
|
||||
OpenAPI_access_type_e access_type,
|
||||
OpenAPI_rat_type_e rat_type
|
||||
)
|
||||
{
|
||||
OpenAPI_condition_data_t *condition_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_condition_data_t));
|
||||
if (!condition_data_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
condition_data_local_var->cond_id = cond_id;
|
||||
condition_data_local_var->activation_time = activation_time;
|
||||
condition_data_local_var->deactivation_time = deactivation_time;
|
||||
condition_data_local_var->access_type = access_type;
|
||||
condition_data_local_var->rat_type = rat_type;
|
||||
|
||||
return condition_data_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_condition_data_free(OpenAPI_condition_data_t *condition_data)
|
||||
{
|
||||
if (NULL == condition_data) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(condition_data->cond_id);
|
||||
ogs_free(condition_data->activation_time);
|
||||
ogs_free(condition_data->deactivation_time);
|
||||
ogs_free(condition_data);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_condition_data_convertToJSON(OpenAPI_condition_data_t *condition_data)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (condition_data == NULL) {
|
||||
ogs_error("OpenAPI_condition_data_convertToJSON() failed [ConditionData]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (!condition_data->cond_id) {
|
||||
ogs_error("OpenAPI_condition_data_convertToJSON() failed [cond_id]");
|
||||
goto end;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "condId", condition_data->cond_id) == NULL) {
|
||||
ogs_error("OpenAPI_condition_data_convertToJSON() failed [cond_id]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (condition_data->activation_time) {
|
||||
if (cJSON_AddStringToObject(item, "activationTime", condition_data->activation_time) == NULL) {
|
||||
ogs_error("OpenAPI_condition_data_convertToJSON() failed [activation_time]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (condition_data->deactivation_time) {
|
||||
if (cJSON_AddStringToObject(item, "deactivationTime", condition_data->deactivation_time) == NULL) {
|
||||
ogs_error("OpenAPI_condition_data_convertToJSON() failed [deactivation_time]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (condition_data->access_type) {
|
||||
if (cJSON_AddStringToObject(item, "accessType", OpenAPI_access_type_ToString(condition_data->access_type)) == NULL) {
|
||||
ogs_error("OpenAPI_condition_data_convertToJSON() failed [access_type]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (condition_data->rat_type) {
|
||||
if (cJSON_AddStringToObject(item, "ratType", OpenAPI_rat_type_ToString(condition_data->rat_type)) == NULL) {
|
||||
ogs_error("OpenAPI_condition_data_convertToJSON() failed [rat_type]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_condition_data_t *OpenAPI_condition_data_parseFromJSON(cJSON *condition_dataJSON)
|
||||
{
|
||||
OpenAPI_condition_data_t *condition_data_local_var = NULL;
|
||||
cJSON *cond_id = cJSON_GetObjectItemCaseSensitive(condition_dataJSON, "condId");
|
||||
if (!cond_id) {
|
||||
ogs_error("OpenAPI_condition_data_parseFromJSON() failed [cond_id]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
if (!cJSON_IsString(cond_id)) {
|
||||
ogs_error("OpenAPI_condition_data_parseFromJSON() failed [cond_id]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *activation_time = cJSON_GetObjectItemCaseSensitive(condition_dataJSON, "activationTime");
|
||||
|
||||
if (activation_time) {
|
||||
if (!cJSON_IsString(activation_time)) {
|
||||
ogs_error("OpenAPI_condition_data_parseFromJSON() failed [activation_time]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *deactivation_time = cJSON_GetObjectItemCaseSensitive(condition_dataJSON, "deactivationTime");
|
||||
|
||||
if (deactivation_time) {
|
||||
if (!cJSON_IsString(deactivation_time)) {
|
||||
ogs_error("OpenAPI_condition_data_parseFromJSON() failed [deactivation_time]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *access_type = cJSON_GetObjectItemCaseSensitive(condition_dataJSON, "accessType");
|
||||
|
||||
OpenAPI_access_type_e access_typeVariable;
|
||||
if (access_type) {
|
||||
if (!cJSON_IsString(access_type)) {
|
||||
ogs_error("OpenAPI_condition_data_parseFromJSON() failed [access_type]");
|
||||
goto end;
|
||||
}
|
||||
access_typeVariable = OpenAPI_access_type_FromString(access_type->valuestring);
|
||||
}
|
||||
|
||||
cJSON *rat_type = cJSON_GetObjectItemCaseSensitive(condition_dataJSON, "ratType");
|
||||
|
||||
OpenAPI_rat_type_e rat_typeVariable;
|
||||
if (rat_type) {
|
||||
if (!cJSON_IsString(rat_type)) {
|
||||
ogs_error("OpenAPI_condition_data_parseFromJSON() failed [rat_type]");
|
||||
goto end;
|
||||
}
|
||||
rat_typeVariable = OpenAPI_rat_type_FromString(rat_type->valuestring);
|
||||
}
|
||||
|
||||
condition_data_local_var = OpenAPI_condition_data_create (
|
||||
ogs_strdup(cond_id->valuestring),
|
||||
activation_time ? ogs_strdup(activation_time->valuestring) : NULL,
|
||||
deactivation_time ? ogs_strdup(deactivation_time->valuestring) : NULL,
|
||||
access_type ? access_typeVariable : 0,
|
||||
rat_type ? rat_typeVariable : 0
|
||||
);
|
||||
|
||||
return condition_data_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_condition_data_t *OpenAPI_condition_data_copy(OpenAPI_condition_data_t *dst, OpenAPI_condition_data_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_condition_data_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_condition_data_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_condition_data_free(dst);
|
||||
dst = OpenAPI_condition_data_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
48
lib/sbi/openapi/model/condition_data.h
Normal file
48
lib/sbi/openapi/model/condition_data.h
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* condition_data.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_condition_data_H_
|
||||
#define _OpenAPI_condition_data_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
#include "access_type.h"
|
||||
#include "rat_type.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_condition_data_s OpenAPI_condition_data_t;
|
||||
typedef struct OpenAPI_condition_data_s {
|
||||
char *cond_id;
|
||||
char *activation_time;
|
||||
char *deactivation_time;
|
||||
OpenAPI_access_type_e access_type;
|
||||
OpenAPI_rat_type_e rat_type;
|
||||
} OpenAPI_condition_data_t;
|
||||
|
||||
OpenAPI_condition_data_t *OpenAPI_condition_data_create(
|
||||
char *cond_id,
|
||||
char *activation_time,
|
||||
char *deactivation_time,
|
||||
OpenAPI_access_type_e access_type,
|
||||
OpenAPI_rat_type_e rat_type
|
||||
);
|
||||
void OpenAPI_condition_data_free(OpenAPI_condition_data_t *condition_data);
|
||||
OpenAPI_condition_data_t *OpenAPI_condition_data_parseFromJSON(cJSON *condition_dataJSON);
|
||||
cJSON *OpenAPI_condition_data_convertToJSON(OpenAPI_condition_data_t *condition_data);
|
||||
OpenAPI_condition_data_t *OpenAPI_condition_data_copy(OpenAPI_condition_data_t *dst, OpenAPI_condition_data_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_condition_data_H_ */
|
||||
|
||||
|
|
@ -4,82 +4,27 @@
|
|||
#include <stdio.h>
|
||||
#include "core_network_type.h"
|
||||
|
||||
OpenAPI_core_network_type_t *OpenAPI_core_network_type_create(
|
||||
)
|
||||
char* OpenAPI_core_network_type_ToString(OpenAPI_core_network_type_e core_network_type)
|
||||
{
|
||||
OpenAPI_core_network_type_t *core_network_type_local_var = OpenAPI_malloc(sizeof(OpenAPI_core_network_type_t));
|
||||
if (!core_network_type_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return core_network_type_local_var;
|
||||
const char *core_network_typeArray[] = { "NULL", "_5GC", "EPC" };
|
||||
size_t sizeofArray = sizeof(core_network_typeArray) / sizeof(core_network_typeArray[0]);
|
||||
if (core_network_type < sizeofArray)
|
||||
return (char *)core_network_typeArray[core_network_type];
|
||||
else
|
||||
return (char *)"Unknown";
|
||||
}
|
||||
|
||||
void OpenAPI_core_network_type_free(OpenAPI_core_network_type_t *core_network_type)
|
||||
OpenAPI_core_network_type_e OpenAPI_core_network_type_FromString(char* core_network_type)
|
||||
{
|
||||
if (NULL == core_network_type) {
|
||||
return;
|
||||
int stringToReturn = 0;
|
||||
const char *core_network_typeArray[] = { "NULL", "_5GC", "EPC" };
|
||||
size_t sizeofArray = sizeof(core_network_typeArray) / sizeof(core_network_typeArray[0]);
|
||||
while (stringToReturn < sizeofArray) {
|
||||
if (strcmp(core_network_type, core_network_typeArray[stringToReturn]) == 0) {
|
||||
return stringToReturn;
|
||||
}
|
||||
stringToReturn++;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(core_network_type);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_core_network_type_convertToJSON(OpenAPI_core_network_type_t *core_network_type)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (core_network_type == NULL) {
|
||||
ogs_error("OpenAPI_core_network_type_convertToJSON() failed [CoreNetworkType]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_core_network_type_t *OpenAPI_core_network_type_parseFromJSON(cJSON *core_network_typeJSON)
|
||||
{
|
||||
OpenAPI_core_network_type_t *core_network_type_local_var = NULL;
|
||||
core_network_type_local_var = OpenAPI_core_network_type_create (
|
||||
);
|
||||
|
||||
return core_network_type_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_core_network_type_t *OpenAPI_core_network_type_copy(OpenAPI_core_network_type_t *dst, OpenAPI_core_network_type_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_core_network_type_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_core_network_type_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_core_network_type_free(dst);
|
||||
dst = OpenAPI_core_network_type_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,16 +17,11 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_core_network_type_s OpenAPI_core_network_type_t;
|
||||
typedef struct OpenAPI_core_network_type_s {
|
||||
} OpenAPI_core_network_type_t;
|
||||
typedef enum { OpenAPI_core_network_type_NULL = 0, OpenAPI_core_network_type__5GC, OpenAPI_core_network_type_EPC } OpenAPI_core_network_type_e;
|
||||
|
||||
OpenAPI_core_network_type_t *OpenAPI_core_network_type_create(
|
||||
);
|
||||
void OpenAPI_core_network_type_free(OpenAPI_core_network_type_t *core_network_type);
|
||||
OpenAPI_core_network_type_t *OpenAPI_core_network_type_parseFromJSON(cJSON *core_network_typeJSON);
|
||||
cJSON *OpenAPI_core_network_type_convertToJSON(OpenAPI_core_network_type_t *core_network_type);
|
||||
OpenAPI_core_network_type_t *OpenAPI_core_network_type_copy(OpenAPI_core_network_type_t *dst, OpenAPI_core_network_type_t *src);
|
||||
char* OpenAPI_core_network_type_ToString(OpenAPI_core_network_type_e core_network_type);
|
||||
|
||||
OpenAPI_core_network_type_e OpenAPI_core_network_type_FromString(char* core_network_type);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
85
lib/sbi/openapi/model/credit_management_status.c
Normal file
85
lib/sbi/openapi/model/credit_management_status.c
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "credit_management_status.h"
|
||||
|
||||
OpenAPI_credit_management_status_t *OpenAPI_credit_management_status_create(
|
||||
)
|
||||
{
|
||||
OpenAPI_credit_management_status_t *credit_management_status_local_var = OpenAPI_malloc(sizeof(OpenAPI_credit_management_status_t));
|
||||
if (!credit_management_status_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return credit_management_status_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_credit_management_status_free(OpenAPI_credit_management_status_t *credit_management_status)
|
||||
{
|
||||
if (NULL == credit_management_status) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(credit_management_status);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_credit_management_status_convertToJSON(OpenAPI_credit_management_status_t *credit_management_status)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (credit_management_status == NULL) {
|
||||
ogs_error("OpenAPI_credit_management_status_convertToJSON() failed [CreditManagementStatus]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_credit_management_status_t *OpenAPI_credit_management_status_parseFromJSON(cJSON *credit_management_statusJSON)
|
||||
{
|
||||
OpenAPI_credit_management_status_t *credit_management_status_local_var = NULL;
|
||||
credit_management_status_local_var = OpenAPI_credit_management_status_create (
|
||||
);
|
||||
|
||||
return credit_management_status_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_credit_management_status_t *OpenAPI_credit_management_status_copy(OpenAPI_credit_management_status_t *dst, OpenAPI_credit_management_status_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_credit_management_status_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_credit_management_status_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_credit_management_status_free(dst);
|
||||
dst = OpenAPI_credit_management_status_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
36
lib/sbi/openapi/model/credit_management_status.h
Normal file
36
lib/sbi/openapi/model/credit_management_status.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* credit_management_status.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_credit_management_status_H_
|
||||
#define _OpenAPI_credit_management_status_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_credit_management_status_s OpenAPI_credit_management_status_t;
|
||||
typedef struct OpenAPI_credit_management_status_s {
|
||||
} OpenAPI_credit_management_status_t;
|
||||
|
||||
OpenAPI_credit_management_status_t *OpenAPI_credit_management_status_create(
|
||||
);
|
||||
void OpenAPI_credit_management_status_free(OpenAPI_credit_management_status_t *credit_management_status);
|
||||
OpenAPI_credit_management_status_t *OpenAPI_credit_management_status_parseFromJSON(cJSON *credit_management_statusJSON);
|
||||
cJSON *OpenAPI_credit_management_status_convertToJSON(OpenAPI_credit_management_status_t *credit_management_status);
|
||||
OpenAPI_credit_management_status_t *OpenAPI_credit_management_status_copy(OpenAPI_credit_management_status_t *dst, OpenAPI_credit_management_status_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_credit_management_status_H_ */
|
||||
|
||||
209
lib/sbi/openapi/model/error_report.c
Normal file
209
lib/sbi/openapi/model/error_report.c
Normal file
|
|
@ -0,0 +1,209 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "error_report.h"
|
||||
|
||||
OpenAPI_error_report_t *OpenAPI_error_report_create(
|
||||
OpenAPI_problem_details_t *error,
|
||||
OpenAPI_list_t *rule_reports,
|
||||
OpenAPI_list_t *sess_rule_reports
|
||||
)
|
||||
{
|
||||
OpenAPI_error_report_t *error_report_local_var = OpenAPI_malloc(sizeof(OpenAPI_error_report_t));
|
||||
if (!error_report_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
error_report_local_var->error = error;
|
||||
error_report_local_var->rule_reports = rule_reports;
|
||||
error_report_local_var->sess_rule_reports = sess_rule_reports;
|
||||
|
||||
return error_report_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_error_report_free(OpenAPI_error_report_t *error_report)
|
||||
{
|
||||
if (NULL == error_report) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_problem_details_free(error_report->error);
|
||||
OpenAPI_list_for_each(error_report->rule_reports, node) {
|
||||
OpenAPI_rule_report_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(error_report->rule_reports);
|
||||
OpenAPI_list_for_each(error_report->sess_rule_reports, node) {
|
||||
OpenAPI_session_rule_report_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(error_report->sess_rule_reports);
|
||||
ogs_free(error_report);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_error_report_convertToJSON(OpenAPI_error_report_t *error_report)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (error_report == NULL) {
|
||||
ogs_error("OpenAPI_error_report_convertToJSON() failed [ErrorReport]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (error_report->error) {
|
||||
cJSON *error_local_JSON = OpenAPI_problem_details_convertToJSON(error_report->error);
|
||||
if (error_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_error_report_convertToJSON() failed [error]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "error", error_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_error_report_convertToJSON() failed [error]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (error_report->rule_reports) {
|
||||
cJSON *rule_reportsList = cJSON_AddArrayToObject(item, "ruleReports");
|
||||
if (rule_reportsList == NULL) {
|
||||
ogs_error("OpenAPI_error_report_convertToJSON() failed [rule_reports]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *rule_reports_node;
|
||||
if (error_report->rule_reports) {
|
||||
OpenAPI_list_for_each(error_report->rule_reports, rule_reports_node) {
|
||||
cJSON *itemLocal = OpenAPI_rule_report_convertToJSON(rule_reports_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_error_report_convertToJSON() failed [rule_reports]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(rule_reportsList, itemLocal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (error_report->sess_rule_reports) {
|
||||
cJSON *sess_rule_reportsList = cJSON_AddArrayToObject(item, "sessRuleReports");
|
||||
if (sess_rule_reportsList == NULL) {
|
||||
ogs_error("OpenAPI_error_report_convertToJSON() failed [sess_rule_reports]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *sess_rule_reports_node;
|
||||
if (error_report->sess_rule_reports) {
|
||||
OpenAPI_list_for_each(error_report->sess_rule_reports, sess_rule_reports_node) {
|
||||
cJSON *itemLocal = OpenAPI_session_rule_report_convertToJSON(sess_rule_reports_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_error_report_convertToJSON() failed [sess_rule_reports]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(sess_rule_reportsList, itemLocal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_error_report_t *OpenAPI_error_report_parseFromJSON(cJSON *error_reportJSON)
|
||||
{
|
||||
OpenAPI_error_report_t *error_report_local_var = NULL;
|
||||
cJSON *error = cJSON_GetObjectItemCaseSensitive(error_reportJSON, "error");
|
||||
|
||||
OpenAPI_problem_details_t *error_local_nonprim = NULL;
|
||||
if (error) {
|
||||
error_local_nonprim = OpenAPI_problem_details_parseFromJSON(error);
|
||||
}
|
||||
|
||||
cJSON *rule_reports = cJSON_GetObjectItemCaseSensitive(error_reportJSON, "ruleReports");
|
||||
|
||||
OpenAPI_list_t *rule_reportsList;
|
||||
if (rule_reports) {
|
||||
cJSON *rule_reports_local_nonprimitive;
|
||||
if (!cJSON_IsArray(rule_reports)) {
|
||||
ogs_error("OpenAPI_error_report_parseFromJSON() failed [rule_reports]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
rule_reportsList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(rule_reports_local_nonprimitive, rule_reports ) {
|
||||
if (!cJSON_IsObject(rule_reports_local_nonprimitive)) {
|
||||
ogs_error("OpenAPI_error_report_parseFromJSON() failed [rule_reports]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_rule_report_t *rule_reportsItem = OpenAPI_rule_report_parseFromJSON(rule_reports_local_nonprimitive);
|
||||
|
||||
OpenAPI_list_add(rule_reportsList, rule_reportsItem);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *sess_rule_reports = cJSON_GetObjectItemCaseSensitive(error_reportJSON, "sessRuleReports");
|
||||
|
||||
OpenAPI_list_t *sess_rule_reportsList;
|
||||
if (sess_rule_reports) {
|
||||
cJSON *sess_rule_reports_local_nonprimitive;
|
||||
if (!cJSON_IsArray(sess_rule_reports)) {
|
||||
ogs_error("OpenAPI_error_report_parseFromJSON() failed [sess_rule_reports]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
sess_rule_reportsList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(sess_rule_reports_local_nonprimitive, sess_rule_reports ) {
|
||||
if (!cJSON_IsObject(sess_rule_reports_local_nonprimitive)) {
|
||||
ogs_error("OpenAPI_error_report_parseFromJSON() failed [sess_rule_reports]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_session_rule_report_t *sess_rule_reportsItem = OpenAPI_session_rule_report_parseFromJSON(sess_rule_reports_local_nonprimitive);
|
||||
|
||||
OpenAPI_list_add(sess_rule_reportsList, sess_rule_reportsItem);
|
||||
}
|
||||
}
|
||||
|
||||
error_report_local_var = OpenAPI_error_report_create (
|
||||
error ? error_local_nonprim : NULL,
|
||||
rule_reports ? rule_reportsList : NULL,
|
||||
sess_rule_reports ? sess_rule_reportsList : NULL
|
||||
);
|
||||
|
||||
return error_report_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_error_report_t *OpenAPI_error_report_copy(OpenAPI_error_report_t *dst, OpenAPI_error_report_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_error_report_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_error_report_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_error_report_free(dst);
|
||||
dst = OpenAPI_error_report_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
45
lib/sbi/openapi/model/error_report.h
Normal file
45
lib/sbi/openapi/model/error_report.h
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* error_report.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_error_report_H_
|
||||
#define _OpenAPI_error_report_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
#include "problem_details.h"
|
||||
#include "rule_report.h"
|
||||
#include "session_rule_report.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_error_report_s OpenAPI_error_report_t;
|
||||
typedef struct OpenAPI_error_report_s {
|
||||
struct OpenAPI_problem_details_s *error;
|
||||
OpenAPI_list_t *rule_reports;
|
||||
OpenAPI_list_t *sess_rule_reports;
|
||||
} OpenAPI_error_report_t;
|
||||
|
||||
OpenAPI_error_report_t *OpenAPI_error_report_create(
|
||||
OpenAPI_problem_details_t *error,
|
||||
OpenAPI_list_t *rule_reports,
|
||||
OpenAPI_list_t *sess_rule_reports
|
||||
);
|
||||
void OpenAPI_error_report_free(OpenAPI_error_report_t *error_report);
|
||||
OpenAPI_error_report_t *OpenAPI_error_report_parseFromJSON(cJSON *error_reportJSON);
|
||||
cJSON *OpenAPI_error_report_convertToJSON(OpenAPI_error_report_t *error_report);
|
||||
OpenAPI_error_report_t *OpenAPI_error_report_copy(OpenAPI_error_report_t *dst, OpenAPI_error_report_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_error_report_H_ */
|
||||
|
||||
|
|
@ -5,13 +5,13 @@
|
|||
#include "expected_ue_behaviour_data.h"
|
||||
|
||||
OpenAPI_expected_ue_behaviour_data_t *OpenAPI_expected_ue_behaviour_data_create(
|
||||
OpenAPI_stationary_indication_t *stationary_indication,
|
||||
OpenAPI_stationary_indication_e stationary_indication,
|
||||
int communication_duration_time,
|
||||
int periodic_time,
|
||||
OpenAPI_scheduled_communication_time_t *scheduled_communication_time,
|
||||
OpenAPI_scheduled_communication_type_t *scheduled_communication_type,
|
||||
OpenAPI_scheduled_communication_type_e scheduled_communication_type,
|
||||
OpenAPI_list_t *expected_umts,
|
||||
OpenAPI_traffic_profile_t *traffic_profile,
|
||||
OpenAPI_traffic_profile_e traffic_profile,
|
||||
OpenAPI_battery_indication_t *battery_indication,
|
||||
char *validity_time
|
||||
)
|
||||
|
|
@ -39,14 +39,11 @@ void OpenAPI_expected_ue_behaviour_data_free(OpenAPI_expected_ue_behaviour_data_
|
|||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_stationary_indication_free(expected_ue_behaviour_data->stationary_indication);
|
||||
OpenAPI_scheduled_communication_time_free(expected_ue_behaviour_data->scheduled_communication_time);
|
||||
OpenAPI_scheduled_communication_type_free(expected_ue_behaviour_data->scheduled_communication_type);
|
||||
OpenAPI_list_for_each(expected_ue_behaviour_data->expected_umts, node) {
|
||||
OpenAPI_location_area_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(expected_ue_behaviour_data->expected_umts);
|
||||
OpenAPI_traffic_profile_free(expected_ue_behaviour_data->traffic_profile);
|
||||
OpenAPI_battery_indication_free(expected_ue_behaviour_data->battery_indication);
|
||||
ogs_free(expected_ue_behaviour_data->validity_time);
|
||||
ogs_free(expected_ue_behaviour_data);
|
||||
|
|
@ -63,13 +60,7 @@ cJSON *OpenAPI_expected_ue_behaviour_data_convertToJSON(OpenAPI_expected_ue_beha
|
|||
|
||||
item = cJSON_CreateObject();
|
||||
if (expected_ue_behaviour_data->stationary_indication) {
|
||||
cJSON *stationary_indication_local_JSON = OpenAPI_stationary_indication_convertToJSON(expected_ue_behaviour_data->stationary_indication);
|
||||
if (stationary_indication_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_expected_ue_behaviour_data_convertToJSON() failed [stationary_indication]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "stationaryIndication", stationary_indication_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
if (cJSON_AddStringToObject(item, "stationaryIndication", OpenAPI_stationary_indication_ToString(expected_ue_behaviour_data->stationary_indication)) == NULL) {
|
||||
ogs_error("OpenAPI_expected_ue_behaviour_data_convertToJSON() failed [stationary_indication]");
|
||||
goto end;
|
||||
}
|
||||
|
|
@ -103,13 +94,7 @@ cJSON *OpenAPI_expected_ue_behaviour_data_convertToJSON(OpenAPI_expected_ue_beha
|
|||
}
|
||||
|
||||
if (expected_ue_behaviour_data->scheduled_communication_type) {
|
||||
cJSON *scheduled_communication_type_local_JSON = OpenAPI_scheduled_communication_type_convertToJSON(expected_ue_behaviour_data->scheduled_communication_type);
|
||||
if (scheduled_communication_type_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_expected_ue_behaviour_data_convertToJSON() failed [scheduled_communication_type]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "scheduledCommunicationType", scheduled_communication_type_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
if (cJSON_AddStringToObject(item, "scheduledCommunicationType", OpenAPI_scheduled_communication_type_ToString(expected_ue_behaviour_data->scheduled_communication_type)) == NULL) {
|
||||
ogs_error("OpenAPI_expected_ue_behaviour_data_convertToJSON() failed [scheduled_communication_type]");
|
||||
goto end;
|
||||
}
|
||||
|
|
@ -136,13 +121,7 @@ cJSON *OpenAPI_expected_ue_behaviour_data_convertToJSON(OpenAPI_expected_ue_beha
|
|||
}
|
||||
|
||||
if (expected_ue_behaviour_data->traffic_profile) {
|
||||
cJSON *traffic_profile_local_JSON = OpenAPI_traffic_profile_convertToJSON(expected_ue_behaviour_data->traffic_profile);
|
||||
if (traffic_profile_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_expected_ue_behaviour_data_convertToJSON() failed [traffic_profile]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "trafficProfile", traffic_profile_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
if (cJSON_AddStringToObject(item, "trafficProfile", OpenAPI_traffic_profile_ToString(expected_ue_behaviour_data->traffic_profile)) == NULL) {
|
||||
ogs_error("OpenAPI_expected_ue_behaviour_data_convertToJSON() failed [traffic_profile]");
|
||||
goto end;
|
||||
}
|
||||
|
|
@ -177,9 +156,13 @@ OpenAPI_expected_ue_behaviour_data_t *OpenAPI_expected_ue_behaviour_data_parseFr
|
|||
OpenAPI_expected_ue_behaviour_data_t *expected_ue_behaviour_data_local_var = NULL;
|
||||
cJSON *stationary_indication = cJSON_GetObjectItemCaseSensitive(expected_ue_behaviour_dataJSON, "stationaryIndication");
|
||||
|
||||
OpenAPI_stationary_indication_t *stationary_indication_local_nonprim = NULL;
|
||||
OpenAPI_stationary_indication_e stationary_indicationVariable;
|
||||
if (stationary_indication) {
|
||||
stationary_indication_local_nonprim = OpenAPI_stationary_indication_parseFromJSON(stationary_indication);
|
||||
if (!cJSON_IsString(stationary_indication)) {
|
||||
ogs_error("OpenAPI_expected_ue_behaviour_data_parseFromJSON() failed [stationary_indication]");
|
||||
goto end;
|
||||
}
|
||||
stationary_indicationVariable = OpenAPI_stationary_indication_FromString(stationary_indication->valuestring);
|
||||
}
|
||||
|
||||
cJSON *communication_duration_time = cJSON_GetObjectItemCaseSensitive(expected_ue_behaviour_dataJSON, "communicationDurationTime");
|
||||
|
|
@ -209,9 +192,13 @@ OpenAPI_expected_ue_behaviour_data_t *OpenAPI_expected_ue_behaviour_data_parseFr
|
|||
|
||||
cJSON *scheduled_communication_type = cJSON_GetObjectItemCaseSensitive(expected_ue_behaviour_dataJSON, "scheduledCommunicationType");
|
||||
|
||||
OpenAPI_scheduled_communication_type_t *scheduled_communication_type_local_nonprim = NULL;
|
||||
OpenAPI_scheduled_communication_type_e scheduled_communication_typeVariable;
|
||||
if (scheduled_communication_type) {
|
||||
scheduled_communication_type_local_nonprim = OpenAPI_scheduled_communication_type_parseFromJSON(scheduled_communication_type);
|
||||
if (!cJSON_IsString(scheduled_communication_type)) {
|
||||
ogs_error("OpenAPI_expected_ue_behaviour_data_parseFromJSON() failed [scheduled_communication_type]");
|
||||
goto end;
|
||||
}
|
||||
scheduled_communication_typeVariable = OpenAPI_scheduled_communication_type_FromString(scheduled_communication_type->valuestring);
|
||||
}
|
||||
|
||||
cJSON *expected_umts = cJSON_GetObjectItemCaseSensitive(expected_ue_behaviour_dataJSON, "expectedUmts");
|
||||
|
|
@ -239,9 +226,13 @@ OpenAPI_expected_ue_behaviour_data_t *OpenAPI_expected_ue_behaviour_data_parseFr
|
|||
|
||||
cJSON *traffic_profile = cJSON_GetObjectItemCaseSensitive(expected_ue_behaviour_dataJSON, "trafficProfile");
|
||||
|
||||
OpenAPI_traffic_profile_t *traffic_profile_local_nonprim = NULL;
|
||||
OpenAPI_traffic_profile_e traffic_profileVariable;
|
||||
if (traffic_profile) {
|
||||
traffic_profile_local_nonprim = OpenAPI_traffic_profile_parseFromJSON(traffic_profile);
|
||||
if (!cJSON_IsString(traffic_profile)) {
|
||||
ogs_error("OpenAPI_expected_ue_behaviour_data_parseFromJSON() failed [traffic_profile]");
|
||||
goto end;
|
||||
}
|
||||
traffic_profileVariable = OpenAPI_traffic_profile_FromString(traffic_profile->valuestring);
|
||||
}
|
||||
|
||||
cJSON *battery_indication = cJSON_GetObjectItemCaseSensitive(expected_ue_behaviour_dataJSON, "batteryIndication");
|
||||
|
|
@ -261,13 +252,13 @@ OpenAPI_expected_ue_behaviour_data_t *OpenAPI_expected_ue_behaviour_data_parseFr
|
|||
}
|
||||
|
||||
expected_ue_behaviour_data_local_var = OpenAPI_expected_ue_behaviour_data_create (
|
||||
stationary_indication ? stationary_indication_local_nonprim : NULL,
|
||||
stationary_indication ? stationary_indicationVariable : 0,
|
||||
communication_duration_time ? communication_duration_time->valuedouble : 0,
|
||||
periodic_time ? periodic_time->valuedouble : 0,
|
||||
scheduled_communication_time ? scheduled_communication_time_local_nonprim : NULL,
|
||||
scheduled_communication_type ? scheduled_communication_type_local_nonprim : NULL,
|
||||
scheduled_communication_type ? scheduled_communication_typeVariable : 0,
|
||||
expected_umts ? expected_umtsList : NULL,
|
||||
traffic_profile ? traffic_profile_local_nonprim : NULL,
|
||||
traffic_profile ? traffic_profileVariable : 0,
|
||||
battery_indication ? battery_indication_local_nonprim : NULL,
|
||||
validity_time ? ogs_strdup(validity_time->valuestring) : NULL
|
||||
);
|
||||
|
|
|
|||
|
|
@ -25,25 +25,25 @@ extern "C" {
|
|||
|
||||
typedef struct OpenAPI_expected_ue_behaviour_data_s OpenAPI_expected_ue_behaviour_data_t;
|
||||
typedef struct OpenAPI_expected_ue_behaviour_data_s {
|
||||
struct OpenAPI_stationary_indication_s *stationary_indication;
|
||||
OpenAPI_stationary_indication_e stationary_indication;
|
||||
int communication_duration_time;
|
||||
int periodic_time;
|
||||
struct OpenAPI_scheduled_communication_time_s *scheduled_communication_time;
|
||||
struct OpenAPI_scheduled_communication_type_s *scheduled_communication_type;
|
||||
OpenAPI_scheduled_communication_type_e scheduled_communication_type;
|
||||
OpenAPI_list_t *expected_umts;
|
||||
struct OpenAPI_traffic_profile_s *traffic_profile;
|
||||
OpenAPI_traffic_profile_e traffic_profile;
|
||||
struct OpenAPI_battery_indication_s *battery_indication;
|
||||
char *validity_time;
|
||||
} OpenAPI_expected_ue_behaviour_data_t;
|
||||
|
||||
OpenAPI_expected_ue_behaviour_data_t *OpenAPI_expected_ue_behaviour_data_create(
|
||||
OpenAPI_stationary_indication_t *stationary_indication,
|
||||
OpenAPI_stationary_indication_e stationary_indication,
|
||||
int communication_duration_time,
|
||||
int periodic_time,
|
||||
OpenAPI_scheduled_communication_time_t *scheduled_communication_time,
|
||||
OpenAPI_scheduled_communication_type_t *scheduled_communication_type,
|
||||
OpenAPI_scheduled_communication_type_e scheduled_communication_type,
|
||||
OpenAPI_list_t *expected_umts,
|
||||
OpenAPI_traffic_profile_t *traffic_profile,
|
||||
OpenAPI_traffic_profile_e traffic_profile,
|
||||
OpenAPI_battery_indication_t *battery_indication,
|
||||
char *validity_time
|
||||
);
|
||||
|
|
|
|||
85
lib/sbi/openapi/model/failure_cause.c
Normal file
85
lib/sbi/openapi/model/failure_cause.c
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "failure_cause.h"
|
||||
|
||||
OpenAPI_failure_cause_t *OpenAPI_failure_cause_create(
|
||||
)
|
||||
{
|
||||
OpenAPI_failure_cause_t *failure_cause_local_var = OpenAPI_malloc(sizeof(OpenAPI_failure_cause_t));
|
||||
if (!failure_cause_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return failure_cause_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_failure_cause_free(OpenAPI_failure_cause_t *failure_cause)
|
||||
{
|
||||
if (NULL == failure_cause) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(failure_cause);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_failure_cause_convertToJSON(OpenAPI_failure_cause_t *failure_cause)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (failure_cause == NULL) {
|
||||
ogs_error("OpenAPI_failure_cause_convertToJSON() failed [FailureCause]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_failure_cause_t *OpenAPI_failure_cause_parseFromJSON(cJSON *failure_causeJSON)
|
||||
{
|
||||
OpenAPI_failure_cause_t *failure_cause_local_var = NULL;
|
||||
failure_cause_local_var = OpenAPI_failure_cause_create (
|
||||
);
|
||||
|
||||
return failure_cause_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_failure_cause_t *OpenAPI_failure_cause_copy(OpenAPI_failure_cause_t *dst, OpenAPI_failure_cause_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_failure_cause_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_failure_cause_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_failure_cause_free(dst);
|
||||
dst = OpenAPI_failure_cause_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
36
lib/sbi/openapi/model/failure_cause.h
Normal file
36
lib/sbi/openapi/model/failure_cause.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* failure_cause.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_failure_cause_H_
|
||||
#define _OpenAPI_failure_cause_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_failure_cause_s OpenAPI_failure_cause_t;
|
||||
typedef struct OpenAPI_failure_cause_s {
|
||||
} OpenAPI_failure_cause_t;
|
||||
|
||||
OpenAPI_failure_cause_t *OpenAPI_failure_cause_create(
|
||||
);
|
||||
void OpenAPI_failure_cause_free(OpenAPI_failure_cause_t *failure_cause);
|
||||
OpenAPI_failure_cause_t *OpenAPI_failure_cause_parseFromJSON(cJSON *failure_causeJSON);
|
||||
cJSON *OpenAPI_failure_cause_convertToJSON(OpenAPI_failure_cause_t *failure_cause);
|
||||
OpenAPI_failure_cause_t *OpenAPI_failure_cause_copy(OpenAPI_failure_cause_t *dst, OpenAPI_failure_cause_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_failure_cause_H_ */
|
||||
|
||||
85
lib/sbi/openapi/model/failure_code.c
Normal file
85
lib/sbi/openapi/model/failure_code.c
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "failure_code.h"
|
||||
|
||||
OpenAPI_failure_code_t *OpenAPI_failure_code_create(
|
||||
)
|
||||
{
|
||||
OpenAPI_failure_code_t *failure_code_local_var = OpenAPI_malloc(sizeof(OpenAPI_failure_code_t));
|
||||
if (!failure_code_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return failure_code_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_failure_code_free(OpenAPI_failure_code_t *failure_code)
|
||||
{
|
||||
if (NULL == failure_code) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(failure_code);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_failure_code_convertToJSON(OpenAPI_failure_code_t *failure_code)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (failure_code == NULL) {
|
||||
ogs_error("OpenAPI_failure_code_convertToJSON() failed [FailureCode]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_failure_code_t *OpenAPI_failure_code_parseFromJSON(cJSON *failure_codeJSON)
|
||||
{
|
||||
OpenAPI_failure_code_t *failure_code_local_var = NULL;
|
||||
failure_code_local_var = OpenAPI_failure_code_create (
|
||||
);
|
||||
|
||||
return failure_code_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_failure_code_t *OpenAPI_failure_code_copy(OpenAPI_failure_code_t *dst, OpenAPI_failure_code_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_failure_code_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_failure_code_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_failure_code_free(dst);
|
||||
dst = OpenAPI_failure_code_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
36
lib/sbi/openapi/model/failure_code.h
Normal file
36
lib/sbi/openapi/model/failure_code.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* failure_code.h
|
||||
*
|
||||
* Possible values are - UNK_RULE_ID: Indicates that the pre-provisioned PCC rule could not be successfully activated because the PCC rule identifier is unknown to the SMF. - RA_GR_ERR: Indicate that the PCC rule could not be successfully installed or enforced because the Rating Group specified within the Charging Data policy decision which the PCC rule refers to is unknown or, invalid. - SER_ID_ERR: Indicate that the PCC rule could not be successfully installed or enforced because the Service Identifier specified within the Charging Data policy decision which the PCC rule refers to is invalid, unknown, or not applicable to the service being charged. - NF_MAL: Indicate that the PCC rule could not be successfully installed (for those provisioned from the PCF) or activated (for those pre-defined in SMF) or enforced (for those already successfully installed) due to SMF/UPF malfunction. - RES_LIM: Indicate that the PCC rule could not be successfully installed (for those provisioned from PCF) or activated (for those pre-defined in SMF) or enforced (for those already successfully installed) due to a limitation of resources at the SMF/UPF. - MAX_NR_QoS_FLOW: Indicate that the PCC rule could not be successfully installed (for those provisioned from PCF) or activated (for those pre-defined in SMF) or enforced (for those already successfully installed) due to the fact that the maximum number of QoS flows has been reached for the PDU session. - MISS_FLOW_INFO: Indicate that the PCC rule could not be successfully installed or enforced because neither the \"flowInfos\" attribute nor the \"appId\" attribute is specified within the PccRule data structure by the PCF during the first install request of the PCC rule. - RES_ALLO_FAIL: Indicate that the PCC rule could not be successfully installed or maintained since the QoS flow establishment/modification failed, or the QoS flow was released. - UNSUCC_QOS_VAL: indicate that the QoS validation has failed or when Guaranteed Bandwidth > Max-Requested-Bandwidth. - INCOR_FLOW_INFO: Indicate that the PCC rule could not be successfully installed or modified at the SMF because the provided flow information is not supported by the network (e.g. the provided IP address(es) or Ipv6 prefix(es) do not correspond to an IP version applicable for the PDU session). - PS_TO_CS_HAN: Indicate that the PCC rule could not be maintained because of PS to CS handover. - APP_ID_ERR: Indicate that the rule could not be successfully installed or enforced because the Application Identifier is invalid, unknown, or not applicable to the application required for detection. - NO_QOS_FLOW_BOUND: Indicate that there is no QoS flow which the SMF can bind the PCC rule(s) to. - FILTER_RES: Indicate that the Flow Information within the \"flowInfos\" attribute cannot be handled by the SMF because any of the restrictions defined in subclause 5.4.2 of 3GPP TS 29.212 was not met. - MISS_REDI_SER_ADDR: Indicate that the PCC rule could not be successfully installed or enforced at the SMF because there is no valid Redirect Server Address within the Traffic Control Data policy decision which the PCC rule refers to provided by the PCF and no preconfigured redirection address for this PCC rule at the SMF. - CM_END_USER_SER_DENIED: Indicate that the charging system denied the service request due to service restrictions (e.g. terminate rating group) or limitations related to the end-user, for example the end-user's account could not cover the requested service. - CM_CREDIT_CON_NOT_APP: Indicate that the charging system determined that the service can be granted to the end user but no further credit control is needed for the service (e.g. service is free of charge or is treated for offline charging). - CM_AUTH_REJ: Indicate that the charging system denied the service request in order to terminate the service for which credit is requested. - CM_USER_UNK: Indicate that the specified end user could not be found in the charging system. - CM_RAT_FAILED: Indicate that the charging system cannot rate the service request due to insufficient rating input, incorrect AVP combination or due to an attribute or an attribute value that is not recognized or supported in the rating. - UE_STA_SUSP: Indicates that the UE is in suspend state.
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_failure_code_H_
|
||||
#define _OpenAPI_failure_code_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_failure_code_s OpenAPI_failure_code_t;
|
||||
typedef struct OpenAPI_failure_code_s {
|
||||
} OpenAPI_failure_code_t;
|
||||
|
||||
OpenAPI_failure_code_t *OpenAPI_failure_code_create(
|
||||
);
|
||||
void OpenAPI_failure_code_free(OpenAPI_failure_code_t *failure_code);
|
||||
OpenAPI_failure_code_t *OpenAPI_failure_code_parseFromJSON(cJSON *failure_codeJSON);
|
||||
cJSON *OpenAPI_failure_code_convertToJSON(OpenAPI_failure_code_t *failure_code);
|
||||
OpenAPI_failure_code_t *OpenAPI_failure_code_copy(OpenAPI_failure_code_t *dst, OpenAPI_failure_code_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_failure_code_H_ */
|
||||
|
||||
85
lib/sbi/openapi/model/final_unit_action.c
Normal file
85
lib/sbi/openapi/model/final_unit_action.c
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "final_unit_action.h"
|
||||
|
||||
OpenAPI_final_unit_action_t *OpenAPI_final_unit_action_create(
|
||||
)
|
||||
{
|
||||
OpenAPI_final_unit_action_t *final_unit_action_local_var = OpenAPI_malloc(sizeof(OpenAPI_final_unit_action_t));
|
||||
if (!final_unit_action_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return final_unit_action_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_final_unit_action_free(OpenAPI_final_unit_action_t *final_unit_action)
|
||||
{
|
||||
if (NULL == final_unit_action) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(final_unit_action);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_final_unit_action_convertToJSON(OpenAPI_final_unit_action_t *final_unit_action)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (final_unit_action == NULL) {
|
||||
ogs_error("OpenAPI_final_unit_action_convertToJSON() failed [FinalUnitAction]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_final_unit_action_t *OpenAPI_final_unit_action_parseFromJSON(cJSON *final_unit_actionJSON)
|
||||
{
|
||||
OpenAPI_final_unit_action_t *final_unit_action_local_var = NULL;
|
||||
final_unit_action_local_var = OpenAPI_final_unit_action_create (
|
||||
);
|
||||
|
||||
return final_unit_action_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_final_unit_action_t *OpenAPI_final_unit_action_copy(OpenAPI_final_unit_action_t *dst, OpenAPI_final_unit_action_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_final_unit_action_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_final_unit_action_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_final_unit_action_free(dst);
|
||||
dst = OpenAPI_final_unit_action_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
36
lib/sbi/openapi/model/final_unit_action.h
Normal file
36
lib/sbi/openapi/model/final_unit_action.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* final_unit_action.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_final_unit_action_H_
|
||||
#define _OpenAPI_final_unit_action_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_final_unit_action_s OpenAPI_final_unit_action_t;
|
||||
typedef struct OpenAPI_final_unit_action_s {
|
||||
} OpenAPI_final_unit_action_t;
|
||||
|
||||
OpenAPI_final_unit_action_t *OpenAPI_final_unit_action_create(
|
||||
);
|
||||
void OpenAPI_final_unit_action_free(OpenAPI_final_unit_action_t *final_unit_action);
|
||||
OpenAPI_final_unit_action_t *OpenAPI_final_unit_action_parseFromJSON(cJSON *final_unit_actionJSON);
|
||||
cJSON *OpenAPI_final_unit_action_convertToJSON(OpenAPI_final_unit_action_t *final_unit_action);
|
||||
OpenAPI_final_unit_action_t *OpenAPI_final_unit_action_copy(OpenAPI_final_unit_action_t *dst, OpenAPI_final_unit_action_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_final_unit_action_H_ */
|
||||
|
||||
85
lib/sbi/openapi/model/flow_direction_rm.c
Normal file
85
lib/sbi/openapi/model/flow_direction_rm.c
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "flow_direction_rm.h"
|
||||
|
||||
OpenAPI_flow_direction_rm_t *OpenAPI_flow_direction_rm_create(
|
||||
)
|
||||
{
|
||||
OpenAPI_flow_direction_rm_t *flow_direction_rm_local_var = OpenAPI_malloc(sizeof(OpenAPI_flow_direction_rm_t));
|
||||
if (!flow_direction_rm_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return flow_direction_rm_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_flow_direction_rm_free(OpenAPI_flow_direction_rm_t *flow_direction_rm)
|
||||
{
|
||||
if (NULL == flow_direction_rm) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(flow_direction_rm);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_flow_direction_rm_convertToJSON(OpenAPI_flow_direction_rm_t *flow_direction_rm)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (flow_direction_rm == NULL) {
|
||||
ogs_error("OpenAPI_flow_direction_rm_convertToJSON() failed [FlowDirectionRm]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_flow_direction_rm_t *OpenAPI_flow_direction_rm_parseFromJSON(cJSON *flow_direction_rmJSON)
|
||||
{
|
||||
OpenAPI_flow_direction_rm_t *flow_direction_rm_local_var = NULL;
|
||||
flow_direction_rm_local_var = OpenAPI_flow_direction_rm_create (
|
||||
);
|
||||
|
||||
return flow_direction_rm_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_flow_direction_rm_t *OpenAPI_flow_direction_rm_copy(OpenAPI_flow_direction_rm_t *dst, OpenAPI_flow_direction_rm_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_flow_direction_rm_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_flow_direction_rm_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_flow_direction_rm_free(dst);
|
||||
dst = OpenAPI_flow_direction_rm_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
38
lib/sbi/openapi/model/flow_direction_rm.h
Normal file
38
lib/sbi/openapi/model/flow_direction_rm.h
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* flow_direction_rm.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_flow_direction_rm_H_
|
||||
#define _OpenAPI_flow_direction_rm_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
#include "flow_direction.h"
|
||||
#include "null_value.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_flow_direction_rm_s OpenAPI_flow_direction_rm_t;
|
||||
typedef struct OpenAPI_flow_direction_rm_s {
|
||||
} OpenAPI_flow_direction_rm_t;
|
||||
|
||||
OpenAPI_flow_direction_rm_t *OpenAPI_flow_direction_rm_create(
|
||||
);
|
||||
void OpenAPI_flow_direction_rm_free(OpenAPI_flow_direction_rm_t *flow_direction_rm);
|
||||
OpenAPI_flow_direction_rm_t *OpenAPI_flow_direction_rm_parseFromJSON(cJSON *flow_direction_rmJSON);
|
||||
cJSON *OpenAPI_flow_direction_rm_convertToJSON(OpenAPI_flow_direction_rm_t *flow_direction_rm);
|
||||
OpenAPI_flow_direction_rm_t *OpenAPI_flow_direction_rm_copy(OpenAPI_flow_direction_rm_t *dst, OpenAPI_flow_direction_rm_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_flow_direction_rm_H_ */
|
||||
|
||||
252
lib/sbi/openapi/model/flow_information.c
Normal file
252
lib/sbi/openapi/model/flow_information.c
Normal file
|
|
@ -0,0 +1,252 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "flow_information.h"
|
||||
|
||||
OpenAPI_flow_information_t *OpenAPI_flow_information_create(
|
||||
char *flow_description,
|
||||
OpenAPI_eth_flow_description_t *eth_flow_description,
|
||||
char *pack_filt_id,
|
||||
int packet_filter_usage,
|
||||
char *tos_traffic_class,
|
||||
char *spi,
|
||||
char *flow_label,
|
||||
OpenAPI_flow_direction_rm_t *flow_direction
|
||||
)
|
||||
{
|
||||
OpenAPI_flow_information_t *flow_information_local_var = OpenAPI_malloc(sizeof(OpenAPI_flow_information_t));
|
||||
if (!flow_information_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
flow_information_local_var->flow_description = flow_description;
|
||||
flow_information_local_var->eth_flow_description = eth_flow_description;
|
||||
flow_information_local_var->pack_filt_id = pack_filt_id;
|
||||
flow_information_local_var->packet_filter_usage = packet_filter_usage;
|
||||
flow_information_local_var->tos_traffic_class = tos_traffic_class;
|
||||
flow_information_local_var->spi = spi;
|
||||
flow_information_local_var->flow_label = flow_label;
|
||||
flow_information_local_var->flow_direction = flow_direction;
|
||||
|
||||
return flow_information_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_flow_information_free(OpenAPI_flow_information_t *flow_information)
|
||||
{
|
||||
if (NULL == flow_information) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(flow_information->flow_description);
|
||||
OpenAPI_eth_flow_description_free(flow_information->eth_flow_description);
|
||||
ogs_free(flow_information->pack_filt_id);
|
||||
ogs_free(flow_information->tos_traffic_class);
|
||||
ogs_free(flow_information->spi);
|
||||
ogs_free(flow_information->flow_label);
|
||||
OpenAPI_flow_direction_rm_free(flow_information->flow_direction);
|
||||
ogs_free(flow_information);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_flow_information_convertToJSON(OpenAPI_flow_information_t *flow_information)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (flow_information == NULL) {
|
||||
ogs_error("OpenAPI_flow_information_convertToJSON() failed [FlowInformation]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (flow_information->flow_description) {
|
||||
if (cJSON_AddStringToObject(item, "flowDescription", flow_information->flow_description) == NULL) {
|
||||
ogs_error("OpenAPI_flow_information_convertToJSON() failed [flow_description]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (flow_information->eth_flow_description) {
|
||||
cJSON *eth_flow_description_local_JSON = OpenAPI_eth_flow_description_convertToJSON(flow_information->eth_flow_description);
|
||||
if (eth_flow_description_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_flow_information_convertToJSON() failed [eth_flow_description]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "ethFlowDescription", eth_flow_description_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_flow_information_convertToJSON() failed [eth_flow_description]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (flow_information->pack_filt_id) {
|
||||
if (cJSON_AddStringToObject(item, "packFiltId", flow_information->pack_filt_id) == NULL) {
|
||||
ogs_error("OpenAPI_flow_information_convertToJSON() failed [pack_filt_id]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (flow_information->packet_filter_usage) {
|
||||
if (cJSON_AddBoolToObject(item, "packetFilterUsage", flow_information->packet_filter_usage) == NULL) {
|
||||
ogs_error("OpenAPI_flow_information_convertToJSON() failed [packet_filter_usage]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (flow_information->tos_traffic_class) {
|
||||
if (cJSON_AddStringToObject(item, "tosTrafficClass", flow_information->tos_traffic_class) == NULL) {
|
||||
ogs_error("OpenAPI_flow_information_convertToJSON() failed [tos_traffic_class]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (flow_information->spi) {
|
||||
if (cJSON_AddStringToObject(item, "spi", flow_information->spi) == NULL) {
|
||||
ogs_error("OpenAPI_flow_information_convertToJSON() failed [spi]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (flow_information->flow_label) {
|
||||
if (cJSON_AddStringToObject(item, "flowLabel", flow_information->flow_label) == NULL) {
|
||||
ogs_error("OpenAPI_flow_information_convertToJSON() failed [flow_label]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (flow_information->flow_direction) {
|
||||
cJSON *flow_direction_local_JSON = OpenAPI_flow_direction_rm_convertToJSON(flow_information->flow_direction);
|
||||
if (flow_direction_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_flow_information_convertToJSON() failed [flow_direction]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "flowDirection", flow_direction_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_flow_information_convertToJSON() failed [flow_direction]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_flow_information_t *OpenAPI_flow_information_parseFromJSON(cJSON *flow_informationJSON)
|
||||
{
|
||||
OpenAPI_flow_information_t *flow_information_local_var = NULL;
|
||||
cJSON *flow_description = cJSON_GetObjectItemCaseSensitive(flow_informationJSON, "flowDescription");
|
||||
|
||||
if (flow_description) {
|
||||
if (!cJSON_IsString(flow_description)) {
|
||||
ogs_error("OpenAPI_flow_information_parseFromJSON() failed [flow_description]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *eth_flow_description = cJSON_GetObjectItemCaseSensitive(flow_informationJSON, "ethFlowDescription");
|
||||
|
||||
OpenAPI_eth_flow_description_t *eth_flow_description_local_nonprim = NULL;
|
||||
if (eth_flow_description) {
|
||||
eth_flow_description_local_nonprim = OpenAPI_eth_flow_description_parseFromJSON(eth_flow_description);
|
||||
}
|
||||
|
||||
cJSON *pack_filt_id = cJSON_GetObjectItemCaseSensitive(flow_informationJSON, "packFiltId");
|
||||
|
||||
if (pack_filt_id) {
|
||||
if (!cJSON_IsString(pack_filt_id)) {
|
||||
ogs_error("OpenAPI_flow_information_parseFromJSON() failed [pack_filt_id]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *packet_filter_usage = cJSON_GetObjectItemCaseSensitive(flow_informationJSON, "packetFilterUsage");
|
||||
|
||||
if (packet_filter_usage) {
|
||||
if (!cJSON_IsBool(packet_filter_usage)) {
|
||||
ogs_error("OpenAPI_flow_information_parseFromJSON() failed [packet_filter_usage]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *tos_traffic_class = cJSON_GetObjectItemCaseSensitive(flow_informationJSON, "tosTrafficClass");
|
||||
|
||||
if (tos_traffic_class) {
|
||||
if (!cJSON_IsString(tos_traffic_class)) {
|
||||
ogs_error("OpenAPI_flow_information_parseFromJSON() failed [tos_traffic_class]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *spi = cJSON_GetObjectItemCaseSensitive(flow_informationJSON, "spi");
|
||||
|
||||
if (spi) {
|
||||
if (!cJSON_IsString(spi)) {
|
||||
ogs_error("OpenAPI_flow_information_parseFromJSON() failed [spi]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *flow_label = cJSON_GetObjectItemCaseSensitive(flow_informationJSON, "flowLabel");
|
||||
|
||||
if (flow_label) {
|
||||
if (!cJSON_IsString(flow_label)) {
|
||||
ogs_error("OpenAPI_flow_information_parseFromJSON() failed [flow_label]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *flow_direction = cJSON_GetObjectItemCaseSensitive(flow_informationJSON, "flowDirection");
|
||||
|
||||
OpenAPI_flow_direction_rm_t *flow_direction_local_nonprim = NULL;
|
||||
if (flow_direction) {
|
||||
flow_direction_local_nonprim = OpenAPI_flow_direction_rm_parseFromJSON(flow_direction);
|
||||
}
|
||||
|
||||
flow_information_local_var = OpenAPI_flow_information_create (
|
||||
flow_description ? ogs_strdup(flow_description->valuestring) : NULL,
|
||||
eth_flow_description ? eth_flow_description_local_nonprim : NULL,
|
||||
pack_filt_id ? ogs_strdup(pack_filt_id->valuestring) : NULL,
|
||||
packet_filter_usage ? packet_filter_usage->valueint : 0,
|
||||
tos_traffic_class ? ogs_strdup(tos_traffic_class->valuestring) : NULL,
|
||||
spi ? ogs_strdup(spi->valuestring) : NULL,
|
||||
flow_label ? ogs_strdup(flow_label->valuestring) : NULL,
|
||||
flow_direction ? flow_direction_local_nonprim : NULL
|
||||
);
|
||||
|
||||
return flow_information_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_flow_information_t *OpenAPI_flow_information_copy(OpenAPI_flow_information_t *dst, OpenAPI_flow_information_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_flow_information_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_flow_information_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_flow_information_free(dst);
|
||||
dst = OpenAPI_flow_information_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
54
lib/sbi/openapi/model/flow_information.h
Normal file
54
lib/sbi/openapi/model/flow_information.h
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* flow_information.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_flow_information_H_
|
||||
#define _OpenAPI_flow_information_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
#include "eth_flow_description.h"
|
||||
#include "flow_direction_rm.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_flow_information_s OpenAPI_flow_information_t;
|
||||
typedef struct OpenAPI_flow_information_s {
|
||||
char *flow_description;
|
||||
struct OpenAPI_eth_flow_description_s *eth_flow_description;
|
||||
char *pack_filt_id;
|
||||
int packet_filter_usage;
|
||||
char *tos_traffic_class;
|
||||
char *spi;
|
||||
char *flow_label;
|
||||
struct OpenAPI_flow_direction_rm_s *flow_direction;
|
||||
} OpenAPI_flow_information_t;
|
||||
|
||||
OpenAPI_flow_information_t *OpenAPI_flow_information_create(
|
||||
char *flow_description,
|
||||
OpenAPI_eth_flow_description_t *eth_flow_description,
|
||||
char *pack_filt_id,
|
||||
int packet_filter_usage,
|
||||
char *tos_traffic_class,
|
||||
char *spi,
|
||||
char *flow_label,
|
||||
OpenAPI_flow_direction_rm_t *flow_direction
|
||||
);
|
||||
void OpenAPI_flow_information_free(OpenAPI_flow_information_t *flow_information);
|
||||
OpenAPI_flow_information_t *OpenAPI_flow_information_parseFromJSON(cJSON *flow_informationJSON);
|
||||
cJSON *OpenAPI_flow_information_convertToJSON(OpenAPI_flow_information_t *flow_information);
|
||||
OpenAPI_flow_information_t *OpenAPI_flow_information_copy(OpenAPI_flow_information_t *dst, OpenAPI_flow_information_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_flow_information_H_ */
|
||||
|
||||
85
lib/sbi/openapi/model/flow_status.c
Normal file
85
lib/sbi/openapi/model/flow_status.c
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "flow_status.h"
|
||||
|
||||
OpenAPI_flow_status_t *OpenAPI_flow_status_create(
|
||||
)
|
||||
{
|
||||
OpenAPI_flow_status_t *flow_status_local_var = OpenAPI_malloc(sizeof(OpenAPI_flow_status_t));
|
||||
if (!flow_status_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return flow_status_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_flow_status_free(OpenAPI_flow_status_t *flow_status)
|
||||
{
|
||||
if (NULL == flow_status) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(flow_status);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_flow_status_convertToJSON(OpenAPI_flow_status_t *flow_status)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (flow_status == NULL) {
|
||||
ogs_error("OpenAPI_flow_status_convertToJSON() failed [FlowStatus]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_flow_status_t *OpenAPI_flow_status_parseFromJSON(cJSON *flow_statusJSON)
|
||||
{
|
||||
OpenAPI_flow_status_t *flow_status_local_var = NULL;
|
||||
flow_status_local_var = OpenAPI_flow_status_create (
|
||||
);
|
||||
|
||||
return flow_status_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_flow_status_t *OpenAPI_flow_status_copy(OpenAPI_flow_status_t *dst, OpenAPI_flow_status_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_flow_status_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_flow_status_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_flow_status_free(dst);
|
||||
dst = OpenAPI_flow_status_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
36
lib/sbi/openapi/model/flow_status.h
Normal file
36
lib/sbi/openapi/model/flow_status.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* flow_status.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_flow_status_H_
|
||||
#define _OpenAPI_flow_status_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_flow_status_s OpenAPI_flow_status_t;
|
||||
typedef struct OpenAPI_flow_status_s {
|
||||
} OpenAPI_flow_status_t;
|
||||
|
||||
OpenAPI_flow_status_t *OpenAPI_flow_status_create(
|
||||
);
|
||||
void OpenAPI_flow_status_free(OpenAPI_flow_status_t *flow_status);
|
||||
OpenAPI_flow_status_t *OpenAPI_flow_status_parseFromJSON(cJSON *flow_statusJSON);
|
||||
cJSON *OpenAPI_flow_status_convertToJSON(OpenAPI_flow_status_t *flow_status);
|
||||
OpenAPI_flow_status_t *OpenAPI_flow_status_copy(OpenAPI_flow_status_t *dst, OpenAPI_flow_status_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_flow_status_H_ */
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ OpenAPI_hsmf_update_data_t *OpenAPI_hsmf_update_data_create(
|
|||
OpenAPI_n4_information_t *n4_info,
|
||||
OpenAPI_n4_information_t *n4_info_ext1,
|
||||
OpenAPI_n4_information_t *n4_info_ext2,
|
||||
OpenAPI_presence_state_t *presence_in_ladn,
|
||||
OpenAPI_presence_state_e presence_in_ladn,
|
||||
char *vsmf_pdu_session_uri,
|
||||
char *vsmf_id,
|
||||
char *v_smf_service_instance_id,
|
||||
|
|
@ -174,7 +174,6 @@ void OpenAPI_hsmf_update_data_free(OpenAPI_hsmf_update_data_t *hsmf_update_data)
|
|||
OpenAPI_n4_information_free(hsmf_update_data->n4_info);
|
||||
OpenAPI_n4_information_free(hsmf_update_data->n4_info_ext1);
|
||||
OpenAPI_n4_information_free(hsmf_update_data->n4_info_ext2);
|
||||
OpenAPI_presence_state_free(hsmf_update_data->presence_in_ladn);
|
||||
ogs_free(hsmf_update_data->vsmf_pdu_session_uri);
|
||||
ogs_free(hsmf_update_data->vsmf_id);
|
||||
ogs_free(hsmf_update_data->v_smf_service_instance_id);
|
||||
|
|
@ -653,13 +652,7 @@ cJSON *OpenAPI_hsmf_update_data_convertToJSON(OpenAPI_hsmf_update_data_t *hsmf_u
|
|||
}
|
||||
|
||||
if (hsmf_update_data->presence_in_ladn) {
|
||||
cJSON *presence_in_ladn_local_JSON = OpenAPI_presence_state_convertToJSON(hsmf_update_data->presence_in_ladn);
|
||||
if (presence_in_ladn_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [presence_in_ladn]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "presenceInLadn", presence_in_ladn_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
if (cJSON_AddStringToObject(item, "presenceInLadn", OpenAPI_presence_state_ToString(hsmf_update_data->presence_in_ladn)) == NULL) {
|
||||
ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [presence_in_ladn]");
|
||||
goto end;
|
||||
}
|
||||
|
|
@ -1248,9 +1241,13 @@ OpenAPI_hsmf_update_data_t *OpenAPI_hsmf_update_data_parseFromJSON(cJSON *hsmf_u
|
|||
|
||||
cJSON *presence_in_ladn = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "presenceInLadn");
|
||||
|
||||
OpenAPI_presence_state_t *presence_in_ladn_local_nonprim = NULL;
|
||||
OpenAPI_presence_state_e presence_in_ladnVariable;
|
||||
if (presence_in_ladn) {
|
||||
presence_in_ladn_local_nonprim = OpenAPI_presence_state_parseFromJSON(presence_in_ladn);
|
||||
if (!cJSON_IsString(presence_in_ladn)) {
|
||||
ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [presence_in_ladn]");
|
||||
goto end;
|
||||
}
|
||||
presence_in_ladnVariable = OpenAPI_presence_state_FromString(presence_in_ladn->valuestring);
|
||||
}
|
||||
|
||||
cJSON *vsmf_pdu_session_uri = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "vsmfPduSessionUri");
|
||||
|
|
@ -1413,7 +1410,7 @@ OpenAPI_hsmf_update_data_t *OpenAPI_hsmf_update_data_parseFromJSON(cJSON *hsmf_u
|
|||
n4_info ? n4_info_local_nonprim : NULL,
|
||||
n4_info_ext1 ? n4_info_ext1_local_nonprim : NULL,
|
||||
n4_info_ext2 ? n4_info_ext2_local_nonprim : NULL,
|
||||
presence_in_ladn ? presence_in_ladn_local_nonprim : NULL,
|
||||
presence_in_ladn ? presence_in_ladnVariable : 0,
|
||||
vsmf_pdu_session_uri ? ogs_strdup(vsmf_pdu_session_uri->valuestring) : NULL,
|
||||
vsmf_id ? ogs_strdup(vsmf_id->valuestring) : NULL,
|
||||
v_smf_service_instance_id ? ogs_strdup(v_smf_service_instance_id->valuestring) : NULL,
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ typedef struct OpenAPI_hsmf_update_data_s {
|
|||
struct OpenAPI_n4_information_s *n4_info;
|
||||
struct OpenAPI_n4_information_s *n4_info_ext1;
|
||||
struct OpenAPI_n4_information_s *n4_info_ext2;
|
||||
struct OpenAPI_presence_state_s *presence_in_ladn;
|
||||
OpenAPI_presence_state_e presence_in_ladn;
|
||||
char *vsmf_pdu_session_uri;
|
||||
char *vsmf_id;
|
||||
char *v_smf_service_instance_id;
|
||||
|
|
@ -139,7 +139,7 @@ OpenAPI_hsmf_update_data_t *OpenAPI_hsmf_update_data_create(
|
|||
OpenAPI_n4_information_t *n4_info,
|
||||
OpenAPI_n4_information_t *n4_info_ext1,
|
||||
OpenAPI_n4_information_t *n4_info_ext2,
|
||||
OpenAPI_presence_state_t *presence_in_ladn,
|
||||
OpenAPI_presence_state_e presence_in_ladn,
|
||||
char *vsmf_pdu_session_uri,
|
||||
char *vsmf_id,
|
||||
char *v_smf_service_instance_id,
|
||||
|
|
|
|||
165
lib/sbi/openapi/model/ip_multicast_address_info.c
Normal file
165
lib/sbi/openapi/model/ip_multicast_address_info.c
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "ip_multicast_address_info.h"
|
||||
|
||||
OpenAPI_ip_multicast_address_info_t *OpenAPI_ip_multicast_address_info_create(
|
||||
char *src_ipv4_addr,
|
||||
char *ipv4_mul_addr,
|
||||
char *src_ipv6_addr,
|
||||
char *ipv6_mul_addr
|
||||
)
|
||||
{
|
||||
OpenAPI_ip_multicast_address_info_t *ip_multicast_address_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_ip_multicast_address_info_t));
|
||||
if (!ip_multicast_address_info_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
ip_multicast_address_info_local_var->src_ipv4_addr = src_ipv4_addr;
|
||||
ip_multicast_address_info_local_var->ipv4_mul_addr = ipv4_mul_addr;
|
||||
ip_multicast_address_info_local_var->src_ipv6_addr = src_ipv6_addr;
|
||||
ip_multicast_address_info_local_var->ipv6_mul_addr = ipv6_mul_addr;
|
||||
|
||||
return ip_multicast_address_info_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_ip_multicast_address_info_free(OpenAPI_ip_multicast_address_info_t *ip_multicast_address_info)
|
||||
{
|
||||
if (NULL == ip_multicast_address_info) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(ip_multicast_address_info->src_ipv4_addr);
|
||||
ogs_free(ip_multicast_address_info->ipv4_mul_addr);
|
||||
ogs_free(ip_multicast_address_info->src_ipv6_addr);
|
||||
ogs_free(ip_multicast_address_info->ipv6_mul_addr);
|
||||
ogs_free(ip_multicast_address_info);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_ip_multicast_address_info_convertToJSON(OpenAPI_ip_multicast_address_info_t *ip_multicast_address_info)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (ip_multicast_address_info == NULL) {
|
||||
ogs_error("OpenAPI_ip_multicast_address_info_convertToJSON() failed [IpMulticastAddressInfo]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (ip_multicast_address_info->src_ipv4_addr) {
|
||||
if (cJSON_AddStringToObject(item, "srcIpv4Addr", ip_multicast_address_info->src_ipv4_addr) == NULL) {
|
||||
ogs_error("OpenAPI_ip_multicast_address_info_convertToJSON() failed [src_ipv4_addr]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (ip_multicast_address_info->ipv4_mul_addr) {
|
||||
if (cJSON_AddStringToObject(item, "ipv4MulAddr", ip_multicast_address_info->ipv4_mul_addr) == NULL) {
|
||||
ogs_error("OpenAPI_ip_multicast_address_info_convertToJSON() failed [ipv4_mul_addr]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (ip_multicast_address_info->src_ipv6_addr) {
|
||||
if (cJSON_AddStringToObject(item, "srcIpv6Addr", ip_multicast_address_info->src_ipv6_addr) == NULL) {
|
||||
ogs_error("OpenAPI_ip_multicast_address_info_convertToJSON() failed [src_ipv6_addr]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (ip_multicast_address_info->ipv6_mul_addr) {
|
||||
if (cJSON_AddStringToObject(item, "ipv6MulAddr", ip_multicast_address_info->ipv6_mul_addr) == NULL) {
|
||||
ogs_error("OpenAPI_ip_multicast_address_info_convertToJSON() failed [ipv6_mul_addr]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_ip_multicast_address_info_t *OpenAPI_ip_multicast_address_info_parseFromJSON(cJSON *ip_multicast_address_infoJSON)
|
||||
{
|
||||
OpenAPI_ip_multicast_address_info_t *ip_multicast_address_info_local_var = NULL;
|
||||
cJSON *src_ipv4_addr = cJSON_GetObjectItemCaseSensitive(ip_multicast_address_infoJSON, "srcIpv4Addr");
|
||||
|
||||
if (src_ipv4_addr) {
|
||||
if (!cJSON_IsString(src_ipv4_addr)) {
|
||||
ogs_error("OpenAPI_ip_multicast_address_info_parseFromJSON() failed [src_ipv4_addr]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *ipv4_mul_addr = cJSON_GetObjectItemCaseSensitive(ip_multicast_address_infoJSON, "ipv4MulAddr");
|
||||
|
||||
if (ipv4_mul_addr) {
|
||||
if (!cJSON_IsString(ipv4_mul_addr)) {
|
||||
ogs_error("OpenAPI_ip_multicast_address_info_parseFromJSON() failed [ipv4_mul_addr]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *src_ipv6_addr = cJSON_GetObjectItemCaseSensitive(ip_multicast_address_infoJSON, "srcIpv6Addr");
|
||||
|
||||
if (src_ipv6_addr) {
|
||||
if (!cJSON_IsString(src_ipv6_addr)) {
|
||||
ogs_error("OpenAPI_ip_multicast_address_info_parseFromJSON() failed [src_ipv6_addr]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *ipv6_mul_addr = cJSON_GetObjectItemCaseSensitive(ip_multicast_address_infoJSON, "ipv6MulAddr");
|
||||
|
||||
if (ipv6_mul_addr) {
|
||||
if (!cJSON_IsString(ipv6_mul_addr)) {
|
||||
ogs_error("OpenAPI_ip_multicast_address_info_parseFromJSON() failed [ipv6_mul_addr]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
ip_multicast_address_info_local_var = OpenAPI_ip_multicast_address_info_create (
|
||||
src_ipv4_addr ? ogs_strdup(src_ipv4_addr->valuestring) : NULL,
|
||||
ipv4_mul_addr ? ogs_strdup(ipv4_mul_addr->valuestring) : NULL,
|
||||
src_ipv6_addr ? ogs_strdup(src_ipv6_addr->valuestring) : NULL,
|
||||
ipv6_mul_addr ? ogs_strdup(ipv6_mul_addr->valuestring) : NULL
|
||||
);
|
||||
|
||||
return ip_multicast_address_info_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_ip_multicast_address_info_t *OpenAPI_ip_multicast_address_info_copy(OpenAPI_ip_multicast_address_info_t *dst, OpenAPI_ip_multicast_address_info_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_ip_multicast_address_info_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_ip_multicast_address_info_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_ip_multicast_address_info_free(dst);
|
||||
dst = OpenAPI_ip_multicast_address_info_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
44
lib/sbi/openapi/model/ip_multicast_address_info.h
Normal file
44
lib/sbi/openapi/model/ip_multicast_address_info.h
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* ip_multicast_address_info.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_ip_multicast_address_info_H_
|
||||
#define _OpenAPI_ip_multicast_address_info_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_ip_multicast_address_info_s OpenAPI_ip_multicast_address_info_t;
|
||||
typedef struct OpenAPI_ip_multicast_address_info_s {
|
||||
char *src_ipv4_addr;
|
||||
char *ipv4_mul_addr;
|
||||
char *src_ipv6_addr;
|
||||
char *ipv6_mul_addr;
|
||||
} OpenAPI_ip_multicast_address_info_t;
|
||||
|
||||
OpenAPI_ip_multicast_address_info_t *OpenAPI_ip_multicast_address_info_create(
|
||||
char *src_ipv4_addr,
|
||||
char *ipv4_mul_addr,
|
||||
char *src_ipv6_addr,
|
||||
char *ipv6_mul_addr
|
||||
);
|
||||
void OpenAPI_ip_multicast_address_info_free(OpenAPI_ip_multicast_address_info_t *ip_multicast_address_info);
|
||||
OpenAPI_ip_multicast_address_info_t *OpenAPI_ip_multicast_address_info_parseFromJSON(cJSON *ip_multicast_address_infoJSON);
|
||||
cJSON *OpenAPI_ip_multicast_address_info_convertToJSON(OpenAPI_ip_multicast_address_info_t *ip_multicast_address_info);
|
||||
OpenAPI_ip_multicast_address_info_t *OpenAPI_ip_multicast_address_info_copy(OpenAPI_ip_multicast_address_info_t *dst, OpenAPI_ip_multicast_address_info_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_ip_multicast_address_info_H_ */
|
||||
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
OpenAPI_ladn_info_t *OpenAPI_ladn_info_create(
|
||||
char *ladn,
|
||||
OpenAPI_presence_state_t *presence
|
||||
OpenAPI_presence_state_e presence
|
||||
)
|
||||
{
|
||||
OpenAPI_ladn_info_t *ladn_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_ladn_info_t));
|
||||
|
|
@ -26,7 +26,6 @@ void OpenAPI_ladn_info_free(OpenAPI_ladn_info_t *ladn_info)
|
|||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(ladn_info->ladn);
|
||||
OpenAPI_presence_state_free(ladn_info->presence);
|
||||
ogs_free(ladn_info);
|
||||
}
|
||||
|
||||
|
|
@ -50,13 +49,7 @@ cJSON *OpenAPI_ladn_info_convertToJSON(OpenAPI_ladn_info_t *ladn_info)
|
|||
}
|
||||
|
||||
if (ladn_info->presence) {
|
||||
cJSON *presence_local_JSON = OpenAPI_presence_state_convertToJSON(ladn_info->presence);
|
||||
if (presence_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_ladn_info_convertToJSON() failed [presence]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "presence", presence_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
if (cJSON_AddStringToObject(item, "presence", OpenAPI_presence_state_ToString(ladn_info->presence)) == NULL) {
|
||||
ogs_error("OpenAPI_ladn_info_convertToJSON() failed [presence]");
|
||||
goto end;
|
||||
}
|
||||
|
|
@ -83,14 +76,18 @@ OpenAPI_ladn_info_t *OpenAPI_ladn_info_parseFromJSON(cJSON *ladn_infoJSON)
|
|||
|
||||
cJSON *presence = cJSON_GetObjectItemCaseSensitive(ladn_infoJSON, "presence");
|
||||
|
||||
OpenAPI_presence_state_t *presence_local_nonprim = NULL;
|
||||
OpenAPI_presence_state_e presenceVariable;
|
||||
if (presence) {
|
||||
presence_local_nonprim = OpenAPI_presence_state_parseFromJSON(presence);
|
||||
if (!cJSON_IsString(presence)) {
|
||||
ogs_error("OpenAPI_ladn_info_parseFromJSON() failed [presence]");
|
||||
goto end;
|
||||
}
|
||||
presenceVariable = OpenAPI_presence_state_FromString(presence->valuestring);
|
||||
}
|
||||
|
||||
ladn_info_local_var = OpenAPI_ladn_info_create (
|
||||
ogs_strdup(ladn->valuestring),
|
||||
presence ? presence_local_nonprim : NULL
|
||||
presence ? presenceVariable : 0
|
||||
);
|
||||
|
||||
return ladn_info_local_var;
|
||||
|
|
|
|||
|
|
@ -21,12 +21,12 @@ extern "C" {
|
|||
typedef struct OpenAPI_ladn_info_s OpenAPI_ladn_info_t;
|
||||
typedef struct OpenAPI_ladn_info_s {
|
||||
char *ladn;
|
||||
struct OpenAPI_presence_state_s *presence;
|
||||
OpenAPI_presence_state_e presence;
|
||||
} OpenAPI_ladn_info_t;
|
||||
|
||||
OpenAPI_ladn_info_t *OpenAPI_ladn_info_create(
|
||||
char *ladn,
|
||||
OpenAPI_presence_state_t *presence
|
||||
OpenAPI_presence_state_e presence
|
||||
);
|
||||
void OpenAPI_ladn_info_free(OpenAPI_ladn_info_t *ladn_info);
|
||||
OpenAPI_ladn_info_t *OpenAPI_ladn_info_parseFromJSON(cJSON *ladn_infoJSON);
|
||||
|
|
|
|||
85
lib/sbi/openapi/model/ma_pdu_indication.c
Normal file
85
lib/sbi/openapi/model/ma_pdu_indication.c
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "ma_pdu_indication.h"
|
||||
|
||||
OpenAPI_ma_pdu_indication_t *OpenAPI_ma_pdu_indication_create(
|
||||
)
|
||||
{
|
||||
OpenAPI_ma_pdu_indication_t *ma_pdu_indication_local_var = OpenAPI_malloc(sizeof(OpenAPI_ma_pdu_indication_t));
|
||||
if (!ma_pdu_indication_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return ma_pdu_indication_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_ma_pdu_indication_free(OpenAPI_ma_pdu_indication_t *ma_pdu_indication)
|
||||
{
|
||||
if (NULL == ma_pdu_indication) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(ma_pdu_indication);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_ma_pdu_indication_convertToJSON(OpenAPI_ma_pdu_indication_t *ma_pdu_indication)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (ma_pdu_indication == NULL) {
|
||||
ogs_error("OpenAPI_ma_pdu_indication_convertToJSON() failed [MaPduIndication]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_ma_pdu_indication_t *OpenAPI_ma_pdu_indication_parseFromJSON(cJSON *ma_pdu_indicationJSON)
|
||||
{
|
||||
OpenAPI_ma_pdu_indication_t *ma_pdu_indication_local_var = NULL;
|
||||
ma_pdu_indication_local_var = OpenAPI_ma_pdu_indication_create (
|
||||
);
|
||||
|
||||
return ma_pdu_indication_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_ma_pdu_indication_t *OpenAPI_ma_pdu_indication_copy(OpenAPI_ma_pdu_indication_t *dst, OpenAPI_ma_pdu_indication_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_ma_pdu_indication_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_ma_pdu_indication_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_ma_pdu_indication_free(dst);
|
||||
dst = OpenAPI_ma_pdu_indication_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
36
lib/sbi/openapi/model/ma_pdu_indication.h
Normal file
36
lib/sbi/openapi/model/ma_pdu_indication.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* ma_pdu_indication.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_ma_pdu_indication_H_
|
||||
#define _OpenAPI_ma_pdu_indication_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_ma_pdu_indication_s OpenAPI_ma_pdu_indication_t;
|
||||
typedef struct OpenAPI_ma_pdu_indication_s {
|
||||
} OpenAPI_ma_pdu_indication_t;
|
||||
|
||||
OpenAPI_ma_pdu_indication_t *OpenAPI_ma_pdu_indication_create(
|
||||
);
|
||||
void OpenAPI_ma_pdu_indication_free(OpenAPI_ma_pdu_indication_t *ma_pdu_indication);
|
||||
OpenAPI_ma_pdu_indication_t *OpenAPI_ma_pdu_indication_parseFromJSON(cJSON *ma_pdu_indicationJSON);
|
||||
cJSON *OpenAPI_ma_pdu_indication_convertToJSON(OpenAPI_ma_pdu_indication_t *ma_pdu_indication);
|
||||
OpenAPI_ma_pdu_indication_t *OpenAPI_ma_pdu_indication_copy(OpenAPI_ma_pdu_indication_t *dst, OpenAPI_ma_pdu_indication_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_ma_pdu_indication_H_ */
|
||||
|
||||
143
lib/sbi/openapi/model/mapping_of_snssai.c
Normal file
143
lib/sbi/openapi/model/mapping_of_snssai.c
Normal file
|
|
@ -0,0 +1,143 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "mapping_of_snssai.h"
|
||||
|
||||
OpenAPI_mapping_of_snssai_t *OpenAPI_mapping_of_snssai_create(
|
||||
OpenAPI_snssai_t *serving_snssai,
|
||||
OpenAPI_snssai_t *home_snssai
|
||||
)
|
||||
{
|
||||
OpenAPI_mapping_of_snssai_t *mapping_of_snssai_local_var = OpenAPI_malloc(sizeof(OpenAPI_mapping_of_snssai_t));
|
||||
if (!mapping_of_snssai_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
mapping_of_snssai_local_var->serving_snssai = serving_snssai;
|
||||
mapping_of_snssai_local_var->home_snssai = home_snssai;
|
||||
|
||||
return mapping_of_snssai_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_mapping_of_snssai_free(OpenAPI_mapping_of_snssai_t *mapping_of_snssai)
|
||||
{
|
||||
if (NULL == mapping_of_snssai) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_snssai_free(mapping_of_snssai->serving_snssai);
|
||||
OpenAPI_snssai_free(mapping_of_snssai->home_snssai);
|
||||
ogs_free(mapping_of_snssai);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_mapping_of_snssai_convertToJSON(OpenAPI_mapping_of_snssai_t *mapping_of_snssai)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (mapping_of_snssai == NULL) {
|
||||
ogs_error("OpenAPI_mapping_of_snssai_convertToJSON() failed [MappingOfSnssai]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (!mapping_of_snssai->serving_snssai) {
|
||||
ogs_error("OpenAPI_mapping_of_snssai_convertToJSON() failed [serving_snssai]");
|
||||
goto end;
|
||||
}
|
||||
cJSON *serving_snssai_local_JSON = OpenAPI_snssai_convertToJSON(mapping_of_snssai->serving_snssai);
|
||||
if (serving_snssai_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_mapping_of_snssai_convertToJSON() failed [serving_snssai]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "servingSnssai", serving_snssai_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_mapping_of_snssai_convertToJSON() failed [serving_snssai]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!mapping_of_snssai->home_snssai) {
|
||||
ogs_error("OpenAPI_mapping_of_snssai_convertToJSON() failed [home_snssai]");
|
||||
goto end;
|
||||
}
|
||||
cJSON *home_snssai_local_JSON = OpenAPI_snssai_convertToJSON(mapping_of_snssai->home_snssai);
|
||||
if (home_snssai_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_mapping_of_snssai_convertToJSON() failed [home_snssai]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "homeSnssai", home_snssai_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_mapping_of_snssai_convertToJSON() failed [home_snssai]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_mapping_of_snssai_t *OpenAPI_mapping_of_snssai_parseFromJSON(cJSON *mapping_of_snssaiJSON)
|
||||
{
|
||||
OpenAPI_mapping_of_snssai_t *mapping_of_snssai_local_var = NULL;
|
||||
cJSON *serving_snssai = cJSON_GetObjectItemCaseSensitive(mapping_of_snssaiJSON, "servingSnssai");
|
||||
if (!serving_snssai) {
|
||||
ogs_error("OpenAPI_mapping_of_snssai_parseFromJSON() failed [serving_snssai]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_snssai_t *serving_snssai_local_nonprim = NULL;
|
||||
|
||||
serving_snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(serving_snssai);
|
||||
|
||||
cJSON *home_snssai = cJSON_GetObjectItemCaseSensitive(mapping_of_snssaiJSON, "homeSnssai");
|
||||
if (!home_snssai) {
|
||||
ogs_error("OpenAPI_mapping_of_snssai_parseFromJSON() failed [home_snssai]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_snssai_t *home_snssai_local_nonprim = NULL;
|
||||
|
||||
home_snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(home_snssai);
|
||||
|
||||
mapping_of_snssai_local_var = OpenAPI_mapping_of_snssai_create (
|
||||
serving_snssai_local_nonprim,
|
||||
home_snssai_local_nonprim
|
||||
);
|
||||
|
||||
return mapping_of_snssai_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_mapping_of_snssai_t *OpenAPI_mapping_of_snssai_copy(OpenAPI_mapping_of_snssai_t *dst, OpenAPI_mapping_of_snssai_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_mapping_of_snssai_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_mapping_of_snssai_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_mapping_of_snssai_free(dst);
|
||||
dst = OpenAPI_mapping_of_snssai_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
41
lib/sbi/openapi/model/mapping_of_snssai.h
Normal file
41
lib/sbi/openapi/model/mapping_of_snssai.h
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* mapping_of_snssai.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_mapping_of_snssai_H_
|
||||
#define _OpenAPI_mapping_of_snssai_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
#include "snssai.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_mapping_of_snssai_s OpenAPI_mapping_of_snssai_t;
|
||||
typedef struct OpenAPI_mapping_of_snssai_s {
|
||||
struct OpenAPI_snssai_s *serving_snssai;
|
||||
struct OpenAPI_snssai_s *home_snssai;
|
||||
} OpenAPI_mapping_of_snssai_t;
|
||||
|
||||
OpenAPI_mapping_of_snssai_t *OpenAPI_mapping_of_snssai_create(
|
||||
OpenAPI_snssai_t *serving_snssai,
|
||||
OpenAPI_snssai_t *home_snssai
|
||||
);
|
||||
void OpenAPI_mapping_of_snssai_free(OpenAPI_mapping_of_snssai_t *mapping_of_snssai);
|
||||
OpenAPI_mapping_of_snssai_t *OpenAPI_mapping_of_snssai_parseFromJSON(cJSON *mapping_of_snssaiJSON);
|
||||
cJSON *OpenAPI_mapping_of_snssai_convertToJSON(OpenAPI_mapping_of_snssai_t *mapping_of_snssai);
|
||||
OpenAPI_mapping_of_snssai_t *OpenAPI_mapping_of_snssai_copy(OpenAPI_mapping_of_snssai_t *dst, OpenAPI_mapping_of_snssai_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_mapping_of_snssai_H_ */
|
||||
|
||||
85
lib/sbi/openapi/model/metering_method.c
Normal file
85
lib/sbi/openapi/model/metering_method.c
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "metering_method.h"
|
||||
|
||||
OpenAPI_metering_method_t *OpenAPI_metering_method_create(
|
||||
)
|
||||
{
|
||||
OpenAPI_metering_method_t *metering_method_local_var = OpenAPI_malloc(sizeof(OpenAPI_metering_method_t));
|
||||
if (!metering_method_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return metering_method_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_metering_method_free(OpenAPI_metering_method_t *metering_method)
|
||||
{
|
||||
if (NULL == metering_method) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(metering_method);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_metering_method_convertToJSON(OpenAPI_metering_method_t *metering_method)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (metering_method == NULL) {
|
||||
ogs_error("OpenAPI_metering_method_convertToJSON() failed [MeteringMethod]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_metering_method_t *OpenAPI_metering_method_parseFromJSON(cJSON *metering_methodJSON)
|
||||
{
|
||||
OpenAPI_metering_method_t *metering_method_local_var = NULL;
|
||||
metering_method_local_var = OpenAPI_metering_method_create (
|
||||
);
|
||||
|
||||
return metering_method_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_metering_method_t *OpenAPI_metering_method_copy(OpenAPI_metering_method_t *dst, OpenAPI_metering_method_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_metering_method_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_metering_method_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_metering_method_free(dst);
|
||||
dst = OpenAPI_metering_method_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
37
lib/sbi/openapi/model/metering_method.h
Normal file
37
lib/sbi/openapi/model/metering_method.h
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* metering_method.h
|
||||
*
|
||||
* Possible values are - DURATION: Indicates that the duration of the service data flow traffic shall be metered. - VOLUME: Indicates that volume of the service data flow traffic shall be metered. - DURATION_VOLUME: Indicates that the duration and the volume of the service data flow traffic shall be metered. - EVENT: Indicates that events of the service data flow traffic shall be metered.
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_metering_method_H_
|
||||
#define _OpenAPI_metering_method_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
#include "null_value.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_metering_method_s OpenAPI_metering_method_t;
|
||||
typedef struct OpenAPI_metering_method_s {
|
||||
} OpenAPI_metering_method_t;
|
||||
|
||||
OpenAPI_metering_method_t *OpenAPI_metering_method_create(
|
||||
);
|
||||
void OpenAPI_metering_method_free(OpenAPI_metering_method_t *metering_method);
|
||||
OpenAPI_metering_method_t *OpenAPI_metering_method_parseFromJSON(cJSON *metering_methodJSON);
|
||||
cJSON *OpenAPI_metering_method_convertToJSON(OpenAPI_metering_method_t *metering_method);
|
||||
OpenAPI_metering_method_t *OpenAPI_metering_method_copy(OpenAPI_metering_method_t *dst, OpenAPI_metering_method_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_metering_method_H_ */
|
||||
|
||||
209
lib/sbi/openapi/model/packet_filter_info.c
Normal file
209
lib/sbi/openapi/model/packet_filter_info.c
Normal file
|
|
@ -0,0 +1,209 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "packet_filter_info.h"
|
||||
|
||||
OpenAPI_packet_filter_info_t *OpenAPI_packet_filter_info_create(
|
||||
char *pack_filt_id,
|
||||
char *pack_filt_cont,
|
||||
char *tos_traffic_class,
|
||||
char *spi,
|
||||
char *flow_label,
|
||||
OpenAPI_flow_direction_t *flow_direction
|
||||
)
|
||||
{
|
||||
OpenAPI_packet_filter_info_t *packet_filter_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_packet_filter_info_t));
|
||||
if (!packet_filter_info_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
packet_filter_info_local_var->pack_filt_id = pack_filt_id;
|
||||
packet_filter_info_local_var->pack_filt_cont = pack_filt_cont;
|
||||
packet_filter_info_local_var->tos_traffic_class = tos_traffic_class;
|
||||
packet_filter_info_local_var->spi = spi;
|
||||
packet_filter_info_local_var->flow_label = flow_label;
|
||||
packet_filter_info_local_var->flow_direction = flow_direction;
|
||||
|
||||
return packet_filter_info_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_packet_filter_info_free(OpenAPI_packet_filter_info_t *packet_filter_info)
|
||||
{
|
||||
if (NULL == packet_filter_info) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(packet_filter_info->pack_filt_id);
|
||||
ogs_free(packet_filter_info->pack_filt_cont);
|
||||
ogs_free(packet_filter_info->tos_traffic_class);
|
||||
ogs_free(packet_filter_info->spi);
|
||||
ogs_free(packet_filter_info->flow_label);
|
||||
OpenAPI_flow_direction_free(packet_filter_info->flow_direction);
|
||||
ogs_free(packet_filter_info);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_packet_filter_info_convertToJSON(OpenAPI_packet_filter_info_t *packet_filter_info)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (packet_filter_info == NULL) {
|
||||
ogs_error("OpenAPI_packet_filter_info_convertToJSON() failed [PacketFilterInfo]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (packet_filter_info->pack_filt_id) {
|
||||
if (cJSON_AddStringToObject(item, "packFiltId", packet_filter_info->pack_filt_id) == NULL) {
|
||||
ogs_error("OpenAPI_packet_filter_info_convertToJSON() failed [pack_filt_id]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (packet_filter_info->pack_filt_cont) {
|
||||
if (cJSON_AddStringToObject(item, "packFiltCont", packet_filter_info->pack_filt_cont) == NULL) {
|
||||
ogs_error("OpenAPI_packet_filter_info_convertToJSON() failed [pack_filt_cont]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (packet_filter_info->tos_traffic_class) {
|
||||
if (cJSON_AddStringToObject(item, "tosTrafficClass", packet_filter_info->tos_traffic_class) == NULL) {
|
||||
ogs_error("OpenAPI_packet_filter_info_convertToJSON() failed [tos_traffic_class]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (packet_filter_info->spi) {
|
||||
if (cJSON_AddStringToObject(item, "spi", packet_filter_info->spi) == NULL) {
|
||||
ogs_error("OpenAPI_packet_filter_info_convertToJSON() failed [spi]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (packet_filter_info->flow_label) {
|
||||
if (cJSON_AddStringToObject(item, "flowLabel", packet_filter_info->flow_label) == NULL) {
|
||||
ogs_error("OpenAPI_packet_filter_info_convertToJSON() failed [flow_label]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (packet_filter_info->flow_direction) {
|
||||
cJSON *flow_direction_local_JSON = OpenAPI_flow_direction_convertToJSON(packet_filter_info->flow_direction);
|
||||
if (flow_direction_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_packet_filter_info_convertToJSON() failed [flow_direction]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "flowDirection", flow_direction_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_packet_filter_info_convertToJSON() failed [flow_direction]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_packet_filter_info_t *OpenAPI_packet_filter_info_parseFromJSON(cJSON *packet_filter_infoJSON)
|
||||
{
|
||||
OpenAPI_packet_filter_info_t *packet_filter_info_local_var = NULL;
|
||||
cJSON *pack_filt_id = cJSON_GetObjectItemCaseSensitive(packet_filter_infoJSON, "packFiltId");
|
||||
|
||||
if (pack_filt_id) {
|
||||
if (!cJSON_IsString(pack_filt_id)) {
|
||||
ogs_error("OpenAPI_packet_filter_info_parseFromJSON() failed [pack_filt_id]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *pack_filt_cont = cJSON_GetObjectItemCaseSensitive(packet_filter_infoJSON, "packFiltCont");
|
||||
|
||||
if (pack_filt_cont) {
|
||||
if (!cJSON_IsString(pack_filt_cont)) {
|
||||
ogs_error("OpenAPI_packet_filter_info_parseFromJSON() failed [pack_filt_cont]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *tos_traffic_class = cJSON_GetObjectItemCaseSensitive(packet_filter_infoJSON, "tosTrafficClass");
|
||||
|
||||
if (tos_traffic_class) {
|
||||
if (!cJSON_IsString(tos_traffic_class)) {
|
||||
ogs_error("OpenAPI_packet_filter_info_parseFromJSON() failed [tos_traffic_class]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *spi = cJSON_GetObjectItemCaseSensitive(packet_filter_infoJSON, "spi");
|
||||
|
||||
if (spi) {
|
||||
if (!cJSON_IsString(spi)) {
|
||||
ogs_error("OpenAPI_packet_filter_info_parseFromJSON() failed [spi]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *flow_label = cJSON_GetObjectItemCaseSensitive(packet_filter_infoJSON, "flowLabel");
|
||||
|
||||
if (flow_label) {
|
||||
if (!cJSON_IsString(flow_label)) {
|
||||
ogs_error("OpenAPI_packet_filter_info_parseFromJSON() failed [flow_label]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *flow_direction = cJSON_GetObjectItemCaseSensitive(packet_filter_infoJSON, "flowDirection");
|
||||
|
||||
OpenAPI_flow_direction_t *flow_direction_local_nonprim = NULL;
|
||||
if (flow_direction) {
|
||||
flow_direction_local_nonprim = OpenAPI_flow_direction_parseFromJSON(flow_direction);
|
||||
}
|
||||
|
||||
packet_filter_info_local_var = OpenAPI_packet_filter_info_create (
|
||||
pack_filt_id ? ogs_strdup(pack_filt_id->valuestring) : NULL,
|
||||
pack_filt_cont ? ogs_strdup(pack_filt_cont->valuestring) : NULL,
|
||||
tos_traffic_class ? ogs_strdup(tos_traffic_class->valuestring) : NULL,
|
||||
spi ? ogs_strdup(spi->valuestring) : NULL,
|
||||
flow_label ? ogs_strdup(flow_label->valuestring) : NULL,
|
||||
flow_direction ? flow_direction_local_nonprim : NULL
|
||||
);
|
||||
|
||||
return packet_filter_info_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_packet_filter_info_t *OpenAPI_packet_filter_info_copy(OpenAPI_packet_filter_info_t *dst, OpenAPI_packet_filter_info_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_packet_filter_info_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_packet_filter_info_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_packet_filter_info_free(dst);
|
||||
dst = OpenAPI_packet_filter_info_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
49
lib/sbi/openapi/model/packet_filter_info.h
Normal file
49
lib/sbi/openapi/model/packet_filter_info.h
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* packet_filter_info.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_packet_filter_info_H_
|
||||
#define _OpenAPI_packet_filter_info_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
#include "flow_direction.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_packet_filter_info_s OpenAPI_packet_filter_info_t;
|
||||
typedef struct OpenAPI_packet_filter_info_s {
|
||||
char *pack_filt_id;
|
||||
char *pack_filt_cont;
|
||||
char *tos_traffic_class;
|
||||
char *spi;
|
||||
char *flow_label;
|
||||
struct OpenAPI_flow_direction_s *flow_direction;
|
||||
} OpenAPI_packet_filter_info_t;
|
||||
|
||||
OpenAPI_packet_filter_info_t *OpenAPI_packet_filter_info_create(
|
||||
char *pack_filt_id,
|
||||
char *pack_filt_cont,
|
||||
char *tos_traffic_class,
|
||||
char *spi,
|
||||
char *flow_label,
|
||||
OpenAPI_flow_direction_t *flow_direction
|
||||
);
|
||||
void OpenAPI_packet_filter_info_free(OpenAPI_packet_filter_info_t *packet_filter_info);
|
||||
OpenAPI_packet_filter_info_t *OpenAPI_packet_filter_info_parseFromJSON(cJSON *packet_filter_infoJSON);
|
||||
cJSON *OpenAPI_packet_filter_info_convertToJSON(OpenAPI_packet_filter_info_t *packet_filter_info);
|
||||
OpenAPI_packet_filter_info_t *OpenAPI_packet_filter_info_copy(OpenAPI_packet_filter_info_t *dst, OpenAPI_packet_filter_info_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_packet_filter_info_H_ */
|
||||
|
||||
238
lib/sbi/openapi/model/partial_success_report.c
Normal file
238
lib/sbi/openapi/model/partial_success_report.c
Normal file
|
|
@ -0,0 +1,238 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "partial_success_report.h"
|
||||
|
||||
OpenAPI_partial_success_report_t *OpenAPI_partial_success_report_create(
|
||||
OpenAPI_failure_cause_t *failure_cause,
|
||||
OpenAPI_list_t *rule_reports,
|
||||
OpenAPI_list_t *sess_rule_reports,
|
||||
OpenAPI_ue_camping_rep_t *ue_camping_rep
|
||||
)
|
||||
{
|
||||
OpenAPI_partial_success_report_t *partial_success_report_local_var = OpenAPI_malloc(sizeof(OpenAPI_partial_success_report_t));
|
||||
if (!partial_success_report_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
partial_success_report_local_var->failure_cause = failure_cause;
|
||||
partial_success_report_local_var->rule_reports = rule_reports;
|
||||
partial_success_report_local_var->sess_rule_reports = sess_rule_reports;
|
||||
partial_success_report_local_var->ue_camping_rep = ue_camping_rep;
|
||||
|
||||
return partial_success_report_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_partial_success_report_free(OpenAPI_partial_success_report_t *partial_success_report)
|
||||
{
|
||||
if (NULL == partial_success_report) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_failure_cause_free(partial_success_report->failure_cause);
|
||||
OpenAPI_list_for_each(partial_success_report->rule_reports, node) {
|
||||
OpenAPI_rule_report_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(partial_success_report->rule_reports);
|
||||
OpenAPI_list_for_each(partial_success_report->sess_rule_reports, node) {
|
||||
OpenAPI_session_rule_report_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(partial_success_report->sess_rule_reports);
|
||||
OpenAPI_ue_camping_rep_free(partial_success_report->ue_camping_rep);
|
||||
ogs_free(partial_success_report);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_partial_success_report_convertToJSON(OpenAPI_partial_success_report_t *partial_success_report)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (partial_success_report == NULL) {
|
||||
ogs_error("OpenAPI_partial_success_report_convertToJSON() failed [PartialSuccessReport]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (!partial_success_report->failure_cause) {
|
||||
ogs_error("OpenAPI_partial_success_report_convertToJSON() failed [failure_cause]");
|
||||
goto end;
|
||||
}
|
||||
cJSON *failure_cause_local_JSON = OpenAPI_failure_cause_convertToJSON(partial_success_report->failure_cause);
|
||||
if (failure_cause_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_partial_success_report_convertToJSON() failed [failure_cause]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "failureCause", failure_cause_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_partial_success_report_convertToJSON() failed [failure_cause]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (partial_success_report->rule_reports) {
|
||||
cJSON *rule_reportsList = cJSON_AddArrayToObject(item, "ruleReports");
|
||||
if (rule_reportsList == NULL) {
|
||||
ogs_error("OpenAPI_partial_success_report_convertToJSON() failed [rule_reports]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *rule_reports_node;
|
||||
if (partial_success_report->rule_reports) {
|
||||
OpenAPI_list_for_each(partial_success_report->rule_reports, rule_reports_node) {
|
||||
cJSON *itemLocal = OpenAPI_rule_report_convertToJSON(rule_reports_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_partial_success_report_convertToJSON() failed [rule_reports]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(rule_reportsList, itemLocal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (partial_success_report->sess_rule_reports) {
|
||||
cJSON *sess_rule_reportsList = cJSON_AddArrayToObject(item, "sessRuleReports");
|
||||
if (sess_rule_reportsList == NULL) {
|
||||
ogs_error("OpenAPI_partial_success_report_convertToJSON() failed [sess_rule_reports]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *sess_rule_reports_node;
|
||||
if (partial_success_report->sess_rule_reports) {
|
||||
OpenAPI_list_for_each(partial_success_report->sess_rule_reports, sess_rule_reports_node) {
|
||||
cJSON *itemLocal = OpenAPI_session_rule_report_convertToJSON(sess_rule_reports_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_partial_success_report_convertToJSON() failed [sess_rule_reports]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(sess_rule_reportsList, itemLocal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (partial_success_report->ue_camping_rep) {
|
||||
cJSON *ue_camping_rep_local_JSON = OpenAPI_ue_camping_rep_convertToJSON(partial_success_report->ue_camping_rep);
|
||||
if (ue_camping_rep_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_partial_success_report_convertToJSON() failed [ue_camping_rep]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "ueCampingRep", ue_camping_rep_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_partial_success_report_convertToJSON() failed [ue_camping_rep]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_partial_success_report_t *OpenAPI_partial_success_report_parseFromJSON(cJSON *partial_success_reportJSON)
|
||||
{
|
||||
OpenAPI_partial_success_report_t *partial_success_report_local_var = NULL;
|
||||
cJSON *failure_cause = cJSON_GetObjectItemCaseSensitive(partial_success_reportJSON, "failureCause");
|
||||
if (!failure_cause) {
|
||||
ogs_error("OpenAPI_partial_success_report_parseFromJSON() failed [failure_cause]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_failure_cause_t *failure_cause_local_nonprim = NULL;
|
||||
|
||||
failure_cause_local_nonprim = OpenAPI_failure_cause_parseFromJSON(failure_cause);
|
||||
|
||||
cJSON *rule_reports = cJSON_GetObjectItemCaseSensitive(partial_success_reportJSON, "ruleReports");
|
||||
|
||||
OpenAPI_list_t *rule_reportsList;
|
||||
if (rule_reports) {
|
||||
cJSON *rule_reports_local_nonprimitive;
|
||||
if (!cJSON_IsArray(rule_reports)) {
|
||||
ogs_error("OpenAPI_partial_success_report_parseFromJSON() failed [rule_reports]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
rule_reportsList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(rule_reports_local_nonprimitive, rule_reports ) {
|
||||
if (!cJSON_IsObject(rule_reports_local_nonprimitive)) {
|
||||
ogs_error("OpenAPI_partial_success_report_parseFromJSON() failed [rule_reports]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_rule_report_t *rule_reportsItem = OpenAPI_rule_report_parseFromJSON(rule_reports_local_nonprimitive);
|
||||
|
||||
OpenAPI_list_add(rule_reportsList, rule_reportsItem);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *sess_rule_reports = cJSON_GetObjectItemCaseSensitive(partial_success_reportJSON, "sessRuleReports");
|
||||
|
||||
OpenAPI_list_t *sess_rule_reportsList;
|
||||
if (sess_rule_reports) {
|
||||
cJSON *sess_rule_reports_local_nonprimitive;
|
||||
if (!cJSON_IsArray(sess_rule_reports)) {
|
||||
ogs_error("OpenAPI_partial_success_report_parseFromJSON() failed [sess_rule_reports]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
sess_rule_reportsList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(sess_rule_reports_local_nonprimitive, sess_rule_reports ) {
|
||||
if (!cJSON_IsObject(sess_rule_reports_local_nonprimitive)) {
|
||||
ogs_error("OpenAPI_partial_success_report_parseFromJSON() failed [sess_rule_reports]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_session_rule_report_t *sess_rule_reportsItem = OpenAPI_session_rule_report_parseFromJSON(sess_rule_reports_local_nonprimitive);
|
||||
|
||||
OpenAPI_list_add(sess_rule_reportsList, sess_rule_reportsItem);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *ue_camping_rep = cJSON_GetObjectItemCaseSensitive(partial_success_reportJSON, "ueCampingRep");
|
||||
|
||||
OpenAPI_ue_camping_rep_t *ue_camping_rep_local_nonprim = NULL;
|
||||
if (ue_camping_rep) {
|
||||
ue_camping_rep_local_nonprim = OpenAPI_ue_camping_rep_parseFromJSON(ue_camping_rep);
|
||||
}
|
||||
|
||||
partial_success_report_local_var = OpenAPI_partial_success_report_create (
|
||||
failure_cause_local_nonprim,
|
||||
rule_reports ? rule_reportsList : NULL,
|
||||
sess_rule_reports ? sess_rule_reportsList : NULL,
|
||||
ue_camping_rep ? ue_camping_rep_local_nonprim : NULL
|
||||
);
|
||||
|
||||
return partial_success_report_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_partial_success_report_t *OpenAPI_partial_success_report_copy(OpenAPI_partial_success_report_t *dst, OpenAPI_partial_success_report_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_partial_success_report_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_partial_success_report_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_partial_success_report_free(dst);
|
||||
dst = OpenAPI_partial_success_report_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
48
lib/sbi/openapi/model/partial_success_report.h
Normal file
48
lib/sbi/openapi/model/partial_success_report.h
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* partial_success_report.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_partial_success_report_H_
|
||||
#define _OpenAPI_partial_success_report_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
#include "failure_cause.h"
|
||||
#include "rule_report.h"
|
||||
#include "session_rule_report.h"
|
||||
#include "ue_camping_rep.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_partial_success_report_s OpenAPI_partial_success_report_t;
|
||||
typedef struct OpenAPI_partial_success_report_s {
|
||||
struct OpenAPI_failure_cause_s *failure_cause;
|
||||
OpenAPI_list_t *rule_reports;
|
||||
OpenAPI_list_t *sess_rule_reports;
|
||||
struct OpenAPI_ue_camping_rep_s *ue_camping_rep;
|
||||
} OpenAPI_partial_success_report_t;
|
||||
|
||||
OpenAPI_partial_success_report_t *OpenAPI_partial_success_report_create(
|
||||
OpenAPI_failure_cause_t *failure_cause,
|
||||
OpenAPI_list_t *rule_reports,
|
||||
OpenAPI_list_t *sess_rule_reports,
|
||||
OpenAPI_ue_camping_rep_t *ue_camping_rep
|
||||
);
|
||||
void OpenAPI_partial_success_report_free(OpenAPI_partial_success_report_t *partial_success_report);
|
||||
OpenAPI_partial_success_report_t *OpenAPI_partial_success_report_parseFromJSON(cJSON *partial_success_reportJSON);
|
||||
cJSON *OpenAPI_partial_success_report_convertToJSON(OpenAPI_partial_success_report_t *partial_success_report);
|
||||
OpenAPI_partial_success_report_t *OpenAPI_partial_success_report_copy(OpenAPI_partial_success_report_t *dst, OpenAPI_partial_success_report_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_partial_success_report_H_ */
|
||||
|
||||
692
lib/sbi/openapi/model/pcc_rule.c
Normal file
692
lib/sbi/openapi/model/pcc_rule.c
Normal file
|
|
@ -0,0 +1,692 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "pcc_rule.h"
|
||||
|
||||
OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_create(
|
||||
OpenAPI_list_t *flow_infos,
|
||||
char *app_id,
|
||||
int cont_ver,
|
||||
char *pcc_rule_id,
|
||||
int precedence,
|
||||
OpenAPI_af_sig_protocol_t *af_sig_protocol,
|
||||
int app_reloc,
|
||||
OpenAPI_list_t *ref_qos_data,
|
||||
OpenAPI_list_t *ref_alt_qos_params,
|
||||
OpenAPI_list_t *ref_tc_data,
|
||||
OpenAPI_list_t *ref_chg_data,
|
||||
OpenAPI_list_t *ref_chg_n3g_data,
|
||||
OpenAPI_list_t *ref_um_data,
|
||||
OpenAPI_list_t *ref_um_n3g_data,
|
||||
char *ref_cond_data,
|
||||
OpenAPI_list_t *ref_qos_mon,
|
||||
int addr_preser_ind,
|
||||
OpenAPI_tscai_input_container_t *tscai_input_dl,
|
||||
OpenAPI_tscai_input_container_t *tscai_input_ul
|
||||
)
|
||||
{
|
||||
OpenAPI_pcc_rule_t *pcc_rule_local_var = OpenAPI_malloc(sizeof(OpenAPI_pcc_rule_t));
|
||||
if (!pcc_rule_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
pcc_rule_local_var->flow_infos = flow_infos;
|
||||
pcc_rule_local_var->app_id = app_id;
|
||||
pcc_rule_local_var->cont_ver = cont_ver;
|
||||
pcc_rule_local_var->pcc_rule_id = pcc_rule_id;
|
||||
pcc_rule_local_var->precedence = precedence;
|
||||
pcc_rule_local_var->af_sig_protocol = af_sig_protocol;
|
||||
pcc_rule_local_var->app_reloc = app_reloc;
|
||||
pcc_rule_local_var->ref_qos_data = ref_qos_data;
|
||||
pcc_rule_local_var->ref_alt_qos_params = ref_alt_qos_params;
|
||||
pcc_rule_local_var->ref_tc_data = ref_tc_data;
|
||||
pcc_rule_local_var->ref_chg_data = ref_chg_data;
|
||||
pcc_rule_local_var->ref_chg_n3g_data = ref_chg_n3g_data;
|
||||
pcc_rule_local_var->ref_um_data = ref_um_data;
|
||||
pcc_rule_local_var->ref_um_n3g_data = ref_um_n3g_data;
|
||||
pcc_rule_local_var->ref_cond_data = ref_cond_data;
|
||||
pcc_rule_local_var->ref_qos_mon = ref_qos_mon;
|
||||
pcc_rule_local_var->addr_preser_ind = addr_preser_ind;
|
||||
pcc_rule_local_var->tscai_input_dl = tscai_input_dl;
|
||||
pcc_rule_local_var->tscai_input_ul = tscai_input_ul;
|
||||
|
||||
return pcc_rule_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_pcc_rule_free(OpenAPI_pcc_rule_t *pcc_rule)
|
||||
{
|
||||
if (NULL == pcc_rule) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_list_for_each(pcc_rule->flow_infos, node) {
|
||||
OpenAPI_flow_information_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(pcc_rule->flow_infos);
|
||||
ogs_free(pcc_rule->app_id);
|
||||
ogs_free(pcc_rule->pcc_rule_id);
|
||||
OpenAPI_af_sig_protocol_free(pcc_rule->af_sig_protocol);
|
||||
OpenAPI_list_for_each(pcc_rule->ref_qos_data, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(pcc_rule->ref_qos_data);
|
||||
OpenAPI_list_for_each(pcc_rule->ref_alt_qos_params, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(pcc_rule->ref_alt_qos_params);
|
||||
OpenAPI_list_for_each(pcc_rule->ref_tc_data, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(pcc_rule->ref_tc_data);
|
||||
OpenAPI_list_for_each(pcc_rule->ref_chg_data, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(pcc_rule->ref_chg_data);
|
||||
OpenAPI_list_for_each(pcc_rule->ref_chg_n3g_data, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(pcc_rule->ref_chg_n3g_data);
|
||||
OpenAPI_list_for_each(pcc_rule->ref_um_data, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(pcc_rule->ref_um_data);
|
||||
OpenAPI_list_for_each(pcc_rule->ref_um_n3g_data, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(pcc_rule->ref_um_n3g_data);
|
||||
ogs_free(pcc_rule->ref_cond_data);
|
||||
OpenAPI_list_for_each(pcc_rule->ref_qos_mon, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(pcc_rule->ref_qos_mon);
|
||||
OpenAPI_tscai_input_container_free(pcc_rule->tscai_input_dl);
|
||||
OpenAPI_tscai_input_container_free(pcc_rule->tscai_input_ul);
|
||||
ogs_free(pcc_rule);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_pcc_rule_convertToJSON(OpenAPI_pcc_rule_t *pcc_rule)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (pcc_rule == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [PccRule]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (pcc_rule->flow_infos) {
|
||||
cJSON *flow_infosList = cJSON_AddArrayToObject(item, "flowInfos");
|
||||
if (flow_infosList == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [flow_infos]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *flow_infos_node;
|
||||
if (pcc_rule->flow_infos) {
|
||||
OpenAPI_list_for_each(pcc_rule->flow_infos, flow_infos_node) {
|
||||
cJSON *itemLocal = OpenAPI_flow_information_convertToJSON(flow_infos_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [flow_infos]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(flow_infosList, itemLocal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pcc_rule->app_id) {
|
||||
if (cJSON_AddStringToObject(item, "appId", pcc_rule->app_id) == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [app_id]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (pcc_rule->cont_ver) {
|
||||
if (cJSON_AddNumberToObject(item, "contVer", pcc_rule->cont_ver) == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [cont_ver]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (!pcc_rule->pcc_rule_id) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [pcc_rule_id]");
|
||||
goto end;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "pccRuleId", pcc_rule->pcc_rule_id) == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [pcc_rule_id]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (pcc_rule->precedence) {
|
||||
if (cJSON_AddNumberToObject(item, "precedence", pcc_rule->precedence) == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [precedence]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (pcc_rule->af_sig_protocol) {
|
||||
cJSON *af_sig_protocol_local_JSON = OpenAPI_af_sig_protocol_convertToJSON(pcc_rule->af_sig_protocol);
|
||||
if (af_sig_protocol_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [af_sig_protocol]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "afSigProtocol", af_sig_protocol_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [af_sig_protocol]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (pcc_rule->app_reloc) {
|
||||
if (cJSON_AddBoolToObject(item, "appReloc", pcc_rule->app_reloc) == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [app_reloc]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (pcc_rule->ref_qos_data) {
|
||||
cJSON *ref_qos_data = cJSON_AddArrayToObject(item, "refQosData");
|
||||
if (ref_qos_data == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_qos_data]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *ref_qos_data_node;
|
||||
OpenAPI_list_for_each(pcc_rule->ref_qos_data, ref_qos_data_node) {
|
||||
if (cJSON_AddStringToObject(ref_qos_data, "", (char*)ref_qos_data_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_qos_data]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pcc_rule->ref_alt_qos_params) {
|
||||
cJSON *ref_alt_qos_params = cJSON_AddArrayToObject(item, "refAltQosParams");
|
||||
if (ref_alt_qos_params == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_alt_qos_params]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *ref_alt_qos_params_node;
|
||||
OpenAPI_list_for_each(pcc_rule->ref_alt_qos_params, ref_alt_qos_params_node) {
|
||||
if (cJSON_AddStringToObject(ref_alt_qos_params, "", (char*)ref_alt_qos_params_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_alt_qos_params]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pcc_rule->ref_tc_data) {
|
||||
cJSON *ref_tc_data = cJSON_AddArrayToObject(item, "refTcData");
|
||||
if (ref_tc_data == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_tc_data]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *ref_tc_data_node;
|
||||
OpenAPI_list_for_each(pcc_rule->ref_tc_data, ref_tc_data_node) {
|
||||
if (cJSON_AddStringToObject(ref_tc_data, "", (char*)ref_tc_data_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_tc_data]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pcc_rule->ref_chg_data) {
|
||||
cJSON *ref_chg_data = cJSON_AddArrayToObject(item, "refChgData");
|
||||
if (ref_chg_data == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_chg_data]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *ref_chg_data_node;
|
||||
OpenAPI_list_for_each(pcc_rule->ref_chg_data, ref_chg_data_node) {
|
||||
if (cJSON_AddStringToObject(ref_chg_data, "", (char*)ref_chg_data_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_chg_data]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pcc_rule->ref_chg_n3g_data) {
|
||||
cJSON *ref_chg_n3g_data = cJSON_AddArrayToObject(item, "refChgN3gData");
|
||||
if (ref_chg_n3g_data == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_chg_n3g_data]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *ref_chg_n3g_data_node;
|
||||
OpenAPI_list_for_each(pcc_rule->ref_chg_n3g_data, ref_chg_n3g_data_node) {
|
||||
if (cJSON_AddStringToObject(ref_chg_n3g_data, "", (char*)ref_chg_n3g_data_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_chg_n3g_data]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pcc_rule->ref_um_data) {
|
||||
cJSON *ref_um_data = cJSON_AddArrayToObject(item, "refUmData");
|
||||
if (ref_um_data == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_um_data]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *ref_um_data_node;
|
||||
OpenAPI_list_for_each(pcc_rule->ref_um_data, ref_um_data_node) {
|
||||
if (cJSON_AddStringToObject(ref_um_data, "", (char*)ref_um_data_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_um_data]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pcc_rule->ref_um_n3g_data) {
|
||||
cJSON *ref_um_n3g_data = cJSON_AddArrayToObject(item, "refUmN3gData");
|
||||
if (ref_um_n3g_data == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_um_n3g_data]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *ref_um_n3g_data_node;
|
||||
OpenAPI_list_for_each(pcc_rule->ref_um_n3g_data, ref_um_n3g_data_node) {
|
||||
if (cJSON_AddStringToObject(ref_um_n3g_data, "", (char*)ref_um_n3g_data_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_um_n3g_data]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pcc_rule->ref_cond_data) {
|
||||
if (cJSON_AddStringToObject(item, "refCondData", pcc_rule->ref_cond_data) == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_cond_data]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (pcc_rule->ref_qos_mon) {
|
||||
cJSON *ref_qos_mon = cJSON_AddArrayToObject(item, "refQosMon");
|
||||
if (ref_qos_mon == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_qos_mon]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *ref_qos_mon_node;
|
||||
OpenAPI_list_for_each(pcc_rule->ref_qos_mon, ref_qos_mon_node) {
|
||||
if (cJSON_AddStringToObject(ref_qos_mon, "", (char*)ref_qos_mon_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_qos_mon]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pcc_rule->addr_preser_ind) {
|
||||
if (cJSON_AddBoolToObject(item, "addrPreserInd", pcc_rule->addr_preser_ind) == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [addr_preser_ind]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (pcc_rule->tscai_input_dl) {
|
||||
cJSON *tscai_input_dl_local_JSON = OpenAPI_tscai_input_container_convertToJSON(pcc_rule->tscai_input_dl);
|
||||
if (tscai_input_dl_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [tscai_input_dl]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "tscaiInputDl", tscai_input_dl_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [tscai_input_dl]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (pcc_rule->tscai_input_ul) {
|
||||
cJSON *tscai_input_ul_local_JSON = OpenAPI_tscai_input_container_convertToJSON(pcc_rule->tscai_input_ul);
|
||||
if (tscai_input_ul_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [tscai_input_ul]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "tscaiInputUl", tscai_input_ul_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [tscai_input_ul]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_parseFromJSON(cJSON *pcc_ruleJSON)
|
||||
{
|
||||
OpenAPI_pcc_rule_t *pcc_rule_local_var = NULL;
|
||||
cJSON *flow_infos = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "flowInfos");
|
||||
|
||||
OpenAPI_list_t *flow_infosList;
|
||||
if (flow_infos) {
|
||||
cJSON *flow_infos_local_nonprimitive;
|
||||
if (!cJSON_IsArray(flow_infos)) {
|
||||
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [flow_infos]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
flow_infosList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(flow_infos_local_nonprimitive, flow_infos ) {
|
||||
if (!cJSON_IsObject(flow_infos_local_nonprimitive)) {
|
||||
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [flow_infos]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_flow_information_t *flow_infosItem = OpenAPI_flow_information_parseFromJSON(flow_infos_local_nonprimitive);
|
||||
|
||||
OpenAPI_list_add(flow_infosList, flow_infosItem);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *app_id = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "appId");
|
||||
|
||||
if (app_id) {
|
||||
if (!cJSON_IsString(app_id)) {
|
||||
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [app_id]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *cont_ver = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "contVer");
|
||||
|
||||
if (cont_ver) {
|
||||
if (!cJSON_IsNumber(cont_ver)) {
|
||||
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [cont_ver]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *pcc_rule_id = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "pccRuleId");
|
||||
if (!pcc_rule_id) {
|
||||
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [pcc_rule_id]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
if (!cJSON_IsString(pcc_rule_id)) {
|
||||
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [pcc_rule_id]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *precedence = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "precedence");
|
||||
|
||||
if (precedence) {
|
||||
if (!cJSON_IsNumber(precedence)) {
|
||||
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [precedence]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *af_sig_protocol = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "afSigProtocol");
|
||||
|
||||
OpenAPI_af_sig_protocol_t *af_sig_protocol_local_nonprim = NULL;
|
||||
if (af_sig_protocol) {
|
||||
af_sig_protocol_local_nonprim = OpenAPI_af_sig_protocol_parseFromJSON(af_sig_protocol);
|
||||
}
|
||||
|
||||
cJSON *app_reloc = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "appReloc");
|
||||
|
||||
if (app_reloc) {
|
||||
if (!cJSON_IsBool(app_reloc)) {
|
||||
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [app_reloc]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *ref_qos_data = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "refQosData");
|
||||
|
||||
OpenAPI_list_t *ref_qos_dataList;
|
||||
if (ref_qos_data) {
|
||||
cJSON *ref_qos_data_local;
|
||||
if (!cJSON_IsArray(ref_qos_data)) {
|
||||
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_qos_data]");
|
||||
goto end;
|
||||
}
|
||||
ref_qos_dataList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(ref_qos_data_local, ref_qos_data) {
|
||||
if (!cJSON_IsString(ref_qos_data_local)) {
|
||||
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_qos_data]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(ref_qos_dataList, ogs_strdup(ref_qos_data_local->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *ref_alt_qos_params = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "refAltQosParams");
|
||||
|
||||
OpenAPI_list_t *ref_alt_qos_paramsList;
|
||||
if (ref_alt_qos_params) {
|
||||
cJSON *ref_alt_qos_params_local;
|
||||
if (!cJSON_IsArray(ref_alt_qos_params)) {
|
||||
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_alt_qos_params]");
|
||||
goto end;
|
||||
}
|
||||
ref_alt_qos_paramsList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(ref_alt_qos_params_local, ref_alt_qos_params) {
|
||||
if (!cJSON_IsString(ref_alt_qos_params_local)) {
|
||||
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_alt_qos_params]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(ref_alt_qos_paramsList, ogs_strdup(ref_alt_qos_params_local->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *ref_tc_data = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "refTcData");
|
||||
|
||||
OpenAPI_list_t *ref_tc_dataList;
|
||||
if (ref_tc_data) {
|
||||
cJSON *ref_tc_data_local;
|
||||
if (!cJSON_IsArray(ref_tc_data)) {
|
||||
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_tc_data]");
|
||||
goto end;
|
||||
}
|
||||
ref_tc_dataList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(ref_tc_data_local, ref_tc_data) {
|
||||
if (!cJSON_IsString(ref_tc_data_local)) {
|
||||
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_tc_data]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(ref_tc_dataList, ogs_strdup(ref_tc_data_local->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *ref_chg_data = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "refChgData");
|
||||
|
||||
OpenAPI_list_t *ref_chg_dataList;
|
||||
if (ref_chg_data) {
|
||||
cJSON *ref_chg_data_local;
|
||||
if (!cJSON_IsArray(ref_chg_data)) {
|
||||
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_chg_data]");
|
||||
goto end;
|
||||
}
|
||||
ref_chg_dataList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(ref_chg_data_local, ref_chg_data) {
|
||||
if (!cJSON_IsString(ref_chg_data_local)) {
|
||||
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_chg_data]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(ref_chg_dataList, ogs_strdup(ref_chg_data_local->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *ref_chg_n3g_data = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "refChgN3gData");
|
||||
|
||||
OpenAPI_list_t *ref_chg_n3g_dataList;
|
||||
if (ref_chg_n3g_data) {
|
||||
cJSON *ref_chg_n3g_data_local;
|
||||
if (!cJSON_IsArray(ref_chg_n3g_data)) {
|
||||
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_chg_n3g_data]");
|
||||
goto end;
|
||||
}
|
||||
ref_chg_n3g_dataList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(ref_chg_n3g_data_local, ref_chg_n3g_data) {
|
||||
if (!cJSON_IsString(ref_chg_n3g_data_local)) {
|
||||
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_chg_n3g_data]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(ref_chg_n3g_dataList, ogs_strdup(ref_chg_n3g_data_local->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *ref_um_data = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "refUmData");
|
||||
|
||||
OpenAPI_list_t *ref_um_dataList;
|
||||
if (ref_um_data) {
|
||||
cJSON *ref_um_data_local;
|
||||
if (!cJSON_IsArray(ref_um_data)) {
|
||||
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_um_data]");
|
||||
goto end;
|
||||
}
|
||||
ref_um_dataList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(ref_um_data_local, ref_um_data) {
|
||||
if (!cJSON_IsString(ref_um_data_local)) {
|
||||
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_um_data]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(ref_um_dataList, ogs_strdup(ref_um_data_local->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *ref_um_n3g_data = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "refUmN3gData");
|
||||
|
||||
OpenAPI_list_t *ref_um_n3g_dataList;
|
||||
if (ref_um_n3g_data) {
|
||||
cJSON *ref_um_n3g_data_local;
|
||||
if (!cJSON_IsArray(ref_um_n3g_data)) {
|
||||
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_um_n3g_data]");
|
||||
goto end;
|
||||
}
|
||||
ref_um_n3g_dataList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(ref_um_n3g_data_local, ref_um_n3g_data) {
|
||||
if (!cJSON_IsString(ref_um_n3g_data_local)) {
|
||||
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_um_n3g_data]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(ref_um_n3g_dataList, ogs_strdup(ref_um_n3g_data_local->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *ref_cond_data = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "refCondData");
|
||||
|
||||
if (ref_cond_data) {
|
||||
if (!cJSON_IsString(ref_cond_data)) {
|
||||
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_cond_data]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *ref_qos_mon = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "refQosMon");
|
||||
|
||||
OpenAPI_list_t *ref_qos_monList;
|
||||
if (ref_qos_mon) {
|
||||
cJSON *ref_qos_mon_local;
|
||||
if (!cJSON_IsArray(ref_qos_mon)) {
|
||||
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_qos_mon]");
|
||||
goto end;
|
||||
}
|
||||
ref_qos_monList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(ref_qos_mon_local, ref_qos_mon) {
|
||||
if (!cJSON_IsString(ref_qos_mon_local)) {
|
||||
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_qos_mon]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(ref_qos_monList, ogs_strdup(ref_qos_mon_local->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *addr_preser_ind = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "addrPreserInd");
|
||||
|
||||
if (addr_preser_ind) {
|
||||
if (!cJSON_IsBool(addr_preser_ind)) {
|
||||
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [addr_preser_ind]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *tscai_input_dl = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "tscaiInputDl");
|
||||
|
||||
OpenAPI_tscai_input_container_t *tscai_input_dl_local_nonprim = NULL;
|
||||
if (tscai_input_dl) {
|
||||
tscai_input_dl_local_nonprim = OpenAPI_tscai_input_container_parseFromJSON(tscai_input_dl);
|
||||
}
|
||||
|
||||
cJSON *tscai_input_ul = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "tscaiInputUl");
|
||||
|
||||
OpenAPI_tscai_input_container_t *tscai_input_ul_local_nonprim = NULL;
|
||||
if (tscai_input_ul) {
|
||||
tscai_input_ul_local_nonprim = OpenAPI_tscai_input_container_parseFromJSON(tscai_input_ul);
|
||||
}
|
||||
|
||||
pcc_rule_local_var = OpenAPI_pcc_rule_create (
|
||||
flow_infos ? flow_infosList : NULL,
|
||||
app_id ? ogs_strdup(app_id->valuestring) : NULL,
|
||||
cont_ver ? cont_ver->valuedouble : 0,
|
||||
ogs_strdup(pcc_rule_id->valuestring),
|
||||
precedence ? precedence->valuedouble : 0,
|
||||
af_sig_protocol ? af_sig_protocol_local_nonprim : NULL,
|
||||
app_reloc ? app_reloc->valueint : 0,
|
||||
ref_qos_data ? ref_qos_dataList : NULL,
|
||||
ref_alt_qos_params ? ref_alt_qos_paramsList : NULL,
|
||||
ref_tc_data ? ref_tc_dataList : NULL,
|
||||
ref_chg_data ? ref_chg_dataList : NULL,
|
||||
ref_chg_n3g_data ? ref_chg_n3g_dataList : NULL,
|
||||
ref_um_data ? ref_um_dataList : NULL,
|
||||
ref_um_n3g_data ? ref_um_n3g_dataList : NULL,
|
||||
ref_cond_data ? ogs_strdup(ref_cond_data->valuestring) : NULL,
|
||||
ref_qos_mon ? ref_qos_monList : NULL,
|
||||
addr_preser_ind ? addr_preser_ind->valueint : 0,
|
||||
tscai_input_dl ? tscai_input_dl_local_nonprim : NULL,
|
||||
tscai_input_ul ? tscai_input_ul_local_nonprim : NULL
|
||||
);
|
||||
|
||||
return pcc_rule_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_copy(OpenAPI_pcc_rule_t *dst, OpenAPI_pcc_rule_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_pcc_rule_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_pcc_rule_free(dst);
|
||||
dst = OpenAPI_pcc_rule_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
77
lib/sbi/openapi/model/pcc_rule.h
Normal file
77
lib/sbi/openapi/model/pcc_rule.h
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* pcc_rule.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_pcc_rule_H_
|
||||
#define _OpenAPI_pcc_rule_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
#include "af_sig_protocol.h"
|
||||
#include "flow_information.h"
|
||||
#include "tscai_input_container.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_pcc_rule_s OpenAPI_pcc_rule_t;
|
||||
typedef struct OpenAPI_pcc_rule_s {
|
||||
OpenAPI_list_t *flow_infos;
|
||||
char *app_id;
|
||||
int cont_ver;
|
||||
char *pcc_rule_id;
|
||||
int precedence;
|
||||
struct OpenAPI_af_sig_protocol_s *af_sig_protocol;
|
||||
int app_reloc;
|
||||
OpenAPI_list_t *ref_qos_data;
|
||||
OpenAPI_list_t *ref_alt_qos_params;
|
||||
OpenAPI_list_t *ref_tc_data;
|
||||
OpenAPI_list_t *ref_chg_data;
|
||||
OpenAPI_list_t *ref_chg_n3g_data;
|
||||
OpenAPI_list_t *ref_um_data;
|
||||
OpenAPI_list_t *ref_um_n3g_data;
|
||||
char *ref_cond_data;
|
||||
OpenAPI_list_t *ref_qos_mon;
|
||||
int addr_preser_ind;
|
||||
struct OpenAPI_tscai_input_container_s *tscai_input_dl;
|
||||
struct OpenAPI_tscai_input_container_s *tscai_input_ul;
|
||||
} OpenAPI_pcc_rule_t;
|
||||
|
||||
OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_create(
|
||||
OpenAPI_list_t *flow_infos,
|
||||
char *app_id,
|
||||
int cont_ver,
|
||||
char *pcc_rule_id,
|
||||
int precedence,
|
||||
OpenAPI_af_sig_protocol_t *af_sig_protocol,
|
||||
int app_reloc,
|
||||
OpenAPI_list_t *ref_qos_data,
|
||||
OpenAPI_list_t *ref_alt_qos_params,
|
||||
OpenAPI_list_t *ref_tc_data,
|
||||
OpenAPI_list_t *ref_chg_data,
|
||||
OpenAPI_list_t *ref_chg_n3g_data,
|
||||
OpenAPI_list_t *ref_um_data,
|
||||
OpenAPI_list_t *ref_um_n3g_data,
|
||||
char *ref_cond_data,
|
||||
OpenAPI_list_t *ref_qos_mon,
|
||||
int addr_preser_ind,
|
||||
OpenAPI_tscai_input_container_t *tscai_input_dl,
|
||||
OpenAPI_tscai_input_container_t *tscai_input_ul
|
||||
);
|
||||
void OpenAPI_pcc_rule_free(OpenAPI_pcc_rule_t *pcc_rule);
|
||||
OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_parseFromJSON(cJSON *pcc_ruleJSON);
|
||||
cJSON *OpenAPI_pcc_rule_convertToJSON(OpenAPI_pcc_rule_t *pcc_rule);
|
||||
OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_copy(OpenAPI_pcc_rule_t *dst, OpenAPI_pcc_rule_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_pcc_rule_H_ */
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_create(
|
|||
int ma_request_ind,
|
||||
int ma_nw_upgrade_ind,
|
||||
OpenAPI_list_t *dnai_list,
|
||||
OpenAPI_presence_state_t *presence_in_ladn,
|
||||
OpenAPI_presence_state_e presence_in_ladn,
|
||||
OpenAPI_list_t *secondary_rat_usage_info,
|
||||
OpenAPI_small_data_rate_status_t *small_data_rate_status,
|
||||
OpenAPI_apn_rate_status_t *apn_rate_status,
|
||||
|
|
@ -179,7 +179,6 @@ void OpenAPI_pdu_session_create_data_free(OpenAPI_pdu_session_create_data_t *pdu
|
|||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(pdu_session_create_data->dnai_list);
|
||||
OpenAPI_presence_state_free(pdu_session_create_data->presence_in_ladn);
|
||||
OpenAPI_list_for_each(pdu_session_create_data->secondary_rat_usage_info, node) {
|
||||
OpenAPI_secondary_rat_usage_info_free(node->data);
|
||||
}
|
||||
|
|
@ -667,13 +666,7 @@ cJSON *OpenAPI_pdu_session_create_data_convertToJSON(OpenAPI_pdu_session_create_
|
|||
}
|
||||
|
||||
if (pdu_session_create_data->presence_in_ladn) {
|
||||
cJSON *presence_in_ladn_local_JSON = OpenAPI_presence_state_convertToJSON(pdu_session_create_data->presence_in_ladn);
|
||||
if (presence_in_ladn_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [presence_in_ladn]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "presenceInLadn", presence_in_ladn_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
if (cJSON_AddStringToObject(item, "presenceInLadn", OpenAPI_presence_state_ToString(pdu_session_create_data->presence_in_ladn)) == NULL) {
|
||||
ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [presence_in_ladn]");
|
||||
goto end;
|
||||
}
|
||||
|
|
@ -1237,9 +1230,13 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_parseFromJSON
|
|||
|
||||
cJSON *presence_in_ladn = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "presenceInLadn");
|
||||
|
||||
OpenAPI_presence_state_t *presence_in_ladn_local_nonprim = NULL;
|
||||
OpenAPI_presence_state_e presence_in_ladnVariable;
|
||||
if (presence_in_ladn) {
|
||||
presence_in_ladn_local_nonprim = OpenAPI_presence_state_parseFromJSON(presence_in_ladn);
|
||||
if (!cJSON_IsString(presence_in_ladn)) {
|
||||
ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [presence_in_ladn]");
|
||||
goto end;
|
||||
}
|
||||
presence_in_ladnVariable = OpenAPI_presence_state_FromString(presence_in_ladn->valuestring);
|
||||
}
|
||||
|
||||
cJSON *secondary_rat_usage_info = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "secondaryRatUsageInfo");
|
||||
|
|
@ -1342,7 +1339,7 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_parseFromJSON
|
|||
ma_request_ind ? ma_request_ind->valueint : 0,
|
||||
ma_nw_upgrade_ind ? ma_nw_upgrade_ind->valueint : 0,
|
||||
dnai_list ? dnai_listList : NULL,
|
||||
presence_in_ladn ? presence_in_ladn_local_nonprim : NULL,
|
||||
presence_in_ladn ? presence_in_ladnVariable : 0,
|
||||
secondary_rat_usage_info ? secondary_rat_usage_infoList : NULL,
|
||||
small_data_rate_status ? small_data_rate_status_local_nonprim : NULL,
|
||||
apn_rate_status ? apn_rate_status_local_nonprim : NULL,
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ typedef struct OpenAPI_pdu_session_create_data_s {
|
|||
int ma_request_ind;
|
||||
int ma_nw_upgrade_ind;
|
||||
OpenAPI_list_t *dnai_list;
|
||||
struct OpenAPI_presence_state_s *presence_in_ladn;
|
||||
OpenAPI_presence_state_e presence_in_ladn;
|
||||
OpenAPI_list_t *secondary_rat_usage_info;
|
||||
struct OpenAPI_small_data_rate_status_s *small_data_rate_status;
|
||||
struct OpenAPI_apn_rate_status_s *apn_rate_status;
|
||||
|
|
@ -149,7 +149,7 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_create(
|
|||
int ma_request_ind,
|
||||
int ma_nw_upgrade_ind,
|
||||
OpenAPI_list_t *dnai_list,
|
||||
OpenAPI_presence_state_t *presence_in_ladn,
|
||||
OpenAPI_presence_state_e presence_in_ladn,
|
||||
OpenAPI_list_t *secondary_rat_usage_info,
|
||||
OpenAPI_small_data_rate_status_t *small_data_rate_status,
|
||||
OpenAPI_apn_rate_status_t *apn_rate_status,
|
||||
|
|
|
|||
85
lib/sbi/openapi/model/pdu_session_rel_cause.c
Normal file
85
lib/sbi/openapi/model/pdu_session_rel_cause.c
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "pdu_session_rel_cause.h"
|
||||
|
||||
OpenAPI_pdu_session_rel_cause_t *OpenAPI_pdu_session_rel_cause_create(
|
||||
)
|
||||
{
|
||||
OpenAPI_pdu_session_rel_cause_t *pdu_session_rel_cause_local_var = OpenAPI_malloc(sizeof(OpenAPI_pdu_session_rel_cause_t));
|
||||
if (!pdu_session_rel_cause_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return pdu_session_rel_cause_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_pdu_session_rel_cause_free(OpenAPI_pdu_session_rel_cause_t *pdu_session_rel_cause)
|
||||
{
|
||||
if (NULL == pdu_session_rel_cause) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(pdu_session_rel_cause);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_pdu_session_rel_cause_convertToJSON(OpenAPI_pdu_session_rel_cause_t *pdu_session_rel_cause)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (pdu_session_rel_cause == NULL) {
|
||||
ogs_error("OpenAPI_pdu_session_rel_cause_convertToJSON() failed [PduSessionRelCause]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_pdu_session_rel_cause_t *OpenAPI_pdu_session_rel_cause_parseFromJSON(cJSON *pdu_session_rel_causeJSON)
|
||||
{
|
||||
OpenAPI_pdu_session_rel_cause_t *pdu_session_rel_cause_local_var = NULL;
|
||||
pdu_session_rel_cause_local_var = OpenAPI_pdu_session_rel_cause_create (
|
||||
);
|
||||
|
||||
return pdu_session_rel_cause_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_pdu_session_rel_cause_t *OpenAPI_pdu_session_rel_cause_copy(OpenAPI_pdu_session_rel_cause_t *dst, OpenAPI_pdu_session_rel_cause_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_pdu_session_rel_cause_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_pdu_session_rel_cause_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_pdu_session_rel_cause_free(dst);
|
||||
dst = OpenAPI_pdu_session_rel_cause_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
36
lib/sbi/openapi/model/pdu_session_rel_cause.h
Normal file
36
lib/sbi/openapi/model/pdu_session_rel_cause.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* pdu_session_rel_cause.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_pdu_session_rel_cause_H_
|
||||
#define _OpenAPI_pdu_session_rel_cause_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_pdu_session_rel_cause_s OpenAPI_pdu_session_rel_cause_t;
|
||||
typedef struct OpenAPI_pdu_session_rel_cause_s {
|
||||
} OpenAPI_pdu_session_rel_cause_t;
|
||||
|
||||
OpenAPI_pdu_session_rel_cause_t *OpenAPI_pdu_session_rel_cause_create(
|
||||
);
|
||||
void OpenAPI_pdu_session_rel_cause_free(OpenAPI_pdu_session_rel_cause_t *pdu_session_rel_cause);
|
||||
OpenAPI_pdu_session_rel_cause_t *OpenAPI_pdu_session_rel_cause_parseFromJSON(cJSON *pdu_session_rel_causeJSON);
|
||||
cJSON *OpenAPI_pdu_session_rel_cause_convertToJSON(OpenAPI_pdu_session_rel_cause_t *pdu_session_rel_cause);
|
||||
OpenAPI_pdu_session_rel_cause_t *OpenAPI_pdu_session_rel_cause_copy(OpenAPI_pdu_session_rel_cause_t *dst, OpenAPI_pdu_session_rel_cause_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_pdu_session_rel_cause_H_ */
|
||||
|
||||
367
lib/sbi/openapi/model/policy_association.c
Normal file
367
lib/sbi/openapi/model/policy_association.c
Normal file
|
|
@ -0,0 +1,367 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "policy_association.h"
|
||||
|
||||
OpenAPI_policy_association_t *OpenAPI_policy_association_create(
|
||||
OpenAPI_policy_association_request_t *request,
|
||||
OpenAPI_list_t *triggers,
|
||||
OpenAPI_service_area_restriction_t *serv_area_res,
|
||||
OpenAPI_wireline_service_area_restriction_t *wl_serv_area_res,
|
||||
int rfsp,
|
||||
OpenAPI_smf_selection_data_t *smf_sel_info,
|
||||
OpenAPI_ambr_t *ue_ambr,
|
||||
OpenAPI_ambr_t *rg_tmbr,
|
||||
OpenAPI_list_t* pras,
|
||||
char *supp_feat
|
||||
)
|
||||
{
|
||||
OpenAPI_policy_association_t *policy_association_local_var = OpenAPI_malloc(sizeof(OpenAPI_policy_association_t));
|
||||
if (!policy_association_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
policy_association_local_var->request = request;
|
||||
policy_association_local_var->triggers = triggers;
|
||||
policy_association_local_var->serv_area_res = serv_area_res;
|
||||
policy_association_local_var->wl_serv_area_res = wl_serv_area_res;
|
||||
policy_association_local_var->rfsp = rfsp;
|
||||
policy_association_local_var->smf_sel_info = smf_sel_info;
|
||||
policy_association_local_var->ue_ambr = ue_ambr;
|
||||
policy_association_local_var->rg_tmbr = rg_tmbr;
|
||||
policy_association_local_var->pras = pras;
|
||||
policy_association_local_var->supp_feat = supp_feat;
|
||||
|
||||
return policy_association_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_policy_association_free(OpenAPI_policy_association_t *policy_association)
|
||||
{
|
||||
if (NULL == policy_association) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_policy_association_request_free(policy_association->request);
|
||||
OpenAPI_list_free(policy_association->triggers);
|
||||
OpenAPI_service_area_restriction_free(policy_association->serv_area_res);
|
||||
OpenAPI_wireline_service_area_restriction_free(policy_association->wl_serv_area_res);
|
||||
OpenAPI_smf_selection_data_free(policy_association->smf_sel_info);
|
||||
OpenAPI_ambr_free(policy_association->ue_ambr);
|
||||
OpenAPI_ambr_free(policy_association->rg_tmbr);
|
||||
OpenAPI_list_for_each(policy_association->pras, node) {
|
||||
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
|
||||
OpenAPI_presence_info_free(localKeyValue->value);
|
||||
ogs_free(localKeyValue);
|
||||
}
|
||||
OpenAPI_list_free(policy_association->pras);
|
||||
ogs_free(policy_association->supp_feat);
|
||||
ogs_free(policy_association);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_policy_association_convertToJSON(OpenAPI_policy_association_t *policy_association)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (policy_association == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_convertToJSON() failed [PolicyAssociation]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (policy_association->request) {
|
||||
cJSON *request_local_JSON = OpenAPI_policy_association_request_convertToJSON(policy_association->request);
|
||||
if (request_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_convertToJSON() failed [request]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "request", request_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_convertToJSON() failed [request]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association->triggers) {
|
||||
cJSON *triggers = cJSON_AddArrayToObject(item, "triggers");
|
||||
if (triggers == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_convertToJSON() failed [triggers]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_lnode_t *triggers_node;
|
||||
OpenAPI_list_for_each(policy_association->triggers, triggers_node) {
|
||||
if (cJSON_AddStringToObject(triggers, "", OpenAPI_request_trigger_ToString((OpenAPI_request_trigger_e)triggers_node->data)) == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_convertToJSON() failed [triggers]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association->serv_area_res) {
|
||||
cJSON *serv_area_res_local_JSON = OpenAPI_service_area_restriction_convertToJSON(policy_association->serv_area_res);
|
||||
if (serv_area_res_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_convertToJSON() failed [serv_area_res]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "servAreaRes", serv_area_res_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_convertToJSON() failed [serv_area_res]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association->wl_serv_area_res) {
|
||||
cJSON *wl_serv_area_res_local_JSON = OpenAPI_wireline_service_area_restriction_convertToJSON(policy_association->wl_serv_area_res);
|
||||
if (wl_serv_area_res_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_convertToJSON() failed [wl_serv_area_res]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "wlServAreaRes", wl_serv_area_res_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_convertToJSON() failed [wl_serv_area_res]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association->rfsp) {
|
||||
if (cJSON_AddNumberToObject(item, "rfsp", policy_association->rfsp) == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_convertToJSON() failed [rfsp]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association->smf_sel_info) {
|
||||
cJSON *smf_sel_info_local_JSON = OpenAPI_smf_selection_data_convertToJSON(policy_association->smf_sel_info);
|
||||
if (smf_sel_info_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_convertToJSON() failed [smf_sel_info]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "smfSelInfo", smf_sel_info_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_convertToJSON() failed [smf_sel_info]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association->ue_ambr) {
|
||||
cJSON *ue_ambr_local_JSON = OpenAPI_ambr_convertToJSON(policy_association->ue_ambr);
|
||||
if (ue_ambr_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_convertToJSON() failed [ue_ambr]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "ueAmbr", ue_ambr_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_convertToJSON() failed [ue_ambr]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association->rg_tmbr) {
|
||||
cJSON *rg_tmbr_local_JSON = OpenAPI_ambr_convertToJSON(policy_association->rg_tmbr);
|
||||
if (rg_tmbr_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_convertToJSON() failed [rg_tmbr]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "rgTmbr", rg_tmbr_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_convertToJSON() failed [rg_tmbr]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association->pras) {
|
||||
cJSON *pras = cJSON_AddObjectToObject(item, "pras");
|
||||
if (pras == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_convertToJSON() failed [pras]");
|
||||
goto end;
|
||||
}
|
||||
cJSON *localMapObject = pras;
|
||||
OpenAPI_lnode_t *pras_node;
|
||||
if (policy_association->pras) {
|
||||
OpenAPI_list_for_each(policy_association->pras, pras_node) {
|
||||
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)pras_node->data;
|
||||
cJSON *itemLocal = OpenAPI_presence_info_convertToJSON(localKeyValue->value);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_convertToJSON() failed [pras]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(pras, localKeyValue->key, itemLocal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!policy_association->supp_feat) {
|
||||
ogs_error("OpenAPI_policy_association_convertToJSON() failed [supp_feat]");
|
||||
goto end;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "suppFeat", policy_association->supp_feat) == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_convertToJSON() failed [supp_feat]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_policy_association_t *OpenAPI_policy_association_parseFromJSON(cJSON *policy_associationJSON)
|
||||
{
|
||||
OpenAPI_policy_association_t *policy_association_local_var = NULL;
|
||||
cJSON *request = cJSON_GetObjectItemCaseSensitive(policy_associationJSON, "request");
|
||||
|
||||
OpenAPI_policy_association_request_t *request_local_nonprim = NULL;
|
||||
if (request) {
|
||||
request_local_nonprim = OpenAPI_policy_association_request_parseFromJSON(request);
|
||||
}
|
||||
|
||||
cJSON *triggers = cJSON_GetObjectItemCaseSensitive(policy_associationJSON, "triggers");
|
||||
|
||||
OpenAPI_list_t *triggersList;
|
||||
if (triggers) {
|
||||
cJSON *triggers_local_nonprimitive;
|
||||
if (!cJSON_IsArray(triggers)) {
|
||||
ogs_error("OpenAPI_policy_association_parseFromJSON() failed [triggers]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
triggersList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(triggers_local_nonprimitive, triggers ) {
|
||||
if (!cJSON_IsString(triggers_local_nonprimitive)) {
|
||||
ogs_error("OpenAPI_policy_association_parseFromJSON() failed [triggers]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_list_add(triggersList, (void *)OpenAPI_request_trigger_FromString(triggers_local_nonprimitive->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *serv_area_res = cJSON_GetObjectItemCaseSensitive(policy_associationJSON, "servAreaRes");
|
||||
|
||||
OpenAPI_service_area_restriction_t *serv_area_res_local_nonprim = NULL;
|
||||
if (serv_area_res) {
|
||||
serv_area_res_local_nonprim = OpenAPI_service_area_restriction_parseFromJSON(serv_area_res);
|
||||
}
|
||||
|
||||
cJSON *wl_serv_area_res = cJSON_GetObjectItemCaseSensitive(policy_associationJSON, "wlServAreaRes");
|
||||
|
||||
OpenAPI_wireline_service_area_restriction_t *wl_serv_area_res_local_nonprim = NULL;
|
||||
if (wl_serv_area_res) {
|
||||
wl_serv_area_res_local_nonprim = OpenAPI_wireline_service_area_restriction_parseFromJSON(wl_serv_area_res);
|
||||
}
|
||||
|
||||
cJSON *rfsp = cJSON_GetObjectItemCaseSensitive(policy_associationJSON, "rfsp");
|
||||
|
||||
if (rfsp) {
|
||||
if (!cJSON_IsNumber(rfsp)) {
|
||||
ogs_error("OpenAPI_policy_association_parseFromJSON() failed [rfsp]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *smf_sel_info = cJSON_GetObjectItemCaseSensitive(policy_associationJSON, "smfSelInfo");
|
||||
|
||||
OpenAPI_smf_selection_data_t *smf_sel_info_local_nonprim = NULL;
|
||||
if (smf_sel_info) {
|
||||
smf_sel_info_local_nonprim = OpenAPI_smf_selection_data_parseFromJSON(smf_sel_info);
|
||||
}
|
||||
|
||||
cJSON *ue_ambr = cJSON_GetObjectItemCaseSensitive(policy_associationJSON, "ueAmbr");
|
||||
|
||||
OpenAPI_ambr_t *ue_ambr_local_nonprim = NULL;
|
||||
if (ue_ambr) {
|
||||
ue_ambr_local_nonprim = OpenAPI_ambr_parseFromJSON(ue_ambr);
|
||||
}
|
||||
|
||||
cJSON *rg_tmbr = cJSON_GetObjectItemCaseSensitive(policy_associationJSON, "rgTmbr");
|
||||
|
||||
OpenAPI_ambr_t *rg_tmbr_local_nonprim = NULL;
|
||||
if (rg_tmbr) {
|
||||
rg_tmbr_local_nonprim = OpenAPI_ambr_parseFromJSON(rg_tmbr);
|
||||
}
|
||||
|
||||
cJSON *pras = cJSON_GetObjectItemCaseSensitive(policy_associationJSON, "pras");
|
||||
|
||||
OpenAPI_list_t *prasList;
|
||||
if (pras) {
|
||||
cJSON *pras_local_map;
|
||||
if (!cJSON_IsObject(pras)) {
|
||||
ogs_error("OpenAPI_policy_association_parseFromJSON() failed [pras]");
|
||||
goto end;
|
||||
}
|
||||
prasList = OpenAPI_list_create();
|
||||
OpenAPI_map_t *localMapKeyPair = NULL;
|
||||
cJSON_ArrayForEach(pras_local_map, pras) {
|
||||
cJSON *localMapObject = pras_local_map;
|
||||
if (!cJSON_IsObject(pras_local_map)) {
|
||||
ogs_error("OpenAPI_policy_association_parseFromJSON() failed [pras]");
|
||||
goto end;
|
||||
}
|
||||
localMapKeyPair = OpenAPI_map_create(
|
||||
localMapObject->string, OpenAPI_presence_info_parseFromJSON(localMapObject));
|
||||
OpenAPI_list_add(prasList, localMapKeyPair);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *supp_feat = cJSON_GetObjectItemCaseSensitive(policy_associationJSON, "suppFeat");
|
||||
if (!supp_feat) {
|
||||
ogs_error("OpenAPI_policy_association_parseFromJSON() failed [supp_feat]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
if (!cJSON_IsString(supp_feat)) {
|
||||
ogs_error("OpenAPI_policy_association_parseFromJSON() failed [supp_feat]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
policy_association_local_var = OpenAPI_policy_association_create (
|
||||
request ? request_local_nonprim : NULL,
|
||||
triggers ? triggersList : NULL,
|
||||
serv_area_res ? serv_area_res_local_nonprim : NULL,
|
||||
wl_serv_area_res ? wl_serv_area_res_local_nonprim : NULL,
|
||||
rfsp ? rfsp->valuedouble : 0,
|
||||
smf_sel_info ? smf_sel_info_local_nonprim : NULL,
|
||||
ue_ambr ? ue_ambr_local_nonprim : NULL,
|
||||
rg_tmbr ? rg_tmbr_local_nonprim : NULL,
|
||||
pras ? prasList : NULL,
|
||||
ogs_strdup(supp_feat->valuestring)
|
||||
);
|
||||
|
||||
return policy_association_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_policy_association_t *OpenAPI_policy_association_copy(OpenAPI_policy_association_t *dst, OpenAPI_policy_association_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_policy_association_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_policy_association_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_policy_association_free(dst);
|
||||
dst = OpenAPI_policy_association_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
63
lib/sbi/openapi/model/policy_association.h
Normal file
63
lib/sbi/openapi/model/policy_association.h
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* policy_association.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_policy_association_H_
|
||||
#define _OpenAPI_policy_association_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
#include "ambr.h"
|
||||
#include "policy_association_request.h"
|
||||
#include "presence_info.h"
|
||||
#include "request_trigger.h"
|
||||
#include "service_area_restriction.h"
|
||||
#include "smf_selection_data.h"
|
||||
#include "wireline_service_area_restriction.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_policy_association_s OpenAPI_policy_association_t;
|
||||
typedef struct OpenAPI_policy_association_s {
|
||||
struct OpenAPI_policy_association_request_s *request;
|
||||
OpenAPI_list_t *triggers;
|
||||
struct OpenAPI_service_area_restriction_s *serv_area_res;
|
||||
struct OpenAPI_wireline_service_area_restriction_s *wl_serv_area_res;
|
||||
int rfsp;
|
||||
struct OpenAPI_smf_selection_data_s *smf_sel_info;
|
||||
struct OpenAPI_ambr_s *ue_ambr;
|
||||
struct OpenAPI_ambr_s *rg_tmbr;
|
||||
OpenAPI_list_t* pras;
|
||||
char *supp_feat;
|
||||
} OpenAPI_policy_association_t;
|
||||
|
||||
OpenAPI_policy_association_t *OpenAPI_policy_association_create(
|
||||
OpenAPI_policy_association_request_t *request,
|
||||
OpenAPI_list_t *triggers,
|
||||
OpenAPI_service_area_restriction_t *serv_area_res,
|
||||
OpenAPI_wireline_service_area_restriction_t *wl_serv_area_res,
|
||||
int rfsp,
|
||||
OpenAPI_smf_selection_data_t *smf_sel_info,
|
||||
OpenAPI_ambr_t *ue_ambr,
|
||||
OpenAPI_ambr_t *rg_tmbr,
|
||||
OpenAPI_list_t* pras,
|
||||
char *supp_feat
|
||||
);
|
||||
void OpenAPI_policy_association_free(OpenAPI_policy_association_t *policy_association);
|
||||
OpenAPI_policy_association_t *OpenAPI_policy_association_parseFromJSON(cJSON *policy_associationJSON);
|
||||
cJSON *OpenAPI_policy_association_convertToJSON(OpenAPI_policy_association_t *policy_association);
|
||||
OpenAPI_policy_association_t *OpenAPI_policy_association_copy(OpenAPI_policy_association_t *dst, OpenAPI_policy_association_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_policy_association_H_ */
|
||||
|
||||
30
lib/sbi/openapi/model/policy_association_release_cause.c
Normal file
30
lib/sbi/openapi/model/policy_association_release_cause.c
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "policy_association_release_cause.h"
|
||||
|
||||
char* OpenAPI_policy_association_release_cause_ToString(OpenAPI_policy_association_release_cause_e policy_association_release_cause)
|
||||
{
|
||||
const char *policy_association_release_causeArray[] = { "NULL", "UNSPECIFIED", "UE_SUBSCRIPTION", "INSUFFICIENT_RES" };
|
||||
size_t sizeofArray = sizeof(policy_association_release_causeArray) / sizeof(policy_association_release_causeArray[0]);
|
||||
if (policy_association_release_cause < sizeofArray)
|
||||
return (char *)policy_association_release_causeArray[policy_association_release_cause];
|
||||
else
|
||||
return (char *)"Unknown";
|
||||
}
|
||||
|
||||
OpenAPI_policy_association_release_cause_e OpenAPI_policy_association_release_cause_FromString(char* policy_association_release_cause)
|
||||
{
|
||||
int stringToReturn = 0;
|
||||
const char *policy_association_release_causeArray[] = { "NULL", "UNSPECIFIED", "UE_SUBSCRIPTION", "INSUFFICIENT_RES" };
|
||||
size_t sizeofArray = sizeof(policy_association_release_causeArray) / sizeof(policy_association_release_causeArray[0]);
|
||||
while (stringToReturn < sizeofArray) {
|
||||
if (strcmp(policy_association_release_cause, policy_association_release_causeArray[stringToReturn]) == 0) {
|
||||
return stringToReturn;
|
||||
}
|
||||
stringToReturn++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
31
lib/sbi/openapi/model/policy_association_release_cause.h
Normal file
31
lib/sbi/openapi/model/policy_association_release_cause.h
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* policy_association_release_cause.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_policy_association_release_cause_H_
|
||||
#define _OpenAPI_policy_association_release_cause_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum { OpenAPI_policy_association_release_cause_NULL = 0, OpenAPI_policy_association_release_cause_UNSPECIFIED, OpenAPI_policy_association_release_cause_UE_SUBSCRIPTION, OpenAPI_policy_association_release_cause_INSUFFICIENT_RES } OpenAPI_policy_association_release_cause_e;
|
||||
|
||||
char* OpenAPI_policy_association_release_cause_ToString(OpenAPI_policy_association_release_cause_e policy_association_release_cause);
|
||||
|
||||
OpenAPI_policy_association_release_cause_e OpenAPI_policy_association_release_cause_FromString(char* policy_association_release_cause);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_policy_association_release_cause_H_ */
|
||||
|
||||
854
lib/sbi/openapi/model/policy_association_request.c
Normal file
854
lib/sbi/openapi/model/policy_association_request.c
Normal file
|
|
@ -0,0 +1,854 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "policy_association_request.h"
|
||||
|
||||
OpenAPI_policy_association_request_t *OpenAPI_policy_association_request_create(
|
||||
char *notification_uri,
|
||||
OpenAPI_list_t *alt_notif_ipv4_addrs,
|
||||
OpenAPI_list_t *alt_notif_ipv6_addrs,
|
||||
char *supi,
|
||||
char *gpsi,
|
||||
OpenAPI_access_type_e access_type,
|
||||
OpenAPI_list_t *access_types,
|
||||
char *pei,
|
||||
OpenAPI_user_location_t *user_loc,
|
||||
char *time_zone,
|
||||
OpenAPI_plmn_id_nid_t *serving_plmn,
|
||||
OpenAPI_rat_type_e rat_type,
|
||||
OpenAPI_list_t *rat_types,
|
||||
OpenAPI_list_t *group_ids,
|
||||
OpenAPI_service_area_restriction_t *serv_area_res,
|
||||
OpenAPI_wireline_service_area_restriction_t *wl_serv_area_res,
|
||||
int rfsp,
|
||||
OpenAPI_ambr_t *ue_ambr,
|
||||
OpenAPI_ambr_t *rg_tmbr,
|
||||
OpenAPI_list_t *allowed_snssais,
|
||||
OpenAPI_list_t *mapping_snssais,
|
||||
OpenAPI_list_t *n3g_allowed_snssais,
|
||||
OpenAPI_guami_t *guami,
|
||||
char *servive_name,
|
||||
OpenAPI_trace_data_t *trace_req,
|
||||
char *supp_feat
|
||||
)
|
||||
{
|
||||
OpenAPI_policy_association_request_t *policy_association_request_local_var = OpenAPI_malloc(sizeof(OpenAPI_policy_association_request_t));
|
||||
if (!policy_association_request_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
policy_association_request_local_var->notification_uri = notification_uri;
|
||||
policy_association_request_local_var->alt_notif_ipv4_addrs = alt_notif_ipv4_addrs;
|
||||
policy_association_request_local_var->alt_notif_ipv6_addrs = alt_notif_ipv6_addrs;
|
||||
policy_association_request_local_var->supi = supi;
|
||||
policy_association_request_local_var->gpsi = gpsi;
|
||||
policy_association_request_local_var->access_type = access_type;
|
||||
policy_association_request_local_var->access_types = access_types;
|
||||
policy_association_request_local_var->pei = pei;
|
||||
policy_association_request_local_var->user_loc = user_loc;
|
||||
policy_association_request_local_var->time_zone = time_zone;
|
||||
policy_association_request_local_var->serving_plmn = serving_plmn;
|
||||
policy_association_request_local_var->rat_type = rat_type;
|
||||
policy_association_request_local_var->rat_types = rat_types;
|
||||
policy_association_request_local_var->group_ids = group_ids;
|
||||
policy_association_request_local_var->serv_area_res = serv_area_res;
|
||||
policy_association_request_local_var->wl_serv_area_res = wl_serv_area_res;
|
||||
policy_association_request_local_var->rfsp = rfsp;
|
||||
policy_association_request_local_var->ue_ambr = ue_ambr;
|
||||
policy_association_request_local_var->rg_tmbr = rg_tmbr;
|
||||
policy_association_request_local_var->allowed_snssais = allowed_snssais;
|
||||
policy_association_request_local_var->mapping_snssais = mapping_snssais;
|
||||
policy_association_request_local_var->n3g_allowed_snssais = n3g_allowed_snssais;
|
||||
policy_association_request_local_var->guami = guami;
|
||||
policy_association_request_local_var->servive_name = servive_name;
|
||||
policy_association_request_local_var->trace_req = trace_req;
|
||||
policy_association_request_local_var->supp_feat = supp_feat;
|
||||
|
||||
return policy_association_request_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_policy_association_request_free(OpenAPI_policy_association_request_t *policy_association_request)
|
||||
{
|
||||
if (NULL == policy_association_request) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(policy_association_request->notification_uri);
|
||||
OpenAPI_list_for_each(policy_association_request->alt_notif_ipv4_addrs, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(policy_association_request->alt_notif_ipv4_addrs);
|
||||
OpenAPI_list_for_each(policy_association_request->alt_notif_ipv6_addrs, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(policy_association_request->alt_notif_ipv6_addrs);
|
||||
ogs_free(policy_association_request->supi);
|
||||
ogs_free(policy_association_request->gpsi);
|
||||
OpenAPI_list_free(policy_association_request->access_types);
|
||||
ogs_free(policy_association_request->pei);
|
||||
OpenAPI_user_location_free(policy_association_request->user_loc);
|
||||
ogs_free(policy_association_request->time_zone);
|
||||
OpenAPI_plmn_id_nid_free(policy_association_request->serving_plmn);
|
||||
OpenAPI_list_free(policy_association_request->rat_types);
|
||||
OpenAPI_list_for_each(policy_association_request->group_ids, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(policy_association_request->group_ids);
|
||||
OpenAPI_service_area_restriction_free(policy_association_request->serv_area_res);
|
||||
OpenAPI_wireline_service_area_restriction_free(policy_association_request->wl_serv_area_res);
|
||||
OpenAPI_ambr_free(policy_association_request->ue_ambr);
|
||||
OpenAPI_ambr_free(policy_association_request->rg_tmbr);
|
||||
OpenAPI_list_for_each(policy_association_request->allowed_snssais, node) {
|
||||
OpenAPI_snssai_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(policy_association_request->allowed_snssais);
|
||||
OpenAPI_list_for_each(policy_association_request->mapping_snssais, node) {
|
||||
OpenAPI_mapping_of_snssai_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(policy_association_request->mapping_snssais);
|
||||
OpenAPI_list_for_each(policy_association_request->n3g_allowed_snssais, node) {
|
||||
OpenAPI_snssai_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(policy_association_request->n3g_allowed_snssais);
|
||||
OpenAPI_guami_free(policy_association_request->guami);
|
||||
ogs_free(policy_association_request->servive_name);
|
||||
OpenAPI_trace_data_free(policy_association_request->trace_req);
|
||||
ogs_free(policy_association_request->supp_feat);
|
||||
ogs_free(policy_association_request);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_policy_association_request_convertToJSON(OpenAPI_policy_association_request_t *policy_association_request)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (policy_association_request == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [PolicyAssociationRequest]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (!policy_association_request->notification_uri) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [notification_uri]");
|
||||
goto end;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "notificationUri", policy_association_request->notification_uri) == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [notification_uri]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (policy_association_request->alt_notif_ipv4_addrs) {
|
||||
cJSON *alt_notif_ipv4_addrs = cJSON_AddArrayToObject(item, "altNotifIpv4Addrs");
|
||||
if (alt_notif_ipv4_addrs == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [alt_notif_ipv4_addrs]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *alt_notif_ipv4_addrs_node;
|
||||
OpenAPI_list_for_each(policy_association_request->alt_notif_ipv4_addrs, alt_notif_ipv4_addrs_node) {
|
||||
if (cJSON_AddStringToObject(alt_notif_ipv4_addrs, "", (char*)alt_notif_ipv4_addrs_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [alt_notif_ipv4_addrs]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_request->alt_notif_ipv6_addrs) {
|
||||
cJSON *alt_notif_ipv6_addrs = cJSON_AddArrayToObject(item, "altNotifIpv6Addrs");
|
||||
if (alt_notif_ipv6_addrs == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [alt_notif_ipv6_addrs]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *alt_notif_ipv6_addrs_node;
|
||||
OpenAPI_list_for_each(policy_association_request->alt_notif_ipv6_addrs, alt_notif_ipv6_addrs_node) {
|
||||
if (cJSON_AddStringToObject(alt_notif_ipv6_addrs, "", (char*)alt_notif_ipv6_addrs_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [alt_notif_ipv6_addrs]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!policy_association_request->supi) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [supi]");
|
||||
goto end;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "supi", policy_association_request->supi) == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [supi]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (policy_association_request->gpsi) {
|
||||
if (cJSON_AddStringToObject(item, "gpsi", policy_association_request->gpsi) == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [gpsi]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_request->access_type) {
|
||||
if (cJSON_AddStringToObject(item, "accessType", OpenAPI_access_type_ToString(policy_association_request->access_type)) == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [access_type]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_request->access_types) {
|
||||
cJSON *access_types = cJSON_AddArrayToObject(item, "accessTypes");
|
||||
if (access_types == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [access_types]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_lnode_t *access_types_node;
|
||||
OpenAPI_list_for_each(policy_association_request->access_types, access_types_node) {
|
||||
if (cJSON_AddStringToObject(access_types, "", OpenAPI_access_type_ToString((OpenAPI_access_type_e)access_types_node->data)) == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [access_types]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_request->pei) {
|
||||
if (cJSON_AddStringToObject(item, "pei", policy_association_request->pei) == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [pei]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_request->user_loc) {
|
||||
cJSON *user_loc_local_JSON = OpenAPI_user_location_convertToJSON(policy_association_request->user_loc);
|
||||
if (user_loc_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [user_loc]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "userLoc", user_loc_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [user_loc]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_request->time_zone) {
|
||||
if (cJSON_AddStringToObject(item, "timeZone", policy_association_request->time_zone) == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [time_zone]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_request->serving_plmn) {
|
||||
cJSON *serving_plmn_local_JSON = OpenAPI_plmn_id_nid_convertToJSON(policy_association_request->serving_plmn);
|
||||
if (serving_plmn_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [serving_plmn]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "servingPlmn", serving_plmn_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [serving_plmn]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_request->rat_type) {
|
||||
if (cJSON_AddStringToObject(item, "ratType", OpenAPI_rat_type_ToString(policy_association_request->rat_type)) == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [rat_type]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_request->rat_types) {
|
||||
cJSON *rat_types = cJSON_AddArrayToObject(item, "ratTypes");
|
||||
if (rat_types == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [rat_types]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_lnode_t *rat_types_node;
|
||||
OpenAPI_list_for_each(policy_association_request->rat_types, rat_types_node) {
|
||||
if (cJSON_AddStringToObject(rat_types, "", OpenAPI_rat_type_ToString((OpenAPI_rat_type_e)rat_types_node->data)) == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [rat_types]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_request->group_ids) {
|
||||
cJSON *group_ids = cJSON_AddArrayToObject(item, "groupIds");
|
||||
if (group_ids == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [group_ids]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *group_ids_node;
|
||||
OpenAPI_list_for_each(policy_association_request->group_ids, group_ids_node) {
|
||||
if (cJSON_AddStringToObject(group_ids, "", (char*)group_ids_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [group_ids]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_request->serv_area_res) {
|
||||
cJSON *serv_area_res_local_JSON = OpenAPI_service_area_restriction_convertToJSON(policy_association_request->serv_area_res);
|
||||
if (serv_area_res_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [serv_area_res]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "servAreaRes", serv_area_res_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [serv_area_res]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_request->wl_serv_area_res) {
|
||||
cJSON *wl_serv_area_res_local_JSON = OpenAPI_wireline_service_area_restriction_convertToJSON(policy_association_request->wl_serv_area_res);
|
||||
if (wl_serv_area_res_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [wl_serv_area_res]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "wlServAreaRes", wl_serv_area_res_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [wl_serv_area_res]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_request->rfsp) {
|
||||
if (cJSON_AddNumberToObject(item, "rfsp", policy_association_request->rfsp) == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [rfsp]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_request->ue_ambr) {
|
||||
cJSON *ue_ambr_local_JSON = OpenAPI_ambr_convertToJSON(policy_association_request->ue_ambr);
|
||||
if (ue_ambr_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [ue_ambr]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "ueAmbr", ue_ambr_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [ue_ambr]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_request->rg_tmbr) {
|
||||
cJSON *rg_tmbr_local_JSON = OpenAPI_ambr_convertToJSON(policy_association_request->rg_tmbr);
|
||||
if (rg_tmbr_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [rg_tmbr]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "rgTmbr", rg_tmbr_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [rg_tmbr]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_request->allowed_snssais) {
|
||||
cJSON *allowed_snssaisList = cJSON_AddArrayToObject(item, "allowedSnssais");
|
||||
if (allowed_snssaisList == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [allowed_snssais]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *allowed_snssais_node;
|
||||
if (policy_association_request->allowed_snssais) {
|
||||
OpenAPI_list_for_each(policy_association_request->allowed_snssais, allowed_snssais_node) {
|
||||
cJSON *itemLocal = OpenAPI_snssai_convertToJSON(allowed_snssais_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [allowed_snssais]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(allowed_snssaisList, itemLocal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_request->mapping_snssais) {
|
||||
cJSON *mapping_snssaisList = cJSON_AddArrayToObject(item, "mappingSnssais");
|
||||
if (mapping_snssaisList == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [mapping_snssais]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *mapping_snssais_node;
|
||||
if (policy_association_request->mapping_snssais) {
|
||||
OpenAPI_list_for_each(policy_association_request->mapping_snssais, mapping_snssais_node) {
|
||||
cJSON *itemLocal = OpenAPI_mapping_of_snssai_convertToJSON(mapping_snssais_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [mapping_snssais]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(mapping_snssaisList, itemLocal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_request->n3g_allowed_snssais) {
|
||||
cJSON *n3g_allowed_snssaisList = cJSON_AddArrayToObject(item, "n3gAllowedSnssais");
|
||||
if (n3g_allowed_snssaisList == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [n3g_allowed_snssais]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *n3g_allowed_snssais_node;
|
||||
if (policy_association_request->n3g_allowed_snssais) {
|
||||
OpenAPI_list_for_each(policy_association_request->n3g_allowed_snssais, n3g_allowed_snssais_node) {
|
||||
cJSON *itemLocal = OpenAPI_snssai_convertToJSON(n3g_allowed_snssais_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [n3g_allowed_snssais]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(n3g_allowed_snssaisList, itemLocal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_request->guami) {
|
||||
cJSON *guami_local_JSON = OpenAPI_guami_convertToJSON(policy_association_request->guami);
|
||||
if (guami_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [guami]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "guami", guami_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [guami]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_request->servive_name) {
|
||||
if (cJSON_AddStringToObject(item, "serviveName", policy_association_request->servive_name) == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [servive_name]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_request->trace_req) {
|
||||
cJSON *trace_req_local_JSON = OpenAPI_trace_data_convertToJSON(policy_association_request->trace_req);
|
||||
if (trace_req_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [trace_req]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "traceReq", trace_req_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [trace_req]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (!policy_association_request->supp_feat) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [supp_feat]");
|
||||
goto end;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "suppFeat", policy_association_request->supp_feat) == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [supp_feat]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_policy_association_request_t *OpenAPI_policy_association_request_parseFromJSON(cJSON *policy_association_requestJSON)
|
||||
{
|
||||
OpenAPI_policy_association_request_t *policy_association_request_local_var = NULL;
|
||||
cJSON *notification_uri = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "notificationUri");
|
||||
if (!notification_uri) {
|
||||
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [notification_uri]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
if (!cJSON_IsString(notification_uri)) {
|
||||
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [notification_uri]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *alt_notif_ipv4_addrs = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "altNotifIpv4Addrs");
|
||||
|
||||
OpenAPI_list_t *alt_notif_ipv4_addrsList;
|
||||
if (alt_notif_ipv4_addrs) {
|
||||
cJSON *alt_notif_ipv4_addrs_local;
|
||||
if (!cJSON_IsArray(alt_notif_ipv4_addrs)) {
|
||||
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [alt_notif_ipv4_addrs]");
|
||||
goto end;
|
||||
}
|
||||
alt_notif_ipv4_addrsList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(alt_notif_ipv4_addrs_local, alt_notif_ipv4_addrs) {
|
||||
if (!cJSON_IsString(alt_notif_ipv4_addrs_local)) {
|
||||
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [alt_notif_ipv4_addrs]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(alt_notif_ipv4_addrsList, ogs_strdup(alt_notif_ipv4_addrs_local->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *alt_notif_ipv6_addrs = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "altNotifIpv6Addrs");
|
||||
|
||||
OpenAPI_list_t *alt_notif_ipv6_addrsList;
|
||||
if (alt_notif_ipv6_addrs) {
|
||||
cJSON *alt_notif_ipv6_addrs_local;
|
||||
if (!cJSON_IsArray(alt_notif_ipv6_addrs)) {
|
||||
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [alt_notif_ipv6_addrs]");
|
||||
goto end;
|
||||
}
|
||||
alt_notif_ipv6_addrsList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(alt_notif_ipv6_addrs_local, alt_notif_ipv6_addrs) {
|
||||
if (!cJSON_IsString(alt_notif_ipv6_addrs_local)) {
|
||||
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [alt_notif_ipv6_addrs]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(alt_notif_ipv6_addrsList, ogs_strdup(alt_notif_ipv6_addrs_local->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *supi = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "supi");
|
||||
if (!supi) {
|
||||
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [supi]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
if (!cJSON_IsString(supi)) {
|
||||
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [supi]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *gpsi = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "gpsi");
|
||||
|
||||
if (gpsi) {
|
||||
if (!cJSON_IsString(gpsi)) {
|
||||
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [gpsi]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *access_type = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "accessType");
|
||||
|
||||
OpenAPI_access_type_e access_typeVariable;
|
||||
if (access_type) {
|
||||
if (!cJSON_IsString(access_type)) {
|
||||
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [access_type]");
|
||||
goto end;
|
||||
}
|
||||
access_typeVariable = OpenAPI_access_type_FromString(access_type->valuestring);
|
||||
}
|
||||
|
||||
cJSON *access_types = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "accessTypes");
|
||||
|
||||
OpenAPI_list_t *access_typesList;
|
||||
if (access_types) {
|
||||
cJSON *access_types_local_nonprimitive;
|
||||
if (!cJSON_IsArray(access_types)) {
|
||||
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [access_types]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
access_typesList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(access_types_local_nonprimitive, access_types ) {
|
||||
if (!cJSON_IsString(access_types_local_nonprimitive)) {
|
||||
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [access_types]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_list_add(access_typesList, (void *)OpenAPI_access_type_FromString(access_types_local_nonprimitive->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *pei = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "pei");
|
||||
|
||||
if (pei) {
|
||||
if (!cJSON_IsString(pei)) {
|
||||
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [pei]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *user_loc = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "userLoc");
|
||||
|
||||
OpenAPI_user_location_t *user_loc_local_nonprim = NULL;
|
||||
if (user_loc) {
|
||||
user_loc_local_nonprim = OpenAPI_user_location_parseFromJSON(user_loc);
|
||||
}
|
||||
|
||||
cJSON *time_zone = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "timeZone");
|
||||
|
||||
if (time_zone) {
|
||||
if (!cJSON_IsString(time_zone)) {
|
||||
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [time_zone]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *serving_plmn = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "servingPlmn");
|
||||
|
||||
OpenAPI_plmn_id_nid_t *serving_plmn_local_nonprim = NULL;
|
||||
if (serving_plmn) {
|
||||
serving_plmn_local_nonprim = OpenAPI_plmn_id_nid_parseFromJSON(serving_plmn);
|
||||
}
|
||||
|
||||
cJSON *rat_type = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "ratType");
|
||||
|
||||
OpenAPI_rat_type_e rat_typeVariable;
|
||||
if (rat_type) {
|
||||
if (!cJSON_IsString(rat_type)) {
|
||||
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [rat_type]");
|
||||
goto end;
|
||||
}
|
||||
rat_typeVariable = OpenAPI_rat_type_FromString(rat_type->valuestring);
|
||||
}
|
||||
|
||||
cJSON *rat_types = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "ratTypes");
|
||||
|
||||
OpenAPI_list_t *rat_typesList;
|
||||
if (rat_types) {
|
||||
cJSON *rat_types_local_nonprimitive;
|
||||
if (!cJSON_IsArray(rat_types)) {
|
||||
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [rat_types]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
rat_typesList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(rat_types_local_nonprimitive, rat_types ) {
|
||||
if (!cJSON_IsString(rat_types_local_nonprimitive)) {
|
||||
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [rat_types]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_list_add(rat_typesList, (void *)OpenAPI_rat_type_FromString(rat_types_local_nonprimitive->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *group_ids = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "groupIds");
|
||||
|
||||
OpenAPI_list_t *group_idsList;
|
||||
if (group_ids) {
|
||||
cJSON *group_ids_local;
|
||||
if (!cJSON_IsArray(group_ids)) {
|
||||
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [group_ids]");
|
||||
goto end;
|
||||
}
|
||||
group_idsList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(group_ids_local, group_ids) {
|
||||
if (!cJSON_IsString(group_ids_local)) {
|
||||
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [group_ids]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(group_idsList, ogs_strdup(group_ids_local->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *serv_area_res = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "servAreaRes");
|
||||
|
||||
OpenAPI_service_area_restriction_t *serv_area_res_local_nonprim = NULL;
|
||||
if (serv_area_res) {
|
||||
serv_area_res_local_nonprim = OpenAPI_service_area_restriction_parseFromJSON(serv_area_res);
|
||||
}
|
||||
|
||||
cJSON *wl_serv_area_res = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "wlServAreaRes");
|
||||
|
||||
OpenAPI_wireline_service_area_restriction_t *wl_serv_area_res_local_nonprim = NULL;
|
||||
if (wl_serv_area_res) {
|
||||
wl_serv_area_res_local_nonprim = OpenAPI_wireline_service_area_restriction_parseFromJSON(wl_serv_area_res);
|
||||
}
|
||||
|
||||
cJSON *rfsp = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "rfsp");
|
||||
|
||||
if (rfsp) {
|
||||
if (!cJSON_IsNumber(rfsp)) {
|
||||
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [rfsp]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *ue_ambr = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "ueAmbr");
|
||||
|
||||
OpenAPI_ambr_t *ue_ambr_local_nonprim = NULL;
|
||||
if (ue_ambr) {
|
||||
ue_ambr_local_nonprim = OpenAPI_ambr_parseFromJSON(ue_ambr);
|
||||
}
|
||||
|
||||
cJSON *rg_tmbr = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "rgTmbr");
|
||||
|
||||
OpenAPI_ambr_t *rg_tmbr_local_nonprim = NULL;
|
||||
if (rg_tmbr) {
|
||||
rg_tmbr_local_nonprim = OpenAPI_ambr_parseFromJSON(rg_tmbr);
|
||||
}
|
||||
|
||||
cJSON *allowed_snssais = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "allowedSnssais");
|
||||
|
||||
OpenAPI_list_t *allowed_snssaisList;
|
||||
if (allowed_snssais) {
|
||||
cJSON *allowed_snssais_local_nonprimitive;
|
||||
if (!cJSON_IsArray(allowed_snssais)) {
|
||||
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [allowed_snssais]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
allowed_snssaisList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(allowed_snssais_local_nonprimitive, allowed_snssais ) {
|
||||
if (!cJSON_IsObject(allowed_snssais_local_nonprimitive)) {
|
||||
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [allowed_snssais]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_snssai_t *allowed_snssaisItem = OpenAPI_snssai_parseFromJSON(allowed_snssais_local_nonprimitive);
|
||||
|
||||
OpenAPI_list_add(allowed_snssaisList, allowed_snssaisItem);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *mapping_snssais = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "mappingSnssais");
|
||||
|
||||
OpenAPI_list_t *mapping_snssaisList;
|
||||
if (mapping_snssais) {
|
||||
cJSON *mapping_snssais_local_nonprimitive;
|
||||
if (!cJSON_IsArray(mapping_snssais)) {
|
||||
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [mapping_snssais]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
mapping_snssaisList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(mapping_snssais_local_nonprimitive, mapping_snssais ) {
|
||||
if (!cJSON_IsObject(mapping_snssais_local_nonprimitive)) {
|
||||
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [mapping_snssais]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_mapping_of_snssai_t *mapping_snssaisItem = OpenAPI_mapping_of_snssai_parseFromJSON(mapping_snssais_local_nonprimitive);
|
||||
|
||||
OpenAPI_list_add(mapping_snssaisList, mapping_snssaisItem);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *n3g_allowed_snssais = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "n3gAllowedSnssais");
|
||||
|
||||
OpenAPI_list_t *n3g_allowed_snssaisList;
|
||||
if (n3g_allowed_snssais) {
|
||||
cJSON *n3g_allowed_snssais_local_nonprimitive;
|
||||
if (!cJSON_IsArray(n3g_allowed_snssais)) {
|
||||
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [n3g_allowed_snssais]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
n3g_allowed_snssaisList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(n3g_allowed_snssais_local_nonprimitive, n3g_allowed_snssais ) {
|
||||
if (!cJSON_IsObject(n3g_allowed_snssais_local_nonprimitive)) {
|
||||
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [n3g_allowed_snssais]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_snssai_t *n3g_allowed_snssaisItem = OpenAPI_snssai_parseFromJSON(n3g_allowed_snssais_local_nonprimitive);
|
||||
|
||||
OpenAPI_list_add(n3g_allowed_snssaisList, n3g_allowed_snssaisItem);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *guami = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "guami");
|
||||
|
||||
OpenAPI_guami_t *guami_local_nonprim = NULL;
|
||||
if (guami) {
|
||||
guami_local_nonprim = OpenAPI_guami_parseFromJSON(guami);
|
||||
}
|
||||
|
||||
cJSON *servive_name = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "serviveName");
|
||||
|
||||
if (servive_name) {
|
||||
if (!cJSON_IsString(servive_name)) {
|
||||
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [servive_name]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *trace_req = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "traceReq");
|
||||
|
||||
OpenAPI_trace_data_t *trace_req_local_nonprim = NULL;
|
||||
if (trace_req) {
|
||||
trace_req_local_nonprim = OpenAPI_trace_data_parseFromJSON(trace_req);
|
||||
}
|
||||
|
||||
cJSON *supp_feat = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "suppFeat");
|
||||
if (!supp_feat) {
|
||||
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [supp_feat]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
if (!cJSON_IsString(supp_feat)) {
|
||||
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [supp_feat]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
policy_association_request_local_var = OpenAPI_policy_association_request_create (
|
||||
ogs_strdup(notification_uri->valuestring),
|
||||
alt_notif_ipv4_addrs ? alt_notif_ipv4_addrsList : NULL,
|
||||
alt_notif_ipv6_addrs ? alt_notif_ipv6_addrsList : NULL,
|
||||
ogs_strdup(supi->valuestring),
|
||||
gpsi ? ogs_strdup(gpsi->valuestring) : NULL,
|
||||
access_type ? access_typeVariable : 0,
|
||||
access_types ? access_typesList : NULL,
|
||||
pei ? ogs_strdup(pei->valuestring) : NULL,
|
||||
user_loc ? user_loc_local_nonprim : NULL,
|
||||
time_zone ? ogs_strdup(time_zone->valuestring) : NULL,
|
||||
serving_plmn ? serving_plmn_local_nonprim : NULL,
|
||||
rat_type ? rat_typeVariable : 0,
|
||||
rat_types ? rat_typesList : NULL,
|
||||
group_ids ? group_idsList : NULL,
|
||||
serv_area_res ? serv_area_res_local_nonprim : NULL,
|
||||
wl_serv_area_res ? wl_serv_area_res_local_nonprim : NULL,
|
||||
rfsp ? rfsp->valuedouble : 0,
|
||||
ue_ambr ? ue_ambr_local_nonprim : NULL,
|
||||
rg_tmbr ? rg_tmbr_local_nonprim : NULL,
|
||||
allowed_snssais ? allowed_snssaisList : NULL,
|
||||
mapping_snssais ? mapping_snssaisList : NULL,
|
||||
n3g_allowed_snssais ? n3g_allowed_snssaisList : NULL,
|
||||
guami ? guami_local_nonprim : NULL,
|
||||
servive_name ? ogs_strdup(servive_name->valuestring) : NULL,
|
||||
trace_req ? trace_req_local_nonprim : NULL,
|
||||
ogs_strdup(supp_feat->valuestring)
|
||||
);
|
||||
|
||||
return policy_association_request_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_policy_association_request_t *OpenAPI_policy_association_request_copy(OpenAPI_policy_association_request_t *dst, OpenAPI_policy_association_request_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_policy_association_request_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_policy_association_request_free(dst);
|
||||
dst = OpenAPI_policy_association_request_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
99
lib/sbi/openapi/model/policy_association_request.h
Normal file
99
lib/sbi/openapi/model/policy_association_request.h
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
* policy_association_request.h
|
||||
*
|
||||
* Information which the NF service consumer provides when requesting the creation of a policy association. The serviveName property corresponds to the serviceName in the main body of the specification.
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_policy_association_request_H_
|
||||
#define _OpenAPI_policy_association_request_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
#include "access_type.h"
|
||||
#include "ambr.h"
|
||||
#include "guami.h"
|
||||
#include "mapping_of_snssai.h"
|
||||
#include "plmn_id_nid.h"
|
||||
#include "rat_type.h"
|
||||
#include "service_area_restriction.h"
|
||||
#include "snssai.h"
|
||||
#include "trace_data.h"
|
||||
#include "user_location.h"
|
||||
#include "wireline_service_area_restriction.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_policy_association_request_s OpenAPI_policy_association_request_t;
|
||||
typedef struct OpenAPI_policy_association_request_s {
|
||||
char *notification_uri;
|
||||
OpenAPI_list_t *alt_notif_ipv4_addrs;
|
||||
OpenAPI_list_t *alt_notif_ipv6_addrs;
|
||||
char *supi;
|
||||
char *gpsi;
|
||||
OpenAPI_access_type_e access_type;
|
||||
OpenAPI_list_t *access_types;
|
||||
char *pei;
|
||||
struct OpenAPI_user_location_s *user_loc;
|
||||
char *time_zone;
|
||||
struct OpenAPI_plmn_id_nid_s *serving_plmn;
|
||||
OpenAPI_rat_type_e rat_type;
|
||||
OpenAPI_list_t *rat_types;
|
||||
OpenAPI_list_t *group_ids;
|
||||
struct OpenAPI_service_area_restriction_s *serv_area_res;
|
||||
struct OpenAPI_wireline_service_area_restriction_s *wl_serv_area_res;
|
||||
int rfsp;
|
||||
struct OpenAPI_ambr_s *ue_ambr;
|
||||
struct OpenAPI_ambr_s *rg_tmbr;
|
||||
OpenAPI_list_t *allowed_snssais;
|
||||
OpenAPI_list_t *mapping_snssais;
|
||||
OpenAPI_list_t *n3g_allowed_snssais;
|
||||
struct OpenAPI_guami_s *guami;
|
||||
char *servive_name;
|
||||
struct OpenAPI_trace_data_s *trace_req;
|
||||
char *supp_feat;
|
||||
} OpenAPI_policy_association_request_t;
|
||||
|
||||
OpenAPI_policy_association_request_t *OpenAPI_policy_association_request_create(
|
||||
char *notification_uri,
|
||||
OpenAPI_list_t *alt_notif_ipv4_addrs,
|
||||
OpenAPI_list_t *alt_notif_ipv6_addrs,
|
||||
char *supi,
|
||||
char *gpsi,
|
||||
OpenAPI_access_type_e access_type,
|
||||
OpenAPI_list_t *access_types,
|
||||
char *pei,
|
||||
OpenAPI_user_location_t *user_loc,
|
||||
char *time_zone,
|
||||
OpenAPI_plmn_id_nid_t *serving_plmn,
|
||||
OpenAPI_rat_type_e rat_type,
|
||||
OpenAPI_list_t *rat_types,
|
||||
OpenAPI_list_t *group_ids,
|
||||
OpenAPI_service_area_restriction_t *serv_area_res,
|
||||
OpenAPI_wireline_service_area_restriction_t *wl_serv_area_res,
|
||||
int rfsp,
|
||||
OpenAPI_ambr_t *ue_ambr,
|
||||
OpenAPI_ambr_t *rg_tmbr,
|
||||
OpenAPI_list_t *allowed_snssais,
|
||||
OpenAPI_list_t *mapping_snssais,
|
||||
OpenAPI_list_t *n3g_allowed_snssais,
|
||||
OpenAPI_guami_t *guami,
|
||||
char *servive_name,
|
||||
OpenAPI_trace_data_t *trace_req,
|
||||
char *supp_feat
|
||||
);
|
||||
void OpenAPI_policy_association_request_free(OpenAPI_policy_association_request_t *policy_association_request);
|
||||
OpenAPI_policy_association_request_t *OpenAPI_policy_association_request_parseFromJSON(cJSON *policy_association_requestJSON);
|
||||
cJSON *OpenAPI_policy_association_request_convertToJSON(OpenAPI_policy_association_request_t *policy_association_request);
|
||||
OpenAPI_policy_association_request_t *OpenAPI_policy_association_request_copy(OpenAPI_policy_association_request_t *dst, OpenAPI_policy_association_request_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_policy_association_request_H_ */
|
||||
|
||||
728
lib/sbi/openapi/model/policy_association_update_request.c
Normal file
728
lib/sbi/openapi/model/policy_association_update_request.c
Normal file
|
|
@ -0,0 +1,728 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "policy_association_update_request.h"
|
||||
|
||||
OpenAPI_policy_association_update_request_t *OpenAPI_policy_association_update_request_create(
|
||||
char *notification_uri,
|
||||
OpenAPI_list_t *alt_notif_ipv4_addrs,
|
||||
OpenAPI_list_t *alt_notif_ipv6_addrs,
|
||||
OpenAPI_list_t *triggers,
|
||||
OpenAPI_service_area_restriction_t *serv_area_res,
|
||||
OpenAPI_wireline_service_area_restriction_t *wl_serv_area_res,
|
||||
int rfsp,
|
||||
OpenAPI_smf_selection_data_t *smf_sel_info,
|
||||
OpenAPI_ambr_t *ue_ambr,
|
||||
OpenAPI_ambr_t *rg_tmbr,
|
||||
OpenAPI_list_t* pra_statuses,
|
||||
OpenAPI_user_location_t *user_loc,
|
||||
OpenAPI_list_t *allowed_snssais,
|
||||
OpenAPI_list_t *mapping_snssais,
|
||||
OpenAPI_list_t *access_types,
|
||||
OpenAPI_list_t *rat_types,
|
||||
OpenAPI_list_t *n3g_allowed_snssais,
|
||||
OpenAPI_trace_data_t *trace_req,
|
||||
OpenAPI_guami_t *guami
|
||||
)
|
||||
{
|
||||
OpenAPI_policy_association_update_request_t *policy_association_update_request_local_var = OpenAPI_malloc(sizeof(OpenAPI_policy_association_update_request_t));
|
||||
if (!policy_association_update_request_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
policy_association_update_request_local_var->notification_uri = notification_uri;
|
||||
policy_association_update_request_local_var->alt_notif_ipv4_addrs = alt_notif_ipv4_addrs;
|
||||
policy_association_update_request_local_var->alt_notif_ipv6_addrs = alt_notif_ipv6_addrs;
|
||||
policy_association_update_request_local_var->triggers = triggers;
|
||||
policy_association_update_request_local_var->serv_area_res = serv_area_res;
|
||||
policy_association_update_request_local_var->wl_serv_area_res = wl_serv_area_res;
|
||||
policy_association_update_request_local_var->rfsp = rfsp;
|
||||
policy_association_update_request_local_var->smf_sel_info = smf_sel_info;
|
||||
policy_association_update_request_local_var->ue_ambr = ue_ambr;
|
||||
policy_association_update_request_local_var->rg_tmbr = rg_tmbr;
|
||||
policy_association_update_request_local_var->pra_statuses = pra_statuses;
|
||||
policy_association_update_request_local_var->user_loc = user_loc;
|
||||
policy_association_update_request_local_var->allowed_snssais = allowed_snssais;
|
||||
policy_association_update_request_local_var->mapping_snssais = mapping_snssais;
|
||||
policy_association_update_request_local_var->access_types = access_types;
|
||||
policy_association_update_request_local_var->rat_types = rat_types;
|
||||
policy_association_update_request_local_var->n3g_allowed_snssais = n3g_allowed_snssais;
|
||||
policy_association_update_request_local_var->trace_req = trace_req;
|
||||
policy_association_update_request_local_var->guami = guami;
|
||||
|
||||
return policy_association_update_request_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_policy_association_update_request_free(OpenAPI_policy_association_update_request_t *policy_association_update_request)
|
||||
{
|
||||
if (NULL == policy_association_update_request) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(policy_association_update_request->notification_uri);
|
||||
OpenAPI_list_for_each(policy_association_update_request->alt_notif_ipv4_addrs, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(policy_association_update_request->alt_notif_ipv4_addrs);
|
||||
OpenAPI_list_for_each(policy_association_update_request->alt_notif_ipv6_addrs, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(policy_association_update_request->alt_notif_ipv6_addrs);
|
||||
OpenAPI_list_free(policy_association_update_request->triggers);
|
||||
OpenAPI_service_area_restriction_free(policy_association_update_request->serv_area_res);
|
||||
OpenAPI_wireline_service_area_restriction_free(policy_association_update_request->wl_serv_area_res);
|
||||
OpenAPI_smf_selection_data_free(policy_association_update_request->smf_sel_info);
|
||||
OpenAPI_ambr_free(policy_association_update_request->ue_ambr);
|
||||
OpenAPI_ambr_free(policy_association_update_request->rg_tmbr);
|
||||
OpenAPI_list_for_each(policy_association_update_request->pra_statuses, node) {
|
||||
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
|
||||
OpenAPI_presence_info_free(localKeyValue->value);
|
||||
ogs_free(localKeyValue);
|
||||
}
|
||||
OpenAPI_list_free(policy_association_update_request->pra_statuses);
|
||||
OpenAPI_user_location_free(policy_association_update_request->user_loc);
|
||||
OpenAPI_list_for_each(policy_association_update_request->allowed_snssais, node) {
|
||||
OpenAPI_snssai_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(policy_association_update_request->allowed_snssais);
|
||||
OpenAPI_list_for_each(policy_association_update_request->mapping_snssais, node) {
|
||||
OpenAPI_mapping_of_snssai_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(policy_association_update_request->mapping_snssais);
|
||||
OpenAPI_list_free(policy_association_update_request->access_types);
|
||||
OpenAPI_list_free(policy_association_update_request->rat_types);
|
||||
OpenAPI_list_for_each(policy_association_update_request->n3g_allowed_snssais, node) {
|
||||
OpenAPI_snssai_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(policy_association_update_request->n3g_allowed_snssais);
|
||||
OpenAPI_trace_data_free(policy_association_update_request->trace_req);
|
||||
OpenAPI_guami_free(policy_association_update_request->guami);
|
||||
ogs_free(policy_association_update_request);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_policy_association_update_request_convertToJSON(OpenAPI_policy_association_update_request_t *policy_association_update_request)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (policy_association_update_request == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [PolicyAssociationUpdateRequest]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (policy_association_update_request->notification_uri) {
|
||||
if (cJSON_AddStringToObject(item, "notificationUri", policy_association_update_request->notification_uri) == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [notification_uri]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_update_request->alt_notif_ipv4_addrs) {
|
||||
cJSON *alt_notif_ipv4_addrs = cJSON_AddArrayToObject(item, "altNotifIpv4Addrs");
|
||||
if (alt_notif_ipv4_addrs == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [alt_notif_ipv4_addrs]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *alt_notif_ipv4_addrs_node;
|
||||
OpenAPI_list_for_each(policy_association_update_request->alt_notif_ipv4_addrs, alt_notif_ipv4_addrs_node) {
|
||||
if (cJSON_AddStringToObject(alt_notif_ipv4_addrs, "", (char*)alt_notif_ipv4_addrs_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [alt_notif_ipv4_addrs]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_update_request->alt_notif_ipv6_addrs) {
|
||||
cJSON *alt_notif_ipv6_addrs = cJSON_AddArrayToObject(item, "altNotifIpv6Addrs");
|
||||
if (alt_notif_ipv6_addrs == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [alt_notif_ipv6_addrs]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *alt_notif_ipv6_addrs_node;
|
||||
OpenAPI_list_for_each(policy_association_update_request->alt_notif_ipv6_addrs, alt_notif_ipv6_addrs_node) {
|
||||
if (cJSON_AddStringToObject(alt_notif_ipv6_addrs, "", (char*)alt_notif_ipv6_addrs_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [alt_notif_ipv6_addrs]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_update_request->triggers) {
|
||||
cJSON *triggers = cJSON_AddArrayToObject(item, "triggers");
|
||||
if (triggers == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [triggers]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_lnode_t *triggers_node;
|
||||
OpenAPI_list_for_each(policy_association_update_request->triggers, triggers_node) {
|
||||
if (cJSON_AddStringToObject(triggers, "", OpenAPI_request_trigger_ToString((OpenAPI_request_trigger_e)triggers_node->data)) == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [triggers]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_update_request->serv_area_res) {
|
||||
cJSON *serv_area_res_local_JSON = OpenAPI_service_area_restriction_convertToJSON(policy_association_update_request->serv_area_res);
|
||||
if (serv_area_res_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [serv_area_res]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "servAreaRes", serv_area_res_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [serv_area_res]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_update_request->wl_serv_area_res) {
|
||||
cJSON *wl_serv_area_res_local_JSON = OpenAPI_wireline_service_area_restriction_convertToJSON(policy_association_update_request->wl_serv_area_res);
|
||||
if (wl_serv_area_res_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [wl_serv_area_res]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "wlServAreaRes", wl_serv_area_res_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [wl_serv_area_res]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_update_request->rfsp) {
|
||||
if (cJSON_AddNumberToObject(item, "rfsp", policy_association_update_request->rfsp) == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [rfsp]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_update_request->smf_sel_info) {
|
||||
cJSON *smf_sel_info_local_JSON = OpenAPI_smf_selection_data_convertToJSON(policy_association_update_request->smf_sel_info);
|
||||
if (smf_sel_info_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [smf_sel_info]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "smfSelInfo", smf_sel_info_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [smf_sel_info]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_update_request->ue_ambr) {
|
||||
cJSON *ue_ambr_local_JSON = OpenAPI_ambr_convertToJSON(policy_association_update_request->ue_ambr);
|
||||
if (ue_ambr_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [ue_ambr]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "ueAmbr", ue_ambr_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [ue_ambr]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_update_request->rg_tmbr) {
|
||||
cJSON *rg_tmbr_local_JSON = OpenAPI_ambr_convertToJSON(policy_association_update_request->rg_tmbr);
|
||||
if (rg_tmbr_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [rg_tmbr]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "rgTmbr", rg_tmbr_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [rg_tmbr]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_update_request->pra_statuses) {
|
||||
cJSON *pra_statuses = cJSON_AddObjectToObject(item, "praStatuses");
|
||||
if (pra_statuses == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [pra_statuses]");
|
||||
goto end;
|
||||
}
|
||||
cJSON *localMapObject = pra_statuses;
|
||||
OpenAPI_lnode_t *pra_statuses_node;
|
||||
if (policy_association_update_request->pra_statuses) {
|
||||
OpenAPI_list_for_each(policy_association_update_request->pra_statuses, pra_statuses_node) {
|
||||
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)pra_statuses_node->data;
|
||||
cJSON *itemLocal = OpenAPI_presence_info_convertToJSON(localKeyValue->value);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [pra_statuses]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(pra_statuses, localKeyValue->key, itemLocal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_update_request->user_loc) {
|
||||
cJSON *user_loc_local_JSON = OpenAPI_user_location_convertToJSON(policy_association_update_request->user_loc);
|
||||
if (user_loc_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [user_loc]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "userLoc", user_loc_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [user_loc]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_update_request->allowed_snssais) {
|
||||
cJSON *allowed_snssaisList = cJSON_AddArrayToObject(item, "allowedSnssais");
|
||||
if (allowed_snssaisList == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [allowed_snssais]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *allowed_snssais_node;
|
||||
if (policy_association_update_request->allowed_snssais) {
|
||||
OpenAPI_list_for_each(policy_association_update_request->allowed_snssais, allowed_snssais_node) {
|
||||
cJSON *itemLocal = OpenAPI_snssai_convertToJSON(allowed_snssais_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [allowed_snssais]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(allowed_snssaisList, itemLocal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_update_request->mapping_snssais) {
|
||||
cJSON *mapping_snssaisList = cJSON_AddArrayToObject(item, "mappingSnssais");
|
||||
if (mapping_snssaisList == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [mapping_snssais]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *mapping_snssais_node;
|
||||
if (policy_association_update_request->mapping_snssais) {
|
||||
OpenAPI_list_for_each(policy_association_update_request->mapping_snssais, mapping_snssais_node) {
|
||||
cJSON *itemLocal = OpenAPI_mapping_of_snssai_convertToJSON(mapping_snssais_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [mapping_snssais]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(mapping_snssaisList, itemLocal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_update_request->access_types) {
|
||||
cJSON *access_types = cJSON_AddArrayToObject(item, "accessTypes");
|
||||
if (access_types == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [access_types]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_lnode_t *access_types_node;
|
||||
OpenAPI_list_for_each(policy_association_update_request->access_types, access_types_node) {
|
||||
if (cJSON_AddStringToObject(access_types, "", OpenAPI_access_type_ToString((OpenAPI_access_type_e)access_types_node->data)) == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [access_types]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_update_request->rat_types) {
|
||||
cJSON *rat_types = cJSON_AddArrayToObject(item, "ratTypes");
|
||||
if (rat_types == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [rat_types]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_lnode_t *rat_types_node;
|
||||
OpenAPI_list_for_each(policy_association_update_request->rat_types, rat_types_node) {
|
||||
if (cJSON_AddStringToObject(rat_types, "", OpenAPI_rat_type_ToString((OpenAPI_rat_type_e)rat_types_node->data)) == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [rat_types]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_update_request->n3g_allowed_snssais) {
|
||||
cJSON *n3g_allowed_snssaisList = cJSON_AddArrayToObject(item, "n3gAllowedSnssais");
|
||||
if (n3g_allowed_snssaisList == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [n3g_allowed_snssais]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *n3g_allowed_snssais_node;
|
||||
if (policy_association_update_request->n3g_allowed_snssais) {
|
||||
OpenAPI_list_for_each(policy_association_update_request->n3g_allowed_snssais, n3g_allowed_snssais_node) {
|
||||
cJSON *itemLocal = OpenAPI_snssai_convertToJSON(n3g_allowed_snssais_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [n3g_allowed_snssais]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(n3g_allowed_snssaisList, itemLocal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_update_request->trace_req) {
|
||||
cJSON *trace_req_local_JSON = OpenAPI_trace_data_convertToJSON(policy_association_update_request->trace_req);
|
||||
if (trace_req_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [trace_req]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "traceReq", trace_req_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [trace_req]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_association_update_request->guami) {
|
||||
cJSON *guami_local_JSON = OpenAPI_guami_convertToJSON(policy_association_update_request->guami);
|
||||
if (guami_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [guami]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "guami", guami_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [guami]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_policy_association_update_request_t *OpenAPI_policy_association_update_request_parseFromJSON(cJSON *policy_association_update_requestJSON)
|
||||
{
|
||||
OpenAPI_policy_association_update_request_t *policy_association_update_request_local_var = NULL;
|
||||
cJSON *notification_uri = cJSON_GetObjectItemCaseSensitive(policy_association_update_requestJSON, "notificationUri");
|
||||
|
||||
if (notification_uri) {
|
||||
if (!cJSON_IsString(notification_uri)) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_parseFromJSON() failed [notification_uri]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *alt_notif_ipv4_addrs = cJSON_GetObjectItemCaseSensitive(policy_association_update_requestJSON, "altNotifIpv4Addrs");
|
||||
|
||||
OpenAPI_list_t *alt_notif_ipv4_addrsList;
|
||||
if (alt_notif_ipv4_addrs) {
|
||||
cJSON *alt_notif_ipv4_addrs_local;
|
||||
if (!cJSON_IsArray(alt_notif_ipv4_addrs)) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_parseFromJSON() failed [alt_notif_ipv4_addrs]");
|
||||
goto end;
|
||||
}
|
||||
alt_notif_ipv4_addrsList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(alt_notif_ipv4_addrs_local, alt_notif_ipv4_addrs) {
|
||||
if (!cJSON_IsString(alt_notif_ipv4_addrs_local)) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_parseFromJSON() failed [alt_notif_ipv4_addrs]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(alt_notif_ipv4_addrsList, ogs_strdup(alt_notif_ipv4_addrs_local->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *alt_notif_ipv6_addrs = cJSON_GetObjectItemCaseSensitive(policy_association_update_requestJSON, "altNotifIpv6Addrs");
|
||||
|
||||
OpenAPI_list_t *alt_notif_ipv6_addrsList;
|
||||
if (alt_notif_ipv6_addrs) {
|
||||
cJSON *alt_notif_ipv6_addrs_local;
|
||||
if (!cJSON_IsArray(alt_notif_ipv6_addrs)) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_parseFromJSON() failed [alt_notif_ipv6_addrs]");
|
||||
goto end;
|
||||
}
|
||||
alt_notif_ipv6_addrsList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(alt_notif_ipv6_addrs_local, alt_notif_ipv6_addrs) {
|
||||
if (!cJSON_IsString(alt_notif_ipv6_addrs_local)) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_parseFromJSON() failed [alt_notif_ipv6_addrs]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(alt_notif_ipv6_addrsList, ogs_strdup(alt_notif_ipv6_addrs_local->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *triggers = cJSON_GetObjectItemCaseSensitive(policy_association_update_requestJSON, "triggers");
|
||||
|
||||
OpenAPI_list_t *triggersList;
|
||||
if (triggers) {
|
||||
cJSON *triggers_local_nonprimitive;
|
||||
if (!cJSON_IsArray(triggers)) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_parseFromJSON() failed [triggers]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
triggersList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(triggers_local_nonprimitive, triggers ) {
|
||||
if (!cJSON_IsString(triggers_local_nonprimitive)) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_parseFromJSON() failed [triggers]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_list_add(triggersList, (void *)OpenAPI_request_trigger_FromString(triggers_local_nonprimitive->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *serv_area_res = cJSON_GetObjectItemCaseSensitive(policy_association_update_requestJSON, "servAreaRes");
|
||||
|
||||
OpenAPI_service_area_restriction_t *serv_area_res_local_nonprim = NULL;
|
||||
if (serv_area_res) {
|
||||
serv_area_res_local_nonprim = OpenAPI_service_area_restriction_parseFromJSON(serv_area_res);
|
||||
}
|
||||
|
||||
cJSON *wl_serv_area_res = cJSON_GetObjectItemCaseSensitive(policy_association_update_requestJSON, "wlServAreaRes");
|
||||
|
||||
OpenAPI_wireline_service_area_restriction_t *wl_serv_area_res_local_nonprim = NULL;
|
||||
if (wl_serv_area_res) {
|
||||
wl_serv_area_res_local_nonprim = OpenAPI_wireline_service_area_restriction_parseFromJSON(wl_serv_area_res);
|
||||
}
|
||||
|
||||
cJSON *rfsp = cJSON_GetObjectItemCaseSensitive(policy_association_update_requestJSON, "rfsp");
|
||||
|
||||
if (rfsp) {
|
||||
if (!cJSON_IsNumber(rfsp)) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_parseFromJSON() failed [rfsp]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *smf_sel_info = cJSON_GetObjectItemCaseSensitive(policy_association_update_requestJSON, "smfSelInfo");
|
||||
|
||||
OpenAPI_smf_selection_data_t *smf_sel_info_local_nonprim = NULL;
|
||||
if (smf_sel_info) {
|
||||
smf_sel_info_local_nonprim = OpenAPI_smf_selection_data_parseFromJSON(smf_sel_info);
|
||||
}
|
||||
|
||||
cJSON *ue_ambr = cJSON_GetObjectItemCaseSensitive(policy_association_update_requestJSON, "ueAmbr");
|
||||
|
||||
OpenAPI_ambr_t *ue_ambr_local_nonprim = NULL;
|
||||
if (ue_ambr) {
|
||||
ue_ambr_local_nonprim = OpenAPI_ambr_parseFromJSON(ue_ambr);
|
||||
}
|
||||
|
||||
cJSON *rg_tmbr = cJSON_GetObjectItemCaseSensitive(policy_association_update_requestJSON, "rgTmbr");
|
||||
|
||||
OpenAPI_ambr_t *rg_tmbr_local_nonprim = NULL;
|
||||
if (rg_tmbr) {
|
||||
rg_tmbr_local_nonprim = OpenAPI_ambr_parseFromJSON(rg_tmbr);
|
||||
}
|
||||
|
||||
cJSON *pra_statuses = cJSON_GetObjectItemCaseSensitive(policy_association_update_requestJSON, "praStatuses");
|
||||
|
||||
OpenAPI_list_t *pra_statusesList;
|
||||
if (pra_statuses) {
|
||||
cJSON *pra_statuses_local_map;
|
||||
if (!cJSON_IsObject(pra_statuses)) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_parseFromJSON() failed [pra_statuses]");
|
||||
goto end;
|
||||
}
|
||||
pra_statusesList = OpenAPI_list_create();
|
||||
OpenAPI_map_t *localMapKeyPair = NULL;
|
||||
cJSON_ArrayForEach(pra_statuses_local_map, pra_statuses) {
|
||||
cJSON *localMapObject = pra_statuses_local_map;
|
||||
if (!cJSON_IsObject(pra_statuses_local_map)) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_parseFromJSON() failed [pra_statuses]");
|
||||
goto end;
|
||||
}
|
||||
localMapKeyPair = OpenAPI_map_create(
|
||||
localMapObject->string, OpenAPI_presence_info_parseFromJSON(localMapObject));
|
||||
OpenAPI_list_add(pra_statusesList, localMapKeyPair);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *user_loc = cJSON_GetObjectItemCaseSensitive(policy_association_update_requestJSON, "userLoc");
|
||||
|
||||
OpenAPI_user_location_t *user_loc_local_nonprim = NULL;
|
||||
if (user_loc) {
|
||||
user_loc_local_nonprim = OpenAPI_user_location_parseFromJSON(user_loc);
|
||||
}
|
||||
|
||||
cJSON *allowed_snssais = cJSON_GetObjectItemCaseSensitive(policy_association_update_requestJSON, "allowedSnssais");
|
||||
|
||||
OpenAPI_list_t *allowed_snssaisList;
|
||||
if (allowed_snssais) {
|
||||
cJSON *allowed_snssais_local_nonprimitive;
|
||||
if (!cJSON_IsArray(allowed_snssais)) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_parseFromJSON() failed [allowed_snssais]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
allowed_snssaisList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(allowed_snssais_local_nonprimitive, allowed_snssais ) {
|
||||
if (!cJSON_IsObject(allowed_snssais_local_nonprimitive)) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_parseFromJSON() failed [allowed_snssais]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_snssai_t *allowed_snssaisItem = OpenAPI_snssai_parseFromJSON(allowed_snssais_local_nonprimitive);
|
||||
|
||||
OpenAPI_list_add(allowed_snssaisList, allowed_snssaisItem);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *mapping_snssais = cJSON_GetObjectItemCaseSensitive(policy_association_update_requestJSON, "mappingSnssais");
|
||||
|
||||
OpenAPI_list_t *mapping_snssaisList;
|
||||
if (mapping_snssais) {
|
||||
cJSON *mapping_snssais_local_nonprimitive;
|
||||
if (!cJSON_IsArray(mapping_snssais)) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_parseFromJSON() failed [mapping_snssais]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
mapping_snssaisList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(mapping_snssais_local_nonprimitive, mapping_snssais ) {
|
||||
if (!cJSON_IsObject(mapping_snssais_local_nonprimitive)) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_parseFromJSON() failed [mapping_snssais]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_mapping_of_snssai_t *mapping_snssaisItem = OpenAPI_mapping_of_snssai_parseFromJSON(mapping_snssais_local_nonprimitive);
|
||||
|
||||
OpenAPI_list_add(mapping_snssaisList, mapping_snssaisItem);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *access_types = cJSON_GetObjectItemCaseSensitive(policy_association_update_requestJSON, "accessTypes");
|
||||
|
||||
OpenAPI_list_t *access_typesList;
|
||||
if (access_types) {
|
||||
cJSON *access_types_local_nonprimitive;
|
||||
if (!cJSON_IsArray(access_types)) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_parseFromJSON() failed [access_types]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
access_typesList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(access_types_local_nonprimitive, access_types ) {
|
||||
if (!cJSON_IsString(access_types_local_nonprimitive)) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_parseFromJSON() failed [access_types]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_list_add(access_typesList, (void *)OpenAPI_access_type_FromString(access_types_local_nonprimitive->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *rat_types = cJSON_GetObjectItemCaseSensitive(policy_association_update_requestJSON, "ratTypes");
|
||||
|
||||
OpenAPI_list_t *rat_typesList;
|
||||
if (rat_types) {
|
||||
cJSON *rat_types_local_nonprimitive;
|
||||
if (!cJSON_IsArray(rat_types)) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_parseFromJSON() failed [rat_types]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
rat_typesList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(rat_types_local_nonprimitive, rat_types ) {
|
||||
if (!cJSON_IsString(rat_types_local_nonprimitive)) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_parseFromJSON() failed [rat_types]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_list_add(rat_typesList, (void *)OpenAPI_rat_type_FromString(rat_types_local_nonprimitive->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *n3g_allowed_snssais = cJSON_GetObjectItemCaseSensitive(policy_association_update_requestJSON, "n3gAllowedSnssais");
|
||||
|
||||
OpenAPI_list_t *n3g_allowed_snssaisList;
|
||||
if (n3g_allowed_snssais) {
|
||||
cJSON *n3g_allowed_snssais_local_nonprimitive;
|
||||
if (!cJSON_IsArray(n3g_allowed_snssais)) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_parseFromJSON() failed [n3g_allowed_snssais]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
n3g_allowed_snssaisList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(n3g_allowed_snssais_local_nonprimitive, n3g_allowed_snssais ) {
|
||||
if (!cJSON_IsObject(n3g_allowed_snssais_local_nonprimitive)) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_parseFromJSON() failed [n3g_allowed_snssais]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_snssai_t *n3g_allowed_snssaisItem = OpenAPI_snssai_parseFromJSON(n3g_allowed_snssais_local_nonprimitive);
|
||||
|
||||
OpenAPI_list_add(n3g_allowed_snssaisList, n3g_allowed_snssaisItem);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *trace_req = cJSON_GetObjectItemCaseSensitive(policy_association_update_requestJSON, "traceReq");
|
||||
|
||||
OpenAPI_trace_data_t *trace_req_local_nonprim = NULL;
|
||||
if (trace_req) {
|
||||
trace_req_local_nonprim = OpenAPI_trace_data_parseFromJSON(trace_req);
|
||||
}
|
||||
|
||||
cJSON *guami = cJSON_GetObjectItemCaseSensitive(policy_association_update_requestJSON, "guami");
|
||||
|
||||
OpenAPI_guami_t *guami_local_nonprim = NULL;
|
||||
if (guami) {
|
||||
guami_local_nonprim = OpenAPI_guami_parseFromJSON(guami);
|
||||
}
|
||||
|
||||
policy_association_update_request_local_var = OpenAPI_policy_association_update_request_create (
|
||||
notification_uri ? ogs_strdup(notification_uri->valuestring) : NULL,
|
||||
alt_notif_ipv4_addrs ? alt_notif_ipv4_addrsList : NULL,
|
||||
alt_notif_ipv6_addrs ? alt_notif_ipv6_addrsList : NULL,
|
||||
triggers ? triggersList : NULL,
|
||||
serv_area_res ? serv_area_res_local_nonprim : NULL,
|
||||
wl_serv_area_res ? wl_serv_area_res_local_nonprim : NULL,
|
||||
rfsp ? rfsp->valuedouble : 0,
|
||||
smf_sel_info ? smf_sel_info_local_nonprim : NULL,
|
||||
ue_ambr ? ue_ambr_local_nonprim : NULL,
|
||||
rg_tmbr ? rg_tmbr_local_nonprim : NULL,
|
||||
pra_statuses ? pra_statusesList : NULL,
|
||||
user_loc ? user_loc_local_nonprim : NULL,
|
||||
allowed_snssais ? allowed_snssaisList : NULL,
|
||||
mapping_snssais ? mapping_snssaisList : NULL,
|
||||
access_types ? access_typesList : NULL,
|
||||
rat_types ? rat_typesList : NULL,
|
||||
n3g_allowed_snssais ? n3g_allowed_snssaisList : NULL,
|
||||
trace_req ? trace_req_local_nonprim : NULL,
|
||||
guami ? guami_local_nonprim : NULL
|
||||
);
|
||||
|
||||
return policy_association_update_request_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_policy_association_update_request_t *OpenAPI_policy_association_update_request_copy(OpenAPI_policy_association_update_request_t *dst, OpenAPI_policy_association_update_request_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_policy_association_update_request_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_policy_association_update_request_free(dst);
|
||||
dst = OpenAPI_policy_association_update_request_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
87
lib/sbi/openapi/model/policy_association_update_request.h
Normal file
87
lib/sbi/openapi/model/policy_association_update_request.h
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* policy_association_update_request.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_policy_association_update_request_H_
|
||||
#define _OpenAPI_policy_association_update_request_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
#include "access_type.h"
|
||||
#include "ambr.h"
|
||||
#include "guami.h"
|
||||
#include "mapping_of_snssai.h"
|
||||
#include "presence_info.h"
|
||||
#include "rat_type.h"
|
||||
#include "request_trigger.h"
|
||||
#include "service_area_restriction.h"
|
||||
#include "smf_selection_data.h"
|
||||
#include "snssai.h"
|
||||
#include "trace_data.h"
|
||||
#include "user_location.h"
|
||||
#include "wireline_service_area_restriction.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_policy_association_update_request_s OpenAPI_policy_association_update_request_t;
|
||||
typedef struct OpenAPI_policy_association_update_request_s {
|
||||
char *notification_uri;
|
||||
OpenAPI_list_t *alt_notif_ipv4_addrs;
|
||||
OpenAPI_list_t *alt_notif_ipv6_addrs;
|
||||
OpenAPI_list_t *triggers;
|
||||
struct OpenAPI_service_area_restriction_s *serv_area_res;
|
||||
struct OpenAPI_wireline_service_area_restriction_s *wl_serv_area_res;
|
||||
int rfsp;
|
||||
struct OpenAPI_smf_selection_data_s *smf_sel_info;
|
||||
struct OpenAPI_ambr_s *ue_ambr;
|
||||
struct OpenAPI_ambr_s *rg_tmbr;
|
||||
OpenAPI_list_t* pra_statuses;
|
||||
struct OpenAPI_user_location_s *user_loc;
|
||||
OpenAPI_list_t *allowed_snssais;
|
||||
OpenAPI_list_t *mapping_snssais;
|
||||
OpenAPI_list_t *access_types;
|
||||
OpenAPI_list_t *rat_types;
|
||||
OpenAPI_list_t *n3g_allowed_snssais;
|
||||
struct OpenAPI_trace_data_s *trace_req;
|
||||
struct OpenAPI_guami_s *guami;
|
||||
} OpenAPI_policy_association_update_request_t;
|
||||
|
||||
OpenAPI_policy_association_update_request_t *OpenAPI_policy_association_update_request_create(
|
||||
char *notification_uri,
|
||||
OpenAPI_list_t *alt_notif_ipv4_addrs,
|
||||
OpenAPI_list_t *alt_notif_ipv6_addrs,
|
||||
OpenAPI_list_t *triggers,
|
||||
OpenAPI_service_area_restriction_t *serv_area_res,
|
||||
OpenAPI_wireline_service_area_restriction_t *wl_serv_area_res,
|
||||
int rfsp,
|
||||
OpenAPI_smf_selection_data_t *smf_sel_info,
|
||||
OpenAPI_ambr_t *ue_ambr,
|
||||
OpenAPI_ambr_t *rg_tmbr,
|
||||
OpenAPI_list_t* pra_statuses,
|
||||
OpenAPI_user_location_t *user_loc,
|
||||
OpenAPI_list_t *allowed_snssais,
|
||||
OpenAPI_list_t *mapping_snssais,
|
||||
OpenAPI_list_t *access_types,
|
||||
OpenAPI_list_t *rat_types,
|
||||
OpenAPI_list_t *n3g_allowed_snssais,
|
||||
OpenAPI_trace_data_t *trace_req,
|
||||
OpenAPI_guami_t *guami
|
||||
);
|
||||
void OpenAPI_policy_association_update_request_free(OpenAPI_policy_association_update_request_t *policy_association_update_request);
|
||||
OpenAPI_policy_association_update_request_t *OpenAPI_policy_association_update_request_parseFromJSON(cJSON *policy_association_update_requestJSON);
|
||||
cJSON *OpenAPI_policy_association_update_request_convertToJSON(OpenAPI_policy_association_update_request_t *policy_association_update_request);
|
||||
OpenAPI_policy_association_update_request_t *OpenAPI_policy_association_update_request_copy(OpenAPI_policy_association_update_request_t *dst, OpenAPI_policy_association_update_request_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_policy_association_update_request_H_ */
|
||||
|
||||
85
lib/sbi/openapi/model/policy_control_request_trigger.c
Normal file
85
lib/sbi/openapi/model/policy_control_request_trigger.c
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "policy_control_request_trigger.h"
|
||||
|
||||
OpenAPI_policy_control_request_trigger_t *OpenAPI_policy_control_request_trigger_create(
|
||||
)
|
||||
{
|
||||
OpenAPI_policy_control_request_trigger_t *policy_control_request_trigger_local_var = OpenAPI_malloc(sizeof(OpenAPI_policy_control_request_trigger_t));
|
||||
if (!policy_control_request_trigger_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return policy_control_request_trigger_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_policy_control_request_trigger_free(OpenAPI_policy_control_request_trigger_t *policy_control_request_trigger)
|
||||
{
|
||||
if (NULL == policy_control_request_trigger) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(policy_control_request_trigger);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_policy_control_request_trigger_convertToJSON(OpenAPI_policy_control_request_trigger_t *policy_control_request_trigger)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (policy_control_request_trigger == NULL) {
|
||||
ogs_error("OpenAPI_policy_control_request_trigger_convertToJSON() failed [PolicyControlRequestTrigger]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_policy_control_request_trigger_t *OpenAPI_policy_control_request_trigger_parseFromJSON(cJSON *policy_control_request_triggerJSON)
|
||||
{
|
||||
OpenAPI_policy_control_request_trigger_t *policy_control_request_trigger_local_var = NULL;
|
||||
policy_control_request_trigger_local_var = OpenAPI_policy_control_request_trigger_create (
|
||||
);
|
||||
|
||||
return policy_control_request_trigger_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_policy_control_request_trigger_t *OpenAPI_policy_control_request_trigger_copy(OpenAPI_policy_control_request_trigger_t *dst, OpenAPI_policy_control_request_trigger_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_policy_control_request_trigger_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_policy_control_request_trigger_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_policy_control_request_trigger_free(dst);
|
||||
dst = OpenAPI_policy_control_request_trigger_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
36
lib/sbi/openapi/model/policy_control_request_trigger.h
Normal file
36
lib/sbi/openapi/model/policy_control_request_trigger.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* policy_control_request_trigger.h
|
||||
*
|
||||
* Possible values are - PLMN_CH: PLMN Change - RES_MO_RE: A request for resource modification has been received by the SMF. The SMF always reports to the PCF. - AC_TY_CH: Access Type Change - UE_IP_CH: UE IP address change. The SMF always reports to the PCF. - UE_MAC_CH: A new UE MAC address is detected or a used UE MAC address is inactive for a specific period - AN_CH_COR: Access Network Charging Correlation Information - US_RE: The PDU Session or the Monitoring key specific resources consumed by a UE either reached the threshold or needs to be reported for other reasons. - APP_STA: The start of application traffic has been detected. - APP_STO: The stop of application traffic has been detected. - AN_INFO: Access Network Information report - CM_SES_FAIL: Credit management session failure - PS_DA_OFF: The SMF reports when the 3GPP PS Data Off status changes. The SMF always reports to the PCF. - DEF_QOS_CH: Default QoS Change. The SMF always reports to the PCF. - SE_AMBR_CH: Session AMBR Change. The SMF always reports to the PCF. - QOS_NOTIF: The SMF notify the PCF when receiving notification from RAN that QoS targets of the QoS Flow cannot be guranteed or gurateed again. - NO_CREDIT: Out of credit - REALLO_OF_CREDIT: Reallocation of credit - PRA_CH: Change of UE presence in Presence Reporting Area - SAREA_CH: Location Change with respect to the Serving Area - SCNN_CH: Location Change with respect to the Serving CN node - RE_TIMEOUT: Indicates the SMF generated the request because there has been a PCC revalidation timeout - RES_RELEASE: Indicate that the SMF can inform the PCF of the outcome of the release of resources for those rules that require so. - SUCC_RES_ALLO: Indicates that the requested rule data is the successful resource allocation. - RAT_TY_CH: RAT Type Change. - REF_QOS_IND_CH: Reflective QoS indication Change - NUM_OF_PACKET_FILTER: Indicates that the SMF shall report the number of supported packet filter for signalled QoS rules - UE_STATUS_RESUME: Indicates that the UE’s status is resumed. - UE_TZ_CH: UE Time Zone Change - AUTH_PROF_CH: The DN-AAA authorization profile index has changed - QOS_MONITORING: Indicate that the SMF notifies the PCF of the QoS Monitoring information. - SCELL_CH: Location Change with respect to the Serving Cell. Only applicable to the interworking scenario as defined in Annex B. - EPS_FALLBACK: EPS Fallback report is enabled in the SMF. - MA_PDU: UE Indicates that the SMF notifies the PCF of the MA PDU session request - TSN_ETHER_PORT: Manageable Ethernet port detected - TSN_CONTAINER: Port management container detected. - 5G_RG_JOIN: The 5G-RG has joined to an IP Multicast Group. - 5G_RG_LEAVE: The 5G-RG has left an IP Multicast Group.
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_policy_control_request_trigger_H_
|
||||
#define _OpenAPI_policy_control_request_trigger_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_policy_control_request_trigger_s OpenAPI_policy_control_request_trigger_t;
|
||||
typedef struct OpenAPI_policy_control_request_trigger_s {
|
||||
} OpenAPI_policy_control_request_trigger_t;
|
||||
|
||||
OpenAPI_policy_control_request_trigger_t *OpenAPI_policy_control_request_trigger_create(
|
||||
);
|
||||
void OpenAPI_policy_control_request_trigger_free(OpenAPI_policy_control_request_trigger_t *policy_control_request_trigger);
|
||||
OpenAPI_policy_control_request_trigger_t *OpenAPI_policy_control_request_trigger_parseFromJSON(cJSON *policy_control_request_triggerJSON);
|
||||
cJSON *OpenAPI_policy_control_request_trigger_convertToJSON(OpenAPI_policy_control_request_trigger_t *policy_control_request_trigger);
|
||||
OpenAPI_policy_control_request_trigger_t *OpenAPI_policy_control_request_trigger_copy(OpenAPI_policy_control_request_trigger_t *dst, OpenAPI_policy_control_request_trigger_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_policy_control_request_trigger_H_ */
|
||||
|
||||
343
lib/sbi/openapi/model/policy_update.c
Normal file
343
lib/sbi/openapi/model/policy_update.c
Normal file
|
|
@ -0,0 +1,343 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "policy_update.h"
|
||||
|
||||
OpenAPI_policy_update_t *OpenAPI_policy_update_create(
|
||||
char *resource_uri,
|
||||
OpenAPI_list_t *triggers,
|
||||
OpenAPI_service_area_restriction_t *serv_area_res,
|
||||
OpenAPI_wireline_service_area_restriction_t *wl_serv_area_res,
|
||||
int rfsp,
|
||||
OpenAPI_smf_selection_data_t *smf_sel_info,
|
||||
OpenAPI_ambr_t *ue_ambr,
|
||||
OpenAPI_ambr_t *rg_tmbr,
|
||||
OpenAPI_list_t* pras
|
||||
)
|
||||
{
|
||||
OpenAPI_policy_update_t *policy_update_local_var = OpenAPI_malloc(sizeof(OpenAPI_policy_update_t));
|
||||
if (!policy_update_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
policy_update_local_var->resource_uri = resource_uri;
|
||||
policy_update_local_var->triggers = triggers;
|
||||
policy_update_local_var->serv_area_res = serv_area_res;
|
||||
policy_update_local_var->wl_serv_area_res = wl_serv_area_res;
|
||||
policy_update_local_var->rfsp = rfsp;
|
||||
policy_update_local_var->smf_sel_info = smf_sel_info;
|
||||
policy_update_local_var->ue_ambr = ue_ambr;
|
||||
policy_update_local_var->rg_tmbr = rg_tmbr;
|
||||
policy_update_local_var->pras = pras;
|
||||
|
||||
return policy_update_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_policy_update_free(OpenAPI_policy_update_t *policy_update)
|
||||
{
|
||||
if (NULL == policy_update) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(policy_update->resource_uri);
|
||||
OpenAPI_list_free(policy_update->triggers);
|
||||
OpenAPI_service_area_restriction_free(policy_update->serv_area_res);
|
||||
OpenAPI_wireline_service_area_restriction_free(policy_update->wl_serv_area_res);
|
||||
OpenAPI_smf_selection_data_free(policy_update->smf_sel_info);
|
||||
OpenAPI_ambr_free(policy_update->ue_ambr);
|
||||
OpenAPI_ambr_free(policy_update->rg_tmbr);
|
||||
OpenAPI_list_for_each(policy_update->pras, node) {
|
||||
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
|
||||
OpenAPI_presence_info_rm_free(localKeyValue->value);
|
||||
ogs_free(localKeyValue);
|
||||
}
|
||||
OpenAPI_list_free(policy_update->pras);
|
||||
ogs_free(policy_update);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_policy_update_convertToJSON(OpenAPI_policy_update_t *policy_update)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (policy_update == NULL) {
|
||||
ogs_error("OpenAPI_policy_update_convertToJSON() failed [PolicyUpdate]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (!policy_update->resource_uri) {
|
||||
ogs_error("OpenAPI_policy_update_convertToJSON() failed [resource_uri]");
|
||||
goto end;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "resourceUri", policy_update->resource_uri) == NULL) {
|
||||
ogs_error("OpenAPI_policy_update_convertToJSON() failed [resource_uri]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (policy_update->triggers) {
|
||||
cJSON *triggers = cJSON_AddArrayToObject(item, "triggers");
|
||||
if (triggers == NULL) {
|
||||
ogs_error("OpenAPI_policy_update_convertToJSON() failed [triggers]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_lnode_t *triggers_node;
|
||||
OpenAPI_list_for_each(policy_update->triggers, triggers_node) {
|
||||
if (cJSON_AddStringToObject(triggers, "", OpenAPI_request_trigger_ToString((OpenAPI_request_trigger_e)triggers_node->data)) == NULL) {
|
||||
ogs_error("OpenAPI_policy_update_convertToJSON() failed [triggers]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_update->serv_area_res) {
|
||||
cJSON *serv_area_res_local_JSON = OpenAPI_service_area_restriction_convertToJSON(policy_update->serv_area_res);
|
||||
if (serv_area_res_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_policy_update_convertToJSON() failed [serv_area_res]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "servAreaRes", serv_area_res_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_policy_update_convertToJSON() failed [serv_area_res]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_update->wl_serv_area_res) {
|
||||
cJSON *wl_serv_area_res_local_JSON = OpenAPI_wireline_service_area_restriction_convertToJSON(policy_update->wl_serv_area_res);
|
||||
if (wl_serv_area_res_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_policy_update_convertToJSON() failed [wl_serv_area_res]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "wlServAreaRes", wl_serv_area_res_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_policy_update_convertToJSON() failed [wl_serv_area_res]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_update->rfsp) {
|
||||
if (cJSON_AddNumberToObject(item, "rfsp", policy_update->rfsp) == NULL) {
|
||||
ogs_error("OpenAPI_policy_update_convertToJSON() failed [rfsp]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_update->smf_sel_info) {
|
||||
cJSON *smf_sel_info_local_JSON = OpenAPI_smf_selection_data_convertToJSON(policy_update->smf_sel_info);
|
||||
if (smf_sel_info_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_policy_update_convertToJSON() failed [smf_sel_info]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "smfSelInfo", smf_sel_info_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_policy_update_convertToJSON() failed [smf_sel_info]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_update->ue_ambr) {
|
||||
cJSON *ue_ambr_local_JSON = OpenAPI_ambr_convertToJSON(policy_update->ue_ambr);
|
||||
if (ue_ambr_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_policy_update_convertToJSON() failed [ue_ambr]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "ueAmbr", ue_ambr_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_policy_update_convertToJSON() failed [ue_ambr]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_update->rg_tmbr) {
|
||||
cJSON *rg_tmbr_local_JSON = OpenAPI_ambr_convertToJSON(policy_update->rg_tmbr);
|
||||
if (rg_tmbr_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_policy_update_convertToJSON() failed [rg_tmbr]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "rgTmbr", rg_tmbr_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_policy_update_convertToJSON() failed [rg_tmbr]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy_update->pras) {
|
||||
cJSON *pras = cJSON_AddObjectToObject(item, "pras");
|
||||
if (pras == NULL) {
|
||||
ogs_error("OpenAPI_policy_update_convertToJSON() failed [pras]");
|
||||
goto end;
|
||||
}
|
||||
cJSON *localMapObject = pras;
|
||||
OpenAPI_lnode_t *pras_node;
|
||||
if (policy_update->pras) {
|
||||
OpenAPI_list_for_each(policy_update->pras, pras_node) {
|
||||
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)pras_node->data;
|
||||
cJSON *itemLocal = OpenAPI_presence_info_rm_convertToJSON(localKeyValue->value);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_policy_update_convertToJSON() failed [pras]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(pras, localKeyValue->key, itemLocal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_policy_update_t *OpenAPI_policy_update_parseFromJSON(cJSON *policy_updateJSON)
|
||||
{
|
||||
OpenAPI_policy_update_t *policy_update_local_var = NULL;
|
||||
cJSON *resource_uri = cJSON_GetObjectItemCaseSensitive(policy_updateJSON, "resourceUri");
|
||||
if (!resource_uri) {
|
||||
ogs_error("OpenAPI_policy_update_parseFromJSON() failed [resource_uri]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
if (!cJSON_IsString(resource_uri)) {
|
||||
ogs_error("OpenAPI_policy_update_parseFromJSON() failed [resource_uri]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *triggers = cJSON_GetObjectItemCaseSensitive(policy_updateJSON, "triggers");
|
||||
|
||||
OpenAPI_list_t *triggersList;
|
||||
if (triggers) {
|
||||
cJSON *triggers_local_nonprimitive;
|
||||
if (!cJSON_IsArray(triggers)) {
|
||||
ogs_error("OpenAPI_policy_update_parseFromJSON() failed [triggers]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
triggersList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(triggers_local_nonprimitive, triggers ) {
|
||||
if (!cJSON_IsString(triggers_local_nonprimitive)) {
|
||||
ogs_error("OpenAPI_policy_update_parseFromJSON() failed [triggers]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_list_add(triggersList, (void *)OpenAPI_request_trigger_FromString(triggers_local_nonprimitive->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *serv_area_res = cJSON_GetObjectItemCaseSensitive(policy_updateJSON, "servAreaRes");
|
||||
|
||||
OpenAPI_service_area_restriction_t *serv_area_res_local_nonprim = NULL;
|
||||
if (serv_area_res) {
|
||||
serv_area_res_local_nonprim = OpenAPI_service_area_restriction_parseFromJSON(serv_area_res);
|
||||
}
|
||||
|
||||
cJSON *wl_serv_area_res = cJSON_GetObjectItemCaseSensitive(policy_updateJSON, "wlServAreaRes");
|
||||
|
||||
OpenAPI_wireline_service_area_restriction_t *wl_serv_area_res_local_nonprim = NULL;
|
||||
if (wl_serv_area_res) {
|
||||
wl_serv_area_res_local_nonprim = OpenAPI_wireline_service_area_restriction_parseFromJSON(wl_serv_area_res);
|
||||
}
|
||||
|
||||
cJSON *rfsp = cJSON_GetObjectItemCaseSensitive(policy_updateJSON, "rfsp");
|
||||
|
||||
if (rfsp) {
|
||||
if (!cJSON_IsNumber(rfsp)) {
|
||||
ogs_error("OpenAPI_policy_update_parseFromJSON() failed [rfsp]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *smf_sel_info = cJSON_GetObjectItemCaseSensitive(policy_updateJSON, "smfSelInfo");
|
||||
|
||||
OpenAPI_smf_selection_data_t *smf_sel_info_local_nonprim = NULL;
|
||||
if (smf_sel_info) {
|
||||
smf_sel_info_local_nonprim = OpenAPI_smf_selection_data_parseFromJSON(smf_sel_info);
|
||||
}
|
||||
|
||||
cJSON *ue_ambr = cJSON_GetObjectItemCaseSensitive(policy_updateJSON, "ueAmbr");
|
||||
|
||||
OpenAPI_ambr_t *ue_ambr_local_nonprim = NULL;
|
||||
if (ue_ambr) {
|
||||
ue_ambr_local_nonprim = OpenAPI_ambr_parseFromJSON(ue_ambr);
|
||||
}
|
||||
|
||||
cJSON *rg_tmbr = cJSON_GetObjectItemCaseSensitive(policy_updateJSON, "rgTmbr");
|
||||
|
||||
OpenAPI_ambr_t *rg_tmbr_local_nonprim = NULL;
|
||||
if (rg_tmbr) {
|
||||
rg_tmbr_local_nonprim = OpenAPI_ambr_parseFromJSON(rg_tmbr);
|
||||
}
|
||||
|
||||
cJSON *pras = cJSON_GetObjectItemCaseSensitive(policy_updateJSON, "pras");
|
||||
|
||||
OpenAPI_list_t *prasList;
|
||||
if (pras) {
|
||||
cJSON *pras_local_map;
|
||||
if (!cJSON_IsObject(pras)) {
|
||||
ogs_error("OpenAPI_policy_update_parseFromJSON() failed [pras]");
|
||||
goto end;
|
||||
}
|
||||
prasList = OpenAPI_list_create();
|
||||
OpenAPI_map_t *localMapKeyPair = NULL;
|
||||
cJSON_ArrayForEach(pras_local_map, pras) {
|
||||
cJSON *localMapObject = pras_local_map;
|
||||
if (!cJSON_IsObject(pras_local_map)) {
|
||||
ogs_error("OpenAPI_policy_update_parseFromJSON() failed [pras]");
|
||||
goto end;
|
||||
}
|
||||
localMapKeyPair = OpenAPI_map_create(
|
||||
localMapObject->string, OpenAPI_presence_info_rm_parseFromJSON(localMapObject));
|
||||
OpenAPI_list_add(prasList, localMapKeyPair);
|
||||
}
|
||||
}
|
||||
|
||||
policy_update_local_var = OpenAPI_policy_update_create (
|
||||
ogs_strdup(resource_uri->valuestring),
|
||||
triggers ? triggersList : NULL,
|
||||
serv_area_res ? serv_area_res_local_nonprim : NULL,
|
||||
wl_serv_area_res ? wl_serv_area_res_local_nonprim : NULL,
|
||||
rfsp ? rfsp->valuedouble : 0,
|
||||
smf_sel_info ? smf_sel_info_local_nonprim : NULL,
|
||||
ue_ambr ? ue_ambr_local_nonprim : NULL,
|
||||
rg_tmbr ? rg_tmbr_local_nonprim : NULL,
|
||||
pras ? prasList : NULL
|
||||
);
|
||||
|
||||
return policy_update_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_policy_update_t *OpenAPI_policy_update_copy(OpenAPI_policy_update_t *dst, OpenAPI_policy_update_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_policy_update_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_policy_update_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_policy_update_free(dst);
|
||||
dst = OpenAPI_policy_update_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
60
lib/sbi/openapi/model/policy_update.h
Normal file
60
lib/sbi/openapi/model/policy_update.h
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* policy_update.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_policy_update_H_
|
||||
#define _OpenAPI_policy_update_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
#include "ambr.h"
|
||||
#include "presence_info_rm.h"
|
||||
#include "request_trigger.h"
|
||||
#include "service_area_restriction.h"
|
||||
#include "smf_selection_data.h"
|
||||
#include "wireline_service_area_restriction.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_policy_update_s OpenAPI_policy_update_t;
|
||||
typedef struct OpenAPI_policy_update_s {
|
||||
char *resource_uri;
|
||||
OpenAPI_list_t *triggers;
|
||||
struct OpenAPI_service_area_restriction_s *serv_area_res;
|
||||
struct OpenAPI_wireline_service_area_restriction_s *wl_serv_area_res;
|
||||
int rfsp;
|
||||
struct OpenAPI_smf_selection_data_s *smf_sel_info;
|
||||
struct OpenAPI_ambr_s *ue_ambr;
|
||||
struct OpenAPI_ambr_s *rg_tmbr;
|
||||
OpenAPI_list_t* pras;
|
||||
} OpenAPI_policy_update_t;
|
||||
|
||||
OpenAPI_policy_update_t *OpenAPI_policy_update_create(
|
||||
char *resource_uri,
|
||||
OpenAPI_list_t *triggers,
|
||||
OpenAPI_service_area_restriction_t *serv_area_res,
|
||||
OpenAPI_wireline_service_area_restriction_t *wl_serv_area_res,
|
||||
int rfsp,
|
||||
OpenAPI_smf_selection_data_t *smf_sel_info,
|
||||
OpenAPI_ambr_t *ue_ambr,
|
||||
OpenAPI_ambr_t *rg_tmbr,
|
||||
OpenAPI_list_t* pras
|
||||
);
|
||||
void OpenAPI_policy_update_free(OpenAPI_policy_update_t *policy_update);
|
||||
OpenAPI_policy_update_t *OpenAPI_policy_update_parseFromJSON(cJSON *policy_updateJSON);
|
||||
cJSON *OpenAPI_policy_update_convertToJSON(OpenAPI_policy_update_t *policy_update);
|
||||
OpenAPI_policy_update_t *OpenAPI_policy_update_copy(OpenAPI_policy_update_t *dst, OpenAPI_policy_update_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_policy_update_H_ */
|
||||
|
||||
138
lib/sbi/openapi/model/port_management_container.c
Normal file
138
lib/sbi/openapi/model/port_management_container.c
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "port_management_container.h"
|
||||
|
||||
OpenAPI_port_management_container_t *OpenAPI_port_management_container_create(
|
||||
char port_man_cont,
|
||||
OpenAPI_tsn_port_identifier_t *port_identifier
|
||||
)
|
||||
{
|
||||
OpenAPI_port_management_container_t *port_management_container_local_var = OpenAPI_malloc(sizeof(OpenAPI_port_management_container_t));
|
||||
if (!port_management_container_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
port_management_container_local_var->port_man_cont = port_man_cont;
|
||||
port_management_container_local_var->port_identifier = port_identifier;
|
||||
|
||||
return port_management_container_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_port_management_container_free(OpenAPI_port_management_container_t *port_management_container)
|
||||
{
|
||||
if (NULL == port_management_container) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_tsn_port_identifier_free(port_management_container->port_identifier);
|
||||
ogs_free(port_management_container);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_port_management_container_convertToJSON(OpenAPI_port_management_container_t *port_management_container)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (port_management_container == NULL) {
|
||||
ogs_error("OpenAPI_port_management_container_convertToJSON() failed [PortManagementContainer]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (!port_management_container->port_man_cont) {
|
||||
ogs_error("OpenAPI_port_management_container_convertToJSON() failed [port_man_cont]");
|
||||
goto end;
|
||||
}
|
||||
if (cJSON_AddNumberToObject(item, "portManCont", port_management_container->port_man_cont) == NULL) {
|
||||
ogs_error("OpenAPI_port_management_container_convertToJSON() failed [port_man_cont]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!port_management_container->port_identifier) {
|
||||
ogs_error("OpenAPI_port_management_container_convertToJSON() failed [port_identifier]");
|
||||
goto end;
|
||||
}
|
||||
cJSON *port_identifier_local_JSON = OpenAPI_tsn_port_identifier_convertToJSON(port_management_container->port_identifier);
|
||||
if (port_identifier_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_port_management_container_convertToJSON() failed [port_identifier]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "portIdentifier", port_identifier_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_port_management_container_convertToJSON() failed [port_identifier]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_port_management_container_t *OpenAPI_port_management_container_parseFromJSON(cJSON *port_management_containerJSON)
|
||||
{
|
||||
OpenAPI_port_management_container_t *port_management_container_local_var = NULL;
|
||||
cJSON *port_man_cont = cJSON_GetObjectItemCaseSensitive(port_management_containerJSON, "portManCont");
|
||||
if (!port_man_cont) {
|
||||
ogs_error("OpenAPI_port_management_container_parseFromJSON() failed [port_man_cont]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
if (!cJSON_IsNumber(port_man_cont)) {
|
||||
ogs_error("OpenAPI_port_management_container_parseFromJSON() failed [port_man_cont]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *port_identifier = cJSON_GetObjectItemCaseSensitive(port_management_containerJSON, "portIdentifier");
|
||||
if (!port_identifier) {
|
||||
ogs_error("OpenAPI_port_management_container_parseFromJSON() failed [port_identifier]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_tsn_port_identifier_t *port_identifier_local_nonprim = NULL;
|
||||
|
||||
port_identifier_local_nonprim = OpenAPI_tsn_port_identifier_parseFromJSON(port_identifier);
|
||||
|
||||
port_management_container_local_var = OpenAPI_port_management_container_create (
|
||||
port_man_cont->valueint,
|
||||
port_identifier_local_nonprim
|
||||
);
|
||||
|
||||
return port_management_container_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_port_management_container_t *OpenAPI_port_management_container_copy(OpenAPI_port_management_container_t *dst, OpenAPI_port_management_container_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_port_management_container_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_port_management_container_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_port_management_container_free(dst);
|
||||
dst = OpenAPI_port_management_container_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
41
lib/sbi/openapi/model/port_management_container.h
Normal file
41
lib/sbi/openapi/model/port_management_container.h
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* port_management_container.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_port_management_container_H_
|
||||
#define _OpenAPI_port_management_container_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
#include "tsn_port_identifier.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_port_management_container_s OpenAPI_port_management_container_t;
|
||||
typedef struct OpenAPI_port_management_container_s {
|
||||
char port_man_cont;
|
||||
struct OpenAPI_tsn_port_identifier_s *port_identifier;
|
||||
} OpenAPI_port_management_container_t;
|
||||
|
||||
OpenAPI_port_management_container_t *OpenAPI_port_management_container_create(
|
||||
char port_man_cont,
|
||||
OpenAPI_tsn_port_identifier_t *port_identifier
|
||||
);
|
||||
void OpenAPI_port_management_container_free(OpenAPI_port_management_container_t *port_management_container);
|
||||
OpenAPI_port_management_container_t *OpenAPI_port_management_container_parseFromJSON(cJSON *port_management_containerJSON);
|
||||
cJSON *OpenAPI_port_management_container_convertToJSON(OpenAPI_port_management_container_t *port_management_container);
|
||||
OpenAPI_port_management_container_t *OpenAPI_port_management_container_copy(OpenAPI_port_management_container_t *dst, OpenAPI_port_management_container_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_port_management_container_H_ */
|
||||
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
OpenAPI_presence_info_t *OpenAPI_presence_info_create(
|
||||
char *pra_id,
|
||||
OpenAPI_presence_state_t *presence_state,
|
||||
OpenAPI_presence_state_e presence_state,
|
||||
OpenAPI_list_t *tracking_area_list,
|
||||
OpenAPI_list_t *ecgi_list,
|
||||
OpenAPI_list_t *ncgi_list,
|
||||
|
|
@ -36,7 +36,6 @@ void OpenAPI_presence_info_free(OpenAPI_presence_info_t *presence_info)
|
|||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(presence_info->pra_id);
|
||||
OpenAPI_presence_state_free(presence_info->presence_state);
|
||||
OpenAPI_list_for_each(presence_info->tracking_area_list, node) {
|
||||
OpenAPI_tai_free(node->data);
|
||||
}
|
||||
|
|
@ -78,13 +77,7 @@ cJSON *OpenAPI_presence_info_convertToJSON(OpenAPI_presence_info_t *presence_inf
|
|||
}
|
||||
|
||||
if (presence_info->presence_state) {
|
||||
cJSON *presence_state_local_JSON = OpenAPI_presence_state_convertToJSON(presence_info->presence_state);
|
||||
if (presence_state_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_presence_info_convertToJSON() failed [presence_state]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "presenceState", presence_state_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
if (cJSON_AddStringToObject(item, "presenceState", OpenAPI_presence_state_ToString(presence_info->presence_state)) == NULL) {
|
||||
ogs_error("OpenAPI_presence_info_convertToJSON() failed [presence_state]");
|
||||
goto end;
|
||||
}
|
||||
|
|
@ -208,9 +201,13 @@ OpenAPI_presence_info_t *OpenAPI_presence_info_parseFromJSON(cJSON *presence_inf
|
|||
|
||||
cJSON *presence_state = cJSON_GetObjectItemCaseSensitive(presence_infoJSON, "presenceState");
|
||||
|
||||
OpenAPI_presence_state_t *presence_state_local_nonprim = NULL;
|
||||
OpenAPI_presence_state_e presence_stateVariable;
|
||||
if (presence_state) {
|
||||
presence_state_local_nonprim = OpenAPI_presence_state_parseFromJSON(presence_state);
|
||||
if (!cJSON_IsString(presence_state)) {
|
||||
ogs_error("OpenAPI_presence_info_parseFromJSON() failed [presence_state]");
|
||||
goto end;
|
||||
}
|
||||
presence_stateVariable = OpenAPI_presence_state_FromString(presence_state->valuestring);
|
||||
}
|
||||
|
||||
cJSON *tracking_area_list = cJSON_GetObjectItemCaseSensitive(presence_infoJSON, "trackingAreaList");
|
||||
|
|
@ -330,7 +327,7 @@ OpenAPI_presence_info_t *OpenAPI_presence_info_parseFromJSON(cJSON *presence_inf
|
|||
|
||||
presence_info_local_var = OpenAPI_presence_info_create (
|
||||
pra_id ? ogs_strdup(pra_id->valuestring) : NULL,
|
||||
presence_state ? presence_state_local_nonprim : NULL,
|
||||
presence_state ? presence_stateVariable : 0,
|
||||
tracking_area_list ? tracking_area_listList : NULL,
|
||||
ecgi_list ? ecgi_listList : NULL,
|
||||
ncgi_list ? ncgi_listList : NULL,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ extern "C" {
|
|||
typedef struct OpenAPI_presence_info_s OpenAPI_presence_info_t;
|
||||
typedef struct OpenAPI_presence_info_s {
|
||||
char *pra_id;
|
||||
struct OpenAPI_presence_state_s *presence_state;
|
||||
OpenAPI_presence_state_e presence_state;
|
||||
OpenAPI_list_t *tracking_area_list;
|
||||
OpenAPI_list_t *ecgi_list;
|
||||
OpenAPI_list_t *ncgi_list;
|
||||
|
|
@ -35,7 +35,7 @@ typedef struct OpenAPI_presence_info_s {
|
|||
|
||||
OpenAPI_presence_info_t *OpenAPI_presence_info_create(
|
||||
char *pra_id,
|
||||
OpenAPI_presence_state_t *presence_state,
|
||||
OpenAPI_presence_state_e presence_state,
|
||||
OpenAPI_list_t *tracking_area_list,
|
||||
OpenAPI_list_t *ecgi_list,
|
||||
OpenAPI_list_t *ncgi_list,
|
||||
|
|
|
|||
376
lib/sbi/openapi/model/presence_info_rm.c
Normal file
376
lib/sbi/openapi/model/presence_info_rm.c
Normal file
|
|
@ -0,0 +1,376 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "presence_info_rm.h"
|
||||
|
||||
OpenAPI_presence_info_rm_t *OpenAPI_presence_info_rm_create(
|
||||
char *pra_id,
|
||||
OpenAPI_presence_state_e presence_state,
|
||||
OpenAPI_list_t *tracking_area_list,
|
||||
OpenAPI_list_t *ecgi_list,
|
||||
OpenAPI_list_t *ncgi_list,
|
||||
OpenAPI_list_t *global_ran_node_id_list,
|
||||
OpenAPI_list_t *globale_nb_id_list
|
||||
)
|
||||
{
|
||||
OpenAPI_presence_info_rm_t *presence_info_rm_local_var = OpenAPI_malloc(sizeof(OpenAPI_presence_info_rm_t));
|
||||
if (!presence_info_rm_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
presence_info_rm_local_var->pra_id = pra_id;
|
||||
presence_info_rm_local_var->presence_state = presence_state;
|
||||
presence_info_rm_local_var->tracking_area_list = tracking_area_list;
|
||||
presence_info_rm_local_var->ecgi_list = ecgi_list;
|
||||
presence_info_rm_local_var->ncgi_list = ncgi_list;
|
||||
presence_info_rm_local_var->global_ran_node_id_list = global_ran_node_id_list;
|
||||
presence_info_rm_local_var->globale_nb_id_list = globale_nb_id_list;
|
||||
|
||||
return presence_info_rm_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_presence_info_rm_free(OpenAPI_presence_info_rm_t *presence_info_rm)
|
||||
{
|
||||
if (NULL == presence_info_rm) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(presence_info_rm->pra_id);
|
||||
OpenAPI_list_for_each(presence_info_rm->tracking_area_list, node) {
|
||||
OpenAPI_tai_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(presence_info_rm->tracking_area_list);
|
||||
OpenAPI_list_for_each(presence_info_rm->ecgi_list, node) {
|
||||
OpenAPI_ecgi_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(presence_info_rm->ecgi_list);
|
||||
OpenAPI_list_for_each(presence_info_rm->ncgi_list, node) {
|
||||
OpenAPI_ncgi_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(presence_info_rm->ncgi_list);
|
||||
OpenAPI_list_for_each(presence_info_rm->global_ran_node_id_list, node) {
|
||||
OpenAPI_global_ran_node_id_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(presence_info_rm->global_ran_node_id_list);
|
||||
OpenAPI_list_for_each(presence_info_rm->globale_nb_id_list, node) {
|
||||
OpenAPI_global_ran_node_id_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(presence_info_rm->globale_nb_id_list);
|
||||
ogs_free(presence_info_rm);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_presence_info_rm_convertToJSON(OpenAPI_presence_info_rm_t *presence_info_rm)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (presence_info_rm == NULL) {
|
||||
ogs_error("OpenAPI_presence_info_rm_convertToJSON() failed [PresenceInfoRm]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (presence_info_rm->pra_id) {
|
||||
if (cJSON_AddStringToObject(item, "praId", presence_info_rm->pra_id) == NULL) {
|
||||
ogs_error("OpenAPI_presence_info_rm_convertToJSON() failed [pra_id]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (presence_info_rm->presence_state) {
|
||||
if (cJSON_AddStringToObject(item, "presenceState", OpenAPI_presence_state_ToString(presence_info_rm->presence_state)) == NULL) {
|
||||
ogs_error("OpenAPI_presence_info_rm_convertToJSON() failed [presence_state]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (presence_info_rm->tracking_area_list) {
|
||||
cJSON *tracking_area_listList = cJSON_AddArrayToObject(item, "trackingAreaList");
|
||||
if (tracking_area_listList == NULL) {
|
||||
ogs_error("OpenAPI_presence_info_rm_convertToJSON() failed [tracking_area_list]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *tracking_area_list_node;
|
||||
if (presence_info_rm->tracking_area_list) {
|
||||
OpenAPI_list_for_each(presence_info_rm->tracking_area_list, tracking_area_list_node) {
|
||||
cJSON *itemLocal = OpenAPI_tai_convertToJSON(tracking_area_list_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_presence_info_rm_convertToJSON() failed [tracking_area_list]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(tracking_area_listList, itemLocal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (presence_info_rm->ecgi_list) {
|
||||
cJSON *ecgi_listList = cJSON_AddArrayToObject(item, "ecgiList");
|
||||
if (ecgi_listList == NULL) {
|
||||
ogs_error("OpenAPI_presence_info_rm_convertToJSON() failed [ecgi_list]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *ecgi_list_node;
|
||||
if (presence_info_rm->ecgi_list) {
|
||||
OpenAPI_list_for_each(presence_info_rm->ecgi_list, ecgi_list_node) {
|
||||
cJSON *itemLocal = OpenAPI_ecgi_convertToJSON(ecgi_list_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_presence_info_rm_convertToJSON() failed [ecgi_list]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(ecgi_listList, itemLocal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (presence_info_rm->ncgi_list) {
|
||||
cJSON *ncgi_listList = cJSON_AddArrayToObject(item, "ncgiList");
|
||||
if (ncgi_listList == NULL) {
|
||||
ogs_error("OpenAPI_presence_info_rm_convertToJSON() failed [ncgi_list]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *ncgi_list_node;
|
||||
if (presence_info_rm->ncgi_list) {
|
||||
OpenAPI_list_for_each(presence_info_rm->ncgi_list, ncgi_list_node) {
|
||||
cJSON *itemLocal = OpenAPI_ncgi_convertToJSON(ncgi_list_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_presence_info_rm_convertToJSON() failed [ncgi_list]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(ncgi_listList, itemLocal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (presence_info_rm->global_ran_node_id_list) {
|
||||
cJSON *global_ran_node_id_listList = cJSON_AddArrayToObject(item, "globalRanNodeIdList");
|
||||
if (global_ran_node_id_listList == NULL) {
|
||||
ogs_error("OpenAPI_presence_info_rm_convertToJSON() failed [global_ran_node_id_list]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *global_ran_node_id_list_node;
|
||||
if (presence_info_rm->global_ran_node_id_list) {
|
||||
OpenAPI_list_for_each(presence_info_rm->global_ran_node_id_list, global_ran_node_id_list_node) {
|
||||
cJSON *itemLocal = OpenAPI_global_ran_node_id_convertToJSON(global_ran_node_id_list_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_presence_info_rm_convertToJSON() failed [global_ran_node_id_list]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(global_ran_node_id_listList, itemLocal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (presence_info_rm->globale_nb_id_list) {
|
||||
cJSON *globale_nb_id_listList = cJSON_AddArrayToObject(item, "globaleNbIdList");
|
||||
if (globale_nb_id_listList == NULL) {
|
||||
ogs_error("OpenAPI_presence_info_rm_convertToJSON() failed [globale_nb_id_list]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *globale_nb_id_list_node;
|
||||
if (presence_info_rm->globale_nb_id_list) {
|
||||
OpenAPI_list_for_each(presence_info_rm->globale_nb_id_list, globale_nb_id_list_node) {
|
||||
cJSON *itemLocal = OpenAPI_global_ran_node_id_convertToJSON(globale_nb_id_list_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_presence_info_rm_convertToJSON() failed [globale_nb_id_list]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(globale_nb_id_listList, itemLocal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_presence_info_rm_t *OpenAPI_presence_info_rm_parseFromJSON(cJSON *presence_info_rmJSON)
|
||||
{
|
||||
OpenAPI_presence_info_rm_t *presence_info_rm_local_var = NULL;
|
||||
cJSON *pra_id = cJSON_GetObjectItemCaseSensitive(presence_info_rmJSON, "praId");
|
||||
|
||||
if (pra_id) {
|
||||
if (!cJSON_IsString(pra_id)) {
|
||||
ogs_error("OpenAPI_presence_info_rm_parseFromJSON() failed [pra_id]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *presence_state = cJSON_GetObjectItemCaseSensitive(presence_info_rmJSON, "presenceState");
|
||||
|
||||
OpenAPI_presence_state_e presence_stateVariable;
|
||||
if (presence_state) {
|
||||
if (!cJSON_IsString(presence_state)) {
|
||||
ogs_error("OpenAPI_presence_info_rm_parseFromJSON() failed [presence_state]");
|
||||
goto end;
|
||||
}
|
||||
presence_stateVariable = OpenAPI_presence_state_FromString(presence_state->valuestring);
|
||||
}
|
||||
|
||||
cJSON *tracking_area_list = cJSON_GetObjectItemCaseSensitive(presence_info_rmJSON, "trackingAreaList");
|
||||
|
||||
OpenAPI_list_t *tracking_area_listList;
|
||||
if (tracking_area_list) {
|
||||
cJSON *tracking_area_list_local_nonprimitive;
|
||||
if (!cJSON_IsArray(tracking_area_list)) {
|
||||
ogs_error("OpenAPI_presence_info_rm_parseFromJSON() failed [tracking_area_list]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
tracking_area_listList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(tracking_area_list_local_nonprimitive, tracking_area_list ) {
|
||||
if (!cJSON_IsObject(tracking_area_list_local_nonprimitive)) {
|
||||
ogs_error("OpenAPI_presence_info_rm_parseFromJSON() failed [tracking_area_list]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_tai_t *tracking_area_listItem = OpenAPI_tai_parseFromJSON(tracking_area_list_local_nonprimitive);
|
||||
|
||||
OpenAPI_list_add(tracking_area_listList, tracking_area_listItem);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *ecgi_list = cJSON_GetObjectItemCaseSensitive(presence_info_rmJSON, "ecgiList");
|
||||
|
||||
OpenAPI_list_t *ecgi_listList;
|
||||
if (ecgi_list) {
|
||||
cJSON *ecgi_list_local_nonprimitive;
|
||||
if (!cJSON_IsArray(ecgi_list)) {
|
||||
ogs_error("OpenAPI_presence_info_rm_parseFromJSON() failed [ecgi_list]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
ecgi_listList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(ecgi_list_local_nonprimitive, ecgi_list ) {
|
||||
if (!cJSON_IsObject(ecgi_list_local_nonprimitive)) {
|
||||
ogs_error("OpenAPI_presence_info_rm_parseFromJSON() failed [ecgi_list]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_ecgi_t *ecgi_listItem = OpenAPI_ecgi_parseFromJSON(ecgi_list_local_nonprimitive);
|
||||
|
||||
OpenAPI_list_add(ecgi_listList, ecgi_listItem);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *ncgi_list = cJSON_GetObjectItemCaseSensitive(presence_info_rmJSON, "ncgiList");
|
||||
|
||||
OpenAPI_list_t *ncgi_listList;
|
||||
if (ncgi_list) {
|
||||
cJSON *ncgi_list_local_nonprimitive;
|
||||
if (!cJSON_IsArray(ncgi_list)) {
|
||||
ogs_error("OpenAPI_presence_info_rm_parseFromJSON() failed [ncgi_list]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
ncgi_listList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(ncgi_list_local_nonprimitive, ncgi_list ) {
|
||||
if (!cJSON_IsObject(ncgi_list_local_nonprimitive)) {
|
||||
ogs_error("OpenAPI_presence_info_rm_parseFromJSON() failed [ncgi_list]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_ncgi_t *ncgi_listItem = OpenAPI_ncgi_parseFromJSON(ncgi_list_local_nonprimitive);
|
||||
|
||||
OpenAPI_list_add(ncgi_listList, ncgi_listItem);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *global_ran_node_id_list = cJSON_GetObjectItemCaseSensitive(presence_info_rmJSON, "globalRanNodeIdList");
|
||||
|
||||
OpenAPI_list_t *global_ran_node_id_listList;
|
||||
if (global_ran_node_id_list) {
|
||||
cJSON *global_ran_node_id_list_local_nonprimitive;
|
||||
if (!cJSON_IsArray(global_ran_node_id_list)) {
|
||||
ogs_error("OpenAPI_presence_info_rm_parseFromJSON() failed [global_ran_node_id_list]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
global_ran_node_id_listList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(global_ran_node_id_list_local_nonprimitive, global_ran_node_id_list ) {
|
||||
if (!cJSON_IsObject(global_ran_node_id_list_local_nonprimitive)) {
|
||||
ogs_error("OpenAPI_presence_info_rm_parseFromJSON() failed [global_ran_node_id_list]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_global_ran_node_id_t *global_ran_node_id_listItem = OpenAPI_global_ran_node_id_parseFromJSON(global_ran_node_id_list_local_nonprimitive);
|
||||
|
||||
OpenAPI_list_add(global_ran_node_id_listList, global_ran_node_id_listItem);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *globale_nb_id_list = cJSON_GetObjectItemCaseSensitive(presence_info_rmJSON, "globaleNbIdList");
|
||||
|
||||
OpenAPI_list_t *globale_nb_id_listList;
|
||||
if (globale_nb_id_list) {
|
||||
cJSON *globale_nb_id_list_local_nonprimitive;
|
||||
if (!cJSON_IsArray(globale_nb_id_list)) {
|
||||
ogs_error("OpenAPI_presence_info_rm_parseFromJSON() failed [globale_nb_id_list]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
globale_nb_id_listList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(globale_nb_id_list_local_nonprimitive, globale_nb_id_list ) {
|
||||
if (!cJSON_IsObject(globale_nb_id_list_local_nonprimitive)) {
|
||||
ogs_error("OpenAPI_presence_info_rm_parseFromJSON() failed [globale_nb_id_list]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_global_ran_node_id_t *globale_nb_id_listItem = OpenAPI_global_ran_node_id_parseFromJSON(globale_nb_id_list_local_nonprimitive);
|
||||
|
||||
OpenAPI_list_add(globale_nb_id_listList, globale_nb_id_listItem);
|
||||
}
|
||||
}
|
||||
|
||||
presence_info_rm_local_var = OpenAPI_presence_info_rm_create (
|
||||
pra_id ? ogs_strdup(pra_id->valuestring) : NULL,
|
||||
presence_state ? presence_stateVariable : 0,
|
||||
tracking_area_list ? tracking_area_listList : NULL,
|
||||
ecgi_list ? ecgi_listList : NULL,
|
||||
ncgi_list ? ncgi_listList : NULL,
|
||||
global_ran_node_id_list ? global_ran_node_id_listList : NULL,
|
||||
globale_nb_id_list ? globale_nb_id_listList : NULL
|
||||
);
|
||||
|
||||
return presence_info_rm_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_presence_info_rm_t *OpenAPI_presence_info_rm_copy(OpenAPI_presence_info_rm_t *dst, OpenAPI_presence_info_rm_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_presence_info_rm_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_presence_info_rm_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_presence_info_rm_free(dst);
|
||||
dst = OpenAPI_presence_info_rm_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
55
lib/sbi/openapi/model/presence_info_rm.h
Normal file
55
lib/sbi/openapi/model/presence_info_rm.h
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* presence_info_rm.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_presence_info_rm_H_
|
||||
#define _OpenAPI_presence_info_rm_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
#include "ecgi.h"
|
||||
#include "global_ran_node_id.h"
|
||||
#include "ncgi.h"
|
||||
#include "presence_state.h"
|
||||
#include "tai.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_presence_info_rm_s OpenAPI_presence_info_rm_t;
|
||||
typedef struct OpenAPI_presence_info_rm_s {
|
||||
char *pra_id;
|
||||
OpenAPI_presence_state_e presence_state;
|
||||
OpenAPI_list_t *tracking_area_list;
|
||||
OpenAPI_list_t *ecgi_list;
|
||||
OpenAPI_list_t *ncgi_list;
|
||||
OpenAPI_list_t *global_ran_node_id_list;
|
||||
OpenAPI_list_t *globale_nb_id_list;
|
||||
} OpenAPI_presence_info_rm_t;
|
||||
|
||||
OpenAPI_presence_info_rm_t *OpenAPI_presence_info_rm_create(
|
||||
char *pra_id,
|
||||
OpenAPI_presence_state_e presence_state,
|
||||
OpenAPI_list_t *tracking_area_list,
|
||||
OpenAPI_list_t *ecgi_list,
|
||||
OpenAPI_list_t *ncgi_list,
|
||||
OpenAPI_list_t *global_ran_node_id_list,
|
||||
OpenAPI_list_t *globale_nb_id_list
|
||||
);
|
||||
void OpenAPI_presence_info_rm_free(OpenAPI_presence_info_rm_t *presence_info_rm);
|
||||
OpenAPI_presence_info_rm_t *OpenAPI_presence_info_rm_parseFromJSON(cJSON *presence_info_rmJSON);
|
||||
cJSON *OpenAPI_presence_info_rm_convertToJSON(OpenAPI_presence_info_rm_t *presence_info_rm);
|
||||
OpenAPI_presence_info_rm_t *OpenAPI_presence_info_rm_copy(OpenAPI_presence_info_rm_t *dst, OpenAPI_presence_info_rm_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_presence_info_rm_H_ */
|
||||
|
||||
|
|
@ -4,82 +4,27 @@
|
|||
#include <stdio.h>
|
||||
#include "presence_state.h"
|
||||
|
||||
OpenAPI_presence_state_t *OpenAPI_presence_state_create(
|
||||
)
|
||||
char* OpenAPI_presence_state_ToString(OpenAPI_presence_state_e presence_state)
|
||||
{
|
||||
OpenAPI_presence_state_t *presence_state_local_var = OpenAPI_malloc(sizeof(OpenAPI_presence_state_t));
|
||||
if (!presence_state_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return presence_state_local_var;
|
||||
const char *presence_stateArray[] = { "NULL", "IN_AREA", "OUT_OF_AREA", "UNKNOWN", "INACTIVE" };
|
||||
size_t sizeofArray = sizeof(presence_stateArray) / sizeof(presence_stateArray[0]);
|
||||
if (presence_state < sizeofArray)
|
||||
return (char *)presence_stateArray[presence_state];
|
||||
else
|
||||
return (char *)"Unknown";
|
||||
}
|
||||
|
||||
void OpenAPI_presence_state_free(OpenAPI_presence_state_t *presence_state)
|
||||
OpenAPI_presence_state_e OpenAPI_presence_state_FromString(char* presence_state)
|
||||
{
|
||||
if (NULL == presence_state) {
|
||||
return;
|
||||
int stringToReturn = 0;
|
||||
const char *presence_stateArray[] = { "NULL", "IN_AREA", "OUT_OF_AREA", "UNKNOWN", "INACTIVE" };
|
||||
size_t sizeofArray = sizeof(presence_stateArray) / sizeof(presence_stateArray[0]);
|
||||
while (stringToReturn < sizeofArray) {
|
||||
if (strcmp(presence_state, presence_stateArray[stringToReturn]) == 0) {
|
||||
return stringToReturn;
|
||||
}
|
||||
stringToReturn++;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(presence_state);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_presence_state_convertToJSON(OpenAPI_presence_state_t *presence_state)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (presence_state == NULL) {
|
||||
ogs_error("OpenAPI_presence_state_convertToJSON() failed [PresenceState]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_presence_state_t *OpenAPI_presence_state_parseFromJSON(cJSON *presence_stateJSON)
|
||||
{
|
||||
OpenAPI_presence_state_t *presence_state_local_var = NULL;
|
||||
presence_state_local_var = OpenAPI_presence_state_create (
|
||||
);
|
||||
|
||||
return presence_state_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_presence_state_t *OpenAPI_presence_state_copy(OpenAPI_presence_state_t *dst, OpenAPI_presence_state_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_presence_state_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_presence_state_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_presence_state_free(dst);
|
||||
dst = OpenAPI_presence_state_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,16 +17,11 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_presence_state_s OpenAPI_presence_state_t;
|
||||
typedef struct OpenAPI_presence_state_s {
|
||||
} OpenAPI_presence_state_t;
|
||||
typedef enum { OpenAPI_presence_state_NULL = 0, OpenAPI_presence_state_IN_AREA, OpenAPI_presence_state_OUT_OF_AREA, OpenAPI_presence_state_UNKNOWN, OpenAPI_presence_state_INACTIVE } OpenAPI_presence_state_e;
|
||||
|
||||
OpenAPI_presence_state_t *OpenAPI_presence_state_create(
|
||||
);
|
||||
void OpenAPI_presence_state_free(OpenAPI_presence_state_t *presence_state);
|
||||
OpenAPI_presence_state_t *OpenAPI_presence_state_parseFromJSON(cJSON *presence_stateJSON);
|
||||
cJSON *OpenAPI_presence_state_convertToJSON(OpenAPI_presence_state_t *presence_state);
|
||||
OpenAPI_presence_state_t *OpenAPI_presence_state_copy(OpenAPI_presence_state_t *dst, OpenAPI_presence_state_t *src);
|
||||
char* OpenAPI_presence_state_ToString(OpenAPI_presence_state_e presence_state);
|
||||
|
||||
OpenAPI_presence_state_e OpenAPI_presence_state_FromString(char* presence_state);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
268
lib/sbi/openapi/model/qos_characteristics.c
Normal file
268
lib/sbi/openapi/model/qos_characteristics.c
Normal file
|
|
@ -0,0 +1,268 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "qos_characteristics.h"
|
||||
|
||||
OpenAPI_qos_characteristics_t *OpenAPI_qos_characteristics_create(
|
||||
int _5qi,
|
||||
OpenAPI_qos_resource_type_t *resource_type,
|
||||
int priority_level,
|
||||
int packet_delay_budget,
|
||||
char *packet_error_rate,
|
||||
int averaging_window,
|
||||
int max_data_burst_vol,
|
||||
int ext_max_data_burst_vol
|
||||
)
|
||||
{
|
||||
OpenAPI_qos_characteristics_t *qos_characteristics_local_var = OpenAPI_malloc(sizeof(OpenAPI_qos_characteristics_t));
|
||||
if (!qos_characteristics_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
qos_characteristics_local_var->_5qi = _5qi;
|
||||
qos_characteristics_local_var->resource_type = resource_type;
|
||||
qos_characteristics_local_var->priority_level = priority_level;
|
||||
qos_characteristics_local_var->packet_delay_budget = packet_delay_budget;
|
||||
qos_characteristics_local_var->packet_error_rate = packet_error_rate;
|
||||
qos_characteristics_local_var->averaging_window = averaging_window;
|
||||
qos_characteristics_local_var->max_data_burst_vol = max_data_burst_vol;
|
||||
qos_characteristics_local_var->ext_max_data_burst_vol = ext_max_data_burst_vol;
|
||||
|
||||
return qos_characteristics_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_qos_characteristics_free(OpenAPI_qos_characteristics_t *qos_characteristics)
|
||||
{
|
||||
if (NULL == qos_characteristics) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_qos_resource_type_free(qos_characteristics->resource_type);
|
||||
ogs_free(qos_characteristics->packet_error_rate);
|
||||
ogs_free(qos_characteristics);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_qos_characteristics_convertToJSON(OpenAPI_qos_characteristics_t *qos_characteristics)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (qos_characteristics == NULL) {
|
||||
ogs_error("OpenAPI_qos_characteristics_convertToJSON() failed [QosCharacteristics]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (!qos_characteristics->_5qi) {
|
||||
ogs_error("OpenAPI_qos_characteristics_convertToJSON() failed [_5qi]");
|
||||
goto end;
|
||||
}
|
||||
if (cJSON_AddNumberToObject(item, "5qi", qos_characteristics->_5qi) == NULL) {
|
||||
ogs_error("OpenAPI_qos_characteristics_convertToJSON() failed [_5qi]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!qos_characteristics->resource_type) {
|
||||
ogs_error("OpenAPI_qos_characteristics_convertToJSON() failed [resource_type]");
|
||||
goto end;
|
||||
}
|
||||
cJSON *resource_type_local_JSON = OpenAPI_qos_resource_type_convertToJSON(qos_characteristics->resource_type);
|
||||
if (resource_type_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_qos_characteristics_convertToJSON() failed [resource_type]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "resourceType", resource_type_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_qos_characteristics_convertToJSON() failed [resource_type]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!qos_characteristics->priority_level) {
|
||||
ogs_error("OpenAPI_qos_characteristics_convertToJSON() failed [priority_level]");
|
||||
goto end;
|
||||
}
|
||||
if (cJSON_AddNumberToObject(item, "priorityLevel", qos_characteristics->priority_level) == NULL) {
|
||||
ogs_error("OpenAPI_qos_characteristics_convertToJSON() failed [priority_level]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!qos_characteristics->packet_delay_budget) {
|
||||
ogs_error("OpenAPI_qos_characteristics_convertToJSON() failed [packet_delay_budget]");
|
||||
goto end;
|
||||
}
|
||||
if (cJSON_AddNumberToObject(item, "packetDelayBudget", qos_characteristics->packet_delay_budget) == NULL) {
|
||||
ogs_error("OpenAPI_qos_characteristics_convertToJSON() failed [packet_delay_budget]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!qos_characteristics->packet_error_rate) {
|
||||
ogs_error("OpenAPI_qos_characteristics_convertToJSON() failed [packet_error_rate]");
|
||||
goto end;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "packetErrorRate", qos_characteristics->packet_error_rate) == NULL) {
|
||||
ogs_error("OpenAPI_qos_characteristics_convertToJSON() failed [packet_error_rate]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (qos_characteristics->averaging_window) {
|
||||
if (cJSON_AddNumberToObject(item, "averagingWindow", qos_characteristics->averaging_window) == NULL) {
|
||||
ogs_error("OpenAPI_qos_characteristics_convertToJSON() failed [averaging_window]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (qos_characteristics->max_data_burst_vol) {
|
||||
if (cJSON_AddNumberToObject(item, "maxDataBurstVol", qos_characteristics->max_data_burst_vol) == NULL) {
|
||||
ogs_error("OpenAPI_qos_characteristics_convertToJSON() failed [max_data_burst_vol]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (qos_characteristics->ext_max_data_burst_vol) {
|
||||
if (cJSON_AddNumberToObject(item, "extMaxDataBurstVol", qos_characteristics->ext_max_data_burst_vol) == NULL) {
|
||||
ogs_error("OpenAPI_qos_characteristics_convertToJSON() failed [ext_max_data_burst_vol]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_qos_characteristics_t *OpenAPI_qos_characteristics_parseFromJSON(cJSON *qos_characteristicsJSON)
|
||||
{
|
||||
OpenAPI_qos_characteristics_t *qos_characteristics_local_var = NULL;
|
||||
cJSON *_5qi = cJSON_GetObjectItemCaseSensitive(qos_characteristicsJSON, "5qi");
|
||||
if (!_5qi) {
|
||||
ogs_error("OpenAPI_qos_characteristics_parseFromJSON() failed [_5qi]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
if (!cJSON_IsNumber(_5qi)) {
|
||||
ogs_error("OpenAPI_qos_characteristics_parseFromJSON() failed [_5qi]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *resource_type = cJSON_GetObjectItemCaseSensitive(qos_characteristicsJSON, "resourceType");
|
||||
if (!resource_type) {
|
||||
ogs_error("OpenAPI_qos_characteristics_parseFromJSON() failed [resource_type]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_qos_resource_type_t *resource_type_local_nonprim = NULL;
|
||||
|
||||
resource_type_local_nonprim = OpenAPI_qos_resource_type_parseFromJSON(resource_type);
|
||||
|
||||
cJSON *priority_level = cJSON_GetObjectItemCaseSensitive(qos_characteristicsJSON, "priorityLevel");
|
||||
if (!priority_level) {
|
||||
ogs_error("OpenAPI_qos_characteristics_parseFromJSON() failed [priority_level]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
if (!cJSON_IsNumber(priority_level)) {
|
||||
ogs_error("OpenAPI_qos_characteristics_parseFromJSON() failed [priority_level]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *packet_delay_budget = cJSON_GetObjectItemCaseSensitive(qos_characteristicsJSON, "packetDelayBudget");
|
||||
if (!packet_delay_budget) {
|
||||
ogs_error("OpenAPI_qos_characteristics_parseFromJSON() failed [packet_delay_budget]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
if (!cJSON_IsNumber(packet_delay_budget)) {
|
||||
ogs_error("OpenAPI_qos_characteristics_parseFromJSON() failed [packet_delay_budget]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *packet_error_rate = cJSON_GetObjectItemCaseSensitive(qos_characteristicsJSON, "packetErrorRate");
|
||||
if (!packet_error_rate) {
|
||||
ogs_error("OpenAPI_qos_characteristics_parseFromJSON() failed [packet_error_rate]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
if (!cJSON_IsString(packet_error_rate)) {
|
||||
ogs_error("OpenAPI_qos_characteristics_parseFromJSON() failed [packet_error_rate]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *averaging_window = cJSON_GetObjectItemCaseSensitive(qos_characteristicsJSON, "averagingWindow");
|
||||
|
||||
if (averaging_window) {
|
||||
if (!cJSON_IsNumber(averaging_window)) {
|
||||
ogs_error("OpenAPI_qos_characteristics_parseFromJSON() failed [averaging_window]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *max_data_burst_vol = cJSON_GetObjectItemCaseSensitive(qos_characteristicsJSON, "maxDataBurstVol");
|
||||
|
||||
if (max_data_burst_vol) {
|
||||
if (!cJSON_IsNumber(max_data_burst_vol)) {
|
||||
ogs_error("OpenAPI_qos_characteristics_parseFromJSON() failed [max_data_burst_vol]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *ext_max_data_burst_vol = cJSON_GetObjectItemCaseSensitive(qos_characteristicsJSON, "extMaxDataBurstVol");
|
||||
|
||||
if (ext_max_data_burst_vol) {
|
||||
if (!cJSON_IsNumber(ext_max_data_burst_vol)) {
|
||||
ogs_error("OpenAPI_qos_characteristics_parseFromJSON() failed [ext_max_data_burst_vol]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
qos_characteristics_local_var = OpenAPI_qos_characteristics_create (
|
||||
_5qi->valuedouble,
|
||||
resource_type_local_nonprim,
|
||||
priority_level->valuedouble,
|
||||
packet_delay_budget->valuedouble,
|
||||
ogs_strdup(packet_error_rate->valuestring),
|
||||
averaging_window ? averaging_window->valuedouble : 0,
|
||||
max_data_burst_vol ? max_data_burst_vol->valuedouble : 0,
|
||||
ext_max_data_burst_vol ? ext_max_data_burst_vol->valuedouble : 0
|
||||
);
|
||||
|
||||
return qos_characteristics_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_qos_characteristics_t *OpenAPI_qos_characteristics_copy(OpenAPI_qos_characteristics_t *dst, OpenAPI_qos_characteristics_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_qos_characteristics_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_qos_characteristics_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_qos_characteristics_free(dst);
|
||||
dst = OpenAPI_qos_characteristics_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
53
lib/sbi/openapi/model/qos_characteristics.h
Normal file
53
lib/sbi/openapi/model/qos_characteristics.h
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* qos_characteristics.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_qos_characteristics_H_
|
||||
#define _OpenAPI_qos_characteristics_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
#include "qos_resource_type.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_qos_characteristics_s OpenAPI_qos_characteristics_t;
|
||||
typedef struct OpenAPI_qos_characteristics_s {
|
||||
int _5qi;
|
||||
struct OpenAPI_qos_resource_type_s *resource_type;
|
||||
int priority_level;
|
||||
int packet_delay_budget;
|
||||
char *packet_error_rate;
|
||||
int averaging_window;
|
||||
int max_data_burst_vol;
|
||||
int ext_max_data_burst_vol;
|
||||
} OpenAPI_qos_characteristics_t;
|
||||
|
||||
OpenAPI_qos_characteristics_t *OpenAPI_qos_characteristics_create(
|
||||
int _5qi,
|
||||
OpenAPI_qos_resource_type_t *resource_type,
|
||||
int priority_level,
|
||||
int packet_delay_budget,
|
||||
char *packet_error_rate,
|
||||
int averaging_window,
|
||||
int max_data_burst_vol,
|
||||
int ext_max_data_burst_vol
|
||||
);
|
||||
void OpenAPI_qos_characteristics_free(OpenAPI_qos_characteristics_t *qos_characteristics);
|
||||
OpenAPI_qos_characteristics_t *OpenAPI_qos_characteristics_parseFromJSON(cJSON *qos_characteristicsJSON);
|
||||
cJSON *OpenAPI_qos_characteristics_convertToJSON(OpenAPI_qos_characteristics_t *qos_characteristics);
|
||||
OpenAPI_qos_characteristics_t *OpenAPI_qos_characteristics_copy(OpenAPI_qos_characteristics_t *dst, OpenAPI_qos_characteristics_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_qos_characteristics_H_ */
|
||||
|
||||
444
lib/sbi/openapi/model/qos_data.c
Normal file
444
lib/sbi/openapi/model/qos_data.c
Normal file
|
|
@ -0,0 +1,444 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "qos_data.h"
|
||||
|
||||
OpenAPI_qos_data_t *OpenAPI_qos_data_create(
|
||||
char *qos_id,
|
||||
int _5qi,
|
||||
char *maxbr_ul,
|
||||
char *maxbr_dl,
|
||||
char *gbr_ul,
|
||||
char *gbr_dl,
|
||||
OpenAPI_arp_t *arp,
|
||||
int qnc,
|
||||
int priority_level,
|
||||
int aver_window,
|
||||
int max_data_burst_vol,
|
||||
int reflective_qos,
|
||||
char *sharing_key_dl,
|
||||
char *sharing_key_ul,
|
||||
int max_packet_loss_rate_dl,
|
||||
int max_packet_loss_rate_ul,
|
||||
int def_qos_flow_indication,
|
||||
int ext_max_data_burst_vol
|
||||
)
|
||||
{
|
||||
OpenAPI_qos_data_t *qos_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_qos_data_t));
|
||||
if (!qos_data_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
qos_data_local_var->qos_id = qos_id;
|
||||
qos_data_local_var->_5qi = _5qi;
|
||||
qos_data_local_var->maxbr_ul = maxbr_ul;
|
||||
qos_data_local_var->maxbr_dl = maxbr_dl;
|
||||
qos_data_local_var->gbr_ul = gbr_ul;
|
||||
qos_data_local_var->gbr_dl = gbr_dl;
|
||||
qos_data_local_var->arp = arp;
|
||||
qos_data_local_var->qnc = qnc;
|
||||
qos_data_local_var->priority_level = priority_level;
|
||||
qos_data_local_var->aver_window = aver_window;
|
||||
qos_data_local_var->max_data_burst_vol = max_data_burst_vol;
|
||||
qos_data_local_var->reflective_qos = reflective_qos;
|
||||
qos_data_local_var->sharing_key_dl = sharing_key_dl;
|
||||
qos_data_local_var->sharing_key_ul = sharing_key_ul;
|
||||
qos_data_local_var->max_packet_loss_rate_dl = max_packet_loss_rate_dl;
|
||||
qos_data_local_var->max_packet_loss_rate_ul = max_packet_loss_rate_ul;
|
||||
qos_data_local_var->def_qos_flow_indication = def_qos_flow_indication;
|
||||
qos_data_local_var->ext_max_data_burst_vol = ext_max_data_burst_vol;
|
||||
|
||||
return qos_data_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_qos_data_free(OpenAPI_qos_data_t *qos_data)
|
||||
{
|
||||
if (NULL == qos_data) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(qos_data->qos_id);
|
||||
ogs_free(qos_data->maxbr_ul);
|
||||
ogs_free(qos_data->maxbr_dl);
|
||||
ogs_free(qos_data->gbr_ul);
|
||||
ogs_free(qos_data->gbr_dl);
|
||||
OpenAPI_arp_free(qos_data->arp);
|
||||
ogs_free(qos_data->sharing_key_dl);
|
||||
ogs_free(qos_data->sharing_key_ul);
|
||||
ogs_free(qos_data);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_qos_data_convertToJSON(OpenAPI_qos_data_t *qos_data)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (qos_data == NULL) {
|
||||
ogs_error("OpenAPI_qos_data_convertToJSON() failed [QosData]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (!qos_data->qos_id) {
|
||||
ogs_error("OpenAPI_qos_data_convertToJSON() failed [qos_id]");
|
||||
goto end;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "qosId", qos_data->qos_id) == NULL) {
|
||||
ogs_error("OpenAPI_qos_data_convertToJSON() failed [qos_id]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (qos_data->_5qi) {
|
||||
if (cJSON_AddNumberToObject(item, "5qi", qos_data->_5qi) == NULL) {
|
||||
ogs_error("OpenAPI_qos_data_convertToJSON() failed [_5qi]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (qos_data->maxbr_ul) {
|
||||
if (cJSON_AddStringToObject(item, "maxbrUl", qos_data->maxbr_ul) == NULL) {
|
||||
ogs_error("OpenAPI_qos_data_convertToJSON() failed [maxbr_ul]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (qos_data->maxbr_dl) {
|
||||
if (cJSON_AddStringToObject(item, "maxbrDl", qos_data->maxbr_dl) == NULL) {
|
||||
ogs_error("OpenAPI_qos_data_convertToJSON() failed [maxbr_dl]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (qos_data->gbr_ul) {
|
||||
if (cJSON_AddStringToObject(item, "gbrUl", qos_data->gbr_ul) == NULL) {
|
||||
ogs_error("OpenAPI_qos_data_convertToJSON() failed [gbr_ul]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (qos_data->gbr_dl) {
|
||||
if (cJSON_AddStringToObject(item, "gbrDl", qos_data->gbr_dl) == NULL) {
|
||||
ogs_error("OpenAPI_qos_data_convertToJSON() failed [gbr_dl]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (qos_data->arp) {
|
||||
cJSON *arp_local_JSON = OpenAPI_arp_convertToJSON(qos_data->arp);
|
||||
if (arp_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_qos_data_convertToJSON() failed [arp]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "arp", arp_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_qos_data_convertToJSON() failed [arp]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (qos_data->qnc) {
|
||||
if (cJSON_AddBoolToObject(item, "qnc", qos_data->qnc) == NULL) {
|
||||
ogs_error("OpenAPI_qos_data_convertToJSON() failed [qnc]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (qos_data->priority_level) {
|
||||
if (cJSON_AddNumberToObject(item, "priorityLevel", qos_data->priority_level) == NULL) {
|
||||
ogs_error("OpenAPI_qos_data_convertToJSON() failed [priority_level]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (qos_data->aver_window) {
|
||||
if (cJSON_AddNumberToObject(item, "averWindow", qos_data->aver_window) == NULL) {
|
||||
ogs_error("OpenAPI_qos_data_convertToJSON() failed [aver_window]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (qos_data->max_data_burst_vol) {
|
||||
if (cJSON_AddNumberToObject(item, "maxDataBurstVol", qos_data->max_data_burst_vol) == NULL) {
|
||||
ogs_error("OpenAPI_qos_data_convertToJSON() failed [max_data_burst_vol]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (qos_data->reflective_qos) {
|
||||
if (cJSON_AddBoolToObject(item, "reflectiveQos", qos_data->reflective_qos) == NULL) {
|
||||
ogs_error("OpenAPI_qos_data_convertToJSON() failed [reflective_qos]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (qos_data->sharing_key_dl) {
|
||||
if (cJSON_AddStringToObject(item, "sharingKeyDl", qos_data->sharing_key_dl) == NULL) {
|
||||
ogs_error("OpenAPI_qos_data_convertToJSON() failed [sharing_key_dl]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (qos_data->sharing_key_ul) {
|
||||
if (cJSON_AddStringToObject(item, "sharingKeyUl", qos_data->sharing_key_ul) == NULL) {
|
||||
ogs_error("OpenAPI_qos_data_convertToJSON() failed [sharing_key_ul]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (qos_data->max_packet_loss_rate_dl) {
|
||||
if (cJSON_AddNumberToObject(item, "maxPacketLossRateDl", qos_data->max_packet_loss_rate_dl) == NULL) {
|
||||
ogs_error("OpenAPI_qos_data_convertToJSON() failed [max_packet_loss_rate_dl]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (qos_data->max_packet_loss_rate_ul) {
|
||||
if (cJSON_AddNumberToObject(item, "maxPacketLossRateUl", qos_data->max_packet_loss_rate_ul) == NULL) {
|
||||
ogs_error("OpenAPI_qos_data_convertToJSON() failed [max_packet_loss_rate_ul]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (qos_data->def_qos_flow_indication) {
|
||||
if (cJSON_AddBoolToObject(item, "defQosFlowIndication", qos_data->def_qos_flow_indication) == NULL) {
|
||||
ogs_error("OpenAPI_qos_data_convertToJSON() failed [def_qos_flow_indication]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (qos_data->ext_max_data_burst_vol) {
|
||||
if (cJSON_AddNumberToObject(item, "extMaxDataBurstVol", qos_data->ext_max_data_burst_vol) == NULL) {
|
||||
ogs_error("OpenAPI_qos_data_convertToJSON() failed [ext_max_data_burst_vol]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_qos_data_t *OpenAPI_qos_data_parseFromJSON(cJSON *qos_dataJSON)
|
||||
{
|
||||
OpenAPI_qos_data_t *qos_data_local_var = NULL;
|
||||
cJSON *qos_id = cJSON_GetObjectItemCaseSensitive(qos_dataJSON, "qosId");
|
||||
if (!qos_id) {
|
||||
ogs_error("OpenAPI_qos_data_parseFromJSON() failed [qos_id]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
if (!cJSON_IsString(qos_id)) {
|
||||
ogs_error("OpenAPI_qos_data_parseFromJSON() failed [qos_id]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *_5qi = cJSON_GetObjectItemCaseSensitive(qos_dataJSON, "5qi");
|
||||
|
||||
if (_5qi) {
|
||||
if (!cJSON_IsNumber(_5qi)) {
|
||||
ogs_error("OpenAPI_qos_data_parseFromJSON() failed [_5qi]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *maxbr_ul = cJSON_GetObjectItemCaseSensitive(qos_dataJSON, "maxbrUl");
|
||||
|
||||
if (maxbr_ul) {
|
||||
if (!cJSON_IsString(maxbr_ul)) {
|
||||
ogs_error("OpenAPI_qos_data_parseFromJSON() failed [maxbr_ul]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *maxbr_dl = cJSON_GetObjectItemCaseSensitive(qos_dataJSON, "maxbrDl");
|
||||
|
||||
if (maxbr_dl) {
|
||||
if (!cJSON_IsString(maxbr_dl)) {
|
||||
ogs_error("OpenAPI_qos_data_parseFromJSON() failed [maxbr_dl]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *gbr_ul = cJSON_GetObjectItemCaseSensitive(qos_dataJSON, "gbrUl");
|
||||
|
||||
if (gbr_ul) {
|
||||
if (!cJSON_IsString(gbr_ul)) {
|
||||
ogs_error("OpenAPI_qos_data_parseFromJSON() failed [gbr_ul]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *gbr_dl = cJSON_GetObjectItemCaseSensitive(qos_dataJSON, "gbrDl");
|
||||
|
||||
if (gbr_dl) {
|
||||
if (!cJSON_IsString(gbr_dl)) {
|
||||
ogs_error("OpenAPI_qos_data_parseFromJSON() failed [gbr_dl]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *arp = cJSON_GetObjectItemCaseSensitive(qos_dataJSON, "arp");
|
||||
|
||||
OpenAPI_arp_t *arp_local_nonprim = NULL;
|
||||
if (arp) {
|
||||
arp_local_nonprim = OpenAPI_arp_parseFromJSON(arp);
|
||||
}
|
||||
|
||||
cJSON *qnc = cJSON_GetObjectItemCaseSensitive(qos_dataJSON, "qnc");
|
||||
|
||||
if (qnc) {
|
||||
if (!cJSON_IsBool(qnc)) {
|
||||
ogs_error("OpenAPI_qos_data_parseFromJSON() failed [qnc]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *priority_level = cJSON_GetObjectItemCaseSensitive(qos_dataJSON, "priorityLevel");
|
||||
|
||||
if (priority_level) {
|
||||
if (!cJSON_IsNumber(priority_level)) {
|
||||
ogs_error("OpenAPI_qos_data_parseFromJSON() failed [priority_level]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *aver_window = cJSON_GetObjectItemCaseSensitive(qos_dataJSON, "averWindow");
|
||||
|
||||
if (aver_window) {
|
||||
if (!cJSON_IsNumber(aver_window)) {
|
||||
ogs_error("OpenAPI_qos_data_parseFromJSON() failed [aver_window]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *max_data_burst_vol = cJSON_GetObjectItemCaseSensitive(qos_dataJSON, "maxDataBurstVol");
|
||||
|
||||
if (max_data_burst_vol) {
|
||||
if (!cJSON_IsNumber(max_data_burst_vol)) {
|
||||
ogs_error("OpenAPI_qos_data_parseFromJSON() failed [max_data_burst_vol]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *reflective_qos = cJSON_GetObjectItemCaseSensitive(qos_dataJSON, "reflectiveQos");
|
||||
|
||||
if (reflective_qos) {
|
||||
if (!cJSON_IsBool(reflective_qos)) {
|
||||
ogs_error("OpenAPI_qos_data_parseFromJSON() failed [reflective_qos]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *sharing_key_dl = cJSON_GetObjectItemCaseSensitive(qos_dataJSON, "sharingKeyDl");
|
||||
|
||||
if (sharing_key_dl) {
|
||||
if (!cJSON_IsString(sharing_key_dl)) {
|
||||
ogs_error("OpenAPI_qos_data_parseFromJSON() failed [sharing_key_dl]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *sharing_key_ul = cJSON_GetObjectItemCaseSensitive(qos_dataJSON, "sharingKeyUl");
|
||||
|
||||
if (sharing_key_ul) {
|
||||
if (!cJSON_IsString(sharing_key_ul)) {
|
||||
ogs_error("OpenAPI_qos_data_parseFromJSON() failed [sharing_key_ul]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *max_packet_loss_rate_dl = cJSON_GetObjectItemCaseSensitive(qos_dataJSON, "maxPacketLossRateDl");
|
||||
|
||||
if (max_packet_loss_rate_dl) {
|
||||
if (!cJSON_IsNumber(max_packet_loss_rate_dl)) {
|
||||
ogs_error("OpenAPI_qos_data_parseFromJSON() failed [max_packet_loss_rate_dl]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *max_packet_loss_rate_ul = cJSON_GetObjectItemCaseSensitive(qos_dataJSON, "maxPacketLossRateUl");
|
||||
|
||||
if (max_packet_loss_rate_ul) {
|
||||
if (!cJSON_IsNumber(max_packet_loss_rate_ul)) {
|
||||
ogs_error("OpenAPI_qos_data_parseFromJSON() failed [max_packet_loss_rate_ul]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *def_qos_flow_indication = cJSON_GetObjectItemCaseSensitive(qos_dataJSON, "defQosFlowIndication");
|
||||
|
||||
if (def_qos_flow_indication) {
|
||||
if (!cJSON_IsBool(def_qos_flow_indication)) {
|
||||
ogs_error("OpenAPI_qos_data_parseFromJSON() failed [def_qos_flow_indication]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *ext_max_data_burst_vol = cJSON_GetObjectItemCaseSensitive(qos_dataJSON, "extMaxDataBurstVol");
|
||||
|
||||
if (ext_max_data_burst_vol) {
|
||||
if (!cJSON_IsNumber(ext_max_data_burst_vol)) {
|
||||
ogs_error("OpenAPI_qos_data_parseFromJSON() failed [ext_max_data_burst_vol]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
qos_data_local_var = OpenAPI_qos_data_create (
|
||||
ogs_strdup(qos_id->valuestring),
|
||||
_5qi ? _5qi->valuedouble : 0,
|
||||
maxbr_ul ? ogs_strdup(maxbr_ul->valuestring) : NULL,
|
||||
maxbr_dl ? ogs_strdup(maxbr_dl->valuestring) : NULL,
|
||||
gbr_ul ? ogs_strdup(gbr_ul->valuestring) : NULL,
|
||||
gbr_dl ? ogs_strdup(gbr_dl->valuestring) : NULL,
|
||||
arp ? arp_local_nonprim : NULL,
|
||||
qnc ? qnc->valueint : 0,
|
||||
priority_level ? priority_level->valuedouble : 0,
|
||||
aver_window ? aver_window->valuedouble : 0,
|
||||
max_data_burst_vol ? max_data_burst_vol->valuedouble : 0,
|
||||
reflective_qos ? reflective_qos->valueint : 0,
|
||||
sharing_key_dl ? ogs_strdup(sharing_key_dl->valuestring) : NULL,
|
||||
sharing_key_ul ? ogs_strdup(sharing_key_ul->valuestring) : NULL,
|
||||
max_packet_loss_rate_dl ? max_packet_loss_rate_dl->valuedouble : 0,
|
||||
max_packet_loss_rate_ul ? max_packet_loss_rate_ul->valuedouble : 0,
|
||||
def_qos_flow_indication ? def_qos_flow_indication->valueint : 0,
|
||||
ext_max_data_burst_vol ? ext_max_data_burst_vol->valuedouble : 0
|
||||
);
|
||||
|
||||
return qos_data_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_qos_data_t *OpenAPI_qos_data_copy(OpenAPI_qos_data_t *dst, OpenAPI_qos_data_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_qos_data_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_qos_data_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_qos_data_free(dst);
|
||||
dst = OpenAPI_qos_data_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
73
lib/sbi/openapi/model/qos_data.h
Normal file
73
lib/sbi/openapi/model/qos_data.h
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* qos_data.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_qos_data_H_
|
||||
#define _OpenAPI_qos_data_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
#include "arp.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_qos_data_s OpenAPI_qos_data_t;
|
||||
typedef struct OpenAPI_qos_data_s {
|
||||
char *qos_id;
|
||||
int _5qi;
|
||||
char *maxbr_ul;
|
||||
char *maxbr_dl;
|
||||
char *gbr_ul;
|
||||
char *gbr_dl;
|
||||
struct OpenAPI_arp_s *arp;
|
||||
int qnc;
|
||||
int priority_level;
|
||||
int aver_window;
|
||||
int max_data_burst_vol;
|
||||
int reflective_qos;
|
||||
char *sharing_key_dl;
|
||||
char *sharing_key_ul;
|
||||
int max_packet_loss_rate_dl;
|
||||
int max_packet_loss_rate_ul;
|
||||
int def_qos_flow_indication;
|
||||
int ext_max_data_burst_vol;
|
||||
} OpenAPI_qos_data_t;
|
||||
|
||||
OpenAPI_qos_data_t *OpenAPI_qos_data_create(
|
||||
char *qos_id,
|
||||
int _5qi,
|
||||
char *maxbr_ul,
|
||||
char *maxbr_dl,
|
||||
char *gbr_ul,
|
||||
char *gbr_dl,
|
||||
OpenAPI_arp_t *arp,
|
||||
int qnc,
|
||||
int priority_level,
|
||||
int aver_window,
|
||||
int max_data_burst_vol,
|
||||
int reflective_qos,
|
||||
char *sharing_key_dl,
|
||||
char *sharing_key_ul,
|
||||
int max_packet_loss_rate_dl,
|
||||
int max_packet_loss_rate_ul,
|
||||
int def_qos_flow_indication,
|
||||
int ext_max_data_burst_vol
|
||||
);
|
||||
void OpenAPI_qos_data_free(OpenAPI_qos_data_t *qos_data);
|
||||
OpenAPI_qos_data_t *OpenAPI_qos_data_parseFromJSON(cJSON *qos_dataJSON);
|
||||
cJSON *OpenAPI_qos_data_convertToJSON(OpenAPI_qos_data_t *qos_data);
|
||||
OpenAPI_qos_data_t *OpenAPI_qos_data_copy(OpenAPI_qos_data_t *dst, OpenAPI_qos_data_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_qos_data_H_ */
|
||||
|
||||
85
lib/sbi/openapi/model/qos_flow_usage.c
Normal file
85
lib/sbi/openapi/model/qos_flow_usage.c
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "qos_flow_usage.h"
|
||||
|
||||
OpenAPI_qos_flow_usage_t *OpenAPI_qos_flow_usage_create(
|
||||
)
|
||||
{
|
||||
OpenAPI_qos_flow_usage_t *qos_flow_usage_local_var = OpenAPI_malloc(sizeof(OpenAPI_qos_flow_usage_t));
|
||||
if (!qos_flow_usage_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return qos_flow_usage_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_qos_flow_usage_free(OpenAPI_qos_flow_usage_t *qos_flow_usage)
|
||||
{
|
||||
if (NULL == qos_flow_usage) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(qos_flow_usage);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_qos_flow_usage_convertToJSON(OpenAPI_qos_flow_usage_t *qos_flow_usage)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (qos_flow_usage == NULL) {
|
||||
ogs_error("OpenAPI_qos_flow_usage_convertToJSON() failed [QosFlowUsage]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_qos_flow_usage_t *OpenAPI_qos_flow_usage_parseFromJSON(cJSON *qos_flow_usageJSON)
|
||||
{
|
||||
OpenAPI_qos_flow_usage_t *qos_flow_usage_local_var = NULL;
|
||||
qos_flow_usage_local_var = OpenAPI_qos_flow_usage_create (
|
||||
);
|
||||
|
||||
return qos_flow_usage_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_qos_flow_usage_t *OpenAPI_qos_flow_usage_copy(OpenAPI_qos_flow_usage_t *dst, OpenAPI_qos_flow_usage_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_qos_flow_usage_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_qos_flow_usage_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_qos_flow_usage_free(dst);
|
||||
dst = OpenAPI_qos_flow_usage_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
36
lib/sbi/openapi/model/qos_flow_usage.h
Normal file
36
lib/sbi/openapi/model/qos_flow_usage.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* qos_flow_usage.h
|
||||
*
|
||||
* Possible values are - GENERAL: Indicate no specific QoS flow usage information is available. - IMS_SIG: Indicate that the QoS flow is used for IMS signalling only.
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_qos_flow_usage_H_
|
||||
#define _OpenAPI_qos_flow_usage_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_qos_flow_usage_s OpenAPI_qos_flow_usage_t;
|
||||
typedef struct OpenAPI_qos_flow_usage_s {
|
||||
} OpenAPI_qos_flow_usage_t;
|
||||
|
||||
OpenAPI_qos_flow_usage_t *OpenAPI_qos_flow_usage_create(
|
||||
);
|
||||
void OpenAPI_qos_flow_usage_free(OpenAPI_qos_flow_usage_t *qos_flow_usage);
|
||||
OpenAPI_qos_flow_usage_t *OpenAPI_qos_flow_usage_parseFromJSON(cJSON *qos_flow_usageJSON);
|
||||
cJSON *OpenAPI_qos_flow_usage_convertToJSON(OpenAPI_qos_flow_usage_t *qos_flow_usage);
|
||||
OpenAPI_qos_flow_usage_t *OpenAPI_qos_flow_usage_copy(OpenAPI_qos_flow_usage_t *dst, OpenAPI_qos_flow_usage_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_qos_flow_usage_H_ */
|
||||
|
||||
345
lib/sbi/openapi/model/qos_monitoring_data.c
Normal file
345
lib/sbi/openapi/model/qos_monitoring_data.c
Normal file
|
|
@ -0,0 +1,345 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "qos_monitoring_data.h"
|
||||
|
||||
OpenAPI_qos_monitoring_data_t *OpenAPI_qos_monitoring_data_create(
|
||||
char *qm_id,
|
||||
OpenAPI_list_t *req_qos_mon_params,
|
||||
OpenAPI_list_t *rep_freqs,
|
||||
int rep_thresh_dl,
|
||||
int rep_thresh_ul,
|
||||
int rep_thresh_rp,
|
||||
int wait_time,
|
||||
int rep_period,
|
||||
char *notify_uri,
|
||||
char *notify_corre_id
|
||||
)
|
||||
{
|
||||
OpenAPI_qos_monitoring_data_t *qos_monitoring_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_qos_monitoring_data_t));
|
||||
if (!qos_monitoring_data_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
qos_monitoring_data_local_var->qm_id = qm_id;
|
||||
qos_monitoring_data_local_var->req_qos_mon_params = req_qos_mon_params;
|
||||
qos_monitoring_data_local_var->rep_freqs = rep_freqs;
|
||||
qos_monitoring_data_local_var->rep_thresh_dl = rep_thresh_dl;
|
||||
qos_monitoring_data_local_var->rep_thresh_ul = rep_thresh_ul;
|
||||
qos_monitoring_data_local_var->rep_thresh_rp = rep_thresh_rp;
|
||||
qos_monitoring_data_local_var->wait_time = wait_time;
|
||||
qos_monitoring_data_local_var->rep_period = rep_period;
|
||||
qos_monitoring_data_local_var->notify_uri = notify_uri;
|
||||
qos_monitoring_data_local_var->notify_corre_id = notify_corre_id;
|
||||
|
||||
return qos_monitoring_data_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_qos_monitoring_data_free(OpenAPI_qos_monitoring_data_t *qos_monitoring_data)
|
||||
{
|
||||
if (NULL == qos_monitoring_data) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(qos_monitoring_data->qm_id);
|
||||
OpenAPI_list_for_each(qos_monitoring_data->req_qos_mon_params, node) {
|
||||
OpenAPI_requested_qos_monitoring_parameter_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(qos_monitoring_data->req_qos_mon_params);
|
||||
OpenAPI_list_for_each(qos_monitoring_data->rep_freqs, node) {
|
||||
OpenAPI_reporting_frequency_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(qos_monitoring_data->rep_freqs);
|
||||
ogs_free(qos_monitoring_data->notify_uri);
|
||||
ogs_free(qos_monitoring_data->notify_corre_id);
|
||||
ogs_free(qos_monitoring_data);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_qos_monitoring_data_convertToJSON(OpenAPI_qos_monitoring_data_t *qos_monitoring_data)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (qos_monitoring_data == NULL) {
|
||||
ogs_error("OpenAPI_qos_monitoring_data_convertToJSON() failed [QosMonitoringData]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (!qos_monitoring_data->qm_id) {
|
||||
ogs_error("OpenAPI_qos_monitoring_data_convertToJSON() failed [qm_id]");
|
||||
goto end;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "qmId", qos_monitoring_data->qm_id) == NULL) {
|
||||
ogs_error("OpenAPI_qos_monitoring_data_convertToJSON() failed [qm_id]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (qos_monitoring_data->req_qos_mon_params) {
|
||||
cJSON *req_qos_mon_paramsList = cJSON_AddArrayToObject(item, "reqQosMonParams");
|
||||
if (req_qos_mon_paramsList == NULL) {
|
||||
ogs_error("OpenAPI_qos_monitoring_data_convertToJSON() failed [req_qos_mon_params]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *req_qos_mon_params_node;
|
||||
if (qos_monitoring_data->req_qos_mon_params) {
|
||||
OpenAPI_list_for_each(qos_monitoring_data->req_qos_mon_params, req_qos_mon_params_node) {
|
||||
cJSON *itemLocal = OpenAPI_requested_qos_monitoring_parameter_convertToJSON(req_qos_mon_params_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_qos_monitoring_data_convertToJSON() failed [req_qos_mon_params]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(req_qos_mon_paramsList, itemLocal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (qos_monitoring_data->rep_freqs) {
|
||||
cJSON *rep_freqsList = cJSON_AddArrayToObject(item, "repFreqs");
|
||||
if (rep_freqsList == NULL) {
|
||||
ogs_error("OpenAPI_qos_monitoring_data_convertToJSON() failed [rep_freqs]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *rep_freqs_node;
|
||||
if (qos_monitoring_data->rep_freqs) {
|
||||
OpenAPI_list_for_each(qos_monitoring_data->rep_freqs, rep_freqs_node) {
|
||||
cJSON *itemLocal = OpenAPI_reporting_frequency_convertToJSON(rep_freqs_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_qos_monitoring_data_convertToJSON() failed [rep_freqs]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(rep_freqsList, itemLocal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (qos_monitoring_data->rep_thresh_dl) {
|
||||
if (cJSON_AddNumberToObject(item, "repThreshDl", qos_monitoring_data->rep_thresh_dl) == NULL) {
|
||||
ogs_error("OpenAPI_qos_monitoring_data_convertToJSON() failed [rep_thresh_dl]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (qos_monitoring_data->rep_thresh_ul) {
|
||||
if (cJSON_AddNumberToObject(item, "repThreshUl", qos_monitoring_data->rep_thresh_ul) == NULL) {
|
||||
ogs_error("OpenAPI_qos_monitoring_data_convertToJSON() failed [rep_thresh_ul]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (qos_monitoring_data->rep_thresh_rp) {
|
||||
if (cJSON_AddNumberToObject(item, "repThreshRp", qos_monitoring_data->rep_thresh_rp) == NULL) {
|
||||
ogs_error("OpenAPI_qos_monitoring_data_convertToJSON() failed [rep_thresh_rp]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (qos_monitoring_data->wait_time) {
|
||||
if (cJSON_AddNumberToObject(item, "waitTime", qos_monitoring_data->wait_time) == NULL) {
|
||||
ogs_error("OpenAPI_qos_monitoring_data_convertToJSON() failed [wait_time]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (qos_monitoring_data->rep_period) {
|
||||
if (cJSON_AddNumberToObject(item, "repPeriod", qos_monitoring_data->rep_period) == NULL) {
|
||||
ogs_error("OpenAPI_qos_monitoring_data_convertToJSON() failed [rep_period]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (qos_monitoring_data->notify_uri) {
|
||||
if (cJSON_AddStringToObject(item, "notifyUri", qos_monitoring_data->notify_uri) == NULL) {
|
||||
ogs_error("OpenAPI_qos_monitoring_data_convertToJSON() failed [notify_uri]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (qos_monitoring_data->notify_corre_id) {
|
||||
if (cJSON_AddStringToObject(item, "notifyCorreId", qos_monitoring_data->notify_corre_id) == NULL) {
|
||||
ogs_error("OpenAPI_qos_monitoring_data_convertToJSON() failed [notify_corre_id]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_qos_monitoring_data_t *OpenAPI_qos_monitoring_data_parseFromJSON(cJSON *qos_monitoring_dataJSON)
|
||||
{
|
||||
OpenAPI_qos_monitoring_data_t *qos_monitoring_data_local_var = NULL;
|
||||
cJSON *qm_id = cJSON_GetObjectItemCaseSensitive(qos_monitoring_dataJSON, "qmId");
|
||||
if (!qm_id) {
|
||||
ogs_error("OpenAPI_qos_monitoring_data_parseFromJSON() failed [qm_id]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
if (!cJSON_IsString(qm_id)) {
|
||||
ogs_error("OpenAPI_qos_monitoring_data_parseFromJSON() failed [qm_id]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *req_qos_mon_params = cJSON_GetObjectItemCaseSensitive(qos_monitoring_dataJSON, "reqQosMonParams");
|
||||
|
||||
OpenAPI_list_t *req_qos_mon_paramsList;
|
||||
if (req_qos_mon_params) {
|
||||
cJSON *req_qos_mon_params_local_nonprimitive;
|
||||
if (!cJSON_IsArray(req_qos_mon_params)) {
|
||||
ogs_error("OpenAPI_qos_monitoring_data_parseFromJSON() failed [req_qos_mon_params]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
req_qos_mon_paramsList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(req_qos_mon_params_local_nonprimitive, req_qos_mon_params ) {
|
||||
if (!cJSON_IsObject(req_qos_mon_params_local_nonprimitive)) {
|
||||
ogs_error("OpenAPI_qos_monitoring_data_parseFromJSON() failed [req_qos_mon_params]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_requested_qos_monitoring_parameter_t *req_qos_mon_paramsItem = OpenAPI_requested_qos_monitoring_parameter_parseFromJSON(req_qos_mon_params_local_nonprimitive);
|
||||
|
||||
OpenAPI_list_add(req_qos_mon_paramsList, req_qos_mon_paramsItem);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *rep_freqs = cJSON_GetObjectItemCaseSensitive(qos_monitoring_dataJSON, "repFreqs");
|
||||
|
||||
OpenAPI_list_t *rep_freqsList;
|
||||
if (rep_freqs) {
|
||||
cJSON *rep_freqs_local_nonprimitive;
|
||||
if (!cJSON_IsArray(rep_freqs)) {
|
||||
ogs_error("OpenAPI_qos_monitoring_data_parseFromJSON() failed [rep_freqs]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
rep_freqsList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(rep_freqs_local_nonprimitive, rep_freqs ) {
|
||||
if (!cJSON_IsObject(rep_freqs_local_nonprimitive)) {
|
||||
ogs_error("OpenAPI_qos_monitoring_data_parseFromJSON() failed [rep_freqs]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_reporting_frequency_t *rep_freqsItem = OpenAPI_reporting_frequency_parseFromJSON(rep_freqs_local_nonprimitive);
|
||||
|
||||
OpenAPI_list_add(rep_freqsList, rep_freqsItem);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *rep_thresh_dl = cJSON_GetObjectItemCaseSensitive(qos_monitoring_dataJSON, "repThreshDl");
|
||||
|
||||
if (rep_thresh_dl) {
|
||||
if (!cJSON_IsNumber(rep_thresh_dl)) {
|
||||
ogs_error("OpenAPI_qos_monitoring_data_parseFromJSON() failed [rep_thresh_dl]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *rep_thresh_ul = cJSON_GetObjectItemCaseSensitive(qos_monitoring_dataJSON, "repThreshUl");
|
||||
|
||||
if (rep_thresh_ul) {
|
||||
if (!cJSON_IsNumber(rep_thresh_ul)) {
|
||||
ogs_error("OpenAPI_qos_monitoring_data_parseFromJSON() failed [rep_thresh_ul]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *rep_thresh_rp = cJSON_GetObjectItemCaseSensitive(qos_monitoring_dataJSON, "repThreshRp");
|
||||
|
||||
if (rep_thresh_rp) {
|
||||
if (!cJSON_IsNumber(rep_thresh_rp)) {
|
||||
ogs_error("OpenAPI_qos_monitoring_data_parseFromJSON() failed [rep_thresh_rp]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *wait_time = cJSON_GetObjectItemCaseSensitive(qos_monitoring_dataJSON, "waitTime");
|
||||
|
||||
if (wait_time) {
|
||||
if (!cJSON_IsNumber(wait_time)) {
|
||||
ogs_error("OpenAPI_qos_monitoring_data_parseFromJSON() failed [wait_time]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *rep_period = cJSON_GetObjectItemCaseSensitive(qos_monitoring_dataJSON, "repPeriod");
|
||||
|
||||
if (rep_period) {
|
||||
if (!cJSON_IsNumber(rep_period)) {
|
||||
ogs_error("OpenAPI_qos_monitoring_data_parseFromJSON() failed [rep_period]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *notify_uri = cJSON_GetObjectItemCaseSensitive(qos_monitoring_dataJSON, "notifyUri");
|
||||
|
||||
if (notify_uri) {
|
||||
if (!cJSON_IsString(notify_uri)) {
|
||||
ogs_error("OpenAPI_qos_monitoring_data_parseFromJSON() failed [notify_uri]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *notify_corre_id = cJSON_GetObjectItemCaseSensitive(qos_monitoring_dataJSON, "notifyCorreId");
|
||||
|
||||
if (notify_corre_id) {
|
||||
if (!cJSON_IsString(notify_corre_id)) {
|
||||
ogs_error("OpenAPI_qos_monitoring_data_parseFromJSON() failed [notify_corre_id]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
qos_monitoring_data_local_var = OpenAPI_qos_monitoring_data_create (
|
||||
ogs_strdup(qm_id->valuestring),
|
||||
req_qos_mon_params ? req_qos_mon_paramsList : NULL,
|
||||
rep_freqs ? rep_freqsList : NULL,
|
||||
rep_thresh_dl ? rep_thresh_dl->valuedouble : 0,
|
||||
rep_thresh_ul ? rep_thresh_ul->valuedouble : 0,
|
||||
rep_thresh_rp ? rep_thresh_rp->valuedouble : 0,
|
||||
wait_time ? wait_time->valuedouble : 0,
|
||||
rep_period ? rep_period->valuedouble : 0,
|
||||
notify_uri ? ogs_strdup(notify_uri->valuestring) : NULL,
|
||||
notify_corre_id ? ogs_strdup(notify_corre_id->valuestring) : NULL
|
||||
);
|
||||
|
||||
return qos_monitoring_data_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_qos_monitoring_data_t *OpenAPI_qos_monitoring_data_copy(OpenAPI_qos_monitoring_data_t *dst, OpenAPI_qos_monitoring_data_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_qos_monitoring_data_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_qos_monitoring_data_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_qos_monitoring_data_free(dst);
|
||||
dst = OpenAPI_qos_monitoring_data_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
58
lib/sbi/openapi/model/qos_monitoring_data.h
Normal file
58
lib/sbi/openapi/model/qos_monitoring_data.h
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* qos_monitoring_data.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_qos_monitoring_data_H_
|
||||
#define _OpenAPI_qos_monitoring_data_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
#include "reporting_frequency.h"
|
||||
#include "requested_qos_monitoring_parameter.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_qos_monitoring_data_s OpenAPI_qos_monitoring_data_t;
|
||||
typedef struct OpenAPI_qos_monitoring_data_s {
|
||||
char *qm_id;
|
||||
OpenAPI_list_t *req_qos_mon_params;
|
||||
OpenAPI_list_t *rep_freqs;
|
||||
int rep_thresh_dl;
|
||||
int rep_thresh_ul;
|
||||
int rep_thresh_rp;
|
||||
int wait_time;
|
||||
int rep_period;
|
||||
char *notify_uri;
|
||||
char *notify_corre_id;
|
||||
} OpenAPI_qos_monitoring_data_t;
|
||||
|
||||
OpenAPI_qos_monitoring_data_t *OpenAPI_qos_monitoring_data_create(
|
||||
char *qm_id,
|
||||
OpenAPI_list_t *req_qos_mon_params,
|
||||
OpenAPI_list_t *rep_freqs,
|
||||
int rep_thresh_dl,
|
||||
int rep_thresh_ul,
|
||||
int rep_thresh_rp,
|
||||
int wait_time,
|
||||
int rep_period,
|
||||
char *notify_uri,
|
||||
char *notify_corre_id
|
||||
);
|
||||
void OpenAPI_qos_monitoring_data_free(OpenAPI_qos_monitoring_data_t *qos_monitoring_data);
|
||||
OpenAPI_qos_monitoring_data_t *OpenAPI_qos_monitoring_data_parseFromJSON(cJSON *qos_monitoring_dataJSON);
|
||||
cJSON *OpenAPI_qos_monitoring_data_convertToJSON(OpenAPI_qos_monitoring_data_t *qos_monitoring_data);
|
||||
OpenAPI_qos_monitoring_data_t *OpenAPI_qos_monitoring_data_copy(OpenAPI_qos_monitoring_data_t *dst, OpenAPI_qos_monitoring_data_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_qos_monitoring_data_H_ */
|
||||
|
||||
262
lib/sbi/openapi/model/qos_monitoring_report.c
Normal file
262
lib/sbi/openapi/model/qos_monitoring_report.c
Normal file
|
|
@ -0,0 +1,262 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "qos_monitoring_report.h"
|
||||
|
||||
OpenAPI_qos_monitoring_report_t *OpenAPI_qos_monitoring_report_create(
|
||||
OpenAPI_list_t *ref_pcc_rule_ids,
|
||||
OpenAPI_list_t *ul_delays,
|
||||
OpenAPI_list_t *dl_delays,
|
||||
OpenAPI_list_t *rt_delays
|
||||
)
|
||||
{
|
||||
OpenAPI_qos_monitoring_report_t *qos_monitoring_report_local_var = OpenAPI_malloc(sizeof(OpenAPI_qos_monitoring_report_t));
|
||||
if (!qos_monitoring_report_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
qos_monitoring_report_local_var->ref_pcc_rule_ids = ref_pcc_rule_ids;
|
||||
qos_monitoring_report_local_var->ul_delays = ul_delays;
|
||||
qos_monitoring_report_local_var->dl_delays = dl_delays;
|
||||
qos_monitoring_report_local_var->rt_delays = rt_delays;
|
||||
|
||||
return qos_monitoring_report_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_qos_monitoring_report_free(OpenAPI_qos_monitoring_report_t *qos_monitoring_report)
|
||||
{
|
||||
if (NULL == qos_monitoring_report) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_list_for_each(qos_monitoring_report->ref_pcc_rule_ids, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(qos_monitoring_report->ref_pcc_rule_ids);
|
||||
OpenAPI_list_for_each(qos_monitoring_report->ul_delays, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(qos_monitoring_report->ul_delays);
|
||||
OpenAPI_list_for_each(qos_monitoring_report->dl_delays, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(qos_monitoring_report->dl_delays);
|
||||
OpenAPI_list_for_each(qos_monitoring_report->rt_delays, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(qos_monitoring_report->rt_delays);
|
||||
ogs_free(qos_monitoring_report);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_qos_monitoring_report_convertToJSON(OpenAPI_qos_monitoring_report_t *qos_monitoring_report)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (qos_monitoring_report == NULL) {
|
||||
ogs_error("OpenAPI_qos_monitoring_report_convertToJSON() failed [QosMonitoringReport]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (!qos_monitoring_report->ref_pcc_rule_ids) {
|
||||
ogs_error("OpenAPI_qos_monitoring_report_convertToJSON() failed [ref_pcc_rule_ids]");
|
||||
goto end;
|
||||
}
|
||||
cJSON *ref_pcc_rule_ids = cJSON_AddArrayToObject(item, "refPccRuleIds");
|
||||
if (ref_pcc_rule_ids == NULL) {
|
||||
ogs_error("OpenAPI_qos_monitoring_report_convertToJSON() failed [ref_pcc_rule_ids]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *ref_pcc_rule_ids_node;
|
||||
OpenAPI_list_for_each(qos_monitoring_report->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_monitoring_report_convertToJSON() failed [ref_pcc_rule_ids]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (qos_monitoring_report->ul_delays) {
|
||||
cJSON *ul_delays = cJSON_AddArrayToObject(item, "ulDelays");
|
||||
if (ul_delays == NULL) {
|
||||
ogs_error("OpenAPI_qos_monitoring_report_convertToJSON() failed [ul_delays]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *ul_delays_node;
|
||||
OpenAPI_list_for_each(qos_monitoring_report->ul_delays, ul_delays_node) {
|
||||
if (cJSON_AddNumberToObject(ul_delays, "", *(double *)ul_delays_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_qos_monitoring_report_convertToJSON() failed [ul_delays]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (qos_monitoring_report->dl_delays) {
|
||||
cJSON *dl_delays = cJSON_AddArrayToObject(item, "dlDelays");
|
||||
if (dl_delays == NULL) {
|
||||
ogs_error("OpenAPI_qos_monitoring_report_convertToJSON() failed [dl_delays]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *dl_delays_node;
|
||||
OpenAPI_list_for_each(qos_monitoring_report->dl_delays, dl_delays_node) {
|
||||
if (cJSON_AddNumberToObject(dl_delays, "", *(double *)dl_delays_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_qos_monitoring_report_convertToJSON() failed [dl_delays]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (qos_monitoring_report->rt_delays) {
|
||||
cJSON *rt_delays = cJSON_AddArrayToObject(item, "rtDelays");
|
||||
if (rt_delays == NULL) {
|
||||
ogs_error("OpenAPI_qos_monitoring_report_convertToJSON() failed [rt_delays]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *rt_delays_node;
|
||||
OpenAPI_list_for_each(qos_monitoring_report->rt_delays, rt_delays_node) {
|
||||
if (cJSON_AddNumberToObject(rt_delays, "", *(double *)rt_delays_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_qos_monitoring_report_convertToJSON() failed [rt_delays]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_qos_monitoring_report_t *OpenAPI_qos_monitoring_report_parseFromJSON(cJSON *qos_monitoring_reportJSON)
|
||||
{
|
||||
OpenAPI_qos_monitoring_report_t *qos_monitoring_report_local_var = NULL;
|
||||
cJSON *ref_pcc_rule_ids = cJSON_GetObjectItemCaseSensitive(qos_monitoring_reportJSON, "refPccRuleIds");
|
||||
if (!ref_pcc_rule_ids) {
|
||||
ogs_error("OpenAPI_qos_monitoring_report_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_monitoring_report_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_monitoring_report_parseFromJSON() failed [ref_pcc_rule_ids]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(ref_pcc_rule_idsList, ogs_strdup(ref_pcc_rule_ids_local->valuestring));
|
||||
}
|
||||
|
||||
cJSON *ul_delays = cJSON_GetObjectItemCaseSensitive(qos_monitoring_reportJSON, "ulDelays");
|
||||
|
||||
OpenAPI_list_t *ul_delaysList;
|
||||
if (ul_delays) {
|
||||
cJSON *ul_delays_local;
|
||||
if (!cJSON_IsArray(ul_delays)) {
|
||||
ogs_error("OpenAPI_qos_monitoring_report_parseFromJSON() failed [ul_delays]");
|
||||
goto end;
|
||||
}
|
||||
ul_delaysList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(ul_delays_local, ul_delays) {
|
||||
if (!cJSON_IsNumber(ul_delays_local)) {
|
||||
ogs_error("OpenAPI_qos_monitoring_report_parseFromJSON() failed [ul_delays]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(ul_delaysList, &ul_delays_local->valuedouble);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *dl_delays = cJSON_GetObjectItemCaseSensitive(qos_monitoring_reportJSON, "dlDelays");
|
||||
|
||||
OpenAPI_list_t *dl_delaysList;
|
||||
if (dl_delays) {
|
||||
cJSON *dl_delays_local;
|
||||
if (!cJSON_IsArray(dl_delays)) {
|
||||
ogs_error("OpenAPI_qos_monitoring_report_parseFromJSON() failed [dl_delays]");
|
||||
goto end;
|
||||
}
|
||||
dl_delaysList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(dl_delays_local, dl_delays) {
|
||||
if (!cJSON_IsNumber(dl_delays_local)) {
|
||||
ogs_error("OpenAPI_qos_monitoring_report_parseFromJSON() failed [dl_delays]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(dl_delaysList, &dl_delays_local->valuedouble);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *rt_delays = cJSON_GetObjectItemCaseSensitive(qos_monitoring_reportJSON, "rtDelays");
|
||||
|
||||
OpenAPI_list_t *rt_delaysList;
|
||||
if (rt_delays) {
|
||||
cJSON *rt_delays_local;
|
||||
if (!cJSON_IsArray(rt_delays)) {
|
||||
ogs_error("OpenAPI_qos_monitoring_report_parseFromJSON() failed [rt_delays]");
|
||||
goto end;
|
||||
}
|
||||
rt_delaysList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(rt_delays_local, rt_delays) {
|
||||
if (!cJSON_IsNumber(rt_delays_local)) {
|
||||
ogs_error("OpenAPI_qos_monitoring_report_parseFromJSON() failed [rt_delays]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(rt_delaysList, &rt_delays_local->valuedouble);
|
||||
}
|
||||
}
|
||||
|
||||
qos_monitoring_report_local_var = OpenAPI_qos_monitoring_report_create (
|
||||
ref_pcc_rule_idsList,
|
||||
ul_delays ? ul_delaysList : NULL,
|
||||
dl_delays ? dl_delaysList : NULL,
|
||||
rt_delays ? rt_delaysList : NULL
|
||||
);
|
||||
|
||||
return qos_monitoring_report_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_qos_monitoring_report_t *OpenAPI_qos_monitoring_report_copy(OpenAPI_qos_monitoring_report_t *dst, OpenAPI_qos_monitoring_report_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_qos_monitoring_report_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_qos_monitoring_report_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_qos_monitoring_report_free(dst);
|
||||
dst = OpenAPI_qos_monitoring_report_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
44
lib/sbi/openapi/model/qos_monitoring_report.h
Normal file
44
lib/sbi/openapi/model/qos_monitoring_report.h
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* qos_monitoring_report.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_qos_monitoring_report_H_
|
||||
#define _OpenAPI_qos_monitoring_report_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_qos_monitoring_report_s OpenAPI_qos_monitoring_report_t;
|
||||
typedef struct OpenAPI_qos_monitoring_report_s {
|
||||
OpenAPI_list_t *ref_pcc_rule_ids;
|
||||
OpenAPI_list_t *ul_delays;
|
||||
OpenAPI_list_t *dl_delays;
|
||||
OpenAPI_list_t *rt_delays;
|
||||
} OpenAPI_qos_monitoring_report_t;
|
||||
|
||||
OpenAPI_qos_monitoring_report_t *OpenAPI_qos_monitoring_report_create(
|
||||
OpenAPI_list_t *ref_pcc_rule_ids,
|
||||
OpenAPI_list_t *ul_delays,
|
||||
OpenAPI_list_t *dl_delays,
|
||||
OpenAPI_list_t *rt_delays
|
||||
);
|
||||
void OpenAPI_qos_monitoring_report_free(OpenAPI_qos_monitoring_report_t *qos_monitoring_report);
|
||||
OpenAPI_qos_monitoring_report_t *OpenAPI_qos_monitoring_report_parseFromJSON(cJSON *qos_monitoring_reportJSON);
|
||||
cJSON *OpenAPI_qos_monitoring_report_convertToJSON(OpenAPI_qos_monitoring_report_t *qos_monitoring_report);
|
||||
OpenAPI_qos_monitoring_report_t *OpenAPI_qos_monitoring_report_copy(OpenAPI_qos_monitoring_report_t *dst, OpenAPI_qos_monitoring_report_t *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OpenAPI_qos_monitoring_report_H_ */
|
||||
|
||||
85
lib/sbi/openapi/model/qos_notif_type.c
Normal file
85
lib/sbi/openapi/model/qos_notif_type.c
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "qos_notif_type.h"
|
||||
|
||||
OpenAPI_qos_notif_type_t *OpenAPI_qos_notif_type_create(
|
||||
)
|
||||
{
|
||||
OpenAPI_qos_notif_type_t *qos_notif_type_local_var = OpenAPI_malloc(sizeof(OpenAPI_qos_notif_type_t));
|
||||
if (!qos_notif_type_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return qos_notif_type_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_qos_notif_type_free(OpenAPI_qos_notif_type_t *qos_notif_type)
|
||||
{
|
||||
if (NULL == qos_notif_type) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(qos_notif_type);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_qos_notif_type_convertToJSON(OpenAPI_qos_notif_type_t *qos_notif_type)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (qos_notif_type == NULL) {
|
||||
ogs_error("OpenAPI_qos_notif_type_convertToJSON() failed [QosNotifType]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_qos_notif_type_t *OpenAPI_qos_notif_type_parseFromJSON(cJSON *qos_notif_typeJSON)
|
||||
{
|
||||
OpenAPI_qos_notif_type_t *qos_notif_type_local_var = NULL;
|
||||
qos_notif_type_local_var = OpenAPI_qos_notif_type_create (
|
||||
);
|
||||
|
||||
return qos_notif_type_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_qos_notif_type_t *OpenAPI_qos_notif_type_copy(OpenAPI_qos_notif_type_t *dst, OpenAPI_qos_notif_type_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_qos_notif_type_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_qos_notif_type_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_qos_notif_type_free(dst);
|
||||
dst = OpenAPI_qos_notif_type_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue