mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-02 21:30:10 +00:00
simple 5GC registration is done
This commit is contained in:
parent
bcd02b1f33
commit
b35c2277be
213 changed files with 7713 additions and 5445 deletions
|
|
@ -4,82 +4,27 @@
|
|||
#include <stdio.h>
|
||||
#include "resource_status.h"
|
||||
|
||||
OpenAPI_resource_status_t *OpenAPI_resource_status_create(
|
||||
)
|
||||
char* OpenAPI_resource_status_ToString(OpenAPI_resource_status_e resource_status)
|
||||
{
|
||||
OpenAPI_resource_status_t *resource_status_local_var = OpenAPI_malloc(sizeof(OpenAPI_resource_status_t));
|
||||
if (!resource_status_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return resource_status_local_var;
|
||||
const char *resource_statusArray[] = { "NULL", "RELEASED", "UNCHANGED", "TRANSFERRED", "UPDATED" };
|
||||
size_t sizeofArray = sizeof(resource_statusArray) / sizeof(resource_statusArray[0]);
|
||||
if (resource_status < sizeofArray)
|
||||
return (char *)resource_statusArray[resource_status];
|
||||
else
|
||||
return (char *)"Unknown";
|
||||
}
|
||||
|
||||
void OpenAPI_resource_status_free(OpenAPI_resource_status_t *resource_status)
|
||||
OpenAPI_resource_status_e OpenAPI_resource_status_FromString(char* resource_status)
|
||||
{
|
||||
if (NULL == resource_status) {
|
||||
return;
|
||||
int stringToReturn = 0;
|
||||
const char *resource_statusArray[] = { "NULL", "RELEASED", "UNCHANGED", "TRANSFERRED", "UPDATED" };
|
||||
size_t sizeofArray = sizeof(resource_statusArray) / sizeof(resource_statusArray[0]);
|
||||
while (stringToReturn < sizeofArray) {
|
||||
if (strcmp(resource_status, resource_statusArray[stringToReturn]) == 0) {
|
||||
return stringToReturn;
|
||||
}
|
||||
stringToReturn++;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(resource_status);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_resource_status_convertToJSON(OpenAPI_resource_status_t *resource_status)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (resource_status == NULL) {
|
||||
ogs_error("OpenAPI_resource_status_convertToJSON() failed [ResourceStatus]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_resource_status_t *OpenAPI_resource_status_parseFromJSON(cJSON *resource_statusJSON)
|
||||
{
|
||||
OpenAPI_resource_status_t *resource_status_local_var = NULL;
|
||||
resource_status_local_var = OpenAPI_resource_status_create (
|
||||
);
|
||||
|
||||
return resource_status_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_resource_status_t *OpenAPI_resource_status_copy(OpenAPI_resource_status_t *dst, OpenAPI_resource_status_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_resource_status_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_resource_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_resource_status_free(dst);
|
||||
dst = OpenAPI_resource_status_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue