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/prose_context.c
Line
Count
Source
1
2
#include <stdlib.h>
3
#include <string.h>
4
#include <stdio.h>
5
#include "prose_context.h"
6
7
OpenAPI_prose_context_t *OpenAPI_prose_context_create(
8
    OpenAPI_ue_auth_e direct_discovery,
9
    OpenAPI_ue_auth_e direct_comm,
10
    OpenAPI_ue_auth_e l2_relay,
11
    OpenAPI_ue_auth_e l3_relay,
12
    OpenAPI_ue_auth_e l2_remote,
13
    OpenAPI_ue_auth_e l3_remote,
14
    OpenAPI_ue_auth_e l2_ue_relay,
15
    OpenAPI_ue_auth_e l3_ue_relay,
16
    OpenAPI_ue_auth_e l2_end,
17
    OpenAPI_ue_auth_e l3_end,
18
    OpenAPI_ue_auth_e multi_path_comm,
19
    char *nr_ue_pc5_ambr,
20
    OpenAPI_pc5_qo_s_para_t *pc5_qo_s_para,
21
    OpenAPI_ue_auth_e l3_interm_relay,
22
    OpenAPI_ue_auth_e l3_multihop_remote,
23
    OpenAPI_ue_auth_e l3_net_multihop_relay,
24
    OpenAPI_ue_auth_e l3_ue_multihop_relay,
25
    OpenAPI_ue_auth_e l3_end_multihop_relay,
26
    OpenAPI_ue_auth_e l2_interm_relay,
27
    OpenAPI_ue_auth_e l2_multihop_remote,
28
    OpenAPI_ue_auth_e l2_net_multihop_relay
29
)
30
0
{
31
0
    OpenAPI_prose_context_t *prose_context_local_var = ogs_malloc(sizeof(OpenAPI_prose_context_t));
32
0
    ogs_assert(prose_context_local_var);
33
34
0
    prose_context_local_var->direct_discovery = direct_discovery;
35
0
    prose_context_local_var->direct_comm = direct_comm;
36
0
    prose_context_local_var->l2_relay = l2_relay;
37
0
    prose_context_local_var->l3_relay = l3_relay;
38
0
    prose_context_local_var->l2_remote = l2_remote;
39
0
    prose_context_local_var->l3_remote = l3_remote;
40
0
    prose_context_local_var->l2_ue_relay = l2_ue_relay;
41
0
    prose_context_local_var->l3_ue_relay = l3_ue_relay;
42
0
    prose_context_local_var->l2_end = l2_end;
43
0
    prose_context_local_var->l3_end = l3_end;
44
0
    prose_context_local_var->multi_path_comm = multi_path_comm;
45
0
    prose_context_local_var->nr_ue_pc5_ambr = nr_ue_pc5_ambr;
46
0
    prose_context_local_var->pc5_qo_s_para = pc5_qo_s_para;
47
0
    prose_context_local_var->l3_interm_relay = l3_interm_relay;
48
0
    prose_context_local_var->l3_multihop_remote = l3_multihop_remote;
49
0
    prose_context_local_var->l3_net_multihop_relay = l3_net_multihop_relay;
50
0
    prose_context_local_var->l3_ue_multihop_relay = l3_ue_multihop_relay;
51
0
    prose_context_local_var->l3_end_multihop_relay = l3_end_multihop_relay;
52
0
    prose_context_local_var->l2_interm_relay = l2_interm_relay;
53
0
    prose_context_local_var->l2_multihop_remote = l2_multihop_remote;
54
0
    prose_context_local_var->l2_net_multihop_relay = l2_net_multihop_relay;
55
56
0
    return prose_context_local_var;
57
0
}
58
59
void OpenAPI_prose_context_free(OpenAPI_prose_context_t *prose_context)
60
0
{
61
0
    OpenAPI_lnode_t *node = NULL;
62
63
0
    if (NULL == prose_context) {
64
0
        return;
65
0
    }
66
0
    if (prose_context->nr_ue_pc5_ambr) {
67
0
        ogs_free(prose_context->nr_ue_pc5_ambr);
68
0
        prose_context->nr_ue_pc5_ambr = NULL;
69
0
    }
70
0
    if (prose_context->pc5_qo_s_para) {
71
0
        OpenAPI_pc5_qo_s_para_free(prose_context->pc5_qo_s_para);
72
0
        prose_context->pc5_qo_s_para = NULL;
73
0
    }
74
0
    ogs_free(prose_context);
75
0
}
76
77
cJSON *OpenAPI_prose_context_convertToJSON(OpenAPI_prose_context_t *prose_context)
78
0
{
79
0
    cJSON *item = NULL;
80
0
    OpenAPI_lnode_t *node = NULL;
81
82
0
    if (prose_context == NULL) {
83
0
        ogs_error("OpenAPI_prose_context_convertToJSON() failed [ProseContext]");
84
0
        return NULL;
85
0
    }
86
87
0
    item = cJSON_CreateObject();
88
0
    if (prose_context->direct_discovery != OpenAPI_ue_auth_NULL) {
89
0
    if (cJSON_AddStringToObject(item, "directDiscovery", OpenAPI_ue_auth_ToString(prose_context->direct_discovery)) == NULL) {
90
0
        ogs_error("OpenAPI_prose_context_convertToJSON() failed [direct_discovery]");
91
0
        goto end;
92
0
    }
93
0
    }
94
95
0
    if (prose_context->direct_comm != OpenAPI_ue_auth_NULL) {
96
0
    if (cJSON_AddStringToObject(item, "directComm", OpenAPI_ue_auth_ToString(prose_context->direct_comm)) == NULL) {
97
0
        ogs_error("OpenAPI_prose_context_convertToJSON() failed [direct_comm]");
98
0
        goto end;
99
0
    }
100
0
    }
101
102
0
    if (prose_context->l2_relay != OpenAPI_ue_auth_NULL) {
103
0
    if (cJSON_AddStringToObject(item, "l2Relay", OpenAPI_ue_auth_ToString(prose_context->l2_relay)) == NULL) {
104
0
        ogs_error("OpenAPI_prose_context_convertToJSON() failed [l2_relay]");
105
0
        goto end;
106
0
    }
107
0
    }
108
109
0
    if (prose_context->l3_relay != OpenAPI_ue_auth_NULL) {
110
0
    if (cJSON_AddStringToObject(item, "l3Relay", OpenAPI_ue_auth_ToString(prose_context->l3_relay)) == NULL) {
111
0
        ogs_error("OpenAPI_prose_context_convertToJSON() failed [l3_relay]");
112
0
        goto end;
113
0
    }
114
0
    }
115
116
0
    if (prose_context->l2_remote != OpenAPI_ue_auth_NULL) {
117
0
    if (cJSON_AddStringToObject(item, "l2Remote", OpenAPI_ue_auth_ToString(prose_context->l2_remote)) == NULL) {
118
0
        ogs_error("OpenAPI_prose_context_convertToJSON() failed [l2_remote]");
119
0
        goto end;
120
0
    }
121
0
    }
122
123
0
    if (prose_context->l3_remote != OpenAPI_ue_auth_NULL) {
124
0
    if (cJSON_AddStringToObject(item, "l3Remote", OpenAPI_ue_auth_ToString(prose_context->l3_remote)) == NULL) {
125
0
        ogs_error("OpenAPI_prose_context_convertToJSON() failed [l3_remote]");
126
0
        goto end;
127
0
    }
128
0
    }
129
130
0
    if (prose_context->l2_ue_relay != OpenAPI_ue_auth_NULL) {
131
0
    if (cJSON_AddStringToObject(item, "l2UeRelay", OpenAPI_ue_auth_ToString(prose_context->l2_ue_relay)) == NULL) {
132
0
        ogs_error("OpenAPI_prose_context_convertToJSON() failed [l2_ue_relay]");
133
0
        goto end;
134
0
    }
135
0
    }
136
137
0
    if (prose_context->l3_ue_relay != OpenAPI_ue_auth_NULL) {
138
0
    if (cJSON_AddStringToObject(item, "l3UeRelay", OpenAPI_ue_auth_ToString(prose_context->l3_ue_relay)) == NULL) {
139
0
        ogs_error("OpenAPI_prose_context_convertToJSON() failed [l3_ue_relay]");
140
0
        goto end;
141
0
    }
142
0
    }
143
144
0
    if (prose_context->l2_end != OpenAPI_ue_auth_NULL) {
145
0
    if (cJSON_AddStringToObject(item, "l2End", OpenAPI_ue_auth_ToString(prose_context->l2_end)) == NULL) {
146
0
        ogs_error("OpenAPI_prose_context_convertToJSON() failed [l2_end]");
147
0
        goto end;
148
0
    }
149
0
    }
150
151
0
    if (prose_context->l3_end != OpenAPI_ue_auth_NULL) {
152
0
    if (cJSON_AddStringToObject(item, "l3End", OpenAPI_ue_auth_ToString(prose_context->l3_end)) == NULL) {
153
0
        ogs_error("OpenAPI_prose_context_convertToJSON() failed [l3_end]");
154
0
        goto end;
155
0
    }
156
0
    }
157
158
0
    if (prose_context->multi_path_comm != OpenAPI_ue_auth_NULL) {
159
0
    if (cJSON_AddStringToObject(item, "multiPathComm", OpenAPI_ue_auth_ToString(prose_context->multi_path_comm)) == NULL) {
160
0
        ogs_error("OpenAPI_prose_context_convertToJSON() failed [multi_path_comm]");
161
0
        goto end;
162
0
    }
163
0
    }
164
165
0
    if (prose_context->nr_ue_pc5_ambr) {
166
0
    if (cJSON_AddStringToObject(item, "nrUePc5Ambr", prose_context->nr_ue_pc5_ambr) == NULL) {
167
0
        ogs_error("OpenAPI_prose_context_convertToJSON() failed [nr_ue_pc5_ambr]");
168
0
        goto end;
169
0
    }
170
0
    }
171
172
0
    if (prose_context->pc5_qo_s_para) {
173
0
    cJSON *pc5_qo_s_para_local_JSON = OpenAPI_pc5_qo_s_para_convertToJSON(prose_context->pc5_qo_s_para);
174
0
    if (pc5_qo_s_para_local_JSON == NULL) {
175
0
        ogs_error("OpenAPI_prose_context_convertToJSON() failed [pc5_qo_s_para]");
176
0
        goto end;
177
0
    }
178
0
    cJSON_AddItemToObject(item, "pc5QoSPara", pc5_qo_s_para_local_JSON);
179
0
    if (item->child == NULL) {
180
0
        ogs_error("OpenAPI_prose_context_convertToJSON() failed [pc5_qo_s_para]");
181
0
        goto end;
182
0
    }
183
0
    }
184
185
0
    if (prose_context->l3_interm_relay != OpenAPI_ue_auth_NULL) {
186
0
    if (cJSON_AddStringToObject(item, "l3IntermRelay", OpenAPI_ue_auth_ToString(prose_context->l3_interm_relay)) == NULL) {
187
0
        ogs_error("OpenAPI_prose_context_convertToJSON() failed [l3_interm_relay]");
188
0
        goto end;
189
0
    }
190
0
    }
191
192
0
    if (prose_context->l3_multihop_remote != OpenAPI_ue_auth_NULL) {
193
0
    if (cJSON_AddStringToObject(item, "l3MultihopRemote", OpenAPI_ue_auth_ToString(prose_context->l3_multihop_remote)) == NULL) {
194
0
        ogs_error("OpenAPI_prose_context_convertToJSON() failed [l3_multihop_remote]");
195
0
        goto end;
196
0
    }
197
0
    }
198
199
0
    if (prose_context->l3_net_multihop_relay != OpenAPI_ue_auth_NULL) {
200
0
    if (cJSON_AddStringToObject(item, "l3NetMultihopRelay", OpenAPI_ue_auth_ToString(prose_context->l3_net_multihop_relay)) == NULL) {
201
0
        ogs_error("OpenAPI_prose_context_convertToJSON() failed [l3_net_multihop_relay]");
202
0
        goto end;
203
0
    }
204
0
    }
205
206
0
    if (prose_context->l3_ue_multihop_relay != OpenAPI_ue_auth_NULL) {
207
0
    if (cJSON_AddStringToObject(item, "l3UeMultihopRelay", OpenAPI_ue_auth_ToString(prose_context->l3_ue_multihop_relay)) == NULL) {
208
0
        ogs_error("OpenAPI_prose_context_convertToJSON() failed [l3_ue_multihop_relay]");
209
0
        goto end;
210
0
    }
211
0
    }
212
213
0
    if (prose_context->l3_end_multihop_relay != OpenAPI_ue_auth_NULL) {
214
0
    if (cJSON_AddStringToObject(item, "l3EndMultihopRelay", OpenAPI_ue_auth_ToString(prose_context->l3_end_multihop_relay)) == NULL) {
215
0
        ogs_error("OpenAPI_prose_context_convertToJSON() failed [l3_end_multihop_relay]");
216
0
        goto end;
217
0
    }
218
0
    }
219
220
0
    if (prose_context->l2_interm_relay != OpenAPI_ue_auth_NULL) {
221
0
    if (cJSON_AddStringToObject(item, "l2IntermRelay", OpenAPI_ue_auth_ToString(prose_context->l2_interm_relay)) == NULL) {
222
0
        ogs_error("OpenAPI_prose_context_convertToJSON() failed [l2_interm_relay]");
223
0
        goto end;
224
0
    }
225
0
    }
226
227
0
    if (prose_context->l2_multihop_remote != OpenAPI_ue_auth_NULL) {
228
0
    if (cJSON_AddStringToObject(item, "l2MultihopRemote", OpenAPI_ue_auth_ToString(prose_context->l2_multihop_remote)) == NULL) {
229
0
        ogs_error("OpenAPI_prose_context_convertToJSON() failed [l2_multihop_remote]");
230
0
        goto end;
231
0
    }
232
0
    }
233
234
0
    if (prose_context->l2_net_multihop_relay != OpenAPI_ue_auth_NULL) {
235
0
    if (cJSON_AddStringToObject(item, "l2NetMultihopRelay", OpenAPI_ue_auth_ToString(prose_context->l2_net_multihop_relay)) == NULL) {
236
0
        ogs_error("OpenAPI_prose_context_convertToJSON() failed [l2_net_multihop_relay]");
237
0
        goto end;
238
0
    }
239
0
    }
240
241
0
end:
242
0
    return item;
243
0
}
244
245
OpenAPI_prose_context_t *OpenAPI_prose_context_parseFromJSON(cJSON *prose_contextJSON)
246
0
{
247
0
    OpenAPI_prose_context_t *prose_context_local_var = NULL;
248
0
    OpenAPI_lnode_t *node = NULL;
249
0
    cJSON *direct_discovery = NULL;
250
0
    OpenAPI_ue_auth_e direct_discoveryVariable = 0;
251
0
    cJSON *direct_comm = NULL;
252
0
    OpenAPI_ue_auth_e direct_commVariable = 0;
253
0
    cJSON *l2_relay = NULL;
254
0
    OpenAPI_ue_auth_e l2_relayVariable = 0;
255
0
    cJSON *l3_relay = NULL;
256
0
    OpenAPI_ue_auth_e l3_relayVariable = 0;
257
0
    cJSON *l2_remote = NULL;
258
0
    OpenAPI_ue_auth_e l2_remoteVariable = 0;
259
0
    cJSON *l3_remote = NULL;
260
0
    OpenAPI_ue_auth_e l3_remoteVariable = 0;
261
0
    cJSON *l2_ue_relay = NULL;
262
0
    OpenAPI_ue_auth_e l2_ue_relayVariable = 0;
263
0
    cJSON *l3_ue_relay = NULL;
264
0
    OpenAPI_ue_auth_e l3_ue_relayVariable = 0;
265
0
    cJSON *l2_end = NULL;
266
0
    OpenAPI_ue_auth_e l2_endVariable = 0;
267
0
    cJSON *l3_end = NULL;
268
0
    OpenAPI_ue_auth_e l3_endVariable = 0;
269
0
    cJSON *multi_path_comm = NULL;
270
0
    OpenAPI_ue_auth_e multi_path_commVariable = 0;
271
0
    cJSON *nr_ue_pc5_ambr = NULL;
272
0
    cJSON *pc5_qo_s_para = NULL;
273
0
    OpenAPI_pc5_qo_s_para_t *pc5_qo_s_para_local_nonprim = NULL;
274
0
    cJSON *l3_interm_relay = NULL;
275
0
    OpenAPI_ue_auth_e l3_interm_relayVariable = 0;
276
0
    cJSON *l3_multihop_remote = NULL;
277
0
    OpenAPI_ue_auth_e l3_multihop_remoteVariable = 0;
278
0
    cJSON *l3_net_multihop_relay = NULL;
279
0
    OpenAPI_ue_auth_e l3_net_multihop_relayVariable = 0;
280
0
    cJSON *l3_ue_multihop_relay = NULL;
281
0
    OpenAPI_ue_auth_e l3_ue_multihop_relayVariable = 0;
282
0
    cJSON *l3_end_multihop_relay = NULL;
283
0
    OpenAPI_ue_auth_e l3_end_multihop_relayVariable = 0;
284
0
    cJSON *l2_interm_relay = NULL;
285
0
    OpenAPI_ue_auth_e l2_interm_relayVariable = 0;
286
0
    cJSON *l2_multihop_remote = NULL;
287
0
    OpenAPI_ue_auth_e l2_multihop_remoteVariable = 0;
288
0
    cJSON *l2_net_multihop_relay = NULL;
289
0
    OpenAPI_ue_auth_e l2_net_multihop_relayVariable = 0;
290
0
    direct_discovery = cJSON_GetObjectItemCaseSensitive(prose_contextJSON, "directDiscovery");
291
0
    if (direct_discovery) {
292
0
    if (!cJSON_IsString(direct_discovery)) {
293
0
        ogs_error("OpenAPI_prose_context_parseFromJSON() failed [direct_discovery]");
294
0
        goto end;
295
0
    }
296
0
    direct_discoveryVariable = OpenAPI_ue_auth_FromString(direct_discovery->valuestring);
297
0
    }
298
299
0
    direct_comm = cJSON_GetObjectItemCaseSensitive(prose_contextJSON, "directComm");
300
0
    if (direct_comm) {
301
0
    if (!cJSON_IsString(direct_comm)) {
302
0
        ogs_error("OpenAPI_prose_context_parseFromJSON() failed [direct_comm]");
303
0
        goto end;
304
0
    }
305
0
    direct_commVariable = OpenAPI_ue_auth_FromString(direct_comm->valuestring);
306
0
    }
307
308
0
    l2_relay = cJSON_GetObjectItemCaseSensitive(prose_contextJSON, "l2Relay");
309
0
    if (l2_relay) {
310
0
    if (!cJSON_IsString(l2_relay)) {
311
0
        ogs_error("OpenAPI_prose_context_parseFromJSON() failed [l2_relay]");
312
0
        goto end;
313
0
    }
314
0
    l2_relayVariable = OpenAPI_ue_auth_FromString(l2_relay->valuestring);
315
0
    }
316
317
0
    l3_relay = cJSON_GetObjectItemCaseSensitive(prose_contextJSON, "l3Relay");
318
0
    if (l3_relay) {
319
0
    if (!cJSON_IsString(l3_relay)) {
320
0
        ogs_error("OpenAPI_prose_context_parseFromJSON() failed [l3_relay]");
321
0
        goto end;
322
0
    }
323
0
    l3_relayVariable = OpenAPI_ue_auth_FromString(l3_relay->valuestring);
324
0
    }
325
326
0
    l2_remote = cJSON_GetObjectItemCaseSensitive(prose_contextJSON, "l2Remote");
327
0
    if (l2_remote) {
328
0
    if (!cJSON_IsString(l2_remote)) {
329
0
        ogs_error("OpenAPI_prose_context_parseFromJSON() failed [l2_remote]");
330
0
        goto end;
331
0
    }
332
0
    l2_remoteVariable = OpenAPI_ue_auth_FromString(l2_remote->valuestring);
333
0
    }
334
335
0
    l3_remote = cJSON_GetObjectItemCaseSensitive(prose_contextJSON, "l3Remote");
336
0
    if (l3_remote) {
337
0
    if (!cJSON_IsString(l3_remote)) {
338
0
        ogs_error("OpenAPI_prose_context_parseFromJSON() failed [l3_remote]");
339
0
        goto end;
340
0
    }
341
0
    l3_remoteVariable = OpenAPI_ue_auth_FromString(l3_remote->valuestring);
342
0
    }
343
344
0
    l2_ue_relay = cJSON_GetObjectItemCaseSensitive(prose_contextJSON, "l2UeRelay");
345
0
    if (l2_ue_relay) {
346
0
    if (!cJSON_IsString(l2_ue_relay)) {
347
0
        ogs_error("OpenAPI_prose_context_parseFromJSON() failed [l2_ue_relay]");
348
0
        goto end;
349
0
    }
350
0
    l2_ue_relayVariable = OpenAPI_ue_auth_FromString(l2_ue_relay->valuestring);
351
0
    }
352
353
0
    l3_ue_relay = cJSON_GetObjectItemCaseSensitive(prose_contextJSON, "l3UeRelay");
354
0
    if (l3_ue_relay) {
355
0
    if (!cJSON_IsString(l3_ue_relay)) {
356
0
        ogs_error("OpenAPI_prose_context_parseFromJSON() failed [l3_ue_relay]");
357
0
        goto end;
358
0
    }
359
0
    l3_ue_relayVariable = OpenAPI_ue_auth_FromString(l3_ue_relay->valuestring);
360
0
    }
361
362
0
    l2_end = cJSON_GetObjectItemCaseSensitive(prose_contextJSON, "l2End");
363
0
    if (l2_end) {
364
0
    if (!cJSON_IsString(l2_end)) {
365
0
        ogs_error("OpenAPI_prose_context_parseFromJSON() failed [l2_end]");
366
0
        goto end;
367
0
    }
368
0
    l2_endVariable = OpenAPI_ue_auth_FromString(l2_end->valuestring);
369
0
    }
370
371
0
    l3_end = cJSON_GetObjectItemCaseSensitive(prose_contextJSON, "l3End");
372
0
    if (l3_end) {
373
0
    if (!cJSON_IsString(l3_end)) {
374
0
        ogs_error("OpenAPI_prose_context_parseFromJSON() failed [l3_end]");
375
0
        goto end;
376
0
    }
377
0
    l3_endVariable = OpenAPI_ue_auth_FromString(l3_end->valuestring);
378
0
    }
379
380
0
    multi_path_comm = cJSON_GetObjectItemCaseSensitive(prose_contextJSON, "multiPathComm");
381
0
    if (multi_path_comm) {
382
0
    if (!cJSON_IsString(multi_path_comm)) {
383
0
        ogs_error("OpenAPI_prose_context_parseFromJSON() failed [multi_path_comm]");
384
0
        goto end;
385
0
    }
386
0
    multi_path_commVariable = OpenAPI_ue_auth_FromString(multi_path_comm->valuestring);
387
0
    }
388
389
0
    nr_ue_pc5_ambr = cJSON_GetObjectItemCaseSensitive(prose_contextJSON, "nrUePc5Ambr");
390
0
    if (nr_ue_pc5_ambr) {
391
0
    if (!cJSON_IsString(nr_ue_pc5_ambr) && !cJSON_IsNull(nr_ue_pc5_ambr)) {
392
0
        ogs_error("OpenAPI_prose_context_parseFromJSON() failed [nr_ue_pc5_ambr]");
393
0
        goto end;
394
0
    }
395
0
    }
396
397
0
    pc5_qo_s_para = cJSON_GetObjectItemCaseSensitive(prose_contextJSON, "pc5QoSPara");
398
0
    if (pc5_qo_s_para) {
399
0
    pc5_qo_s_para_local_nonprim = OpenAPI_pc5_qo_s_para_parseFromJSON(pc5_qo_s_para);
400
0
    if (!pc5_qo_s_para_local_nonprim) {
401
0
        ogs_error("OpenAPI_pc5_qo_s_para_parseFromJSON failed [pc5_qo_s_para]");
402
0
        goto end;
403
0
    }
404
0
    }
405
406
0
    l3_interm_relay = cJSON_GetObjectItemCaseSensitive(prose_contextJSON, "l3IntermRelay");
407
0
    if (l3_interm_relay) {
408
0
    if (!cJSON_IsString(l3_interm_relay)) {
409
0
        ogs_error("OpenAPI_prose_context_parseFromJSON() failed [l3_interm_relay]");
410
0
        goto end;
411
0
    }
412
0
    l3_interm_relayVariable = OpenAPI_ue_auth_FromString(l3_interm_relay->valuestring);
413
0
    }
414
415
0
    l3_multihop_remote = cJSON_GetObjectItemCaseSensitive(prose_contextJSON, "l3MultihopRemote");
416
0
    if (l3_multihop_remote) {
417
0
    if (!cJSON_IsString(l3_multihop_remote)) {
418
0
        ogs_error("OpenAPI_prose_context_parseFromJSON() failed [l3_multihop_remote]");
419
0
        goto end;
420
0
    }
421
0
    l3_multihop_remoteVariable = OpenAPI_ue_auth_FromString(l3_multihop_remote->valuestring);
422
0
    }
423
424
0
    l3_net_multihop_relay = cJSON_GetObjectItemCaseSensitive(prose_contextJSON, "l3NetMultihopRelay");
425
0
    if (l3_net_multihop_relay) {
426
0
    if (!cJSON_IsString(l3_net_multihop_relay)) {
427
0
        ogs_error("OpenAPI_prose_context_parseFromJSON() failed [l3_net_multihop_relay]");
428
0
        goto end;
429
0
    }
430
0
    l3_net_multihop_relayVariable = OpenAPI_ue_auth_FromString(l3_net_multihop_relay->valuestring);
431
0
    }
432
433
0
    l3_ue_multihop_relay = cJSON_GetObjectItemCaseSensitive(prose_contextJSON, "l3UeMultihopRelay");
434
0
    if (l3_ue_multihop_relay) {
435
0
    if (!cJSON_IsString(l3_ue_multihop_relay)) {
436
0
        ogs_error("OpenAPI_prose_context_parseFromJSON() failed [l3_ue_multihop_relay]");
437
0
        goto end;
438
0
    }
439
0
    l3_ue_multihop_relayVariable = OpenAPI_ue_auth_FromString(l3_ue_multihop_relay->valuestring);
440
0
    }
441
442
0
    l3_end_multihop_relay = cJSON_GetObjectItemCaseSensitive(prose_contextJSON, "l3EndMultihopRelay");
443
0
    if (l3_end_multihop_relay) {
444
0
    if (!cJSON_IsString(l3_end_multihop_relay)) {
445
0
        ogs_error("OpenAPI_prose_context_parseFromJSON() failed [l3_end_multihop_relay]");
446
0
        goto end;
447
0
    }
448
0
    l3_end_multihop_relayVariable = OpenAPI_ue_auth_FromString(l3_end_multihop_relay->valuestring);
449
0
    }
450
451
0
    l2_interm_relay = cJSON_GetObjectItemCaseSensitive(prose_contextJSON, "l2IntermRelay");
452
0
    if (l2_interm_relay) {
453
0
    if (!cJSON_IsString(l2_interm_relay)) {
454
0
        ogs_error("OpenAPI_prose_context_parseFromJSON() failed [l2_interm_relay]");
455
0
        goto end;
456
0
    }
457
0
    l2_interm_relayVariable = OpenAPI_ue_auth_FromString(l2_interm_relay->valuestring);
458
0
    }
459
460
0
    l2_multihop_remote = cJSON_GetObjectItemCaseSensitive(prose_contextJSON, "l2MultihopRemote");
461
0
    if (l2_multihop_remote) {
462
0
    if (!cJSON_IsString(l2_multihop_remote)) {
463
0
        ogs_error("OpenAPI_prose_context_parseFromJSON() failed [l2_multihop_remote]");
464
0
        goto end;
465
0
    }
466
0
    l2_multihop_remoteVariable = OpenAPI_ue_auth_FromString(l2_multihop_remote->valuestring);
467
0
    }
468
469
0
    l2_net_multihop_relay = cJSON_GetObjectItemCaseSensitive(prose_contextJSON, "l2NetMultihopRelay");
470
0
    if (l2_net_multihop_relay) {
471
0
    if (!cJSON_IsString(l2_net_multihop_relay)) {
472
0
        ogs_error("OpenAPI_prose_context_parseFromJSON() failed [l2_net_multihop_relay]");
473
0
        goto end;
474
0
    }
475
0
    l2_net_multihop_relayVariable = OpenAPI_ue_auth_FromString(l2_net_multihop_relay->valuestring);
476
0
    }
477
478
0
    prose_context_local_var = OpenAPI_prose_context_create (
479
0
        direct_discovery ? direct_discoveryVariable : 0,
480
0
        direct_comm ? direct_commVariable : 0,
481
0
        l2_relay ? l2_relayVariable : 0,
482
0
        l3_relay ? l3_relayVariable : 0,
483
0
        l2_remote ? l2_remoteVariable : 0,
484
0
        l3_remote ? l3_remoteVariable : 0,
485
0
        l2_ue_relay ? l2_ue_relayVariable : 0,
486
0
        l3_ue_relay ? l3_ue_relayVariable : 0,
487
0
        l2_end ? l2_endVariable : 0,
488
0
        l3_end ? l3_endVariable : 0,
489
0
        multi_path_comm ? multi_path_commVariable : 0,
490
0
        nr_ue_pc5_ambr && !cJSON_IsNull(nr_ue_pc5_ambr) ? ogs_strdup(nr_ue_pc5_ambr->valuestring) : NULL,
491
0
        pc5_qo_s_para ? pc5_qo_s_para_local_nonprim : NULL,
492
0
        l3_interm_relay ? l3_interm_relayVariable : 0,
493
0
        l3_multihop_remote ? l3_multihop_remoteVariable : 0,
494
0
        l3_net_multihop_relay ? l3_net_multihop_relayVariable : 0,
495
0
        l3_ue_multihop_relay ? l3_ue_multihop_relayVariable : 0,
496
0
        l3_end_multihop_relay ? l3_end_multihop_relayVariable : 0,
497
0
        l2_interm_relay ? l2_interm_relayVariable : 0,
498
0
        l2_multihop_remote ? l2_multihop_remoteVariable : 0,
499
0
        l2_net_multihop_relay ? l2_net_multihop_relayVariable : 0
500
0
    );
501
502
0
    return prose_context_local_var;
503
0
end:
504
0
    if (pc5_qo_s_para_local_nonprim) {
505
0
        OpenAPI_pc5_qo_s_para_free(pc5_qo_s_para_local_nonprim);
506
0
        pc5_qo_s_para_local_nonprim = NULL;
507
0
    }
508
0
    return NULL;
509
0
}
510
511
OpenAPI_prose_context_t *OpenAPI_prose_context_copy(OpenAPI_prose_context_t *dst, OpenAPI_prose_context_t *src)
512
0
{
513
0
    cJSON *item = NULL;
514
0
    char *content = NULL;
515
516
0
    ogs_assert(src);
517
0
    item = OpenAPI_prose_context_convertToJSON(src);
518
0
    if (!item) {
519
0
        ogs_error("OpenAPI_prose_context_convertToJSON() failed");
520
0
        return NULL;
521
0
    }
522
523
0
    content = cJSON_Print(item);
524
0
    cJSON_Delete(item);
525
526
0
    if (!content) {
527
0
        ogs_error("cJSON_Print() failed");
528
0
        return NULL;
529
0
    }
530
531
0
    item = cJSON_Parse(content);
532
0
    ogs_free(content);
533
0
    if (!item) {
534
0
        ogs_error("cJSON_Parse() failed");
535
0
        return NULL;
536
0
    }
537
538
0
    OpenAPI_prose_context_free(dst);
539
0
    dst = OpenAPI_prose_context_parseFromJSON(item);
540
0
    cJSON_Delete(item);
541
542
0
    return dst;
543
0
}
544