/src/open5gs/lib/sbi/openapi/model/mps_action.c
Line | Count | Source |
1 | | |
2 | | #include <stdlib.h> |
3 | | #include <string.h> |
4 | | #include <stdio.h> |
5 | | #include "mps_action.h" |
6 | | |
7 | | char* OpenAPI_mps_action_ToString(OpenAPI_mps_action_e mps_action) |
8 | 0 | { |
9 | 0 | const char *mps_actionArray[] = { "NULL", "DISABLE_MPS_FOR_DTS", "ENABLE_MPS_FOR_DTS", "AUTHORIZE_AND_ENABLE_MPS_FOR_DTS", "AUTHORIZE_AND_ENABLE_MPS_FOR_AF_SIGNALLING", "DISABLE_MPS_FOR_MESSAGING_FOR_AF_SIGNALLING", "ENABLE_MPS_FOR_MESSAGING_FOR_AF_SIGNALLING" }; |
10 | 0 | size_t sizeofArray = sizeof(mps_actionArray) / sizeof(mps_actionArray[0]); |
11 | 0 | if (mps_action < sizeofArray) |
12 | 0 | return (char *)mps_actionArray[mps_action]; |
13 | 0 | else |
14 | 0 | return (char *)"Unknown"; |
15 | 0 | } |
16 | | |
17 | | OpenAPI_mps_action_e OpenAPI_mps_action_FromString(char* mps_action) |
18 | 6 | { |
19 | 6 | int stringToReturn = 0; |
20 | 6 | const char *mps_actionArray[] = { "NULL", "DISABLE_MPS_FOR_DTS", "ENABLE_MPS_FOR_DTS", "AUTHORIZE_AND_ENABLE_MPS_FOR_DTS", "AUTHORIZE_AND_ENABLE_MPS_FOR_AF_SIGNALLING", "DISABLE_MPS_FOR_MESSAGING_FOR_AF_SIGNALLING", "ENABLE_MPS_FOR_MESSAGING_FOR_AF_SIGNALLING" }; |
21 | 6 | size_t sizeofArray = sizeof(mps_actionArray) / sizeof(mps_actionArray[0]); |
22 | 48 | while (stringToReturn < sizeofArray) { |
23 | 42 | if (strcmp(mps_action, mps_actionArray[stringToReturn]) == 0) { |
24 | 0 | return stringToReturn; |
25 | 0 | } |
26 | 42 | stringToReturn++; |
27 | 42 | } |
28 | 6 | return 0; |
29 | 6 | } |
30 | | |