Coverage Report

Created: 2026-08-14 06:04

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/open5gs/lib/sbi/openapi/model/mm_context.c
Line
Count
Source
1
2
#include <stdlib.h>
3
#include <string.h>
4
#include <stdio.h>
5
#include "mm_context.h"
6
7
OpenAPI_mm_context_t *OpenAPI_mm_context_create(
8
    OpenAPI_access_type_e access_type,
9
    OpenAPI_nas_security_mode_t *nas_security_mode,
10
    OpenAPI_eps_nas_security_mode_t *eps_nas_security_mode,
11
    bool is_nas_downlink_count,
12
    int nas_downlink_count,
13
    bool is_nas_uplink_count,
14
    int nas_uplink_count,
15
    char *ue_security_capability,
16
    char *s1_ue_network_capability,
17
    OpenAPI_list_t *allowed_nssai,
18
    OpenAPI_list_t *nssai_mapping_list,
19
    OpenAPI_list_t *allowed_home_nssai,
20
    OpenAPI_list_t *partially_allowed_nssai,
21
    OpenAPI_list_t *replaced_snssai_mapping_list,
22
    OpenAPI_list_t *ns_instance_list,
23
    OpenAPI_expected_ue_behavior_t *expected_u_ebehavior,
24
    OpenAPI_ue_differentiation_info_t *ue_differentiation_info,
25
    char *plmn_assi_ue_radio_cap_id,
26
    char *man_assi_ue_radio_cap_id,
27
    char *ucmf_dic_entry_id,
28
    OpenAPI_global_ran_node_id_t *n3_iwf_id,
29
    OpenAPI_global_ran_node_id_t *wagf_id,
30
    OpenAPI_global_ran_node_id_t *tngf_id,
31
    bool is_an_n2_ap_id,
32
    int an_n2_ap_id,
33
    OpenAPI_list_t *nssaa_status_list,
34
    OpenAPI_list_t *pending_nssai_mapping_list,
35
    OpenAPI_uuaa_mm_status_e uuaa_mm_status,
36
    OpenAPI_list_t* dereg_inact_timer_list,
37
    bool is_vo_support_match_ind,
38
    int vo_support_match_ind
39
)
40
0
{
41
0
    OpenAPI_mm_context_t *mm_context_local_var = ogs_malloc(sizeof(OpenAPI_mm_context_t));
42
0
    ogs_assert(mm_context_local_var);
43
44
0
    mm_context_local_var->access_type = access_type;
45
0
    mm_context_local_var->nas_security_mode = nas_security_mode;
46
0
    mm_context_local_var->eps_nas_security_mode = eps_nas_security_mode;
47
0
    mm_context_local_var->is_nas_downlink_count = is_nas_downlink_count;
48
0
    mm_context_local_var->nas_downlink_count = nas_downlink_count;
49
0
    mm_context_local_var->is_nas_uplink_count = is_nas_uplink_count;
50
0
    mm_context_local_var->nas_uplink_count = nas_uplink_count;
51
0
    mm_context_local_var->ue_security_capability = ue_security_capability;
52
0
    mm_context_local_var->s1_ue_network_capability = s1_ue_network_capability;
53
0
    mm_context_local_var->allowed_nssai = allowed_nssai;
54
0
    mm_context_local_var->nssai_mapping_list = nssai_mapping_list;
55
0
    mm_context_local_var->allowed_home_nssai = allowed_home_nssai;
56
0
    mm_context_local_var->partially_allowed_nssai = partially_allowed_nssai;
57
0
    mm_context_local_var->replaced_snssai_mapping_list = replaced_snssai_mapping_list;
58
0
    mm_context_local_var->ns_instance_list = ns_instance_list;
59
0
    mm_context_local_var->expected_u_ebehavior = expected_u_ebehavior;
60
0
    mm_context_local_var->ue_differentiation_info = ue_differentiation_info;
61
0
    mm_context_local_var->plmn_assi_ue_radio_cap_id = plmn_assi_ue_radio_cap_id;
62
0
    mm_context_local_var->man_assi_ue_radio_cap_id = man_assi_ue_radio_cap_id;
63
0
    mm_context_local_var->ucmf_dic_entry_id = ucmf_dic_entry_id;
64
0
    mm_context_local_var->n3_iwf_id = n3_iwf_id;
65
0
    mm_context_local_var->wagf_id = wagf_id;
66
0
    mm_context_local_var->tngf_id = tngf_id;
67
0
    mm_context_local_var->is_an_n2_ap_id = is_an_n2_ap_id;
68
0
    mm_context_local_var->an_n2_ap_id = an_n2_ap_id;
69
0
    mm_context_local_var->nssaa_status_list = nssaa_status_list;
70
0
    mm_context_local_var->pending_nssai_mapping_list = pending_nssai_mapping_list;
71
0
    mm_context_local_var->uuaa_mm_status = uuaa_mm_status;
72
0
    mm_context_local_var->dereg_inact_timer_list = dereg_inact_timer_list;
73
0
    mm_context_local_var->is_vo_support_match_ind = is_vo_support_match_ind;
74
0
    mm_context_local_var->vo_support_match_ind = vo_support_match_ind;
75
76
0
    return mm_context_local_var;
77
0
}
78
79
void OpenAPI_mm_context_free(OpenAPI_mm_context_t *mm_context)
80
0
{
81
0
    OpenAPI_lnode_t *node = NULL;
82
83
0
    if (NULL == mm_context) {
84
0
        return;
85
0
    }
86
0
    if (mm_context->nas_security_mode) {
87
0
        OpenAPI_nas_security_mode_free(mm_context->nas_security_mode);
88
0
        mm_context->nas_security_mode = NULL;
89
0
    }
90
0
    if (mm_context->eps_nas_security_mode) {
91
0
        OpenAPI_eps_nas_security_mode_free(mm_context->eps_nas_security_mode);
92
0
        mm_context->eps_nas_security_mode = NULL;
93
0
    }
94
0
    if (mm_context->ue_security_capability) {
95
0
        ogs_free(mm_context->ue_security_capability);
96
0
        mm_context->ue_security_capability = NULL;
97
0
    }
98
0
    if (mm_context->s1_ue_network_capability) {
99
0
        ogs_free(mm_context->s1_ue_network_capability);
100
0
        mm_context->s1_ue_network_capability = NULL;
101
0
    }
102
0
    if (mm_context->allowed_nssai) {
103
0
        OpenAPI_list_for_each(mm_context->allowed_nssai, node) {
104
0
            OpenAPI_snssai_free(node->data);
105
0
        }
106
0
        OpenAPI_list_free(mm_context->allowed_nssai);
107
0
        mm_context->allowed_nssai = NULL;
108
0
    }
109
0
    if (mm_context->nssai_mapping_list) {
110
0
        OpenAPI_list_for_each(mm_context->nssai_mapping_list, node) {
111
0
            OpenAPI_nssai_mapping_free(node->data);
112
0
        }
113
0
        OpenAPI_list_free(mm_context->nssai_mapping_list);
114
0
        mm_context->nssai_mapping_list = NULL;
115
0
    }
116
0
    if (mm_context->allowed_home_nssai) {
117
0
        OpenAPI_list_for_each(mm_context->allowed_home_nssai, node) {
118
0
            OpenAPI_snssai_free(node->data);
119
0
        }
120
0
        OpenAPI_list_free(mm_context->allowed_home_nssai);
121
0
        mm_context->allowed_home_nssai = NULL;
122
0
    }
123
0
    if (mm_context->partially_allowed_nssai) {
124
0
        OpenAPI_list_for_each(mm_context->partially_allowed_nssai, node) {
125
0
            OpenAPI_partially_allowed_snssai_free(node->data);
126
0
        }
127
0
        OpenAPI_list_free(mm_context->partially_allowed_nssai);
128
0
        mm_context->partially_allowed_nssai = NULL;
129
0
    }
130
0
    if (mm_context->replaced_snssai_mapping_list) {
131
0
        OpenAPI_list_for_each(mm_context->replaced_snssai_mapping_list, node) {
132
0
            OpenAPI_slice_replacement_mapping_free(node->data);
133
0
        }
134
0
        OpenAPI_list_free(mm_context->replaced_snssai_mapping_list);
135
0
        mm_context->replaced_snssai_mapping_list = NULL;
136
0
    }
137
0
    if (mm_context->ns_instance_list) {
138
0
        OpenAPI_list_for_each(mm_context->ns_instance_list, node) {
139
0
            ogs_free(node->data);
140
0
        }
141
0
        OpenAPI_list_free(mm_context->ns_instance_list);
142
0
        mm_context->ns_instance_list = NULL;
143
0
    }
144
0
    if (mm_context->expected_u_ebehavior) {
145
0
        OpenAPI_expected_ue_behavior_free(mm_context->expected_u_ebehavior);
146
0
        mm_context->expected_u_ebehavior = NULL;
147
0
    }
148
0
    if (mm_context->ue_differentiation_info) {
149
0
        OpenAPI_ue_differentiation_info_free(mm_context->ue_differentiation_info);
150
0
        mm_context->ue_differentiation_info = NULL;
151
0
    }
152
0
    if (mm_context->plmn_assi_ue_radio_cap_id) {
153
0
        ogs_free(mm_context->plmn_assi_ue_radio_cap_id);
154
0
        mm_context->plmn_assi_ue_radio_cap_id = NULL;
155
0
    }
156
0
    if (mm_context->man_assi_ue_radio_cap_id) {
157
0
        ogs_free(mm_context->man_assi_ue_radio_cap_id);
158
0
        mm_context->man_assi_ue_radio_cap_id = NULL;
159
0
    }
160
0
    if (mm_context->ucmf_dic_entry_id) {
161
0
        ogs_free(mm_context->ucmf_dic_entry_id);
162
0
        mm_context->ucmf_dic_entry_id = NULL;
163
0
    }
164
0
    if (mm_context->n3_iwf_id) {
165
0
        OpenAPI_global_ran_node_id_free(mm_context->n3_iwf_id);
166
0
        mm_context->n3_iwf_id = NULL;
167
0
    }
168
0
    if (mm_context->wagf_id) {
169
0
        OpenAPI_global_ran_node_id_free(mm_context->wagf_id);
170
0
        mm_context->wagf_id = NULL;
171
0
    }
172
0
    if (mm_context->tngf_id) {
173
0
        OpenAPI_global_ran_node_id_free(mm_context->tngf_id);
174
0
        mm_context->tngf_id = NULL;
175
0
    }
176
0
    if (mm_context->nssaa_status_list) {
177
0
        OpenAPI_list_for_each(mm_context->nssaa_status_list, node) {
178
0
            OpenAPI_nssaa_status_free(node->data);
179
0
        }
180
0
        OpenAPI_list_free(mm_context->nssaa_status_list);
181
0
        mm_context->nssaa_status_list = NULL;
182
0
    }
183
0
    if (mm_context->pending_nssai_mapping_list) {
184
0
        OpenAPI_list_for_each(mm_context->pending_nssai_mapping_list, node) {
185
0
            OpenAPI_nssai_mapping_free(node->data);
186
0
        }
187
0
        OpenAPI_list_free(mm_context->pending_nssai_mapping_list);
188
0
        mm_context->pending_nssai_mapping_list = NULL;
189
0
    }
190
0
    if (mm_context->dereg_inact_timer_list) {
191
0
        OpenAPI_list_for_each(mm_context->dereg_inact_timer_list, node) {
192
0
            OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
193
0
            ogs_free(localKeyValue->key);
194
0
            OpenAPI_dereg_inact_timer_info_free(localKeyValue->value);
195
0
            OpenAPI_map_free(localKeyValue);
196
0
        }
197
0
        OpenAPI_list_free(mm_context->dereg_inact_timer_list);
198
0
        mm_context->dereg_inact_timer_list = NULL;
199
0
    }
200
0
    ogs_free(mm_context);
201
0
}
202
203
cJSON *OpenAPI_mm_context_convertToJSON(OpenAPI_mm_context_t *mm_context)
204
0
{
205
0
    cJSON *item = NULL;
206
0
    OpenAPI_lnode_t *node = NULL;
207
208
0
    if (mm_context == NULL) {
209
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [MmContext]");
210
0
        return NULL;
211
0
    }
212
213
0
    item = cJSON_CreateObject();
214
0
    if (mm_context->access_type == OpenAPI_access_type_NULL) {
215
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [access_type]");
216
0
        return NULL;
217
0
    }
218
0
    if (cJSON_AddStringToObject(item, "accessType", OpenAPI_access_type_ToString(mm_context->access_type)) == NULL) {
219
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [access_type]");
220
0
        goto end;
221
0
    }
222
223
0
    if (mm_context->nas_security_mode) {
224
0
    cJSON *nas_security_mode_local_JSON = OpenAPI_nas_security_mode_convertToJSON(mm_context->nas_security_mode);
225
0
    if (nas_security_mode_local_JSON == NULL) {
226
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [nas_security_mode]");
227
0
        goto end;
228
0
    }
229
0
    cJSON_AddItemToObject(item, "nasSecurityMode", nas_security_mode_local_JSON);
230
0
    if (item->child == NULL) {
231
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [nas_security_mode]");
232
0
        goto end;
233
0
    }
234
0
    }
235
236
0
    if (mm_context->eps_nas_security_mode) {
237
0
    cJSON *eps_nas_security_mode_local_JSON = OpenAPI_eps_nas_security_mode_convertToJSON(mm_context->eps_nas_security_mode);
238
0
    if (eps_nas_security_mode_local_JSON == NULL) {
239
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [eps_nas_security_mode]");
240
0
        goto end;
241
0
    }
242
0
    cJSON_AddItemToObject(item, "epsNasSecurityMode", eps_nas_security_mode_local_JSON);
243
0
    if (item->child == NULL) {
244
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [eps_nas_security_mode]");
245
0
        goto end;
246
0
    }
247
0
    }
248
249
0
    if (mm_context->is_nas_downlink_count) {
250
0
    if (cJSON_AddNumberToObject(item, "nasDownlinkCount", mm_context->nas_downlink_count) == NULL) {
251
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [nas_downlink_count]");
252
0
        goto end;
253
0
    }
254
0
    }
255
256
0
    if (mm_context->is_nas_uplink_count) {
257
0
    if (cJSON_AddNumberToObject(item, "nasUplinkCount", mm_context->nas_uplink_count) == NULL) {
258
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [nas_uplink_count]");
259
0
        goto end;
260
0
    }
261
0
    }
262
263
0
    if (mm_context->ue_security_capability) {
264
0
    if (cJSON_AddStringToObject(item, "ueSecurityCapability", mm_context->ue_security_capability) == NULL) {
265
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [ue_security_capability]");
266
0
        goto end;
267
0
    }
268
0
    }
269
270
0
    if (mm_context->s1_ue_network_capability) {
271
0
    if (cJSON_AddStringToObject(item, "s1UeNetworkCapability", mm_context->s1_ue_network_capability) == NULL) {
272
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [s1_ue_network_capability]");
273
0
        goto end;
274
0
    }
275
0
    }
276
277
0
    if (mm_context->allowed_nssai) {
278
0
    cJSON *allowed_nssaiList = cJSON_AddArrayToObject(item, "allowedNssai");
279
0
    if (allowed_nssaiList == NULL) {
280
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [allowed_nssai]");
281
0
        goto end;
282
0
    }
283
0
    OpenAPI_list_for_each(mm_context->allowed_nssai, node) {
284
0
        cJSON *itemLocal = OpenAPI_snssai_convertToJSON(node->data);
285
0
        if (itemLocal == NULL) {
286
0
            ogs_error("OpenAPI_mm_context_convertToJSON() failed [allowed_nssai]");
287
0
            goto end;
288
0
        }
289
0
        cJSON_AddItemToArray(allowed_nssaiList, itemLocal);
290
0
    }
291
0
    }
292
293
0
    if (mm_context->nssai_mapping_list) {
294
0
    cJSON *nssai_mapping_listList = cJSON_AddArrayToObject(item, "nssaiMappingList");
295
0
    if (nssai_mapping_listList == NULL) {
296
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [nssai_mapping_list]");
297
0
        goto end;
298
0
    }
299
0
    OpenAPI_list_for_each(mm_context->nssai_mapping_list, node) {
300
0
        cJSON *itemLocal = OpenAPI_nssai_mapping_convertToJSON(node->data);
301
0
        if (itemLocal == NULL) {
302
0
            ogs_error("OpenAPI_mm_context_convertToJSON() failed [nssai_mapping_list]");
303
0
            goto end;
304
0
        }
305
0
        cJSON_AddItemToArray(nssai_mapping_listList, itemLocal);
306
0
    }
307
0
    }
308
309
0
    if (mm_context->allowed_home_nssai) {
310
0
    cJSON *allowed_home_nssaiList = cJSON_AddArrayToObject(item, "allowedHomeNssai");
311
0
    if (allowed_home_nssaiList == NULL) {
312
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [allowed_home_nssai]");
313
0
        goto end;
314
0
    }
315
0
    OpenAPI_list_for_each(mm_context->allowed_home_nssai, node) {
316
0
        cJSON *itemLocal = OpenAPI_snssai_convertToJSON(node->data);
317
0
        if (itemLocal == NULL) {
318
0
            ogs_error("OpenAPI_mm_context_convertToJSON() failed [allowed_home_nssai]");
319
0
            goto end;
320
0
        }
321
0
        cJSON_AddItemToArray(allowed_home_nssaiList, itemLocal);
322
0
    }
323
0
    }
324
325
0
    if (mm_context->partially_allowed_nssai) {
326
0
    cJSON *partially_allowed_nssaiList = cJSON_AddArrayToObject(item, "partiallyAllowedNssai");
327
0
    if (partially_allowed_nssaiList == NULL) {
328
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [partially_allowed_nssai]");
329
0
        goto end;
330
0
    }
331
0
    OpenAPI_list_for_each(mm_context->partially_allowed_nssai, node) {
332
0
        cJSON *itemLocal = OpenAPI_partially_allowed_snssai_convertToJSON(node->data);
333
0
        if (itemLocal == NULL) {
334
0
            ogs_error("OpenAPI_mm_context_convertToJSON() failed [partially_allowed_nssai]");
335
0
            goto end;
336
0
        }
337
0
        cJSON_AddItemToArray(partially_allowed_nssaiList, itemLocal);
338
0
    }
339
0
    }
340
341
0
    if (mm_context->replaced_snssai_mapping_list) {
342
0
    cJSON *replaced_snssai_mapping_listList = cJSON_AddArrayToObject(item, "replacedSnssaiMappingList");
343
0
    if (replaced_snssai_mapping_listList == NULL) {
344
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [replaced_snssai_mapping_list]");
345
0
        goto end;
346
0
    }
347
0
    OpenAPI_list_for_each(mm_context->replaced_snssai_mapping_list, node) {
348
0
        cJSON *itemLocal = OpenAPI_slice_replacement_mapping_convertToJSON(node->data);
349
0
        if (itemLocal == NULL) {
350
0
            ogs_error("OpenAPI_mm_context_convertToJSON() failed [replaced_snssai_mapping_list]");
351
0
            goto end;
352
0
        }
353
0
        cJSON_AddItemToArray(replaced_snssai_mapping_listList, itemLocal);
354
0
    }
355
0
    }
356
357
0
    if (mm_context->ns_instance_list) {
358
0
    cJSON *ns_instance_listList = cJSON_AddArrayToObject(item, "nsInstanceList");
359
0
    if (ns_instance_listList == NULL) {
360
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [ns_instance_list]");
361
0
        goto end;
362
0
    }
363
0
    OpenAPI_list_for_each(mm_context->ns_instance_list, node) {
364
0
        if (cJSON_AddStringToObject(ns_instance_listList, "", (char*)node->data) == NULL) {
365
0
            ogs_error("OpenAPI_mm_context_convertToJSON() failed [ns_instance_list]");
366
0
            goto end;
367
0
        }
368
0
    }
369
0
    }
370
371
0
    if (mm_context->expected_u_ebehavior) {
372
0
    cJSON *expected_u_ebehavior_local_JSON = OpenAPI_expected_ue_behavior_convertToJSON(mm_context->expected_u_ebehavior);
373
0
    if (expected_u_ebehavior_local_JSON == NULL) {
374
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [expected_u_ebehavior]");
375
0
        goto end;
376
0
    }
377
0
    cJSON_AddItemToObject(item, "expectedUEbehavior", expected_u_ebehavior_local_JSON);
378
0
    if (item->child == NULL) {
379
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [expected_u_ebehavior]");
380
0
        goto end;
381
0
    }
382
0
    }
383
384
0
    if (mm_context->ue_differentiation_info) {
385
0
    cJSON *ue_differentiation_info_local_JSON = OpenAPI_ue_differentiation_info_convertToJSON(mm_context->ue_differentiation_info);
386
0
    if (ue_differentiation_info_local_JSON == NULL) {
387
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [ue_differentiation_info]");
388
0
        goto end;
389
0
    }
390
0
    cJSON_AddItemToObject(item, "ueDifferentiationInfo", ue_differentiation_info_local_JSON);
391
0
    if (item->child == NULL) {
392
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [ue_differentiation_info]");
393
0
        goto end;
394
0
    }
395
0
    }
396
397
0
    if (mm_context->plmn_assi_ue_radio_cap_id) {
398
0
    if (cJSON_AddStringToObject(item, "plmnAssiUeRadioCapId", mm_context->plmn_assi_ue_radio_cap_id) == NULL) {
399
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [plmn_assi_ue_radio_cap_id]");
400
0
        goto end;
401
0
    }
402
0
    }
403
404
0
    if (mm_context->man_assi_ue_radio_cap_id) {
405
0
    if (cJSON_AddStringToObject(item, "manAssiUeRadioCapId", mm_context->man_assi_ue_radio_cap_id) == NULL) {
406
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [man_assi_ue_radio_cap_id]");
407
0
        goto end;
408
0
    }
409
0
    }
410
411
0
    if (mm_context->ucmf_dic_entry_id) {
412
0
    if (cJSON_AddStringToObject(item, "ucmfDicEntryId", mm_context->ucmf_dic_entry_id) == NULL) {
413
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [ucmf_dic_entry_id]");
414
0
        goto end;
415
0
    }
416
0
    }
417
418
0
    if (mm_context->n3_iwf_id) {
419
0
    cJSON *n3_iwf_id_local_JSON = OpenAPI_global_ran_node_id_convertToJSON(mm_context->n3_iwf_id);
420
0
    if (n3_iwf_id_local_JSON == NULL) {
421
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [n3_iwf_id]");
422
0
        goto end;
423
0
    }
424
0
    cJSON_AddItemToObject(item, "n3IwfId", n3_iwf_id_local_JSON);
425
0
    if (item->child == NULL) {
426
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [n3_iwf_id]");
427
0
        goto end;
428
0
    }
429
0
    }
430
431
0
    if (mm_context->wagf_id) {
432
0
    cJSON *wagf_id_local_JSON = OpenAPI_global_ran_node_id_convertToJSON(mm_context->wagf_id);
433
0
    if (wagf_id_local_JSON == NULL) {
434
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [wagf_id]");
435
0
        goto end;
436
0
    }
437
0
    cJSON_AddItemToObject(item, "wagfId", wagf_id_local_JSON);
438
0
    if (item->child == NULL) {
439
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [wagf_id]");
440
0
        goto end;
441
0
    }
442
0
    }
443
444
0
    if (mm_context->tngf_id) {
445
0
    cJSON *tngf_id_local_JSON = OpenAPI_global_ran_node_id_convertToJSON(mm_context->tngf_id);
446
0
    if (tngf_id_local_JSON == NULL) {
447
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [tngf_id]");
448
0
        goto end;
449
0
    }
450
0
    cJSON_AddItemToObject(item, "tngfId", tngf_id_local_JSON);
451
0
    if (item->child == NULL) {
452
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [tngf_id]");
453
0
        goto end;
454
0
    }
455
0
    }
456
457
0
    if (mm_context->is_an_n2_ap_id) {
458
0
    if (cJSON_AddNumberToObject(item, "anN2ApId", mm_context->an_n2_ap_id) == NULL) {
459
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [an_n2_ap_id]");
460
0
        goto end;
461
0
    }
462
0
    }
463
464
0
    if (mm_context->nssaa_status_list) {
465
0
    cJSON *nssaa_status_listList = cJSON_AddArrayToObject(item, "nssaaStatusList");
466
0
    if (nssaa_status_listList == NULL) {
467
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [nssaa_status_list]");
468
0
        goto end;
469
0
    }
470
0
    OpenAPI_list_for_each(mm_context->nssaa_status_list, node) {
471
0
        cJSON *itemLocal = OpenAPI_nssaa_status_convertToJSON(node->data);
472
0
        if (itemLocal == NULL) {
473
0
            ogs_error("OpenAPI_mm_context_convertToJSON() failed [nssaa_status_list]");
474
0
            goto end;
475
0
        }
476
0
        cJSON_AddItemToArray(nssaa_status_listList, itemLocal);
477
0
    }
478
0
    }
479
480
0
    if (mm_context->pending_nssai_mapping_list) {
481
0
    cJSON *pending_nssai_mapping_listList = cJSON_AddArrayToObject(item, "pendingNssaiMappingList");
482
0
    if (pending_nssai_mapping_listList == NULL) {
483
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [pending_nssai_mapping_list]");
484
0
        goto end;
485
0
    }
486
0
    OpenAPI_list_for_each(mm_context->pending_nssai_mapping_list, node) {
487
0
        cJSON *itemLocal = OpenAPI_nssai_mapping_convertToJSON(node->data);
488
0
        if (itemLocal == NULL) {
489
0
            ogs_error("OpenAPI_mm_context_convertToJSON() failed [pending_nssai_mapping_list]");
490
0
            goto end;
491
0
        }
492
0
        cJSON_AddItemToArray(pending_nssai_mapping_listList, itemLocal);
493
0
    }
494
0
    }
495
496
0
    if (mm_context->uuaa_mm_status != OpenAPI_uuaa_mm_status_NULL) {
497
0
    if (cJSON_AddStringToObject(item, "uuaaMmStatus", OpenAPI_uuaa_mm_status_ToString(mm_context->uuaa_mm_status)) == NULL) {
498
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [uuaa_mm_status]");
499
0
        goto end;
500
0
    }
501
0
    }
502
503
0
    if (mm_context->dereg_inact_timer_list) {
504
0
    cJSON *dereg_inact_timer_list = cJSON_AddObjectToObject(item, "deregInactTimerList");
505
0
    if (dereg_inact_timer_list == NULL) {
506
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [dereg_inact_timer_list]");
507
0
        goto end;
508
0
    }
509
0
    cJSON *localMapObject = dereg_inact_timer_list;
510
0
    if (mm_context->dereg_inact_timer_list) {
511
0
        OpenAPI_list_for_each(mm_context->dereg_inact_timer_list, node) {
512
0
            OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
513
0
            if (localKeyValue == NULL) {
514
0
                ogs_error("OpenAPI_mm_context_convertToJSON() failed [dereg_inact_timer_list]");
515
0
                goto end;
516
0
            }
517
0
            if (localKeyValue->key == NULL) {
518
0
                ogs_error("OpenAPI_mm_context_convertToJSON() failed [dereg_inact_timer_list]");
519
0
                goto end;
520
0
            }
521
0
            cJSON *itemLocal = localKeyValue->value ?
522
0
                OpenAPI_dereg_inact_timer_info_convertToJSON(localKeyValue->value) :
523
0
                cJSON_CreateNull();
524
0
            if (itemLocal == NULL) {
525
0
                ogs_error("OpenAPI_mm_context_convertToJSON() failed [inner]");
526
0
                goto end;
527
0
            }
528
0
            cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal);
529
0
        }
530
0
    }
531
0
    }
532
533
0
    if (mm_context->is_vo_support_match_ind) {
534
0
    if (cJSON_AddBoolToObject(item, "voSupportMatchInd", mm_context->vo_support_match_ind) == NULL) {
535
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed [vo_support_match_ind]");
536
0
        goto end;
537
0
    }
538
0
    }
539
540
0
end:
541
0
    return item;
542
0
}
543
544
OpenAPI_mm_context_t *OpenAPI_mm_context_parseFromJSON(cJSON *mm_contextJSON)
545
0
{
546
0
    OpenAPI_mm_context_t *mm_context_local_var = NULL;
547
0
    OpenAPI_lnode_t *node = NULL;
548
0
    cJSON *access_type = NULL;
549
0
    OpenAPI_access_type_e access_typeVariable = 0;
550
0
    cJSON *nas_security_mode = NULL;
551
0
    OpenAPI_nas_security_mode_t *nas_security_mode_local_nonprim = NULL;
552
0
    cJSON *eps_nas_security_mode = NULL;
553
0
    OpenAPI_eps_nas_security_mode_t *eps_nas_security_mode_local_nonprim = NULL;
554
0
    cJSON *nas_downlink_count = NULL;
555
0
    cJSON *nas_uplink_count = NULL;
556
0
    cJSON *ue_security_capability = NULL;
557
0
    cJSON *s1_ue_network_capability = NULL;
558
0
    cJSON *allowed_nssai = NULL;
559
0
    OpenAPI_list_t *allowed_nssaiList = NULL;
560
0
    cJSON *nssai_mapping_list = NULL;
561
0
    OpenAPI_list_t *nssai_mapping_listList = NULL;
562
0
    cJSON *allowed_home_nssai = NULL;
563
0
    OpenAPI_list_t *allowed_home_nssaiList = NULL;
564
0
    cJSON *partially_allowed_nssai = NULL;
565
0
    OpenAPI_list_t *partially_allowed_nssaiList = NULL;
566
0
    cJSON *replaced_snssai_mapping_list = NULL;
567
0
    OpenAPI_list_t *replaced_snssai_mapping_listList = NULL;
568
0
    cJSON *ns_instance_list = NULL;
569
0
    OpenAPI_list_t *ns_instance_listList = NULL;
570
0
    cJSON *expected_u_ebehavior = NULL;
571
0
    OpenAPI_expected_ue_behavior_t *expected_u_ebehavior_local_nonprim = NULL;
572
0
    cJSON *ue_differentiation_info = NULL;
573
0
    OpenAPI_ue_differentiation_info_t *ue_differentiation_info_local_nonprim = NULL;
574
0
    cJSON *plmn_assi_ue_radio_cap_id = NULL;
575
0
    cJSON *man_assi_ue_radio_cap_id = NULL;
576
0
    cJSON *ucmf_dic_entry_id = NULL;
577
0
    cJSON *n3_iwf_id = NULL;
578
0
    OpenAPI_global_ran_node_id_t *n3_iwf_id_local_nonprim = NULL;
579
0
    cJSON *wagf_id = NULL;
580
0
    OpenAPI_global_ran_node_id_t *wagf_id_local_nonprim = NULL;
581
0
    cJSON *tngf_id = NULL;
582
0
    OpenAPI_global_ran_node_id_t *tngf_id_local_nonprim = NULL;
583
0
    cJSON *an_n2_ap_id = NULL;
584
0
    cJSON *nssaa_status_list = NULL;
585
0
    OpenAPI_list_t *nssaa_status_listList = NULL;
586
0
    cJSON *pending_nssai_mapping_list = NULL;
587
0
    OpenAPI_list_t *pending_nssai_mapping_listList = NULL;
588
0
    cJSON *uuaa_mm_status = NULL;
589
0
    OpenAPI_uuaa_mm_status_e uuaa_mm_statusVariable = 0;
590
0
    cJSON *dereg_inact_timer_list = NULL;
591
0
    OpenAPI_list_t *dereg_inact_timer_listList = NULL;
592
0
    cJSON *vo_support_match_ind = NULL;
593
0
    access_type = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "accessType");
594
0
    if (!access_type) {
595
0
        ogs_error("OpenAPI_mm_context_parseFromJSON() failed [access_type]");
596
0
        goto end;
597
0
    }
598
0
    if (!cJSON_IsString(access_type)) {
599
0
        ogs_error("OpenAPI_mm_context_parseFromJSON() failed [access_type]");
600
0
        goto end;
601
0
    }
602
0
    access_typeVariable = OpenAPI_access_type_FromString(access_type->valuestring);
603
604
0
    nas_security_mode = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "nasSecurityMode");
605
0
    if (nas_security_mode) {
606
0
    nas_security_mode_local_nonprim = OpenAPI_nas_security_mode_parseFromJSON(nas_security_mode);
607
0
    if (!nas_security_mode_local_nonprim) {
608
0
        ogs_error("OpenAPI_nas_security_mode_parseFromJSON failed [nas_security_mode]");
609
0
        goto end;
610
0
    }
611
0
    }
612
613
0
    eps_nas_security_mode = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "epsNasSecurityMode");
614
0
    if (eps_nas_security_mode) {
615
0
    eps_nas_security_mode_local_nonprim = OpenAPI_eps_nas_security_mode_parseFromJSON(eps_nas_security_mode);
616
0
    if (!eps_nas_security_mode_local_nonprim) {
617
0
        ogs_error("OpenAPI_eps_nas_security_mode_parseFromJSON failed [eps_nas_security_mode]");
618
0
        goto end;
619
0
    }
620
0
    }
621
622
0
    nas_downlink_count = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "nasDownlinkCount");
623
0
    if (nas_downlink_count) {
624
0
    if (!cJSON_IsNumber(nas_downlink_count)) {
625
0
        ogs_error("OpenAPI_mm_context_parseFromJSON() failed [nas_downlink_count]");
626
0
        goto end;
627
0
    }
628
0
    }
629
630
0
    nas_uplink_count = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "nasUplinkCount");
631
0
    if (nas_uplink_count) {
632
0
    if (!cJSON_IsNumber(nas_uplink_count)) {
633
0
        ogs_error("OpenAPI_mm_context_parseFromJSON() failed [nas_uplink_count]");
634
0
        goto end;
635
0
    }
636
0
    }
637
638
0
    ue_security_capability = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "ueSecurityCapability");
639
0
    if (ue_security_capability) {
640
0
    if (!cJSON_IsString(ue_security_capability) && !cJSON_IsNull(ue_security_capability)) {
641
0
        ogs_error("OpenAPI_mm_context_parseFromJSON() failed [ue_security_capability]");
642
0
        goto end;
643
0
    }
644
0
    }
645
646
0
    s1_ue_network_capability = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "s1UeNetworkCapability");
647
0
    if (s1_ue_network_capability) {
648
0
    if (!cJSON_IsString(s1_ue_network_capability) && !cJSON_IsNull(s1_ue_network_capability)) {
649
0
        ogs_error("OpenAPI_mm_context_parseFromJSON() failed [s1_ue_network_capability]");
650
0
        goto end;
651
0
    }
652
0
    }
653
654
0
    allowed_nssai = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "allowedNssai");
655
0
    if (allowed_nssai) {
656
0
        cJSON *allowed_nssai_local = NULL;
657
0
        if (!cJSON_IsArray(allowed_nssai)) {
658
0
            ogs_error("OpenAPI_mm_context_parseFromJSON() failed [allowed_nssai]");
659
0
            goto end;
660
0
        }
661
662
0
        allowed_nssaiList = OpenAPI_list_create();
663
664
0
        cJSON_ArrayForEach(allowed_nssai_local, allowed_nssai) {
665
0
            if (!cJSON_IsObject(allowed_nssai_local)) {
666
0
                ogs_error("OpenAPI_mm_context_parseFromJSON() failed [allowed_nssai]");
667
0
                goto end;
668
0
            }
669
0
            OpenAPI_snssai_t *allowed_nssaiItem = OpenAPI_snssai_parseFromJSON(allowed_nssai_local);
670
0
            if (!allowed_nssaiItem) {
671
0
                ogs_error("No allowed_nssaiItem");
672
0
                goto end;
673
0
            }
674
0
            OpenAPI_list_add(allowed_nssaiList, allowed_nssaiItem);
675
0
        }
676
0
    }
677
678
0
    nssai_mapping_list = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "nssaiMappingList");
679
0
    if (nssai_mapping_list) {
680
0
        cJSON *nssai_mapping_list_local = NULL;
681
0
        if (!cJSON_IsArray(nssai_mapping_list)) {
682
0
            ogs_error("OpenAPI_mm_context_parseFromJSON() failed [nssai_mapping_list]");
683
0
            goto end;
684
0
        }
685
686
0
        nssai_mapping_listList = OpenAPI_list_create();
687
688
0
        cJSON_ArrayForEach(nssai_mapping_list_local, nssai_mapping_list) {
689
0
            if (!cJSON_IsObject(nssai_mapping_list_local)) {
690
0
                ogs_error("OpenAPI_mm_context_parseFromJSON() failed [nssai_mapping_list]");
691
0
                goto end;
692
0
            }
693
0
            OpenAPI_nssai_mapping_t *nssai_mapping_listItem = OpenAPI_nssai_mapping_parseFromJSON(nssai_mapping_list_local);
694
0
            if (!nssai_mapping_listItem) {
695
0
                ogs_error("No nssai_mapping_listItem");
696
0
                goto end;
697
0
            }
698
0
            OpenAPI_list_add(nssai_mapping_listList, nssai_mapping_listItem);
699
0
        }
700
0
    }
701
702
0
    allowed_home_nssai = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "allowedHomeNssai");
703
0
    if (allowed_home_nssai) {
704
0
        cJSON *allowed_home_nssai_local = NULL;
705
0
        if (!cJSON_IsArray(allowed_home_nssai)) {
706
0
            ogs_error("OpenAPI_mm_context_parseFromJSON() failed [allowed_home_nssai]");
707
0
            goto end;
708
0
        }
709
710
0
        allowed_home_nssaiList = OpenAPI_list_create();
711
712
0
        cJSON_ArrayForEach(allowed_home_nssai_local, allowed_home_nssai) {
713
0
            if (!cJSON_IsObject(allowed_home_nssai_local)) {
714
0
                ogs_error("OpenAPI_mm_context_parseFromJSON() failed [allowed_home_nssai]");
715
0
                goto end;
716
0
            }
717
0
            OpenAPI_snssai_t *allowed_home_nssaiItem = OpenAPI_snssai_parseFromJSON(allowed_home_nssai_local);
718
0
            if (!allowed_home_nssaiItem) {
719
0
                ogs_error("No allowed_home_nssaiItem");
720
0
                goto end;
721
0
            }
722
0
            OpenAPI_list_add(allowed_home_nssaiList, allowed_home_nssaiItem);
723
0
        }
724
0
    }
725
726
0
    partially_allowed_nssai = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "partiallyAllowedNssai");
727
0
    if (partially_allowed_nssai) {
728
0
        cJSON *partially_allowed_nssai_local = NULL;
729
0
        if (!cJSON_IsArray(partially_allowed_nssai)) {
730
0
            ogs_error("OpenAPI_mm_context_parseFromJSON() failed [partially_allowed_nssai]");
731
0
            goto end;
732
0
        }
733
734
0
        partially_allowed_nssaiList = OpenAPI_list_create();
735
736
0
        cJSON_ArrayForEach(partially_allowed_nssai_local, partially_allowed_nssai) {
737
0
            if (!cJSON_IsObject(partially_allowed_nssai_local)) {
738
0
                ogs_error("OpenAPI_mm_context_parseFromJSON() failed [partially_allowed_nssai]");
739
0
                goto end;
740
0
            }
741
0
            OpenAPI_partially_allowed_snssai_t *partially_allowed_nssaiItem = OpenAPI_partially_allowed_snssai_parseFromJSON(partially_allowed_nssai_local);
742
0
            if (!partially_allowed_nssaiItem) {
743
0
                ogs_error("No partially_allowed_nssaiItem");
744
0
                goto end;
745
0
            }
746
0
            OpenAPI_list_add(partially_allowed_nssaiList, partially_allowed_nssaiItem);
747
0
        }
748
0
    }
749
750
0
    replaced_snssai_mapping_list = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "replacedSnssaiMappingList");
751
0
    if (replaced_snssai_mapping_list) {
752
0
        cJSON *replaced_snssai_mapping_list_local = NULL;
753
0
        if (!cJSON_IsArray(replaced_snssai_mapping_list)) {
754
0
            ogs_error("OpenAPI_mm_context_parseFromJSON() failed [replaced_snssai_mapping_list]");
755
0
            goto end;
756
0
        }
757
758
0
        replaced_snssai_mapping_listList = OpenAPI_list_create();
759
760
0
        cJSON_ArrayForEach(replaced_snssai_mapping_list_local, replaced_snssai_mapping_list) {
761
0
            if (!cJSON_IsObject(replaced_snssai_mapping_list_local)) {
762
0
                ogs_error("OpenAPI_mm_context_parseFromJSON() failed [replaced_snssai_mapping_list]");
763
0
                goto end;
764
0
            }
765
0
            OpenAPI_slice_replacement_mapping_t *replaced_snssai_mapping_listItem = OpenAPI_slice_replacement_mapping_parseFromJSON(replaced_snssai_mapping_list_local);
766
0
            if (!replaced_snssai_mapping_listItem) {
767
0
                ogs_error("No replaced_snssai_mapping_listItem");
768
0
                goto end;
769
0
            }
770
0
            OpenAPI_list_add(replaced_snssai_mapping_listList, replaced_snssai_mapping_listItem);
771
0
        }
772
0
    }
773
774
0
    ns_instance_list = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "nsInstanceList");
775
0
    if (ns_instance_list) {
776
0
        cJSON *ns_instance_list_local = NULL;
777
0
        if (!cJSON_IsArray(ns_instance_list)) {
778
0
            ogs_error("OpenAPI_mm_context_parseFromJSON() failed [ns_instance_list]");
779
0
            goto end;
780
0
        }
781
782
0
        ns_instance_listList = OpenAPI_list_create();
783
784
0
        cJSON_ArrayForEach(ns_instance_list_local, ns_instance_list) {
785
0
            double *localDouble = NULL;
786
0
            int *localInt = NULL;
787
0
            if (!cJSON_IsString(ns_instance_list_local)) {
788
0
                ogs_error("OpenAPI_mm_context_parseFromJSON() failed [ns_instance_list]");
789
0
                goto end;
790
0
            }
791
0
            OpenAPI_list_add(ns_instance_listList, ogs_strdup(ns_instance_list_local->valuestring));
792
0
        }
793
0
    }
794
795
0
    expected_u_ebehavior = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "expectedUEbehavior");
796
0
    if (expected_u_ebehavior) {
797
0
    expected_u_ebehavior_local_nonprim = OpenAPI_expected_ue_behavior_parseFromJSON(expected_u_ebehavior);
798
0
    if (!expected_u_ebehavior_local_nonprim) {
799
0
        ogs_error("OpenAPI_expected_ue_behavior_parseFromJSON failed [expected_u_ebehavior]");
800
0
        goto end;
801
0
    }
802
0
    }
803
804
0
    ue_differentiation_info = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "ueDifferentiationInfo");
805
0
    if (ue_differentiation_info) {
806
0
    ue_differentiation_info_local_nonprim = OpenAPI_ue_differentiation_info_parseFromJSON(ue_differentiation_info);
807
0
    if (!ue_differentiation_info_local_nonprim) {
808
0
        ogs_error("OpenAPI_ue_differentiation_info_parseFromJSON failed [ue_differentiation_info]");
809
0
        goto end;
810
0
    }
811
0
    }
812
813
0
    plmn_assi_ue_radio_cap_id = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "plmnAssiUeRadioCapId");
814
0
    if (plmn_assi_ue_radio_cap_id) {
815
0
    if (!cJSON_IsString(plmn_assi_ue_radio_cap_id) && !cJSON_IsNull(plmn_assi_ue_radio_cap_id)) {
816
0
        ogs_error("OpenAPI_mm_context_parseFromJSON() failed [plmn_assi_ue_radio_cap_id]");
817
0
        goto end;
818
0
    }
819
0
    }
820
821
0
    man_assi_ue_radio_cap_id = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "manAssiUeRadioCapId");
822
0
    if (man_assi_ue_radio_cap_id) {
823
0
    if (!cJSON_IsString(man_assi_ue_radio_cap_id) && !cJSON_IsNull(man_assi_ue_radio_cap_id)) {
824
0
        ogs_error("OpenAPI_mm_context_parseFromJSON() failed [man_assi_ue_radio_cap_id]");
825
0
        goto end;
826
0
    }
827
0
    }
828
829
0
    ucmf_dic_entry_id = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "ucmfDicEntryId");
830
0
    if (ucmf_dic_entry_id) {
831
0
    if (!cJSON_IsString(ucmf_dic_entry_id) && !cJSON_IsNull(ucmf_dic_entry_id)) {
832
0
        ogs_error("OpenAPI_mm_context_parseFromJSON() failed [ucmf_dic_entry_id]");
833
0
        goto end;
834
0
    }
835
0
    }
836
837
0
    n3_iwf_id = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "n3IwfId");
838
0
    if (n3_iwf_id) {
839
0
    n3_iwf_id_local_nonprim = OpenAPI_global_ran_node_id_parseFromJSON(n3_iwf_id);
840
0
    if (!n3_iwf_id_local_nonprim) {
841
0
        ogs_error("OpenAPI_global_ran_node_id_parseFromJSON failed [n3_iwf_id]");
842
0
        goto end;
843
0
    }
844
0
    }
845
846
0
    wagf_id = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "wagfId");
847
0
    if (wagf_id) {
848
0
    wagf_id_local_nonprim = OpenAPI_global_ran_node_id_parseFromJSON(wagf_id);
849
0
    if (!wagf_id_local_nonprim) {
850
0
        ogs_error("OpenAPI_global_ran_node_id_parseFromJSON failed [wagf_id]");
851
0
        goto end;
852
0
    }
853
0
    }
854
855
0
    tngf_id = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "tngfId");
856
0
    if (tngf_id) {
857
0
    tngf_id_local_nonprim = OpenAPI_global_ran_node_id_parseFromJSON(tngf_id);
858
0
    if (!tngf_id_local_nonprim) {
859
0
        ogs_error("OpenAPI_global_ran_node_id_parseFromJSON failed [tngf_id]");
860
0
        goto end;
861
0
    }
862
0
    }
863
864
0
    an_n2_ap_id = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "anN2ApId");
865
0
    if (an_n2_ap_id) {
866
0
    if (!cJSON_IsNumber(an_n2_ap_id)) {
867
0
        ogs_error("OpenAPI_mm_context_parseFromJSON() failed [an_n2_ap_id]");
868
0
        goto end;
869
0
    }
870
0
    }
871
872
0
    nssaa_status_list = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "nssaaStatusList");
873
0
    if (nssaa_status_list) {
874
0
        cJSON *nssaa_status_list_local = NULL;
875
0
        if (!cJSON_IsArray(nssaa_status_list)) {
876
0
            ogs_error("OpenAPI_mm_context_parseFromJSON() failed [nssaa_status_list]");
877
0
            goto end;
878
0
        }
879
880
0
        nssaa_status_listList = OpenAPI_list_create();
881
882
0
        cJSON_ArrayForEach(nssaa_status_list_local, nssaa_status_list) {
883
0
            if (!cJSON_IsObject(nssaa_status_list_local)) {
884
0
                ogs_error("OpenAPI_mm_context_parseFromJSON() failed [nssaa_status_list]");
885
0
                goto end;
886
0
            }
887
0
            OpenAPI_nssaa_status_t *nssaa_status_listItem = OpenAPI_nssaa_status_parseFromJSON(nssaa_status_list_local);
888
0
            if (!nssaa_status_listItem) {
889
0
                ogs_error("No nssaa_status_listItem");
890
0
                goto end;
891
0
            }
892
0
            OpenAPI_list_add(nssaa_status_listList, nssaa_status_listItem);
893
0
        }
894
0
    }
895
896
0
    pending_nssai_mapping_list = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "pendingNssaiMappingList");
897
0
    if (pending_nssai_mapping_list) {
898
0
        cJSON *pending_nssai_mapping_list_local = NULL;
899
0
        if (!cJSON_IsArray(pending_nssai_mapping_list)) {
900
0
            ogs_error("OpenAPI_mm_context_parseFromJSON() failed [pending_nssai_mapping_list]");
901
0
            goto end;
902
0
        }
903
904
0
        pending_nssai_mapping_listList = OpenAPI_list_create();
905
906
0
        cJSON_ArrayForEach(pending_nssai_mapping_list_local, pending_nssai_mapping_list) {
907
0
            if (!cJSON_IsObject(pending_nssai_mapping_list_local)) {
908
0
                ogs_error("OpenAPI_mm_context_parseFromJSON() failed [pending_nssai_mapping_list]");
909
0
                goto end;
910
0
            }
911
0
            OpenAPI_nssai_mapping_t *pending_nssai_mapping_listItem = OpenAPI_nssai_mapping_parseFromJSON(pending_nssai_mapping_list_local);
912
0
            if (!pending_nssai_mapping_listItem) {
913
0
                ogs_error("No pending_nssai_mapping_listItem");
914
0
                goto end;
915
0
            }
916
0
            OpenAPI_list_add(pending_nssai_mapping_listList, pending_nssai_mapping_listItem);
917
0
        }
918
0
    }
919
920
0
    uuaa_mm_status = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "uuaaMmStatus");
921
0
    if (uuaa_mm_status) {
922
0
    if (!cJSON_IsString(uuaa_mm_status)) {
923
0
        ogs_error("OpenAPI_mm_context_parseFromJSON() failed [uuaa_mm_status]");
924
0
        goto end;
925
0
    }
926
0
    uuaa_mm_statusVariable = OpenAPI_uuaa_mm_status_FromString(uuaa_mm_status->valuestring);
927
0
    }
928
929
0
    dereg_inact_timer_list = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "deregInactTimerList");
930
0
    if (dereg_inact_timer_list) {
931
0
        cJSON *dereg_inact_timer_list_local_map = NULL;
932
0
        if (!cJSON_IsObject(dereg_inact_timer_list) && !cJSON_IsNull(dereg_inact_timer_list)) {
933
0
            ogs_error("OpenAPI_mm_context_parseFromJSON() failed [dereg_inact_timer_list]");
934
0
            goto end;
935
0
        }
936
0
        if (cJSON_IsObject(dereg_inact_timer_list)) {
937
0
            dereg_inact_timer_listList = OpenAPI_list_create();
938
0
            OpenAPI_map_t *localMapKeyPair = NULL;
939
0
            cJSON_ArrayForEach(dereg_inact_timer_list_local_map, dereg_inact_timer_list) {
940
0
                cJSON *localMapObject = dereg_inact_timer_list_local_map;
941
0
                if (cJSON_IsObject(localMapObject)) {
942
0
                    localMapKeyPair = OpenAPI_map_create(
943
0
                        ogs_strdup(localMapObject->string), OpenAPI_dereg_inact_timer_info_parseFromJSON(localMapObject));
944
0
                } else if (cJSON_IsNull(localMapObject)) {
945
0
                    localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL);
946
0
                } else {
947
0
                    ogs_error("OpenAPI_mm_context_parseFromJSON() failed [inner]");
948
0
                    goto end;
949
0
                }
950
0
                if (localMapKeyPair == NULL) {
951
0
                    ogs_error("OpenAPI_mm_context_parseFromJSON() failed [dereg_inact_timer_list]");
952
0
                    goto end;
953
0
                }
954
0
                OpenAPI_list_add(dereg_inact_timer_listList, localMapKeyPair);
955
0
            }
956
0
        }
957
0
    }
958
959
0
    vo_support_match_ind = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "voSupportMatchInd");
960
0
    if (vo_support_match_ind) {
961
0
    if (!cJSON_IsBool(vo_support_match_ind)) {
962
0
        ogs_error("OpenAPI_mm_context_parseFromJSON() failed [vo_support_match_ind]");
963
0
        goto end;
964
0
    }
965
0
    }
966
967
0
    mm_context_local_var = OpenAPI_mm_context_create (
968
0
        access_typeVariable,
969
0
        nas_security_mode ? nas_security_mode_local_nonprim : NULL,
970
0
        eps_nas_security_mode ? eps_nas_security_mode_local_nonprim : NULL,
971
0
        nas_downlink_count ? true : false,
972
0
        nas_downlink_count ? nas_downlink_count->valuedouble : 0,
973
0
        nas_uplink_count ? true : false,
974
0
        nas_uplink_count ? nas_uplink_count->valuedouble : 0,
975
0
        ue_security_capability && !cJSON_IsNull(ue_security_capability) ? ogs_strdup(ue_security_capability->valuestring) : NULL,
976
0
        s1_ue_network_capability && !cJSON_IsNull(s1_ue_network_capability) ? ogs_strdup(s1_ue_network_capability->valuestring) : NULL,
977
0
        allowed_nssai ? allowed_nssaiList : NULL,
978
0
        nssai_mapping_list ? nssai_mapping_listList : NULL,
979
0
        allowed_home_nssai ? allowed_home_nssaiList : NULL,
980
0
        partially_allowed_nssai ? partially_allowed_nssaiList : NULL,
981
0
        replaced_snssai_mapping_list ? replaced_snssai_mapping_listList : NULL,
982
0
        ns_instance_list ? ns_instance_listList : NULL,
983
0
        expected_u_ebehavior ? expected_u_ebehavior_local_nonprim : NULL,
984
0
        ue_differentiation_info ? ue_differentiation_info_local_nonprim : NULL,
985
0
        plmn_assi_ue_radio_cap_id && !cJSON_IsNull(plmn_assi_ue_radio_cap_id) ? ogs_strdup(plmn_assi_ue_radio_cap_id->valuestring) : NULL,
986
0
        man_assi_ue_radio_cap_id && !cJSON_IsNull(man_assi_ue_radio_cap_id) ? ogs_strdup(man_assi_ue_radio_cap_id->valuestring) : NULL,
987
0
        ucmf_dic_entry_id && !cJSON_IsNull(ucmf_dic_entry_id) ? ogs_strdup(ucmf_dic_entry_id->valuestring) : NULL,
988
0
        n3_iwf_id ? n3_iwf_id_local_nonprim : NULL,
989
0
        wagf_id ? wagf_id_local_nonprim : NULL,
990
0
        tngf_id ? tngf_id_local_nonprim : NULL,
991
0
        an_n2_ap_id ? true : false,
992
0
        an_n2_ap_id ? an_n2_ap_id->valuedouble : 0,
993
0
        nssaa_status_list ? nssaa_status_listList : NULL,
994
0
        pending_nssai_mapping_list ? pending_nssai_mapping_listList : NULL,
995
0
        uuaa_mm_status ? uuaa_mm_statusVariable : 0,
996
0
        dereg_inact_timer_list ? dereg_inact_timer_listList : NULL,
997
0
        vo_support_match_ind ? true : false,
998
0
        vo_support_match_ind ? vo_support_match_ind->valueint : 0
999
0
    );
1000
1001
0
    return mm_context_local_var;
1002
0
end:
1003
0
    if (nas_security_mode_local_nonprim) {
1004
0
        OpenAPI_nas_security_mode_free(nas_security_mode_local_nonprim);
1005
0
        nas_security_mode_local_nonprim = NULL;
1006
0
    }
1007
0
    if (eps_nas_security_mode_local_nonprim) {
1008
0
        OpenAPI_eps_nas_security_mode_free(eps_nas_security_mode_local_nonprim);
1009
0
        eps_nas_security_mode_local_nonprim = NULL;
1010
0
    }
1011
0
    if (allowed_nssaiList) {
1012
0
        OpenAPI_list_for_each(allowed_nssaiList, node) {
1013
0
            OpenAPI_snssai_free(node->data);
1014
0
        }
1015
0
        OpenAPI_list_free(allowed_nssaiList);
1016
0
        allowed_nssaiList = NULL;
1017
0
    }
1018
0
    if (nssai_mapping_listList) {
1019
0
        OpenAPI_list_for_each(nssai_mapping_listList, node) {
1020
0
            OpenAPI_nssai_mapping_free(node->data);
1021
0
        }
1022
0
        OpenAPI_list_free(nssai_mapping_listList);
1023
0
        nssai_mapping_listList = NULL;
1024
0
    }
1025
0
    if (allowed_home_nssaiList) {
1026
0
        OpenAPI_list_for_each(allowed_home_nssaiList, node) {
1027
0
            OpenAPI_snssai_free(node->data);
1028
0
        }
1029
0
        OpenAPI_list_free(allowed_home_nssaiList);
1030
0
        allowed_home_nssaiList = NULL;
1031
0
    }
1032
0
    if (partially_allowed_nssaiList) {
1033
0
        OpenAPI_list_for_each(partially_allowed_nssaiList, node) {
1034
0
            OpenAPI_partially_allowed_snssai_free(node->data);
1035
0
        }
1036
0
        OpenAPI_list_free(partially_allowed_nssaiList);
1037
0
        partially_allowed_nssaiList = NULL;
1038
0
    }
1039
0
    if (replaced_snssai_mapping_listList) {
1040
0
        OpenAPI_list_for_each(replaced_snssai_mapping_listList, node) {
1041
0
            OpenAPI_slice_replacement_mapping_free(node->data);
1042
0
        }
1043
0
        OpenAPI_list_free(replaced_snssai_mapping_listList);
1044
0
        replaced_snssai_mapping_listList = NULL;
1045
0
    }
1046
0
    if (ns_instance_listList) {
1047
0
        OpenAPI_list_for_each(ns_instance_listList, node) {
1048
0
            ogs_free(node->data);
1049
0
        }
1050
0
        OpenAPI_list_free(ns_instance_listList);
1051
0
        ns_instance_listList = NULL;
1052
0
    }
1053
0
    if (expected_u_ebehavior_local_nonprim) {
1054
0
        OpenAPI_expected_ue_behavior_free(expected_u_ebehavior_local_nonprim);
1055
0
        expected_u_ebehavior_local_nonprim = NULL;
1056
0
    }
1057
0
    if (ue_differentiation_info_local_nonprim) {
1058
0
        OpenAPI_ue_differentiation_info_free(ue_differentiation_info_local_nonprim);
1059
0
        ue_differentiation_info_local_nonprim = NULL;
1060
0
    }
1061
0
    if (n3_iwf_id_local_nonprim) {
1062
0
        OpenAPI_global_ran_node_id_free(n3_iwf_id_local_nonprim);
1063
0
        n3_iwf_id_local_nonprim = NULL;
1064
0
    }
1065
0
    if (wagf_id_local_nonprim) {
1066
0
        OpenAPI_global_ran_node_id_free(wagf_id_local_nonprim);
1067
0
        wagf_id_local_nonprim = NULL;
1068
0
    }
1069
0
    if (tngf_id_local_nonprim) {
1070
0
        OpenAPI_global_ran_node_id_free(tngf_id_local_nonprim);
1071
0
        tngf_id_local_nonprim = NULL;
1072
0
    }
1073
0
    if (nssaa_status_listList) {
1074
0
        OpenAPI_list_for_each(nssaa_status_listList, node) {
1075
0
            OpenAPI_nssaa_status_free(node->data);
1076
0
        }
1077
0
        OpenAPI_list_free(nssaa_status_listList);
1078
0
        nssaa_status_listList = NULL;
1079
0
    }
1080
0
    if (pending_nssai_mapping_listList) {
1081
0
        OpenAPI_list_for_each(pending_nssai_mapping_listList, node) {
1082
0
            OpenAPI_nssai_mapping_free(node->data);
1083
0
        }
1084
0
        OpenAPI_list_free(pending_nssai_mapping_listList);
1085
0
        pending_nssai_mapping_listList = NULL;
1086
0
    }
1087
0
    if (dereg_inact_timer_listList) {
1088
0
        OpenAPI_list_for_each(dereg_inact_timer_listList, node) {
1089
0
            OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
1090
0
            ogs_free(localKeyValue->key);
1091
0
            OpenAPI_dereg_inact_timer_info_free(localKeyValue->value);
1092
0
            OpenAPI_map_free(localKeyValue);
1093
0
        }
1094
0
        OpenAPI_list_free(dereg_inact_timer_listList);
1095
0
        dereg_inact_timer_listList = NULL;
1096
0
    }
1097
0
    return NULL;
1098
0
}
1099
1100
OpenAPI_mm_context_t *OpenAPI_mm_context_copy(OpenAPI_mm_context_t *dst, OpenAPI_mm_context_t *src)
1101
0
{
1102
0
    cJSON *item = NULL;
1103
0
    char *content = NULL;
1104
1105
0
    ogs_assert(src);
1106
0
    item = OpenAPI_mm_context_convertToJSON(src);
1107
0
    if (!item) {
1108
0
        ogs_error("OpenAPI_mm_context_convertToJSON() failed");
1109
0
        return NULL;
1110
0
    }
1111
1112
0
    content = cJSON_Print(item);
1113
0
    cJSON_Delete(item);
1114
1115
0
    if (!content) {
1116
0
        ogs_error("cJSON_Print() failed");
1117
0
        return NULL;
1118
0
    }
1119
1120
0
    item = cJSON_Parse(content);
1121
0
    ogs_free(content);
1122
0
    if (!item) {
1123
0
        ogs_error("cJSON_Parse() failed");
1124
0
        return NULL;
1125
0
    }
1126
1127
0
    OpenAPI_mm_context_free(dst);
1128
0
    dst = OpenAPI_mm_context_parseFromJSON(item);
1129
0
    cJSON_Delete(item);
1130
1131
0
    return dst;
1132
0
}
1133