mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-02 21:30:10 +00:00
[5GC] Added BSF(Binding Support Function)
This commit is contained in:
parent
611986794b
commit
fe89f7cd11
293 changed files with 24988 additions and 1507 deletions
|
|
@ -4,82 +4,27 @@
|
|||
#include <stdio.h>
|
||||
#include "registration_reason.h"
|
||||
|
||||
OpenAPI_registration_reason_t *OpenAPI_registration_reason_create(
|
||||
)
|
||||
char* OpenAPI_registration_reason_ToString(OpenAPI_registration_reason_e registration_reason)
|
||||
{
|
||||
OpenAPI_registration_reason_t *registration_reason_local_var = OpenAPI_malloc(sizeof(OpenAPI_registration_reason_t));
|
||||
if (!registration_reason_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return registration_reason_local_var;
|
||||
const char *registration_reasonArray[] = { "NULL", "SMF_CONTEXT_TRANSFERRED" };
|
||||
size_t sizeofArray = sizeof(registration_reasonArray) / sizeof(registration_reasonArray[0]);
|
||||
if (registration_reason < sizeofArray)
|
||||
return (char *)registration_reasonArray[registration_reason];
|
||||
else
|
||||
return (char *)"Unknown";
|
||||
}
|
||||
|
||||
void OpenAPI_registration_reason_free(OpenAPI_registration_reason_t *registration_reason)
|
||||
OpenAPI_registration_reason_e OpenAPI_registration_reason_FromString(char* registration_reason)
|
||||
{
|
||||
if (NULL == registration_reason) {
|
||||
return;
|
||||
int stringToReturn = 0;
|
||||
const char *registration_reasonArray[] = { "NULL", "SMF_CONTEXT_TRANSFERRED" };
|
||||
size_t sizeofArray = sizeof(registration_reasonArray) / sizeof(registration_reasonArray[0]);
|
||||
while (stringToReturn < sizeofArray) {
|
||||
if (strcmp(registration_reason, registration_reasonArray[stringToReturn]) == 0) {
|
||||
return stringToReturn;
|
||||
}
|
||||
stringToReturn++;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(registration_reason);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_registration_reason_convertToJSON(OpenAPI_registration_reason_t *registration_reason)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (registration_reason == NULL) {
|
||||
ogs_error("OpenAPI_registration_reason_convertToJSON() failed [RegistrationReason]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_registration_reason_t *OpenAPI_registration_reason_parseFromJSON(cJSON *registration_reasonJSON)
|
||||
{
|
||||
OpenAPI_registration_reason_t *registration_reason_local_var = NULL;
|
||||
registration_reason_local_var = OpenAPI_registration_reason_create (
|
||||
);
|
||||
|
||||
return registration_reason_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_registration_reason_t *OpenAPI_registration_reason_copy(OpenAPI_registration_reason_t *dst, OpenAPI_registration_reason_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_registration_reason_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_registration_reason_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_registration_reason_free(dst);
|
||||
dst = OpenAPI_registration_reason_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue