mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-04 22:30:09 +00:00
[Release-17] Upgrade SBI to v17.x.0
This commit is contained in:
parent
969c116e77
commit
4d44b1843e
1687 changed files with 121604 additions and 9310 deletions
|
|
@ -8,7 +8,8 @@ OpenAPI_nsi_information_t *OpenAPI_nsi_information_create(
|
|||
char *nrf_id,
|
||||
char *nsi_id,
|
||||
char *nrf_nf_mgt_uri,
|
||||
char *nrf_access_token_uri
|
||||
char *nrf_access_token_uri,
|
||||
OpenAPI_list_t* nrf_oauth2_required
|
||||
)
|
||||
{
|
||||
OpenAPI_nsi_information_t *nsi_information_local_var = ogs_malloc(sizeof(OpenAPI_nsi_information_t));
|
||||
|
|
@ -18,6 +19,7 @@ OpenAPI_nsi_information_t *OpenAPI_nsi_information_create(
|
|||
nsi_information_local_var->nsi_id = nsi_id;
|
||||
nsi_information_local_var->nrf_nf_mgt_uri = nrf_nf_mgt_uri;
|
||||
nsi_information_local_var->nrf_access_token_uri = nrf_access_token_uri;
|
||||
nsi_information_local_var->nrf_oauth2_required = nrf_oauth2_required;
|
||||
|
||||
return nsi_information_local_var;
|
||||
}
|
||||
|
|
@ -45,6 +47,16 @@ void OpenAPI_nsi_information_free(OpenAPI_nsi_information_t *nsi_information)
|
|||
ogs_free(nsi_information->nrf_access_token_uri);
|
||||
nsi_information->nrf_access_token_uri = NULL;
|
||||
}
|
||||
if (nsi_information->nrf_oauth2_required) {
|
||||
OpenAPI_list_for_each(nsi_information->nrf_oauth2_required, node) {
|
||||
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
|
||||
ogs_free(localKeyValue->key);
|
||||
ogs_free(localKeyValue->value);
|
||||
OpenAPI_map_free(localKeyValue);
|
||||
}
|
||||
OpenAPI_list_free(nsi_information->nrf_oauth2_required);
|
||||
nsi_information->nrf_oauth2_required = NULL;
|
||||
}
|
||||
ogs_free(nsi_information);
|
||||
}
|
||||
|
||||
|
|
@ -89,6 +101,24 @@ cJSON *OpenAPI_nsi_information_convertToJSON(OpenAPI_nsi_information_t *nsi_info
|
|||
}
|
||||
}
|
||||
|
||||
if (nsi_information->nrf_oauth2_required) {
|
||||
cJSON *nrf_oauth2_required = cJSON_AddObjectToObject(item, "nrfOauth2Required");
|
||||
if (nrf_oauth2_required == NULL) {
|
||||
ogs_error("OpenAPI_nsi_information_convertToJSON() failed [nrf_oauth2_required]");
|
||||
goto end;
|
||||
}
|
||||
cJSON *localMapObject = nrf_oauth2_required;
|
||||
if (nsi_information->nrf_oauth2_required) {
|
||||
OpenAPI_list_for_each(nsi_information->nrf_oauth2_required, node) {
|
||||
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
|
||||
if (cJSON_AddBoolToObject(localMapObject, localKeyValue->key, (uintptr_t)localKeyValue->value) == NULL) {
|
||||
ogs_error("OpenAPI_nsi_information_convertToJSON() failed [inner]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
|
@ -101,6 +131,8 @@ OpenAPI_nsi_information_t *OpenAPI_nsi_information_parseFromJSON(cJSON *nsi_info
|
|||
cJSON *nsi_id = NULL;
|
||||
cJSON *nrf_nf_mgt_uri = NULL;
|
||||
cJSON *nrf_access_token_uri = NULL;
|
||||
cJSON *nrf_oauth2_required = NULL;
|
||||
OpenAPI_list_t *nrf_oauth2_requiredList = NULL;
|
||||
nrf_id = cJSON_GetObjectItemCaseSensitive(nsi_informationJSON, "nrfId");
|
||||
if (!nrf_id) {
|
||||
ogs_error("OpenAPI_nsi_information_parseFromJSON() failed [nrf_id]");
|
||||
|
|
@ -135,15 +167,56 @@ OpenAPI_nsi_information_t *OpenAPI_nsi_information_parseFromJSON(cJSON *nsi_info
|
|||
}
|
||||
}
|
||||
|
||||
nrf_oauth2_required = cJSON_GetObjectItemCaseSensitive(nsi_informationJSON, "nrfOauth2Required");
|
||||
if (nrf_oauth2_required) {
|
||||
cJSON *nrf_oauth2_required_local_map = NULL;
|
||||
if (!cJSON_IsObject(nrf_oauth2_required) && !cJSON_IsNull(nrf_oauth2_required)) {
|
||||
ogs_error("OpenAPI_nsi_information_parseFromJSON() failed [nrf_oauth2_required]");
|
||||
goto end;
|
||||
}
|
||||
if (cJSON_IsObject(nrf_oauth2_required)) {
|
||||
nrf_oauth2_requiredList = OpenAPI_list_create();
|
||||
OpenAPI_map_t *localMapKeyPair = NULL;
|
||||
cJSON_ArrayForEach(nrf_oauth2_required_local_map, nrf_oauth2_required) {
|
||||
cJSON *localMapObject = nrf_oauth2_required_local_map;
|
||||
double *localDouble = NULL;
|
||||
int *localInt = NULL;
|
||||
if (!cJSON_IsBool(localMapObject)) {
|
||||
ogs_error("OpenAPI_nsi_information_parseFromJSON() failed [inner]");
|
||||
goto end;
|
||||
}
|
||||
localInt = (int *)ogs_calloc(1, sizeof(int));
|
||||
if (!localInt) {
|
||||
ogs_error("OpenAPI_nsi_information_parseFromJSON() failed [inner]");
|
||||
goto end;
|
||||
}
|
||||
*localInt = localMapObject->valueint;
|
||||
localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), localInt);
|
||||
OpenAPI_list_add(nrf_oauth2_requiredList, localMapKeyPair);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsi_information_local_var = OpenAPI_nsi_information_create (
|
||||
ogs_strdup(nrf_id->valuestring),
|
||||
nsi_id && !cJSON_IsNull(nsi_id) ? ogs_strdup(nsi_id->valuestring) : NULL,
|
||||
nrf_nf_mgt_uri && !cJSON_IsNull(nrf_nf_mgt_uri) ? ogs_strdup(nrf_nf_mgt_uri->valuestring) : NULL,
|
||||
nrf_access_token_uri && !cJSON_IsNull(nrf_access_token_uri) ? ogs_strdup(nrf_access_token_uri->valuestring) : NULL
|
||||
nrf_access_token_uri && !cJSON_IsNull(nrf_access_token_uri) ? ogs_strdup(nrf_access_token_uri->valuestring) : NULL,
|
||||
nrf_oauth2_required ? nrf_oauth2_requiredList : NULL
|
||||
);
|
||||
|
||||
return nsi_information_local_var;
|
||||
end:
|
||||
if (nrf_oauth2_requiredList) {
|
||||
OpenAPI_list_for_each(nrf_oauth2_requiredList, node) {
|
||||
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data;
|
||||
ogs_free(localKeyValue->key);
|
||||
ogs_free(localKeyValue->value);
|
||||
OpenAPI_map_free(localKeyValue);
|
||||
}
|
||||
OpenAPI_list_free(nrf_oauth2_requiredList);
|
||||
nrf_oauth2_requiredList = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue