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