/src/open5gs/lib/sbi/openapi/model/flow_direction.c
Line | Count | Source |
1 | | |
2 | | #include <stdlib.h> |
3 | | #include <string.h> |
4 | | #include <stdio.h> |
5 | | #include "flow_direction.h" |
6 | | |
7 | | char* OpenAPI_flow_direction_ToString(OpenAPI_flow_direction_e flow_direction) |
8 | 0 | { |
9 | 0 | const char *flow_directionArray[] = { "NULL", "DOWNLINK", "UPLINK", "BIDIRECTIONAL", "UNSPECIFIED" }; |
10 | 0 | size_t sizeofArray = sizeof(flow_directionArray) / sizeof(flow_directionArray[0]); |
11 | 0 | if (flow_direction < sizeofArray) |
12 | 0 | return (char *)flow_directionArray[flow_direction]; |
13 | 0 | else |
14 | 0 | return (char *)"Unknown"; |
15 | 0 | } |
16 | | |
17 | | OpenAPI_flow_direction_e OpenAPI_flow_direction_FromString(char* flow_direction) |
18 | 1.60k | { |
19 | 1.60k | int stringToReturn = 0; |
20 | 1.60k | const char *flow_directionArray[] = { "NULL", "DOWNLINK", "UPLINK", "BIDIRECTIONAL", "UNSPECIFIED" }; |
21 | 1.60k | size_t sizeofArray = sizeof(flow_directionArray) / sizeof(flow_directionArray[0]); |
22 | 6.96k | while (stringToReturn < sizeofArray) { |
23 | 6.08k | if (strcmp(flow_direction, flow_directionArray[stringToReturn]) == 0) { |
24 | 730 | return stringToReturn; |
25 | 730 | } |
26 | 5.35k | stringToReturn++; |
27 | 5.35k | } |
28 | 877 | return 0; |
29 | 1.60k | } |
30 | | |