summaryrefslogtreecommitdiffstats
path: root/vnfs/VES5.0/evel/evel-library/code/evel_library/evel.h
blob: 4df1ff0b2a5a01c1e6cfcca9aee689857397cbb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
#ifndef EVEL_INCLUDED
#define EVEL_INCLUDED
/*************************************************************************//**
 *
 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and 
 * limitations under the License.
 *
 ****************************************************************************/

/**************************************************************************//**
 * @file
 * Header for EVEL library
 *
 * This file implements the EVEL library which is intended to provide a
 * simple wrapper around the complexity of AT&T's Vendor Event Listener API so
 * that VNFs can use it without worrying about details of the API transport.
 *
 * Zero return value is success (::EVEL_SUCCESS), non-zero is failure and will
 * be one of ::EVEL_ERR_CODES.
 *****************************************************************************/

#ifdef __cplusplus
extern "C" {
#endif

#include <stdbool.h>
#include <stdio.h>
#include <stdarg.h>
#include <time.h>

#include "jsmn.h"
#include "double_list.h"
#include "hashtable.h"

/*****************************************************************************/
/* Supported API version.                                                    */
/*****************************************************************************/
#define EVEL_API_MAJOR_VERSION 5
#define EVEL_API_MINOR_VERSION 3

/**************************************************************************//**
 * Error codes
 *
 * Error codes for EVEL low level interface
 *****************************************************************************/
typedef enum {
  EVEL_SUCCESS,                   /** The operation was successful.          */
  EVEL_ERR_GEN_FAIL,              /** Non-specific failure.                  */
  EVEL_CURL_LIBRARY_FAIL,         /** A cURL library operation failed.       */
  EVEL_PTHREAD_LIBRARY_FAIL,      /** A Posix threads operation failed.      */
  EVEL_OUT_OF_MEMORY,             /** A memory allocation failure occurred.  */
  EVEL_EVENT_BUFFER_FULL,         /** Too many events in the ring-buffer.    */
  EVEL_EVENT_HANDLER_INACTIVE,    /** Attempt to raise event when inactive.  */
  EVEL_NO_METADATA,               /** Failed to retrieve OpenStack metadata. */
  EVEL_BAD_METADATA,              /** OpenStack metadata invalid format.     */
  EVEL_BAD_JSON_FORMAT,           /** JSON failed to parse correctly.        */
  EVEL_JSON_KEY_NOT_FOUND,        /** Failed to find the specified JSON key. */
  EVEL_MAX_ERROR_CODES            /** Maximum number of valid error codes.   */
} EVEL_ERR_CODES;

/**************************************************************************//**
 * Logging levels
 *
 * Variable levels of verbosity in the logging functions.
 *****************************************************************************/
typedef enum {
  EVEL_LOG_MIN               = 0,
  EVEL_LOG_SPAMMY            = 30,
  EVEL_LOG_DEBUG             = 40,
  EVEL_LOG_INFO              = 50,
  EVEL_LOG_ERROR             = 60,
  EVEL_LOG_MAX               = 101
} EVEL_LOG_LEVELS;

/*****************************************************************************/
/* Maximum string lengths.                                                   */
/*****************************************************************************/
#define EVEL_MAX_STRING_LEN          4096
#define EVEL_MAX_JSON_BODY           16000
#define EVEL_MAX_ERROR_STRING_LEN    255
#define EVEL_MAX_URL_LEN             511

/**************************************************************************//**
 * This value represents there being no restriction on the reporting interval.
 *****************************************************************************/
static const int EVEL_MEASUREMENT_INTERVAL_UKNOWN = 0;

/**************************************************************************//**
 * How many events can be backed-up before we start dropping events on the
 * floor.
 *
 * @note  This value should be tuned in accordance with expected burstiness of
 *        the event load and the expected response time of the ECOMP event
 *        listener so that the probability of the buffer filling is suitably
 *        low.
 *****************************************************************************/
static const int EVEL_EVENT_BUFFER_DEPTH = 100;

/*****************************************************************************/
/* How many different IP Types-of-Service are supported.                     */
/*****************************************************************************/
#define EVEL_TOS_SUPPORTED      256

/**************************************************************************//**
 * Event domains for the various events we support.
 * JSON equivalent field: domain
 *****************************************************************************/
typedef enum {
  EVEL_DOMAIN_INTERNAL,       /** Internal event, not for external routing.  */
  EVEL_DOMAIN_HEARTBEAT,      /** A Heartbeat event (event header only).     */
  EVEL_DOMAIN_FAULT,          /** A Fault event.                             */
  EVEL_DOMAIN_MEASUREMENT,    /** A Measurement for VF Scaling event.        */
  EVEL_DOMAIN_MOBILE_FLOW,    /** A Mobile Flow event.                       */
  EVEL_DOMAIN_REPORT,         /** A Measurement for VF Reporting event.      */
  EVEL_DOMAIN_HEARTBEAT_FIELD,/** A Heartbeat field event.                   */
  EVEL_DOMAIN_SIPSIGNALING,   /** A Signaling event.                         */
  EVEL_DOMAIN_STATE_CHANGE,   /** A State Change event.                      */
  EVEL_DOMAIN_SYSLOG,         /** A Syslog event.                            */
  EVEL_DOMAIN_OTHER,          /** Another event.                             */
  EVEL_DOMAIN_THRESHOLD_CROSS,  /** A Threshold Crossing  Event		     */
  EVEL_DOMAIN_VOICE_QUALITY,  /** A Voice Quality Event		 	     */
  EVEL_MAX_DOMAINS            /** Maximum number of recognized Event types.  */
} EVEL_EVENT_DOMAINS;

/**************************************************************************//**
 * Event priorities.
 * JSON equivalent field: priority
 *****************************************************************************/
typedef enum {
  EVEL_PRIORITY_HIGH,
  EVEL_PRIORITY_MEDIUM,
  EVEL_PRIORITY_NORMAL,
  EVEL_PRIORITY_LOW,
  EVEL_MAX_PRIORITIES
} EVEL_EVENT_PRIORITIES;

/**************************************************************************//**
 * Fault / Threshold severities.
 * JSON equivalent field: eventSeverity
 *****************************************************************************/
typedef enum {
  EVEL_SEVERITY_CRITICAL,
  EVEL_SEVERITY_MAJOR,
  EVEL_SEVERITY_MINOR,
  EVEL_SEVERITY_WARNING,
  EVEL_SEVERITY_NORMAL,
  EVEL_MAX_SEVERITIES
} EVEL_SEVERITIES;

/**************************************************************************//**
 * Fault source types.
 * JSON equivalent field: eventSourceType
 *****************************************************************************/
typedef enum {
  EVEL_SOURCE_OTHER,
  EVEL_SOURCE_ROUTER,
  EVEL_SOURCE_SWITCH,
  EVEL_SOURCE_HOST,
  EVEL_SOURCE_CARD,
  EVEL_SOURCE_PORT,
  EVEL_SOURCE_SLOT_THRESHOLD,
  EVEL_SOURCE_PORT_THRESHOLD,
  EVEL_SOURCE_VIRTUAL_MACHINE,
  EVEL_SOURCE_VIRTUAL_NETWORK_FUNCTION,
  /***************************************************************************/
  /* START OF VENDOR-SPECIFIC VALUES                                         */
  /*                                                                         */
  /* Vendor-specific values should be added here, and handled appropriately  */
  /* in evel_event.c.                                                        */
  /***************************************************************************/

  /***************************************************************************/
  /* END OF VENDOR-SPECIFIC VALUES                                           */
  /***************************************************************************/
  EVEL_MAX_SOURCE_TYPES
} EVEL_SOURCE_TYPES;

/**************************************************************************//**
 * Fault VNF Status.
 * JSON equivalent field: vfStatus
 *****************************************************************************/
typedef enum {
  EVEL_VF_STATUS_ACTIVE,
  EVEL_VF_STATUS_IDLE,
  EVEL_VF_STATUS_PREP_TERMINATE,
  EVEL_VF_STATUS_READY_TERMINATE,
  EVEL_VF_STATUS_REQ_TERMINATE,
  EVEL_MAX_VF_STATUSES
} EVEL_VF_STATUSES;

/**************************************************************************//**
 * Counter criticalities.
 * JSON equivalent field: criticality
 *****************************************************************************/
typedef enum {
  EVEL_COUNTER_CRITICALITY_CRIT,
  EVEL_COUNTER_CRITICALITY_MAJ,
  EVEL_MAX_COUNTER_CRITICALITIES
} EVEL_COUNTER_CRITICALITIES;

/**************************************************************************//**
 * Alert actions.
 * JSON equivalent field: alertAction
 *****************************************************************************/
typedef enum {
  EVEL_ALERT_ACTION_CLEAR,
  EVEL_ALERT_ACTION_CONT,
  EVEL_ALERT_ACTION_SET,
  EVEL_MAX_ALERT_ACTIONS
} EVEL_ALERT_ACTIONS;

/**************************************************************************//**
 * Alert types.
 * JSON equivalent field: alertType
 *****************************************************************************/
typedef enum {
  EVEL_ALERT_TYPE_CARD,
  EVEL_ALERT_TYPE_ELEMENT,
  EVEL_ALERT_TYPE_INTERFACE,
  EVEL_ALERT_TYPE_SERVICE,
  EVEL_MAX_ALERT_TYPES
} EVEL_ALERT_TYPES;

/**************************************************************************//**
 * Alert types.
 * JSON equivalent fields: newState, oldState
 *****************************************************************************/
typedef enum {
  EVEL_ENTITY_STATE_IN_SERVICE,
  EVEL_ENTITY_STATE_MAINTENANCE,
  EVEL_ENTITY_STATE_OUT_OF_SERVICE,
  EVEL_MAX_ENTITY_STATES
} EVEL_ENTITY_STATE;

/**************************************************************************//**
 * Syslog facilities.
 * JSON equivalent field: syslogFacility
 *****************************************************************************/
typedef enum {
  EVEL_SYSLOG_FACILITY_KERNEL,
  EVEL_SYSLOG_FACILITY_USER,
  EVEL_SYSLOG_FACILITY_MAIL,
  EVEL_SYSLOG_FACILITY_SYSTEM_DAEMON,
  EVEL_SYSLOG_FACILITY_SECURITY_AUTH,
  EVEL_SYSLOG_FACILITY_INTERNAL,
  EVEL_SYSLOG_FACILITY_LINE_PRINTER,
  EVEL_SYSLOG_FACILITY_NETWORK_NEWS,
  EVEL_SYSLOG_FACILITY_UUCP,
  EVEL_SYSLOG_FACILITY_CLOCK_DAEMON,
  EVEL_SYSLOG_FACILITY_SECURITY_AUTH2,
  EVEL_SYSLOG_FACILITY_FTP_DAEMON,
  EVEL_SYSLOG_FACILITY_NTP,
  EVEL_SYSLOG_FACILITY_LOG_AUDIT,
  EVEL_SYSLOG_FACILITY_LOG_ALERT,
  EVEL_SYSLOG_FACILITY_CLOCK_DAEMON2,
  EVEL_SYSLOG_FACILITY_LOCAL0,
  EVEL_SYSLOG_FACILITY_LOCAL1,
  EVEL_SYSLOG_FACILITY_LOCAL2,
  EVEL_SYSLOG_FACILITY_LOCAL3,
  EVEL_SYSLOG_FACILITY_LOCAL4,
  EVEL_SYSLOG_FACILITY_LOCAL5,
  EVEL_SYSLOG_FACILITY_LOCAL6,
  EVEL_SYSLOG_FACILITY_LOCAL7,
  EVEL_MAX_SYSLOG_FACILITIES
} EVEL_SYSLOG_FACILITIES;

/**************************************************************************//**
 * TCP flags.
 * JSON equivalent fields: tcpFlagCountList, tcpFlagList
 *****************************************************************************/
typedef enum {
  EVEL_TCP_NS,
  EVEL_TCP_CWR,
  EVEL_TCP_ECE,
  EVEL_TCP_URG,
  EVEL_TCP_ACK,
  EVEL_TCP_PSH,
  EVEL_TCP_RST,
  EVEL_TCP_SYN,
  EVEL_TCP_FIN,
  EVEL_MAX_TCP_FLAGS
} EVEL_TCP_FLAGS;

/**************************************************************************//**
 * Mobile QCI Classes of Service.
 * JSON equivalent fields: mobileQciCosCountList, mobileQciCosList
 *****************************************************************************/
typedef enum {

  /***************************************************************************/
  /* UMTS Classes of Service.                                                */
  /***************************************************************************/
  EVEL_QCI_COS_UMTS_CONVERSATIONAL,
  EVEL_QCI_COS_UMTS_STREAMING,
  EVEL_QCI_COS_UMTS_INTERACTIVE,
  EVEL_QCI_COS_UMTS_BACKGROUND,

  /***************************************************************************/
  /* LTE Classes of Service.                                                 */
  /***************************************************************************/
  EVEL_QCI_COS_LTE_1,
  EVEL_QCI_COS_LTE_2,
  EVEL_QCI_COS_LTE_3,
  EVEL_QCI_COS_LTE_4,
  EVEL_QCI_COS_LTE_65,
  EVEL_QCI_COS_LTE_66,
  EVEL_QCI_COS_LTE_5,
  EVEL_QCI_COS_LTE_6,
  EVEL_QCI_COS_LTE_7,
  EVEL_QCI_COS_LTE_8,
  EVEL_QCI_COS_LTE_9,
  EVEL_QCI_COS_LTE_69,
  EVEL_QCI_COS_LTE_70,
  EVEL_MAX_QCI_COS_TYPES
} EVEL_QCI_COS_TYPES;

/**************************************************************************//**
 * Service Event endpoint description
 * JSON equivalent field: endpointDesc
 *****************************************************************************/
typedef enum {
  EVEL_SERVICE_ENDPOINT_CALLEE,
  EVEL_SERVICE_ENDPOINT_CALLER,
  EVEL_MAX_SERVICE_ENDPOINT_DESC
} EVEL_SERVICE_ENDPOINT_DESC;

/**************************************************************************//**
 * Boolean type for EVEL library.
 *****************************************************************************/
typedef enum {
  EVEL_FALSE,
  EVEL_TRUE
} EVEL_BOOLEAN;

/**************************************************************************//**
 * Optional parameter holder for double.
 *****************************************************************************/
typedef struct evel_option_double
{
  double value;
  EVEL_BOOLEAN is_set;
} EVEL_OPTION_DOUBLE;

/**************************************************************************//**
 * Optional parameter holder for string.
 *****************************************************************************/
typedef struct evel_option_string
{
  char * value;
  EVEL_BOOLEAN is_set;
} EVEL_OPTION_STRING;

/**************************************************************************//**
 * Optional parameter holder for int.
 *****************************************************************************/
typedef struct evel_option_int
{
  int value;
  EVEL_BOOLEAN is_set;
} EVEL_OPTION_INT;

/**************************************************************************//**
 * Optional parameter holder for unsigned long long.
 *****************************************************************************/
typedef struct evel_option_ull
{
  unsigned long long value;
  EVEL_BOOLEAN is_set;
} EVEL_OPTION_ULL;

/**************************************************************************//**
 * Optional parameter holder for time_t.
 *****************************************************************************/
typedef struct evel_option_time
{
  time_t value;
  EVEL_BOOLEAN is_set;
} EVEL_OPTION_TIME;

/**************************************************************************//**
 * enrichment fields for internal VES Event Listener service use only,
 * not supplied by event sources
 *****************************************************************************/
typedef struct internal_header_fields
{
  void *object;
  EVEL_BOOLEAN is_set;
} EVEL_OPTION_INTHEADER_FIELDS;

/*****************************************************************************/
/* Supported Common Event Header version.                                    */
/*****************************************************************************/
#define EVEL_HEADER_MAJOR_VERSION 3
#define EVEL_HEADER_MINOR_VERSION 0

/**************************************************************************//**
 * Event header.
 * JSON equivalent field: commonEventHeader
 *****************************************************************************/
typedef struct event_header {
  /***************************************************************************/
  /* Version                                                                 */
  /***************************************************************************/
  int major_version;
  int minor_version;

  /***************************************************************************/
  /* Mandatory fields                                                        */
  /***************************************************************************/
  EVEL_EVENT_DOMAINS event_domain;
  char * event_id;
  char * event_name;
  char * source_name;
  char * reporting_entity_name;
  EVEL_EVENT_PRIORITIES priority;
  unsigned long long start_epoch_microsec;
  unsigned long long last_epoch_microsec;
  int sequence;

  /***************************************************************************/
  /* Optional fields                                                         */
  /***************************************************************************/
  EVEL_OPTION_STRING event_type;
  EVEL_OPTION_STRING source_id;
  EVEL_OPTION_STRING reporting_entity_id;
  EVEL_OPTION_INTHEADER_FIELDS internal_field;
  EVEL_OPTION_STRING nfcnaming_code;
  EVEL_OPTION_STRING nfnaming_code;

} EVENT_HEADER;

/*****************************************************************************/
/* Supported Fault version.                                                  */
/*****************************************************************************/
#define EVEL_FAULT_MAJOR_VERSION 2
#define EVEL_FAULT_MINOR_VERSION 1

/**************************************************************************//**
 * Fault.
 * JSON equivalent field: faultFields
 *****************************************************************************/
typedef struct event_fault {
  /***************************************************************************/
  /* Header and version                                                      */
  /***************************************************************************/
  EVENT_HEADER header;
  int major_version;
  int minor_version;

  /***************************************************************************/
  /* Mandatory fields                                                        */
  /***************************************************************************/
  EVEL_SEVERITIES event_severity;
  EVEL_SOURCE_TYPES event_source_type;
  char * alarm_condition;
  char * specific_problem;
  EVEL_VF_STATUSES vf_status;

  /***************************************************************************/
  /* Optional fields                                                         */
  /***************************************************************************/
  EVEL_OPTION_STRING category;
  EVEL_OPTION_STRING alarm_interface_a;
  DLIST additional_info;

} EVENT_FAULT;

/**************************************************************************//**
 * Fault Additional Info.
 * JSON equivalent field: alarmAdditionalInformation
 *****************************************************************************/
typedef struct fault_additional_info {
  char * name;
  char * value;
} FAULT_ADDL_INFO;


/**************************************************************************//**
 * optional field block for fields specific to heartbeat events
 *****************************************************************************/
typedef struct event_heartbeat_fields
{
  /***************************************************************************/
  /* Header and version                                                      */
  /***************************************************************************/
  EVENT_HEADER header;
  int major_version;
  int minor_version;

  /***************************************************************************/
  /* Mandatory fields                                                        */
  /***************************************************************************/
  double heartbeat_version;
  int    heartbeat_interval;

  /***************************************************************************/
  /* Optional fields                                                         */
  /***************************************************************************/
  DLIST additional_info;

} EVENT_HEARTBEAT_FIELD;

/**************************************************************************//**
 * tuple which provides the name of a key along with its value and
 * relative order
 *****************************************************************************/
typedef struct internal_key
{
  char                *keyname;
  EVEL_OPTION_INT      keyorder;
  EVEL_OPTION_STRING   keyvalue;
} EVEL_INTERNAL_KEY;

/**************************************************************************//**
 * meta-information about an instance of a jsonObject along with
 * the actual object instance
 *****************************************************************************/
typedef struct json_object_instance
{

  char *jsonstring;
  unsigned long long objinst_epoch_microsec;
  DLIST object_keys; /*EVEL_INTERNAL_KEY list */

} EVEL_JSON_OBJECT_INSTANCE;
#define MAX_JSON_TOKENS 128
/**************************************************************************//**
 * Create a new json object instance.
 *
 * @note    The mandatory fields on the Other must be supplied to this factory
 *          function and are immutable once set.  Optional fields have explicit
 *          setter functions, but again values may only be set once so that the
 *          Other has immutable properties.
 * @param   yourjson       json string.
 * @returns pointer to the newly manufactured ::EVEL_JSON_OBJECT_INSTANCE.
 *          not used (i.e. posted) it must be released using ::evel_free_jsonobjectinstance.
 * @retval  NULL  Failed to create the json object instance.
 *****************************************************************************/
EVEL_JSON_OBJECT_INSTANCE * evel_new_jsonobjinstance(const char *const yourjson);
/**************************************************************************//**
 * Free an json object instance.
 *
 * Free off the json object instance supplied.
 *  Will free all the contained allocated memory.
 *
 *****************************************************************************/
void evel_free_jsonobjinst(EVEL_JSON_OBJECT_INSTANCE * objinst);

/**************************************************************************//**
 * enrichment fields for internal VES Event Listener service use only,
 * not supplied by event sources
 *****************************************************************************/
typedef struct json_object
{

  char *object_name;
  EVEL_OPTION_STRING objectschema;
  EVEL_OPTION_STRING objectschemaurl;
  EVEL_OPTION_STRING nfsubscribedobjname;
  EVEL_OPTION_STRING nfsubscriptionid;
  DLIST jsonobjectinstances;  /* EVEL_JSON_OBJECT_INSTANCE list */

} EVEL_JSON_OBJECT;

/**************************************************************************//**
 * Create a new json object.
 *
 * @note    The mandatory fields on the Other must be supplied to this factory
 *          function and are immutable once set.  Optional fields have explicit
 *          setter functions, but again values may only be set once so that the
 *          Other has immutable properties.
 * @param name       name of the object.
 * @returns pointer to the newly manufactured ::EVEL_JSON_OBJECT.
 *          not used (i.e. posted) it must be released using ::evel_free_jsonobject.
 * @retval  NULL  Failed to create the json object.
 *****************************************************************************/
EVEL_JSON_OBJECT * evel_new_jsonobject(const char *const name);
/**************************************************************************//**
 * Free an json object.
 *
 * Free off the json object instance supplied.
 *  Will free all the contained allocated memory.
 *
 *****************************************************************************/
void evel_free_jsonobject(EVEL_JSON_OBJECT * jsobj);
/*****************************************************************************/
/* Supported Measurement version.                                            */
/*****************************************************************************/
#define EVEL_MEASUREMENT_MAJOR_VERSION 2
#define EVEL_MEASUREMENT_MINOR_VERSION 0

/**************************************************************************//**
 * Errors.
 * JSON equivalent field: errors
 *****************************************************************************/
typedef struct measurement_errors {
  int receive_discards;
  int receive_errors;
  int transmit_discards;
  int transmit_errors;
} MEASUREMENT_ERRORS;

/**************************************************************************//**
 * Measurement.
 * JSON equivalent field: measurementsForVfScalingFields
 *****************************************************************************/
typedef struct event_measurement {
  /***************************************************************************/
  /* Header and version                                                      */
  /***************************************************************************/
  EVENT_HEADER header;
  int major_version;
  int minor_version;

  /***************************************************************************/
  /* Mandatory fields                                                        */
  /***************************************************************************/
  double measurement_interval;

  /***************************************************************************/
  /* Optional fields                                                         */
  /***************************************************************************/
  DLIST additional_info;
  DLIST additional_measurements;
  DLIST additional_objects;
  DLIST codec_usage;
  EVEL_OPTION_INT concurrent_sessions;
  EVEL_OPTION_INT configured_entities;
  DLIST cpu_usage;
  DLIST disk_usage;
  MEASUREMENT_ERRORS * errors;
  DLIST feature_usage;
  DLIST filesystem_usage;
  DLIST latency_distribution;
  EVEL_OPTION_DOUBLE mean_request_latency;
  DLIST mem_usage;
  EVEL_OPTION_INT media_ports_in_use;
  EVEL_OPTION_INT request_rate;
  EVEL_OPTION_INT vnfc_scaling_metric;
  DLIST vnic_usage;

} EVENT_MEASUREMENT;

/**************************************************************************//**
 * CPU Usage.
 * JSON equivalent field: cpuUsage
 *****************************************************************************/
typedef struct measurement_cpu_use {
  char * id;
  double usage;
  EVEL_OPTION_DOUBLE idle;
  EVEL_OPTION_DOUBLE intrpt;
  EVEL_OPTION_DOUBLE nice;
  EVEL_OPTION_DOUBLE softirq;
  EVEL_OPTION_DOUBLE steal;
  EVEL_OPTION_DOUBLE sys;
  EVEL_OPTION_DOUBLE user;
  EVEL_OPTION_DOUBLE wait;
} MEASUREMENT_CPU_USE;


/**************************************************************************//**
 * Disk Usage.
 * JSON equivalent field: diskUsage
 *****************************************************************************/
typedef struct measurement_disk_use {
  char * id;
  EVEL_OPTION_DOUBLE iotimeavg;
  EVEL_OPTION_DOUBLE iotimelast;
  EVEL_OPTION_DOUBLE iotimemax;
  EVEL_OPTION_DOUBLE iotimemin;
  EVEL_OPTION_DOUBLE mergereadavg;
  EVEL_OPTION_DOUBLE mergereadlast;
  EVEL_OPTION_DOUBLE mergereadmax;
  EVEL_OPTION_DOUBLE mergereadmin;
  EVEL_OPTION_DOUBLE mergewriteavg;
  EVEL_OPTION_DOUBLE mergewritelast;
  EVEL_OPTION_DOUBLE mergewritemax;
  EVEL_OPTION_DOUBLE mergewritemin;
  EVEL_OPTION_DOUBLE octetsreadavg;
  EVEL_OPTION_DOUBLE octetsreadlast;
  EVEL_OPTION_DOUBLE octetsreadmax;
  EVEL_OPTION_DOUBLE octetsreadmin;
  EVEL_OPTION_DOUBLE octetswriteavg;
  EVEL_OPTION_DOUBLE octetswritelast;
  EVEL_OPTION_DOUBLE octetswritemax;
  EVEL_OPTION_DOUBLE octetswritemin;
  EVEL_OPTION_DOUBLE opsreadavg;
  EVEL_OPTION_DOUBLE opsreadlast;
  EVEL_OPTION_DOUBLE opsreadmax;
  EVEL_OPTION_DOUBLE opsreadmin;
  EVEL_OPTION_DOUBLE opswriteavg;
  EVEL_OPTION_DOUBLE opswritelast;
  EVEL_OPTION_DOUBLE opswritemax;
  EVEL_OPTION_DOUBLE opswritemin;
  EVEL_OPTION_DOUBLE pendingopsavg;
  EVEL_OPTION_DOUBLE pendingopslast;
  EVEL_OPTION_DOUBLE pendingopsmax;
  EVEL_OPTION_DOUBLE pendingopsmin;
  EVEL_OPTION_DOUBLE timereadavg;
  EVEL_OPTION_DOUBLE timereadlast;
  EVEL_OPTION_DOUBLE timereadmax;
  EVEL_OPTION_DOUBLE timereadmin;
  EVEL_OPTION_DOUBLE timewriteavg;
  EVEL_OPTION_DOUBLE timewritelast;
  EVEL_OPTION_DOUBLE timewritemax;
  EVEL_OPTION_DOUBLE timewritemin;

} MEASUREMENT_DISK_USE;

/**************************************************************************//**
 * Add an additional Disk usage value name/value pair to the Measurement.
 *
 * The name and value are null delimited ASCII strings.  The library takes
 * a copy so the caller does not have to preserve values after the function
 * returns.
 *
 * @param measurement   Pointer to the measurement.
 * @param id            ASCIIZ string with the CPU's identifier.
 * @param usage         Disk utilization.
 *****************************************************************************/
MEASUREMENT_DISK_USE * evel_measurement_new_disk_use_add(EVENT_MEASUREMENT * measurement, char * id);

/**************************************************************************//**
 * Filesystem Usage.
 * JSON equivalent field: filesystemUsage
 *****************************************************************************/
typedef struct measurement_fsys_use {
  char * filesystem_name;
  double block_configured;
  double block_iops;
  double block_used;
  double ephemeral_configured;
  double ephemeral_iops;
  double ephemeral_used;
} MEASUREMENT_FSYS_USE;

/**************************************************************************//**
 * Memory Usage.
 * JSON equivalent field: memoryUsage
 *****************************************************************************/
typedef struct measurement_mem_use {
  char * id;
  char * vmid;
  double membuffsz;
  EVEL_OPTION_DOUBLE memcache;
  EVEL_OPTION_DOUBLE memconfig;
  EVEL_OPTION_DOUBLE memfree;
  EVEL_OPTION_DOUBLE slabrecl;
  EVEL_OPTION_DOUBLE slabunrecl;
  EVEL_OPTION_DOUBLE memused;
} MEASUREMENT_MEM_USE;

/**************************************************************************//**
 * Add an additional Memory usage value name/value pair to the Measurement.
 *
 * The name and value are null delimited ASCII strings.  The library takes
 * a copy so the caller does not have to preserve values after the function
 * returns.
 *
 * @param measurement   Pointer to the measurement.
 * @param id            ASCIIZ string with the Memory identifier.
 * @param vmidentifier  ASCIIZ string with the VM's identifier.
 * @param membuffsz     Memory Size.
 *
 * @return  Returns pointer to memory use structure in measurements
 *****************************************************************************/
MEASUREMENT_MEM_USE * evel_measurement_new_mem_use_add(EVENT_MEASUREMENT * measurement,
                                 char * id,  char *vmidentifier,  double membuffsz);

/**************************************************************************//**
 * Set kilobytes of memory used for cache
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param mem_use      Pointer to the Memory Use.
 * @param val          double
 *****************************************************************************/
void evel_measurement_mem_use_memcache_set(MEASUREMENT_MEM_USE * const mem_use,
                                    const double val);
/**************************************************************************//**
 * Set kilobytes of memory configured in the virtual machine on which the VNFC reporting
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param mem_use      Pointer to the Memory Use.
 * @param val          double
 *****************************************************************************/
void evel_measurement_mem_use_memconfig_set(MEASUREMENT_MEM_USE * const mem_use,
                                    const double val);
/**************************************************************************//**
 * Set kilobytes of physical RAM left unused by the system
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param mem_use      Pointer to the Memory Use.
 * @param val          double
 *****************************************************************************/
void evel_measurement_mem_use_memfree_set(MEASUREMENT_MEM_USE * const mem_use,
                                    const double val);
/**************************************************************************//**
 * Set the part of the slab that can be reclaimed such as caches measured in kilobytes
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param mem_use      Pointer to the Memory Use.
 * @param val          double
 *****************************************************************************/
void evel_measurement_mem_use_slab_reclaimed_set(MEASUREMENT_MEM_USE * const mem_use,
                                    const double val);
/**************************************************************************//**
 * Set the part of the slab that cannot be reclaimed such as caches measured in kilobytes
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param mem_use      Pointer to the Memory Use.
 * @param val          double
 *****************************************************************************/
void evel_measurement_mem_use_slab_unreclaimable_set(MEASUREMENT_MEM_USE * const mem_use,
                                    const double val);
/**************************************************************************//**
 * Set the total memory minus the sum of free, buffered, cached and slab memory in kilobytes
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param mem_use      Pointer to the Memory Use.
 * @param val          double
 *****************************************************************************/
void evel_measurement_mem_use_usedup_set(MEASUREMENT_MEM_USE * const mem_use,
                                    const double val);
/**************************************************************************//**
 * Latency Bucket.
 * JSON equivalent field: latencyBucketMeasure
 *****************************************************************************/
typedef struct measurement_latency_bucket {
  int count;

  /***************************************************************************/
  /* Optional fields                                                         */
  /***************************************************************************/
  EVEL_OPTION_DOUBLE high_end;
  EVEL_OPTION_DOUBLE low_end;

} MEASUREMENT_LATENCY_BUCKET;

/**************************************************************************//**
 * Virtual NIC usage.
 * JSON equivalent field: vNicUsage
 *****************************************************************************/
typedef struct measurement_vnic_performance {
  /***************************************************************************/
  /* Optional fields                                                         */
  /***************************************************************************/
  /*Cumulative count of broadcast packets received as read at the end of
   the measurement interval*/
  EVEL_OPTION_DOUBLE recvd_bcast_packets_acc;
  /*Count of broadcast packets received within the measurement interval*/
  EVEL_OPTION_DOUBLE recvd_bcast_packets_delta;
  /*Cumulative count of discarded packets received as read at the end of
   the measurement interval*/
  EVEL_OPTION_DOUBLE recvd_discarded_packets_acc;
  /*Count of discarded packets received within the measurement interval*/
  EVEL_OPTION_DOUBLE recvd_discarded_packets_delta;
  /*Cumulative count of error packets received as read at the end of
   the measurement interval*/
  EVEL_OPTION_DOUBLE recvd_error_packets_acc;
  /*Count of error packets received within the measurement interval*/
  EVEL_OPTION_DOUBLE recvd_error_packets_delta;
  /*Cumulative count of multicast packets received as read at the end of
   the measurement interval*/
  EVEL_OPTION_DOUBLE recvd_mcast_packets_acc;
  /*Count of mcast packets received within the measurement interval*/
  EVEL_OPTION_DOUBLE recvd_mcast_packets_delta;
  /*Cumulative count of octets received as read at the end of
   the measurement interval*/
  EVEL_OPTION_DOUBLE recvd_octets_acc;
  /*Count of octets received within the measurement interval*/
  EVEL_OPTION_DOUBLE recvd_octets_delta;
  /*Cumulative count of all packets received as read at the end of
   the measurement interval*/
  EVEL_OPTION_DOUBLE recvd_total_packets_acc;
  /*Count of all packets received within the measurement interval*/
  EVEL_OPTION_DOUBLE recvd_total_packets_delta;
  /*Cumulative count of unicast packets received as read at the end of
   the measurement interval*/
  EVEL_OPTION_DOUBLE recvd_ucast_packets_acc;
  /*Count of unicast packets received within the measurement interval*/
  EVEL_OPTION_DOUBLE recvd_ucast_packets_delta;
  /*Cumulative count of transmitted broadcast packets at the end of
   the measurement interval*/
  EVEL_OPTION_DOUBLE tx_bcast_packets_acc;
  /*Count of transmitted broadcast packets within the measurement interval*/
  EVEL_OPTION_DOUBLE tx_bcast_packets_delta;
  /*Cumulative count of transmit discarded packets at the end of
   the measurement interval*/
  EVEL_OPTION_DOUBLE tx_discarded_packets_acc;
  /*Count of transmit discarded packets within the measurement interval*/
  EVEL_OPTION_DOUBLE tx_discarded_packets_delta;
  /*Cumulative count of transmit error packets at the end of
   the measurement interval*/
  EVEL_OPTION_DOUBLE tx_error_packets_acc;
  /*Count of transmit error packets within the measurement interval*/
  EVEL_OPTION_DOUBLE tx_error_packets_delta;
  /*Cumulative count of transmit multicast packets at the end of
   the measurement interval*/
  EVEL_OPTION_DOUBLE tx_mcast_packets_acc;
  /*Count of transmit multicast packets within the measurement interval*/
  EVEL_OPTION_DOUBLE tx_mcast_packets_delta;
  /*Cumulative count of transmit octets at the end of
   the measurement interval*/
  EVEL_OPTION_DOUBLE tx_octets_acc;
  /*Count of transmit octets received within the measurement interval*/
  EVEL_OPTION_DOUBLE tx_octets_delta;
  /*Cumulative count of all transmit packets at the end of
   the measurement interval*/
  EVEL_OPTION_DOUBLE tx_total_packets_acc;
  /*Count of transmit packets within the measurement interval*/
  EVEL_OPTION_DOUBLE tx_total_packets_delta;
  /*Cumulative count of all transmit unicast packets at the end of
   the measurement interval*/
  EVEL_OPTION_DOUBLE tx_ucast_packets_acc;
  /*Count of transmit unicast packets within the measurement interval*/
  EVEL_OPTION_DOUBLE tx_ucast_packets_delta;
  /* Indicates whether vNicPerformance values are likely inaccurate
           due to counter overflow or other condtions*/
  char *valuesaresuspect;
  char *vnic_id;

} MEASUREMENT_VNIC_PERFORMANCE;

/**************************************************************************//**
 * Codec Usage.
 * JSON equivalent field: codecsInUse
 *****************************************************************************/
typedef struct measurement_codec_use {
  char * codec_id;
  int number_in_use;
} MEASUREMENT_CODEC_USE;

/**************************************************************************//**
 * Feature Usage.
 * JSON equivalent field: featuresInUse
 *****************************************************************************/
typedef struct measurement_feature_use {
  char * feature_id;
  int feature_utilization;
} MEASUREMENT_FEATURE_USE;

/**************************************************************************//**
 * Measurement Group.
 * JSON equivalent field: additionalMeasurements
 *****************************************************************************/
typedef struct measurement_group {
  char * name;
  DLIST measurements;
} MEASUREMENT_GROUP;

/**************************************************************************//**
 * Custom Defined Measurement.
 * JSON equivalent field: measurements
 *****************************************************************************/
typedef struct custom_measurement {
  char * name;
  char * value;
} CUSTOM_MEASUREMENT;

/*****************************************************************************/
/* Supported Report version.                                                 */
/*****************************************************************************/
#define EVEL_REPORT_MAJOR_VERSION 1
#define EVEL_REPORT_MINOR_VERSION 1

/**************************************************************************//**
 * Report.
 * JSON equivalent field: measurementsForVfReportingFields
 *
 * @note  This is an experimental event type and is not currently a formal part
 *        of AT&T's specification.
 *****************************************************************************/
typedef struct event_report {
  /***************************************************************************/
  /* Header and version                                                      */
  /***************************************************************************/
  EVENT_HEADER header;
  int major_version;
  int minor_version;

  /***************************************************************************/
  /* Mandatory fields                                                        */
  /***************************************************************************/
  double measurement_interval;

  /***************************************************************************/
  /* Optional fields                                                         */
  /***************************************************************************/
  DLIST feature_usage;
  DLIST measurement_groups;

} EVENT_REPORT;

/**************************************************************************//**
 * Mobile GTP Per Flow Metrics.
 * JSON equivalent field: gtpPerFlowMetrics
 *****************************************************************************/
typedef struct mobile_gtp_per_flow_metrics {
  double avg_bit_error_rate;
  double avg_packet_delay_variation;
  int avg_packet_latency;
  int avg_receive_throughput;
  int avg_transmit_throughput;
  int flow_activation_epoch;
  int flow_activation_microsec;
  int flow_deactivation_epoch;
  int flow_deactivation_microsec;
  time_t flow_deactivation_time;
  char * flow_status;
  int max_packet_delay_variation;
  int num_activation_failures;
  int num_bit_errors;
  int num_bytes_received;
  int num_bytes_transmitted;
  int num_dropped_packets;
  int num_l7_bytes_received;
  int num_l7_bytes_transmitted;
  int num_lost_packets;
  int num_out_of_order_packets;
  int num_packet_errors;
  int num_packets_received_excl_retrans;
  int num_packets_received_incl_retrans;
  int num_packets_transmitted_incl_retrans;
  int num_retries;
  int num_timeouts;
  int num_tunneled_l7_bytes_received;
  int round_trip_time;
  int time_to_first_byte;

  /***************************************************************************/
  /* Optional fields                                                         */
  /***************************************************************************/
  EVEL_OPTION_INT ip_tos_counts[EVEL_TOS_SUPPORTED];
  EVEL_OPTION_INT tcp_flag_counts[EVEL_MAX_TCP_FLAGS];
  EVEL_OPTION_INT qci_cos_counts[EVEL_MAX_QCI_COS_TYPES];
  EVEL_OPTION_INT dur_connection_failed_status;
  EVEL_OPTION_INT dur_tunnel_failed_status;
  EVEL_OPTION_STRING flow_activated_by;
  EVEL_OPTION_TIME flow_activation_time;
  EVEL_OPTION_STRING flow_deactivated_by;
  EVEL_OPTION_STRING gtp_connection_status;
  EVEL_OPTION_STRING gtp_tunnel_status;
  EVEL_OPTION_INT large_packet_rtt;
  EVEL_OPTION_DOUBLE large_packet_threshold;
  EVEL_OPTION_INT max_receive_bit_rate;
  EVEL_OPTION_INT max_transmit_bit_rate;
  EVEL_OPTION_INT num_gtp_echo_failures;
  EVEL_OPTION_INT num_gtp_tunnel_errors;
  EVEL_OPTION_INT num_http_errors;

} MOBILE_GTP_PER_FLOW_METRICS;

/*****************************************************************************/
/* Supported Mobile Flow version.                                            */
/*****************************************************************************/
#define EVEL_MOBILE_FLOW_MAJOR_VERSION 2
#define EVEL_MOBILE_FLOW_MINOR_VERSION 0

/**************************************************************************//**
 * Mobile Flow.
 * JSON equivalent field: mobileFlow
 *****************************************************************************/
typedef struct event_mobile_flow {
  /***************************************************************************/
  /* Header and version                                                      */
  /***************************************************************************/
  EVENT_HEADER header;
  int major_version;
  int minor_version;

  /***************************************************************************/
  /* Mandatory fields                                                        */
  /***************************************************************************/
  char * flow_direction;
  MOBILE_GTP_PER_FLOW_METRICS * gtp_per_flow_metrics;
  char * ip_protocol_type;
  char * ip_version;
  char * other_endpoint_ip_address;
  int other_endpoint_port;
  char * reporting_endpoint_ip_addr;
  int reporting_endpoint_port;
  DLIST additional_info;                         /* JSON: additionalFields */

  /***************************************************************************/
  /* Optional fields                                                         */
  /***************************************************************************/
  EVEL_OPTION_STRING application_type;
  EVEL_OPTION_STRING app_protocol_type;
  EVEL_OPTION_STRING app_protocol_version;
  EVEL_OPTION_STRING cid;
  EVEL_OPTION_STRING connection_type;
  EVEL_OPTION_STRING ecgi;
  EVEL_OPTION_STRING gtp_protocol_type;
  EVEL_OPTION_STRING gtp_version;
  EVEL_OPTION_STRING http_header;
  EVEL_OPTION_STRING imei;
  EVEL_OPTION_STRING imsi;
  EVEL_OPTION_STRING lac;
  EVEL_OPTION_STRING mcc;
  EVEL_OPTION_STRING mnc;
  EVEL_OPTION_STRING msisdn;
  EVEL_OPTION_STRING other_functional_role;
  EVEL_OPTION_STRING rac;
  EVEL_OPTION_STRING radio_access_technology;
  EVEL_OPTION_STRING sac;
  EVEL_OPTION_INT sampling_algorithm;
  EVEL_OPTION_STRING tac;
  EVEL_OPTION_STRING tunnel_id;
  EVEL_OPTION_STRING vlan_id;

} EVENT_MOBILE_FLOW;

/*****************************************************************************/
/* Supported Other field version.                                            */
/*****************************************************************************/
#define EVEL_OTHER_EVENT_MAJOR_VERSION 1
#define EVEL_OTHER_EVENT_MINOR_VERSION 1

/**************************************************************************//**
 * Other.
 * JSON equivalent field: otherFields
 *****************************************************************************/
typedef struct event_other {
  EVENT_HEADER header;
  int major_version;
  int minor_version;

  HASHTABLE_T *namedarrays; /* HASHTABLE_T */
  DLIST jsonobjects; /* DLIST of EVEL_JSON_OBJECT */
  DLIST namedvalues;
} EVENT_OTHER;

/**************************************************************************//**
 * Other Field.
 * JSON equivalent field: otherFields
 *****************************************************************************/
typedef struct other_field {
  char * name;
  char * value;
} OTHER_FIELD;


/*****************************************************************************/
/* Supported Service Events version.                                         */
/*****************************************************************************/
#define EVEL_HEARTBEAT_FIELD_MAJOR_VERSION 1
#define EVEL_HEARTBEAT_FIELD_MINOR_VERSION 0


/*****************************************************************************/
/* Supported Signaling version.                                              */
/*****************************************************************************/
#define EVEL_SIGNALING_MAJOR_VERSION 1
#define EVEL_SIGNALING_MINOR_VERSION 0

/**************************************************************************//**
 * Vendor VNF Name fields.
 * JSON equivalent field: vendorVnfNameFields
 *****************************************************************************/
typedef struct vendor_vnfname_field {
  char * vendorname;
  EVEL_OPTION_STRING vfmodule;
  EVEL_OPTION_STRING vnfname;
} VENDOR_VNFNAME_FIELD;

/**************************************************************************//**
 * Signaling.
 * JSON equivalent field: signalingFields
 *****************************************************************************/
typedef struct event_signaling {
  /***************************************************************************/
  /* Header and version                                                      */
  /***************************************************************************/
  EVENT_HEADER header;
  int major_version;
  int minor_version;

  /***************************************************************************/
  /* Mandatory fields                                                        */
  /***************************************************************************/
  VENDOR_VNFNAME_FIELD vnfname_field;
  EVEL_OPTION_STRING correlator;                         /* JSON: correlator */
  EVEL_OPTION_STRING local_ip_address;               /* JSON: localIpAddress */
  EVEL_OPTION_STRING local_port;                          /* JSON: localPort */
  EVEL_OPTION_STRING remote_ip_address;             /* JSON: remoteIpAddress */
  EVEL_OPTION_STRING remote_port;                        /* JSON: remotePort */

  /***************************************************************************/
  /* Optional fields                                                         */
  /***************************************************************************/
  EVEL_OPTION_STRING compressed_sip;                  /* JSON: compressedSip */
  EVEL_OPTION_STRING summary_sip;                        /* JSON: summarySip */
  DLIST additional_info;

} EVENT_SIGNALING;

/**************************************************************************//**
 * Sgnaling Additional Field.
 * JSON equivalent field: additionalFields
 *****************************************************************************/
typedef struct signaling_additional_field {
  char * name;
  char * value;
} SIGNALING_ADDL_FIELD;

/*****************************************************************************/
/* Supported State Change version.                                           */
/*****************************************************************************/
#define EVEL_STATE_CHANGE_MAJOR_VERSION 2
#define EVEL_STATE_CHANGE_MINOR_VERSION 0

/**************************************************************************//**
 * State Change.
 * JSON equivalent field: stateChangeFields
 *****************************************************************************/
typedef struct event_state_change {
  /***************************************************************************/
  /* Header and version                                                      */
  /***************************************************************************/
  EVENT_HEADER header;
  int major_version;
  int minor_version;

  /***************************************************************************/
  /* Mandatory fields                                                        */
  /***************************************************************************/
  EVEL_ENTITY_STATE new_state;
  EVEL_ENTITY_STATE old_state;
  char * state_interface;
  double version;

  /***************************************************************************/
  /* Optional fields                                                         */
  /***************************************************************************/
  DLIST additional_fields;

} EVENT_STATE_CHANGE;

/**************************************************************************//**
 * State Change Additional Field.
 * JSON equivalent field: additionalFields
 *****************************************************************************/
typedef struct state_change_additional_field {
  char * name;
  char * value;
} STATE_CHANGE_ADDL_FIELD;

/*****************************************************************************/
/* Supported Syslog version.                                                 */
/*****************************************************************************/
#define EVEL_SYSLOG_MAJOR_VERSION 3
#define EVEL_SYSLOG_MINOR_VERSION 0

/**************************************************************************//**
 * Syslog.
 * JSON equivalent field: syslogFields
 *****************************************************************************/
typedef struct event_syslog {
  /***************************************************************************/
  /* Header and version                                                      */
  /***************************************************************************/
  EVENT_HEADER header;
  int major_version;
  int minor_version;

  /***************************************************************************/
  /* Mandatory fields                                                        */
  /***************************************************************************/
  EVEL_SOURCE_TYPES event_source_type;
  char * syslog_msg;
  char * syslog_tag;

  /***************************************************************************/
  /* Optional fields                                                         */
  /***************************************************************************/
  EVEL_OPTION_STRING additional_filters;
  EVEL_OPTION_STRING event_source_host;
  EVEL_OPTION_INT syslog_facility;
  EVEL_OPTION_INT syslog_priority;
  EVEL_OPTION_STRING syslog_proc;
  EVEL_OPTION_INT syslog_proc_id;
  EVEL_OPTION_STRING syslog_s_data;
  EVEL_OPTION_STRING syslog_sdid;
  EVEL_OPTION_STRING syslog_severity;
  double syslog_fver;
  EVEL_OPTION_INT syslog_ver;

} EVENT_SYSLOG;

/**************************************************************************//**
 * Copyright.
 * JSON equivalent object: attCopyrightNotice
 *****************************************************************************/
typedef struct copyright {
  char * useAndRedistribution;
  char * condition1;
  char * condition2;
  char * condition3;
  char * condition4;
  char * disclaimerLine1;
  char * disclaimerLine2;
  char * disclaimerLine3;
  char * disclaimerLine4;
} COPYRIGHT;

/**************************************************************************//**
 * Library initialization.
 *
 * Initialize the EVEL library.
 *
 * @note  This function initializes the cURL library.  Applications making use
 *        of libcurl may need to pull the initialization out of here.  Note
 *        also that this function is not threadsafe as a result - refer to
 *        libcurl's API documentation for relevant warnings.
 *
 * @sa  Matching Term function.
 *
 * @param   fqdn    The API's FQDN or IP address.
 * @param   port    The API's port.
 * @param   path    The optional path (may be NULL).
 * @param   topic   The optional topic part of the URL (may be NULL).
 * @param   secure  Whether to use HTTPS (0=HTTP, 1=HTTPS).
 * @param   username  Username for Basic Authentication of requests.
 * @param   password  Password for Basic Authentication of requests.
 * @param   source_type The kind of node we represent.
 * @param   role    The role this node undertakes.
 * @param   verbosity  0 for normal operation, positive values for chattier
 *                     logs.
 *
 * @returns Status code
 * @retval  EVEL_SUCCESS      On success
 * @retval  ::EVEL_ERR_CODES  On failure.
 *****************************************************************************/
EVEL_ERR_CODES evel_initialize(const char * const fqdn,
                               int port,
                               const char * const path,
                               const char * const topic,
                               int secure,
                               const char * const username,
                               const char * const password,
                               EVEL_SOURCE_TYPES source_type,
                               const char * const role,
                               int verbosity
                               );

/**************************************************************************//**
 * Clean up the EVEL library.
 *
 * @note that at present don't expect Init/Term cycling not to leak memory!
 *
 * @returns Status code
 * @retval  EVEL_SUCCESS On success
 * @retval  "One of ::EVEL_ERR_CODES" On failure.
 *****************************************************************************/
EVEL_ERR_CODES evel_terminate(void);

EVEL_ERR_CODES evel_post_event(EVENT_HEADER * event);
const char * evel_error_string(void);


/**************************************************************************//**
 * Free an event.
 *
 * Free off the event supplied.  Will free all the contained allocated memory.
 *
 * @note  It is safe to free a NULL pointer.
 *****************************************************************************/
void evel_free_event(void * event);

/**************************************************************************//**
 * Encode the event as a JSON event object according to AT&T's schema.
 *
 * @param json      Pointer to where to store the JSON encoded data.
 * @param max_size  Size of storage available in json_body.
 * @param event     Pointer to the ::EVENT_HEADER to encode.
 * @returns Number of bytes actually written.
 *****************************************************************************/
int evel_json_encode_event(char * json,
                           int max_size,
                           EVENT_HEADER * event);

/**************************************************************************//**
 * Initialize an event instance id.
 *
 * @param vfield        Pointer to the event vnfname field being initialized.
 * @param vendor_id     The vendor id to encode in the event instance id.
 * @param event_id      The event id to encode in the event instance id.
 *****************************************************************************/
void evel_init_vendor_field(VENDOR_VNFNAME_FIELD * const vfield,
                                 const char * const vendor_name);

/**************************************************************************//**
 * Set the Vendor module property of the Vendor.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param vfield        Pointer to the Vendor field.
 * @param module_name   The module name to be set. ASCIIZ string. The caller
 *                      does not need to preserve the value once the function
 *                      returns.
 *****************************************************************************/
void evel_vendor_field_module_set(VENDOR_VNFNAME_FIELD * const vfield,
                                    const char * const module_name);
/**************************************************************************//**
 * Set the Vendor module property of the Vendor.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param vfield        Pointer to the Vendor field.
 * @param module_name   The module name to be set. ASCIIZ string. The caller
 *                      does not need to preserve the value once the function
 *                      returns.
 *****************************************************************************/
void evel_vendor_field_vnfname_set(VENDOR_VNFNAME_FIELD * const vfield,
                                    const char * const vnfname);
/**************************************************************************//**
 * Free an event instance id.
 *
 * @param vfield   Pointer to the event vnfname_field being freed.
 *****************************************************************************/
void evel_free_event_vendor_field(VENDOR_VNFNAME_FIELD * const vfield);

/**************************************************************************//**
 * Callback function to provide returned data.
 *
 * Copy data into the supplied buffer, write_callback::ptr, checking size
 * limits.
 *
 * @returns   Number of bytes placed into write_callback::ptr. 0 for EOF.
 *****************************************************************************/
size_t evel_write_callback(void *contents,
                           size_t size,
                           size_t nmemb,
                           void *userp);

/*****************************************************************************/
/*****************************************************************************/
/*                                                                           */
/*   HEARTBEAT - (includes common header, too)                               */
/*                                                                           */
/*****************************************************************************/
/*****************************************************************************/

/**************************************************************************//**
 * Create a new heartbeat event.
 *
 * @note that the heartbeat is just a "naked" commonEventHeader!
 *
 * @returns pointer to the newly manufactured ::EVENT_HEADER.  If the event is
 *          not used it must be released using ::evel_free_event
 * @retval  NULL  Failed to create the event.
 *****************************************************************************/
EVENT_HEADER * evel_new_heartbeat(void);

/**************************************************************************//**
 * Create a new heartbeat event of given name and type.
 *
 * @note that the heartbeat is just a "naked" commonEventHeader!
 *
 * @param event_name  Unique Event Name confirming Domain AsdcModel Description
 * @param event_id    A universal identifier of the event for: troubleshooting correlation, analysis, etc
 *
 * @returns pointer to the newly manufactured ::EVENT_HEADER.  If the event is
 *          not used it must be released using ::evel_free_event
 * @retval  NULL  Failed to create the event.
 *****************************************************************************/
EVENT_HEADER * evel_new_heartbeat_nameid(const char* ev_name, const char *ev_id);


/**************************************************************************//**
 * Free an event header.
 *
 * Free off the event header supplied.  Will free all the contained allocated
 * memory.
 *
 * @note It does not free the header itself, since that may be part of a
 * larger structure.
 *****************************************************************************/
void evel_free_header(EVENT_HEADER * const event);

/**************************************************************************//**
 * Initialize a newly created event header.
 *
 * @param header  Pointer to the header being initialized.
 *****************************************************************************/
void evel_init_header(EVENT_HEADER * const header,const char *const eventname);

/**************************************************************************//**
 * Set the Event Type property of the event header.
 *
 * @param header        Pointer to the ::EVENT_HEADER.
 * @param type          The Event Type to be set. ASCIIZ string. The caller
 *                      does not need to preserve the value once the function
 *                      returns.
 *****************************************************************************/
void evel_header_type_set(EVENT_HEADER * const header,
                          const char * const type);

/**************************************************************************//**
 * Set the Start Epoch property of the event header.
 *
 * @note The Start Epoch defaults to the time of event creation.
 *
 * @param header        Pointer to the ::EVENT_HEADER.
 * @param start_epoch_microsec
 *                      The start epoch to set, in microseconds.
 *****************************************************************************/
void evel_start_epoch_set(EVENT_HEADER * const header,
                          const unsigned long long start_epoch_microsec);

/**************************************************************************//**
 * Set the Last Epoch property of the event header.
 *
 * @note The Last Epoch defaults to the time of event creation.
 *
 * @param header        Pointer to the ::EVENT_HEADER.
 * @param last_epoch_microsec
 *                      The last epoch to set, in microseconds.
 *****************************************************************************/
void evel_last_epoch_set(EVENT_HEADER * const header,
                         const unsigned long long last_epoch_microsec);

/**************************************************************************//**
 * Set the Reporting Entity Name property of the event header.
 *
 * @note The Reporting Entity Name defaults to the OpenStack VM Name.
 *
 * @param header        Pointer to the ::EVENT_HEADER.
 * @param entity_name   The entity name to set.
 *****************************************************************************/
void evel_reporting_entity_name_set(EVENT_HEADER * const header,
                                    const char * const entity_name);

/**************************************************************************//**
 * Set the Reporting Entity Id property of the event header.
 *
 * @note The Reporting Entity Id defaults to the OpenStack VM UUID.
 *
 * @param header        Pointer to the ::EVENT_HEADER.
 * @param entity_id     The entity id to set.
 *****************************************************************************/
void evel_reporting_entity_id_set(EVENT_HEADER * const header,
                                  const char * const entity_id);

/**************************************************************************//**
 * Set the NFC Naming code property of the event header.
 *
 * @param header        Pointer to the ::EVENT_HEADER.
 * @param nfcnamingcode String
 *****************************************************************************/
void evel_nfcnamingcode_set(EVENT_HEADER * const header,
                         const char * const nfcnam);
/**************************************************************************//**
 * Set the NF Naming code property of the event header.
 *
 * @param header        Pointer to the ::EVENT_HEADER.
 * @param nfnamingcode String
 *****************************************************************************/
void evel_nfnamingcode_set(EVENT_HEADER * const header,
                         const char * const nfnam);

/*****************************************************************************/
/*****************************************************************************/
/*                                                                           */
/*   FAULT                                                                   */
/*                                                                           */
/*****************************************************************************/
/*****************************************************************************/

/**************************************************************************//**
 * Create a new fault event.
 *
 * @note    The mandatory fields on the Fault must be supplied to this factory
 *          function and are immutable once set.  Optional fields have explicit
 *          setter functions, but again values may only be set once so that the
 *          Fault has immutable properties.
 * @param event_name    Unique Event Name
 * @param event_id    A universal identifier of the event for analysis etc
 * @param   condition   The condition indicated by the Fault.
 * @param   specific_problem  The specific problem triggering the fault.
 * @param   priority    The priority of the event.
 * @param   severity    The severity of the Fault.
 * @param   ev_source_type    Source of Alarm event
 * @param   version     fault version
 * @param   status      status of Virtual Function
 * @returns pointer to the newly manufactured ::EVENT_FAULT.  If the event is
 *          not used (i.e. posted) it must be released using ::evel_free_fault.
 * @retval  NULL  Failed to create the event.
 *****************************************************************************/
EVENT_FAULT * evel_new_fault(const char* ev_name, const char *ev_id,
			     const char * const condition,
                             const char * const specific_problem,
                             EVEL_EVENT_PRIORITIES priority,
                             EVEL_SEVERITIES severity,
                             EVEL_SOURCE_TYPES ev_source_type,
                             EVEL_VF_STATUSES status);

/**************************************************************************//**
 * Free a Fault.
 *
 * Free off the Fault supplied.  Will free all the contained allocated memory.
 *
 * @note It does not free the Fault itself, since that may be part of a
 * larger structure.
 *****************************************************************************/
void evel_free_fault(EVENT_FAULT * event);

/**************************************************************************//**
 * Set the Fault Category property of the Fault.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param fault      Pointer to the fault.
 * @param category   Category : license, link, routing, security, signaling.
 *                       ASCIIZ string. The caller
 *                   does not need to preserve the value once the function
 *                   returns.
 *****************************************************************************/
void evel_fault_category_set(EVENT_FAULT * fault,
                              const char * const category);

/**************************************************************************//**
 * Set the Alarm Interface A property of the Fault.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param fault      Pointer to the fault.
 * @param interface  The Alarm Interface A to be set. ASCIIZ string. The caller
 *                   does not need to preserve the value once the function
 *                   returns.
 *****************************************************************************/
void evel_fault_interface_set(EVENT_FAULT * fault,
                              const char * const interface);

/**************************************************************************//**
 * Add an additional value name/value pair to the Fault.
 *
 * The name and value are null delimited ASCII strings.  The library takes
 * a copy so the caller does not have to preserve values after the function
 * returns.
 *
 * @param fault     Pointer to the fault.
 * @param name      ASCIIZ string with the attribute's name.
 * @param value     ASCIIZ string with the attribute's value.
 *****************************************************************************/
void evel_fault_addl_info_add(EVENT_FAULT * fault, char * name, char * value);

/**************************************************************************//**
 * Set the Event Type property of the Fault.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param fault      Pointer to the fault.
 * @param type       The Event Type to be set. ASCIIZ string. The caller
 *                   does not need to preserve the value once the function
 *                   returns.
 *****************************************************************************/
void evel_fault_type_set(EVENT_FAULT * fault, const char * const type);

/*****************************************************************************/
/*****************************************************************************/
/*                                                                           */
/*   MEASUREMENT                                                             */
/*                                                                           */
/*****************************************************************************/
/*****************************************************************************/

/**************************************************************************//**
 * Create a new Measurement event.
 *
 * @note    The mandatory fields on the Measurement must be supplied to this
 *          factory function and are immutable once set.  Optional fields have
 *          explicit setter functions, but again values may only be set once so
 *          that the Measurement has immutable properties.
 *
 * @param   measurement_interval
 * @param event_name    Unique Event Name
 * @param event_id    A universal identifier of the event for analysis etc
 *
 * @returns pointer to the newly manufactured ::EVENT_MEASUREMENT.  If the
 *          event is not used (i.e. posted) it must be released using
 *          ::evel_free_event.
 * @retval  NULL  Failed to create the event.
 *****************************************************************************/
EVENT_MEASUREMENT * evel_new_measurement(double measurement_interval,const char* ev_name, const char *ev_id);

/**************************************************************************//**
 * Free a Measurement.
 *
 * Free off the Measurement supplied.  Will free all the contained allocated
 * memory.
 *
 * @note It does not free the Measurement itself, since that may be part of a
 * larger structure.
 *****************************************************************************/
void evel_free_measurement(EVENT_MEASUREMENT * event);

/**************************************************************************//**
 * Set the Event Type property of the Measurement.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param measurement Pointer to the Measurement.
 * @param type        The Event Type to be set. ASCIIZ string. The caller
 *                    does not need to preserve the value once the function
 *                    returns.
 *****************************************************************************/
void evel_measurement_type_set(EVENT_MEASUREMENT * measurement,
                               const char * const type);

/**************************************************************************//**
 * Set the Concurrent Sessions property of the Measurement.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param measurement         Pointer to the Measurement.
 * @param concurrent_sessions The Concurrent Sessions to be set.
 *****************************************************************************/
void evel_measurement_conc_sess_set(EVENT_MEASUREMENT * measurement,
                                    int concurrent_sessions);

/**************************************************************************//**
 * Set the Configured Entities property of the Measurement.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param measurement         Pointer to the Measurement.
 * @param configured_entities The Configured Entities to be set.
 *****************************************************************************/
void evel_measurement_cfg_ents_set(EVENT_MEASUREMENT * measurement,
                                   int configured_entities);

/**************************************************************************//**
 * Add an additional set of Errors to the Measurement.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param measurement       Pointer to the measurement.
 * @param receive_discards  The number of receive discards.
 * @param receive_errors    The number of receive errors.
 * @param transmit_discards The number of transmit discards.
 * @param transmit_errors   The number of transmit errors.
 *****************************************************************************/
void evel_measurement_errors_set(EVENT_MEASUREMENT * measurement,
                                 int receive_discards,
                                 int receive_errors,
                                 int transmit_discards,
                                 int transmit_errors);

/**************************************************************************//**
 * Set the Mean Request Latency property of the Measurement.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param measurement          Pointer to the Measurement.
 * @param mean_request_latency The Mean Request Latency to be set.
 *****************************************************************************/
void evel_measurement_mean_req_lat_set(EVENT_MEASUREMENT * measurement,
                                       double mean_request_latency);

/**************************************************************************//**
 * Set the Request Rate property of the Measurement.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param measurement  Pointer to the Measurement.
 * @param request_rate The Request Rate to be set.
 *****************************************************************************/
void evel_measurement_request_rate_set(EVENT_MEASUREMENT * measurement,
                                       int request_rate);

/**************************************************************************//**
 * Add an additional CPU usage value name/value pair to the Measurement.
 *
 * The name and value are null delimited ASCII strings.  The library takes
 * a copy so the caller does not have to preserve values after the function
 * returns.
 *
 * @param measurement   Pointer to the measurement.
 * @param id            ASCIIZ string with the CPU's identifier.
 * @param usage         CPU utilization.
 *****************************************************************************/
MEASUREMENT_CPU_USE * evel_measurement_new_cpu_use_add(EVENT_MEASUREMENT * measurement, char * id, double usage);

/**************************************************************************//**
 * Set the CPU Idle value in measurement interval
 *   percentage of CPU time spent in the idle task
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param cpu_use      Pointer to the CPU Use.
 * @param val          double
 *****************************************************************************/
void evel_measurement_cpu_use_idle_set(MEASUREMENT_CPU_USE *const cpu_use,
                                    const double val);

/**************************************************************************//**
 * Set the percentage of time spent servicing interrupts
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param cpu_use      Pointer to the CPU Use.
 * @param val          double
 *****************************************************************************/
void evel_measurement_cpu_use_interrupt_set(MEASUREMENT_CPU_USE * const cpu_use,
                                    const double val);

/**************************************************************************//**
 * Set the percentage of time spent running user space processes that have been niced
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param cpu_use      Pointer to the CPU Use.
 * @param val          double
 *****************************************************************************/
void evel_measurement_cpu_use_nice_set(MEASUREMENT_CPU_USE * const cpu_use,
                                    const double val);

/**************************************************************************//**
 * Set the percentage of time spent handling soft irq interrupts
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param cpu_use      Pointer to the CPU Use.
 * @param val          double
 *****************************************************************************/
void evel_measurement_cpu_use_softirq_set(MEASUREMENT_CPU_USE * const cpu_use,
                                    const double val);
/**************************************************************************//**
 * Set the percentage of time spent in involuntary wait
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param cpu_use      Pointer to the CPU Use.
 * @param val          double
 *****************************************************************************/
void evel_measurement_cpu_use_steal_set(MEASUREMENT_CPU_USE * const cpu_use,
                                    const double val);
/**************************************************************************//**
 * Set the percentage of time spent on system tasks running the kernel
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param cpu_use      Pointer to the CPU Use.
 * @param val          double
 *****************************************************************************/
void evel_measurement_cpu_use_system_set(MEASUREMENT_CPU_USE * const cpu_use,
                                    const double val);
/**************************************************************************//**
 * Set the percentage of time spent running un-niced user space processes
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param cpu_use      Pointer to the CPU Use.
 * @param val          double
 *****************************************************************************/
void evel_measurement_cpu_use_usageuser_set(MEASUREMENT_CPU_USE * const cpu_use,
                                    const double val);
/**************************************************************************//**
 * Set the percentage of CPU time spent waiting for I/O operations to complete
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param cpu_use      Pointer to the CPU Use.
 * @param val          double
 *****************************************************************************/
void evel_measurement_cpu_use_wait_set(MEASUREMENT_CPU_USE * const cpu_use,
                                    const double val);

/**************************************************************************//**
 * Add an additional File System usage value name/value pair to the
 * Measurement.
 *
 * The filesystem_name is null delimited ASCII string.  The library takes a
 * copy so the caller does not have to preserve values after the function
 * returns.
 *
 * @param measurement     Pointer to the measurement.
 * @param filesystem_name   ASCIIZ string with the file-system's UUID.
 * @param block_configured  Block storage configured.
 * @param block_used        Block storage in use.
 * @param block_iops        Block storage IOPS.
 * @param ephemeral_configured  Ephemeral storage configured.
 * @param ephemeral_used        Ephemeral storage in use.
 * @param ephemeral_iops        Ephemeral storage IOPS.
 *****************************************************************************/
void evel_measurement_fsys_use_add(EVENT_MEASUREMENT * measurement,
                                   char * filesystem_name,
                                   double block_configured,
                                   double block_used,
                                   double block_iops,
                                   double ephemeral_configured,
                                   double ephemeral_used,
                                   double ephemeral_iops);

/**************************************************************************//**
 * Add a Feature usage value name/value pair to the Measurement.
 *
 * The name is null delimited ASCII string.  The library takes
 * a copy so the caller does not have to preserve values after the function
 * returns.
 *
 * @param measurement     Pointer to the measurement.
 * @param feature         ASCIIZ string with the feature's name.
 * @param utilization     Utilization of the feature.
 *****************************************************************************/
void evel_measurement_feature_use_add(EVENT_MEASUREMENT * measurement,
                                      char * feature,
                                      int utilization);

/**************************************************************************//**
 * Add a Additional Measurement value name/value pair to the Measurement.
 *
 * The name is null delimited ASCII string.  The library takes
 * a copy so the caller does not have to preserve values after the function
 * returns.
 *
 * @param measurement   Pointer to the Measurement.
 * @param group    ASCIIZ string with the measurement group's name.
 * @param name     ASCIIZ string containing the measurement's name.
 * @param name     ASCIIZ string containing the measurement's value.
 *****************************************************************************/
void evel_measurement_custom_measurement_add(EVENT_MEASUREMENT * measurement,
                                             const char * const group,
                                             const char * const name,
                                             const char * const value);

/**************************************************************************//**
 * Add a Codec usage value name/value pair to the Measurement.
 *
 * The name is null delimited ASCII string.  The library takes
 * a copy so the caller does not have to preserve values after the function
 * returns.
 *
 * @param measurement     Pointer to the measurement.
 * @param codec           ASCIIZ string with the codec's name.
 * @param utilization     Utilization of the feature.
 *****************************************************************************/
void evel_measurement_codec_use_add(EVENT_MEASUREMENT * measurement,
                                    char * codec,
                                    int utilization);

/**************************************************************************//**
 * Set the Media Ports in Use property of the Measurement.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param measurement         Pointer to the measurement.
 * @param media_ports_in_use  The media port usage to set.
 *****************************************************************************/
void evel_measurement_media_port_use_set(EVENT_MEASUREMENT * measurement,
                                         int media_ports_in_use);

/**************************************************************************//**
 * Set the VNFC Scaling Metric property of the Measurement.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param measurement     Pointer to the measurement.
 * @param scaling_metric  The scaling metric to set.
 *****************************************************************************/
void evel_measurement_vnfc_scaling_metric_set(EVENT_MEASUREMENT * measurement,
                                              int scaling_metric);

/**************************************************************************//**
 * Create a new Latency Bucket to be added to a Measurement event.
 *
 * @note    The mandatory fields on the ::MEASUREMENT_LATENCY_BUCKET must be
 *          supplied to this factory function and are immutable once set.
 *          Optional fields have explicit setter functions, but again values
 *          may only be set once so that the ::MEASUREMENT_LATENCY_BUCKET has
 *          immutable properties.
 *
 * @param count         Count of events in this bucket.
 *
 * @returns pointer to the newly manufactured ::MEASUREMENT_LATENCY_BUCKET.
 * @retval  NULL  Failed to create the Latency Bucket.
 *****************************************************************************/
MEASUREMENT_LATENCY_BUCKET * evel_new_meas_latency_bucket(const int count);

/**************************************************************************//**
 * Set the High End property of the Measurement Latency Bucket.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param bucket        Pointer to the Measurement Latency Bucket.
 * @param high_end      High end of the bucket's range.
 *****************************************************************************/
void evel_meas_latency_bucket_high_end_set(
                                     MEASUREMENT_LATENCY_BUCKET * const bucket,
                                     const double high_end);

/**************************************************************************//**
 * Set the Low End property of the Measurement Latency Bucket.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param bucket        Pointer to the Measurement Latency Bucket.
 * @param low_end       Low end of the bucket's range.
 *****************************************************************************/
void evel_meas_latency_bucket_low_end_set(
                                     MEASUREMENT_LATENCY_BUCKET * const bucket,
                                     const double low_end);

/**************************************************************************//**
 * Add an additional Measurement Latency Bucket to the specified event.
 *
 * @param measurement   Pointer to the Measurement event.
 * @param bucket        Pointer to the Measurement Latency Bucket to add.
 *****************************************************************************/
void evel_meas_latency_bucket_add(EVENT_MEASUREMENT * const measurement,
                                  MEASUREMENT_LATENCY_BUCKET * const bucket);

/**************************************************************************//**
 * Add an additional Latency Distribution bucket to the Measurement.
 *
 * This function implements the previous API, purely for convenience.
 *
 * @param measurement   Pointer to the measurement.
 * @param low_end       Low end of the bucket's range.
 * @param high_end      High end of the bucket's range.
 * @param count         Count of events in this bucket.
 *****************************************************************************/
void evel_measurement_latency_add(EVENT_MEASUREMENT * const measurement,
                                  const double low_end,
                                  const double high_end,
                                  const int count);

/**************************************************************************//**
 * Create a new vNIC Use to be added to a Measurement event.
 *
 * @note    The mandatory fields on the ::MEASUREMENT_VNIC_PERFORMANCE must be supplied
 *          to this factory function and are immutable once set. Optional
 *          fields have explicit setter functions, but again values may only be
 *          set once so that the ::MEASUREMENT_VNIC_PERFORMANCE has immutable
 *          properties.
 *
 * @param vnic_id               ASCIIZ string with the vNIC's ID.
 * @param val_suspect           True or false confidence in data.
 *
 * @returns pointer to the newly manufactured ::MEASUREMENT_VNIC_PERFORMANCE.
 *          If the structure is not used it must be released using
 *          ::evel_measurement_free_vnic_performance.
 * @retval  NULL  Failed to create the vNIC Use.
 *****************************************************************************/
MEASUREMENT_VNIC_PERFORMANCE * evel_measurement_new_vnic_performance(char * const vnic_id, char * const val_suspect);

/**************************************************************************//**
 * Free a vNIC Use.
 *
 * Free off the ::MEASUREMENT_VNIC_PERFORMANCE supplied.  Will free all the contained
 * allocated memory.
 *
 * @note It does not free the vNIC Use itself, since that may be part of a
 * larger structure.
 *****************************************************************************/
void evel_measurement_free_vnic_performance(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance);

/**************************************************************************//**
 * Set the Accumulated Broadcast Packets Received in measurement interval
 * property of the vNIC performance.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param vnic_performance      Pointer to the vNIC Use.
 * @param recvd_bcast_packets_acc
 *****************************************************************************/
void evel_vnic_performance_rx_bcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
                                    const double recvd_bcast_packets_acc);
/**************************************************************************//**
 * Set the Delta Broadcast Packets Received in measurement interval
 * property of the vNIC performance.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param vnic_performance      Pointer to the vNIC Use.
 * @param recvd_bcast_packets_delta
 *****************************************************************************/
void evel_vnic_performance_rx_bcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
                                    const double recvd_bcast_packets_delta);
/**************************************************************************//**
 * Set the Discarded Packets Received in measurement interval
 * property of the vNIC performance.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param vnic_performance      Pointer to the vNIC Use.
 * @param recvd_discard_packets_acc
 *****************************************************************************/
void evel_vnic_performance_rx_discard_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
                                    const double recvd_discard_packets_acc);
/**************************************************************************//**
 * Set the Delta Discarded Packets Received in measurement interval
 * property of the vNIC performance.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param vnic_performance      Pointer to the vNIC Use.
 * @param recvd_discard_packets_delta
 *****************************************************************************/
void evel_vnic_performance_rx_discard_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
                                    const double recvd_discard_packets_delta);
/**************************************************************************//**
 * Set the Error Packets Received in measurement interval
 * property of the vNIC performance.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param vnic_performance      Pointer to the vNIC Use.
 * @param recvd_error_packets_acc
 *****************************************************************************/
void evel_vnic_performance_rx_error_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
                                    const double recvd_error_packets_acc);
/**************************************************************************//**
 * Set the Delta Error Packets Received in measurement interval
 * property of the vNIC performance.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param vnic_performance      Pointer to the vNIC Use.
 * @param recvd_error_packets_delta
 *****************************************************************************/
void evel_vnic_performance_rx_error_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
                                    const double recvd_error_packets_delta);
/**************************************************************************//**
 * Set the Accumulated Multicast Packets Received in measurement interval
 * property of the vNIC performance.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param vnic_performance      Pointer to the vNIC Use.
 * @param recvd_mcast_packets_acc
 *****************************************************************************/
void evel_vnic_performance_rx_mcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
                                    const double recvd_mcast_packets_acc);
/**************************************************************************//**
 * Set the Delta Multicast Packets Received in measurement interval
 * property of the vNIC performance.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param vnic_performance      Pointer to the vNIC Use.
 * @param recvd_mcast_packets_delta
 *****************************************************************************/
void evel_vnic_performance_rx_mcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
                                    const double recvd_mcast_packets_delta);
/**************************************************************************//**
 * Set the Accumulated Octets Received in measurement interval
 * property of the vNIC performance.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param vnic_performance      Pointer to the vNIC Use.
 * @param recvd_octets_acc
 *****************************************************************************/
void evel_vnic_performance_rx_octets_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
                                    const double recvd_octets_acc);
/**************************************************************************//**
 * Set the Delta Octets Received in measurement interval
 * property of the vNIC performance.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param vnic_performance      Pointer to the vNIC Use.
 * @param recvd_octets_delta
 *****************************************************************************/
void evel_vnic_performance_rx_octets_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
                                    const double recvd_octets_delta);
/**************************************************************************//**
 * Set the Accumulated Total Packets Received in measurement interval
 * property of the vNIC performance.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param vnic_performance      Pointer to the vNIC Use.
 * @param recvd_total_packets_acc
 *****************************************************************************/
void evel_vnic_performance_rx_total_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
                                    const double recvd_total_packets_acc);
/**************************************************************************//**
 * Set the Delta Total Packets Received in measurement interval
 * property of the vNIC performance.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param vnic_performance      Pointer to the vNIC Use.
 * @param recvd_total_packets_delta
 *****************************************************************************/
void evel_vnic_performance_rx_total_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
                                    const double recvd_total_packets_delta);
/**************************************************************************//**
 * Set the Accumulated Unicast Packets Received in measurement interval
 * property of the vNIC performance.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param vnic_performance      Pointer to the vNIC Use.
 * @param recvd_ucast_packets_acc
 *****************************************************************************/
void evel_vnic_performance_rx_ucast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
                                    const double recvd_ucast_packets_acc);
/**************************************************************************//**
 * Set the Delta Unicast packets Received in measurement interval
 * property of the vNIC performance.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param vnic_performance      Pointer to the vNIC Use.
 * @param recvd_ucast_packets_delta
 *****************************************************************************/
void evel_vnic_performance_rx_ucast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
                                    const double recvd_ucast_packets_delta);
/**************************************************************************//**
 * Set the Transmitted Broadcast Packets in measurement interval
 * property of the vNIC performance.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param vnic_performance      Pointer to the vNIC Use.
 * @param tx_bcast_packets_acc
 *****************************************************************************/
void evel_vnic_performance_tx_bcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
                                    const double tx_bcast_packets_acc);
/**************************************************************************//**
 * Set the Delta Broadcast packets Transmitted in measurement interval
 * property of the vNIC performance.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param vnic_performance      Pointer to the vNIC Use.
 * @param tx_bcast_packets_delta
 *****************************************************************************/
void evel_vnic_performance_tx_bcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
                                    const double tx_bcast_packets_delta);
/**************************************************************************//**
 * Set the Transmitted Discarded Packets in measurement interval
 * property of the vNIC performance.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param vnic_performance      Pointer to the vNIC Use.
 * @param tx_discarded_packets_acc
 *****************************************************************************/
void evel_vnic_performance_tx_discarded_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
                                    const double tx_discarded_packets_acc);
/**************************************************************************//**
 * Set the Delta Discarded packets Transmitted in measurement interval
 * property of the vNIC performance.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param vnic_performance      Pointer to the vNIC Use.
 * @param tx_discarded_packets_delta
 *****************************************************************************/
void evel_vnic_performance_tx_discarded_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
                                    const double tx_discarded_packets_delta);
/**************************************************************************//**
 * Set the Transmitted Errored Packets in measurement interval
 * property of the vNIC performance.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param vnic_performance      Pointer to the vNIC Use.
 * @param tx_error_packets_acc
 *****************************************************************************/
void evel_vnic_performance_tx_error_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
                                    const double tx_error_packets_acc);
/**************************************************************************//**
 * Set the Delta Errored packets Transmitted in measurement interval
 * property of the vNIC performance.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param vnic_performance      Pointer to the vNIC Use.
 * @param tx_error_packets_delta
 *****************************************************************************/
void evel_vnic_performance_tx_error_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
                                    const double tx_error_packets_delta);
/**************************************************************************//**
 * Set the Transmitted Multicast Packets in measurement interval
 * property of the vNIC performance.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param vnic_performance      Pointer to the vNIC Use.
 * @param tx_mcast_packets_acc
 *****************************************************************************/
void evel_vnic_performance_tx_mcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
                                    const double tx_mcast_packets_acc);
/**************************************************************************//**
 * Set the Delta Multicast packets Transmitted in measurement interval
 * property of the vNIC performance.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param vnic_performance      Pointer to the vNIC Use.
 * @param tx_mcast_packets_delta
 *****************************************************************************/
void evel_vnic_performance_tx_mcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
                                    const double tx_mcast_packets_delta);
/**************************************************************************//**
 * Set the Transmitted Octets in measurement interval
 * property of the vNIC performance.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param vnic_performance      Pointer to the vNIC Use.
 * @param tx_octets_acc
 *****************************************************************************/
void evel_vnic_performance_tx_octets_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
                                    const double tx_octets_acc);
/**************************************************************************//**
 * Set the Delta Octets Transmitted in measurement interval
 * property of the vNIC performance.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param vnic_performance      Pointer to the vNIC Use.
 * @param tx_octets_delta
 *****************************************************************************/
void evel_vnic_performance_tx_octets_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
                                    const double tx_octets_delta);
/**************************************************************************//**
 * Set the Transmitted Total Packets in measurement interval
 * property of the vNIC performance.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param vnic_performance      Pointer to the vNIC Use.
 * @param tx_total_packets_acc
 *****************************************************************************/
void evel_vnic_performance_tx_total_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
                                    const double tx_total_packets_acc);
/**************************************************************************//**
 * Set the Delta Total Packets Transmitted in measurement interval
 * property of the vNIC performance.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param vnic_performance      Pointer to the vNIC Use.
 * @param tx_total_packets_delta
 *****************************************************************************/
void evel_vnic_performance_tx_total_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
                                    const double tx_total_packets_delta);
/**************************************************************************//**
 * Set the Transmitted Unicast Packets in measurement interval
 * property of the vNIC performance.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param vnic_performance      Pointer to the vNIC Use.
 * @param tx_ucast_packets_acc
 *****************************************************************************/
void evel_vnic_performance_tx_ucast_packets_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
                                    const double tx_ucast_packets_acc);
/**************************************************************************//**
 * Set the Delta Octets Transmitted in measurement interval
 * property of the vNIC performance.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param vnic_performance      Pointer to the vNIC Use.
 * @param tx_ucast_packets_delta
 *****************************************************************************/
void evel_vnic_performance_tx_ucast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
                                    const double tx_ucast_packets_delta);

/**************************************************************************//**
 * Add an additional vNIC Use to the specified Measurement event.
 *
 * @param measurement   Pointer to the measurement.
 * @param vnic_performance      Pointer to the vNIC Use to add.
 *****************************************************************************/
void evel_meas_vnic_performance_add(EVENT_MEASUREMENT * const measurement,
                            MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance);

/**************************************************************************//**
 * Add an additional vNIC usage record Measurement.
 *
 * This function implements the previous API, purely for convenience.
 *
 * The ID is null delimited ASCII string.  The library takes a copy so the
 * caller does not have to preserve values after the function returns.
 *
 * @param measurement           Pointer to the measurement.
 * @param vnic_id               ASCIIZ string with the vNIC's ID.
 * @param valset                true or false confidence level
 * @param recvd_bcast_packets_acc         Recieved broadcast packets
 * @param recvd_bcast_packets_delta       Received delta broadcast packets
 * @param recvd_discarded_packets_acc     Recieved discarded packets
 * @param recvd_discarded_packets_delta   Received discarded delta packets
 * @param recvd_error_packets_acc         Received error packets
 * @param recvd_error_packets_delta,      Received delta error packets
 * @param recvd_mcast_packets_acc         Received multicast packets
 * @param recvd_mcast_packets_delta       Received delta multicast packets
 * @param recvd_octets_acc                Received octets
 * @param recvd_octets_delta              Received delta octets
 * @param recvd_total_packets_acc         Received total packets
 * @param recvd_total_packets_delta       Received delta total packets
 * @param recvd_ucast_packets_acc         Received Unicast packets
 * @param recvd_ucast_packets_delta       Received delta unicast packets
 * @param tx_bcast_packets_acc            Transmitted broadcast packets
 * @param tx_bcast_packets_delta          Transmitted delta broadcast packets
 * @param tx_discarded_packets_acc        Transmitted packets discarded
 * @param tx_discarded_packets_delta      Transmitted delta discarded packets
 * @param tx_error_packets_acc            Transmitted error packets
 * @param tx_error_packets_delta          Transmitted delta error packets
 * @param tx_mcast_packets_acc            Transmitted multicast packets accumulated
 * @param tx_mcast_packets_delta          Transmitted delta multicast packets
 * @param tx_octets_acc                   Transmitted octets
 * @param tx_octets_delta                 Transmitted delta octets
 * @param tx_total_packets_acc            Transmitted total packets
 * @param tx_total_packets_delta          Transmitted delta total packets
 * @param tx_ucast_packets_acc            Transmitted Unicast packets
 * @param tx_ucast_packets_delta          Transmitted delta Unicast packets
 *****************************************************************************/
void evel_measurement_vnic_performance_add(EVENT_MEASUREMENT * const measurement,
                               char * const vnic_id,
                               char * valset,
                               double recvd_bcast_packets_acc,
                               double recvd_bcast_packets_delta,
                               double recvd_discarded_packets_acc,
                               double recvd_discarded_packets_delta,
                               double recvd_error_packets_acc,
                               double recvd_error_packets_delta,
                               double recvd_mcast_packets_acc,
                               double recvd_mcast_packets_delta,
                               double recvd_octets_acc,
                               double recvd_octets_delta,
                               double recvd_total_packets_acc,
                               double recvd_total_packets_delta,
                               double recvd_ucast_packets_acc,
                               double recvd_ucast_packets_delta,
                               double tx_bcast_packets_acc,
                               double tx_bcast_packets_delta,
                               double tx_discarded_packets_acc,
                               double tx_discarded_packets_delta,
                               double tx_error_packets_acc,
                               double tx_error_packets_delta,
                               double tx_mcast_packets_acc,
                               double tx_mcast_packets_delta,
                               double tx_octets_acc,
                               double tx_octets_delta,
                               double tx_total_packets_acc,
                               double tx_total_packets_delta,
                               double tx_ucast_packets_acc,
                               double tx_ucast_packets_delta);

/*****************************************************************************/
/*****************************************************************************/
/*                                                                           */
/*   REPORT                                                                  */
/*                                                                           */
/*****************************************************************************/
/*****************************************************************************/

/**************************************************************************//**
 * Create a new Report event.
 *
 * @note    The mandatory fields on the Report must be supplied to this
 *          factory function and are immutable once set.  Optional fields have
 *          explicit setter functions, but again values may only be set once so
 *          that the Report has immutable properties.
 *
 * @param   measurement_interval
 * @param event_name    Unique Event Name
 * @param event_id    A universal identifier of the event for analysis etc
 *
 * @returns pointer to the newly manufactured ::EVENT_REPORT.  If the event is
 *          not used (i.e. posted) it must be released using
 *          ::evel_free_report.
 * @retval  NULL  Failed to create the event.
 *****************************************************************************/
EVENT_REPORT * evel_new_report(double measurement_interval,const char* ev_name, const char *ev_id);

/**************************************************************************//**
 * Free a Report.
 *
 * Free off the Report supplied.  Will free all the contained allocated memory.
 *
 * @note It does not free the Report itself, since that may be part of a
 * larger structure.
 *****************************************************************************/
void evel_free_report(EVENT_REPORT * event);

/**************************************************************************//**
 * Set the Event Type property of the Report.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param report Pointer to the Report.
 * @param type        The Event Type to be set. ASCIIZ string. The caller
 *                    does not need to preserve the value once the function
 *                    returns.
 *****************************************************************************/
void evel_report_type_set(EVENT_REPORT * report, const char * const type);

/**************************************************************************//**
 * Add a Feature usage value name/value pair to the Report.
 *
 * The name is null delimited ASCII string.  The library takes
 * a copy so the caller does not have to preserve values after the function
 * returns.
 *
 * @param report          Pointer to the report.
 * @param feature         ASCIIZ string with the feature's name.
 * @param utilization     Utilization of the feature.
 *****************************************************************************/
void evel_report_feature_use_add(EVENT_REPORT * report,
                                 char * feature,
                                 int utilization);

/**************************************************************************//**
 * Add a Additional Measurement value name/value pair to the Report.
 *
 * The name is null delimited ASCII string.  The library takes
 * a copy so the caller does not have to preserve values after the function
 * returns.
 *
 * @param report   Pointer to the report.
 * @param group    ASCIIZ string with the measurement group's name.
 * @param name     ASCIIZ string containing the measurement's name.
 * @param value    ASCIIZ string containing the measurement's value.
 *****************************************************************************/
void evel_report_custom_measurement_add(EVENT_REPORT * report,
                                        const char * const group,
                                        const char * const name,
                                        const char * const value);

/*****************************************************************************/
/*****************************************************************************/
/*                                                                           */
/*   MOBILE_FLOW                                                             */
/*                                                                           */
/*****************************************************************************/
/*****************************************************************************/

/**************************************************************************//**
 * Create a new Mobile Flow event.
 *
 * @note    The mandatory fields on the Mobile Flow must be supplied to this
 *          factory function and are immutable once set.  Optional fields have
 *          explicit setter functions, but again values may only be set once so
 *          that the Mobile Flow has immutable properties.
 *
 * @param event_name    Unique Event Name
 * @param event_id    A universal identifier of the event for analysis etc
 * @param   flow_direction
 * @param   gtp_per_flow_metrics
 * @param   ip_protocol_type
 * @param   ip_version
 * @param   other_endpoint_ip_address
 * @param   other_endpoint_port
 * @param   reporting_endpoint_ip_addr
 * @param   reporting_endpoint_port
 *
 * @returns pointer to the newly manufactured ::EVENT_MOBILE_FLOW.  If the
 *          event is not used (i.e. posted) it must be released using
 *          ::evel_free_mobile_flow.
 * @retval  NULL  Failed to create the event.
 *****************************************************************************/
EVENT_MOBILE_FLOW * evel_new_mobile_flow(
		      const char* ev_name, const char *ev_id,
                      const char * const flow_direction,
                      MOBILE_GTP_PER_FLOW_METRICS * gtp_per_flow_metrics,
                      const char * const ip_protocol_type,
                      const char * const ip_version,
                      const char * const other_endpoint_ip_address,
                      int other_endpoint_port,
                      const char * const reporting_endpoint_ip_addr,
                      int reporting_endpoint_port);

/**************************************************************************//**
 * Free a Mobile Flow.
 *
 * Free off the Mobile Flow supplied.  Will free all the contained allocated
 * memory.
 *
 * @note It does not free the Mobile Flow itself, since that may be part of a
 * larger structure.
 *****************************************************************************/
void evel_free_mobile_flow(EVENT_MOBILE_FLOW * event);

/**************************************************************************//**
 * Set the Event Type property of the Mobile Flow.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param mobile_flow Pointer to the Mobile Flow.
 * @param type        The Event Type to be set. ASCIIZ string. The caller
 *                    does not need to preserve the value once the function
 *                    returns.
 *****************************************************************************/
void evel_mobile_flow_type_set(EVENT_MOBILE_FLOW * mobile_flow,
                               const char * const type);

/**************************************************************************//**
 * Set the Application Type property of the Mobile Flow.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param mobile_flow Pointer to the Mobile Flow.
 * @param type        The Application Type to be set. ASCIIZ string. The caller
 *                    does not need to preserve the value once the function
 *                    returns.
 *****************************************************************************/
void evel_mobile_flow_app_type_set(EVENT_MOBILE_FLOW * mobile_flow,
                                   const char * const type);

/**************************************************************************//**
 * Set the Application Protocol Type property of the Mobile Flow.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param mobile_flow Pointer to the Mobile Flow.
 * @param type        The Application Protocol Type to be set. ASCIIZ string.
 *                    The caller does not need to preserve the value once the
 *                    function returns.
 *****************************************************************************/
void evel_mobile_flow_app_prot_type_set(EVENT_MOBILE_FLOW * mobile_flow,
                                        const char * const type);

/**************************************************************************//**
 * Set the Application Protocol Version property of the Mobile Flow.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param mobile_flow Pointer to the Mobile Flow.
 * @param version     The Application Protocol Version to be set. ASCIIZ
 *                    string.  The caller does not need to preserve the value
 *                    once the function returns.
 *****************************************************************************/
void evel_mobile_flow_app_prot_ver_set(EVENT_MOBILE_FLOW * mobile_flow,
                                       const char * const version);

/**************************************************************************//**
 * Set the CID property of the Mobile Flow.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param mobile_flow Pointer to the Mobile Flow.
 * @param cid         The CID to be set. ASCIIZ string.  The caller does not
 *                    need to preserve the value once the function returns.
 *****************************************************************************/
void evel_mobile_flow_cid_set(EVENT_MOBILE_FLOW * mobile_flow,
                              const char * const cid);

/**************************************************************************//**
 * Set the Connection Type property of the Mobile Flow.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param mobile_flow Pointer to the Mobile Flow.
 * @param type        The Connection Type to be set. ASCIIZ string. The caller
 *                    does not need to preserve the value once the function
 *                    returns.
 *****************************************************************************/
void evel_mobile_flow_con_type_set(EVENT_MOBILE_FLOW * mobile_flow,
                                   const char * const type);

/**************************************************************************//**
 * Set the ECGI property of the Mobile Flow.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param mobile_flow Pointer to the Mobile Flow.
 * @param ecgi        The ECGI to be set. ASCIIZ string.  The caller does not
 *                    need to preserve the value once the function returns.
 *****************************************************************************/
void evel_mobile_flow_ecgi_set(EVENT_MOBILE_FLOW * mobile_flow,
                               const char * const ecgi);

/**************************************************************************//**
 * Set the GTP Protocol Type property of the Mobile Flow.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param mobile_flow Pointer to the Mobile Flow.
 * @param type        The GTP Protocol Type to be set. ASCIIZ string.  The
 *                    caller does not need to preserve the value once the
 *                    function returns.
 *****************************************************************************/
void evel_mobile_flow_gtp_prot_type_set(EVENT_MOBILE_FLOW * mobile_flow,
                                        const char * const type);

/**************************************************************************//**
 * Set the GTP Protocol Version property of the Mobile Flow.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param mobile_flow Pointer to the Mobile Flow.
 * @param version     The GTP Protocol Version to be set. ASCIIZ string.  The
 *                    caller does not need to preserve the value once the
 *                    function returns.
 *****************************************************************************/
void evel_mobile_flow_gtp_prot_ver_set(EVENT_MOBILE_FLOW * mobile_flow,
                                       const char * const version);

/**************************************************************************//**
 * Set the HTTP Header property of the Mobile Flow.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param mobile_flow Pointer to the Mobile Flow.
 * @param header      The HTTP header to be set. ASCIIZ string. The caller does
 *                    not need to preserve the value once the function returns.
 *****************************************************************************/
void evel_mobile_flow_http_header_set(EVENT_MOBILE_FLOW * mobile_flow,
                                      const char * const header);

/**************************************************************************//**
 * Set the IMEI property of the Mobile Flow.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param mobile_flow Pointer to the Mobile Flow.
 * @param imei        The IMEI to be set. ASCIIZ string.  The caller does not
 *                    need to preserve the value once the function returns.
 *****************************************************************************/
void evel_mobile_flow_imei_set(EVENT_MOBILE_FLOW * mobile_flow,
                               const char * const imei);

/**************************************************************************//**
 * Set the IMSI property of the Mobile Flow.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param mobile_flow Pointer to the Mobile Flow.
 * @param imsi        The IMSI to be set. ASCIIZ string.  The caller does not
 *                    need to preserve the value once the function returns.
 *****************************************************************************/
void evel_mobile_flow_imsi_set(EVENT_MOBILE_FLOW * mobile_flow,
                               const char * const imsi);

/**************************************************************************//**
 * Set the LAC property of the Mobile Flow.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param mobile_flow Pointer to the Mobile Flow.
 * @param lac         The LAC to be set. ASCIIZ string.  The caller does not
 *                    need to preserve the value once the function returns.
 *****************************************************************************/
void evel_mobile_flow_lac_set(EVENT_MOBILE_FLOW * mobile_flow,
                              const char * const lac);

/**************************************************************************//**
 * Set the MCC property of the Mobile Flow.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param mobile_flow Pointer to the Mobile Flow.
 * @param mcc         The MCC to be set. ASCIIZ string.  The caller does not
 *                    need to preserve the value once the function returns.
 *****************************************************************************/
void evel_mobile_flow_mcc_set(EVENT_MOBILE_FLOW * mobile_flow,
                              const char * const mcc);

/**************************************************************************//**
 * Set the MNC property of the Mobile Flow.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param mobile_flow Pointer to the Mobile Flow.
 * @param mnc         The MNC to be set. ASCIIZ string.  The caller does not
 *                    need to preserve the value once the function returns.
 *****************************************************************************/
void evel_mobile_flow_mnc_set(EVENT_MOBILE_FLOW * mobile_flow,
                              const char * const mnc);

/**************************************************************************//**
 * Set the MSISDN property of the Mobile Flow.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param mobile_flow Pointer to the Mobile Flow.
 * @param msisdn      The MSISDN to be set. ASCIIZ string.  The caller does not
 *                    need to preserve the value once the function returns.
 *****************************************************************************/
void evel_mobile_flow_msisdn_set(EVENT_MOBILE_FLOW * mobile_flow,
                                 const char * const msisdn);

/**************************************************************************//**
 * Set the Other Functional Role property of the Mobile Flow.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param mobile_flow Pointer to the Mobile Flow.
 * @param role        The Other Functional Role to be set. ASCIIZ string. The
 *                    caller does not need to preserve the value once the
 *                    function returns.
 *****************************************************************************/
void evel_mobile_flow_other_func_role_set(EVENT_MOBILE_FLOW * mobile_flow,
                                          const char * const role);

/**************************************************************************//**
 * Set the RAC property of the Mobile Flow.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param mobile_flow Pointer to the Mobile Flow.
 * @param rac         The RAC to be set. ASCIIZ string.  The caller does not
 *                    need to preserve the value once the function returns.
 *****************************************************************************/
void evel_mobile_flow_rac_set(EVENT_MOBILE_FLOW * mobile_flow,
                              const char * const rac);

/**************************************************************************//**
 * Set the Radio Access Technology property of the Mobile Flow.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param mobile_flow Pointer to the Mobile Flow.
 * @param tech        The Radio Access Technology to be set. ASCIIZ string. The
 *                    caller does not need to preserve the value once the
 *                    function returns.
 *****************************************************************************/
void evel_mobile_flow_radio_acc_tech_set(EVENT_MOBILE_FLOW * mobile_flow,
                                         const char * const tech);

/**************************************************************************//**
 * Set the SAC property of the Mobile Flow.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param mobile_flow Pointer to the Mobile Flow.
 * @param sac         The SAC to be set. ASCIIZ string.  The caller does not
 *                    need to preserve the value once the function returns.
 *****************************************************************************/
void evel_mobile_flow_sac_set(EVENT_MOBILE_FLOW * mobile_flow,
                              const char * const sac);

/**************************************************************************//**
 * Set the Sampling Algorithm property of the Mobile Flow.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param mobile_flow Pointer to the Mobile Flow.
 * @param algorithm   The Sampling Algorithm to be set.
 *****************************************************************************/
void evel_mobile_flow_samp_alg_set(EVENT_MOBILE_FLOW * mobile_flow,
                                   int algorithm);

/**************************************************************************//**
 * Set the TAC property of the Mobile Flow.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param mobile_flow Pointer to the Mobile Flow.
 * @param tac         The TAC to be set. ASCIIZ string.  The caller does not
 *                    need to preserve the value once the function returns.
 *****************************************************************************/
void evel_mobile_flow_tac_set(EVENT_MOBILE_FLOW * mobile_flow,
                              const char * const tac);

/**************************************************************************//**
 * Set the Tunnel ID property of the Mobile Flow.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param mobile_flow Pointer to the Mobile Flow.
 * @param tunnel_id   The Tunnel ID to be set. ASCIIZ string.  The caller does
 *                    not need to preserve the value once the function returns.
 *****************************************************************************/
void evel_mobile_flow_tunnel_id_set(EVENT_MOBILE_FLOW * mobile_flow,
                                    const char * const tunnel_id);

/**************************************************************************//**
 * Set the VLAN ID property of the Mobile Flow.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param mobile_flow Pointer to the Mobile Flow.
 * @param vlan_id     The VLAN ID to be set. ASCIIZ string.  The caller does
 *                    not need to preserve the value once the function returns.
 *****************************************************************************/
void evel_mobile_flow_vlan_id_set(EVENT_MOBILE_FLOW * mobile_flow,
                                  const char * const vlan_id);

/**************************************************************************//**
 * Create a new Mobile GTP Per Flow Metrics.
 *
 * @note    The mandatory fields on the Mobile GTP Per Flow Metrics must be
 *          supplied to this factory function and are immutable once set.
 *          Optional fields have explicit setter functions, but again values
 *          may only be set once so that the Mobile GTP Per Flow Metrics has
 *          immutable properties.
 *
 * @param   avg_bit_error_rate
 * @param   avg_packet_delay_variation
 * @param   avg_packet_latency
 * @param   avg_receive_throughput
 * @param   avg_transmit_throughput
 * @param   flow_activation_epoch
 * @param   flow_activation_microsec
 * @param   flow_deactivation_epoch
 * @param   flow_deactivation_microsec
 * @param   flow_deactivation_time
 * @param   flow_status
 * @param   max_packet_delay_variation
 * @param   num_activation_failures
 * @param   num_bit_errors
 * @param   num_bytes_received
 * @param   num_bytes_transmitted
 * @param   num_dropped_packets
 * @param   num_l7_bytes_received
 * @param   num_l7_bytes_transmitted
 * @param   num_lost_packets
 * @param   num_out_of_order_packets
 * @param   num_packet_errors
 * @param   num_packets_received_excl_retrans
 * @param   num_packets_received_incl_retrans
 * @param   num_packets_transmitted_incl_retrans
 * @param   num_retries
 * @param   num_timeouts
 * @param   num_tunneled_l7_bytes_received
 * @param   round_trip_time
 * @param   time_to_first_byte
 *
 * @returns pointer to the newly manufactured ::MOBILE_GTP_PER_FLOW_METRICS.
 *          If the structure is not used it must be released using
 *          ::evel_free_mobile_gtp_flow_metrics.
 * @retval  NULL  Failed to create the event.
 *****************************************************************************/
MOBILE_GTP_PER_FLOW_METRICS * evel_new_mobile_gtp_flow_metrics(
                                      double avg_bit_error_rate,
                                      double avg_packet_delay_variation,
                                      int avg_packet_latency,
                                      int avg_receive_throughput,
                                      int avg_transmit_throughput,
                                      int flow_activation_epoch,
                                      int flow_activation_microsec,
                                      int flow_deactivation_epoch,
                                      int flow_deactivation_microsec,
                                      time_t flow_deactivation_time,
                                      const char * const flow_status,
                                      int max_packet_delay_variation,
                                      int num_activation_failures,
                                      int num_bit_errors,
                                      int num_bytes_received,
                                      int num_bytes_transmitted,
                                      int num_dropped_packets,
                                      int num_l7_bytes_received,
                                      int num_l7_bytes_transmitted,
                                      int num_lost_packets,
                                      int num_out_of_order_packets,
                                      int num_packet_errors,
                                      int num_packets_received_excl_retrans,
                                      int num_packets_received_incl_retrans,
                                      int num_packets_transmitted_incl_retrans,
                                      int num_retries,
                                      int num_timeouts,
                                      int num_tunneled_l7_bytes_received,
                                      int round_trip_time,
                                      int time_to_first_byte);

/**************************************************************************//**
 * Free a Mobile GTP Per Flow Metrics.
 *
 * Free off the Mobile GTP Per Flow Metrics supplied.  Will free all the
 * contained allocated memory.
 *
 * @note It does not free the Mobile GTP Per Flow Metrics itself, since that
 * may be part of a larger structure.
 *****************************************************************************/
void evel_free_mobile_gtp_flow_metrics(MOBILE_GTP_PER_FLOW_METRICS * metrics);

/**************************************************************************//**
 * Set the Duration of Connection Failed Status property of the Mobile GTP Per
 * Flow Metrics.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param metrics     Pointer to the Mobile GTP Per Flow Metrics.
 * @param duration    The Duration of Connection Failed Status to be set.
 *****************************************************************************/
void evel_mobile_gtp_metrics_dur_con_fail_set(
                                         MOBILE_GTP_PER_FLOW_METRICS * metrics,
                                         int duration);

/**************************************************************************//**
 * Set the Duration of Tunnel Failed Status property of the Mobile GTP Per Flow
 * Metrics.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param metrics     Pointer to the Mobile GTP Per Flow Metrics.
 * @param duration    The Duration of Tunnel Failed Status to be set.
 *****************************************************************************/
void evel_mobile_gtp_metrics_dur_tun_fail_set(
                                         MOBILE_GTP_PER_FLOW_METRICS * metrics,
                                         int duration);

/**************************************************************************//**
 * Set the Activated By property of the Mobile GTP Per Flow metrics.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param metrics     Pointer to the Mobile GTP Per Flow Metrics.
 * @param act_by      The Activated By to be set.  ASCIIZ string. The caller
 *                    does not need to preserve the value once the function
 *                    returns.
 *****************************************************************************/
void evel_mobile_gtp_metrics_act_by_set(MOBILE_GTP_PER_FLOW_METRICS * metrics,
                                        const char * const act_by);

/**************************************************************************//**
 * Set the Activation Time property of the Mobile GTP Per Flow metrics.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param metrics     Pointer to the Mobile GTP Per Flow Metrics.
 * @param act_time    The Activation Time to be set.  ASCIIZ string. The caller
 *                    does not need to preserve the value once the function
 *                    returns.
 *****************************************************************************/
void evel_mobile_gtp_metrics_act_time_set(
                                         MOBILE_GTP_PER_FLOW_METRICS * metrics,
                                         time_t act_time);

/**************************************************************************//**
 * Set the Deactivated By property of the Mobile GTP Per Flow metrics.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param metrics     Pointer to the Mobile GTP Per Flow Metrics.
 * @param deact_by    The Deactivated By to be set.  ASCIIZ string. The caller
 *                    does not need to preserve the value once the function
 *                    returns.
 *****************************************************************************/
void evel_mobile_gtp_metrics_deact_by_set(
                                         MOBILE_GTP_PER_FLOW_METRICS * metrics,
                                         const char * const deact_by);

/**************************************************************************//**
 * Set the GTP Connection Status property of the Mobile GTP Per Flow metrics.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param metrics     Pointer to the Mobile GTP Per Flow Metrics.
 * @param status      The GTP Connection Status to be set.  ASCIIZ string. The
 *                    caller does not need to preserve the value once the
 *                    function returns.
 *****************************************************************************/
void evel_mobile_gtp_metrics_con_status_set(
                                         MOBILE_GTP_PER_FLOW_METRICS * metrics,
                                         const char * const status);

/**************************************************************************//**
 * Set the GTP Tunnel Status property of the Mobile GTP Per Flow metrics.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param metrics     Pointer to the Mobile GTP Per Flow Metrics.
 * @param status      The GTP Tunnel Status to be set.  ASCIIZ string. The
 *                    caller does not need to preserve the value once the
 *                    function returns.
 *****************************************************************************/
void evel_mobile_gtp_metrics_tun_status_set(
                                         MOBILE_GTP_PER_FLOW_METRICS * metrics,
                                         const char * const status);

/**************************************************************************//**
 * Set an IP Type-of-Service count property of the Mobile GTP Per Flow metrics.
 *
 * @param metrics     Pointer to the Mobile GTP Per Flow Metrics.
 * @param index       The index of the IP Type-of-Service.
 * @param count       The count.
 *****************************************************************************/
void evel_mobile_gtp_metrics_iptos_set(MOBILE_GTP_PER_FLOW_METRICS * metrics,
                                       int index,
                                       int count);

/**************************************************************************//**
 * Set the Large Packet Round-Trip Time property of the Mobile GTP Per Flow
 * Metrics.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param metrics     Pointer to the Mobile GTP Per Flow Metrics.
 * @param rtt         The Large Packet Round-Trip Time to be set.
 *****************************************************************************/
void evel_mobile_gtp_metrics_large_pkt_rtt_set(
                                         MOBILE_GTP_PER_FLOW_METRICS * metrics,
                                         int rtt);

/**************************************************************************//**
 * Set the Large Packet Threshold property of the Mobile GTP Per Flow Metrics.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param metrics     Pointer to the Mobile GTP Per Flow Metrics.
 * @param threshold   The Large Packet Threshold to be set.
 *****************************************************************************/
void evel_mobile_gtp_metrics_large_pkt_thresh_set(
                                         MOBILE_GTP_PER_FLOW_METRICS * metrics,
                                         double threshold);

/**************************************************************************//**
 * Set the Max Receive Bit Rate property of the Mobile GTP Per Flow Metrics.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param metrics     Pointer to the Mobile GTP Per Flow Metrics.
 * @param rate        The Max Receive Bit Rate to be set.
 *****************************************************************************/
void evel_mobile_gtp_metrics_max_rcv_bit_rate_set(
                                         MOBILE_GTP_PER_FLOW_METRICS * metrics,
                                         int rate);

/**************************************************************************//**
 * Set the Max Transmit Bit Rate property of the Mobile GTP Per Flow Metrics.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param metrics     Pointer to the Mobile GTP Per Flow Metrics.
 * @param rate        The Max Transmit Bit Rate to be set.
 *****************************************************************************/
void evel_mobile_gtp_metrics_max_trx_bit_rate_set(
                                         MOBILE_GTP_PER_FLOW_METRICS * metrics,
                                         int rate);

/**************************************************************************//**
 * Set the Number of GTP Echo Failures property of the Mobile GTP Per Flow
 * Metrics.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param metrics     Pointer to the Mobile GTP Per Flow Metrics.
 * @param num         The Number of GTP Echo Failures to be set.
 *****************************************************************************/
void evel_mobile_gtp_metrics_num_echo_fail_set(
                                         MOBILE_GTP_PER_FLOW_METRICS * metrics,
                                         int num);

/**************************************************************************//**
 * Set the Number of GTP Tunnel Errors property of the Mobile GTP Per Flow
 * Metrics.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param metrics     Pointer to the Mobile GTP Per Flow Metrics.
 * @param num         The Number of GTP Tunnel Errors to be set.
 *****************************************************************************/
void evel_mobile_gtp_metrics_num_tun_fail_set(
                                         MOBILE_GTP_PER_FLOW_METRICS * metrics,
                                         int num);

/**************************************************************************//**
 * Set the Number of HTTP Errors property of the Mobile GTP Per Flow Metrics.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param metrics     Pointer to the Mobile GTP Per Flow Metrics.
 * @param num         The Number of HTTP Errors to be set.
 *****************************************************************************/
void evel_mobile_gtp_metrics_num_http_errors_set(
                                         MOBILE_GTP_PER_FLOW_METRICS * metrics,
                                         int num);

/**************************************************************************//**
 * Add a TCP flag count to the metrics.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param metrics       Pointer to the Mobile GTP Per Flow Metrics.
 * @param tcp_flag      The TCP flag count to be updated.
 * @param count         The associated flag count.
 *****************************************************************************/
void evel_mobile_gtp_metrics_tcp_flag_count_add(
                                         MOBILE_GTP_PER_FLOW_METRICS * metrics,
                                         const EVEL_TCP_FLAGS tcp_flag,
                                         const int count);

/**************************************************************************//**
 * Add a QCI COS count to the metrics.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param metrics       Pointer to the Mobile GTP Per Flow Metrics.
 * @param qci_cos       The QCI COS count to be updated.
 * @param count         The associated QCI COS count.
 *****************************************************************************/
void evel_mobile_gtp_metrics_qci_cos_count_add(
                                         MOBILE_GTP_PER_FLOW_METRICS * metrics,
                                         const EVEL_QCI_COS_TYPES qci_cos,
                                         const int count);

/*****************************************************************************/
/*****************************************************************************/
/*                                                                           */
/*   SIGNALING                                                               */
/*                                                                           */
/*****************************************************************************/
/*****************************************************************************/

/**************************************************************************//**
 * Create a new Signaling event.
 *
 * @note    The mandatory fields on the Signaling must be supplied to
 *          this factory function and are immutable once set.  Optional fields
 *          have explicit setter functions, but again values may only be set
 *          once so that the event has immutable properties.
 * @param event_name    Unique Event Name
 * @param event_id    A universal identifier of the event for analysis etc
 * @param vendor_name   The vendor id to encode in the event vnf field.
 * @param module        The module to encode in the event.
 * @param vnfname       The Virtual network function to encode in the event.
 * @returns pointer to the newly manufactured ::EVENT_SIGNALING.  If the event
 *          is not used (i.e. posted) it must be released using
 *          ::evel_free_signaling.
 * @retval  NULL  Failed to create the event.
 *****************************************************************************/
EVENT_SIGNALING * evel_new_signaling(const char* ev_name, const char *ev_id,
				     const char * const vendor_name,
                                     const char * const correlator,
				     const char * const local_ip_address,
				     const char * const local_port,
				     const char * const remote_ip_address,
				     const char * const remote_port);

/**************************************************************************//**
 * Free a Signaling event.
 *
 * Free off the event supplied.  Will free all the contained allocated memory.
 *
 * @note It does not free the event itself, since that may be part of a larger
 * structure.
 *****************************************************************************/
void evel_free_signaling(EVENT_SIGNALING * const event);

/**************************************************************************//**
 * Set the Event Type property of the Signaling event.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param event         Pointer to the Signaling event.
 * @param type          The Event Type to be set. ASCIIZ string. The caller
 *                      does not need to preserve the value once the function
 *                      returns.
 *****************************************************************************/
void evel_signaling_type_set(EVENT_SIGNALING * const event,
                             const char * const type);

/**************************************************************************//**
 * Add an additional value name/value pair to the SIP signaling.
 *
 * The name and value are null delimited ASCII strings.  The library takes
 * a copy so the caller does not have to preserve values after the function
 * returns.
 *
 * @param event     Pointer to the fault.
 * @param name      ASCIIZ string with the attribute's name.  The caller
 *                  does not need to preserve the value once the function
 *                  returns.
 * @param value     ASCIIZ string with the attribute's value.  The caller
 *                  does not need to preserve the value once the function
 *                  returns.
 *****************************************************************************/
void evel_signaling_addl_info_add(EVENT_SIGNALING * event, char * name, char * value);

/**************************************************************************//**
 * Set the Correlator property of the Signaling event.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param event         Pointer to the Signaling event.
 * @param correlator    The correlator to be set. ASCIIZ string. The caller
 *                      does not need to preserve the value once the function
 *                      returns.
 *****************************************************************************/
void evel_signaling_correlator_set(EVENT_SIGNALING * const event,
                                   const char * const correlator);

/**************************************************************************//**
 * Set the Local Ip Address property of the Signaling event.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param event         Pointer to the Signaling event.
 * @param local_ip_address
 *                      The Local Ip Address to be set. ASCIIZ string. The
 *                      caller does not need to preserve the value once the
 *                      function returns.
 *****************************************************************************/
void evel_signaling_local_ip_address_set(EVENT_SIGNALING * const event,
                                         const char * const local_ip_address);

/**************************************************************************//**
 * Set the Local Port property of the Signaling event.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param event         Pointer to the Signaling event.
 * @param local_port    The Local Port to be set. ASCIIZ string. The caller
 *                      does not need to preserve the value once the function
 *                      returns.
 *****************************************************************************/
void evel_signaling_local_port_set(EVENT_SIGNALING * const event,
                                   const char * const local_port);

/**************************************************************************//**
 * Set the Remote Ip Address property of the Signaling event.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param event         Pointer to the Signaling event.
 * @param remote_ip_address
 *                      The Remote Ip Address to be set. ASCIIZ string. The
 *                      caller does not need to preserve the value once the
 *                      function returns.
 *****************************************************************************/
void evel_signaling_remote_ip_address_set(EVENT_SIGNALING * const event,
                                         const char * const remote_ip_address);

/**************************************************************************//**
 * Set the Remote Port property of the Signaling event.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param event         Pointer to the Signaling event.
 * @param remote_port   The Remote Port to be set. ASCIIZ string. The caller
 *                      does not need to preserve the value once the function
 *                      returns.
 *****************************************************************************/
void evel_signaling_remote_port_set(EVENT_SIGNALING * const event,
                                    const char * const remote_port);
/**************************************************************************//**
 * Set the Vendor module property of the Signaling event.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param event         Pointer to the Signaling event.
 * @param modulename    The module name to be set. ASCIIZ string. The caller
 *                      does not need to preserve the value once the function
 *                      returns.
 *****************************************************************************/
void evel_signaling_vnfmodule_name_set(EVENT_SIGNALING * const event,
                                    const char * const module_name);
/**************************************************************************//**
 * Set the Vendor module property of the Signaling event.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param event         Pointer to the Signaling event.
 * @param vnfname       The Virtual Network function to be set. ASCIIZ string.
 *                      The caller does not need to preserve the value once
 *                      the function returns.
 *****************************************************************************/
void evel_signaling_vnfname_set(EVENT_SIGNALING * const event,
                                    const char * const vnfname);

/**************************************************************************//**
 * Set the Compressed SIP property of the Signaling event.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param event         Pointer to the Signaling event.
 * @param compressed_sip
 *                      The Compressed SIP to be set. ASCIIZ string. The caller
 *                      does not need to preserve the value once the function
 *                      returns.
 *****************************************************************************/
void evel_signaling_compressed_sip_set(EVENT_SIGNALING * const event,
                                       const char * const compressed_sip);

/**************************************************************************//**
 * Set the Summary SIP property of the Signaling event.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param event         Pointer to the Signaling event.
 * @param summary_sip   The Summary SIP to be set. ASCIIZ string. The caller
 *                      does not need to preserve the value once the function
 *                      returns.
 *****************************************************************************/
void evel_signaling_summary_sip_set(EVENT_SIGNALING * const event,
                                    const char * const summary_sip);


/*****************************************************************************/
/*****************************************************************************/
/*                                                                           */
/*   STATE CHANGE                                                            */
/*                                                                           */
/*****************************************************************************/
/*****************************************************************************/

/**************************************************************************//**
 * Create a new State Change event.
 *
 * @note    The mandatory fields on the Syslog must be supplied to this factory
 *          function and are immutable once set.  Optional fields have explicit
 *          setter functions, but again values may only be set once so that the
 *          Syslog has immutable properties.
 *
 * @param event_name    Unique Event Name
 * @param event_id    A universal identifier of the event for analysis etc
 * @param new_state     The new state of the reporting entity.
 * @param old_state     The old state of the reporting entity.
 * @param interface     The card or port name of the reporting entity.
 *
 * @returns pointer to the newly manufactured ::EVENT_STATE_CHANGE.  If the
 *          event is not used it must be released using
 *          ::evel_free_state_change
 * @retval  NULL  Failed to create the event.
 *****************************************************************************/
EVENT_STATE_CHANGE * evel_new_state_change(const char* ev_name, const char *ev_id,
					   const EVEL_ENTITY_STATE new_state,
                                           const EVEL_ENTITY_STATE old_state,
                                           const char * const interface);

/**************************************************************************//**
 * Free a State Change.
 *
 * Free off the State Change supplied.  Will free all the contained allocated
 * memory.
 *
 * @note It does not free the State Change itself, since that may be part of a
 * larger structure.
 *****************************************************************************/
void evel_free_state_change(EVENT_STATE_CHANGE * const state_change);

/**************************************************************************//**
 * Set the Event Type property of the State Change.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param state_change  Pointer to the ::EVENT_STATE_CHANGE.
 * @param type          The Event Type to be set. ASCIIZ string. The caller
 *                      does not need to preserve the value once the function
 *                      returns.
 *****************************************************************************/
void evel_state_change_type_set(EVENT_STATE_CHANGE * const state_change,
                                const char * const type);

/**************************************************************************//**
 * Add an additional field name/value pair to the State Change.
 *
 * The name and value are null delimited ASCII strings.  The library takes
 * a copy so the caller does not have to preserve values after the function
 * returns.
 *
 * @param state_change  Pointer to the ::EVENT_STATE_CHANGE.
 * @param name          ASCIIZ string with the attribute's name.  The caller
 *                      does not need to preserve the value once the function
 *                      returns.
 * @param value         ASCIIZ string with the attribute's value.  The caller
 *                      does not need to preserve the value once the function
 *                      returns.
 *****************************************************************************/
void evel_state_change_addl_field_add(EVENT_STATE_CHANGE * const state_change,
                                      const char * const name,
                                      const char * const value);

/*****************************************************************************/
/*****************************************************************************/
/*                                                                           */
/*   SYSLOG                                                                  */
/*                                                                           */
/*****************************************************************************/
/*****************************************************************************/

/**************************************************************************//**
 * Create a new syslog event.
 *
 * @note    The mandatory fields on the Syslog must be supplied to this factory
 *          function and are immutable once set.  Optional fields have explicit
 *          setter functions, but again values may only be set once so that the
 *          Syslog has immutable properties.
 *
 * @param event_name    Unique Event Name
 * @param event_id    A universal identifier of the event for analysis etc
 * @param   event_source_type
 * @param   syslog_msg
 * @param   syslog_tag
 * @param   version
 *
 * @returns pointer to the newly manufactured ::EVENT_SYSLOG.  If the event is
 *          not used it must be released using ::evel_free_syslog
 * @retval  NULL  Failed to create the event.
 *****************************************************************************/
EVENT_SYSLOG * evel_new_syslog(const char* ev_name, const char *ev_id,
				EVEL_SOURCE_TYPES event_source_type,
                               const char * const syslog_msg,
                               const char * const syslog_tag);

/**************************************************************************//**
 * Set the Event Type property of the Syslog.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param syslog      Pointer to the syslog.
 * @param type        The Event Type to be set. ASCIIZ string. The caller
 *                    does not need to preserve the value once the function
 *                    returns.
 *****************************************************************************/
void evel_syslog_type_set(EVENT_SYSLOG * syslog,
                          const char * const type);

/**************************************************************************//**
 * Free a Syslog.
 *
 * Free off the Syslog supplied.  Will free all the contained allocated memory.
 *
 * @note It does not free the Syslog itself, since that may be part of a
 * larger structure.
 *****************************************************************************/
void evel_free_syslog(EVENT_SYSLOG * event);

/**************************************************************************//**
 * Add an additional field name/value pair to the Syslog.
 *
 * The name and value are null delimited ASCII strings.  The library takes
 * a copy so the caller does not have to preserve values after the function
 * returns.
 *
 * @param syslog    Pointer to the syslog.
 * @param name      ASCIIZ string with the attribute's name.  The caller
 *                  does not need to preserve the value once the function
 *                  returns.
 * @param value     ASCIIZ string with the attribute's value.  The caller
 *                  does not need to preserve the value once the function
 *                  returns.
 *****************************************************************************/
void evel_syslog_addl_field_add(EVENT_SYSLOG * syslog,
                                char * name,
                                char * value);

/**************************************************************************//**
 * Set the Event Source Host property of the Syslog.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param syslog      Pointer to the Syslog.
 * @param host        The Event Source Host to be set.  ASCIIZ string. The
 *                    caller does not need to preserve the value once the
 *                    function returns.
 *****************************************************************************/
void evel_syslog_event_source_host_set(EVENT_SYSLOG * syslog,
                                       const char * const host);

/**************************************************************************//**
 * Set the Syslog Facility property of the Syslog.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param syslog      Pointer to the Syslog.
 * @param facility    The Syslog Facility to be set.  ASCIIZ string. The caller
 *                    does not need to preserve the value once the function
 *                    returns.
 *****************************************************************************/
void evel_syslog_facility_set(EVENT_SYSLOG * syslog,
                              EVEL_SYSLOG_FACILITIES facility);

/**************************************************************************//**
 * Set the Process property of the Syslog.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param syslog      Pointer to the Syslog.
 * @param proc        The Process to be set.  ASCIIZ string. The caller does
 *                    not need to preserve the value once the function returns.
 *****************************************************************************/
void evel_syslog_proc_set(EVENT_SYSLOG * syslog, const char * const proc);

/**************************************************************************//**
 * Set the Process ID property of the Syslog.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param syslog      Pointer to the Syslog.
 * @param proc_id     The Process ID to be set.
 *****************************************************************************/
void evel_syslog_proc_id_set(EVENT_SYSLOG * syslog, int proc_id);

/**************************************************************************//**
 * Set the Version property of the Syslog.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param syslog      Pointer to the Syslog.
 * @param version     The Version to be set.
 *****************************************************************************/
void evel_syslog_version_set(EVENT_SYSLOG * syslog, int version);

/**************************************************************************//**
 * Set the Structured Data property of the Syslog.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param syslog      Pointer to the Syslog.
 * @param s_data      The Structured Data to be set.  ASCIIZ string. The caller
 *                    does not need to preserve the value once the function
 *                    returns.
 *****************************************************************************/
void evel_syslog_s_data_set(EVENT_SYSLOG * syslog, const char * const s_data);

/**************************************************************************//**
 * Set the Structured SDID property of the Syslog.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param syslog     Pointer to the Syslog.
 * @param sdid     The Structured Data to be set. ASCIIZ string. name@number
 *                 Caller does not need to preserve the value once the function
 *                   returns.
 *****************************************************************************/
void evel_syslog_sdid_set(EVENT_SYSLOG * syslog, const char * const sdid);

/**************************************************************************//**
 * Set the Structured Severity property of the Syslog.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param syslog     Pointer to the Syslog.
 * @param sdid     The Structured Data to be set. ASCIIZ string. 
 *                 Caller does not need to preserve the value once the function
 *                   returns.
 *****************************************************************************/
void evel_syslog_severity_set(EVENT_SYSLOG * syslog, const char * const severty);


/*****************************************************************************/
/*****************************************************************************/
/*                                                                           */
/*   OTHER                                                                   */
/*                                                                           */
/*****************************************************************************/
/*****************************************************************************/

/**************************************************************************//**
 * Create a new other event.
 *
 * @param event_name    Unique Event Name
 * @param event_id    A universal identifier of the event for analysis etc
 *
 * @returns pointer to the newly manufactured ::EVENT_OTHER.  If the event is
 *          not used it must be released using ::evel_free_other.
 * @retval  NULL  Failed to create the event.
 *****************************************************************************/
EVENT_OTHER * evel_new_other(const char* ev_name, const char *ev_id);

/**************************************************************************//**
 * Free an Other.
 *
 * Free off the Other supplied.  Will free all the contained allocated memory.
 *
 * @note It does not free the Other itself, since that may be part of a
 * larger structure.
 *****************************************************************************/
void evel_free_other(EVENT_OTHER * event);

/**************************************************************************//**
 * Set the Event Type property of the Other.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param other       Pointer to the Other.
 * @param type        The Event Type to be set. ASCIIZ string. The caller
 *                    does not need to preserve the value once the function
 *                    returns.
 *****************************************************************************/
void evel_other_type_set(EVENT_OTHER * other,
                         const char * const type);

/**************************************************************************//**
 * Add a value name/value pair to the Other.
 *
 * The name and value are null delimited ASCII strings.  The library takes
 * a copy so the caller does not have to preserve values after the function
 * returns.
 *
 * @param other     Pointer to the Other.
 * @param name      ASCIIZ string with the attribute's name.
 * @param value     ASCIIZ string with the attribute's value.
 *****************************************************************************/
void evel_other_field_add(EVENT_OTHER * other,
                          char * name,
                          char * value);

/*****************************************************************************/
/*****************************************************************************/
/*                                                                           */
/*   THROTTLING                                                              */
/*                                                                           */
/*****************************************************************************/
/*****************************************************************************/

/**************************************************************************//**
 * Return the current measurement interval provided by the Event Listener.
 *
 * @returns The current measurement interval
 * @retval  EVEL_MEASUREMENT_INTERVAL_UKNOWN (0) - interval has not been
 *          specified
 *****************************************************************************/
int evel_get_measurement_interval();

/*****************************************************************************/
/* Supported Report version.                                                 */
/*****************************************************************************/
#define EVEL_VOICEQ_MAJOR_VERSION 1
#define EVEL_VOICEQ_MINOR_VERSION 0

/**************************************************************************//**
 * End of Call Voice Quality Metrices
 * JSON equivalent field: endOfCallVqmSummaries
 *****************************************************************************/
typedef struct end_of_call_vqm_summaries {
	/***************************************************************************/
	/* Mandatory fields                                                        */
	/***************************************************************************/
	char* adjacencyName;
	char* endpointDescription;

	/***************************************************************************/
	/* Optional fields                                                         */
	/***************************************************************************/
	EVEL_OPTION_INT endpointJitter;
	EVEL_OPTION_INT endpointRtpOctetsDiscarded;
	EVEL_OPTION_INT endpointRtpOctetsReceived;
	EVEL_OPTION_INT endpointRtpOctetsSent;
	EVEL_OPTION_INT endpointRtpPacketsDiscarded;
	EVEL_OPTION_INT endpointRtpPacketsReceived;
	EVEL_OPTION_INT endpointRtpPacketsSent;
	EVEL_OPTION_INT localJitter;
	EVEL_OPTION_INT localRtpOctetsDiscarded;
	EVEL_OPTION_INT localRtpOctetsReceived;
	EVEL_OPTION_INT localRtpOctetsSent;
	EVEL_OPTION_INT localRtpPacketsDiscarded;
	EVEL_OPTION_INT localRtpPacketsReceived;
	EVEL_OPTION_INT localRtpPacketsSent;
	EVEL_OPTION_INT mosCqe;
	EVEL_OPTION_INT packetsLost;
	EVEL_OPTION_INT packetLossPercent;
	EVEL_OPTION_INT rFactor;
	EVEL_OPTION_INT roundTripDelay;

} END_OF_CALL_VOICE_QUALITY_METRICS;

/**************************************************************************//**
* Voice QUality.
* JSON equivalent field: voiceQualityFields
*****************************************************************************/

typedef struct event_voiceQuality {
	/***************************************************************************/
	/* Header and version                                                      */
	/***************************************************************************/
	EVENT_HEADER header;
	int major_version;
	int minor_version;

	/***************************************************************************/
	/* Mandatory fields                                                        */
	/***************************************************************************/
	
	char *calleeSideCodec;
	char *callerSideCodec;
	char *correlator;
	char *midCallRtcp;
	VENDOR_VNFNAME_FIELD vendorVnfNameFields;
	END_OF_CALL_VOICE_QUALITY_METRICS *endOfCallVqmSummaries;

	/***************************************************************************/
	/* Optional fields                                                         */
	/***************************************************************************/
	EVEL_OPTION_STRING phoneNumber;
	DLIST additionalInformation;

} EVENT_VOICE_QUALITY;
/**************************************************************************//**
 * Voice Quality Additional Info.
 * JSON equivalent field: additionalInformation
 *****************************************************************************/
typedef struct voice_quality_additional_info {
  char * name;
  char * value;
} VOICE_QUALITY_ADDL_INFO;

/**************************************************************************//**
 * Create a new voice quality event.
 *
 * @note    The mandatory fields on the Voice Quality must be supplied to this 
 *          factory function and are immutable once set.  Optional fields have 
 *          explicit setter functions, but again values may only be set once 
 *          so that the Voice Quality has immutable properties.
 * @param event_name    Unique Event Name
 * @param event_id    A universal identifier of the event for analysis etc
 * @param   calleeSideCodec			Callee codec for the call.
 * @param   callerSideCodec			Caller codec for the call.
 * @param   correlator				Constant across all events on this call.
 * @param   midCallRtcp				Base64 encoding of the binary RTCP data
 *									(excluding Eth/IP/UDP headers).
 * @param   vendorVnfNameFields		Vendor, VNF and VfModule names.
 * @returns pointer to the newly manufactured ::EVENT_VOICE_QUALITY.  If the 
 *          event is not used (i.e. posted) it must be released using
			::evel_free_voice_quality.
 * @retval  NULL  Failed to create the event.
 *****************************************************************************/
EVENT_VOICE_QUALITY * evel_new_voice_quality(const char* ev_name, const char *ev_id,
	const char * const calleeSideCodec,
	const char * const callerSideCodec, const char * const correlator,
	const char * const midCallRtcp, const char * const vendorVnfNameFields);

/**************************************************************************//**
 * Set the Callee side codec for Call for domain Voice Quality
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param voiceQuality				Pointer to the Voice Quality Event.
 * @param calleeCodecForCall		The Callee Side Codec to be set.  ASCIIZ 
 *									string. The caller does not need to 
 *									preserve the value once the function
 *									returns.
 *****************************************************************************/
void evel_voice_quality_callee_codec_set(EVENT_VOICE_QUALITY * voiceQuality,
									const char * const calleeCodecForCall);

/**************************************************************************//**
 * Set the Caller side codec for Call for domain Voice Quality
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param voiceQuality				Pointer to the Voice Quality Event.
 * @param callerCodecForCall		The Caller Side Codec to be set.  ASCIIZ 
 *									string. The caller does not need to 
 *									preserve the value once the function
 *									returns.
 *****************************************************************************/
void evel_voice_quality_caller_codec_set(EVENT_VOICE_QUALITY * voiceQuality,
									const char * const callerCodecForCall);

/**************************************************************************//**
 * Set the correlator for domain Voice Quality
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param voiceQuality				Pointer to the Voice Quality Event.
 * @param correlator				The correlator value to be set.  ASCIIZ 
 *									string. The caller does not need to 
 *									preserve the value once the function
 *									returns.
 *****************************************************************************/
void evel_voice_quality_correlator_set(EVENT_VOICE_QUALITY * voiceQuality,
									const char * const vCorrelator);

/**************************************************************************//**
 * Set the RTCP Call Data for domain Voice Quality
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param voiceQuality				Pointer to the Voice Quality Event.
 * @param rtcpCallData		        The RTCP Call Data to be set.  ASCIIZ 
 *									string. The caller does not need to 
 *									preserve the value once the function
 *									returns.
 *****************************************************************************/
void evel_voice_quality_rtcp_data_set(EVENT_VOICE_QUALITY * voiceQuality,
									const char * const rtcpCallData);

/**************************************************************************//**
 * Set the Vendor VNF Name fields for domain Voice Quality
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param voiceQuality				Pointer to the Voice Quality Event.
 * @param nameFields		        The Vendor, VNF and VfModule names to be set.   
 *									ASCIIZ string. The caller does not need to 
 *									preserve the value once the function
 *									returns.
 *****************************************************************************/
void evel_voice_quality_name_fields_set(EVENT_VOICE_QUALITY * voiceQuality,
									const char * const nameFields);

/**************************************************************************//**
 * Add an End of Call Voice Quality Metrices

 * The adjacencyName and endpointDescription is null delimited ASCII string.  
 * The library takes a copy so the caller does not have to preserve values
 * after the function returns.
 *
 * @param voiceQuality     Pointer to the measurement.
 * @param adjacencyName						Adjacency name
 * @param endpointDescription				Enumeration: ‘Caller’, ‘Callee’.
 * @param endpointJitter					Endpoint jitter
 * @param endpointRtpOctetsDiscarded        Endpoint RTP octets discarded.
 * @param endpointRtpOctetsReceived			Endpoint RTP octets received.
 * @param endpointRtpOctetsSent				Endpoint RTP octets sent
 * @param endpointRtpPacketsDiscarded		Endpoint RTP packets discarded.
 * @param endpointRtpPacketsReceived		Endpoint RTP packets received.
 * @param endpointRtpPacketsSent			Endpoint RTP packets sent.
 * @param localJitter						Local jitter.
 * @param localRtpOctetsDiscarded			Local RTP octets discarded.
 * @param localRtpOctetsReceived			Local RTP octets received.
 * @param localRtpOctetsSent				Local RTP octets sent.
 * @param localRtpPacketsDiscarded			Local RTP packets discarded.
 * @param localRtpPacketsReceived			Local RTP packets received.
 * @param localRtpPacketsSent				Local RTP packets sent.
 * @param mosCqe							Decimal range from 1 to 5
 *											(1 decimal place)
 * @param packetsLost						No	Packets lost
 * @param packetLossPercent					Calculated percentage packet loss 
 * @param rFactor							rFactor from 0 to 100
 * @param roundTripDelay					Round trip delay in milliseconds
 *****************************************************************************/
void evel_voice_quality_end_metrics_add(EVENT_VOICE_QUALITY * voiceQuality,
	const char * adjacencyName, EVEL_SERVICE_ENDPOINT_DESC endpointDescription,
	int endpointJitter,
	int endpointRtpOctetsDiscarded,
	int endpointRtpOctetsReceived,
	int endpointRtpOctetsSent,
	int endpointRtpPacketsDiscarded,
	int endpointRtpPacketsReceived,
	int endpointRtpPacketsSent,
	int localJitter,
	int localRtpOctetsDiscarded,
	int localRtpOctetsReceived,
	int localRtpOctetsSent,
	int localRtpPacketsDiscarded,
	int localRtpPacketsReceived,
	int localRtpPacketsSent,
	int mosCqe,
	int packetsLost,
	int packetLossPercent,
	int rFactor,
	int roundTripDelay);

/**************************************************************************//**
 * Free a Voice Quality.
 *
 * Free off the Voce Quality supplied.  Will free all the contained allocated
 * memory.
 *
 * @note It does not free the Voice Quality itself, since that may be part of a
 * larger structure.
 *****************************************************************************/
void evel_free_voice_quality(EVENT_VOICE_QUALITY * voiceQuality);

/**************************************************************************//**
 * Add an additional value name/value pair to the Voice Quality.
 *
 * The name and value are null delimited ASCII strings.  The library takes
 * a copy so the caller does not have to preserve values after the function
 * returns.
 *
 * @param fault     Pointer to the fault.
 * @param name      ASCIIZ string with the attribute's name.  The caller
 *                  does not need to preserve the value once the function
 *                  returns.
 * @param value     ASCIIZ string with the attribute's value.  The caller
 *                  does not need to preserve the value once the function
 *                  returns.
 *****************************************************************************/
void evel_voice_quality_addl_info_add(EVENT_VOICE_QUALITY * voiceQuality, char * name, char * value);


/*****************************************************************************/
/*****************************************************************************/
/*                                                                           */
/*   THRESHOLD CROSSING ALERT                                                */
/*                                                                           */
/*****************************************************************************/
/*****************************************************************************/

typedef enum evel_event_action {
	  EVEL_EVENT_ACTION_CLEAR,
	  EVEL_EVENT_ACTION_CONTINUE,
	  EVEL_EVENT_ACTION_SET,
	  EVEL_MAX_EVENT_ACTION
}EVEL_EVENT_ACTION;
	
typedef enum evel_alert_type {
         EVEL_CARD_ANOMALY, 
   	 EVEL_ELEMENT_ANOMALY, 
    	 EVEL_INTERFACE_ANOMALY, 
    	 EVEL_SERVICE_ANOMALY,
         EVEL_MAX_ANOMALY
}EVEL_ALERT_TYPE;


typedef struct perf_counter {
	char * criticality;
	char * name;
	char * thresholdCrossed;
	char * value;
}PERF_COUNTER;


/*****************************************************************************/
/* Supported Threshold Crossing version.                                     */
/*****************************************************************************/
#define EVEL_THRESHOLD_CROSS_MAJOR_VERSION 2
#define EVEL_THRESHOLD_CROSS_MINOR_VERSION 0

/**************************************************************************//**
 * Threshold Crossing.
 * JSON equivalent field: Threshold Cross Fields
 *****************************************************************************/
typedef struct event_threshold_cross {
  /***************************************************************************/
  /* Header and version                                                      */
  /***************************************************************************/
  EVENT_HEADER header;
  int major_version;
  int minor_version;

  /***************************************************************************/
  /* Mandatory fields                                                        */
  /***************************************************************************/
  PERF_COUNTER additionalParameters;
  EVEL_EVENT_ACTION  alertAction;
  char *             alertDescription; 
  EVEL_ALERT_TYPE    alertType;
  unsigned long long collectionTimestamp; 
  EVEL_SEVERITIES    eventSeverity;
  unsigned long long eventStartTimestamp;

  /***************************************************************************/
  /* Optional fields                                                         */
  /***************************************************************************/
  DLIST additional_info;
  EVEL_OPTION_STRING    alertValue;
  DLIST     alertidList;
  EVEL_OPTION_STRING    dataCollector;
  EVEL_OPTION_STRING    elementType;
  EVEL_OPTION_STRING    interfaceName;
  EVEL_OPTION_STRING    networkService;
  EVEL_OPTION_STRING    possibleRootCause;

} EVENT_THRESHOLD_CROSS;


/**************************************************************************//**
 * Create a new Threshold Crossing Alert event.
 *
 * @note    The mandatory fields on the TCA must be supplied to this factory
 *          function and are immutable once set.  Optional fields have explicit
 *          setter functions, but again values may only be set once so that the
 *          TCA has immutable properties.
 *
 * @param event_name    Unique Event Name
 * @param event_id    A universal identifier of the event for analysis etc
 * @param char* tcriticality   Performance Counter Criticality MAJ MIN,
 * @param char* tname          Performance Counter Threshold name
 * @param char* tthresholdCrossed  Counter Threshold crossed value
 * @param char* tvalue             Counter actual value
 * @param EVEL_EVENT_ACTION talertAction   Alert set continue or clear
 * @param char*  talertDescription
 * @param EVEL_ALERT_TYPE     talertType    Kind of anamoly
 * @param unsigned long long  tcollectionTimestamp time at which alert was collected
 * @param EVEL_SEVERITIES     teventSeverity  Severity of Alert
 * @param unsigned long long  teventStartTimestamp Time when this alert started
 *
 * @returns pointer to the newly manufactured ::EVENT_THRESHOLD_CROSS.  If the
 *          event is not used it must be released using
 *          ::evel_free_threshold_cross
 * @retval  NULL  Failed to create the event.
 *****************************************************************************/
EVENT_THRESHOLD_CROSS * evel_new_threshold_cross(
				const char* ev_name, const char *ev_id,
                               char * tcriticality,
	                       char * tname,
	                       char * tthresholdCrossed,
	                       char * tvalue,
                               EVEL_EVENT_ACTION  talertAction,
                               char *             talertDescription, 
                               EVEL_ALERT_TYPE    talertType,
                               unsigned long long tcollectionTimestamp, 
                               EVEL_SEVERITIES    teventSeverity,
                               unsigned long long teventStartTimestamp);

/**************************************************************************//**
 * Free a Threshold cross event.
 *
 * Free off the Threshold crossing event supplied.  Will free all the contained allocated
 * memory.
 *
 * @note It does not free the Threshold Cross itself, since that may be part of a
 * larger structure.
 *****************************************************************************/
void evel_free_threshold_cross(EVENT_THRESHOLD_CROSS * const tcp);

/**************************************************************************//**
 * Set the Event Type property of the Threshold Cross.
 *
 * @note  The property is treated as immutable: it is only valid to call
 *        the setter once.  However, we don't assert if the caller tries to
 *        overwrite, just ignoring the update instead.
 *
 * @param tcp  Pointer to the ::EVENT_THRESHOLD_CROSS.
 * @param type          The Event Type to be set. ASCIIZ string. The caller
 *                      does not need to preserve the value once the function
 *                      returns.
 *****************************************************************************/
void evel_threshold_cross_type_set(EVENT_THRESHOLD_CROSS * const tcp, char * type);

/**************************************************************************//**
 * Add an optional additional alertid value to Alert.
 *
 * @param alertid  Adds Alert ID
 *****************************************************************************/
void evel_threshold_cross_alertid_add(EVENT_THRESHOLD_CROSS * const event,char *  alertid);

  /**************************************************************************//**
   * Set the TCA probable Root cause.
   *
   * @param sheader     Possible root cause to Threshold
   *****************************************************************************/
  void evel_threshold_cross_possible_rootcause_set(EVENT_THRESHOLD_CROSS * const event, char *  sheader);
  /**************************************************************************//**
   * Set the TCA networking cause.
   *
   * @param sheader     Possible networking service value to Threshold
   *****************************************************************************/
  void evel_threshold_cross_networkservice_set(EVENT_THRESHOLD_CROSS * const event, char *  sheader);
  /**************************************************************************//**
   * Set the TCA Interface name.
   *
   * @param sheader     Interface name to threshold
   *****************************************************************************/
  void evel_threshold_cross_interfacename_set(EVENT_THRESHOLD_CROSS * const event,char *  sheader);
  /**************************************************************************//**
   * Set the TCA Data element type.
   *
   * @param sheader     element type of Threshold
   *****************************************************************************/
  void evel_threshold_cross_data_elementtype_set(EVENT_THRESHOLD_CROSS * const event,char *  sheader);
  /**************************************************************************//**
   * Set the TCA Data collector value.
   *
   * @param sheader     Data collector value
   *****************************************************************************/
  void evel_threshold_cross_data_collector_set(EVENT_THRESHOLD_CROSS * const event,char *  sheader);
  /**************************************************************************//**
   * Set the TCA alert value.
   *
   * @param sheader     Possible alert value
   *****************************************************************************/
  void evel_threshold_cross_alertvalue_set(EVENT_THRESHOLD_CROSS * const event,char *  sheader);

/**************************************************************************//**
 * Add an additional field name/value pair to the THRESHOLD CROSS event.
 *
 * The name and value are null delimited ASCII strings.  The library takes
 * a copy so the caller does not have to preserve values after the function
 * returns.
 *
 * @param state_change  Pointer to the ::EVENT_THRESHOLD_CROSS.
 * @param name          ASCIIZ string with the attribute's name.  The caller
 *                      does not need to preserve the value once the function
 *                      returns.
 * @param value         ASCIIZ string with the attribute's value.  The caller
 *                      does not need to preserve the value once the function
 *                      returns.
 *****************************************************************************/
void evel_threshold_cross_addl_info_add(EVENT_THRESHOLD_CROSS * const tcp,
                                      const char * const name,
                                      const char * const value);

/*****************************************************************************/
/*****************************************************************************/
/*                                                                           */
/*   LOGGING                                                                 */
/*                                                                           */
/*****************************************************************************/
/*****************************************************************************/

/*****************************************************************************/
/* Debug macros.                                                             */
/*****************************************************************************/
#define EVEL_DEBUG(FMT, ...)   log_debug(EVEL_LOG_DEBUG, (FMT), ##__VA_ARGS__)
#define EVEL_INFO(FMT, ...)    log_debug(EVEL_LOG_INFO, (FMT), ##__VA_ARGS__)
#define EVEL_SPAMMY(FMT, ...)  log_debug(EVEL_LOG_SPAMMY, (FMT), ##__VA_ARGS__)
#define EVEL_ERROR(FMT, ...)   log_debug(EVEL_LOG_ERROR, "ERROR: " FMT, \
                                         ##__VA_ARGS__)
#define EVEL_ENTER()                                                          \
        {                                                                     \
          log_debug(EVEL_LOG_DEBUG, "Enter %s {", __FUNCTION__);              \
          debug_indent += 2;                                                  \
        }
#define EVEL_EXIT()                                                           \
        {                                                                     \
          debug_indent -= 2;                                                  \
          log_debug(EVEL_LOG_DEBUG, "Exit %s }", __FUNCTION__);               \
        }

#define INDENT_SEPARATORS                                                     \
        "| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "

extern EVEL_LOG_LEVELS debug_level;
extern int debug_indent;
extern FILE * fout;

#define EVEL_DEBUG_ON() ((debug_level) >= EVEL_LOG_DEBUG)

/**************************************************************************//**
 * Initialize logging
 *
 * @param[in] level  The debugging level - one of ::EVEL_LOG_LEVELS.
 * @param[in] ident  The identifier for our logs.
 *****************************************************************************/
void log_initialize(EVEL_LOG_LEVELS level, const char * ident);

/**************************************************************************//**
 * Log debug information
 *
 * Logs debugging information in a platform independent manner.
 *
 * @param[in] level   The debugging level - one of ::EVEL_LOG_LEVELS.
 * @param[in] format  Log formatting string in printf format.
 * @param[in] ...     Variable argument list.
 *****************************************************************************/
void log_debug(EVEL_LOG_LEVELS level, char * format, ...);

/***************************************************************************//*
 * Store the formatted string into the static error string and log the error.
 *
 * @param format  Error string in standard printf format.
 * @param ...     Variable parameters to be substituted into the format string.
 *****************************************************************************/
void log_error_state(char * format, ...);

#ifdef __cplusplus
}
#endif

#endif