AT&T ECOMP Vendor Event Listener library  0.1
evel_service.c
Go to the documentation of this file.
1 /**************************************************************************/
35 #include <string.h>
36 #include <assert.h>
37 #include <stdlib.h>
38 
39 #include "evel_throttle.h"
40 
41 /**************************************************************************/
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 /**************************************************************************/
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 /**************************************************************************/
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 /**************************************************************************/
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);
215  product_id,
216  "Product Id");
217 
218  EVEL_EXIT();
219 }
220 
221 /**************************************************************************/
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);
244  subsystem_id,
245  "Subsystem Id");
246 
247  EVEL_EXIT();
248 }
249 
250 /**************************************************************************/
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);
273  friendly_name,
274  "Friendly Name");
275 
276  EVEL_EXIT();
277 }
278 
279 /**************************************************************************/
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);
302  correlator,
303  "Correlator");
304 
305  EVEL_EXIT();
306 }
307 
308 /**************************************************************************/
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);
330  codec,
331  "Codec");
332 
333  EVEL_EXIT();
334 }
335 
336 /**************************************************************************/
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);
358  codec,
359  "Callee Side Codec");
360 
361  EVEL_EXIT();
362 }
363 
364 /**************************************************************************/
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);
386  codec,
387  "Caller Side Codec");
388 
389  EVEL_EXIT();
390 }
391 
392 /**************************************************************************/
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);
415  rtcp_data,
416  "RTCP Data");
417 
418  EVEL_EXIT();
419 }
420 
421 /**************************************************************************/
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);
445  adjacency_name,
446  "Adjacency Name");
447 
448  EVEL_EXIT();
449 }
450 
451 /**************************************************************************/
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);
473  evel_service_endpoint_desc(endpoint_desc),
474  "Endpoint Description");
475 
476  EVEL_EXIT();
477 }
478 
479 /**************************************************************************/
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);
500  jitter,
501  "Endpoint Jitter");
502 
503  EVEL_EXIT();
504 }
505 
506 /**************************************************************************/
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);
527  rtp_oct_disc,
528  "Endpoint Rtp Octets Discarded");
529 
530  EVEL_EXIT();
531 }
532 
533 /**************************************************************************/
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);
554  rtp_oct_recv,
555  "Endpoint Rtp Octets Received");
556 
557  EVEL_EXIT();
558 }
559 
560 /**************************************************************************/
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);
581  rtp_oct_sent,
582  "Endpoint Rtp Octets Sent");
583 
584  EVEL_EXIT();
585 }
586 
587 /**************************************************************************/
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);
608  rtp_pkt_disc,
609  "Endpoint Rtp Packets Discarded");
610 
611  EVEL_EXIT();
612 }
613 
614 /**************************************************************************/
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);
635  rtp_pkt_recv,
636  "Endpoint Rtp Packets Received");
637 
638  EVEL_EXIT();
639 }
640 
641 /**************************************************************************/
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);
662  rtp_pkt_sent,
663  "Endpoint Rtp Packets Sent");
664 
665  EVEL_EXIT();
666 }
667 
668 /**************************************************************************/
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);
689  jitter,
690  "Local Jitter");
691 
692  EVEL_EXIT();
693 }
694 
695 /**************************************************************************/
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);
716  rtp_oct_disc,
717  "Local Rtp Octets Discarded");
718 
719  EVEL_EXIT();
720 }
721 
722 /**************************************************************************/
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);
743  rtp_oct_recv,
744  "Local Rtp Octets Received");
745 
746  EVEL_EXIT();
747 }
748 
749 /**************************************************************************/
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);
770  rtp_oct_sent,
771  "Local Rtp Octets Sent");
772 
773  EVEL_EXIT();
774 }
775 
776 /**************************************************************************/
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);
797  rtp_pkt_disc,
798  "Local Rtp Packets Discarded");
799 
800  EVEL_EXIT();
801 }
802 
803 /**************************************************************************/
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);
824  rtp_pkt_recv,
825  "Local Rtp Packets Received");
826 
827  EVEL_EXIT();
828 }
829 
830 /**************************************************************************/
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);
851  rtp_pkt_sent,
852  "Local Rtp Packets Sent");
853 
854  EVEL_EXIT();
855 }
856 
857 /**************************************************************************/
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);
878  mos_cqe,
879  "Mos Cqe");
880 
881  EVEL_EXIT();
882 }
883 
884 /**************************************************************************/
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);
905  packets_lost,
906  "Packets Lost");
907 
908  EVEL_EXIT();
909 }
910 
911 /**************************************************************************/
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);
933  packet_loss_percent,
934  "Packet Loss Percent");
935 
936  EVEL_EXIT();
937 }
938 
939 /**************************************************************************/
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);
960  r_factor,
961  "R Factor");
962 
963  EVEL_EXIT();
964 }
965 
966 /**************************************************************************/
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);
988  round_trip_delay,
989  "Round Trip Delay");
990 
991  EVEL_EXIT();
992 }
993 
994 /**************************************************************************/
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);
1017  phone_number,
1018  "Phone Number");
1019 
1020  EVEL_EXIT();
1021 }
1022 
1023 /**************************************************************************/
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  /***************************************************************************/
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 
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 /**************************************************************************/
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  }
1302  evel_free_option_string(&event->codec);
1310  evel_free_header(&event->header);
1311 
1312  EVEL_EXIT();
1313 }
EVEL_OPTION_STRING adjacency_name
Definition: evel.h:877
int minor_version
Definition: evel.h:845
void evel_init_option_int(EVEL_OPTION_INT *const option)
Initialize an EVEL_OPTION_INT to a not-set state.
Definition: evel_option.c:151
void evel_set_option_string(EVEL_OPTION_STRING *const option, const char *const value, const char *const description)
Set the value of an EVEL_OPTION_STRING.
Definition: evel_option.c:94
#define EVEL_DEBUG(FMT,...)
Definition: evel.h:3621
EVENT_SERVICE * evel_new_service(const char *const vendor_id, const char *const event_id)
Create a new Service event.
Definition: evel_service.c:55
void evel_service_endpoint_desc_set(EVENT_SERVICE *const event, const EVEL_SERVICE_ENDPOINT_DESC endpoint_desc)
Set the Endpoint Descriptor property of the Service event.
Definition: evel_service.c:461
void evel_service_r_factor_set(EVENT_SERVICE *const event, const int r_factor)
Set the R Factor property of the Service event.
Definition: evel_service.c:949
char * evel_service_endpoint_desc(const EVEL_ENTITY_STATE endpoint_desc)
Convert a EVEL_SERVICE_ENDPOINT_DESC to string form for JSON encoding.
Definition: evel_strings.c:453
void evel_service_friendly_name_set(EVENT_SERVICE *const event, const char *const friendly_name)
Set the Friendly Name property of the Service event.
Definition: evel_service.c:262
DLIST_ITEM * dlist_get_first(DLIST *list)
Definition: double_list.c:162
void evel_service_adjacency_name_set(EVENT_SERVICE *const event, const char *const adjacency_name)
Set the Adjacency Name property of the Service event.
Definition: evel_service.c:434
void evel_set_option_int(EVEL_OPTION_INT *const option, const int value, const char *const description)
Set the value of an EVEL_OPTION_INT.
Definition: evel_option.c:195
DLIST additional_fields
Definition: evel.h:856
void evel_service_addl_field_add(EVENT_SERVICE *const event, const char *const name, const char *const value)
Add a name/value pair to the Service, under the additionalFields array.
Definition: evel_service.c:163
EVEL_OPTION_INT local_rtp_oct_recv
Definition: evel.h:888
void dlist_initialize(DLIST *list)
List initialization.
Definition: double_list.c:55
bool evel_json_open_opt_named_object(EVEL_JSON_BUFFER *jbuf, const char *const key)
Add the opening bracket of an optional named object to a JSON buffer.
void evel_service_type_set(EVENT_SERVICE *const event, const char *const type)
Set the Event Type property of the Service event.
Definition: evel_service.c:135
#define EVEL_SERVICE_MINOR_VERSION
Definition: evel.h:833
EVEL_OPTION_STRING callee_side_codec
Definition: evel.h:866
void evel_service_caller_codec_set(EVENT_SERVICE *const event, const char *const codec)
Set the Caller Side Codec property of the Service event.
Definition: evel_service.c:375
void evel_json_encode_service(EVEL_JSON_BUFFER *const jbuf, EVENT_SERVICE *const event)
Encode the Service in JSON according to AT&T&#39;s schema for the event type.
EVEL_OPTION_INT endpoint_rtp_oct_sent
Definition: evel.h:882
void evel_service_local_rtp_pkt_disc_set(EVENT_SERVICE *const event, const int rtp_pkt_disc)
Set the Local Rtp Packets Discarded property of the Service event.
Definition: evel_service.c:786
void evel_service_correlator_set(EVENT_SERVICE *const event, const char *const correlator)
Set the Correlator property of the Service event.
Definition: evel_service.c:291
void evel_service_endpoint_rtp_oct_recv_set(EVENT_SERVICE *const event, const int rtp_oct_recv)
Set the Endpoint Rtp Octets Received property of the Service event.
Definition: evel_service.c:543
void * item
Definition: double_list.h:47
void evel_service_endpoint_jitter_set(EVENT_SERVICE *const event, const int jitter)
Set the Endpoint Jitter property of the Service event.
Definition: evel_service.c:489
EVEL_THROTTLE_SPEC * throttle_spec
EVEL_OPTION_INT endpoint_rtp_oct_disc
Definition: evel.h:880
void evel_service_round_trip_delay_set(EVENT_SERVICE *const event, const int round_trip_delay)
Set the Round Trip Delay property of the Service event.
Definition: evel_service.c:977
void evel_service_endpoint_rtp_pkt_recv_set(EVENT_SERVICE *const event, const int rtp_pkt_recv)
Set the Endpoint Rtp Packets Received property of the Service event.
Definition: evel_service.c:624
void evel_service_local_rtp_pkt_sent_set(EVENT_SERVICE *const event, const int rtp_pkt_sent)
Set the Local Rtp Packets Sent property of the Service event.
Definition: evel_service.c:840
bool evel_enc_kv_opt_double(EVEL_JSON_BUFFER *jbuf, const char *const key, const EVEL_OPTION_DOUBLE *const option)
Encode a string key and double value to a EVEL_JSON_BUFFER.
EVEL_OPTION_STRING endpoint_description
Definition: evel.h:878
#define EVEL_EXIT()
Definition: evel.h:3631
EVEL_EVENT_INSTANCE_ID instance_id
Definition: evel.h:850
EVEL_OPTION_STRING rtcp_data
Definition: evel.h:872
EVEL_OPTION_STRING codec
Definition: evel.h:861
int major_version
Definition: evel.h:844
void evel_json_close_list(EVEL_JSON_BUFFER *jbuf)
Add the closing bracket of a list to a JSON buffer.
EVEL_OPTION_INT endpoint_rtp_pkt_disc
Definition: evel.h:883
void evel_init_option_string(EVEL_OPTION_STRING *const option)
Initialize an EVEL_OPTION_STRING to a not-set state.
Definition: evel_option.c:72
#define EVEL_ENTER()
Definition: evel.h:3626
A Measurement for VF Reporting event.
Definition: evel.h:137
void evel_service_local_rtp_pkt_recv_set(EVENT_SERVICE *const event, const int rtp_pkt_recv)
Set the Local Rtp Packets Received property of the Service event.
Definition: evel_service.c:813
EVEL_OPTION_INT local_jitter
Definition: evel.h:886
void evel_set_option_double(EVEL_OPTION_DOUBLE *const option, const double value, const char *const description)
Set the value of an EVEL_OPTION_DOUBLE.
Definition: evel_option.c:271
EVEL_OPTION_STRING caller_side_codec
Definition: evel.h:867
void evel_json_encode_instance_id(EVEL_JSON_BUFFER *jbuf, EVEL_EVENT_INSTANCE_ID *instance_id)
Encode the instance id as a JSON object according to AT&T&#39;s schema.
Definition: evel_event.c:534
void evel_service_endpoint_rtp_oct_disc_set(EVENT_SERVICE *const event, const int rtp_oct_disc)
Set the Endpoint Rtp Octets Discarded property of the Service event.
Definition: evel_service.c:516
void evel_service_endpoint_rtp_pkt_disc_set(EVENT_SERVICE *const event, const int rtp_pkt_disc)
Set the Endpoint Rtp Packets Discarded property of the Service event.
Definition: evel_service.c:597
void evel_service_mos_cqe_set(EVENT_SERVICE *const event, const double mos_cqe)
Set the Mos Cqe property of the Service event.
Definition: evel_service.c:867
void evel_service_local_rtp_oct_recv_set(EVENT_SERVICE *const event, const int rtp_oct_recv)
Set the Local Rtp Octets Received property of the Service event.
Definition: evel_service.c:732
Other Field.
Definition: evel.h:803
EVEL_OPTION_INT round_trip_delay
Definition: evel.h:897
void evel_service_local_jitter_set(EVENT_SERVICE *const event, const int jitter)
Set the Local Jitter property of the Service event.
Definition: evel_service.c:678
EVEL_OPTION_INT endpoint_rtp_pkt_sent
Definition: evel.h:885
void evel_enc_kv_string(EVEL_JSON_BUFFER *jbuf, const char *const key, const char *const value)
Encode a string key and string value to a EVEL_JSON_BUFFER.
EVEL_OPTION_INT local_rtp_pkt_recv
Definition: evel.h:891
void evel_json_close_object(EVEL_JSON_BUFFER *jbuf)
Add the closing bracket of an object to a JSON buffer.
EVEL_OPTION_INT endpoint_rtp_pkt_recv
Definition: evel.h:884
char * value
Definition: evel.h:805
void evel_init_option_double(EVEL_OPTION_DOUBLE *const option)
Initialize an EVEL_OPTION_DOUBLE to a not-set state.
Definition: evel_option.c:227
void evel_service_endpoint_rtp_oct_sent_set(EVENT_SERVICE *const event, const int rtp_oct_sent)
Set the Endpoint Rtp Octets Sent property of the Service event.
Definition: evel_service.c:570
EVEL_OPTION_STRING phone_number
Definition: evel.h:902
void evel_service_product_id_set(EVENT_SERVICE *const event, const char *const product_id)
Set the Product Id property of the Service event.
Definition: evel_service.c:204
void evel_json_open_named_object(EVEL_JSON_BUFFER *jbuf, const char *const key)
Add the opening bracket of an object to a JSON buffer.
void evel_service_packets_lost_set(EVENT_SERVICE *const event, const int packets_lost)
Set the Packets Lost property of the Service event.
Definition: evel_service.c:894
EVEL_OPTION_INT endpoint_rtp_oct_recv
Definition: evel.h:881
void evel_json_open_object(EVEL_JSON_BUFFER *jbuf)
Add the opening bracket of an object to a JSON buffer.
EVEL_OPTION_INT local_rtp_pkt_sent
Definition: evel.h:892
EVEL_OPTION_DOUBLE mos_cqe
Definition: evel.h:893
EVEL_OPTION_INT packets_lost
Definition: evel.h:894
void evel_json_checkpoint(EVEL_JSON_BUFFER *jbuf)
Add a checkpoint - a stake in the ground to which we can rewind.
EVEL_OPTION_STRING event_friendly_name
Definition: evel.h:825
void evel_service_local_rtp_oct_sent_set(EVENT_SERVICE *const event, const int rtp_oct_sent)
Set the Local Rtp Octets Sent property of the Service event.
Definition: evel_service.c:759
char * name
Definition: evel.h:804
EVEL_EVENT_DOMAINS event_domain
Definition: evel.h:420
void evel_service_packet_loss_percent_set(EVENT_SERVICE *const event, const double packet_loss_percent)
Set the packet Loss Percent property of the Service event.
Definition: evel_service.c:922
EVEL_OPTION_STRING product_id
Definition: evel.h:823
void evel_json_encode_header(EVEL_JSON_BUFFER *jbuf, EVENT_HEADER *event)
Encode the event as a JSON event object according to AT&T&#39;s schema.
Definition: evel_event.c:291
#define EVEL_SERVICE_MAJOR_VERSION
Definition: evel.h:832
EVEL_OPTION_STRING subsystem_id
Definition: evel.h:824
EVEL_OPTION_DOUBLE packet_loss_percent
Definition: evel.h:895
void evel_service_codec_set(EVENT_SERVICE *const event, const char *const codec)
Set the Codec property of the Service event.
Definition: evel_service.c:319
void evel_free_header(EVENT_HEADER *const event)
Free an event header.
Definition: evel_event.c:349
void evel_service_subsystem_id_set(EVENT_SERVICE *const event, const char *const subsystem_id)
Set the Subsystem Id property of the Service event.
Definition: evel_service.c:233
EVENT_HEADER header
Definition: evel.h:843
void * dlist_pop_last(DLIST *list)
Definition: double_list.c:73
void dlist_push_last(DLIST *list, void *item)
Definition: double_list.c:132
Service Events.
Definition: evel.h:839
bool evel_json_open_opt_named_list(EVEL_JSON_BUFFER *jbuf, const char *const key)
Add the key and opening bracket of an optional named list to a JSON buffer.
void log_error_state(char *format,...)
Definition: evel_logging.c:98
EVEL_OPTION_INT endpoint_jitter
Definition: evel.h:879
EVEL_SERVICE_ENDPOINT_DESC
Service Event endpoint description JSON equivalent field: endpointDesc.
Definition: evel.h:341
void evel_free_service(EVENT_SERVICE *const event)
Free a Service event.
void evel_free_option_string(EVEL_OPTION_STRING *const option)
Free the underlying resources of an EVEL_OPTION_STRING.
Definition: evel_option.c:48
EVEL_OPTION_INT local_rtp_oct_disc
Definition: evel.h:887
bool evel_enc_kv_opt_string(EVEL_JSON_BUFFER *jbuf, const char *const key, const EVEL_OPTION_STRING *const option)
Encode a string key and string value to a EVEL_JSON_BUFFER.
DLIST_ITEM * dlist_get_next(DLIST_ITEM *item)
Definition: double_list.c:172
EVEL_OPTION_INT r_factor
Definition: evel.h:896
void evel_service_local_rtp_oct_disc_set(EVENT_SERVICE *const event, const int rtp_oct_disc)
Set the Local Rtp Octets Discarded property of the Service event.
Definition: evel_service.c:705
bool evel_enc_kv_opt_int(EVEL_JSON_BUFFER *jbuf, const char *const key, const EVEL_OPTION_INT *const option)
Encode a string key and integer value to a EVEL_JSON_BUFFER.
void evel_json_rewind(EVEL_JSON_BUFFER *jbuf)
Rewind to the latest checkoint.
void evel_header_type_set(EVENT_HEADER *const header, const char *const type)
Set the Event Type property of the event header.
Definition: evel_event.c:164
EVEL throttle definitions.
void evel_service_endpoint_rtp_pkt_sent_set(EVENT_SERVICE *const event, const int rtp_pkt_sent)
Set the Endpoint Rtp Packets Sent property of the Service event.
Definition: evel_service.c:651
void evel_init_event_instance_id(EVEL_EVENT_INSTANCE_ID *const instance_id, const char *const vendor_id, const char *const event_id)
Initialize an event instance id.
Definition: evel_event.c:471
void evel_enc_version(EVEL_JSON_BUFFER *jbuf, const char *const key, const int major_version, const int minor_version)
Encode a key and version.
void evel_init_header(EVENT_HEADER *const header)
Initialize a newly created event header.
Definition: evel_event.c:112
void evel_service_rtcp_data_set(EVENT_SERVICE *const event, const char *const rtcp_data)
Set the RTCP Data property of the Service event.
Definition: evel_service.c:404
bool evel_throttle_suppress_nv_pair(EVEL_THROTTLE_SPEC *throttle_spec, const char *const field_name, const char *const name)
Determine whether a name-value pair should be allowed (not suppressed).
void evel_free_event_instance_id(EVEL_EVENT_INSTANCE_ID *const instance_id)
Free an event instance id.
Definition: evel_event.c:505
void evel_service_phone_number_set(EVENT_SERVICE *const event, const char *const phone_number)
Set the Phone Number property of the Service event.
EVEL_OPTION_INT local_rtp_oct_sent
Definition: evel.h:889
void evel_service_callee_codec_set(EVENT_SERVICE *const event, const char *const codec)
Set the Callee Side Codec property of the Service event.
Definition: evel_service.c:347
EVEL_OPTION_INT local_rtp_pkt_disc
Definition: evel.h:890
EVEL_OPTION_STRING correlator
Definition: evel.h:855