Initial OpenECOMP Demo commit
[demo.git] / vnfs / VES / code / evel_library / evel_service.c
1 /**************************************************************************//**
2  * @file
3  * Implementation of EVEL functions relating to Service.
4  *
5  * License
6  * -------
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright notice,
12  *    this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright notice,
14  *    this list of conditions and the following disclaimer in the documentation
15  *    and/or other materials provided with the distribution.
16  * 3. All advertising materials mentioning features or use of this software
17  *    must display the following acknowledgement:  This product includes
18  *    software developed by the AT&T.
19  * 4. Neither the name of AT&T nor the names of its contributors may be used to
20  *    endorse or promote products derived from this software without specific
21  *    prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY AT&T INTELLECTUAL PROPERTY ''AS IS'' AND ANY
24  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26  * DISCLAIMED. IN NO EVENT SHALL AT&T INTELLECTUAL PROPERTY BE LIABLE FOR ANY
27  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  *****************************************************************************/
34
35 #include <string.h>
36 #include <assert.h>
37 #include <stdlib.h>
38
39 #include "evel_throttle.h"
40
41 /**************************************************************************//**
42  * Create a new Service event.
43  *
44  * @note    The mandatory fields on the Service must be supplied to
45  *          this factory function and are immutable once set.  Optional fields
46  *          have explicit setter functions, but again values may only be set
47  *          once so that the event has immutable properties.
48  * @param vendor_id     The vendor id to encode in the event instance id.
49  * @param event_id      The vendor event id to encode in the event instance id.
50  * @returns pointer to the newly manufactured ::EVENT_SERVICE.  If the event
51  *          is not used (i.e. posted) it must be released using
52  *          ::evel_free_service.
53  * @retval  NULL  Failed to create the event.
54  *****************************************************************************/
55 EVENT_SERVICE * evel_new_service(const char * const vendor_id,
56                                  const char * const event_id)
57 {
58   EVENT_SERVICE * event = NULL;
59
60   EVEL_ENTER();
61
62   /***************************************************************************/
63   /* Check preconditions.                                                    */
64   /***************************************************************************/
65   assert(vendor_id != NULL);
66   assert(event_id != NULL);
67
68   /***************************************************************************/
69   /* Allocate the Service event.                                           */
70   /***************************************************************************/
71   event = malloc(sizeof(EVENT_SERVICE));
72   if (event == NULL)
73   {
74     log_error_state("Out of memory");
75     goto exit_label;
76   }
77   memset(event, 0, sizeof(EVENT_SERVICE));
78   EVEL_DEBUG("New Service event is at %lp", event);
79
80   /***************************************************************************/
81   /* Initialize the header & the Service fields.                           */
82   /***************************************************************************/
83   evel_init_header(&event->header);
84   event->header.event_domain = EVEL_DOMAIN_SERVICE;
85   event->major_version = EVEL_SERVICE_MAJOR_VERSION;
86   event->minor_version = EVEL_SERVICE_MINOR_VERSION;
87   evel_init_event_instance_id(&event->instance_id, vendor_id, event_id);
88   evel_init_option_string(&event->correlator);
89   dlist_initialize(&event->additional_fields);
90   evel_init_option_string(&event->codec);
91   evel_init_option_string(&event->callee_side_codec);
92   evel_init_option_string(&event->caller_side_codec);
93   evel_init_option_string(&event->rtcp_data);
94   evel_init_option_string(&event->adjacency_name);
95   evel_init_option_string(&event->endpoint_description);
96   evel_init_option_int(&event->endpoint_jitter);
97   evel_init_option_int(&event->endpoint_rtp_oct_disc);
98   evel_init_option_int(&event->endpoint_rtp_oct_recv);
99   evel_init_option_int(&event->endpoint_rtp_oct_sent);
100   evel_init_option_int(&event->endpoint_rtp_pkt_disc);
101   evel_init_option_int(&event->endpoint_rtp_pkt_recv);
102   evel_init_option_int(&event->endpoint_rtp_pkt_sent);
103   evel_init_option_int(&event->local_jitter);
104   evel_init_option_int(&event->local_rtp_oct_disc);
105   evel_init_option_int(&event->local_rtp_oct_recv);
106   evel_init_option_int(&event->local_rtp_oct_sent);
107   evel_init_option_int(&event->local_rtp_pkt_disc);
108   evel_init_option_int(&event->local_rtp_pkt_recv);
109   evel_init_option_int(&event->local_rtp_pkt_sent);
110   evel_init_option_double(&event->mos_cqe);
111   evel_init_option_int(&event->packets_lost);
112   evel_init_option_double(&event->packet_loss_percent);
113   evel_init_option_int(&event->r_factor);
114   evel_init_option_int(&event->round_trip_delay);
115   evel_init_option_string(&event->phone_number);
116
117 exit_label:
118
119   EVEL_EXIT();
120   return event;
121 }
122
123 /**************************************************************************//**
124  * Set the Event Type property of the Service event.
125  *
126  * @note  The property is treated as immutable: it is only valid to call
127  *        the setter once.  However, we don't assert if the caller tries to
128  *        overwrite, just ignoring the update instead.
129  *
130  * @param event         Pointer to the Service event.
131  * @param type          The Event Type to be set. ASCIIZ string. The caller
132  *                      does not need to preserve the value once the function
133  *                      returns.
134  *****************************************************************************/
135 void evel_service_type_set(EVENT_SERVICE * const event,
136                            const char * const type)
137 {
138   EVEL_ENTER();
139
140   /***************************************************************************/
141   /* Check preconditions and call evel_header_type_set.                      */
142   /***************************************************************************/
143   assert(event != NULL);
144   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
145   evel_header_type_set(&event->header, type);
146
147   EVEL_EXIT();
148 }
149
150 /**************************************************************************//**
151  * Add a name/value pair to the Service, under the additionalFields array.
152  *
153  * The name and value are null delimited ASCII strings.  The library takes
154  * a copy so the caller does not have to preserve values after the function
155  * returns.
156  *
157  * @param event     Pointer to the Service event.
158  * @param name      ASCIIZ string with the field's name.  The caller does not
159  *                  need to preserve the value once the function returns.
160  * @param value     ASCIIZ string with the field's value.  The caller does not
161  *                  need to preserve the value once the function returns.
162  *****************************************************************************/
163 void evel_service_addl_field_add(EVENT_SERVICE * const event,
164                                  const char * const name,
165                                  const char * const value)
166 {
167   OTHER_FIELD * nv_pair = NULL;
168
169   EVEL_ENTER();
170
171   /***************************************************************************/
172   /* Check preconditions.                                                    */
173   /***************************************************************************/
174   assert(event != NULL);
175   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
176   assert(name != NULL);
177   assert(value != NULL);
178
179   EVEL_DEBUG("Adding name=%s value=%s", name, value);
180   nv_pair = malloc(sizeof(OTHER_FIELD));
181   assert(nv_pair != NULL);
182   nv_pair->name = strdup(name);
183   nv_pair->value = strdup(value);
184   assert(nv_pair->name != NULL);
185   assert(nv_pair->value != NULL);
186
187   dlist_push_last(&event->additional_fields, nv_pair);
188
189   EVEL_EXIT();
190 }
191
192 /**************************************************************************//**
193  * Set the Product Id property of the Service event.
194  *
195  * @note  The property is treated as immutable: it is only valid to call
196  *        the setter once.  However, we don't assert if the caller tries to
197  *        overwrite, just ignoring the update instead.
198  *
199  * @param event         Pointer to the Service event.
200  * @param product_id    The vendor product id to be set. ASCIIZ string. The
201  *                      caller does not need to preserve the value once the
202  *                      function returns.
203  *****************************************************************************/
204 void evel_service_product_id_set(EVENT_SERVICE * const event,
205                                  const char * const product_id)
206 {
207   EVEL_ENTER();
208
209   /***************************************************************************/
210   /* Check preconditions and call evel_set_option_string.                    */
211   /***************************************************************************/
212   assert(event != NULL);
213   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
214   evel_set_option_string(&event->instance_id.product_id,
215                          product_id,
216                          "Product Id");
217
218   EVEL_EXIT();
219 }
220
221 /**************************************************************************//**
222  * Set the Subsystem Id property of the Service event.
223  *
224  * @note  The property is treated as immutable: it is only valid to call
225  *        the setter once.  However, we don't assert if the caller tries to
226  *        overwrite, just ignoring the update instead.
227  *
228  * @param event         Pointer to the Service event.
229  * @param subsystem_id  The vendor subsystem id to be set. ASCIIZ string. The
230  *                      caller does not need to preserve the value once the
231  *                      function returns.
232  *****************************************************************************/
233 void evel_service_subsystem_id_set(EVENT_SERVICE * const event,
234                                    const char * const subsystem_id)
235 {
236   EVEL_ENTER();
237
238   /***************************************************************************/
239   /* Check preconditions and call evel_set_option_string.                    */
240   /***************************************************************************/
241   assert(event != NULL);
242   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
243   evel_set_option_string(&event->instance_id.subsystem_id,
244                          subsystem_id,
245                          "Subsystem Id");
246
247   EVEL_EXIT();
248 }
249
250 /**************************************************************************//**
251  * Set the Friendly Name property of the Service event.
252  *
253  * @note  The property is treated as immutable: it is only valid to call
254  *        the setter once.  However, we don't assert if the caller tries to
255  *        overwrite, just ignoring the update instead.
256  *
257  * @param event         Pointer to the Service event.
258  * @param friendly_name The vendor friendly name to be set. ASCIIZ string. The
259  *                      caller does not need to preserve the value once the
260  *                      function returns.
261  *****************************************************************************/
262 void evel_service_friendly_name_set(EVENT_SERVICE * const event,
263                                     const char * const friendly_name)
264 {
265   EVEL_ENTER();
266
267   /***************************************************************************/
268   /* Check preconditions and call evel_set_option_string.                    */
269   /***************************************************************************/
270   assert(event != NULL);
271   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
272   evel_set_option_string(&event->instance_id.event_friendly_name,
273                          friendly_name,
274                          "Friendly Name");
275
276   EVEL_EXIT();
277 }
278
279 /**************************************************************************//**
280  * Set the Correlator property of the Service event.
281  *
282  * @note  The property is treated as immutable: it is only valid to call
283  *        the setter once.  However, we don't assert if the caller tries to
284  *        overwrite, just ignoring the update instead.
285  *
286  * @param event         Pointer to the Service event.
287  * @param correlator    The correlator to be set. ASCIIZ string. The caller
288  *                      does not need to preserve the value once the function
289  *                      returns.
290  *****************************************************************************/
291 void evel_service_correlator_set(EVENT_SERVICE * const event,
292                                  const char * const correlator)
293 {
294   EVEL_ENTER();
295
296   /***************************************************************************/
297   /* Check preconditions and call evel_set_option_string.                    */
298   /***************************************************************************/
299   assert(event != NULL);
300   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
301   evel_set_option_string(&event->correlator,
302                          correlator,
303                          "Correlator");
304
305   EVEL_EXIT();
306 }
307
308 /**************************************************************************//**
309  * Set the Codec property of the Service event.
310  *
311  * @note  The property is treated as immutable: it is only valid to call
312  *        the setter once.  However, we don't assert if the caller tries to
313  *        overwrite, just ignoring the update instead.
314  *
315  * @param event         Pointer to the Service event.
316  * @param codec         The codec to be set. ASCIIZ string. The caller does not
317  *                      need to preserve the value once the function returns.
318  *****************************************************************************/
319 void evel_service_codec_set(EVENT_SERVICE * const event,
320                             const char * const codec)
321 {
322   EVEL_ENTER();
323
324   /***************************************************************************/
325   /* Check preconditions and call evel_set_option_string.                    */
326   /***************************************************************************/
327   assert(event != NULL);
328   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
329   evel_set_option_string(&event->codec,
330                          codec,
331                          "Codec");
332
333   EVEL_EXIT();
334 }
335
336 /**************************************************************************//**
337  * Set the Callee Side Codec property of the Service event.
338  *
339  * @note  The property is treated as immutable: it is only valid to call
340  *        the setter once.  However, we don't assert if the caller tries to
341  *        overwrite, just ignoring the update instead.
342  *
343  * @param event         Pointer to the Service event.
344  * @param codec         The codec to be set. ASCIIZ string. The caller does not
345  *                      need to preserve the value once the function returns.
346  *****************************************************************************/
347 void evel_service_callee_codec_set(EVENT_SERVICE * const event,
348                                    const char * const codec)
349 {
350   EVEL_ENTER();
351
352   /***************************************************************************/
353   /* Check preconditions and call evel_set_option_string.                    */
354   /***************************************************************************/
355   assert(event != NULL);
356   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
357   evel_set_option_string(&event->callee_side_codec,
358                          codec,
359                          "Callee Side Codec");
360
361   EVEL_EXIT();
362 }
363
364 /**************************************************************************//**
365  * Set the Caller Side Codec property of the Service event.
366  *
367  * @note  The property is treated as immutable: it is only valid to call
368  *        the setter once.  However, we don't assert if the caller tries to
369  *        overwrite, just ignoring the update instead.
370  *
371  * @param event         Pointer to the Service event.
372  * @param codec         The codec to be set. ASCIIZ string. The caller does not
373  *                      need to preserve the value once the function returns.
374  *****************************************************************************/
375 void evel_service_caller_codec_set(EVENT_SERVICE * const event,
376                                    const char * const codec)
377 {
378   EVEL_ENTER();
379
380   /***************************************************************************/
381   /* Check preconditions and call evel_set_option_string.                    */
382   /***************************************************************************/
383   assert(event != NULL);
384   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
385   evel_set_option_string(&event->caller_side_codec,
386                          codec,
387                          "Caller Side Codec");
388
389   EVEL_EXIT();
390 }
391
392 /**************************************************************************//**
393  * Set the RTCP Data property of the Service event.
394  *
395  * @note  The property is treated as immutable: it is only valid to call
396  *        the setter once.  However, we don't assert if the caller tries to
397  *        overwrite, just ignoring the update instead.
398  *
399  * @param event         Pointer to the Service event.
400  * @param rtcp_data     The RTCP Data to be set. ASCIIZ string. The caller
401  *                      does not need to preserve the value once the function
402  *                      returns.
403  *****************************************************************************/
404 void evel_service_rtcp_data_set(EVENT_SERVICE * const event,
405                                 const char * const rtcp_data)
406 {
407   EVEL_ENTER();
408
409   /***************************************************************************/
410   /* Check preconditions and call evel_set_option_string.                    */
411   /***************************************************************************/
412   assert(event != NULL);
413   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
414   evel_set_option_string(&event->rtcp_data,
415                          rtcp_data,
416                          "RTCP Data");
417
418   EVEL_EXIT();
419 }
420
421 /**************************************************************************//**
422  * Set the Adjacency Name property of the Service event.
423  *
424  * @note  The property is treated as immutable: it is only valid to call
425  *        the setter once.  However, we don't assert if the caller tries to
426  *        overwrite, just ignoring the update instead.
427  *
428  * @param event         Pointer to the Service event.
429  * @param adjacency_name
430  *                      The adjacency name to be set. ASCIIZ string. The caller
431  *                      does not need to preserve the value once the function
432  *                      returns.
433  *****************************************************************************/
434 void evel_service_adjacency_name_set(EVENT_SERVICE * const event,
435                                      const char * const adjacency_name)
436 {
437   EVEL_ENTER();
438
439   /***************************************************************************/
440   /* Check preconditions and call evel_set_option_string.                    */
441   /***************************************************************************/
442   assert(event != NULL);
443   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
444   evel_set_option_string(&event->adjacency_name,
445                          adjacency_name,
446                          "Adjacency Name");
447
448   EVEL_EXIT();
449 }
450
451 /**************************************************************************//**
452  * Set the Endpoint Descriptor property of the Service event.
453  *
454  * @note  The property is treated as immutable: it is only valid to call
455  *        the setter once.  However, we don't assert if the caller tries to
456  *        overwrite, just ignoring the update instead.
457  *
458  * @param event         Pointer to the Service event.
459  * @param endpoint_desc The endpoint descriptor to be set.
460  *****************************************************************************/
461 void evel_service_endpoint_desc_set(
462                                 EVENT_SERVICE * const event,
463                                 const EVEL_SERVICE_ENDPOINT_DESC endpoint_desc)
464 {
465   EVEL_ENTER();
466
467   /***************************************************************************/
468   /* Check preconditions and call evel_set_option_string.                    */
469   /***************************************************************************/
470   assert(event != NULL);
471   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
472   evel_set_option_string(&event->endpoint_description,
473                          evel_service_endpoint_desc(endpoint_desc),
474                          "Endpoint Description");
475
476   EVEL_EXIT();
477 }
478
479 /**************************************************************************//**
480  * Set the Endpoint Jitter property of the Service event.
481  *
482  * @note  The property is treated as immutable: it is only valid to call
483  *        the setter once.  However, we don't assert if the caller tries to
484  *        overwrite, just ignoring the update instead.
485  *
486  * @param event         Pointer to the Service event.
487  * @param jitter        The jitter to be set.
488  *****************************************************************************/
489 void evel_service_endpoint_jitter_set(EVENT_SERVICE * const event,
490                                       const int jitter)
491 {
492   EVEL_ENTER();
493
494   /***************************************************************************/
495   /* Check preconditions and call evel_set_option_string.                    */
496   /***************************************************************************/
497   assert(event != NULL);
498   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
499   evel_set_option_int(&event->endpoint_jitter,
500                       jitter,
501                       "Endpoint Jitter");
502
503   EVEL_EXIT();
504 }
505
506 /**************************************************************************//**
507  * Set the Endpoint Rtp Octets Discarded property of the Service event.
508  *
509  * @note  The property is treated as immutable: it is only valid to call
510  *        the setter once.  However, we don't assert if the caller tries to
511  *        overwrite, just ignoring the update instead.
512  *
513  * @param event         Pointer to the Service event.
514  * @param rtp_oct_disc  The discard count.
515  *****************************************************************************/
516 void evel_service_endpoint_rtp_oct_disc_set(EVENT_SERVICE * const event,
517                                             const int rtp_oct_disc)
518 {
519   EVEL_ENTER();
520
521   /***************************************************************************/
522   /* Check preconditions and call evel_set_option_string.                    */
523   /***************************************************************************/
524   assert(event != NULL);
525   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
526   evel_set_option_int(&event->endpoint_rtp_oct_disc,
527                       rtp_oct_disc,
528                       "Endpoint Rtp Octets Discarded");
529
530   EVEL_EXIT();
531 }
532
533 /**************************************************************************//**
534  * Set the Endpoint Rtp Octets Received property of the Service event.
535  *
536  * @note  The property is treated as immutable: it is only valid to call
537  *        the setter once.  However, we don't assert if the caller tries to
538  *        overwrite, just ignoring the update instead.
539  *
540  * @param event         Pointer to the Service event.
541  * @param rtp_oct_recv  The receive count.
542  *****************************************************************************/
543 void evel_service_endpoint_rtp_oct_recv_set(EVENT_SERVICE * const event,
544                                             const int rtp_oct_recv)
545 {
546   EVEL_ENTER();
547
548   /***************************************************************************/
549   /* Check preconditions and call evel_set_option_string.                    */
550   /***************************************************************************/
551   assert(event != NULL);
552   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
553   evel_set_option_int(&event->endpoint_rtp_oct_recv,
554                       rtp_oct_recv,
555                       "Endpoint Rtp Octets Received");
556
557   EVEL_EXIT();
558 }
559
560 /**************************************************************************//**
561  * Set the Endpoint Rtp Octets Sent property of the Service event.
562  *
563  * @note  The property is treated as immutable: it is only valid to call
564  *        the setter once.  However, we don't assert if the caller tries to
565  *        overwrite, just ignoring the update instead.
566  *
567  * @param event         Pointer to the Service event.
568  * @param rtp_oct_sent  The send count.
569  *****************************************************************************/
570 void evel_service_endpoint_rtp_oct_sent_set(EVENT_SERVICE * const event,
571                                             const int rtp_oct_sent)
572 {
573   EVEL_ENTER();
574
575   /***************************************************************************/
576   /* Check preconditions and call evel_set_option_string.                    */
577   /***************************************************************************/
578   assert(event != NULL);
579   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
580   evel_set_option_int(&event->endpoint_rtp_oct_sent,
581                       rtp_oct_sent,
582                       "Endpoint Rtp Octets Sent");
583
584   EVEL_EXIT();
585 }
586
587 /**************************************************************************//**
588  * Set the Endpoint Rtp Packets Discarded property of the Service event.
589  *
590  * @note  The property is treated as immutable: it is only valid to call
591  *        the setter once.  However, we don't assert if the caller tries to
592  *        overwrite, just ignoring the update instead.
593  *
594  * @param event         Pointer to the Service event.
595  * @param rtp_pkt_disc  The discard count.
596  *****************************************************************************/
597 void evel_service_endpoint_rtp_pkt_disc_set(EVENT_SERVICE * const event,
598                                             const int rtp_pkt_disc)
599 {
600   EVEL_ENTER();
601
602   /***************************************************************************/
603   /* Check preconditions and call evel_set_option_string.                    */
604   /***************************************************************************/
605   assert(event != NULL);
606   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
607   evel_set_option_int(&event->endpoint_rtp_pkt_disc,
608                       rtp_pkt_disc,
609                       "Endpoint Rtp Packets Discarded");
610
611   EVEL_EXIT();
612 }
613
614 /**************************************************************************//**
615  * Set the Endpoint Rtp Packets Received property of the Service event.
616  *
617  * @note  The property is treated as immutable: it is only valid to call
618  *        the setter once.  However, we don't assert if the caller tries to
619  *        overwrite, just ignoring the update instead.
620  *
621  * @param event         Pointer to the Service event.
622  * @param rtp_pkt_recv  The receive count.
623  *****************************************************************************/
624 void evel_service_endpoint_rtp_pkt_recv_set(EVENT_SERVICE * const event,
625                                             const int rtp_pkt_recv)
626 {
627   EVEL_ENTER();
628
629   /***************************************************************************/
630   /* Check preconditions and call evel_set_option_string.                    */
631   /***************************************************************************/
632   assert(event != NULL);
633   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
634   evel_set_option_int(&event->endpoint_rtp_pkt_recv,
635                       rtp_pkt_recv,
636                       "Endpoint Rtp Packets Received");
637
638   EVEL_EXIT();
639 }
640
641 /**************************************************************************//**
642  * Set the Endpoint Rtp Packets Sent property of the Service event.
643  *
644  * @note  The property is treated as immutable: it is only valid to call
645  *        the setter once.  However, we don't assert if the caller tries to
646  *        overwrite, just ignoring the update instead.
647  *
648  * @param event         Pointer to the Service event.
649  * @param rtp_pkt_sent  The send count.
650  *****************************************************************************/
651 void evel_service_endpoint_rtp_pkt_sent_set(EVENT_SERVICE * const event,
652                                             const int rtp_pkt_sent)
653 {
654   EVEL_ENTER();
655
656   /***************************************************************************/
657   /* Check preconditions and call evel_set_option_string.                    */
658   /***************************************************************************/
659   assert(event != NULL);
660   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
661   evel_set_option_int(&event->endpoint_rtp_pkt_sent,
662                       rtp_pkt_sent,
663                       "Endpoint Rtp Packets Sent");
664
665   EVEL_EXIT();
666 }
667
668 /**************************************************************************//**
669  * Set the Local Jitter property of the Service event.
670  *
671  * @note  The property is treated as immutable: it is only valid to call
672  *        the setter once.  However, we don't assert if the caller tries to
673  *        overwrite, just ignoring the update instead.
674  *
675  * @param event         Pointer to the Service event.
676  * @param jitter        The jitter to be set.
677  *****************************************************************************/
678 void evel_service_local_jitter_set(EVENT_SERVICE * const event,
679                                    const int jitter)
680 {
681   EVEL_ENTER();
682
683   /***************************************************************************/
684   /* Check preconditions and call evel_set_option_string.                    */
685   /***************************************************************************/
686   assert(event != NULL);
687   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
688   evel_set_option_int(&event->local_jitter,
689                       jitter,
690                       "Local Jitter");
691
692   EVEL_EXIT();
693 }
694
695 /**************************************************************************//**
696  * Set the Local Rtp Octets Discarded property of the Service event.
697  *
698  * @note  The property is treated as immutable: it is only valid to call
699  *        the setter once.  However, we don't assert if the caller tries to
700  *        overwrite, just ignoring the update instead.
701  *
702  * @param event         Pointer to the Service event.
703  * @param rtp_oct_disc  The discard count.
704  *****************************************************************************/
705 void evel_service_local_rtp_oct_disc_set(EVENT_SERVICE * const event,
706                                          const int rtp_oct_disc)
707 {
708   EVEL_ENTER();
709
710   /***************************************************************************/
711   /* Check preconditions and call evel_set_option_string.                    */
712   /***************************************************************************/
713   assert(event != NULL);
714   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
715   evel_set_option_int(&event->local_rtp_oct_disc,
716                       rtp_oct_disc,
717                       "Local Rtp Octets Discarded");
718
719   EVEL_EXIT();
720 }
721
722 /**************************************************************************//**
723  * Set the Local Rtp Octets Received property of the Service event.
724  *
725  * @note  The property is treated as immutable: it is only valid to call
726  *        the setter once.  However, we don't assert if the caller tries to
727  *        overwrite, just ignoring the update instead.
728  *
729  * @param event         Pointer to the Service event.
730  * @param rtp_oct_recv  The receive count.
731  *****************************************************************************/
732 void evel_service_local_rtp_oct_recv_set(EVENT_SERVICE * const event,
733                                          const int rtp_oct_recv)
734 {
735   EVEL_ENTER();
736
737   /***************************************************************************/
738   /* Check preconditions and call evel_set_option_string.                    */
739   /***************************************************************************/
740   assert(event != NULL);
741   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
742   evel_set_option_int(&event->local_rtp_oct_recv,
743                       rtp_oct_recv,
744                       "Local Rtp Octets Received");
745
746   EVEL_EXIT();
747 }
748
749 /**************************************************************************//**
750  * Set the Local Rtp Octets Sent property of the Service event.
751  *
752  * @note  The property is treated as immutable: it is only valid to call
753  *        the setter once.  However, we don't assert if the caller tries to
754  *        overwrite, just ignoring the update instead.
755  *
756  * @param event         Pointer to the Service event.
757  * @param rtp_oct_sent  The send count.
758  *****************************************************************************/
759 void evel_service_local_rtp_oct_sent_set(EVENT_SERVICE * const event,
760                                          const int rtp_oct_sent)
761 {
762   EVEL_ENTER();
763
764   /***************************************************************************/
765   /* Check preconditions and call evel_set_option_string.                    */
766   /***************************************************************************/
767   assert(event != NULL);
768   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
769   evel_set_option_int(&event->local_rtp_oct_sent,
770                       rtp_oct_sent,
771                       "Local Rtp Octets Sent");
772
773   EVEL_EXIT();
774 }
775
776 /**************************************************************************//**
777  * Set the Local Rtp Packets Discarded property of the Service event.
778  *
779  * @note  The property is treated as immutable: it is only valid to call
780  *        the setter once.  However, we don't assert if the caller tries to
781  *        overwrite, just ignoring the update instead.
782  *
783  * @param event         Pointer to the Service event.
784  * @param rtp_pkt_disc  The discard count.
785  *****************************************************************************/
786 void evel_service_local_rtp_pkt_disc_set(EVENT_SERVICE * const event,
787                                          const int rtp_pkt_disc)
788 {
789   EVEL_ENTER();
790
791   /***************************************************************************/
792   /* Check preconditions and call evel_set_option_string.                    */
793   /***************************************************************************/
794   assert(event != NULL);
795   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
796   evel_set_option_int(&event->local_rtp_pkt_disc,
797                       rtp_pkt_disc,
798                       "Local Rtp Packets Discarded");
799
800   EVEL_EXIT();
801 }
802
803 /**************************************************************************//**
804  * Set the Local Rtp Packets Received property of the Service event.
805  *
806  * @note  The property is treated as immutable: it is only valid to call
807  *        the setter once.  However, we don't assert if the caller tries to
808  *        overwrite, just ignoring the update instead.
809  *
810  * @param event         Pointer to the Service event.
811  * @param rtp_pkt_recv  The receive count.
812  *****************************************************************************/
813 void evel_service_local_rtp_pkt_recv_set(EVENT_SERVICE * const event,
814                                          const int rtp_pkt_recv)
815 {
816   EVEL_ENTER();
817
818   /***************************************************************************/
819   /* Check preconditions and call evel_set_option_string.                    */
820   /***************************************************************************/
821   assert(event != NULL);
822   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
823   evel_set_option_int(&event->local_rtp_pkt_recv,
824                       rtp_pkt_recv,
825                       "Local Rtp Packets Received");
826
827   EVEL_EXIT();
828 }
829
830 /**************************************************************************//**
831  * Set the Local Rtp Packets Sent property of the Service event.
832  *
833  * @note  The property is treated as immutable: it is only valid to call
834  *        the setter once.  However, we don't assert if the caller tries to
835  *        overwrite, just ignoring the update instead.
836  *
837  * @param event         Pointer to the Service event.
838  * @param rtp_pkt_sent  The send count.
839  *****************************************************************************/
840 void evel_service_local_rtp_pkt_sent_set(EVENT_SERVICE * const event,
841                                          const int rtp_pkt_sent)
842 {
843   EVEL_ENTER();
844
845   /***************************************************************************/
846   /* Check preconditions and call evel_set_option_string.                    */
847   /***************************************************************************/
848   assert(event != NULL);
849   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
850   evel_set_option_int(&event->local_rtp_pkt_sent,
851                       rtp_pkt_sent,
852                       "Local Rtp Packets Sent");
853
854   EVEL_EXIT();
855 }
856
857 /**************************************************************************//**
858  * Set the Mos Cqe property of the Service event.
859  *
860  * @note  The property is treated as immutable: it is only valid to call
861  *        the setter once.  However, we don't assert if the caller tries to
862  *        overwrite, just ignoring the update instead.
863  *
864  * @param event         Pointer to the Service event.
865  * @param mos_cqe       The mosCqe to be set.
866  *****************************************************************************/
867 void evel_service_mos_cqe_set(EVENT_SERVICE * const event,
868                               const double mos_cqe)
869 {
870   EVEL_ENTER();
871
872   /***************************************************************************/
873   /* Check preconditions and call evel_set_option_string.                    */
874   /***************************************************************************/
875   assert(event != NULL);
876   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
877   evel_set_option_double(&event->mos_cqe,
878                          mos_cqe,
879                          "Mos Cqe");
880
881   EVEL_EXIT();
882 }
883
884 /**************************************************************************//**
885  * Set the Packets Lost property of the Service event.
886  *
887  * @note  The property is treated as immutable: it is only valid to call
888  *        the setter once.  However, we don't assert if the caller tries to
889  *        overwrite, just ignoring the update instead.
890  *
891  * @param event         Pointer to the Service event.
892  * @param packets_lost  The number of packets lost to be set.
893  *****************************************************************************/
894 void evel_service_packets_lost_set(EVENT_SERVICE * const event,
895                                    const int packets_lost)
896 {
897   EVEL_ENTER();
898
899   /***************************************************************************/
900   /* Check preconditions and call evel_set_option_string.                    */
901   /***************************************************************************/
902   assert(event != NULL);
903   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
904   evel_set_option_int(&event->packets_lost,
905                       packets_lost,
906                       "Packets Lost");
907
908   EVEL_EXIT();
909 }
910
911 /**************************************************************************//**
912  * Set the packet Loss Percent property of the Service event.
913  *
914  * @note  The property is treated as immutable: it is only valid to call
915  *        the setter once.  However, we don't assert if the caller tries to
916  *        overwrite, just ignoring the update instead.
917  *
918  * @param event         Pointer to the Service event.
919  * @param packet_loss_percent
920  *                      The packet loss in percent.
921  *****************************************************************************/
922 void evel_service_packet_loss_percent_set(EVENT_SERVICE * const event,
923                                           const double packet_loss_percent)
924 {
925   EVEL_ENTER();
926
927   /***************************************************************************/
928   /* Check preconditions and call evel_set_option_string.                    */
929   /***************************************************************************/
930   assert(event != NULL);
931   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
932   evel_set_option_double(&event->packet_loss_percent,
933                          packet_loss_percent,
934                          "Packet Loss Percent");
935
936   EVEL_EXIT();
937 }
938
939 /**************************************************************************//**
940  * Set the R Factor property of the Service event.
941  *
942  * @note  The property is treated as immutable: it is only valid to call
943  *        the setter once.  However, we don't assert if the caller tries to
944  *        overwrite, just ignoring the update instead.
945  *
946  * @param event         Pointer to the Service event.
947  * @param r_factor      The R Factor to be set.
948  *****************************************************************************/
949 void evel_service_r_factor_set(EVENT_SERVICE * const event,
950                                const int r_factor)
951 {
952   EVEL_ENTER();
953
954   /***************************************************************************/
955   /* Check preconditions and call evel_set_option_string.                    */
956   /***************************************************************************/
957   assert(event != NULL);
958   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
959   evel_set_option_int(&event->r_factor,
960                       r_factor,
961                       "R Factor");
962
963   EVEL_EXIT();
964 }
965
966 /**************************************************************************//**
967  * Set the Round Trip Delay property of the Service event.
968  *
969  * @note  The property is treated as immutable: it is only valid to call
970  *        the setter once.  However, we don't assert if the caller tries to
971  *        overwrite, just ignoring the update instead.
972  *
973  * @param event         Pointer to the Service event.
974  * @param round_trip_delay
975  *                      The Round trip delay to be set.
976  *****************************************************************************/
977 void evel_service_round_trip_delay_set(EVENT_SERVICE * const event,
978                                        const int round_trip_delay)
979 {
980   EVEL_ENTER();
981
982   /***************************************************************************/
983   /* Check preconditions and call evel_set_option_string.                    */
984   /***************************************************************************/
985   assert(event != NULL);
986   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
987   evel_set_option_int(&event->round_trip_delay,
988                       round_trip_delay,
989                       "Round Trip Delay");
990
991   EVEL_EXIT();
992 }
993
994 /**************************************************************************//**
995  * Set the Phone Number property of the Service event.
996  *
997  * @note  The property is treated as immutable: it is only valid to call
998  *        the setter once.  However, we don't assert if the caller tries to
999  *        overwrite, just ignoring the update instead.
1000  *
1001  * @param event         Pointer to the Service event.
1002  * @param phone_number  The Phone Number to be set. ASCIIZ string. The caller
1003  *                      does not need to preserve the value once the function
1004  *                      returns.
1005  *****************************************************************************/
1006 void evel_service_phone_number_set(EVENT_SERVICE * const event,
1007                                    const char * const phone_number)
1008 {
1009   EVEL_ENTER();
1010
1011   /***************************************************************************/
1012   /* Check preconditions and call evel_set_option_string.                    */
1013   /***************************************************************************/
1014   assert(event != NULL);
1015   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
1016   evel_set_option_string(&event->phone_number,
1017                          phone_number,
1018                          "Phone Number");
1019
1020   EVEL_EXIT();
1021 }
1022
1023 /**************************************************************************//**
1024  * Encode the Service in JSON according to AT&T's schema for the
1025  * event type.
1026  *
1027  * @param jbuf          Pointer to the ::EVEL_JSON_BUFFER to encode into.
1028  * @param event         Pointer to the ::EVENT_HEADER to encode.
1029  *****************************************************************************/
1030 void evel_json_encode_service(EVEL_JSON_BUFFER * const jbuf,
1031                                 EVENT_SERVICE * const event)
1032 {
1033   OTHER_FIELD * nv_pair = NULL;
1034   DLIST_ITEM * dlist_item = NULL;
1035
1036   EVEL_ENTER();
1037
1038   /***************************************************************************/
1039   /* Check preconditions.                                                    */
1040   /***************************************************************************/
1041   assert(event != NULL);
1042   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
1043
1044   evel_json_encode_header(jbuf, &event->header);
1045   evel_json_open_named_object(jbuf, "serviceEventsFields");
1046
1047   /***************************************************************************/
1048   /* Mandatory fields                                                        */
1049   /***************************************************************************/
1050   evel_json_encode_instance_id(jbuf, &event->instance_id);
1051   evel_enc_version(jbuf,
1052                    "serviceEventsFieldsVersion",
1053                    event->major_version,
1054                    event->minor_version);
1055
1056   /***************************************************************************/
1057   /* Optional fields                                                         */
1058   /***************************************************************************/
1059   evel_enc_kv_opt_string(jbuf, "correlator", &event->correlator);
1060
1061   /***************************************************************************/
1062   /* Checkpoint, so that we can wind back if all fields are suppressed.      */
1063   /***************************************************************************/
1064   evel_json_checkpoint(jbuf);
1065   if (evel_json_open_opt_named_list(jbuf, "additionalFields"))
1066   {
1067     bool added = false;
1068
1069     dlist_item = dlist_get_first(&event->additional_fields);
1070     while (dlist_item != NULL)
1071     {
1072       nv_pair = (OTHER_FIELD *) dlist_item->item;
1073       assert(nv_pair != NULL);
1074
1075       if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec,
1076                                           "additionalFields",
1077                                           nv_pair->name))
1078       {
1079         evel_json_open_object(jbuf);
1080         evel_enc_kv_string(jbuf, "name", nv_pair->name);
1081         evel_enc_kv_string(jbuf, "value", nv_pair->value);
1082         evel_json_close_object(jbuf);
1083         added = true;
1084       }
1085       dlist_item = dlist_get_next(dlist_item);
1086     }
1087     evel_json_close_list(jbuf);
1088
1089     /*************************************************************************/
1090     /* If we've not written anything, rewind to before we opened the list.   */
1091     /*************************************************************************/
1092     if (!added)
1093     {
1094       evel_json_rewind(jbuf);
1095     }
1096   }
1097
1098   /***************************************************************************/
1099   /* Optional fields within JSON equivalent object: codecSelected            */
1100   /***************************************************************************/
1101   evel_json_checkpoint(jbuf);
1102   if (evel_json_open_opt_named_object(jbuf, "codecSelected"))
1103   {
1104     bool added = false;
1105     added |= evel_enc_kv_opt_string(jbuf,
1106                                     "codec",
1107                                     &event->codec);
1108     evel_json_close_object(jbuf);
1109
1110     /*************************************************************************/
1111     /* If the object is empty, rewind to before we opened it.                */
1112     /*************************************************************************/
1113     if (!added)
1114     {
1115       evel_json_rewind(jbuf);
1116     }
1117   }
1118
1119   /***************************************************************************/
1120   /* Optional fields within JSON equivalent object: codecSelectedTranscoding */
1121   /***************************************************************************/
1122   evel_json_checkpoint(jbuf);
1123   if (evel_json_open_opt_named_object(jbuf, "codecSelectedTranscoding"))
1124   {
1125     bool added = false;
1126     added |= evel_enc_kv_opt_string(jbuf,
1127                                     "calleeSideCodec",
1128                                     &event->callee_side_codec);
1129     added |= evel_enc_kv_opt_string(jbuf,
1130                                     "callerSideCodec",
1131                                     &event->caller_side_codec);
1132     evel_json_close_object(jbuf);
1133
1134     /*************************************************************************/
1135     /* If the object is empty, rewind to before we opened it.                */
1136     /*************************************************************************/
1137     if (!added)
1138     {
1139       evel_json_rewind(jbuf);
1140     }
1141   }
1142
1143   /***************************************************************************/
1144   /* Optional fields within JSON equivalent object: midCallRtcp              */
1145   /***************************************************************************/
1146   evel_json_checkpoint(jbuf);
1147   if (evel_json_open_opt_named_object(jbuf, "midCallRtcp"))
1148   {
1149     bool added = false;
1150     added |= evel_enc_kv_opt_string(jbuf,
1151                                     "rtcpData",
1152                                     &event->rtcp_data);
1153     evel_json_close_object(jbuf);
1154
1155     /*************************************************************************/
1156     /* If the object is empty, rewind to before we opened it.                */
1157     /*************************************************************************/
1158     if (!added)
1159     {
1160       evel_json_rewind(jbuf);
1161     }
1162   }
1163
1164   /***************************************************************************/
1165   /* Optional fields within JSON equivalent object: endOfCallVqmSummaries    */
1166   /***************************************************************************/
1167   evel_json_checkpoint(jbuf);
1168   if (evel_json_open_opt_named_object(jbuf, "endOfCallVqmSummaries"))
1169   {
1170     bool added = false;
1171     added |= evel_enc_kv_opt_string(jbuf,
1172                                     "adjacencyName",
1173                                     &event->adjacency_name);
1174     added |= evel_enc_kv_opt_string(jbuf,
1175                                     "endpointDescription",
1176                                     &event->endpoint_description);
1177     added |= evel_enc_kv_opt_int(jbuf,
1178                                  "endpointJitter",
1179                                  &event->endpoint_jitter);
1180     added |= evel_enc_kv_opt_int(jbuf,
1181                                  "endpointRtpOctetsDiscarded",
1182                                  &event->endpoint_rtp_oct_disc);
1183     added |= evel_enc_kv_opt_int(jbuf,
1184                                  "endpointRtpOctetsReceived",
1185                                  &event->endpoint_rtp_oct_recv);
1186     added |= evel_enc_kv_opt_int(jbuf,
1187                                  "endpointRtpOctetsSent",
1188                                  &event->endpoint_rtp_oct_sent);
1189     added |= evel_enc_kv_opt_int(jbuf,
1190                                  "endpointRtpPacketsDiscarded",
1191                                  &event->endpoint_rtp_pkt_disc);
1192     added |= evel_enc_kv_opt_int(jbuf,
1193                                  "endpointRtpPacketsReceived",
1194                                  &event->endpoint_rtp_pkt_recv);
1195     added |= evel_enc_kv_opt_int(jbuf,
1196                                  "endpointRtpPacketsSent",
1197                                  &event->endpoint_rtp_pkt_sent);
1198     added |= evel_enc_kv_opt_int(jbuf,
1199                                  "localJitter",
1200                                  &event->local_jitter);
1201     added |= evel_enc_kv_opt_int(jbuf,
1202                                  "localRtpOctetsDiscarded",
1203                                  &event->local_rtp_oct_disc);
1204     added |= evel_enc_kv_opt_int(jbuf,
1205                                  "localRtpOctetsReceived",
1206                                  &event->local_rtp_oct_recv);
1207     added |= evel_enc_kv_opt_int(jbuf,
1208                                  "localRtpOctetsSent",
1209                                  &event->local_rtp_oct_sent);
1210     added |= evel_enc_kv_opt_int(jbuf,
1211                                  "localRtpPacketsDiscarded",
1212                                  &event->local_rtp_pkt_disc);
1213     added |= evel_enc_kv_opt_int(jbuf,
1214                                  "localRtpPacketsReceived",
1215                                  &event->local_rtp_pkt_recv);
1216     added |= evel_enc_kv_opt_int(jbuf,
1217                                  "localRtpPacketsSent",
1218                                  &event->local_rtp_pkt_sent);
1219     added |= evel_enc_kv_opt_double(jbuf,
1220                                     "mosCqe",
1221                                     &event->mos_cqe);
1222     added |= evel_enc_kv_opt_int(jbuf,
1223                                  "packetsLost",
1224                                  &event->packets_lost);
1225     added |= evel_enc_kv_opt_double(jbuf,
1226                                     "packetLossPercent",
1227                                     &event->packet_loss_percent);
1228     added |= evel_enc_kv_opt_int(jbuf,
1229                                  "rFactor",
1230                                  &event->r_factor);
1231     added |= evel_enc_kv_opt_int(jbuf,
1232                                  "roundTripDelay",
1233                                  &event->round_trip_delay);
1234     evel_json_close_object(jbuf);
1235
1236     /*************************************************************************/
1237     /* If the object is empty, rewind to before we opened it.                */
1238     /*************************************************************************/
1239     if (!added)
1240     {
1241       evel_json_rewind(jbuf);
1242     }
1243   }
1244
1245   /***************************************************************************/
1246   /* Optional fields within JSON equivalent object: marker                   */
1247   /***************************************************************************/
1248   evel_json_checkpoint(jbuf);
1249   if (evel_json_open_opt_named_object(jbuf, "marker"))
1250   {
1251     bool added = false;
1252     added |= evel_enc_kv_opt_string(jbuf, "phoneNumber", &event->phone_number);
1253     evel_json_close_object(jbuf);
1254
1255     /*************************************************************************/
1256     /* If the object is empty, rewind to before we opened it.                */
1257     /*************************************************************************/
1258     if (!added)
1259     {
1260       evel_json_rewind(jbuf);
1261     }
1262   }
1263
1264   evel_json_close_object(jbuf);
1265
1266   EVEL_EXIT();
1267 }
1268
1269 /**************************************************************************//**
1270  * Free a Service event.
1271  *
1272  * Free off the event supplied.  Will free all the contained allocated memory.
1273  *
1274  * @note It does not free the event itself, since that may be part of a larger
1275  * structure.
1276  *****************************************************************************/
1277 void evel_free_service(EVENT_SERVICE * const event)
1278 {
1279   OTHER_FIELD * nv_pair = NULL;
1280
1281   EVEL_ENTER();
1282
1283   /***************************************************************************/
1284   /* Check preconditions.                                                    */
1285   /***************************************************************************/
1286   assert(event != NULL);
1287   assert(event->header.event_domain == EVEL_DOMAIN_SERVICE);
1288
1289   /***************************************************************************/
1290   /* Free all internal strings then the header itself.                       */
1291   /***************************************************************************/
1292   nv_pair = dlist_pop_last(&event->additional_fields);
1293   while (nv_pair != NULL)
1294   {
1295     EVEL_DEBUG("Freeing Other Field (%s, %s)", nv_pair->name, nv_pair->value);
1296     free(nv_pair->name);
1297     free(nv_pair->value);
1298     free(nv_pair);
1299     nv_pair = dlist_pop_last(&event->additional_fields);
1300   }
1301   evel_free_option_string(&event->correlator);
1302   evel_free_option_string(&event->codec);
1303   evel_free_option_string(&event->callee_side_codec);
1304   evel_free_option_string(&event->caller_side_codec);
1305   evel_free_option_string(&event->rtcp_data);
1306   evel_free_option_string(&event->adjacency_name);
1307   evel_free_option_string(&event->endpoint_description);
1308   evel_free_option_string(&event->phone_number);
1309   evel_free_event_instance_id(&event->instance_id);
1310   evel_free_header(&event->header);
1311
1312   EVEL_EXIT();
1313 }