/src/open5gs/lib/sbi/openapi/model/subscr_cond.c
Line | Count | Source |
1 | | |
2 | | #include <stdlib.h> |
3 | | #include <string.h> |
4 | | #include <stdio.h> |
5 | | #include "subscr_cond.h" |
6 | | |
7 | | char *OpenAPI_condition_typesubscr_cond_ToString(OpenAPI_subscr_cond_condition_type_e condition_type) |
8 | 0 | { |
9 | 0 | const char *condition_typeArray[] = { "NULL", "SERVICE_NAME_LIST_COND" }; |
10 | 0 | size_t sizeofArray = sizeof(condition_typeArray) / sizeof(condition_typeArray[0]); |
11 | 0 | if (condition_type < sizeofArray) |
12 | 0 | return (char *)condition_typeArray[condition_type]; |
13 | 0 | else |
14 | 0 | return (char *)"Unknown"; |
15 | 0 | } |
16 | | |
17 | | OpenAPI_subscr_cond_condition_type_e OpenAPI_condition_typesubscr_cond_FromString(char* condition_type) |
18 | 0 | { |
19 | 0 | int stringToReturn = 0; |
20 | 0 | const char *condition_typeArray[] = { "NULL", "SERVICE_NAME_LIST_COND" }; |
21 | 0 | size_t sizeofArray = sizeof(condition_typeArray) / sizeof(condition_typeArray[0]); |
22 | 0 | while (stringToReturn < sizeofArray) { |
23 | 0 | if (strcmp(condition_type, condition_typeArray[stringToReturn]) == 0) { |
24 | 0 | return stringToReturn; |
25 | 0 | } |
26 | 0 | stringToReturn++; |
27 | 0 | } |
28 | 0 | return 0; |
29 | 0 | } |
30 | | OpenAPI_subscr_cond_t *OpenAPI_subscr_cond_create( |
31 | | char *nf_instance_id, |
32 | | OpenAPI_list_t *nf_instance_id_list, |
33 | | OpenAPI_nf_type_e nf_type, |
34 | | OpenAPI_service_name_e service_name, |
35 | | OpenAPI_subscr_cond_condition_type_e condition_type, |
36 | | OpenAPI_list_t *service_name_list, |
37 | | char *amf_set_id, |
38 | | char *amf_region_id, |
39 | | OpenAPI_list_t *guami_list, |
40 | | OpenAPI_list_t *snssai_list, |
41 | | OpenAPI_list_t *nsi_list, |
42 | | char *nf_group_id, |
43 | | OpenAPI_list_t *nf_group_id_list, |
44 | | char *nf_set_id, |
45 | | char *nf_service_set_id, |
46 | | OpenAPI_list_t *smf_serving_area, |
47 | | OpenAPI_list_t *tai_list, |
48 | | OpenAPI_list_t *scp_domains, |
49 | | OpenAPI_list_t *nf_type_list, |
50 | | OpenAPI_list_t *analytics_ids, |
51 | | OpenAPI_list_t *tai_range_list, |
52 | | OpenAPI_list_t *serving_nf_type_list, |
53 | | OpenAPI_list_t *serving_nf_set_id_list, |
54 | | OpenAPI_list_t *ml_analytics_list, |
55 | | OpenAPI_list_t *af_events, |
56 | | OpenAPI_pfd_data_t *pfd_data, |
57 | | OpenAPI_list_t *gpsi_ranges, |
58 | | OpenAPI_list_t *external_group_identifiers_ranges, |
59 | | OpenAPI_list_t *served_fqdn_list |
60 | | ) |
61 | 0 | { |
62 | 0 | OpenAPI_subscr_cond_t *subscr_cond_local_var = ogs_malloc(sizeof(OpenAPI_subscr_cond_t)); |
63 | 0 | ogs_assert(subscr_cond_local_var); |
64 | | |
65 | 0 | subscr_cond_local_var->nf_instance_id = nf_instance_id; |
66 | 0 | subscr_cond_local_var->nf_instance_id_list = nf_instance_id_list; |
67 | 0 | subscr_cond_local_var->nf_type = nf_type; |
68 | 0 | subscr_cond_local_var->service_name = service_name; |
69 | 0 | subscr_cond_local_var->condition_type = condition_type; |
70 | 0 | subscr_cond_local_var->service_name_list = service_name_list; |
71 | 0 | subscr_cond_local_var->amf_set_id = amf_set_id; |
72 | 0 | subscr_cond_local_var->amf_region_id = amf_region_id; |
73 | 0 | subscr_cond_local_var->guami_list = guami_list; |
74 | 0 | subscr_cond_local_var->snssai_list = snssai_list; |
75 | 0 | subscr_cond_local_var->nsi_list = nsi_list; |
76 | 0 | subscr_cond_local_var->nf_group_id = nf_group_id; |
77 | 0 | subscr_cond_local_var->nf_group_id_list = nf_group_id_list; |
78 | 0 | subscr_cond_local_var->nf_set_id = nf_set_id; |
79 | 0 | subscr_cond_local_var->nf_service_set_id = nf_service_set_id; |
80 | 0 | subscr_cond_local_var->smf_serving_area = smf_serving_area; |
81 | 0 | subscr_cond_local_var->tai_list = tai_list; |
82 | 0 | subscr_cond_local_var->scp_domains = scp_domains; |
83 | 0 | subscr_cond_local_var->nf_type_list = nf_type_list; |
84 | 0 | subscr_cond_local_var->analytics_ids = analytics_ids; |
85 | 0 | subscr_cond_local_var->tai_range_list = tai_range_list; |
86 | 0 | subscr_cond_local_var->serving_nf_type_list = serving_nf_type_list; |
87 | 0 | subscr_cond_local_var->serving_nf_set_id_list = serving_nf_set_id_list; |
88 | 0 | subscr_cond_local_var->ml_analytics_list = ml_analytics_list; |
89 | 0 | subscr_cond_local_var->af_events = af_events; |
90 | 0 | subscr_cond_local_var->pfd_data = pfd_data; |
91 | 0 | subscr_cond_local_var->gpsi_ranges = gpsi_ranges; |
92 | 0 | subscr_cond_local_var->external_group_identifiers_ranges = external_group_identifiers_ranges; |
93 | 0 | subscr_cond_local_var->served_fqdn_list = served_fqdn_list; |
94 | |
|
95 | 0 | return subscr_cond_local_var; |
96 | 0 | } |
97 | | |
98 | | void OpenAPI_subscr_cond_free(OpenAPI_subscr_cond_t *subscr_cond) |
99 | 0 | { |
100 | 0 | OpenAPI_lnode_t *node = NULL; |
101 | |
|
102 | 0 | if (NULL == subscr_cond) { |
103 | 0 | return; |
104 | 0 | } |
105 | 0 | if (subscr_cond->nf_instance_id) { |
106 | 0 | ogs_free(subscr_cond->nf_instance_id); |
107 | 0 | subscr_cond->nf_instance_id = NULL; |
108 | 0 | } |
109 | 0 | if (subscr_cond->nf_instance_id_list) { |
110 | 0 | OpenAPI_list_for_each(subscr_cond->nf_instance_id_list, node) { |
111 | 0 | ogs_free(node->data); |
112 | 0 | } |
113 | 0 | OpenAPI_list_free(subscr_cond->nf_instance_id_list); |
114 | 0 | subscr_cond->nf_instance_id_list = NULL; |
115 | 0 | } |
116 | 0 | if (subscr_cond->service_name_list) { |
117 | 0 | OpenAPI_list_free(subscr_cond->service_name_list); |
118 | 0 | subscr_cond->service_name_list = NULL; |
119 | 0 | } |
120 | 0 | if (subscr_cond->amf_set_id) { |
121 | 0 | ogs_free(subscr_cond->amf_set_id); |
122 | 0 | subscr_cond->amf_set_id = NULL; |
123 | 0 | } |
124 | 0 | if (subscr_cond->amf_region_id) { |
125 | 0 | ogs_free(subscr_cond->amf_region_id); |
126 | 0 | subscr_cond->amf_region_id = NULL; |
127 | 0 | } |
128 | 0 | if (subscr_cond->guami_list) { |
129 | 0 | OpenAPI_list_for_each(subscr_cond->guami_list, node) { |
130 | 0 | OpenAPI_guami_free(node->data); |
131 | 0 | } |
132 | 0 | OpenAPI_list_free(subscr_cond->guami_list); |
133 | 0 | subscr_cond->guami_list = NULL; |
134 | 0 | } |
135 | 0 | if (subscr_cond->snssai_list) { |
136 | 0 | OpenAPI_list_for_each(subscr_cond->snssai_list, node) { |
137 | 0 | OpenAPI_snssai_free(node->data); |
138 | 0 | } |
139 | 0 | OpenAPI_list_free(subscr_cond->snssai_list); |
140 | 0 | subscr_cond->snssai_list = NULL; |
141 | 0 | } |
142 | 0 | if (subscr_cond->nsi_list) { |
143 | 0 | OpenAPI_list_for_each(subscr_cond->nsi_list, node) { |
144 | 0 | ogs_free(node->data); |
145 | 0 | } |
146 | 0 | OpenAPI_list_free(subscr_cond->nsi_list); |
147 | 0 | subscr_cond->nsi_list = NULL; |
148 | 0 | } |
149 | 0 | if (subscr_cond->nf_group_id) { |
150 | 0 | ogs_free(subscr_cond->nf_group_id); |
151 | 0 | subscr_cond->nf_group_id = NULL; |
152 | 0 | } |
153 | 0 | if (subscr_cond->nf_group_id_list) { |
154 | 0 | OpenAPI_list_for_each(subscr_cond->nf_group_id_list, node) { |
155 | 0 | ogs_free(node->data); |
156 | 0 | } |
157 | 0 | OpenAPI_list_free(subscr_cond->nf_group_id_list); |
158 | 0 | subscr_cond->nf_group_id_list = NULL; |
159 | 0 | } |
160 | 0 | if (subscr_cond->nf_set_id) { |
161 | 0 | ogs_free(subscr_cond->nf_set_id); |
162 | 0 | subscr_cond->nf_set_id = NULL; |
163 | 0 | } |
164 | 0 | if (subscr_cond->nf_service_set_id) { |
165 | 0 | ogs_free(subscr_cond->nf_service_set_id); |
166 | 0 | subscr_cond->nf_service_set_id = NULL; |
167 | 0 | } |
168 | 0 | if (subscr_cond->smf_serving_area) { |
169 | 0 | OpenAPI_list_for_each(subscr_cond->smf_serving_area, node) { |
170 | 0 | ogs_free(node->data); |
171 | 0 | } |
172 | 0 | OpenAPI_list_free(subscr_cond->smf_serving_area); |
173 | 0 | subscr_cond->smf_serving_area = NULL; |
174 | 0 | } |
175 | 0 | if (subscr_cond->tai_list) { |
176 | 0 | OpenAPI_list_for_each(subscr_cond->tai_list, node) { |
177 | 0 | OpenAPI_tai_free(node->data); |
178 | 0 | } |
179 | 0 | OpenAPI_list_free(subscr_cond->tai_list); |
180 | 0 | subscr_cond->tai_list = NULL; |
181 | 0 | } |
182 | 0 | if (subscr_cond->scp_domains) { |
183 | 0 | OpenAPI_list_for_each(subscr_cond->scp_domains, node) { |
184 | 0 | ogs_free(node->data); |
185 | 0 | } |
186 | 0 | OpenAPI_list_free(subscr_cond->scp_domains); |
187 | 0 | subscr_cond->scp_domains = NULL; |
188 | 0 | } |
189 | 0 | if (subscr_cond->nf_type_list) { |
190 | 0 | OpenAPI_list_free(subscr_cond->nf_type_list); |
191 | 0 | subscr_cond->nf_type_list = NULL; |
192 | 0 | } |
193 | 0 | if (subscr_cond->analytics_ids) { |
194 | 0 | OpenAPI_list_for_each(subscr_cond->analytics_ids, node) { |
195 | 0 | ogs_free(node->data); |
196 | 0 | } |
197 | 0 | OpenAPI_list_free(subscr_cond->analytics_ids); |
198 | 0 | subscr_cond->analytics_ids = NULL; |
199 | 0 | } |
200 | 0 | if (subscr_cond->tai_range_list) { |
201 | 0 | OpenAPI_list_for_each(subscr_cond->tai_range_list, node) { |
202 | 0 | OpenAPI_tai_range_free(node->data); |
203 | 0 | } |
204 | 0 | OpenAPI_list_free(subscr_cond->tai_range_list); |
205 | 0 | subscr_cond->tai_range_list = NULL; |
206 | 0 | } |
207 | 0 | if (subscr_cond->serving_nf_type_list) { |
208 | 0 | OpenAPI_list_free(subscr_cond->serving_nf_type_list); |
209 | 0 | subscr_cond->serving_nf_type_list = NULL; |
210 | 0 | } |
211 | 0 | if (subscr_cond->serving_nf_set_id_list) { |
212 | 0 | OpenAPI_list_for_each(subscr_cond->serving_nf_set_id_list, node) { |
213 | 0 | ogs_free(node->data); |
214 | 0 | } |
215 | 0 | OpenAPI_list_free(subscr_cond->serving_nf_set_id_list); |
216 | 0 | subscr_cond->serving_nf_set_id_list = NULL; |
217 | 0 | } |
218 | 0 | if (subscr_cond->ml_analytics_list) { |
219 | 0 | OpenAPI_list_for_each(subscr_cond->ml_analytics_list, node) { |
220 | 0 | OpenAPI_ml_analytics_info_free(node->data); |
221 | 0 | } |
222 | 0 | OpenAPI_list_free(subscr_cond->ml_analytics_list); |
223 | 0 | subscr_cond->ml_analytics_list = NULL; |
224 | 0 | } |
225 | 0 | if (subscr_cond->af_events) { |
226 | 0 | OpenAPI_list_free(subscr_cond->af_events); |
227 | 0 | subscr_cond->af_events = NULL; |
228 | 0 | } |
229 | 0 | if (subscr_cond->pfd_data) { |
230 | 0 | OpenAPI_pfd_data_free(subscr_cond->pfd_data); |
231 | 0 | subscr_cond->pfd_data = NULL; |
232 | 0 | } |
233 | 0 | if (subscr_cond->gpsi_ranges) { |
234 | 0 | OpenAPI_list_for_each(subscr_cond->gpsi_ranges, node) { |
235 | 0 | OpenAPI_identity_range_free(node->data); |
236 | 0 | } |
237 | 0 | OpenAPI_list_free(subscr_cond->gpsi_ranges); |
238 | 0 | subscr_cond->gpsi_ranges = NULL; |
239 | 0 | } |
240 | 0 | if (subscr_cond->external_group_identifiers_ranges) { |
241 | 0 | OpenAPI_list_for_each(subscr_cond->external_group_identifiers_ranges, node) { |
242 | 0 | OpenAPI_identity_range_free(node->data); |
243 | 0 | } |
244 | 0 | OpenAPI_list_free(subscr_cond->external_group_identifiers_ranges); |
245 | 0 | subscr_cond->external_group_identifiers_ranges = NULL; |
246 | 0 | } |
247 | 0 | if (subscr_cond->served_fqdn_list) { |
248 | 0 | OpenAPI_list_for_each(subscr_cond->served_fqdn_list, node) { |
249 | 0 | ogs_free(node->data); |
250 | 0 | } |
251 | 0 | OpenAPI_list_free(subscr_cond->served_fqdn_list); |
252 | 0 | subscr_cond->served_fqdn_list = NULL; |
253 | 0 | } |
254 | 0 | ogs_free(subscr_cond); |
255 | 0 | } |
256 | | |
257 | | cJSON *OpenAPI_subscr_cond_convertToJSON(OpenAPI_subscr_cond_t *subscr_cond) |
258 | 0 | { |
259 | 0 | cJSON *item = NULL; |
260 | 0 | OpenAPI_lnode_t *node = NULL; |
261 | |
|
262 | 0 | if (subscr_cond == NULL) { |
263 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [SubscrCond]"); |
264 | 0 | return NULL; |
265 | 0 | } |
266 | | |
267 | 0 | item = cJSON_CreateObject(); |
268 | 0 | if (subscr_cond->nf_instance_id) { |
269 | 0 | if (cJSON_AddStringToObject(item, "nfInstanceId", subscr_cond->nf_instance_id) == NULL) { |
270 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [nf_instance_id]"); |
271 | 0 | goto end; |
272 | 0 | } |
273 | 0 | } |
274 | | |
275 | 0 | if (subscr_cond->nf_instance_id_list) { |
276 | 0 | cJSON *nf_instance_id_listList = cJSON_AddArrayToObject(item, "nfInstanceIdList"); |
277 | 0 | if (nf_instance_id_listList == NULL) { |
278 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [nf_instance_id_list]"); |
279 | 0 | goto end; |
280 | 0 | } |
281 | 0 | OpenAPI_list_for_each(subscr_cond->nf_instance_id_list, node) { |
282 | 0 | if (cJSON_AddStringToObject(nf_instance_id_listList, "", (char*)node->data) == NULL) { |
283 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [nf_instance_id_list]"); |
284 | 0 | goto end; |
285 | 0 | } |
286 | 0 | } |
287 | 0 | } |
288 | | |
289 | 0 | if (subscr_cond->nf_type != OpenAPI_nf_type_NULL) { |
290 | 0 | if (cJSON_AddStringToObject(item, "nfType", OpenAPI_nf_type_ToString(subscr_cond->nf_type)) == NULL) { |
291 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [nf_type]"); |
292 | 0 | goto end; |
293 | 0 | } |
294 | 0 | } |
295 | | |
296 | 0 | if (subscr_cond->service_name != OpenAPI_service_name_NULL) { |
297 | 0 | if (cJSON_AddStringToObject(item, "serviceName", OpenAPI_service_name_ToString(subscr_cond->service_name)) == NULL) { |
298 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [service_name]"); |
299 | 0 | goto end; |
300 | 0 | } |
301 | 0 | } |
302 | | |
303 | 0 | if (subscr_cond->condition_type != OpenAPI_subscr_cond_CONDITIONTYPE_NULL) { |
304 | 0 | if (cJSON_AddStringToObject(item, "conditionType", OpenAPI_condition_typesubscr_cond_ToString(subscr_cond->condition_type)) == NULL) { |
305 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [condition_type]"); |
306 | 0 | goto end; |
307 | 0 | } |
308 | 0 | } |
309 | | |
310 | 0 | if (subscr_cond->service_name_list != OpenAPI_service_name_NULL) { |
311 | 0 | cJSON *service_name_listList = cJSON_AddArrayToObject(item, "serviceNameList"); |
312 | 0 | if (service_name_listList == NULL) { |
313 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [service_name_list]"); |
314 | 0 | goto end; |
315 | 0 | } |
316 | 0 | OpenAPI_list_for_each(subscr_cond->service_name_list, node) { |
317 | 0 | if (cJSON_AddStringToObject(service_name_listList, "", OpenAPI_service_name_ToString((intptr_t)node->data)) == NULL) { |
318 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [service_name_list]"); |
319 | 0 | goto end; |
320 | 0 | } |
321 | 0 | } |
322 | 0 | } |
323 | | |
324 | 0 | if (subscr_cond->amf_set_id) { |
325 | 0 | if (cJSON_AddStringToObject(item, "amfSetId", subscr_cond->amf_set_id) == NULL) { |
326 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [amf_set_id]"); |
327 | 0 | goto end; |
328 | 0 | } |
329 | 0 | } |
330 | | |
331 | 0 | if (subscr_cond->amf_region_id) { |
332 | 0 | if (cJSON_AddStringToObject(item, "amfRegionId", subscr_cond->amf_region_id) == NULL) { |
333 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [amf_region_id]"); |
334 | 0 | goto end; |
335 | 0 | } |
336 | 0 | } |
337 | | |
338 | 0 | if (subscr_cond->guami_list) { |
339 | 0 | cJSON *guami_listList = cJSON_AddArrayToObject(item, "guamiList"); |
340 | 0 | if (guami_listList == NULL) { |
341 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [guami_list]"); |
342 | 0 | goto end; |
343 | 0 | } |
344 | 0 | OpenAPI_list_for_each(subscr_cond->guami_list, node) { |
345 | 0 | cJSON *itemLocal = OpenAPI_guami_convertToJSON(node->data); |
346 | 0 | if (itemLocal == NULL) { |
347 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [guami_list]"); |
348 | 0 | goto end; |
349 | 0 | } |
350 | 0 | cJSON_AddItemToArray(guami_listList, itemLocal); |
351 | 0 | } |
352 | 0 | } |
353 | | |
354 | 0 | if (subscr_cond->snssai_list) { |
355 | 0 | cJSON *snssai_listList = cJSON_AddArrayToObject(item, "snssaiList"); |
356 | 0 | if (snssai_listList == NULL) { |
357 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [snssai_list]"); |
358 | 0 | goto end; |
359 | 0 | } |
360 | 0 | OpenAPI_list_for_each(subscr_cond->snssai_list, node) { |
361 | 0 | cJSON *itemLocal = OpenAPI_snssai_convertToJSON(node->data); |
362 | 0 | if (itemLocal == NULL) { |
363 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [snssai_list]"); |
364 | 0 | goto end; |
365 | 0 | } |
366 | 0 | cJSON_AddItemToArray(snssai_listList, itemLocal); |
367 | 0 | } |
368 | 0 | } |
369 | | |
370 | 0 | if (subscr_cond->nsi_list) { |
371 | 0 | cJSON *nsi_listList = cJSON_AddArrayToObject(item, "nsiList"); |
372 | 0 | if (nsi_listList == NULL) { |
373 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [nsi_list]"); |
374 | 0 | goto end; |
375 | 0 | } |
376 | 0 | OpenAPI_list_for_each(subscr_cond->nsi_list, node) { |
377 | 0 | if (cJSON_AddStringToObject(nsi_listList, "", (char*)node->data) == NULL) { |
378 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [nsi_list]"); |
379 | 0 | goto end; |
380 | 0 | } |
381 | 0 | } |
382 | 0 | } |
383 | | |
384 | 0 | if (subscr_cond->nf_group_id) { |
385 | 0 | if (cJSON_AddStringToObject(item, "nfGroupId", subscr_cond->nf_group_id) == NULL) { |
386 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [nf_group_id]"); |
387 | 0 | goto end; |
388 | 0 | } |
389 | 0 | } |
390 | | |
391 | 0 | if (subscr_cond->nf_group_id_list) { |
392 | 0 | cJSON *nf_group_id_listList = cJSON_AddArrayToObject(item, "nfGroupIdList"); |
393 | 0 | if (nf_group_id_listList == NULL) { |
394 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [nf_group_id_list]"); |
395 | 0 | goto end; |
396 | 0 | } |
397 | 0 | OpenAPI_list_for_each(subscr_cond->nf_group_id_list, node) { |
398 | 0 | if (cJSON_AddStringToObject(nf_group_id_listList, "", (char*)node->data) == NULL) { |
399 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [nf_group_id_list]"); |
400 | 0 | goto end; |
401 | 0 | } |
402 | 0 | } |
403 | 0 | } |
404 | | |
405 | 0 | if (subscr_cond->nf_set_id) { |
406 | 0 | if (cJSON_AddStringToObject(item, "nfSetId", subscr_cond->nf_set_id) == NULL) { |
407 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [nf_set_id]"); |
408 | 0 | goto end; |
409 | 0 | } |
410 | 0 | } |
411 | | |
412 | 0 | if (subscr_cond->nf_service_set_id) { |
413 | 0 | if (cJSON_AddStringToObject(item, "nfServiceSetId", subscr_cond->nf_service_set_id) == NULL) { |
414 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [nf_service_set_id]"); |
415 | 0 | goto end; |
416 | 0 | } |
417 | 0 | } |
418 | | |
419 | 0 | if (subscr_cond->smf_serving_area) { |
420 | 0 | cJSON *smf_serving_areaList = cJSON_AddArrayToObject(item, "smfServingArea"); |
421 | 0 | if (smf_serving_areaList == NULL) { |
422 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [smf_serving_area]"); |
423 | 0 | goto end; |
424 | 0 | } |
425 | 0 | OpenAPI_list_for_each(subscr_cond->smf_serving_area, node) { |
426 | 0 | if (cJSON_AddStringToObject(smf_serving_areaList, "", (char*)node->data) == NULL) { |
427 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [smf_serving_area]"); |
428 | 0 | goto end; |
429 | 0 | } |
430 | 0 | } |
431 | 0 | } |
432 | | |
433 | 0 | if (subscr_cond->tai_list) { |
434 | 0 | cJSON *tai_listList = cJSON_AddArrayToObject(item, "taiList"); |
435 | 0 | if (tai_listList == NULL) { |
436 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [tai_list]"); |
437 | 0 | goto end; |
438 | 0 | } |
439 | 0 | OpenAPI_list_for_each(subscr_cond->tai_list, node) { |
440 | 0 | cJSON *itemLocal = OpenAPI_tai_convertToJSON(node->data); |
441 | 0 | if (itemLocal == NULL) { |
442 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [tai_list]"); |
443 | 0 | goto end; |
444 | 0 | } |
445 | 0 | cJSON_AddItemToArray(tai_listList, itemLocal); |
446 | 0 | } |
447 | 0 | } |
448 | | |
449 | 0 | if (subscr_cond->scp_domains) { |
450 | 0 | cJSON *scp_domainsList = cJSON_AddArrayToObject(item, "scpDomains"); |
451 | 0 | if (scp_domainsList == NULL) { |
452 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [scp_domains]"); |
453 | 0 | goto end; |
454 | 0 | } |
455 | 0 | OpenAPI_list_for_each(subscr_cond->scp_domains, node) { |
456 | 0 | if (cJSON_AddStringToObject(scp_domainsList, "", (char*)node->data) == NULL) { |
457 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [scp_domains]"); |
458 | 0 | goto end; |
459 | 0 | } |
460 | 0 | } |
461 | 0 | } |
462 | | |
463 | 0 | if (subscr_cond->nf_type_list != OpenAPI_nf_type_NULL) { |
464 | 0 | cJSON *nf_type_listList = cJSON_AddArrayToObject(item, "nfTypeList"); |
465 | 0 | if (nf_type_listList == NULL) { |
466 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [nf_type_list]"); |
467 | 0 | goto end; |
468 | 0 | } |
469 | 0 | OpenAPI_list_for_each(subscr_cond->nf_type_list, node) { |
470 | 0 | if (cJSON_AddStringToObject(nf_type_listList, "", OpenAPI_nf_type_ToString((intptr_t)node->data)) == NULL) { |
471 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [nf_type_list]"); |
472 | 0 | goto end; |
473 | 0 | } |
474 | 0 | } |
475 | 0 | } |
476 | | |
477 | 0 | if (subscr_cond->analytics_ids) { |
478 | 0 | cJSON *analytics_idsList = cJSON_AddArrayToObject(item, "analyticsIds"); |
479 | 0 | if (analytics_idsList == NULL) { |
480 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [analytics_ids]"); |
481 | 0 | goto end; |
482 | 0 | } |
483 | 0 | OpenAPI_list_for_each(subscr_cond->analytics_ids, node) { |
484 | 0 | if (cJSON_AddStringToObject(analytics_idsList, "", (char*)node->data) == NULL) { |
485 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [analytics_ids]"); |
486 | 0 | goto end; |
487 | 0 | } |
488 | 0 | } |
489 | 0 | } |
490 | | |
491 | 0 | if (subscr_cond->tai_range_list) { |
492 | 0 | cJSON *tai_range_listList = cJSON_AddArrayToObject(item, "taiRangeList"); |
493 | 0 | if (tai_range_listList == NULL) { |
494 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [tai_range_list]"); |
495 | 0 | goto end; |
496 | 0 | } |
497 | 0 | OpenAPI_list_for_each(subscr_cond->tai_range_list, node) { |
498 | 0 | cJSON *itemLocal = OpenAPI_tai_range_convertToJSON(node->data); |
499 | 0 | if (itemLocal == NULL) { |
500 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [tai_range_list]"); |
501 | 0 | goto end; |
502 | 0 | } |
503 | 0 | cJSON_AddItemToArray(tai_range_listList, itemLocal); |
504 | 0 | } |
505 | 0 | } |
506 | | |
507 | 0 | if (subscr_cond->serving_nf_type_list != OpenAPI_nf_type_NULL) { |
508 | 0 | cJSON *serving_nf_type_listList = cJSON_AddArrayToObject(item, "servingNfTypeList"); |
509 | 0 | if (serving_nf_type_listList == NULL) { |
510 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [serving_nf_type_list]"); |
511 | 0 | goto end; |
512 | 0 | } |
513 | 0 | OpenAPI_list_for_each(subscr_cond->serving_nf_type_list, node) { |
514 | 0 | if (cJSON_AddStringToObject(serving_nf_type_listList, "", OpenAPI_nf_type_ToString((intptr_t)node->data)) == NULL) { |
515 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [serving_nf_type_list]"); |
516 | 0 | goto end; |
517 | 0 | } |
518 | 0 | } |
519 | 0 | } |
520 | | |
521 | 0 | if (subscr_cond->serving_nf_set_id_list) { |
522 | 0 | cJSON *serving_nf_set_id_listList = cJSON_AddArrayToObject(item, "servingNfSetIdList"); |
523 | 0 | if (serving_nf_set_id_listList == NULL) { |
524 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [serving_nf_set_id_list]"); |
525 | 0 | goto end; |
526 | 0 | } |
527 | 0 | OpenAPI_list_for_each(subscr_cond->serving_nf_set_id_list, node) { |
528 | 0 | if (cJSON_AddStringToObject(serving_nf_set_id_listList, "", (char*)node->data) == NULL) { |
529 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [serving_nf_set_id_list]"); |
530 | 0 | goto end; |
531 | 0 | } |
532 | 0 | } |
533 | 0 | } |
534 | | |
535 | 0 | if (subscr_cond->ml_analytics_list) { |
536 | 0 | cJSON *ml_analytics_listList = cJSON_AddArrayToObject(item, "mlAnalyticsList"); |
537 | 0 | if (ml_analytics_listList == NULL) { |
538 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [ml_analytics_list]"); |
539 | 0 | goto end; |
540 | 0 | } |
541 | 0 | OpenAPI_list_for_each(subscr_cond->ml_analytics_list, node) { |
542 | 0 | cJSON *itemLocal = OpenAPI_ml_analytics_info_convertToJSON(node->data); |
543 | 0 | if (itemLocal == NULL) { |
544 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [ml_analytics_list]"); |
545 | 0 | goto end; |
546 | 0 | } |
547 | 0 | cJSON_AddItemToArray(ml_analytics_listList, itemLocal); |
548 | 0 | } |
549 | 0 | } |
550 | | |
551 | 0 | if (subscr_cond->af_events != OpenAPI_af_event_NULL) { |
552 | 0 | cJSON *af_eventsList = cJSON_AddArrayToObject(item, "afEvents"); |
553 | 0 | if (af_eventsList == NULL) { |
554 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [af_events]"); |
555 | 0 | goto end; |
556 | 0 | } |
557 | 0 | OpenAPI_list_for_each(subscr_cond->af_events, node) { |
558 | 0 | if (cJSON_AddStringToObject(af_eventsList, "", OpenAPI_af_event_ToString((intptr_t)node->data)) == NULL) { |
559 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [af_events]"); |
560 | 0 | goto end; |
561 | 0 | } |
562 | 0 | } |
563 | 0 | } |
564 | | |
565 | 0 | if (subscr_cond->pfd_data) { |
566 | 0 | cJSON *pfd_data_local_JSON = OpenAPI_pfd_data_convertToJSON(subscr_cond->pfd_data); |
567 | 0 | if (pfd_data_local_JSON == NULL) { |
568 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [pfd_data]"); |
569 | 0 | goto end; |
570 | 0 | } |
571 | 0 | cJSON_AddItemToObject(item, "pfdData", pfd_data_local_JSON); |
572 | 0 | if (item->child == NULL) { |
573 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [pfd_data]"); |
574 | 0 | goto end; |
575 | 0 | } |
576 | 0 | } |
577 | | |
578 | 0 | if (subscr_cond->gpsi_ranges) { |
579 | 0 | cJSON *gpsi_rangesList = cJSON_AddArrayToObject(item, "gpsiRanges"); |
580 | 0 | if (gpsi_rangesList == NULL) { |
581 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [gpsi_ranges]"); |
582 | 0 | goto end; |
583 | 0 | } |
584 | 0 | OpenAPI_list_for_each(subscr_cond->gpsi_ranges, node) { |
585 | 0 | cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(node->data); |
586 | 0 | if (itemLocal == NULL) { |
587 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [gpsi_ranges]"); |
588 | 0 | goto end; |
589 | 0 | } |
590 | 0 | cJSON_AddItemToArray(gpsi_rangesList, itemLocal); |
591 | 0 | } |
592 | 0 | } |
593 | | |
594 | 0 | if (subscr_cond->external_group_identifiers_ranges) { |
595 | 0 | cJSON *external_group_identifiers_rangesList = cJSON_AddArrayToObject(item, "externalGroupIdentifiersRanges"); |
596 | 0 | if (external_group_identifiers_rangesList == NULL) { |
597 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [external_group_identifiers_ranges]"); |
598 | 0 | goto end; |
599 | 0 | } |
600 | 0 | OpenAPI_list_for_each(subscr_cond->external_group_identifiers_ranges, node) { |
601 | 0 | cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(node->data); |
602 | 0 | if (itemLocal == NULL) { |
603 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [external_group_identifiers_ranges]"); |
604 | 0 | goto end; |
605 | 0 | } |
606 | 0 | cJSON_AddItemToArray(external_group_identifiers_rangesList, itemLocal); |
607 | 0 | } |
608 | 0 | } |
609 | | |
610 | 0 | if (subscr_cond->served_fqdn_list) { |
611 | 0 | cJSON *served_fqdn_listList = cJSON_AddArrayToObject(item, "servedFqdnList"); |
612 | 0 | if (served_fqdn_listList == NULL) { |
613 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [served_fqdn_list]"); |
614 | 0 | goto end; |
615 | 0 | } |
616 | 0 | OpenAPI_list_for_each(subscr_cond->served_fqdn_list, node) { |
617 | 0 | if (cJSON_AddStringToObject(served_fqdn_listList, "", (char*)node->data) == NULL) { |
618 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [served_fqdn_list]"); |
619 | 0 | goto end; |
620 | 0 | } |
621 | 0 | } |
622 | 0 | } |
623 | | |
624 | 0 | end: |
625 | 0 | return item; |
626 | 0 | } |
627 | | |
628 | | OpenAPI_subscr_cond_t *OpenAPI_subscr_cond_parseFromJSON(cJSON *subscr_condJSON) |
629 | 0 | { |
630 | 0 | OpenAPI_subscr_cond_t *subscr_cond_local_var = NULL; |
631 | 0 | OpenAPI_lnode_t *node = NULL; |
632 | 0 | cJSON *nf_instance_id = NULL; |
633 | 0 | cJSON *nf_instance_id_list = NULL; |
634 | 0 | OpenAPI_list_t *nf_instance_id_listList = NULL; |
635 | 0 | cJSON *nf_type = NULL; |
636 | 0 | OpenAPI_nf_type_e nf_typeVariable = 0; |
637 | 0 | cJSON *service_name = NULL; |
638 | 0 | OpenAPI_service_name_e service_nameVariable = 0; |
639 | 0 | cJSON *condition_type = NULL; |
640 | 0 | OpenAPI_subscr_cond_condition_type_e condition_typeVariable = 0; |
641 | 0 | cJSON *service_name_list = NULL; |
642 | 0 | OpenAPI_list_t *service_name_listList = NULL; |
643 | 0 | cJSON *amf_set_id = NULL; |
644 | 0 | cJSON *amf_region_id = NULL; |
645 | 0 | cJSON *guami_list = NULL; |
646 | 0 | OpenAPI_list_t *guami_listList = NULL; |
647 | 0 | cJSON *snssai_list = NULL; |
648 | 0 | OpenAPI_list_t *snssai_listList = NULL; |
649 | 0 | cJSON *nsi_list = NULL; |
650 | 0 | OpenAPI_list_t *nsi_listList = NULL; |
651 | 0 | cJSON *nf_group_id = NULL; |
652 | 0 | cJSON *nf_group_id_list = NULL; |
653 | 0 | OpenAPI_list_t *nf_group_id_listList = NULL; |
654 | 0 | cJSON *nf_set_id = NULL; |
655 | 0 | cJSON *nf_service_set_id = NULL; |
656 | 0 | cJSON *smf_serving_area = NULL; |
657 | 0 | OpenAPI_list_t *smf_serving_areaList = NULL; |
658 | 0 | cJSON *tai_list = NULL; |
659 | 0 | OpenAPI_list_t *tai_listList = NULL; |
660 | 0 | cJSON *scp_domains = NULL; |
661 | 0 | OpenAPI_list_t *scp_domainsList = NULL; |
662 | 0 | cJSON *nf_type_list = NULL; |
663 | 0 | OpenAPI_list_t *nf_type_listList = NULL; |
664 | 0 | cJSON *analytics_ids = NULL; |
665 | 0 | OpenAPI_list_t *analytics_idsList = NULL; |
666 | 0 | cJSON *tai_range_list = NULL; |
667 | 0 | OpenAPI_list_t *tai_range_listList = NULL; |
668 | 0 | cJSON *serving_nf_type_list = NULL; |
669 | 0 | OpenAPI_list_t *serving_nf_type_listList = NULL; |
670 | 0 | cJSON *serving_nf_set_id_list = NULL; |
671 | 0 | OpenAPI_list_t *serving_nf_set_id_listList = NULL; |
672 | 0 | cJSON *ml_analytics_list = NULL; |
673 | 0 | OpenAPI_list_t *ml_analytics_listList = NULL; |
674 | 0 | cJSON *af_events = NULL; |
675 | 0 | OpenAPI_list_t *af_eventsList = NULL; |
676 | 0 | cJSON *pfd_data = NULL; |
677 | 0 | OpenAPI_pfd_data_t *pfd_data_local_nonprim = NULL; |
678 | 0 | cJSON *gpsi_ranges = NULL; |
679 | 0 | OpenAPI_list_t *gpsi_rangesList = NULL; |
680 | 0 | cJSON *external_group_identifiers_ranges = NULL; |
681 | 0 | OpenAPI_list_t *external_group_identifiers_rangesList = NULL; |
682 | 0 | cJSON *served_fqdn_list = NULL; |
683 | 0 | OpenAPI_list_t *served_fqdn_listList = NULL; |
684 | 0 | nf_instance_id = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "nfInstanceId"); |
685 | 0 | if (nf_instance_id) { |
686 | 0 | if (!cJSON_IsString(nf_instance_id) && !cJSON_IsNull(nf_instance_id)) { |
687 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [nf_instance_id]"); |
688 | 0 | goto end; |
689 | 0 | } |
690 | 0 | } |
691 | | |
692 | 0 | nf_instance_id_list = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "nfInstanceIdList"); |
693 | 0 | if (nf_instance_id_list) { |
694 | 0 | cJSON *nf_instance_id_list_local = NULL; |
695 | 0 | if (!cJSON_IsArray(nf_instance_id_list)) { |
696 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [nf_instance_id_list]"); |
697 | 0 | goto end; |
698 | 0 | } |
699 | | |
700 | 0 | nf_instance_id_listList = OpenAPI_list_create(); |
701 | |
|
702 | 0 | cJSON_ArrayForEach(nf_instance_id_list_local, nf_instance_id_list) { |
703 | 0 | double *localDouble = NULL; |
704 | 0 | int *localInt = NULL; |
705 | 0 | if (!cJSON_IsString(nf_instance_id_list_local)) { |
706 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [nf_instance_id_list]"); |
707 | 0 | goto end; |
708 | 0 | } |
709 | 0 | OpenAPI_list_add(nf_instance_id_listList, ogs_strdup(nf_instance_id_list_local->valuestring)); |
710 | 0 | } |
711 | 0 | } |
712 | | |
713 | 0 | nf_type = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "nfType"); |
714 | 0 | if (nf_type) { |
715 | 0 | if (!cJSON_IsString(nf_type)) { |
716 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [nf_type]"); |
717 | 0 | goto end; |
718 | 0 | } |
719 | 0 | nf_typeVariable = OpenAPI_nf_type_FromString(nf_type->valuestring); |
720 | 0 | } |
721 | | |
722 | 0 | service_name = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "serviceName"); |
723 | 0 | if (service_name) { |
724 | 0 | if (!cJSON_IsString(service_name)) { |
725 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [service_name]"); |
726 | 0 | goto end; |
727 | 0 | } |
728 | 0 | service_nameVariable = OpenAPI_service_name_FromString(service_name->valuestring); |
729 | 0 | } |
730 | | |
731 | 0 | condition_type = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "conditionType"); |
732 | 0 | if (condition_type) { |
733 | 0 | if (!cJSON_IsString(condition_type)) { |
734 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [condition_type]"); |
735 | 0 | goto end; |
736 | 0 | } |
737 | 0 | condition_typeVariable = OpenAPI_condition_typesubscr_cond_FromString(condition_type->valuestring); |
738 | 0 | } |
739 | | |
740 | 0 | service_name_list = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "serviceNameList"); |
741 | 0 | if (service_name_list) { |
742 | 0 | cJSON *service_name_list_local = NULL; |
743 | 0 | if (!cJSON_IsArray(service_name_list)) { |
744 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [service_name_list]"); |
745 | 0 | goto end; |
746 | 0 | } |
747 | | |
748 | 0 | service_name_listList = OpenAPI_list_create(); |
749 | |
|
750 | 0 | cJSON_ArrayForEach(service_name_list_local, service_name_list) { |
751 | 0 | OpenAPI_service_name_e localEnum = OpenAPI_service_name_NULL; |
752 | 0 | if (!cJSON_IsString(service_name_list_local)) { |
753 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [service_name_list]"); |
754 | 0 | goto end; |
755 | 0 | } |
756 | 0 | localEnum = OpenAPI_service_name_FromString(service_name_list_local->valuestring); |
757 | 0 | if (!localEnum) { |
758 | 0 | ogs_info("Enum value \"%s\" for field \"service_name_list\" is not supported. Ignoring it ...", |
759 | 0 | service_name_list_local->valuestring); |
760 | 0 | } else { |
761 | 0 | OpenAPI_list_add(service_name_listList, (void *)localEnum); |
762 | 0 | } |
763 | 0 | } |
764 | 0 | if (service_name_listList->count == 0) { |
765 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed: Expected service_name_listList to not be empty (after ignoring unsupported enum values)."); |
766 | 0 | goto end; |
767 | 0 | } |
768 | 0 | } |
769 | | |
770 | 0 | amf_set_id = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "amfSetId"); |
771 | 0 | if (amf_set_id) { |
772 | 0 | if (!cJSON_IsString(amf_set_id) && !cJSON_IsNull(amf_set_id)) { |
773 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [amf_set_id]"); |
774 | 0 | goto end; |
775 | 0 | } |
776 | 0 | } |
777 | | |
778 | 0 | amf_region_id = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "amfRegionId"); |
779 | 0 | if (amf_region_id) { |
780 | 0 | if (!cJSON_IsString(amf_region_id) && !cJSON_IsNull(amf_region_id)) { |
781 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [amf_region_id]"); |
782 | 0 | goto end; |
783 | 0 | } |
784 | 0 | } |
785 | | |
786 | 0 | guami_list = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "guamiList"); |
787 | 0 | if (guami_list) { |
788 | 0 | cJSON *guami_list_local = NULL; |
789 | 0 | if (!cJSON_IsArray(guami_list)) { |
790 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [guami_list]"); |
791 | 0 | goto end; |
792 | 0 | } |
793 | | |
794 | 0 | guami_listList = OpenAPI_list_create(); |
795 | |
|
796 | 0 | cJSON_ArrayForEach(guami_list_local, guami_list) { |
797 | 0 | if (!cJSON_IsObject(guami_list_local)) { |
798 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [guami_list]"); |
799 | 0 | goto end; |
800 | 0 | } |
801 | 0 | OpenAPI_guami_t *guami_listItem = OpenAPI_guami_parseFromJSON(guami_list_local); |
802 | 0 | if (!guami_listItem) { |
803 | 0 | ogs_error("No guami_listItem"); |
804 | 0 | goto end; |
805 | 0 | } |
806 | 0 | OpenAPI_list_add(guami_listList, guami_listItem); |
807 | 0 | } |
808 | 0 | } |
809 | | |
810 | 0 | snssai_list = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "snssaiList"); |
811 | 0 | if (snssai_list) { |
812 | 0 | cJSON *snssai_list_local = NULL; |
813 | 0 | if (!cJSON_IsArray(snssai_list)) { |
814 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [snssai_list]"); |
815 | 0 | goto end; |
816 | 0 | } |
817 | | |
818 | 0 | snssai_listList = OpenAPI_list_create(); |
819 | |
|
820 | 0 | cJSON_ArrayForEach(snssai_list_local, snssai_list) { |
821 | 0 | if (!cJSON_IsObject(snssai_list_local)) { |
822 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [snssai_list]"); |
823 | 0 | goto end; |
824 | 0 | } |
825 | 0 | OpenAPI_snssai_t *snssai_listItem = OpenAPI_snssai_parseFromJSON(snssai_list_local); |
826 | 0 | if (!snssai_listItem) { |
827 | 0 | ogs_error("No snssai_listItem"); |
828 | 0 | goto end; |
829 | 0 | } |
830 | 0 | OpenAPI_list_add(snssai_listList, snssai_listItem); |
831 | 0 | } |
832 | 0 | } |
833 | | |
834 | 0 | nsi_list = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "nsiList"); |
835 | 0 | if (nsi_list) { |
836 | 0 | cJSON *nsi_list_local = NULL; |
837 | 0 | if (!cJSON_IsArray(nsi_list)) { |
838 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [nsi_list]"); |
839 | 0 | goto end; |
840 | 0 | } |
841 | | |
842 | 0 | nsi_listList = OpenAPI_list_create(); |
843 | |
|
844 | 0 | cJSON_ArrayForEach(nsi_list_local, nsi_list) { |
845 | 0 | double *localDouble = NULL; |
846 | 0 | int *localInt = NULL; |
847 | 0 | if (!cJSON_IsString(nsi_list_local)) { |
848 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [nsi_list]"); |
849 | 0 | goto end; |
850 | 0 | } |
851 | 0 | OpenAPI_list_add(nsi_listList, ogs_strdup(nsi_list_local->valuestring)); |
852 | 0 | } |
853 | 0 | } |
854 | | |
855 | 0 | nf_group_id = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "nfGroupId"); |
856 | 0 | if (nf_group_id) { |
857 | 0 | if (!cJSON_IsString(nf_group_id) && !cJSON_IsNull(nf_group_id)) { |
858 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [nf_group_id]"); |
859 | 0 | goto end; |
860 | 0 | } |
861 | 0 | } |
862 | | |
863 | 0 | nf_group_id_list = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "nfGroupIdList"); |
864 | 0 | if (nf_group_id_list) { |
865 | 0 | cJSON *nf_group_id_list_local = NULL; |
866 | 0 | if (!cJSON_IsArray(nf_group_id_list)) { |
867 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [nf_group_id_list]"); |
868 | 0 | goto end; |
869 | 0 | } |
870 | | |
871 | 0 | nf_group_id_listList = OpenAPI_list_create(); |
872 | |
|
873 | 0 | cJSON_ArrayForEach(nf_group_id_list_local, nf_group_id_list) { |
874 | 0 | double *localDouble = NULL; |
875 | 0 | int *localInt = NULL; |
876 | 0 | if (!cJSON_IsString(nf_group_id_list_local)) { |
877 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [nf_group_id_list]"); |
878 | 0 | goto end; |
879 | 0 | } |
880 | 0 | OpenAPI_list_add(nf_group_id_listList, ogs_strdup(nf_group_id_list_local->valuestring)); |
881 | 0 | } |
882 | 0 | } |
883 | | |
884 | 0 | nf_set_id = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "nfSetId"); |
885 | 0 | if (nf_set_id) { |
886 | 0 | if (!cJSON_IsString(nf_set_id) && !cJSON_IsNull(nf_set_id)) { |
887 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [nf_set_id]"); |
888 | 0 | goto end; |
889 | 0 | } |
890 | 0 | } |
891 | | |
892 | 0 | nf_service_set_id = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "nfServiceSetId"); |
893 | 0 | if (nf_service_set_id) { |
894 | 0 | if (!cJSON_IsString(nf_service_set_id) && !cJSON_IsNull(nf_service_set_id)) { |
895 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [nf_service_set_id]"); |
896 | 0 | goto end; |
897 | 0 | } |
898 | 0 | } |
899 | | |
900 | 0 | smf_serving_area = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "smfServingArea"); |
901 | 0 | if (smf_serving_area) { |
902 | 0 | cJSON *smf_serving_area_local = NULL; |
903 | 0 | if (!cJSON_IsArray(smf_serving_area)) { |
904 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [smf_serving_area]"); |
905 | 0 | goto end; |
906 | 0 | } |
907 | | |
908 | 0 | smf_serving_areaList = OpenAPI_list_create(); |
909 | |
|
910 | 0 | cJSON_ArrayForEach(smf_serving_area_local, smf_serving_area) { |
911 | 0 | double *localDouble = NULL; |
912 | 0 | int *localInt = NULL; |
913 | 0 | if (!cJSON_IsString(smf_serving_area_local)) { |
914 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [smf_serving_area]"); |
915 | 0 | goto end; |
916 | 0 | } |
917 | 0 | OpenAPI_list_add(smf_serving_areaList, ogs_strdup(smf_serving_area_local->valuestring)); |
918 | 0 | } |
919 | 0 | } |
920 | | |
921 | 0 | tai_list = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "taiList"); |
922 | 0 | if (tai_list) { |
923 | 0 | cJSON *tai_list_local = NULL; |
924 | 0 | if (!cJSON_IsArray(tai_list)) { |
925 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [tai_list]"); |
926 | 0 | goto end; |
927 | 0 | } |
928 | | |
929 | 0 | tai_listList = OpenAPI_list_create(); |
930 | |
|
931 | 0 | cJSON_ArrayForEach(tai_list_local, tai_list) { |
932 | 0 | if (!cJSON_IsObject(tai_list_local)) { |
933 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [tai_list]"); |
934 | 0 | goto end; |
935 | 0 | } |
936 | 0 | OpenAPI_tai_t *tai_listItem = OpenAPI_tai_parseFromJSON(tai_list_local); |
937 | 0 | if (!tai_listItem) { |
938 | 0 | ogs_error("No tai_listItem"); |
939 | 0 | goto end; |
940 | 0 | } |
941 | 0 | OpenAPI_list_add(tai_listList, tai_listItem); |
942 | 0 | } |
943 | 0 | } |
944 | | |
945 | 0 | scp_domains = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "scpDomains"); |
946 | 0 | if (scp_domains) { |
947 | 0 | cJSON *scp_domains_local = NULL; |
948 | 0 | if (!cJSON_IsArray(scp_domains)) { |
949 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [scp_domains]"); |
950 | 0 | goto end; |
951 | 0 | } |
952 | | |
953 | 0 | scp_domainsList = OpenAPI_list_create(); |
954 | |
|
955 | 0 | cJSON_ArrayForEach(scp_domains_local, scp_domains) { |
956 | 0 | double *localDouble = NULL; |
957 | 0 | int *localInt = NULL; |
958 | 0 | if (!cJSON_IsString(scp_domains_local)) { |
959 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [scp_domains]"); |
960 | 0 | goto end; |
961 | 0 | } |
962 | 0 | OpenAPI_list_add(scp_domainsList, ogs_strdup(scp_domains_local->valuestring)); |
963 | 0 | } |
964 | 0 | } |
965 | | |
966 | 0 | nf_type_list = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "nfTypeList"); |
967 | 0 | if (nf_type_list) { |
968 | 0 | cJSON *nf_type_list_local = NULL; |
969 | 0 | if (!cJSON_IsArray(nf_type_list)) { |
970 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [nf_type_list]"); |
971 | 0 | goto end; |
972 | 0 | } |
973 | | |
974 | 0 | nf_type_listList = OpenAPI_list_create(); |
975 | |
|
976 | 0 | cJSON_ArrayForEach(nf_type_list_local, nf_type_list) { |
977 | 0 | OpenAPI_nf_type_e localEnum = OpenAPI_nf_type_NULL; |
978 | 0 | if (!cJSON_IsString(nf_type_list_local)) { |
979 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [nf_type_list]"); |
980 | 0 | goto end; |
981 | 0 | } |
982 | 0 | localEnum = OpenAPI_nf_type_FromString(nf_type_list_local->valuestring); |
983 | 0 | if (!localEnum) { |
984 | 0 | ogs_info("Enum value \"%s\" for field \"nf_type_list\" is not supported. Ignoring it ...", |
985 | 0 | nf_type_list_local->valuestring); |
986 | 0 | } else { |
987 | 0 | OpenAPI_list_add(nf_type_listList, (void *)localEnum); |
988 | 0 | } |
989 | 0 | } |
990 | 0 | if (nf_type_listList->count == 0) { |
991 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed: Expected nf_type_listList to not be empty (after ignoring unsupported enum values)."); |
992 | 0 | goto end; |
993 | 0 | } |
994 | 0 | } |
995 | | |
996 | 0 | analytics_ids = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "analyticsIds"); |
997 | 0 | if (analytics_ids) { |
998 | 0 | cJSON *analytics_ids_local = NULL; |
999 | 0 | if (!cJSON_IsArray(analytics_ids)) { |
1000 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [analytics_ids]"); |
1001 | 0 | goto end; |
1002 | 0 | } |
1003 | | |
1004 | 0 | analytics_idsList = OpenAPI_list_create(); |
1005 | |
|
1006 | 0 | cJSON_ArrayForEach(analytics_ids_local, analytics_ids) { |
1007 | 0 | double *localDouble = NULL; |
1008 | 0 | int *localInt = NULL; |
1009 | 0 | if (!cJSON_IsString(analytics_ids_local)) { |
1010 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [analytics_ids]"); |
1011 | 0 | goto end; |
1012 | 0 | } |
1013 | 0 | OpenAPI_list_add(analytics_idsList, ogs_strdup(analytics_ids_local->valuestring)); |
1014 | 0 | } |
1015 | 0 | } |
1016 | | |
1017 | 0 | tai_range_list = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "taiRangeList"); |
1018 | 0 | if (tai_range_list) { |
1019 | 0 | cJSON *tai_range_list_local = NULL; |
1020 | 0 | if (!cJSON_IsArray(tai_range_list)) { |
1021 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [tai_range_list]"); |
1022 | 0 | goto end; |
1023 | 0 | } |
1024 | | |
1025 | 0 | tai_range_listList = OpenAPI_list_create(); |
1026 | |
|
1027 | 0 | cJSON_ArrayForEach(tai_range_list_local, tai_range_list) { |
1028 | 0 | if (!cJSON_IsObject(tai_range_list_local)) { |
1029 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [tai_range_list]"); |
1030 | 0 | goto end; |
1031 | 0 | } |
1032 | 0 | OpenAPI_tai_range_t *tai_range_listItem = OpenAPI_tai_range_parseFromJSON(tai_range_list_local); |
1033 | 0 | if (!tai_range_listItem) { |
1034 | 0 | ogs_error("No tai_range_listItem"); |
1035 | 0 | goto end; |
1036 | 0 | } |
1037 | 0 | OpenAPI_list_add(tai_range_listList, tai_range_listItem); |
1038 | 0 | } |
1039 | 0 | } |
1040 | | |
1041 | 0 | serving_nf_type_list = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "servingNfTypeList"); |
1042 | 0 | if (serving_nf_type_list) { |
1043 | 0 | cJSON *serving_nf_type_list_local = NULL; |
1044 | 0 | if (!cJSON_IsArray(serving_nf_type_list)) { |
1045 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [serving_nf_type_list]"); |
1046 | 0 | goto end; |
1047 | 0 | } |
1048 | | |
1049 | 0 | serving_nf_type_listList = OpenAPI_list_create(); |
1050 | |
|
1051 | 0 | cJSON_ArrayForEach(serving_nf_type_list_local, serving_nf_type_list) { |
1052 | 0 | OpenAPI_nf_type_e localEnum = OpenAPI_nf_type_NULL; |
1053 | 0 | if (!cJSON_IsString(serving_nf_type_list_local)) { |
1054 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [serving_nf_type_list]"); |
1055 | 0 | goto end; |
1056 | 0 | } |
1057 | 0 | localEnum = OpenAPI_nf_type_FromString(serving_nf_type_list_local->valuestring); |
1058 | 0 | if (!localEnum) { |
1059 | 0 | ogs_info("Enum value \"%s\" for field \"serving_nf_type_list\" is not supported. Ignoring it ...", |
1060 | 0 | serving_nf_type_list_local->valuestring); |
1061 | 0 | } else { |
1062 | 0 | OpenAPI_list_add(serving_nf_type_listList, (void *)localEnum); |
1063 | 0 | } |
1064 | 0 | } |
1065 | 0 | if (serving_nf_type_listList->count == 0) { |
1066 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed: Expected serving_nf_type_listList to not be empty (after ignoring unsupported enum values)."); |
1067 | 0 | goto end; |
1068 | 0 | } |
1069 | 0 | } |
1070 | | |
1071 | 0 | serving_nf_set_id_list = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "servingNfSetIdList"); |
1072 | 0 | if (serving_nf_set_id_list) { |
1073 | 0 | cJSON *serving_nf_set_id_list_local = NULL; |
1074 | 0 | if (!cJSON_IsArray(serving_nf_set_id_list)) { |
1075 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [serving_nf_set_id_list]"); |
1076 | 0 | goto end; |
1077 | 0 | } |
1078 | | |
1079 | 0 | serving_nf_set_id_listList = OpenAPI_list_create(); |
1080 | |
|
1081 | 0 | cJSON_ArrayForEach(serving_nf_set_id_list_local, serving_nf_set_id_list) { |
1082 | 0 | double *localDouble = NULL; |
1083 | 0 | int *localInt = NULL; |
1084 | 0 | if (!cJSON_IsString(serving_nf_set_id_list_local)) { |
1085 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [serving_nf_set_id_list]"); |
1086 | 0 | goto end; |
1087 | 0 | } |
1088 | 0 | OpenAPI_list_add(serving_nf_set_id_listList, ogs_strdup(serving_nf_set_id_list_local->valuestring)); |
1089 | 0 | } |
1090 | 0 | } |
1091 | | |
1092 | 0 | ml_analytics_list = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "mlAnalyticsList"); |
1093 | 0 | if (ml_analytics_list) { |
1094 | 0 | cJSON *ml_analytics_list_local = NULL; |
1095 | 0 | if (!cJSON_IsArray(ml_analytics_list)) { |
1096 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [ml_analytics_list]"); |
1097 | 0 | goto end; |
1098 | 0 | } |
1099 | | |
1100 | 0 | ml_analytics_listList = OpenAPI_list_create(); |
1101 | |
|
1102 | 0 | cJSON_ArrayForEach(ml_analytics_list_local, ml_analytics_list) { |
1103 | 0 | if (!cJSON_IsObject(ml_analytics_list_local)) { |
1104 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [ml_analytics_list]"); |
1105 | 0 | goto end; |
1106 | 0 | } |
1107 | 0 | OpenAPI_ml_analytics_info_t *ml_analytics_listItem = OpenAPI_ml_analytics_info_parseFromJSON(ml_analytics_list_local); |
1108 | 0 | if (!ml_analytics_listItem) { |
1109 | 0 | ogs_error("No ml_analytics_listItem"); |
1110 | 0 | goto end; |
1111 | 0 | } |
1112 | 0 | OpenAPI_list_add(ml_analytics_listList, ml_analytics_listItem); |
1113 | 0 | } |
1114 | 0 | } |
1115 | | |
1116 | 0 | af_events = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "afEvents"); |
1117 | 0 | if (af_events) { |
1118 | 0 | cJSON *af_events_local = NULL; |
1119 | 0 | if (!cJSON_IsArray(af_events)) { |
1120 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [af_events]"); |
1121 | 0 | goto end; |
1122 | 0 | } |
1123 | | |
1124 | 0 | af_eventsList = OpenAPI_list_create(); |
1125 | |
|
1126 | 0 | cJSON_ArrayForEach(af_events_local, af_events) { |
1127 | 0 | OpenAPI_af_event_e localEnum = OpenAPI_af_event_NULL; |
1128 | 0 | if (!cJSON_IsString(af_events_local)) { |
1129 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [af_events]"); |
1130 | 0 | goto end; |
1131 | 0 | } |
1132 | 0 | localEnum = OpenAPI_af_event_FromString(af_events_local->valuestring); |
1133 | 0 | if (!localEnum) { |
1134 | 0 | ogs_info("Enum value \"%s\" for field \"af_events\" is not supported. Ignoring it ...", |
1135 | 0 | af_events_local->valuestring); |
1136 | 0 | } else { |
1137 | 0 | OpenAPI_list_add(af_eventsList, (void *)localEnum); |
1138 | 0 | } |
1139 | 0 | } |
1140 | 0 | if (af_eventsList->count == 0) { |
1141 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed: Expected af_eventsList to not be empty (after ignoring unsupported enum values)."); |
1142 | 0 | goto end; |
1143 | 0 | } |
1144 | 0 | } |
1145 | | |
1146 | 0 | pfd_data = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "pfdData"); |
1147 | 0 | if (pfd_data) { |
1148 | 0 | pfd_data_local_nonprim = OpenAPI_pfd_data_parseFromJSON(pfd_data); |
1149 | 0 | if (!pfd_data_local_nonprim) { |
1150 | 0 | ogs_error("OpenAPI_pfd_data_parseFromJSON failed [pfd_data]"); |
1151 | 0 | goto end; |
1152 | 0 | } |
1153 | 0 | } |
1154 | | |
1155 | 0 | gpsi_ranges = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "gpsiRanges"); |
1156 | 0 | if (gpsi_ranges) { |
1157 | 0 | cJSON *gpsi_ranges_local = NULL; |
1158 | 0 | if (!cJSON_IsArray(gpsi_ranges)) { |
1159 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [gpsi_ranges]"); |
1160 | 0 | goto end; |
1161 | 0 | } |
1162 | | |
1163 | 0 | gpsi_rangesList = OpenAPI_list_create(); |
1164 | |
|
1165 | 0 | cJSON_ArrayForEach(gpsi_ranges_local, gpsi_ranges) { |
1166 | 0 | if (!cJSON_IsObject(gpsi_ranges_local)) { |
1167 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [gpsi_ranges]"); |
1168 | 0 | goto end; |
1169 | 0 | } |
1170 | 0 | OpenAPI_identity_range_t *gpsi_rangesItem = OpenAPI_identity_range_parseFromJSON(gpsi_ranges_local); |
1171 | 0 | if (!gpsi_rangesItem) { |
1172 | 0 | ogs_error("No gpsi_rangesItem"); |
1173 | 0 | goto end; |
1174 | 0 | } |
1175 | 0 | OpenAPI_list_add(gpsi_rangesList, gpsi_rangesItem); |
1176 | 0 | } |
1177 | 0 | } |
1178 | | |
1179 | 0 | external_group_identifiers_ranges = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "externalGroupIdentifiersRanges"); |
1180 | 0 | if (external_group_identifiers_ranges) { |
1181 | 0 | cJSON *external_group_identifiers_ranges_local = NULL; |
1182 | 0 | if (!cJSON_IsArray(external_group_identifiers_ranges)) { |
1183 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [external_group_identifiers_ranges]"); |
1184 | 0 | goto end; |
1185 | 0 | } |
1186 | | |
1187 | 0 | external_group_identifiers_rangesList = OpenAPI_list_create(); |
1188 | |
|
1189 | 0 | cJSON_ArrayForEach(external_group_identifiers_ranges_local, external_group_identifiers_ranges) { |
1190 | 0 | if (!cJSON_IsObject(external_group_identifiers_ranges_local)) { |
1191 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [external_group_identifiers_ranges]"); |
1192 | 0 | goto end; |
1193 | 0 | } |
1194 | 0 | OpenAPI_identity_range_t *external_group_identifiers_rangesItem = OpenAPI_identity_range_parseFromJSON(external_group_identifiers_ranges_local); |
1195 | 0 | if (!external_group_identifiers_rangesItem) { |
1196 | 0 | ogs_error("No external_group_identifiers_rangesItem"); |
1197 | 0 | goto end; |
1198 | 0 | } |
1199 | 0 | OpenAPI_list_add(external_group_identifiers_rangesList, external_group_identifiers_rangesItem); |
1200 | 0 | } |
1201 | 0 | } |
1202 | | |
1203 | 0 | served_fqdn_list = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "servedFqdnList"); |
1204 | 0 | if (served_fqdn_list) { |
1205 | 0 | cJSON *served_fqdn_list_local = NULL; |
1206 | 0 | if (!cJSON_IsArray(served_fqdn_list)) { |
1207 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [served_fqdn_list]"); |
1208 | 0 | goto end; |
1209 | 0 | } |
1210 | | |
1211 | 0 | served_fqdn_listList = OpenAPI_list_create(); |
1212 | |
|
1213 | 0 | cJSON_ArrayForEach(served_fqdn_list_local, served_fqdn_list) { |
1214 | 0 | double *localDouble = NULL; |
1215 | 0 | int *localInt = NULL; |
1216 | 0 | if (!cJSON_IsString(served_fqdn_list_local)) { |
1217 | 0 | ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [served_fqdn_list]"); |
1218 | 0 | goto end; |
1219 | 0 | } |
1220 | 0 | OpenAPI_list_add(served_fqdn_listList, ogs_strdup(served_fqdn_list_local->valuestring)); |
1221 | 0 | } |
1222 | 0 | } |
1223 | | |
1224 | 0 | subscr_cond_local_var = OpenAPI_subscr_cond_create ( |
1225 | 0 | nf_instance_id && !cJSON_IsNull(nf_instance_id) ? ogs_strdup(nf_instance_id->valuestring) : NULL, |
1226 | 0 | nf_instance_id_list ? nf_instance_id_listList : NULL, |
1227 | 0 | nf_type ? nf_typeVariable : 0, |
1228 | 0 | service_name ? service_nameVariable : 0, |
1229 | 0 | condition_type ? condition_typeVariable : 0, |
1230 | 0 | service_name_list ? service_name_listList : NULL, |
1231 | 0 | amf_set_id && !cJSON_IsNull(amf_set_id) ? ogs_strdup(amf_set_id->valuestring) : NULL, |
1232 | 0 | amf_region_id && !cJSON_IsNull(amf_region_id) ? ogs_strdup(amf_region_id->valuestring) : NULL, |
1233 | 0 | guami_list ? guami_listList : NULL, |
1234 | 0 | snssai_list ? snssai_listList : NULL, |
1235 | 0 | nsi_list ? nsi_listList : NULL, |
1236 | 0 | nf_group_id && !cJSON_IsNull(nf_group_id) ? ogs_strdup(nf_group_id->valuestring) : NULL, |
1237 | 0 | nf_group_id_list ? nf_group_id_listList : NULL, |
1238 | 0 | nf_set_id && !cJSON_IsNull(nf_set_id) ? ogs_strdup(nf_set_id->valuestring) : NULL, |
1239 | 0 | nf_service_set_id && !cJSON_IsNull(nf_service_set_id) ? ogs_strdup(nf_service_set_id->valuestring) : NULL, |
1240 | 0 | smf_serving_area ? smf_serving_areaList : NULL, |
1241 | 0 | tai_list ? tai_listList : NULL, |
1242 | 0 | scp_domains ? scp_domainsList : NULL, |
1243 | 0 | nf_type_list ? nf_type_listList : NULL, |
1244 | 0 | analytics_ids ? analytics_idsList : NULL, |
1245 | 0 | tai_range_list ? tai_range_listList : NULL, |
1246 | 0 | serving_nf_type_list ? serving_nf_type_listList : NULL, |
1247 | 0 | serving_nf_set_id_list ? serving_nf_set_id_listList : NULL, |
1248 | 0 | ml_analytics_list ? ml_analytics_listList : NULL, |
1249 | 0 | af_events ? af_eventsList : NULL, |
1250 | 0 | pfd_data ? pfd_data_local_nonprim : NULL, |
1251 | 0 | gpsi_ranges ? gpsi_rangesList : NULL, |
1252 | 0 | external_group_identifiers_ranges ? external_group_identifiers_rangesList : NULL, |
1253 | 0 | served_fqdn_list ? served_fqdn_listList : NULL |
1254 | 0 | ); |
1255 | |
|
1256 | 0 | return subscr_cond_local_var; |
1257 | 0 | end: |
1258 | 0 | if (nf_instance_id_listList) { |
1259 | 0 | OpenAPI_list_for_each(nf_instance_id_listList, node) { |
1260 | 0 | ogs_free(node->data); |
1261 | 0 | } |
1262 | 0 | OpenAPI_list_free(nf_instance_id_listList); |
1263 | 0 | nf_instance_id_listList = NULL; |
1264 | 0 | } |
1265 | 0 | if (service_name_listList) { |
1266 | 0 | OpenAPI_list_free(service_name_listList); |
1267 | 0 | service_name_listList = NULL; |
1268 | 0 | } |
1269 | 0 | if (guami_listList) { |
1270 | 0 | OpenAPI_list_for_each(guami_listList, node) { |
1271 | 0 | OpenAPI_guami_free(node->data); |
1272 | 0 | } |
1273 | 0 | OpenAPI_list_free(guami_listList); |
1274 | 0 | guami_listList = NULL; |
1275 | 0 | } |
1276 | 0 | if (snssai_listList) { |
1277 | 0 | OpenAPI_list_for_each(snssai_listList, node) { |
1278 | 0 | OpenAPI_snssai_free(node->data); |
1279 | 0 | } |
1280 | 0 | OpenAPI_list_free(snssai_listList); |
1281 | 0 | snssai_listList = NULL; |
1282 | 0 | } |
1283 | 0 | if (nsi_listList) { |
1284 | 0 | OpenAPI_list_for_each(nsi_listList, node) { |
1285 | 0 | ogs_free(node->data); |
1286 | 0 | } |
1287 | 0 | OpenAPI_list_free(nsi_listList); |
1288 | 0 | nsi_listList = NULL; |
1289 | 0 | } |
1290 | 0 | if (nf_group_id_listList) { |
1291 | 0 | OpenAPI_list_for_each(nf_group_id_listList, node) { |
1292 | 0 | ogs_free(node->data); |
1293 | 0 | } |
1294 | 0 | OpenAPI_list_free(nf_group_id_listList); |
1295 | 0 | nf_group_id_listList = NULL; |
1296 | 0 | } |
1297 | 0 | if (smf_serving_areaList) { |
1298 | 0 | OpenAPI_list_for_each(smf_serving_areaList, node) { |
1299 | 0 | ogs_free(node->data); |
1300 | 0 | } |
1301 | 0 | OpenAPI_list_free(smf_serving_areaList); |
1302 | 0 | smf_serving_areaList = NULL; |
1303 | 0 | } |
1304 | 0 | if (tai_listList) { |
1305 | 0 | OpenAPI_list_for_each(tai_listList, node) { |
1306 | 0 | OpenAPI_tai_free(node->data); |
1307 | 0 | } |
1308 | 0 | OpenAPI_list_free(tai_listList); |
1309 | 0 | tai_listList = NULL; |
1310 | 0 | } |
1311 | 0 | if (scp_domainsList) { |
1312 | 0 | OpenAPI_list_for_each(scp_domainsList, node) { |
1313 | 0 | ogs_free(node->data); |
1314 | 0 | } |
1315 | 0 | OpenAPI_list_free(scp_domainsList); |
1316 | 0 | scp_domainsList = NULL; |
1317 | 0 | } |
1318 | 0 | if (nf_type_listList) { |
1319 | 0 | OpenAPI_list_free(nf_type_listList); |
1320 | 0 | nf_type_listList = NULL; |
1321 | 0 | } |
1322 | 0 | if (analytics_idsList) { |
1323 | 0 | OpenAPI_list_for_each(analytics_idsList, node) { |
1324 | 0 | ogs_free(node->data); |
1325 | 0 | } |
1326 | 0 | OpenAPI_list_free(analytics_idsList); |
1327 | 0 | analytics_idsList = NULL; |
1328 | 0 | } |
1329 | 0 | if (tai_range_listList) { |
1330 | 0 | OpenAPI_list_for_each(tai_range_listList, node) { |
1331 | 0 | OpenAPI_tai_range_free(node->data); |
1332 | 0 | } |
1333 | 0 | OpenAPI_list_free(tai_range_listList); |
1334 | 0 | tai_range_listList = NULL; |
1335 | 0 | } |
1336 | 0 | if (serving_nf_type_listList) { |
1337 | 0 | OpenAPI_list_free(serving_nf_type_listList); |
1338 | 0 | serving_nf_type_listList = NULL; |
1339 | 0 | } |
1340 | 0 | if (serving_nf_set_id_listList) { |
1341 | 0 | OpenAPI_list_for_each(serving_nf_set_id_listList, node) { |
1342 | 0 | ogs_free(node->data); |
1343 | 0 | } |
1344 | 0 | OpenAPI_list_free(serving_nf_set_id_listList); |
1345 | 0 | serving_nf_set_id_listList = NULL; |
1346 | 0 | } |
1347 | 0 | if (ml_analytics_listList) { |
1348 | 0 | OpenAPI_list_for_each(ml_analytics_listList, node) { |
1349 | 0 | OpenAPI_ml_analytics_info_free(node->data); |
1350 | 0 | } |
1351 | 0 | OpenAPI_list_free(ml_analytics_listList); |
1352 | 0 | ml_analytics_listList = NULL; |
1353 | 0 | } |
1354 | 0 | if (af_eventsList) { |
1355 | 0 | OpenAPI_list_free(af_eventsList); |
1356 | 0 | af_eventsList = NULL; |
1357 | 0 | } |
1358 | 0 | if (pfd_data_local_nonprim) { |
1359 | 0 | OpenAPI_pfd_data_free(pfd_data_local_nonprim); |
1360 | 0 | pfd_data_local_nonprim = NULL; |
1361 | 0 | } |
1362 | 0 | if (gpsi_rangesList) { |
1363 | 0 | OpenAPI_list_for_each(gpsi_rangesList, node) { |
1364 | 0 | OpenAPI_identity_range_free(node->data); |
1365 | 0 | } |
1366 | 0 | OpenAPI_list_free(gpsi_rangesList); |
1367 | 0 | gpsi_rangesList = NULL; |
1368 | 0 | } |
1369 | 0 | if (external_group_identifiers_rangesList) { |
1370 | 0 | OpenAPI_list_for_each(external_group_identifiers_rangesList, node) { |
1371 | 0 | OpenAPI_identity_range_free(node->data); |
1372 | 0 | } |
1373 | 0 | OpenAPI_list_free(external_group_identifiers_rangesList); |
1374 | 0 | external_group_identifiers_rangesList = NULL; |
1375 | 0 | } |
1376 | 0 | if (served_fqdn_listList) { |
1377 | 0 | OpenAPI_list_for_each(served_fqdn_listList, node) { |
1378 | 0 | ogs_free(node->data); |
1379 | 0 | } |
1380 | 0 | OpenAPI_list_free(served_fqdn_listList); |
1381 | 0 | served_fqdn_listList = NULL; |
1382 | 0 | } |
1383 | 0 | return NULL; |
1384 | 0 | } |
1385 | | |
1386 | | OpenAPI_subscr_cond_t *OpenAPI_subscr_cond_copy(OpenAPI_subscr_cond_t *dst, OpenAPI_subscr_cond_t *src) |
1387 | 0 | { |
1388 | 0 | cJSON *item = NULL; |
1389 | 0 | char *content = NULL; |
1390 | |
|
1391 | 0 | ogs_assert(src); |
1392 | 0 | item = OpenAPI_subscr_cond_convertToJSON(src); |
1393 | 0 | if (!item) { |
1394 | 0 | ogs_error("OpenAPI_subscr_cond_convertToJSON() failed"); |
1395 | 0 | return NULL; |
1396 | 0 | } |
1397 | | |
1398 | 0 | content = cJSON_Print(item); |
1399 | 0 | cJSON_Delete(item); |
1400 | |
|
1401 | 0 | if (!content) { |
1402 | 0 | ogs_error("cJSON_Print() failed"); |
1403 | 0 | return NULL; |
1404 | 0 | } |
1405 | | |
1406 | 0 | item = cJSON_Parse(content); |
1407 | 0 | ogs_free(content); |
1408 | 0 | if (!item) { |
1409 | 0 | ogs_error("cJSON_Parse() failed"); |
1410 | 0 | return NULL; |
1411 | 0 | } |
1412 | | |
1413 | 0 | OpenAPI_subscr_cond_free(dst); |
1414 | 0 | dst = OpenAPI_subscr_cond_parseFromJSON(item); |
1415 | 0 | cJSON_Delete(item); |
1416 | |
|
1417 | 0 | return dst; |
1418 | 0 | } |
1419 | | |