/src/open5gs/lib/sbi/openapi/model/flow_status.c
Line | Count | Source |
1 | | |
2 | | #include <stdlib.h> |
3 | | #include <string.h> |
4 | | #include <stdio.h> |
5 | | #include "flow_status.h" |
6 | | |
7 | | char* OpenAPI_flow_status_ToString(OpenAPI_flow_status_e flow_status) |
8 | 0 | { |
9 | 0 | const char *flow_statusArray[] = { "NULL", "ENABLED-UPLINK", "ENABLED-DOWNLINK", "ENABLED", "DISABLED", "REMOVED" }; |
10 | 0 | size_t sizeofArray = sizeof(flow_statusArray) / sizeof(flow_statusArray[0]); |
11 | 0 | if (flow_status < sizeofArray) |
12 | 0 | return (char *)flow_statusArray[flow_status]; |
13 | 0 | else |
14 | 0 | return (char *)"Unknown"; |
15 | 0 | } |
16 | | |
17 | | OpenAPI_flow_status_e OpenAPI_flow_status_FromString(char* flow_status) |
18 | 0 | { |
19 | 0 | int stringToReturn = 0; |
20 | 0 | const char *flow_statusArray[] = { "NULL", "ENABLED-UPLINK", "ENABLED-DOWNLINK", "ENABLED", "DISABLED", "REMOVED" }; |
21 | 0 | size_t sizeofArray = sizeof(flow_statusArray) / sizeof(flow_statusArray[0]); |
22 | 0 | while (stringToReturn < sizeofArray) { |
23 | 0 | if (strcmp(flow_status, flow_statusArray[stringToReturn]) == 0) { |
24 | 0 | return stringToReturn; |
25 | 0 | } |
26 | 0 | stringToReturn++; |
27 | 0 | } |
28 | 0 | return 0; |
29 | 0 | } |
30 | | |