Add AUSF, UDM, and UDR

This commit is contained in:
Sukchan Lee 2020-06-04 14:12:05 -04:00
parent 0c0241d5e5
commit 72370ff0b2
1151 changed files with 140173 additions and 24799 deletions

View file

@ -0,0 +1,91 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "app_descriptor.h"
OpenAPI_app_descriptor_t *OpenAPI_app_descriptor_create(
char *os_id,
char *app_id
)
{
OpenAPI_app_descriptor_t *app_descriptor_local_var = OpenAPI_malloc(sizeof(OpenAPI_app_descriptor_t));
if (!app_descriptor_local_var) {
return NULL;
}
app_descriptor_local_var->os_id = os_id;
app_descriptor_local_var->app_id = app_id;
return app_descriptor_local_var;
}
void OpenAPI_app_descriptor_free(OpenAPI_app_descriptor_t *app_descriptor)
{
if (NULL == app_descriptor) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(app_descriptor->os_id);
ogs_free(app_descriptor->app_id);
ogs_free(app_descriptor);
}
cJSON *OpenAPI_app_descriptor_convertToJSON(OpenAPI_app_descriptor_t *app_descriptor)
{
cJSON *item = NULL;
if (app_descriptor == NULL) {
ogs_error("OpenAPI_app_descriptor_convertToJSON() failed [AppDescriptor]");
return NULL;
}
item = cJSON_CreateObject();
if (app_descriptor->os_id) {
if (cJSON_AddStringToObject(item, "osId", app_descriptor->os_id) == NULL) {
ogs_error("OpenAPI_app_descriptor_convertToJSON() failed [os_id]");
goto end;
}
}
if (app_descriptor->app_id) {
if (cJSON_AddStringToObject(item, "appId", app_descriptor->app_id) == NULL) {
ogs_error("OpenAPI_app_descriptor_convertToJSON() failed [app_id]");
goto end;
}
}
end:
return item;
}
OpenAPI_app_descriptor_t *OpenAPI_app_descriptor_parseFromJSON(cJSON *app_descriptorJSON)
{
OpenAPI_app_descriptor_t *app_descriptor_local_var = NULL;
cJSON *os_id = cJSON_GetObjectItemCaseSensitive(app_descriptorJSON, "osId");
if (os_id) {
if (!cJSON_IsString(os_id)) {
ogs_error("OpenAPI_app_descriptor_parseFromJSON() failed [os_id]");
goto end;
}
}
cJSON *app_id = cJSON_GetObjectItemCaseSensitive(app_descriptorJSON, "appId");
if (app_id) {
if (!cJSON_IsString(app_id)) {
ogs_error("OpenAPI_app_descriptor_parseFromJSON() failed [app_id]");
goto end;
}
}
app_descriptor_local_var = OpenAPI_app_descriptor_create (
os_id ? ogs_strdup(os_id->valuestring) : NULL,
app_id ? ogs_strdup(app_id->valuestring) : NULL
);
return app_descriptor_local_var;
end:
return NULL;
}