Coverage Report

Created: 2026-11-12 06:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/open5gs/lib/sbi/openapi/model/area_scope.c
Line
Count
Source
1
2
#include <stdlib.h>
3
#include <string.h>
4
#include <stdio.h>
5
#include "area_scope.h"
6
7
OpenAPI_area_scope_t *OpenAPI_area_scope_create(
8
    OpenAPI_list_t *eutra_cell_id_list,
9
    OpenAPI_list_t *nr_cell_id_list,
10
    OpenAPI_list_t *tac_list,
11
    OpenAPI_list_t* tac_info_per_plmn,
12
    OpenAPI_list_t* cag_info_per_plmn,
13
    OpenAPI_list_t* nid_info_per_plmn,
14
    OpenAPI_list_t* cell_id_nid_info_per_plmn,
15
    OpenAPI_list_t* tac_nid_info_per_plmn,
16
    OpenAPI_list_t *cag_list
17
)
18
429
{
19
429
    OpenAPI_area_scope_t *area_scope_local_var = ogs_malloc(sizeof(OpenAPI_area_scope_t));
20
429
    ogs_assert(area_scope_local_var);
21
22
429
    area_scope_local_var->eutra_cell_id_list = eutra_cell_id_list;
23
429
    area_scope_local_var->nr_cell_id_list = nr_cell_id_list;
24
429
    area_scope_local_var->tac_list = tac_list;
25
429
    area_scope_local_var->tac_info_per_plmn = tac_info_per_plmn;
26
429
    area_scope_local_var->cag_info_per_plmn = cag_info_per_plmn;
27
429
    area_scope_local_var->nid_info_per_plmn = nid_info_per_plmn;
28
429
    area_scope_local_var->cell_id_nid_info_per_plmn = cell_id_nid_info_per_plmn;
29
429
    area_scope_local_var->tac_nid_info_per_plmn = tac_nid_info_per_plmn;
30
429
    area_scope_local_var->cag_list = cag_list;
31
32
429
    return area_scope_local_var;
33
429
}
34
35
void OpenAPI_area_scope_free(OpenAPI_area_scope_t *area_scope)
36
340
{
37
340
    OpenAPI_lnode_t *node = NULL;
38
39
340
    if (NULL == area_scope) {
40
0
        return;
41
0
    }
42
340
    if (area_scope->eutra_cell_id_list) {
43
0
        OpenAPI_list_for_each(area_scope->eutra_cell_id_list, node) {
44
0
            ogs_free(node->data);
45
0
        }
46
0
        OpenAPI_list_free(area_scope->eutra_cell_id_list);
47
0
        area_scope->eutra_cell_id_list = NULL;
48
0
    }
49
340
    if (area_scope->nr_cell_id_list) {
50
0
        OpenAPI_list_for_each(area_scope->nr_cell_id_list, node) {
51
0
            ogs_free(node->data);
52
0
        }
53
0
        OpenAPI_list_free(area_scope->nr_cell_id_list);
54
0
        area_scope->nr_cell_id_list = NULL;
55
0
    }
56
340
    if (area_scope->tac_list) {
57
556
        OpenAPI_list_for_each(area_scope->tac_list, node) {
58
556
            ogs_free(node->data);
59
556
        }
60
169
        OpenAPI_list_free(area_scope->tac_list);
61
169
        area_scope->tac_list = NULL;
62
169
    }
63
340
    if (area_scope->tac_info_per_plmn) {
64
0
        OpenAPI_list_for_each(area_scope->tac_info_per_plmn, node) {
65
0
            OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
66
0
            ogs_free(localKeyValue->key);
67
0
            OpenAPI_tac_info_free(localKeyValue->value);
68
0
            OpenAPI_map_free(localKeyValue);
69
0
        }
70
0
        OpenAPI_list_free(area_scope->tac_info_per_plmn);
71
0
        area_scope->tac_info_per_plmn = NULL;
72
0
    }
73
340
    if (area_scope->cag_info_per_plmn) {
74
0
        OpenAPI_list_for_each(area_scope->cag_info_per_plmn, node) {
75
0
            OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
76
0
            ogs_free(localKeyValue->key);
77
0
            OpenAPI_cag_info_1_free(localKeyValue->value);
78
0
            OpenAPI_map_free(localKeyValue);
79
0
        }
80
0
        OpenAPI_list_free(area_scope->cag_info_per_plmn);
81
0
        area_scope->cag_info_per_plmn = NULL;
82
0
    }
83
340
    if (area_scope->nid_info_per_plmn) {
84
0
        OpenAPI_list_for_each(area_scope->nid_info_per_plmn, node) {
85
0
            OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
86
0
            ogs_free(localKeyValue->key);
87
0
            OpenAPI_nid_info_free(localKeyValue->value);
88
0
            OpenAPI_map_free(localKeyValue);
89
0
        }
90
0
        OpenAPI_list_free(area_scope->nid_info_per_plmn);
91
0
        area_scope->nid_info_per_plmn = NULL;
92
0
    }
93
340
    if (area_scope->cell_id_nid_info_per_plmn) {
94
0
        OpenAPI_list_for_each(area_scope->cell_id_nid_info_per_plmn, node) {
95
0
            OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
96
0
            ogs_free(localKeyValue->key);
97
0
            OpenAPI_cell_id_nid_info_free(localKeyValue->value);
98
0
            OpenAPI_map_free(localKeyValue);
99
0
        }
100
0
        OpenAPI_list_free(area_scope->cell_id_nid_info_per_plmn);
101
0
        area_scope->cell_id_nid_info_per_plmn = NULL;
102
0
    }
103
340
    if (area_scope->tac_nid_info_per_plmn) {
104
0
        OpenAPI_list_for_each(area_scope->tac_nid_info_per_plmn, node) {
105
0
            OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
106
0
            ogs_free(localKeyValue->key);
107
0
            OpenAPI_tac_nid_info_free(localKeyValue->value);
108
0
            OpenAPI_map_free(localKeyValue);
109
0
        }
110
0
        OpenAPI_list_free(area_scope->tac_nid_info_per_plmn);
111
0
        area_scope->tac_nid_info_per_plmn = NULL;
112
0
    }
113
340
    if (area_scope->cag_list) {
114
437
        OpenAPI_list_for_each(area_scope->cag_list, node) {
115
437
            ogs_free(node->data);
116
437
        }
117
83
        OpenAPI_list_free(area_scope->cag_list);
118
83
        area_scope->cag_list = NULL;
119
83
    }
120
340
    ogs_free(area_scope);
121
340
}
122
123
cJSON *OpenAPI_area_scope_convertToJSON(OpenAPI_area_scope_t *area_scope)
124
0
{
125
0
    cJSON *item = NULL;
126
0
    OpenAPI_lnode_t *node = NULL;
127
128
0
    if (area_scope == NULL) {
129
0
        ogs_error("OpenAPI_area_scope_convertToJSON() failed [AreaScope]");
130
0
        return NULL;
131
0
    }
132
133
0
    item = cJSON_CreateObject();
134
0
    if (area_scope->eutra_cell_id_list) {
135
0
    cJSON *eutra_cell_id_listList = cJSON_AddArrayToObject(item, "eutraCellIdList");
136
0
    if (eutra_cell_id_listList == NULL) {
137
0
        ogs_error("OpenAPI_area_scope_convertToJSON() failed [eutra_cell_id_list]");
138
0
        goto end;
139
0
    }
140
0
    OpenAPI_list_for_each(area_scope->eutra_cell_id_list, node) {
141
0
        if (cJSON_AddStringToObject(eutra_cell_id_listList, "", (char*)node->data) == NULL) {
142
0
            ogs_error("OpenAPI_area_scope_convertToJSON() failed [eutra_cell_id_list]");
143
0
            goto end;
144
0
        }
145
0
    }
146
0
    }
147
148
0
    if (area_scope->nr_cell_id_list) {
149
0
    cJSON *nr_cell_id_listList = cJSON_AddArrayToObject(item, "nrCellIdList");
150
0
    if (nr_cell_id_listList == NULL) {
151
0
        ogs_error("OpenAPI_area_scope_convertToJSON() failed [nr_cell_id_list]");
152
0
        goto end;
153
0
    }
154
0
    OpenAPI_list_for_each(area_scope->nr_cell_id_list, node) {
155
0
        if (cJSON_AddStringToObject(nr_cell_id_listList, "", (char*)node->data) == NULL) {
156
0
            ogs_error("OpenAPI_area_scope_convertToJSON() failed [nr_cell_id_list]");
157
0
            goto end;
158
0
        }
159
0
    }
160
0
    }
161
162
0
    if (area_scope->tac_list) {
163
0
    cJSON *tac_listList = cJSON_AddArrayToObject(item, "tacList");
164
0
    if (tac_listList == NULL) {
165
0
        ogs_error("OpenAPI_area_scope_convertToJSON() failed [tac_list]");
166
0
        goto end;
167
0
    }
168
0
    OpenAPI_list_for_each(area_scope->tac_list, node) {
169
0
        if (cJSON_AddStringToObject(tac_listList, "", (char*)node->data) == NULL) {
170
0
            ogs_error("OpenAPI_area_scope_convertToJSON() failed [tac_list]");
171
0
            goto end;
172
0
        }
173
0
    }
174
0
    }
175
176
0
    if (area_scope->tac_info_per_plmn) {
177
0
    cJSON *tac_info_per_plmn = cJSON_AddObjectToObject(item, "tacInfoPerPlmn");
178
0
    if (tac_info_per_plmn == NULL) {
179
0
        ogs_error("OpenAPI_area_scope_convertToJSON() failed [tac_info_per_plmn]");
180
0
        goto end;
181
0
    }
182
0
    cJSON *localMapObject = tac_info_per_plmn;
183
0
    if (area_scope->tac_info_per_plmn) {
184
0
        OpenAPI_list_for_each(area_scope->tac_info_per_plmn, node) {
185
0
            OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
186
0
            if (localKeyValue == NULL) {
187
0
                ogs_error("OpenAPI_area_scope_convertToJSON() failed [tac_info_per_plmn]");
188
0
                goto end;
189
0
            }
190
0
            if (localKeyValue->key == NULL) {
191
0
                ogs_error("OpenAPI_area_scope_convertToJSON() failed [tac_info_per_plmn]");
192
0
                goto end;
193
0
            }
194
0
            cJSON *itemLocal = localKeyValue->value ?
195
0
                OpenAPI_tac_info_convertToJSON(localKeyValue->value) :
196
0
                cJSON_CreateNull();
197
0
            if (itemLocal == NULL) {
198
0
                ogs_error("OpenAPI_area_scope_convertToJSON() failed [inner]");
199
0
                goto end;
200
0
            }
201
0
            cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal);
202
0
        }
203
0
    }
204
0
    }
205
206
0
    if (area_scope->cag_info_per_plmn) {
207
0
    cJSON *cag_info_per_plmn = cJSON_AddObjectToObject(item, "cagInfoPerPlmn");
208
0
    if (cag_info_per_plmn == NULL) {
209
0
        ogs_error("OpenAPI_area_scope_convertToJSON() failed [cag_info_per_plmn]");
210
0
        goto end;
211
0
    }
212
0
    cJSON *localMapObject = cag_info_per_plmn;
213
0
    if (area_scope->cag_info_per_plmn) {
214
0
        OpenAPI_list_for_each(area_scope->cag_info_per_plmn, node) {
215
0
            OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
216
0
            if (localKeyValue == NULL) {
217
0
                ogs_error("OpenAPI_area_scope_convertToJSON() failed [cag_info_per_plmn]");
218
0
                goto end;
219
0
            }
220
0
            if (localKeyValue->key == NULL) {
221
0
                ogs_error("OpenAPI_area_scope_convertToJSON() failed [cag_info_per_plmn]");
222
0
                goto end;
223
0
            }
224
0
            cJSON *itemLocal = localKeyValue->value ?
225
0
                OpenAPI_cag_info_1_convertToJSON(localKeyValue->value) :
226
0
                cJSON_CreateNull();
227
0
            if (itemLocal == NULL) {
228
0
                ogs_error("OpenAPI_area_scope_convertToJSON() failed [inner]");
229
0
                goto end;
230
0
            }
231
0
            cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal);
232
0
        }
233
0
    }
234
0
    }
235
236
0
    if (area_scope->nid_info_per_plmn) {
237
0
    cJSON *nid_info_per_plmn = cJSON_AddObjectToObject(item, "nidInfoPerPlmn");
238
0
    if (nid_info_per_plmn == NULL) {
239
0
        ogs_error("OpenAPI_area_scope_convertToJSON() failed [nid_info_per_plmn]");
240
0
        goto end;
241
0
    }
242
0
    cJSON *localMapObject = nid_info_per_plmn;
243
0
    if (area_scope->nid_info_per_plmn) {
244
0
        OpenAPI_list_for_each(area_scope->nid_info_per_plmn, node) {
245
0
            OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
246
0
            if (localKeyValue == NULL) {
247
0
                ogs_error("OpenAPI_area_scope_convertToJSON() failed [nid_info_per_plmn]");
248
0
                goto end;
249
0
            }
250
0
            if (localKeyValue->key == NULL) {
251
0
                ogs_error("OpenAPI_area_scope_convertToJSON() failed [nid_info_per_plmn]");
252
0
                goto end;
253
0
            }
254
0
            cJSON *itemLocal = localKeyValue->value ?
255
0
                OpenAPI_nid_info_convertToJSON(localKeyValue->value) :
256
0
                cJSON_CreateNull();
257
0
            if (itemLocal == NULL) {
258
0
                ogs_error("OpenAPI_area_scope_convertToJSON() failed [inner]");
259
0
                goto end;
260
0
            }
261
0
            cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal);
262
0
        }
263
0
    }
264
0
    }
265
266
0
    if (area_scope->cell_id_nid_info_per_plmn) {
267
0
    cJSON *cell_id_nid_info_per_plmn = cJSON_AddObjectToObject(item, "cellIdNidInfoPerPlmn");
268
0
    if (cell_id_nid_info_per_plmn == NULL) {
269
0
        ogs_error("OpenAPI_area_scope_convertToJSON() failed [cell_id_nid_info_per_plmn]");
270
0
        goto end;
271
0
    }
272
0
    cJSON *localMapObject = cell_id_nid_info_per_plmn;
273
0
    if (area_scope->cell_id_nid_info_per_plmn) {
274
0
        OpenAPI_list_for_each(area_scope->cell_id_nid_info_per_plmn, node) {
275
0
            OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
276
0
            if (localKeyValue == NULL) {
277
0
                ogs_error("OpenAPI_area_scope_convertToJSON() failed [cell_id_nid_info_per_plmn]");
278
0
                goto end;
279
0
            }
280
0
            if (localKeyValue->key == NULL) {
281
0
                ogs_error("OpenAPI_area_scope_convertToJSON() failed [cell_id_nid_info_per_plmn]");
282
0
                goto end;
283
0
            }
284
0
            cJSON *itemLocal = localKeyValue->value ?
285
0
                OpenAPI_cell_id_nid_info_convertToJSON(localKeyValue->value) :
286
0
                cJSON_CreateNull();
287
0
            if (itemLocal == NULL) {
288
0
                ogs_error("OpenAPI_area_scope_convertToJSON() failed [inner]");
289
0
                goto end;
290
0
            }
291
0
            cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal);
292
0
        }
293
0
    }
294
0
    }
295
296
0
    if (area_scope->tac_nid_info_per_plmn) {
297
0
    cJSON *tac_nid_info_per_plmn = cJSON_AddObjectToObject(item, "tacNidInfoPerPlmn");
298
0
    if (tac_nid_info_per_plmn == NULL) {
299
0
        ogs_error("OpenAPI_area_scope_convertToJSON() failed [tac_nid_info_per_plmn]");
300
0
        goto end;
301
0
    }
302
0
    cJSON *localMapObject = tac_nid_info_per_plmn;
303
0
    if (area_scope->tac_nid_info_per_plmn) {
304
0
        OpenAPI_list_for_each(area_scope->tac_nid_info_per_plmn, node) {
305
0
            OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
306
0
            if (localKeyValue == NULL) {
307
0
                ogs_error("OpenAPI_area_scope_convertToJSON() failed [tac_nid_info_per_plmn]");
308
0
                goto end;
309
0
            }
310
0
            if (localKeyValue->key == NULL) {
311
0
                ogs_error("OpenAPI_area_scope_convertToJSON() failed [tac_nid_info_per_plmn]");
312
0
                goto end;
313
0
            }
314
0
            cJSON *itemLocal = localKeyValue->value ?
315
0
                OpenAPI_tac_nid_info_convertToJSON(localKeyValue->value) :
316
0
                cJSON_CreateNull();
317
0
            if (itemLocal == NULL) {
318
0
                ogs_error("OpenAPI_area_scope_convertToJSON() failed [inner]");
319
0
                goto end;
320
0
            }
321
0
            cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal);
322
0
        }
323
0
    }
324
0
    }
325
326
0
    if (area_scope->cag_list) {
327
0
    cJSON *cag_listList = cJSON_AddArrayToObject(item, "cagList");
328
0
    if (cag_listList == NULL) {
329
0
        ogs_error("OpenAPI_area_scope_convertToJSON() failed [cag_list]");
330
0
        goto end;
331
0
    }
332
0
    OpenAPI_list_for_each(area_scope->cag_list, node) {
333
0
        if (cJSON_AddStringToObject(cag_listList, "", (char*)node->data) == NULL) {
334
0
            ogs_error("OpenAPI_area_scope_convertToJSON() failed [cag_list]");
335
0
            goto end;
336
0
        }
337
0
    }
338
0
    }
339
340
0
end:
341
0
    return item;
342
0
}
343
344
OpenAPI_area_scope_t *OpenAPI_area_scope_parseFromJSON(cJSON *area_scopeJSON)
345
543
{
346
543
    OpenAPI_area_scope_t *area_scope_local_var = NULL;
347
543
    OpenAPI_lnode_t *node = NULL;
348
543
    cJSON *eutra_cell_id_list = NULL;
349
543
    OpenAPI_list_t *eutra_cell_id_listList = NULL;
350
543
    cJSON *nr_cell_id_list = NULL;
351
543
    OpenAPI_list_t *nr_cell_id_listList = NULL;
352
543
    cJSON *tac_list = NULL;
353
543
    OpenAPI_list_t *tac_listList = NULL;
354
543
    cJSON *tac_info_per_plmn = NULL;
355
543
    OpenAPI_list_t *tac_info_per_plmnList = NULL;
356
543
    cJSON *cag_info_per_plmn = NULL;
357
543
    OpenAPI_list_t *cag_info_per_plmnList = NULL;
358
543
    cJSON *nid_info_per_plmn = NULL;
359
543
    OpenAPI_list_t *nid_info_per_plmnList = NULL;
360
543
    cJSON *cell_id_nid_info_per_plmn = NULL;
361
543
    OpenAPI_list_t *cell_id_nid_info_per_plmnList = NULL;
362
543
    cJSON *tac_nid_info_per_plmn = NULL;
363
543
    OpenAPI_list_t *tac_nid_info_per_plmnList = NULL;
364
543
    cJSON *cag_list = NULL;
365
543
    OpenAPI_list_t *cag_listList = NULL;
366
543
    eutra_cell_id_list = cJSON_GetObjectItemCaseSensitive(area_scopeJSON, "eutraCellIdList");
367
543
    if (eutra_cell_id_list) {
368
1
        cJSON *eutra_cell_id_list_local = NULL;
369
1
        if (!cJSON_IsArray(eutra_cell_id_list)) {
370
1
            ogs_error("OpenAPI_area_scope_parseFromJSON() failed [eutra_cell_id_list]");
371
1
            goto end;
372
1
        }
373
374
0
        eutra_cell_id_listList = OpenAPI_list_create();
375
376
0
        cJSON_ArrayForEach(eutra_cell_id_list_local, eutra_cell_id_list) {
377
0
            double *localDouble = NULL;
378
0
            int *localInt = NULL;
379
0
            if (!cJSON_IsString(eutra_cell_id_list_local)) {
380
0
                ogs_error("OpenAPI_area_scope_parseFromJSON() failed [eutra_cell_id_list]");
381
0
                goto end;
382
0
            }
383
0
            OpenAPI_list_add(eutra_cell_id_listList, ogs_strdup(eutra_cell_id_list_local->valuestring));
384
0
        }
385
0
    }
386
387
542
    nr_cell_id_list = cJSON_GetObjectItemCaseSensitive(area_scopeJSON, "nrCellIdList");
388
542
    if (nr_cell_id_list) {
389
0
        cJSON *nr_cell_id_list_local = NULL;
390
0
        if (!cJSON_IsArray(nr_cell_id_list)) {
391
0
            ogs_error("OpenAPI_area_scope_parseFromJSON() failed [nr_cell_id_list]");
392
0
            goto end;
393
0
        }
394
395
0
        nr_cell_id_listList = OpenAPI_list_create();
396
397
0
        cJSON_ArrayForEach(nr_cell_id_list_local, nr_cell_id_list) {
398
0
            double *localDouble = NULL;
399
0
            int *localInt = NULL;
400
0
            if (!cJSON_IsString(nr_cell_id_list_local)) {
401
0
                ogs_error("OpenAPI_area_scope_parseFromJSON() failed [nr_cell_id_list]");
402
0
                goto end;
403
0
            }
404
0
            OpenAPI_list_add(nr_cell_id_listList, ogs_strdup(nr_cell_id_list_local->valuestring));
405
0
        }
406
0
    }
407
408
542
    tac_list = cJSON_GetObjectItemCaseSensitive(area_scopeJSON, "tacList");
409
542
    if (tac_list) {
410
247
        cJSON *tac_list_local = NULL;
411
247
        if (!cJSON_IsArray(tac_list)) {
412
11
            ogs_error("OpenAPI_area_scope_parseFromJSON() failed [tac_list]");
413
11
            goto end;
414
11
        }
415
416
236
        tac_listList = OpenAPI_list_create();
417
418
1.03k
        cJSON_ArrayForEach(tac_list_local, tac_list) {
419
1.03k
            double *localDouble = NULL;
420
1.03k
            int *localInt = NULL;
421
1.03k
            if (!cJSON_IsString(tac_list_local)) {
422
36
                ogs_error("OpenAPI_area_scope_parseFromJSON() failed [tac_list]");
423
36
                goto end;
424
36
            }
425
994
            OpenAPI_list_add(tac_listList, ogs_strdup(tac_list_local->valuestring));
426
994
        }
427
236
    }
428
429
495
    tac_info_per_plmn = cJSON_GetObjectItemCaseSensitive(area_scopeJSON, "tacInfoPerPlmn");
430
495
    if (tac_info_per_plmn) {
431
1
        cJSON *tac_info_per_plmn_local_map = NULL;
432
1
        if (!cJSON_IsObject(tac_info_per_plmn) && !cJSON_IsNull(tac_info_per_plmn)) {
433
1
            ogs_error("OpenAPI_area_scope_parseFromJSON() failed [tac_info_per_plmn]");
434
1
            goto end;
435
1
        }
436
0
        if (cJSON_IsObject(tac_info_per_plmn)) {
437
0
            tac_info_per_plmnList = OpenAPI_list_create();
438
0
            OpenAPI_map_t *localMapKeyPair = NULL;
439
0
            cJSON_ArrayForEach(tac_info_per_plmn_local_map, tac_info_per_plmn) {
440
0
                cJSON *localMapObject = tac_info_per_plmn_local_map;
441
0
                if (cJSON_IsObject(localMapObject)) {
442
0
                    localMapKeyPair = OpenAPI_map_create(
443
0
                        ogs_strdup(localMapObject->string), OpenAPI_tac_info_parseFromJSON(localMapObject));
444
0
                } else if (cJSON_IsNull(localMapObject)) {
445
0
                    localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL);
446
0
                } else {
447
0
                    ogs_error("OpenAPI_area_scope_parseFromJSON() failed [inner]");
448
0
                    goto end;
449
0
                }
450
0
                if (localMapKeyPair == NULL) {
451
0
                    ogs_error("OpenAPI_area_scope_parseFromJSON() failed [tac_info_per_plmn]");
452
0
                    goto end;
453
0
                }
454
0
                OpenAPI_list_add(tac_info_per_plmnList, localMapKeyPair);
455
0
            }
456
0
        }
457
0
    }
458
459
494
    cag_info_per_plmn = cJSON_GetObjectItemCaseSensitive(area_scopeJSON, "cagInfoPerPlmn");
460
494
    if (cag_info_per_plmn) {
461
3
        cJSON *cag_info_per_plmn_local_map = NULL;
462
3
        if (!cJSON_IsObject(cag_info_per_plmn) && !cJSON_IsNull(cag_info_per_plmn)) {
463
1
            ogs_error("OpenAPI_area_scope_parseFromJSON() failed [cag_info_per_plmn]");
464
1
            goto end;
465
1
        }
466
2
        if (cJSON_IsObject(cag_info_per_plmn)) {
467
1
            cag_info_per_plmnList = OpenAPI_list_create();
468
1
            OpenAPI_map_t *localMapKeyPair = NULL;
469
1
            cJSON_ArrayForEach(cag_info_per_plmn_local_map, cag_info_per_plmn) {
470
1
                cJSON *localMapObject = cag_info_per_plmn_local_map;
471
1
                if (cJSON_IsObject(localMapObject)) {
472
0
                    localMapKeyPair = OpenAPI_map_create(
473
0
                        ogs_strdup(localMapObject->string), OpenAPI_cag_info_1_parseFromJSON(localMapObject));
474
1
                } else if (cJSON_IsNull(localMapObject)) {
475
0
                    localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL);
476
1
                } else {
477
1
                    ogs_error("OpenAPI_area_scope_parseFromJSON() failed [inner]");
478
1
                    goto end;
479
1
                }
480
0
                if (localMapKeyPair == NULL) {
481
0
                    ogs_error("OpenAPI_area_scope_parseFromJSON() failed [cag_info_per_plmn]");
482
0
                    goto end;
483
0
                }
484
0
                OpenAPI_list_add(cag_info_per_plmnList, localMapKeyPair);
485
0
            }
486
1
        }
487
2
    }
488
489
492
    nid_info_per_plmn = cJSON_GetObjectItemCaseSensitive(area_scopeJSON, "nidInfoPerPlmn");
490
492
    if (nid_info_per_plmn) {
491
1
        cJSON *nid_info_per_plmn_local_map = NULL;
492
1
        if (!cJSON_IsObject(nid_info_per_plmn) && !cJSON_IsNull(nid_info_per_plmn)) {
493
1
            ogs_error("OpenAPI_area_scope_parseFromJSON() failed [nid_info_per_plmn]");
494
1
            goto end;
495
1
        }
496
0
        if (cJSON_IsObject(nid_info_per_plmn)) {
497
0
            nid_info_per_plmnList = OpenAPI_list_create();
498
0
            OpenAPI_map_t *localMapKeyPair = NULL;
499
0
            cJSON_ArrayForEach(nid_info_per_plmn_local_map, nid_info_per_plmn) {
500
0
                cJSON *localMapObject = nid_info_per_plmn_local_map;
501
0
                if (cJSON_IsObject(localMapObject)) {
502
0
                    localMapKeyPair = OpenAPI_map_create(
503
0
                        ogs_strdup(localMapObject->string), OpenAPI_nid_info_parseFromJSON(localMapObject));
504
0
                } else if (cJSON_IsNull(localMapObject)) {
505
0
                    localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL);
506
0
                } else {
507
0
                    ogs_error("OpenAPI_area_scope_parseFromJSON() failed [inner]");
508
0
                    goto end;
509
0
                }
510
0
                if (localMapKeyPair == NULL) {
511
0
                    ogs_error("OpenAPI_area_scope_parseFromJSON() failed [nid_info_per_plmn]");
512
0
                    goto end;
513
0
                }
514
0
                OpenAPI_list_add(nid_info_per_plmnList, localMapKeyPair);
515
0
            }
516
0
        }
517
0
    }
518
519
491
    cell_id_nid_info_per_plmn = cJSON_GetObjectItemCaseSensitive(area_scopeJSON, "cellIdNidInfoPerPlmn");
520
491
    if (cell_id_nid_info_per_plmn) {
521
0
        cJSON *cell_id_nid_info_per_plmn_local_map = NULL;
522
0
        if (!cJSON_IsObject(cell_id_nid_info_per_plmn) && !cJSON_IsNull(cell_id_nid_info_per_plmn)) {
523
0
            ogs_error("OpenAPI_area_scope_parseFromJSON() failed [cell_id_nid_info_per_plmn]");
524
0
            goto end;
525
0
        }
526
0
        if (cJSON_IsObject(cell_id_nid_info_per_plmn)) {
527
0
            cell_id_nid_info_per_plmnList = OpenAPI_list_create();
528
0
            OpenAPI_map_t *localMapKeyPair = NULL;
529
0
            cJSON_ArrayForEach(cell_id_nid_info_per_plmn_local_map, cell_id_nid_info_per_plmn) {
530
0
                cJSON *localMapObject = cell_id_nid_info_per_plmn_local_map;
531
0
                if (cJSON_IsObject(localMapObject)) {
532
0
                    localMapKeyPair = OpenAPI_map_create(
533
0
                        ogs_strdup(localMapObject->string), OpenAPI_cell_id_nid_info_parseFromJSON(localMapObject));
534
0
                } else if (cJSON_IsNull(localMapObject)) {
535
0
                    localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL);
536
0
                } else {
537
0
                    ogs_error("OpenAPI_area_scope_parseFromJSON() failed [inner]");
538
0
                    goto end;
539
0
                }
540
0
                if (localMapKeyPair == NULL) {
541
0
                    ogs_error("OpenAPI_area_scope_parseFromJSON() failed [cell_id_nid_info_per_plmn]");
542
0
                    goto end;
543
0
                }
544
0
                OpenAPI_list_add(cell_id_nid_info_per_plmnList, localMapKeyPair);
545
0
            }
546
0
        }
547
0
    }
548
549
491
    tac_nid_info_per_plmn = cJSON_GetObjectItemCaseSensitive(area_scopeJSON, "tacNidInfoPerPlmn");
550
491
    if (tac_nid_info_per_plmn) {
551
0
        cJSON *tac_nid_info_per_plmn_local_map = NULL;
552
0
        if (!cJSON_IsObject(tac_nid_info_per_plmn) && !cJSON_IsNull(tac_nid_info_per_plmn)) {
553
0
            ogs_error("OpenAPI_area_scope_parseFromJSON() failed [tac_nid_info_per_plmn]");
554
0
            goto end;
555
0
        }
556
0
        if (cJSON_IsObject(tac_nid_info_per_plmn)) {
557
0
            tac_nid_info_per_plmnList = OpenAPI_list_create();
558
0
            OpenAPI_map_t *localMapKeyPair = NULL;
559
0
            cJSON_ArrayForEach(tac_nid_info_per_plmn_local_map, tac_nid_info_per_plmn) {
560
0
                cJSON *localMapObject = tac_nid_info_per_plmn_local_map;
561
0
                if (cJSON_IsObject(localMapObject)) {
562
0
                    localMapKeyPair = OpenAPI_map_create(
563
0
                        ogs_strdup(localMapObject->string), OpenAPI_tac_nid_info_parseFromJSON(localMapObject));
564
0
                } else if (cJSON_IsNull(localMapObject)) {
565
0
                    localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL);
566
0
                } else {
567
0
                    ogs_error("OpenAPI_area_scope_parseFromJSON() failed [inner]");
568
0
                    goto end;
569
0
                }
570
0
                if (localMapKeyPair == NULL) {
571
0
                    ogs_error("OpenAPI_area_scope_parseFromJSON() failed [tac_nid_info_per_plmn]");
572
0
                    goto end;
573
0
                }
574
0
                OpenAPI_list_add(tac_nid_info_per_plmnList, localMapKeyPair);
575
0
            }
576
0
        }
577
0
    }
578
579
491
    cag_list = cJSON_GetObjectItemCaseSensitive(area_scopeJSON, "cagList");
580
491
    if (cag_list) {
581
158
        cJSON *cag_list_local = NULL;
582
158
        if (!cJSON_IsArray(cag_list)) {
583
20
            ogs_error("OpenAPI_area_scope_parseFromJSON() failed [cag_list]");
584
20
            goto end;
585
20
        }
586
587
138
        cag_listList = OpenAPI_list_create();
588
589
1.01k
        cJSON_ArrayForEach(cag_list_local, cag_list) {
590
1.01k
            double *localDouble = NULL;
591
1.01k
            int *localInt = NULL;
592
1.01k
            if (!cJSON_IsString(cag_list_local)) {
593
42
                ogs_error("OpenAPI_area_scope_parseFromJSON() failed [cag_list]");
594
42
                goto end;
595
42
            }
596
977
            OpenAPI_list_add(cag_listList, ogs_strdup(cag_list_local->valuestring));
597
977
        }
598
138
    }
599
600
429
    area_scope_local_var = OpenAPI_area_scope_create (
601
429
        eutra_cell_id_list ? eutra_cell_id_listList : NULL,
602
429
        nr_cell_id_list ? nr_cell_id_listList : NULL,
603
429
        tac_list ? tac_listList : NULL,
604
429
        tac_info_per_plmn ? tac_info_per_plmnList : NULL,
605
429
        cag_info_per_plmn ? cag_info_per_plmnList : NULL,
606
429
        nid_info_per_plmn ? nid_info_per_plmnList : NULL,
607
429
        cell_id_nid_info_per_plmn ? cell_id_nid_info_per_plmnList : NULL,
608
429
        tac_nid_info_per_plmn ? tac_nid_info_per_plmnList : NULL,
609
429
        cag_list ? cag_listList : NULL
610
429
    );
611
612
429
    return area_scope_local_var;
613
114
end:
614
114
    if (eutra_cell_id_listList) {
615
0
        OpenAPI_list_for_each(eutra_cell_id_listList, node) {
616
0
            ogs_free(node->data);
617
0
        }
618
0
        OpenAPI_list_free(eutra_cell_id_listList);
619
0
        eutra_cell_id_listList = NULL;
620
0
    }
621
114
    if (nr_cell_id_listList) {
622
0
        OpenAPI_list_for_each(nr_cell_id_listList, node) {
623
0
            ogs_free(node->data);
624
0
        }
625
0
        OpenAPI_list_free(nr_cell_id_listList);
626
0
        nr_cell_id_listList = NULL;
627
0
    }
628
114
    if (tac_listList) {
629
407
        OpenAPI_list_for_each(tac_listList, node) {
630
407
            ogs_free(node->data);
631
407
        }
632
36
        OpenAPI_list_free(tac_listList);
633
36
        tac_listList = NULL;
634
36
    }
635
114
    if (tac_info_per_plmnList) {
636
0
        OpenAPI_list_for_each(tac_info_per_plmnList, node) {
637
0
            OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
638
0
            ogs_free(localKeyValue->key);
639
0
            OpenAPI_tac_info_free(localKeyValue->value);
640
0
            OpenAPI_map_free(localKeyValue);
641
0
        }
642
0
        OpenAPI_list_free(tac_info_per_plmnList);
643
0
        tac_info_per_plmnList = NULL;
644
0
    }
645
114
    if (cag_info_per_plmnList) {
646
1
        OpenAPI_list_for_each(cag_info_per_plmnList, node) {
647
0
            OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
648
0
            ogs_free(localKeyValue->key);
649
0
            OpenAPI_cag_info_1_free(localKeyValue->value);
650
0
            OpenAPI_map_free(localKeyValue);
651
0
        }
652
1
        OpenAPI_list_free(cag_info_per_plmnList);
653
1
        cag_info_per_plmnList = NULL;
654
1
    }
655
114
    if (nid_info_per_plmnList) {
656
0
        OpenAPI_list_for_each(nid_info_per_plmnList, node) {
657
0
            OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
658
0
            ogs_free(localKeyValue->key);
659
0
            OpenAPI_nid_info_free(localKeyValue->value);
660
0
            OpenAPI_map_free(localKeyValue);
661
0
        }
662
0
        OpenAPI_list_free(nid_info_per_plmnList);
663
0
        nid_info_per_plmnList = NULL;
664
0
    }
665
114
    if (cell_id_nid_info_per_plmnList) {
666
0
        OpenAPI_list_for_each(cell_id_nid_info_per_plmnList, node) {
667
0
            OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
668
0
            ogs_free(localKeyValue->key);
669
0
            OpenAPI_cell_id_nid_info_free(localKeyValue->value);
670
0
            OpenAPI_map_free(localKeyValue);
671
0
        }
672
0
        OpenAPI_list_free(cell_id_nid_info_per_plmnList);
673
0
        cell_id_nid_info_per_plmnList = NULL;
674
0
    }
675
114
    if (tac_nid_info_per_plmnList) {
676
0
        OpenAPI_list_for_each(tac_nid_info_per_plmnList, node) {
677
0
            OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
678
0
            ogs_free(localKeyValue->key);
679
0
            OpenAPI_tac_nid_info_free(localKeyValue->value);
680
0
            OpenAPI_map_free(localKeyValue);
681
0
        }
682
0
        OpenAPI_list_free(tac_nid_info_per_plmnList);
683
0
        tac_nid_info_per_plmnList = NULL;
684
0
    }
685
114
    if (cag_listList) {
686
540
        OpenAPI_list_for_each(cag_listList, node) {
687
540
            ogs_free(node->data);
688
540
        }
689
42
        OpenAPI_list_free(cag_listList);
690
42
        cag_listList = NULL;
691
42
    }
692
114
    return NULL;
693
491
}
694
695
OpenAPI_area_scope_t *OpenAPI_area_scope_copy(OpenAPI_area_scope_t *dst, OpenAPI_area_scope_t *src)
696
0
{
697
0
    cJSON *item = NULL;
698
0
    char *content = NULL;
699
700
0
    ogs_assert(src);
701
0
    item = OpenAPI_area_scope_convertToJSON(src);
702
0
    if (!item) {
703
0
        ogs_error("OpenAPI_area_scope_convertToJSON() failed");
704
0
        return NULL;
705
0
    }
706
707
0
    content = cJSON_Print(item);
708
0
    cJSON_Delete(item);
709
710
0
    if (!content) {
711
0
        ogs_error("cJSON_Print() failed");
712
0
        return NULL;
713
0
    }
714
715
0
    item = cJSON_Parse(content);
716
0
    ogs_free(content);
717
0
    if (!item) {
718
0
        ogs_error("cJSON_Parse() failed");
719
0
        return NULL;
720
0
    }
721
722
0
    OpenAPI_area_scope_free(dst);
723
0
    dst = OpenAPI_area_scope_parseFromJSON(item);
724
0
    cJSON_Delete(item);
725
726
0
    return dst;
727
0
}
728