Coverage Report

Created: 2026-08-17 06:12

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/open5gs/lib/sbi/openapi/model/exemption_ind.c
Line
Count
Source
1
2
#include <stdlib.h>
3
#include <string.h>
4
#include <stdio.h>
5
#include "exemption_ind.h"
6
7
OpenAPI_exemption_ind_t *OpenAPI_exemption_ind_create(
8
    bool is_dnn_congestion,
9
    int dnn_congestion,
10
    bool is_snssai_only_congestion,
11
    int snssai_only_congestion,
12
    bool is_snssai_dnn_congestion,
13
    int snssai_dnn_congestion
14
)
15
0
{
16
0
    OpenAPI_exemption_ind_t *exemption_ind_local_var = ogs_malloc(sizeof(OpenAPI_exemption_ind_t));
17
0
    ogs_assert(exemption_ind_local_var);
18
19
0
    exemption_ind_local_var->is_dnn_congestion = is_dnn_congestion;
20
0
    exemption_ind_local_var->dnn_congestion = dnn_congestion;
21
0
    exemption_ind_local_var->is_snssai_only_congestion = is_snssai_only_congestion;
22
0
    exemption_ind_local_var->snssai_only_congestion = snssai_only_congestion;
23
0
    exemption_ind_local_var->is_snssai_dnn_congestion = is_snssai_dnn_congestion;
24
0
    exemption_ind_local_var->snssai_dnn_congestion = snssai_dnn_congestion;
25
26
0
    return exemption_ind_local_var;
27
0
}
28
29
void OpenAPI_exemption_ind_free(OpenAPI_exemption_ind_t *exemption_ind)
30
0
{
31
0
    OpenAPI_lnode_t *node = NULL;
32
33
0
    if (NULL == exemption_ind) {
34
0
        return;
35
0
    }
36
0
    ogs_free(exemption_ind);
37
0
}
38
39
cJSON *OpenAPI_exemption_ind_convertToJSON(OpenAPI_exemption_ind_t *exemption_ind)
40
0
{
41
0
    cJSON *item = NULL;
42
0
    OpenAPI_lnode_t *node = NULL;
43
44
0
    if (exemption_ind == NULL) {
45
0
        ogs_error("OpenAPI_exemption_ind_convertToJSON() failed [ExemptionInd]");
46
0
        return NULL;
47
0
    }
48
49
0
    item = cJSON_CreateObject();
50
0
    if (exemption_ind->is_dnn_congestion) {
51
0
    if (cJSON_AddBoolToObject(item, "dnnCongestion", exemption_ind->dnn_congestion) == NULL) {
52
0
        ogs_error("OpenAPI_exemption_ind_convertToJSON() failed [dnn_congestion]");
53
0
        goto end;
54
0
    }
55
0
    }
56
57
0
    if (exemption_ind->is_snssai_only_congestion) {
58
0
    if (cJSON_AddBoolToObject(item, "snssaiOnlyCongestion", exemption_ind->snssai_only_congestion) == NULL) {
59
0
        ogs_error("OpenAPI_exemption_ind_convertToJSON() failed [snssai_only_congestion]");
60
0
        goto end;
61
0
    }
62
0
    }
63
64
0
    if (exemption_ind->is_snssai_dnn_congestion) {
65
0
    if (cJSON_AddBoolToObject(item, "snssaiDnnCongestion", exemption_ind->snssai_dnn_congestion) == NULL) {
66
0
        ogs_error("OpenAPI_exemption_ind_convertToJSON() failed [snssai_dnn_congestion]");
67
0
        goto end;
68
0
    }
69
0
    }
70
71
0
end:
72
0
    return item;
73
0
}
74
75
OpenAPI_exemption_ind_t *OpenAPI_exemption_ind_parseFromJSON(cJSON *exemption_indJSON)
76
0
{
77
0
    OpenAPI_exemption_ind_t *exemption_ind_local_var = NULL;
78
0
    OpenAPI_lnode_t *node = NULL;
79
0
    cJSON *dnn_congestion = NULL;
80
0
    cJSON *snssai_only_congestion = NULL;
81
0
    cJSON *snssai_dnn_congestion = NULL;
82
0
    dnn_congestion = cJSON_GetObjectItemCaseSensitive(exemption_indJSON, "dnnCongestion");
83
0
    if (dnn_congestion) {
84
0
    if (!cJSON_IsBool(dnn_congestion)) {
85
0
        ogs_error("OpenAPI_exemption_ind_parseFromJSON() failed [dnn_congestion]");
86
0
        goto end;
87
0
    }
88
0
    }
89
90
0
    snssai_only_congestion = cJSON_GetObjectItemCaseSensitive(exemption_indJSON, "snssaiOnlyCongestion");
91
0
    if (snssai_only_congestion) {
92
0
    if (!cJSON_IsBool(snssai_only_congestion)) {
93
0
        ogs_error("OpenAPI_exemption_ind_parseFromJSON() failed [snssai_only_congestion]");
94
0
        goto end;
95
0
    }
96
0
    }
97
98
0
    snssai_dnn_congestion = cJSON_GetObjectItemCaseSensitive(exemption_indJSON, "snssaiDnnCongestion");
99
0
    if (snssai_dnn_congestion) {
100
0
    if (!cJSON_IsBool(snssai_dnn_congestion)) {
101
0
        ogs_error("OpenAPI_exemption_ind_parseFromJSON() failed [snssai_dnn_congestion]");
102
0
        goto end;
103
0
    }
104
0
    }
105
106
0
    exemption_ind_local_var = OpenAPI_exemption_ind_create (
107
0
        dnn_congestion ? true : false,
108
0
        dnn_congestion ? dnn_congestion->valueint : 0,
109
0
        snssai_only_congestion ? true : false,
110
0
        snssai_only_congestion ? snssai_only_congestion->valueint : 0,
111
0
        snssai_dnn_congestion ? true : false,
112
0
        snssai_dnn_congestion ? snssai_dnn_congestion->valueint : 0
113
0
    );
114
115
0
    return exemption_ind_local_var;
116
0
end:
117
0
    return NULL;
118
0
}
119
120
OpenAPI_exemption_ind_t *OpenAPI_exemption_ind_copy(OpenAPI_exemption_ind_t *dst, OpenAPI_exemption_ind_t *src)
121
0
{
122
0
    cJSON *item = NULL;
123
0
    char *content = NULL;
124
125
0
    ogs_assert(src);
126
0
    item = OpenAPI_exemption_ind_convertToJSON(src);
127
0
    if (!item) {
128
0
        ogs_error("OpenAPI_exemption_ind_convertToJSON() failed");
129
0
        return NULL;
130
0
    }
131
132
0
    content = cJSON_Print(item);
133
0
    cJSON_Delete(item);
134
135
0
    if (!content) {
136
0
        ogs_error("cJSON_Print() failed");
137
0
        return NULL;
138
0
    }
139
140
0
    item = cJSON_Parse(content);
141
0
    ogs_free(content);
142
0
    if (!item) {
143
0
        ogs_error("cJSON_Parse() failed");
144
0
        return NULL;
145
0
    }
146
147
0
    OpenAPI_exemption_ind_free(dst);
148
0
    dst = OpenAPI_exemption_ind_parseFromJSON(item);
149
0
    cJSON_Delete(item);
150
151
0
    return dst;
152
0
}
153