open5gs/lib/sbi/openapi/model/n4_message_type.c

31 lines
1.2 KiB
C
Raw Normal View History

2020-06-17 05:22:28 +00:00
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "n4_message_type.h"
2020-06-22 03:07:14 +00:00
char* OpenAPI_n4_message_type_ToString(OpenAPI_n4_message_type_e n4_message_type)
2020-06-17 05:22:28 +00:00
{
2020-06-22 03:07:14 +00:00
const char *n4_message_typeArray[] = { "NULL", "PFCP_SES_EST_REQ", "PFCP_SES_EST_RSP", "PFCP_SES_MOD_REQ", "PFCP_SES_MOD_RSP", "PFCP_SES_DEL_REQ", "PFCP_SES_DEL_RSP", "PFCP_SES_REP_REQ", "PFCP_SES_REP_RSP" };
size_t sizeofArray = sizeof(n4_message_typeArray) / sizeof(n4_message_typeArray[0]);
if (n4_message_type < sizeofArray)
return (char *)n4_message_typeArray[n4_message_type];
else
return (char *)"Unknown";
2020-06-17 05:22:28 +00:00
}
2020-06-22 03:07:14 +00:00
OpenAPI_n4_message_type_e OpenAPI_n4_message_type_FromString(char* n4_message_type)
2020-06-17 05:22:28 +00:00
{
2020-06-22 03:07:14 +00:00
int stringToReturn = 0;
const char *n4_message_typeArray[] = { "NULL", "PFCP_SES_EST_REQ", "PFCP_SES_EST_RSP", "PFCP_SES_MOD_REQ", "PFCP_SES_MOD_RSP", "PFCP_SES_DEL_REQ", "PFCP_SES_DEL_RSP", "PFCP_SES_REP_REQ", "PFCP_SES_REP_RSP" };
size_t sizeofArray = sizeof(n4_message_typeArray) / sizeof(n4_message_typeArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(n4_message_type, n4_message_typeArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
2020-06-17 05:22:28 +00:00
}
2020-06-22 03:07:14 +00:00
return 0;
2020-06-17 05:22:28 +00:00
}