/src/open5gs/lib/sbi/openapi/model/amf_event.c
Line | Count | Source |
1 | | |
2 | | #include <stdlib.h> |
3 | | #include <string.h> |
4 | | #include <stdio.h> |
5 | | #include "amf_event.h" |
6 | | |
7 | | OpenAPI_amf_event_t *OpenAPI_amf_event_create( |
8 | | OpenAPI_amf_event_type_e type, |
9 | | bool is_immediate_flag, |
10 | | int immediate_flag, |
11 | | OpenAPI_list_t *area_list, |
12 | | OpenAPI_list_t *location_filter_list, |
13 | | OpenAPI_list_t *location_trends_filter_list, |
14 | | bool is_ref_id, |
15 | | int ref_id, |
16 | | OpenAPI_list_t *traffic_descriptor_list, |
17 | | bool is_report_ue_reachable, |
18 | | int report_ue_reachable, |
19 | | OpenAPI_reachability_filter_e reachability_filter, |
20 | | bool is_udm_detect_ind, |
21 | | int udm_detect_ind, |
22 | | bool is_max_reports, |
23 | | int max_reports, |
24 | | OpenAPI_list_t* presence_info_list, |
25 | | bool is_max_response_time, |
26 | | int max_response_time, |
27 | | OpenAPI_target_area_t *target_area, |
28 | | OpenAPI_list_t *snssai_filter, |
29 | | OpenAPI_ue_in_area_filter_t *ue_in_area_filter, |
30 | | bool is_min_interval, |
31 | | int min_interval, |
32 | | char *next_report, |
33 | | bool is_idle_status_ind, |
34 | | int idle_status_ind, |
35 | | OpenAPI_dispersion_area_t *dispersion_area, |
36 | | char *next_periodic_report_time, |
37 | | bool is_adjust_ao_ion_ra, |
38 | | int adjust_ao_ion_ra, |
39 | | bool is_ran_timing_synchro_status_change, |
40 | | int ran_timing_synchro_status_change, |
41 | | OpenAPI_list_t *notify_for_supi_list, |
42 | | OpenAPI_list_t *notify_for_group_list, |
43 | | OpenAPI_list_t *notify_for_snssai_dnn_list, |
44 | | bool is_reporting_threshold, |
45 | | int reporting_threshold, |
46 | | OpenAPI_trajectory_t *assign_trajectory, |
47 | | OpenAPI_sm_comm_failure_filter_t *sm_comm_failure_filter, |
48 | | bool is_ue_pos_cap_requested_ind, |
49 | | int ue_pos_cap_requested_ind, |
50 | | OpenAPI_list_t *tw_list, |
51 | | OpenAPI_uav_altitude_reporting_config_t *uav_altitude_reporting_config |
52 | | ) |
53 | 0 | { |
54 | 0 | OpenAPI_amf_event_t *amf_event_local_var = ogs_malloc(sizeof(OpenAPI_amf_event_t)); |
55 | 0 | ogs_assert(amf_event_local_var); |
56 | | |
57 | 0 | amf_event_local_var->type = type; |
58 | 0 | amf_event_local_var->is_immediate_flag = is_immediate_flag; |
59 | 0 | amf_event_local_var->immediate_flag = immediate_flag; |
60 | 0 | amf_event_local_var->area_list = area_list; |
61 | 0 | amf_event_local_var->location_filter_list = location_filter_list; |
62 | 0 | amf_event_local_var->location_trends_filter_list = location_trends_filter_list; |
63 | 0 | amf_event_local_var->is_ref_id = is_ref_id; |
64 | 0 | amf_event_local_var->ref_id = ref_id; |
65 | 0 | amf_event_local_var->traffic_descriptor_list = traffic_descriptor_list; |
66 | 0 | amf_event_local_var->is_report_ue_reachable = is_report_ue_reachable; |
67 | 0 | amf_event_local_var->report_ue_reachable = report_ue_reachable; |
68 | 0 | amf_event_local_var->reachability_filter = reachability_filter; |
69 | 0 | amf_event_local_var->is_udm_detect_ind = is_udm_detect_ind; |
70 | 0 | amf_event_local_var->udm_detect_ind = udm_detect_ind; |
71 | 0 | amf_event_local_var->is_max_reports = is_max_reports; |
72 | 0 | amf_event_local_var->max_reports = max_reports; |
73 | 0 | amf_event_local_var->presence_info_list = presence_info_list; |
74 | 0 | amf_event_local_var->is_max_response_time = is_max_response_time; |
75 | 0 | amf_event_local_var->max_response_time = max_response_time; |
76 | 0 | amf_event_local_var->target_area = target_area; |
77 | 0 | amf_event_local_var->snssai_filter = snssai_filter; |
78 | 0 | amf_event_local_var->ue_in_area_filter = ue_in_area_filter; |
79 | 0 | amf_event_local_var->is_min_interval = is_min_interval; |
80 | 0 | amf_event_local_var->min_interval = min_interval; |
81 | 0 | amf_event_local_var->next_report = next_report; |
82 | 0 | amf_event_local_var->is_idle_status_ind = is_idle_status_ind; |
83 | 0 | amf_event_local_var->idle_status_ind = idle_status_ind; |
84 | 0 | amf_event_local_var->dispersion_area = dispersion_area; |
85 | 0 | amf_event_local_var->next_periodic_report_time = next_periodic_report_time; |
86 | 0 | amf_event_local_var->is_adjust_ao_ion_ra = is_adjust_ao_ion_ra; |
87 | 0 | amf_event_local_var->adjust_ao_ion_ra = adjust_ao_ion_ra; |
88 | 0 | amf_event_local_var->is_ran_timing_synchro_status_change = is_ran_timing_synchro_status_change; |
89 | 0 | amf_event_local_var->ran_timing_synchro_status_change = ran_timing_synchro_status_change; |
90 | 0 | amf_event_local_var->notify_for_supi_list = notify_for_supi_list; |
91 | 0 | amf_event_local_var->notify_for_group_list = notify_for_group_list; |
92 | 0 | amf_event_local_var->notify_for_snssai_dnn_list = notify_for_snssai_dnn_list; |
93 | 0 | amf_event_local_var->is_reporting_threshold = is_reporting_threshold; |
94 | 0 | amf_event_local_var->reporting_threshold = reporting_threshold; |
95 | 0 | amf_event_local_var->assign_trajectory = assign_trajectory; |
96 | 0 | amf_event_local_var->sm_comm_failure_filter = sm_comm_failure_filter; |
97 | 0 | amf_event_local_var->is_ue_pos_cap_requested_ind = is_ue_pos_cap_requested_ind; |
98 | 0 | amf_event_local_var->ue_pos_cap_requested_ind = ue_pos_cap_requested_ind; |
99 | 0 | amf_event_local_var->tw_list = tw_list; |
100 | 0 | amf_event_local_var->uav_altitude_reporting_config = uav_altitude_reporting_config; |
101 | |
|
102 | 0 | return amf_event_local_var; |
103 | 0 | } |
104 | | |
105 | | void OpenAPI_amf_event_free(OpenAPI_amf_event_t *amf_event) |
106 | 0 | { |
107 | 0 | OpenAPI_lnode_t *node = NULL; |
108 | |
|
109 | 0 | if (NULL == amf_event) { |
110 | 0 | return; |
111 | 0 | } |
112 | 0 | if (amf_event->area_list) { |
113 | 0 | OpenAPI_list_for_each(amf_event->area_list, node) { |
114 | 0 | OpenAPI_amf_event_area_free(node->data); |
115 | 0 | } |
116 | 0 | OpenAPI_list_free(amf_event->area_list); |
117 | 0 | amf_event->area_list = NULL; |
118 | 0 | } |
119 | 0 | if (amf_event->location_filter_list) { |
120 | 0 | OpenAPI_list_free(amf_event->location_filter_list); |
121 | 0 | amf_event->location_filter_list = NULL; |
122 | 0 | } |
123 | 0 | if (amf_event->location_trends_filter_list) { |
124 | 0 | OpenAPI_list_free(amf_event->location_trends_filter_list); |
125 | 0 | amf_event->location_trends_filter_list = NULL; |
126 | 0 | } |
127 | 0 | if (amf_event->traffic_descriptor_list) { |
128 | 0 | OpenAPI_list_for_each(amf_event->traffic_descriptor_list, node) { |
129 | 0 | OpenAPI_traffic_descriptor_free(node->data); |
130 | 0 | } |
131 | 0 | OpenAPI_list_free(amf_event->traffic_descriptor_list); |
132 | 0 | amf_event->traffic_descriptor_list = NULL; |
133 | 0 | } |
134 | 0 | if (amf_event->presence_info_list) { |
135 | 0 | OpenAPI_list_for_each(amf_event->presence_info_list, node) { |
136 | 0 | OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; |
137 | 0 | ogs_free(localKeyValue->key); |
138 | 0 | OpenAPI_presence_info_free(localKeyValue->value); |
139 | 0 | OpenAPI_map_free(localKeyValue); |
140 | 0 | } |
141 | 0 | OpenAPI_list_free(amf_event->presence_info_list); |
142 | 0 | amf_event->presence_info_list = NULL; |
143 | 0 | } |
144 | 0 | if (amf_event->target_area) { |
145 | 0 | OpenAPI_target_area_free(amf_event->target_area); |
146 | 0 | amf_event->target_area = NULL; |
147 | 0 | } |
148 | 0 | if (amf_event->snssai_filter) { |
149 | 0 | OpenAPI_list_for_each(amf_event->snssai_filter, node) { |
150 | 0 | OpenAPI_ext_snssai_free(node->data); |
151 | 0 | } |
152 | 0 | OpenAPI_list_free(amf_event->snssai_filter); |
153 | 0 | amf_event->snssai_filter = NULL; |
154 | 0 | } |
155 | 0 | if (amf_event->ue_in_area_filter) { |
156 | 0 | OpenAPI_ue_in_area_filter_free(amf_event->ue_in_area_filter); |
157 | 0 | amf_event->ue_in_area_filter = NULL; |
158 | 0 | } |
159 | 0 | if (amf_event->next_report) { |
160 | 0 | ogs_free(amf_event->next_report); |
161 | 0 | amf_event->next_report = NULL; |
162 | 0 | } |
163 | 0 | if (amf_event->dispersion_area) { |
164 | 0 | OpenAPI_dispersion_area_free(amf_event->dispersion_area); |
165 | 0 | amf_event->dispersion_area = NULL; |
166 | 0 | } |
167 | 0 | if (amf_event->next_periodic_report_time) { |
168 | 0 | ogs_free(amf_event->next_periodic_report_time); |
169 | 0 | amf_event->next_periodic_report_time = NULL; |
170 | 0 | } |
171 | 0 | if (amf_event->notify_for_supi_list) { |
172 | 0 | OpenAPI_list_for_each(amf_event->notify_for_supi_list, node) { |
173 | 0 | ogs_free(node->data); |
174 | 0 | } |
175 | 0 | OpenAPI_list_free(amf_event->notify_for_supi_list); |
176 | 0 | amf_event->notify_for_supi_list = NULL; |
177 | 0 | } |
178 | 0 | if (amf_event->notify_for_group_list) { |
179 | 0 | OpenAPI_list_for_each(amf_event->notify_for_group_list, node) { |
180 | 0 | ogs_free(node->data); |
181 | 0 | } |
182 | 0 | OpenAPI_list_free(amf_event->notify_for_group_list); |
183 | 0 | amf_event->notify_for_group_list = NULL; |
184 | 0 | } |
185 | 0 | if (amf_event->notify_for_snssai_dnn_list) { |
186 | 0 | OpenAPI_list_for_each(amf_event->notify_for_snssai_dnn_list, node) { |
187 | 0 | OpenAPI_snssai_dnn_item_free(node->data); |
188 | 0 | } |
189 | 0 | OpenAPI_list_free(amf_event->notify_for_snssai_dnn_list); |
190 | 0 | amf_event->notify_for_snssai_dnn_list = NULL; |
191 | 0 | } |
192 | 0 | if (amf_event->assign_trajectory) { |
193 | 0 | OpenAPI_trajectory_free(amf_event->assign_trajectory); |
194 | 0 | amf_event->assign_trajectory = NULL; |
195 | 0 | } |
196 | 0 | if (amf_event->sm_comm_failure_filter) { |
197 | 0 | OpenAPI_sm_comm_failure_filter_free(amf_event->sm_comm_failure_filter); |
198 | 0 | amf_event->sm_comm_failure_filter = NULL; |
199 | 0 | } |
200 | 0 | if (amf_event->tw_list) { |
201 | 0 | OpenAPI_list_for_each(amf_event->tw_list, node) { |
202 | 0 | OpenAPI_time_window_free(node->data); |
203 | 0 | } |
204 | 0 | OpenAPI_list_free(amf_event->tw_list); |
205 | 0 | amf_event->tw_list = NULL; |
206 | 0 | } |
207 | 0 | if (amf_event->uav_altitude_reporting_config) { |
208 | 0 | OpenAPI_uav_altitude_reporting_config_free(amf_event->uav_altitude_reporting_config); |
209 | 0 | amf_event->uav_altitude_reporting_config = NULL; |
210 | 0 | } |
211 | 0 | ogs_free(amf_event); |
212 | 0 | } |
213 | | |
214 | | cJSON *OpenAPI_amf_event_convertToJSON(OpenAPI_amf_event_t *amf_event) |
215 | 0 | { |
216 | 0 | cJSON *item = NULL; |
217 | 0 | OpenAPI_lnode_t *node = NULL; |
218 | |
|
219 | 0 | if (amf_event == NULL) { |
220 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [AmfEvent]"); |
221 | 0 | return NULL; |
222 | 0 | } |
223 | | |
224 | 0 | item = cJSON_CreateObject(); |
225 | 0 | if (amf_event->type == OpenAPI_amf_event_type_NULL) { |
226 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [type]"); |
227 | 0 | return NULL; |
228 | 0 | } |
229 | 0 | if (cJSON_AddStringToObject(item, "type", OpenAPI_amf_event_type_ToString(amf_event->type)) == NULL) { |
230 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [type]"); |
231 | 0 | goto end; |
232 | 0 | } |
233 | | |
234 | 0 | if (amf_event->is_immediate_flag) { |
235 | 0 | if (cJSON_AddBoolToObject(item, "immediateFlag", amf_event->immediate_flag) == NULL) { |
236 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [immediate_flag]"); |
237 | 0 | goto end; |
238 | 0 | } |
239 | 0 | } |
240 | | |
241 | 0 | if (amf_event->area_list) { |
242 | 0 | cJSON *area_listList = cJSON_AddArrayToObject(item, "areaList"); |
243 | 0 | if (area_listList == NULL) { |
244 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [area_list]"); |
245 | 0 | goto end; |
246 | 0 | } |
247 | 0 | OpenAPI_list_for_each(amf_event->area_list, node) { |
248 | 0 | cJSON *itemLocal = OpenAPI_amf_event_area_convertToJSON(node->data); |
249 | 0 | if (itemLocal == NULL) { |
250 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [area_list]"); |
251 | 0 | goto end; |
252 | 0 | } |
253 | 0 | cJSON_AddItemToArray(area_listList, itemLocal); |
254 | 0 | } |
255 | 0 | } |
256 | | |
257 | 0 | if (amf_event->location_filter_list != OpenAPI_location_filter_NULL) { |
258 | 0 | cJSON *location_filter_listList = cJSON_AddArrayToObject(item, "locationFilterList"); |
259 | 0 | if (location_filter_listList == NULL) { |
260 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [location_filter_list]"); |
261 | 0 | goto end; |
262 | 0 | } |
263 | 0 | OpenAPI_list_for_each(amf_event->location_filter_list, node) { |
264 | 0 | if (cJSON_AddStringToObject(location_filter_listList, "", OpenAPI_location_filter_ToString((intptr_t)node->data)) == NULL) { |
265 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [location_filter_list]"); |
266 | 0 | goto end; |
267 | 0 | } |
268 | 0 | } |
269 | 0 | } |
270 | | |
271 | 0 | if (amf_event->location_trends_filter_list != OpenAPI_location_filter_NULL) { |
272 | 0 | cJSON *location_trends_filter_listList = cJSON_AddArrayToObject(item, "locationTrendsFilterList"); |
273 | 0 | if (location_trends_filter_listList == NULL) { |
274 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [location_trends_filter_list]"); |
275 | 0 | goto end; |
276 | 0 | } |
277 | 0 | OpenAPI_list_for_each(amf_event->location_trends_filter_list, node) { |
278 | 0 | if (cJSON_AddStringToObject(location_trends_filter_listList, "", OpenAPI_location_filter_ToString((intptr_t)node->data)) == NULL) { |
279 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [location_trends_filter_list]"); |
280 | 0 | goto end; |
281 | 0 | } |
282 | 0 | } |
283 | 0 | } |
284 | | |
285 | 0 | if (amf_event->is_ref_id) { |
286 | 0 | if (cJSON_AddNumberToObject(item, "refId", amf_event->ref_id) == NULL) { |
287 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [ref_id]"); |
288 | 0 | goto end; |
289 | 0 | } |
290 | 0 | } |
291 | | |
292 | 0 | if (amf_event->traffic_descriptor_list) { |
293 | 0 | cJSON *traffic_descriptor_listList = cJSON_AddArrayToObject(item, "trafficDescriptorList"); |
294 | 0 | if (traffic_descriptor_listList == NULL) { |
295 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [traffic_descriptor_list]"); |
296 | 0 | goto end; |
297 | 0 | } |
298 | 0 | OpenAPI_list_for_each(amf_event->traffic_descriptor_list, node) { |
299 | 0 | cJSON *itemLocal = OpenAPI_traffic_descriptor_convertToJSON(node->data); |
300 | 0 | if (itemLocal == NULL) { |
301 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [traffic_descriptor_list]"); |
302 | 0 | goto end; |
303 | 0 | } |
304 | 0 | cJSON_AddItemToArray(traffic_descriptor_listList, itemLocal); |
305 | 0 | } |
306 | 0 | } |
307 | | |
308 | 0 | if (amf_event->is_report_ue_reachable) { |
309 | 0 | if (cJSON_AddBoolToObject(item, "reportUeReachable", amf_event->report_ue_reachable) == NULL) { |
310 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [report_ue_reachable]"); |
311 | 0 | goto end; |
312 | 0 | } |
313 | 0 | } |
314 | | |
315 | 0 | if (amf_event->reachability_filter != OpenAPI_reachability_filter_NULL) { |
316 | 0 | if (cJSON_AddStringToObject(item, "reachabilityFilter", OpenAPI_reachability_filter_ToString(amf_event->reachability_filter)) == NULL) { |
317 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [reachability_filter]"); |
318 | 0 | goto end; |
319 | 0 | } |
320 | 0 | } |
321 | | |
322 | 0 | if (amf_event->is_udm_detect_ind) { |
323 | 0 | if (cJSON_AddBoolToObject(item, "udmDetectInd", amf_event->udm_detect_ind) == NULL) { |
324 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [udm_detect_ind]"); |
325 | 0 | goto end; |
326 | 0 | } |
327 | 0 | } |
328 | | |
329 | 0 | if (amf_event->is_max_reports) { |
330 | 0 | if (cJSON_AddNumberToObject(item, "maxReports", amf_event->max_reports) == NULL) { |
331 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [max_reports]"); |
332 | 0 | goto end; |
333 | 0 | } |
334 | 0 | } |
335 | | |
336 | 0 | if (amf_event->presence_info_list) { |
337 | 0 | cJSON *presence_info_list = cJSON_AddObjectToObject(item, "presenceInfoList"); |
338 | 0 | if (presence_info_list == NULL) { |
339 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [presence_info_list]"); |
340 | 0 | goto end; |
341 | 0 | } |
342 | 0 | cJSON *localMapObject = presence_info_list; |
343 | 0 | if (amf_event->presence_info_list) { |
344 | 0 | OpenAPI_list_for_each(amf_event->presence_info_list, node) { |
345 | 0 | OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; |
346 | 0 | if (localKeyValue == NULL) { |
347 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [presence_info_list]"); |
348 | 0 | goto end; |
349 | 0 | } |
350 | 0 | if (localKeyValue->key == NULL) { |
351 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [presence_info_list]"); |
352 | 0 | goto end; |
353 | 0 | } |
354 | 0 | cJSON *itemLocal = localKeyValue->value ? |
355 | 0 | OpenAPI_presence_info_convertToJSON(localKeyValue->value) : |
356 | 0 | cJSON_CreateNull(); |
357 | 0 | if (itemLocal == NULL) { |
358 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [inner]"); |
359 | 0 | goto end; |
360 | 0 | } |
361 | 0 | cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); |
362 | 0 | } |
363 | 0 | } |
364 | 0 | } |
365 | | |
366 | 0 | if (amf_event->is_max_response_time) { |
367 | 0 | if (cJSON_AddNumberToObject(item, "maxResponseTime", amf_event->max_response_time) == NULL) { |
368 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [max_response_time]"); |
369 | 0 | goto end; |
370 | 0 | } |
371 | 0 | } |
372 | | |
373 | 0 | if (amf_event->target_area) { |
374 | 0 | cJSON *target_area_local_JSON = OpenAPI_target_area_convertToJSON(amf_event->target_area); |
375 | 0 | if (target_area_local_JSON == NULL) { |
376 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [target_area]"); |
377 | 0 | goto end; |
378 | 0 | } |
379 | 0 | cJSON_AddItemToObject(item, "targetArea", target_area_local_JSON); |
380 | 0 | if (item->child == NULL) { |
381 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [target_area]"); |
382 | 0 | goto end; |
383 | 0 | } |
384 | 0 | } |
385 | | |
386 | 0 | if (amf_event->snssai_filter) { |
387 | 0 | cJSON *snssai_filterList = cJSON_AddArrayToObject(item, "snssaiFilter"); |
388 | 0 | if (snssai_filterList == NULL) { |
389 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [snssai_filter]"); |
390 | 0 | goto end; |
391 | 0 | } |
392 | 0 | OpenAPI_list_for_each(amf_event->snssai_filter, node) { |
393 | 0 | cJSON *itemLocal = OpenAPI_ext_snssai_convertToJSON(node->data); |
394 | 0 | if (itemLocal == NULL) { |
395 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [snssai_filter]"); |
396 | 0 | goto end; |
397 | 0 | } |
398 | 0 | cJSON_AddItemToArray(snssai_filterList, itemLocal); |
399 | 0 | } |
400 | 0 | } |
401 | | |
402 | 0 | if (amf_event->ue_in_area_filter) { |
403 | 0 | cJSON *ue_in_area_filter_local_JSON = OpenAPI_ue_in_area_filter_convertToJSON(amf_event->ue_in_area_filter); |
404 | 0 | if (ue_in_area_filter_local_JSON == NULL) { |
405 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [ue_in_area_filter]"); |
406 | 0 | goto end; |
407 | 0 | } |
408 | 0 | cJSON_AddItemToObject(item, "ueInAreaFilter", ue_in_area_filter_local_JSON); |
409 | 0 | if (item->child == NULL) { |
410 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [ue_in_area_filter]"); |
411 | 0 | goto end; |
412 | 0 | } |
413 | 0 | } |
414 | | |
415 | 0 | if (amf_event->is_min_interval) { |
416 | 0 | if (cJSON_AddNumberToObject(item, "minInterval", amf_event->min_interval) == NULL) { |
417 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [min_interval]"); |
418 | 0 | goto end; |
419 | 0 | } |
420 | 0 | } |
421 | | |
422 | 0 | if (amf_event->next_report) { |
423 | 0 | if (cJSON_AddStringToObject(item, "nextReport", amf_event->next_report) == NULL) { |
424 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [next_report]"); |
425 | 0 | goto end; |
426 | 0 | } |
427 | 0 | } |
428 | | |
429 | 0 | if (amf_event->is_idle_status_ind) { |
430 | 0 | if (cJSON_AddBoolToObject(item, "idleStatusInd", amf_event->idle_status_ind) == NULL) { |
431 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [idle_status_ind]"); |
432 | 0 | goto end; |
433 | 0 | } |
434 | 0 | } |
435 | | |
436 | 0 | if (amf_event->dispersion_area) { |
437 | 0 | cJSON *dispersion_area_local_JSON = OpenAPI_dispersion_area_convertToJSON(amf_event->dispersion_area); |
438 | 0 | if (dispersion_area_local_JSON == NULL) { |
439 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [dispersion_area]"); |
440 | 0 | goto end; |
441 | 0 | } |
442 | 0 | cJSON_AddItemToObject(item, "dispersionArea", dispersion_area_local_JSON); |
443 | 0 | if (item->child == NULL) { |
444 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [dispersion_area]"); |
445 | 0 | goto end; |
446 | 0 | } |
447 | 0 | } |
448 | | |
449 | 0 | if (amf_event->next_periodic_report_time) { |
450 | 0 | if (cJSON_AddStringToObject(item, "nextPeriodicReportTime", amf_event->next_periodic_report_time) == NULL) { |
451 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [next_periodic_report_time]"); |
452 | 0 | goto end; |
453 | 0 | } |
454 | 0 | } |
455 | | |
456 | 0 | if (amf_event->is_adjust_ao_ion_ra) { |
457 | 0 | if (cJSON_AddBoolToObject(item, "adjustAoIOnRa", amf_event->adjust_ao_ion_ra) == NULL) { |
458 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [adjust_ao_ion_ra]"); |
459 | 0 | goto end; |
460 | 0 | } |
461 | 0 | } |
462 | | |
463 | 0 | if (amf_event->is_ran_timing_synchro_status_change) { |
464 | 0 | if (cJSON_AddBoolToObject(item, "ranTimingSynchroStatusChange", amf_event->ran_timing_synchro_status_change) == NULL) { |
465 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [ran_timing_synchro_status_change]"); |
466 | 0 | goto end; |
467 | 0 | } |
468 | 0 | } |
469 | | |
470 | 0 | if (amf_event->notify_for_supi_list) { |
471 | 0 | cJSON *notify_for_supi_listList = cJSON_AddArrayToObject(item, "notifyForSupiList"); |
472 | 0 | if (notify_for_supi_listList == NULL) { |
473 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [notify_for_supi_list]"); |
474 | 0 | goto end; |
475 | 0 | } |
476 | 0 | OpenAPI_list_for_each(amf_event->notify_for_supi_list, node) { |
477 | 0 | if (cJSON_AddStringToObject(notify_for_supi_listList, "", (char*)node->data) == NULL) { |
478 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [notify_for_supi_list]"); |
479 | 0 | goto end; |
480 | 0 | } |
481 | 0 | } |
482 | 0 | } |
483 | | |
484 | 0 | if (amf_event->notify_for_group_list) { |
485 | 0 | cJSON *notify_for_group_listList = cJSON_AddArrayToObject(item, "notifyForGroupList"); |
486 | 0 | if (notify_for_group_listList == NULL) { |
487 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [notify_for_group_list]"); |
488 | 0 | goto end; |
489 | 0 | } |
490 | 0 | OpenAPI_list_for_each(amf_event->notify_for_group_list, node) { |
491 | 0 | if (cJSON_AddStringToObject(notify_for_group_listList, "", (char*)node->data) == NULL) { |
492 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [notify_for_group_list]"); |
493 | 0 | goto end; |
494 | 0 | } |
495 | 0 | } |
496 | 0 | } |
497 | | |
498 | 0 | if (amf_event->notify_for_snssai_dnn_list) { |
499 | 0 | cJSON *notify_for_snssai_dnn_listList = cJSON_AddArrayToObject(item, "notifyForSnssaiDnnList"); |
500 | 0 | if (notify_for_snssai_dnn_listList == NULL) { |
501 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [notify_for_snssai_dnn_list]"); |
502 | 0 | goto end; |
503 | 0 | } |
504 | 0 | OpenAPI_list_for_each(amf_event->notify_for_snssai_dnn_list, node) { |
505 | 0 | cJSON *itemLocal = OpenAPI_snssai_dnn_item_convertToJSON(node->data); |
506 | 0 | if (itemLocal == NULL) { |
507 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [notify_for_snssai_dnn_list]"); |
508 | 0 | goto end; |
509 | 0 | } |
510 | 0 | cJSON_AddItemToArray(notify_for_snssai_dnn_listList, itemLocal); |
511 | 0 | } |
512 | 0 | } |
513 | | |
514 | 0 | if (amf_event->is_reporting_threshold) { |
515 | 0 | if (cJSON_AddNumberToObject(item, "reportingThreshold", amf_event->reporting_threshold) == NULL) { |
516 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [reporting_threshold]"); |
517 | 0 | goto end; |
518 | 0 | } |
519 | 0 | } |
520 | | |
521 | 0 | if (amf_event->assign_trajectory) { |
522 | 0 | cJSON *assign_trajectory_local_JSON = OpenAPI_trajectory_convertToJSON(amf_event->assign_trajectory); |
523 | 0 | if (assign_trajectory_local_JSON == NULL) { |
524 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [assign_trajectory]"); |
525 | 0 | goto end; |
526 | 0 | } |
527 | 0 | cJSON_AddItemToObject(item, "assignTrajectory", assign_trajectory_local_JSON); |
528 | 0 | if (item->child == NULL) { |
529 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [assign_trajectory]"); |
530 | 0 | goto end; |
531 | 0 | } |
532 | 0 | } |
533 | | |
534 | 0 | if (amf_event->sm_comm_failure_filter) { |
535 | 0 | cJSON *sm_comm_failure_filter_local_JSON = OpenAPI_sm_comm_failure_filter_convertToJSON(amf_event->sm_comm_failure_filter); |
536 | 0 | if (sm_comm_failure_filter_local_JSON == NULL) { |
537 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [sm_comm_failure_filter]"); |
538 | 0 | goto end; |
539 | 0 | } |
540 | 0 | cJSON_AddItemToObject(item, "smCommFailureFilter", sm_comm_failure_filter_local_JSON); |
541 | 0 | if (item->child == NULL) { |
542 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [sm_comm_failure_filter]"); |
543 | 0 | goto end; |
544 | 0 | } |
545 | 0 | } |
546 | | |
547 | 0 | if (amf_event->is_ue_pos_cap_requested_ind) { |
548 | 0 | if (cJSON_AddBoolToObject(item, "uePosCapRequestedInd", amf_event->ue_pos_cap_requested_ind) == NULL) { |
549 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [ue_pos_cap_requested_ind]"); |
550 | 0 | goto end; |
551 | 0 | } |
552 | 0 | } |
553 | | |
554 | 0 | if (amf_event->tw_list) { |
555 | 0 | cJSON *tw_listList = cJSON_AddArrayToObject(item, "twList"); |
556 | 0 | if (tw_listList == NULL) { |
557 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [tw_list]"); |
558 | 0 | goto end; |
559 | 0 | } |
560 | 0 | OpenAPI_list_for_each(amf_event->tw_list, node) { |
561 | 0 | cJSON *itemLocal = OpenAPI_time_window_convertToJSON(node->data); |
562 | 0 | if (itemLocal == NULL) { |
563 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [tw_list]"); |
564 | 0 | goto end; |
565 | 0 | } |
566 | 0 | cJSON_AddItemToArray(tw_listList, itemLocal); |
567 | 0 | } |
568 | 0 | } |
569 | | |
570 | 0 | if (amf_event->uav_altitude_reporting_config) { |
571 | 0 | cJSON *uav_altitude_reporting_config_local_JSON = OpenAPI_uav_altitude_reporting_config_convertToJSON(amf_event->uav_altitude_reporting_config); |
572 | 0 | if (uav_altitude_reporting_config_local_JSON == NULL) { |
573 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [uav_altitude_reporting_config]"); |
574 | 0 | goto end; |
575 | 0 | } |
576 | 0 | cJSON_AddItemToObject(item, "uavAltitudeReportingConfig", uav_altitude_reporting_config_local_JSON); |
577 | 0 | if (item->child == NULL) { |
578 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed [uav_altitude_reporting_config]"); |
579 | 0 | goto end; |
580 | 0 | } |
581 | 0 | } |
582 | | |
583 | 0 | end: |
584 | 0 | return item; |
585 | 0 | } |
586 | | |
587 | | OpenAPI_amf_event_t *OpenAPI_amf_event_parseFromJSON(cJSON *amf_eventJSON) |
588 | 0 | { |
589 | 0 | OpenAPI_amf_event_t *amf_event_local_var = NULL; |
590 | 0 | OpenAPI_lnode_t *node = NULL; |
591 | 0 | cJSON *type = NULL; |
592 | 0 | OpenAPI_amf_event_type_e typeVariable = 0; |
593 | 0 | cJSON *immediate_flag = NULL; |
594 | 0 | cJSON *area_list = NULL; |
595 | 0 | OpenAPI_list_t *area_listList = NULL; |
596 | 0 | cJSON *location_filter_list = NULL; |
597 | 0 | OpenAPI_list_t *location_filter_listList = NULL; |
598 | 0 | cJSON *location_trends_filter_list = NULL; |
599 | 0 | OpenAPI_list_t *location_trends_filter_listList = NULL; |
600 | 0 | cJSON *ref_id = NULL; |
601 | 0 | cJSON *traffic_descriptor_list = NULL; |
602 | 0 | OpenAPI_list_t *traffic_descriptor_listList = NULL; |
603 | 0 | cJSON *report_ue_reachable = NULL; |
604 | 0 | cJSON *reachability_filter = NULL; |
605 | 0 | OpenAPI_reachability_filter_e reachability_filterVariable = 0; |
606 | 0 | cJSON *udm_detect_ind = NULL; |
607 | 0 | cJSON *max_reports = NULL; |
608 | 0 | cJSON *presence_info_list = NULL; |
609 | 0 | OpenAPI_list_t *presence_info_listList = NULL; |
610 | 0 | cJSON *max_response_time = NULL; |
611 | 0 | cJSON *target_area = NULL; |
612 | 0 | OpenAPI_target_area_t *target_area_local_nonprim = NULL; |
613 | 0 | cJSON *snssai_filter = NULL; |
614 | 0 | OpenAPI_list_t *snssai_filterList = NULL; |
615 | 0 | cJSON *ue_in_area_filter = NULL; |
616 | 0 | OpenAPI_ue_in_area_filter_t *ue_in_area_filter_local_nonprim = NULL; |
617 | 0 | cJSON *min_interval = NULL; |
618 | 0 | cJSON *next_report = NULL; |
619 | 0 | cJSON *idle_status_ind = NULL; |
620 | 0 | cJSON *dispersion_area = NULL; |
621 | 0 | OpenAPI_dispersion_area_t *dispersion_area_local_nonprim = NULL; |
622 | 0 | cJSON *next_periodic_report_time = NULL; |
623 | 0 | cJSON *adjust_ao_ion_ra = NULL; |
624 | 0 | cJSON *ran_timing_synchro_status_change = NULL; |
625 | 0 | cJSON *notify_for_supi_list = NULL; |
626 | 0 | OpenAPI_list_t *notify_for_supi_listList = NULL; |
627 | 0 | cJSON *notify_for_group_list = NULL; |
628 | 0 | OpenAPI_list_t *notify_for_group_listList = NULL; |
629 | 0 | cJSON *notify_for_snssai_dnn_list = NULL; |
630 | 0 | OpenAPI_list_t *notify_for_snssai_dnn_listList = NULL; |
631 | 0 | cJSON *reporting_threshold = NULL; |
632 | 0 | cJSON *assign_trajectory = NULL; |
633 | 0 | OpenAPI_trajectory_t *assign_trajectory_local_nonprim = NULL; |
634 | 0 | cJSON *sm_comm_failure_filter = NULL; |
635 | 0 | OpenAPI_sm_comm_failure_filter_t *sm_comm_failure_filter_local_nonprim = NULL; |
636 | 0 | cJSON *ue_pos_cap_requested_ind = NULL; |
637 | 0 | cJSON *tw_list = NULL; |
638 | 0 | OpenAPI_list_t *tw_listList = NULL; |
639 | 0 | cJSON *uav_altitude_reporting_config = NULL; |
640 | 0 | OpenAPI_uav_altitude_reporting_config_t *uav_altitude_reporting_config_local_nonprim = NULL; |
641 | 0 | type = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "type"); |
642 | 0 | if (!type) { |
643 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [type]"); |
644 | 0 | goto end; |
645 | 0 | } |
646 | 0 | if (!cJSON_IsString(type)) { |
647 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [type]"); |
648 | 0 | goto end; |
649 | 0 | } |
650 | 0 | typeVariable = OpenAPI_amf_event_type_FromString(type->valuestring); |
651 | |
|
652 | 0 | immediate_flag = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "immediateFlag"); |
653 | 0 | if (immediate_flag) { |
654 | 0 | if (!cJSON_IsBool(immediate_flag)) { |
655 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [immediate_flag]"); |
656 | 0 | goto end; |
657 | 0 | } |
658 | 0 | } |
659 | | |
660 | 0 | area_list = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "areaList"); |
661 | 0 | if (area_list) { |
662 | 0 | cJSON *area_list_local = NULL; |
663 | 0 | if (!cJSON_IsArray(area_list)) { |
664 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [area_list]"); |
665 | 0 | goto end; |
666 | 0 | } |
667 | | |
668 | 0 | area_listList = OpenAPI_list_create(); |
669 | |
|
670 | 0 | cJSON_ArrayForEach(area_list_local, area_list) { |
671 | 0 | if (!cJSON_IsObject(area_list_local)) { |
672 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [area_list]"); |
673 | 0 | goto end; |
674 | 0 | } |
675 | 0 | OpenAPI_amf_event_area_t *area_listItem = OpenAPI_amf_event_area_parseFromJSON(area_list_local); |
676 | 0 | if (!area_listItem) { |
677 | 0 | ogs_error("No area_listItem"); |
678 | 0 | goto end; |
679 | 0 | } |
680 | 0 | OpenAPI_list_add(area_listList, area_listItem); |
681 | 0 | } |
682 | 0 | } |
683 | | |
684 | 0 | location_filter_list = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "locationFilterList"); |
685 | 0 | if (location_filter_list) { |
686 | 0 | cJSON *location_filter_list_local = NULL; |
687 | 0 | if (!cJSON_IsArray(location_filter_list)) { |
688 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [location_filter_list]"); |
689 | 0 | goto end; |
690 | 0 | } |
691 | | |
692 | 0 | location_filter_listList = OpenAPI_list_create(); |
693 | |
|
694 | 0 | cJSON_ArrayForEach(location_filter_list_local, location_filter_list) { |
695 | 0 | OpenAPI_location_filter_e localEnum = OpenAPI_location_filter_NULL; |
696 | 0 | if (!cJSON_IsString(location_filter_list_local)) { |
697 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [location_filter_list]"); |
698 | 0 | goto end; |
699 | 0 | } |
700 | 0 | localEnum = OpenAPI_location_filter_FromString(location_filter_list_local->valuestring); |
701 | 0 | if (!localEnum) { |
702 | 0 | ogs_info("Enum value \"%s\" for field \"location_filter_list\" is not supported. Ignoring it ...", |
703 | 0 | location_filter_list_local->valuestring); |
704 | 0 | } else { |
705 | 0 | OpenAPI_list_add(location_filter_listList, (void *)localEnum); |
706 | 0 | } |
707 | 0 | } |
708 | 0 | if (location_filter_listList->count == 0) { |
709 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed: Expected location_filter_listList to not be empty (after ignoring unsupported enum values)."); |
710 | 0 | goto end; |
711 | 0 | } |
712 | 0 | } |
713 | | |
714 | 0 | location_trends_filter_list = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "locationTrendsFilterList"); |
715 | 0 | if (location_trends_filter_list) { |
716 | 0 | cJSON *location_trends_filter_list_local = NULL; |
717 | 0 | if (!cJSON_IsArray(location_trends_filter_list)) { |
718 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [location_trends_filter_list]"); |
719 | 0 | goto end; |
720 | 0 | } |
721 | | |
722 | 0 | location_trends_filter_listList = OpenAPI_list_create(); |
723 | |
|
724 | 0 | cJSON_ArrayForEach(location_trends_filter_list_local, location_trends_filter_list) { |
725 | 0 | OpenAPI_location_filter_e localEnum = OpenAPI_location_filter_NULL; |
726 | 0 | if (!cJSON_IsString(location_trends_filter_list_local)) { |
727 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [location_trends_filter_list]"); |
728 | 0 | goto end; |
729 | 0 | } |
730 | 0 | localEnum = OpenAPI_location_filter_FromString(location_trends_filter_list_local->valuestring); |
731 | 0 | if (!localEnum) { |
732 | 0 | ogs_info("Enum value \"%s\" for field \"location_trends_filter_list\" is not supported. Ignoring it ...", |
733 | 0 | location_trends_filter_list_local->valuestring); |
734 | 0 | } else { |
735 | 0 | OpenAPI_list_add(location_trends_filter_listList, (void *)localEnum); |
736 | 0 | } |
737 | 0 | } |
738 | 0 | if (location_trends_filter_listList->count == 0) { |
739 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed: Expected location_trends_filter_listList to not be empty (after ignoring unsupported enum values)."); |
740 | 0 | goto end; |
741 | 0 | } |
742 | 0 | } |
743 | | |
744 | 0 | ref_id = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "refId"); |
745 | 0 | if (ref_id) { |
746 | 0 | if (!cJSON_IsNumber(ref_id)) { |
747 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [ref_id]"); |
748 | 0 | goto end; |
749 | 0 | } |
750 | 0 | } |
751 | | |
752 | 0 | traffic_descriptor_list = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "trafficDescriptorList"); |
753 | 0 | if (traffic_descriptor_list) { |
754 | 0 | cJSON *traffic_descriptor_list_local = NULL; |
755 | 0 | if (!cJSON_IsArray(traffic_descriptor_list)) { |
756 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [traffic_descriptor_list]"); |
757 | 0 | goto end; |
758 | 0 | } |
759 | | |
760 | 0 | traffic_descriptor_listList = OpenAPI_list_create(); |
761 | |
|
762 | 0 | cJSON_ArrayForEach(traffic_descriptor_list_local, traffic_descriptor_list) { |
763 | 0 | if (!cJSON_IsObject(traffic_descriptor_list_local)) { |
764 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [traffic_descriptor_list]"); |
765 | 0 | goto end; |
766 | 0 | } |
767 | 0 | OpenAPI_traffic_descriptor_t *traffic_descriptor_listItem = OpenAPI_traffic_descriptor_parseFromJSON(traffic_descriptor_list_local); |
768 | 0 | if (!traffic_descriptor_listItem) { |
769 | 0 | ogs_error("No traffic_descriptor_listItem"); |
770 | 0 | goto end; |
771 | 0 | } |
772 | 0 | OpenAPI_list_add(traffic_descriptor_listList, traffic_descriptor_listItem); |
773 | 0 | } |
774 | 0 | } |
775 | | |
776 | 0 | report_ue_reachable = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "reportUeReachable"); |
777 | 0 | if (report_ue_reachable) { |
778 | 0 | if (!cJSON_IsBool(report_ue_reachable)) { |
779 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [report_ue_reachable]"); |
780 | 0 | goto end; |
781 | 0 | } |
782 | 0 | } |
783 | | |
784 | 0 | reachability_filter = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "reachabilityFilter"); |
785 | 0 | if (reachability_filter) { |
786 | 0 | if (!cJSON_IsString(reachability_filter)) { |
787 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [reachability_filter]"); |
788 | 0 | goto end; |
789 | 0 | } |
790 | 0 | reachability_filterVariable = OpenAPI_reachability_filter_FromString(reachability_filter->valuestring); |
791 | 0 | } |
792 | | |
793 | 0 | udm_detect_ind = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "udmDetectInd"); |
794 | 0 | if (udm_detect_ind) { |
795 | 0 | if (!cJSON_IsBool(udm_detect_ind)) { |
796 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [udm_detect_ind]"); |
797 | 0 | goto end; |
798 | 0 | } |
799 | 0 | } |
800 | | |
801 | 0 | max_reports = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "maxReports"); |
802 | 0 | if (max_reports) { |
803 | 0 | if (!cJSON_IsNumber(max_reports)) { |
804 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [max_reports]"); |
805 | 0 | goto end; |
806 | 0 | } |
807 | 0 | } |
808 | | |
809 | 0 | presence_info_list = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "presenceInfoList"); |
810 | 0 | if (presence_info_list) { |
811 | 0 | cJSON *presence_info_list_local_map = NULL; |
812 | 0 | if (!cJSON_IsObject(presence_info_list) && !cJSON_IsNull(presence_info_list)) { |
813 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [presence_info_list]"); |
814 | 0 | goto end; |
815 | 0 | } |
816 | 0 | if (cJSON_IsObject(presence_info_list)) { |
817 | 0 | presence_info_listList = OpenAPI_list_create(); |
818 | 0 | OpenAPI_map_t *localMapKeyPair = NULL; |
819 | 0 | cJSON_ArrayForEach(presence_info_list_local_map, presence_info_list) { |
820 | 0 | cJSON *localMapObject = presence_info_list_local_map; |
821 | 0 | if (cJSON_IsObject(localMapObject)) { |
822 | 0 | localMapKeyPair = OpenAPI_map_create( |
823 | 0 | ogs_strdup(localMapObject->string), OpenAPI_presence_info_parseFromJSON(localMapObject)); |
824 | 0 | } else if (cJSON_IsNull(localMapObject)) { |
825 | 0 | localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); |
826 | 0 | } else { |
827 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [inner]"); |
828 | 0 | goto end; |
829 | 0 | } |
830 | 0 | if (localMapKeyPair == NULL) { |
831 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [presence_info_list]"); |
832 | 0 | goto end; |
833 | 0 | } |
834 | 0 | OpenAPI_list_add(presence_info_listList, localMapKeyPair); |
835 | 0 | } |
836 | 0 | } |
837 | 0 | } |
838 | | |
839 | 0 | max_response_time = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "maxResponseTime"); |
840 | 0 | if (max_response_time) { |
841 | 0 | if (!cJSON_IsNumber(max_response_time)) { |
842 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [max_response_time]"); |
843 | 0 | goto end; |
844 | 0 | } |
845 | 0 | } |
846 | | |
847 | 0 | target_area = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "targetArea"); |
848 | 0 | if (target_area) { |
849 | 0 | target_area_local_nonprim = OpenAPI_target_area_parseFromJSON(target_area); |
850 | 0 | if (!target_area_local_nonprim) { |
851 | 0 | ogs_error("OpenAPI_target_area_parseFromJSON failed [target_area]"); |
852 | 0 | goto end; |
853 | 0 | } |
854 | 0 | } |
855 | | |
856 | 0 | snssai_filter = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "snssaiFilter"); |
857 | 0 | if (snssai_filter) { |
858 | 0 | cJSON *snssai_filter_local = NULL; |
859 | 0 | if (!cJSON_IsArray(snssai_filter)) { |
860 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [snssai_filter]"); |
861 | 0 | goto end; |
862 | 0 | } |
863 | | |
864 | 0 | snssai_filterList = OpenAPI_list_create(); |
865 | |
|
866 | 0 | cJSON_ArrayForEach(snssai_filter_local, snssai_filter) { |
867 | 0 | if (!cJSON_IsObject(snssai_filter_local)) { |
868 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [snssai_filter]"); |
869 | 0 | goto end; |
870 | 0 | } |
871 | 0 | OpenAPI_ext_snssai_t *snssai_filterItem = OpenAPI_ext_snssai_parseFromJSON(snssai_filter_local); |
872 | 0 | if (!snssai_filterItem) { |
873 | 0 | ogs_error("No snssai_filterItem"); |
874 | 0 | goto end; |
875 | 0 | } |
876 | 0 | OpenAPI_list_add(snssai_filterList, snssai_filterItem); |
877 | 0 | } |
878 | 0 | } |
879 | | |
880 | 0 | ue_in_area_filter = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "ueInAreaFilter"); |
881 | 0 | if (ue_in_area_filter) { |
882 | 0 | ue_in_area_filter_local_nonprim = OpenAPI_ue_in_area_filter_parseFromJSON(ue_in_area_filter); |
883 | 0 | if (!ue_in_area_filter_local_nonprim) { |
884 | 0 | ogs_error("OpenAPI_ue_in_area_filter_parseFromJSON failed [ue_in_area_filter]"); |
885 | 0 | goto end; |
886 | 0 | } |
887 | 0 | } |
888 | | |
889 | 0 | min_interval = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "minInterval"); |
890 | 0 | if (min_interval) { |
891 | 0 | if (!cJSON_IsNumber(min_interval)) { |
892 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [min_interval]"); |
893 | 0 | goto end; |
894 | 0 | } |
895 | 0 | } |
896 | | |
897 | 0 | next_report = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "nextReport"); |
898 | 0 | if (next_report) { |
899 | 0 | if (!cJSON_IsString(next_report) && !cJSON_IsNull(next_report)) { |
900 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [next_report]"); |
901 | 0 | goto end; |
902 | 0 | } |
903 | 0 | } |
904 | | |
905 | 0 | idle_status_ind = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "idleStatusInd"); |
906 | 0 | if (idle_status_ind) { |
907 | 0 | if (!cJSON_IsBool(idle_status_ind)) { |
908 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [idle_status_ind]"); |
909 | 0 | goto end; |
910 | 0 | } |
911 | 0 | } |
912 | | |
913 | 0 | dispersion_area = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "dispersionArea"); |
914 | 0 | if (dispersion_area) { |
915 | 0 | dispersion_area_local_nonprim = OpenAPI_dispersion_area_parseFromJSON(dispersion_area); |
916 | 0 | if (!dispersion_area_local_nonprim) { |
917 | 0 | ogs_error("OpenAPI_dispersion_area_parseFromJSON failed [dispersion_area]"); |
918 | 0 | goto end; |
919 | 0 | } |
920 | 0 | } |
921 | | |
922 | 0 | next_periodic_report_time = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "nextPeriodicReportTime"); |
923 | 0 | if (next_periodic_report_time) { |
924 | 0 | if (!cJSON_IsString(next_periodic_report_time) && !cJSON_IsNull(next_periodic_report_time)) { |
925 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [next_periodic_report_time]"); |
926 | 0 | goto end; |
927 | 0 | } |
928 | 0 | } |
929 | | |
930 | 0 | adjust_ao_ion_ra = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "adjustAoIOnRa"); |
931 | 0 | if (adjust_ao_ion_ra) { |
932 | 0 | if (!cJSON_IsBool(adjust_ao_ion_ra)) { |
933 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [adjust_ao_ion_ra]"); |
934 | 0 | goto end; |
935 | 0 | } |
936 | 0 | } |
937 | | |
938 | 0 | ran_timing_synchro_status_change = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "ranTimingSynchroStatusChange"); |
939 | 0 | if (ran_timing_synchro_status_change) { |
940 | 0 | if (!cJSON_IsBool(ran_timing_synchro_status_change)) { |
941 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [ran_timing_synchro_status_change]"); |
942 | 0 | goto end; |
943 | 0 | } |
944 | 0 | } |
945 | | |
946 | 0 | notify_for_supi_list = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "notifyForSupiList"); |
947 | 0 | if (notify_for_supi_list) { |
948 | 0 | cJSON *notify_for_supi_list_local = NULL; |
949 | 0 | if (!cJSON_IsArray(notify_for_supi_list)) { |
950 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [notify_for_supi_list]"); |
951 | 0 | goto end; |
952 | 0 | } |
953 | | |
954 | 0 | notify_for_supi_listList = OpenAPI_list_create(); |
955 | |
|
956 | 0 | cJSON_ArrayForEach(notify_for_supi_list_local, notify_for_supi_list) { |
957 | 0 | double *localDouble = NULL; |
958 | 0 | int *localInt = NULL; |
959 | 0 | if (!cJSON_IsString(notify_for_supi_list_local)) { |
960 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [notify_for_supi_list]"); |
961 | 0 | goto end; |
962 | 0 | } |
963 | 0 | OpenAPI_list_add(notify_for_supi_listList, ogs_strdup(notify_for_supi_list_local->valuestring)); |
964 | 0 | } |
965 | 0 | } |
966 | | |
967 | 0 | notify_for_group_list = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "notifyForGroupList"); |
968 | 0 | if (notify_for_group_list) { |
969 | 0 | cJSON *notify_for_group_list_local = NULL; |
970 | 0 | if (!cJSON_IsArray(notify_for_group_list)) { |
971 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [notify_for_group_list]"); |
972 | 0 | goto end; |
973 | 0 | } |
974 | | |
975 | 0 | notify_for_group_listList = OpenAPI_list_create(); |
976 | |
|
977 | 0 | cJSON_ArrayForEach(notify_for_group_list_local, notify_for_group_list) { |
978 | 0 | double *localDouble = NULL; |
979 | 0 | int *localInt = NULL; |
980 | 0 | if (!cJSON_IsString(notify_for_group_list_local)) { |
981 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [notify_for_group_list]"); |
982 | 0 | goto end; |
983 | 0 | } |
984 | 0 | OpenAPI_list_add(notify_for_group_listList, ogs_strdup(notify_for_group_list_local->valuestring)); |
985 | 0 | } |
986 | 0 | } |
987 | | |
988 | 0 | notify_for_snssai_dnn_list = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "notifyForSnssaiDnnList"); |
989 | 0 | if (notify_for_snssai_dnn_list) { |
990 | 0 | cJSON *notify_for_snssai_dnn_list_local = NULL; |
991 | 0 | if (!cJSON_IsArray(notify_for_snssai_dnn_list)) { |
992 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [notify_for_snssai_dnn_list]"); |
993 | 0 | goto end; |
994 | 0 | } |
995 | | |
996 | 0 | notify_for_snssai_dnn_listList = OpenAPI_list_create(); |
997 | |
|
998 | 0 | cJSON_ArrayForEach(notify_for_snssai_dnn_list_local, notify_for_snssai_dnn_list) { |
999 | 0 | if (!cJSON_IsObject(notify_for_snssai_dnn_list_local)) { |
1000 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [notify_for_snssai_dnn_list]"); |
1001 | 0 | goto end; |
1002 | 0 | } |
1003 | 0 | OpenAPI_snssai_dnn_item_t *notify_for_snssai_dnn_listItem = OpenAPI_snssai_dnn_item_parseFromJSON(notify_for_snssai_dnn_list_local); |
1004 | 0 | if (!notify_for_snssai_dnn_listItem) { |
1005 | 0 | ogs_error("No notify_for_snssai_dnn_listItem"); |
1006 | 0 | goto end; |
1007 | 0 | } |
1008 | 0 | OpenAPI_list_add(notify_for_snssai_dnn_listList, notify_for_snssai_dnn_listItem); |
1009 | 0 | } |
1010 | 0 | } |
1011 | | |
1012 | 0 | reporting_threshold = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "reportingThreshold"); |
1013 | 0 | if (reporting_threshold) { |
1014 | 0 | if (!cJSON_IsNumber(reporting_threshold)) { |
1015 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [reporting_threshold]"); |
1016 | 0 | goto end; |
1017 | 0 | } |
1018 | 0 | } |
1019 | | |
1020 | 0 | assign_trajectory = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "assignTrajectory"); |
1021 | 0 | if (assign_trajectory) { |
1022 | 0 | assign_trajectory_local_nonprim = OpenAPI_trajectory_parseFromJSON(assign_trajectory); |
1023 | 0 | if (!assign_trajectory_local_nonprim) { |
1024 | 0 | ogs_error("OpenAPI_trajectory_parseFromJSON failed [assign_trajectory]"); |
1025 | 0 | goto end; |
1026 | 0 | } |
1027 | 0 | } |
1028 | | |
1029 | 0 | sm_comm_failure_filter = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "smCommFailureFilter"); |
1030 | 0 | if (sm_comm_failure_filter) { |
1031 | 0 | sm_comm_failure_filter_local_nonprim = OpenAPI_sm_comm_failure_filter_parseFromJSON(sm_comm_failure_filter); |
1032 | 0 | if (!sm_comm_failure_filter_local_nonprim) { |
1033 | 0 | ogs_error("OpenAPI_sm_comm_failure_filter_parseFromJSON failed [sm_comm_failure_filter]"); |
1034 | 0 | goto end; |
1035 | 0 | } |
1036 | 0 | } |
1037 | | |
1038 | 0 | ue_pos_cap_requested_ind = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "uePosCapRequestedInd"); |
1039 | 0 | if (ue_pos_cap_requested_ind) { |
1040 | 0 | if (!cJSON_IsBool(ue_pos_cap_requested_ind)) { |
1041 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [ue_pos_cap_requested_ind]"); |
1042 | 0 | goto end; |
1043 | 0 | } |
1044 | 0 | } |
1045 | | |
1046 | 0 | tw_list = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "twList"); |
1047 | 0 | if (tw_list) { |
1048 | 0 | cJSON *tw_list_local = NULL; |
1049 | 0 | if (!cJSON_IsArray(tw_list)) { |
1050 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [tw_list]"); |
1051 | 0 | goto end; |
1052 | 0 | } |
1053 | | |
1054 | 0 | tw_listList = OpenAPI_list_create(); |
1055 | |
|
1056 | 0 | cJSON_ArrayForEach(tw_list_local, tw_list) { |
1057 | 0 | if (!cJSON_IsObject(tw_list_local)) { |
1058 | 0 | ogs_error("OpenAPI_amf_event_parseFromJSON() failed [tw_list]"); |
1059 | 0 | goto end; |
1060 | 0 | } |
1061 | 0 | OpenAPI_time_window_t *tw_listItem = OpenAPI_time_window_parseFromJSON(tw_list_local); |
1062 | 0 | if (!tw_listItem) { |
1063 | 0 | ogs_error("No tw_listItem"); |
1064 | 0 | goto end; |
1065 | 0 | } |
1066 | 0 | OpenAPI_list_add(tw_listList, tw_listItem); |
1067 | 0 | } |
1068 | 0 | } |
1069 | | |
1070 | 0 | uav_altitude_reporting_config = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "uavAltitudeReportingConfig"); |
1071 | 0 | if (uav_altitude_reporting_config) { |
1072 | 0 | uav_altitude_reporting_config_local_nonprim = OpenAPI_uav_altitude_reporting_config_parseFromJSON(uav_altitude_reporting_config); |
1073 | 0 | if (!uav_altitude_reporting_config_local_nonprim) { |
1074 | 0 | ogs_error("OpenAPI_uav_altitude_reporting_config_parseFromJSON failed [uav_altitude_reporting_config]"); |
1075 | 0 | goto end; |
1076 | 0 | } |
1077 | 0 | } |
1078 | | |
1079 | 0 | amf_event_local_var = OpenAPI_amf_event_create ( |
1080 | 0 | typeVariable, |
1081 | 0 | immediate_flag ? true : false, |
1082 | 0 | immediate_flag ? immediate_flag->valueint : 0, |
1083 | 0 | area_list ? area_listList : NULL, |
1084 | 0 | location_filter_list ? location_filter_listList : NULL, |
1085 | 0 | location_trends_filter_list ? location_trends_filter_listList : NULL, |
1086 | 0 | ref_id ? true : false, |
1087 | 0 | ref_id ? ref_id->valuedouble : 0, |
1088 | 0 | traffic_descriptor_list ? traffic_descriptor_listList : NULL, |
1089 | 0 | report_ue_reachable ? true : false, |
1090 | 0 | report_ue_reachable ? report_ue_reachable->valueint : 0, |
1091 | 0 | reachability_filter ? reachability_filterVariable : 0, |
1092 | 0 | udm_detect_ind ? true : false, |
1093 | 0 | udm_detect_ind ? udm_detect_ind->valueint : 0, |
1094 | 0 | max_reports ? true : false, |
1095 | 0 | max_reports ? max_reports->valuedouble : 0, |
1096 | 0 | presence_info_list ? presence_info_listList : NULL, |
1097 | 0 | max_response_time ? true : false, |
1098 | 0 | max_response_time ? max_response_time->valuedouble : 0, |
1099 | 0 | target_area ? target_area_local_nonprim : NULL, |
1100 | 0 | snssai_filter ? snssai_filterList : NULL, |
1101 | 0 | ue_in_area_filter ? ue_in_area_filter_local_nonprim : NULL, |
1102 | 0 | min_interval ? true : false, |
1103 | 0 | min_interval ? min_interval->valuedouble : 0, |
1104 | 0 | next_report && !cJSON_IsNull(next_report) ? ogs_strdup(next_report->valuestring) : NULL, |
1105 | 0 | idle_status_ind ? true : false, |
1106 | 0 | idle_status_ind ? idle_status_ind->valueint : 0, |
1107 | 0 | dispersion_area ? dispersion_area_local_nonprim : NULL, |
1108 | 0 | next_periodic_report_time && !cJSON_IsNull(next_periodic_report_time) ? ogs_strdup(next_periodic_report_time->valuestring) : NULL, |
1109 | 0 | adjust_ao_ion_ra ? true : false, |
1110 | 0 | adjust_ao_ion_ra ? adjust_ao_ion_ra->valueint : 0, |
1111 | 0 | ran_timing_synchro_status_change ? true : false, |
1112 | 0 | ran_timing_synchro_status_change ? ran_timing_synchro_status_change->valueint : 0, |
1113 | 0 | notify_for_supi_list ? notify_for_supi_listList : NULL, |
1114 | 0 | notify_for_group_list ? notify_for_group_listList : NULL, |
1115 | 0 | notify_for_snssai_dnn_list ? notify_for_snssai_dnn_listList : NULL, |
1116 | 0 | reporting_threshold ? true : false, |
1117 | 0 | reporting_threshold ? reporting_threshold->valuedouble : 0, |
1118 | 0 | assign_trajectory ? assign_trajectory_local_nonprim : NULL, |
1119 | 0 | sm_comm_failure_filter ? sm_comm_failure_filter_local_nonprim : NULL, |
1120 | 0 | ue_pos_cap_requested_ind ? true : false, |
1121 | 0 | ue_pos_cap_requested_ind ? ue_pos_cap_requested_ind->valueint : 0, |
1122 | 0 | tw_list ? tw_listList : NULL, |
1123 | 0 | uav_altitude_reporting_config ? uav_altitude_reporting_config_local_nonprim : NULL |
1124 | 0 | ); |
1125 | |
|
1126 | 0 | return amf_event_local_var; |
1127 | 0 | end: |
1128 | 0 | if (area_listList) { |
1129 | 0 | OpenAPI_list_for_each(area_listList, node) { |
1130 | 0 | OpenAPI_amf_event_area_free(node->data); |
1131 | 0 | } |
1132 | 0 | OpenAPI_list_free(area_listList); |
1133 | 0 | area_listList = NULL; |
1134 | 0 | } |
1135 | 0 | if (location_filter_listList) { |
1136 | 0 | OpenAPI_list_free(location_filter_listList); |
1137 | 0 | location_filter_listList = NULL; |
1138 | 0 | } |
1139 | 0 | if (location_trends_filter_listList) { |
1140 | 0 | OpenAPI_list_free(location_trends_filter_listList); |
1141 | 0 | location_trends_filter_listList = NULL; |
1142 | 0 | } |
1143 | 0 | if (traffic_descriptor_listList) { |
1144 | 0 | OpenAPI_list_for_each(traffic_descriptor_listList, node) { |
1145 | 0 | OpenAPI_traffic_descriptor_free(node->data); |
1146 | 0 | } |
1147 | 0 | OpenAPI_list_free(traffic_descriptor_listList); |
1148 | 0 | traffic_descriptor_listList = NULL; |
1149 | 0 | } |
1150 | 0 | if (presence_info_listList) { |
1151 | 0 | OpenAPI_list_for_each(presence_info_listList, node) { |
1152 | 0 | OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; |
1153 | 0 | ogs_free(localKeyValue->key); |
1154 | 0 | OpenAPI_presence_info_free(localKeyValue->value); |
1155 | 0 | OpenAPI_map_free(localKeyValue); |
1156 | 0 | } |
1157 | 0 | OpenAPI_list_free(presence_info_listList); |
1158 | 0 | presence_info_listList = NULL; |
1159 | 0 | } |
1160 | 0 | if (target_area_local_nonprim) { |
1161 | 0 | OpenAPI_target_area_free(target_area_local_nonprim); |
1162 | 0 | target_area_local_nonprim = NULL; |
1163 | 0 | } |
1164 | 0 | if (snssai_filterList) { |
1165 | 0 | OpenAPI_list_for_each(snssai_filterList, node) { |
1166 | 0 | OpenAPI_ext_snssai_free(node->data); |
1167 | 0 | } |
1168 | 0 | OpenAPI_list_free(snssai_filterList); |
1169 | 0 | snssai_filterList = NULL; |
1170 | 0 | } |
1171 | 0 | if (ue_in_area_filter_local_nonprim) { |
1172 | 0 | OpenAPI_ue_in_area_filter_free(ue_in_area_filter_local_nonprim); |
1173 | 0 | ue_in_area_filter_local_nonprim = NULL; |
1174 | 0 | } |
1175 | 0 | if (dispersion_area_local_nonprim) { |
1176 | 0 | OpenAPI_dispersion_area_free(dispersion_area_local_nonprim); |
1177 | 0 | dispersion_area_local_nonprim = NULL; |
1178 | 0 | } |
1179 | 0 | if (notify_for_supi_listList) { |
1180 | 0 | OpenAPI_list_for_each(notify_for_supi_listList, node) { |
1181 | 0 | ogs_free(node->data); |
1182 | 0 | } |
1183 | 0 | OpenAPI_list_free(notify_for_supi_listList); |
1184 | 0 | notify_for_supi_listList = NULL; |
1185 | 0 | } |
1186 | 0 | if (notify_for_group_listList) { |
1187 | 0 | OpenAPI_list_for_each(notify_for_group_listList, node) { |
1188 | 0 | ogs_free(node->data); |
1189 | 0 | } |
1190 | 0 | OpenAPI_list_free(notify_for_group_listList); |
1191 | 0 | notify_for_group_listList = NULL; |
1192 | 0 | } |
1193 | 0 | if (notify_for_snssai_dnn_listList) { |
1194 | 0 | OpenAPI_list_for_each(notify_for_snssai_dnn_listList, node) { |
1195 | 0 | OpenAPI_snssai_dnn_item_free(node->data); |
1196 | 0 | } |
1197 | 0 | OpenAPI_list_free(notify_for_snssai_dnn_listList); |
1198 | 0 | notify_for_snssai_dnn_listList = NULL; |
1199 | 0 | } |
1200 | 0 | if (assign_trajectory_local_nonprim) { |
1201 | 0 | OpenAPI_trajectory_free(assign_trajectory_local_nonprim); |
1202 | 0 | assign_trajectory_local_nonprim = NULL; |
1203 | 0 | } |
1204 | 0 | if (sm_comm_failure_filter_local_nonprim) { |
1205 | 0 | OpenAPI_sm_comm_failure_filter_free(sm_comm_failure_filter_local_nonprim); |
1206 | 0 | sm_comm_failure_filter_local_nonprim = NULL; |
1207 | 0 | } |
1208 | 0 | if (tw_listList) { |
1209 | 0 | OpenAPI_list_for_each(tw_listList, node) { |
1210 | 0 | OpenAPI_time_window_free(node->data); |
1211 | 0 | } |
1212 | 0 | OpenAPI_list_free(tw_listList); |
1213 | 0 | tw_listList = NULL; |
1214 | 0 | } |
1215 | 0 | if (uav_altitude_reporting_config_local_nonprim) { |
1216 | 0 | OpenAPI_uav_altitude_reporting_config_free(uav_altitude_reporting_config_local_nonprim); |
1217 | 0 | uav_altitude_reporting_config_local_nonprim = NULL; |
1218 | 0 | } |
1219 | 0 | return NULL; |
1220 | 0 | } |
1221 | | |
1222 | | OpenAPI_amf_event_t *OpenAPI_amf_event_copy(OpenAPI_amf_event_t *dst, OpenAPI_amf_event_t *src) |
1223 | 0 | { |
1224 | 0 | cJSON *item = NULL; |
1225 | 0 | char *content = NULL; |
1226 | |
|
1227 | 0 | ogs_assert(src); |
1228 | 0 | item = OpenAPI_amf_event_convertToJSON(src); |
1229 | 0 | if (!item) { |
1230 | 0 | ogs_error("OpenAPI_amf_event_convertToJSON() failed"); |
1231 | 0 | return NULL; |
1232 | 0 | } |
1233 | | |
1234 | 0 | content = cJSON_Print(item); |
1235 | 0 | cJSON_Delete(item); |
1236 | |
|
1237 | 0 | if (!content) { |
1238 | 0 | ogs_error("cJSON_Print() failed"); |
1239 | 0 | return NULL; |
1240 | 0 | } |
1241 | | |
1242 | 0 | item = cJSON_Parse(content); |
1243 | 0 | ogs_free(content); |
1244 | 0 | if (!item) { |
1245 | 0 | ogs_error("cJSON_Parse() failed"); |
1246 | 0 | return NULL; |
1247 | 0 | } |
1248 | | |
1249 | 0 | OpenAPI_amf_event_free(dst); |
1250 | 0 | dst = OpenAPI_amf_event_parseFromJSON(item); |
1251 | 0 | cJSON_Delete(item); |
1252 | |
|
1253 | 0 | return dst; |
1254 | 0 | } |
1255 | | |