1 From 3d16acbb7942682864fd9b8ca9ca15e4147325f1 Mon Sep 17 00:00:00 2001
2 From: Johnson Li <johnson.li@intel.com>
3 Date: Fri, 22 Sep 2017 08:58:40 +0800
4 Subject: [PATCH] Add VES Agent to report statistics
7 v2: Use VES 5.x as agent library
8 v1: Add VES agent to report statistics
10 Signed-off-by: Johnson Li <johnson.li@intel.com>
12 diff --git a/src/configure.ac b/src/configure.ac
13 index fb2ead6d..ea641525 100644
14 --- a/src/configure.ac
15 +++ b/src/configure.ac
16 @@ -154,6 +154,7 @@ PLUGIN_ENABLED(lb)
22 ###############################################################################
24 diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
25 index 623892e7..84513755 100644
26 --- a/src/plugins/Makefile.am
27 +++ b/src/plugins/Makefile.am
28 @@ -69,6 +69,10 @@ if ENABLE_SNAT_PLUGIN
36 include ../suffix-rules.mk
39 diff --git a/src/plugins/ves.am b/src/plugins/ves.am
41 index 00000000..10f2194b
43 +++ b/src/plugins/ves.am
45 +# Copyright (c) <current-year> <your-organization>
46 +# Licensed under the Apache License, Version 2.0 (the "License");
47 +# you may not use this file except in compliance with the License.
48 +# You may obtain a copy of the License at:
50 +# http://www.apache.org/licenses/LICENSE-2.0
52 +# Unless required by applicable law or agreed to in writing, software
53 +# distributed under the License is distributed on an "AS IS" BASIS,
54 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
55 +# See the License for the specific language governing permissions and
56 +# limitations under the License.
58 +vppplugins_LTLIBRARIES += ves_plugin.la
60 +LIBS_DIR=$(CURDIR)/ves/libs
61 +ves_plugin_la_LDFLAGS = $(AM_LDFLAGS) -L$(LIBS_DIR)
62 +ves_plugin_la_LDFLAGS += -Wl,--whole-archive -level -Wl,--no-whole-archive
63 +ves_plugin_la_LDFLAGS += -Wl,-lpthread,-lcurl
65 +ves_plugin_la_SOURCES = ves/ves_node.c \
72 +API_FILES += ves/ves.api
74 +nobase_apiinclude_HEADERS += \
75 + ves/ves_all_api_h.h \
76 + ves/ves_msg_enum.h \
80 diff --git a/src/plugins/ves/include/double_list.h b/src/plugins/ves/include/double_list.h
82 index 00000000..5cf7e1af
84 +++ b/src/plugins/ves/include/double_list.h
86 +/*************************************************************************//**
88 + * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
90 + * Licensed under the Apache License, Version 2.0 (the "License");
91 + * you may not use this file except in compliance with the License.
92 + * You may obtain a copy of the License at
93 + * http://www.apache.org/licenses/LICENSE-2.0
95 + * Unless required by applicable law or agreed to in writing, software
96 + * distributed under the License is distributed on an "AS IS" BASIS,
97 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
98 + * See the License for the specific language governing permissions and
99 + * limitations under the License.
101 + ****************************************************************************/
103 +/**************************************************************************//**
105 + * A simple double-linked list.
107 + * @note No thread protection so you will need to use appropriate
108 + * synchronization if use spans multiple threads.
110 + ****************************************************************************/
112 +#ifndef DOUBLE_LIST_INCLUDED
113 +#define DOUBLE_LIST_INCLUDED
115 +typedef struct dlist_item
117 + struct dlist_item * previous;
118 + struct dlist_item * next;
122 +/**************************************************************************//**
123 + * Double-linked list structure
124 + *****************************************************************************/
125 +typedef struct dlist
132 +void dlist_initialize(DLIST * list);
133 +void * dlist_pop_last(DLIST * list);
134 +void dlist_push_first(DLIST * list, void * item);
135 +void dlist_push_last(DLIST * list, void * item);
136 +DLIST_ITEM * dlist_get_first(DLIST * list);
137 +DLIST_ITEM * dlist_get_last(DLIST * list);
138 +DLIST_ITEM * dlist_get_next(DLIST_ITEM * item);
139 +int dlist_is_empty(DLIST * list);
140 +int dlist_count(DLIST * list);
143 diff --git a/src/plugins/ves/include/evel.h b/src/plugins/ves/include/evel.h
145 index 00000000..6aceec30
147 +++ b/src/plugins/ves/include/evel.h
149 +#ifndef EVEL_INCLUDED
150 +#define EVEL_INCLUDED
151 +/*************************************************************************//**
153 + * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
155 + * Licensed under the Apache License, Version 2.0 (the "License");
156 + * you may not use this file except in compliance with the License.
157 + * You may obtain a copy of the License at
158 + * http://www.apache.org/licenses/LICENSE-2.0
160 + * Unless required by applicable law or agreed to in writing, software
161 + * distributed under the License is distributed on an "AS IS" BASIS,
162 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
163 + * See the License for the specific language governing permissions and
164 + * limitations under the License.
166 + ****************************************************************************/
168 +/**************************************************************************//**
170 + * Header for EVEL library
172 + * This file implements the EVEL library which is intended to provide a
173 + * simple wrapper around the complexity of AT&T's Vendor Event Listener API so
174 + * that VNFs can use it without worrying about details of the API transport.
176 + * Zero return value is success (::EVEL_SUCCESS), non-zero is failure and will
177 + * be one of ::EVEL_ERR_CODES.
178 + *****************************************************************************/
184 +#include <stdbool.h>
190 +#include "double_list.h"
191 +#include "hashtable.h"
193 +/*****************************************************************************/
194 +/* Supported API version. */
195 +/*****************************************************************************/
196 +#define EVEL_API_MAJOR_VERSION 5
197 +#define EVEL_API_MINOR_VERSION 0
199 +/**************************************************************************//**
202 + * Error codes for EVEL low level interface
203 + *****************************************************************************/
205 + EVEL_SUCCESS, /** The operation was successful. */
206 + EVEL_ERR_GEN_FAIL, /** Non-specific failure. */
207 + EVEL_CURL_LIBRARY_FAIL, /** A cURL library operation failed. */
208 + EVEL_PTHREAD_LIBRARY_FAIL, /** A Posix threads operation failed. */
209 + EVEL_OUT_OF_MEMORY, /** A memory allocation failure occurred. */
210 + EVEL_EVENT_BUFFER_FULL, /** Too many events in the ring-buffer. */
211 + EVEL_EVENT_HANDLER_INACTIVE, /** Attempt to raise event when inactive. */
212 + EVEL_NO_METADATA, /** Failed to retrieve OpenStack metadata. */
213 + EVEL_BAD_METADATA, /** OpenStack metadata invalid format. */
214 + EVEL_BAD_JSON_FORMAT, /** JSON failed to parse correctly. */
215 + EVEL_JSON_KEY_NOT_FOUND, /** Failed to find the specified JSON key. */
216 + EVEL_MAX_ERROR_CODES /** Maximum number of valid error codes. */
219 +/**************************************************************************//**
222 + * Variable levels of verbosity in the logging functions.
223 + *****************************************************************************/
226 + EVEL_LOG_SPAMMY = 30,
227 + EVEL_LOG_DEBUG = 40,
228 + EVEL_LOG_INFO = 50,
229 + EVEL_LOG_ERROR = 60,
233 +/*****************************************************************************/
234 +/* Maximum string lengths. */
235 +/*****************************************************************************/
236 +#define EVEL_MAX_STRING_LEN 4096
237 +#define EVEL_MAX_JSON_BODY 16000
238 +#define EVEL_MAX_ERROR_STRING_LEN 255
239 +#define EVEL_MAX_URL_LEN 511
241 +/**************************************************************************//**
242 + * This value represents there being no restriction on the reporting interval.
243 + *****************************************************************************/
244 +static const int EVEL_MEASUREMENT_INTERVAL_UKNOWN = 0;
246 +/**************************************************************************//**
247 + * How many events can be backed-up before we start dropping events on the
250 + * @note This value should be tuned in accordance with expected burstiness of
251 + * the event load and the expected response time of the ECOMP event
252 + * listener so that the probability of the buffer filling is suitably
254 + *****************************************************************************/
255 +static const int EVEL_EVENT_BUFFER_DEPTH = 100;
257 +/*****************************************************************************/
258 +/* How many different IP Types-of-Service are supported. */
259 +/*****************************************************************************/
260 +#define EVEL_TOS_SUPPORTED 256
262 +/**************************************************************************//**
263 + * Event domains for the various events we support.
264 + * JSON equivalent field: domain
265 + *****************************************************************************/
267 + EVEL_DOMAIN_INTERNAL, /** Internal event, not for external routing. */
268 + EVEL_DOMAIN_HEARTBEAT, /** A Heartbeat event (event header only). */
269 + EVEL_DOMAIN_FAULT, /** A Fault event. */
270 + EVEL_DOMAIN_MEASUREMENT, /** A Measurement for VF Scaling event. */
271 + EVEL_DOMAIN_MOBILE_FLOW, /** A Mobile Flow event. */
272 + EVEL_DOMAIN_REPORT, /** A Measurement for VF Reporting event. */
273 + EVEL_DOMAIN_HEARTBEAT_FIELD,/** A Heartbeat field event. */
274 + EVEL_DOMAIN_SIPSIGNALING, /** A Signaling event. */
275 + EVEL_DOMAIN_STATE_CHANGE, /** A State Change event. */
276 + EVEL_DOMAIN_SYSLOG, /** A Syslog event. */
277 + EVEL_DOMAIN_OTHER, /** Another event. */
278 + EVEL_DOMAIN_THRESHOLD_CROSS, /** A Threshold Crossing Event */
279 + EVEL_DOMAIN_VOICE_QUALITY, /** A Voice Quality Event */
280 + EVEL_MAX_DOMAINS /** Maximum number of recognized Event types. */
281 +} EVEL_EVENT_DOMAINS;
283 +/**************************************************************************//**
284 + * Event priorities.
285 + * JSON equivalent field: priority
286 + *****************************************************************************/
288 + EVEL_PRIORITY_HIGH,
289 + EVEL_PRIORITY_MEDIUM,
290 + EVEL_PRIORITY_NORMAL,
292 + EVEL_MAX_PRIORITIES
293 +} EVEL_EVENT_PRIORITIES;
295 +/**************************************************************************//**
296 + * Fault / Threshold severities.
297 + * JSON equivalent field: eventSeverity
298 + *****************************************************************************/
300 + EVEL_SEVERITY_CRITICAL,
301 + EVEL_SEVERITY_MAJOR,
302 + EVEL_SEVERITY_MINOR,
303 + EVEL_SEVERITY_WARNING,
304 + EVEL_SEVERITY_NORMAL,
305 + EVEL_MAX_SEVERITIES
308 +/**************************************************************************//**
309 + * Fault source types.
310 + * JSON equivalent field: eventSourceType
311 + *****************************************************************************/
314 + EVEL_SOURCE_ROUTER,
315 + EVEL_SOURCE_SWITCH,
319 + EVEL_SOURCE_SLOT_THRESHOLD,
320 + EVEL_SOURCE_PORT_THRESHOLD,
321 + EVEL_SOURCE_VIRTUAL_MACHINE,
322 + EVEL_SOURCE_VIRTUAL_NETWORK_FUNCTION,
323 + /***************************************************************************/
324 + /* START OF VENDOR-SPECIFIC VALUES */
326 + /* Vendor-specific values should be added here, and handled appropriately */
327 + /* in evel_event.c. */
328 + /***************************************************************************/
330 + /***************************************************************************/
331 + /* END OF VENDOR-SPECIFIC VALUES */
332 + /***************************************************************************/
333 + EVEL_MAX_SOURCE_TYPES
334 +} EVEL_SOURCE_TYPES;
336 +/**************************************************************************//**
337 + * Fault VNF Status.
338 + * JSON equivalent field: vfStatus
339 + *****************************************************************************/
341 + EVEL_VF_STATUS_ACTIVE,
342 + EVEL_VF_STATUS_IDLE,
343 + EVEL_VF_STATUS_PREP_TERMINATE,
344 + EVEL_VF_STATUS_READY_TERMINATE,
345 + EVEL_VF_STATUS_REQ_TERMINATE,
346 + EVEL_MAX_VF_STATUSES
349 +/**************************************************************************//**
350 + * Counter criticalities.
351 + * JSON equivalent field: criticality
352 + *****************************************************************************/
354 + EVEL_COUNTER_CRITICALITY_CRIT,
355 + EVEL_COUNTER_CRITICALITY_MAJ,
356 + EVEL_MAX_COUNTER_CRITICALITIES
357 +} EVEL_COUNTER_CRITICALITIES;
359 +/**************************************************************************//**
361 + * JSON equivalent field: alertAction
362 + *****************************************************************************/
364 + EVEL_ALERT_ACTION_CLEAR,
365 + EVEL_ALERT_ACTION_CONT,
366 + EVEL_ALERT_ACTION_SET,
367 + EVEL_MAX_ALERT_ACTIONS
368 +} EVEL_ALERT_ACTIONS;
370 +/**************************************************************************//**
372 + * JSON equivalent field: alertType
373 + *****************************************************************************/
375 + EVEL_ALERT_TYPE_CARD,
376 + EVEL_ALERT_TYPE_ELEMENT,
377 + EVEL_ALERT_TYPE_INTERFACE,
378 + EVEL_ALERT_TYPE_SERVICE,
379 + EVEL_MAX_ALERT_TYPES
382 +/**************************************************************************//**
384 + * JSON equivalent fields: newState, oldState
385 + *****************************************************************************/
387 + EVEL_ENTITY_STATE_IN_SERVICE,
388 + EVEL_ENTITY_STATE_MAINTENANCE,
389 + EVEL_ENTITY_STATE_OUT_OF_SERVICE,
390 + EVEL_MAX_ENTITY_STATES
391 +} EVEL_ENTITY_STATE;
393 +/**************************************************************************//**
394 + * Syslog facilities.
395 + * JSON equivalent field: syslogFacility
396 + *****************************************************************************/
398 + EVEL_SYSLOG_FACILITY_KERNEL,
399 + EVEL_SYSLOG_FACILITY_USER,
400 + EVEL_SYSLOG_FACILITY_MAIL,
401 + EVEL_SYSLOG_FACILITY_SYSTEM_DAEMON,
402 + EVEL_SYSLOG_FACILITY_SECURITY_AUTH,
403 + EVEL_SYSLOG_FACILITY_INTERNAL,
404 + EVEL_SYSLOG_FACILITY_LINE_PRINTER,
405 + EVEL_SYSLOG_FACILITY_NETWORK_NEWS,
406 + EVEL_SYSLOG_FACILITY_UUCP,
407 + EVEL_SYSLOG_FACILITY_CLOCK_DAEMON,
408 + EVEL_SYSLOG_FACILITY_SECURITY_AUTH2,
409 + EVEL_SYSLOG_FACILITY_FTP_DAEMON,
410 + EVEL_SYSLOG_FACILITY_NTP,
411 + EVEL_SYSLOG_FACILITY_LOG_AUDIT,
412 + EVEL_SYSLOG_FACILITY_LOG_ALERT,
413 + EVEL_SYSLOG_FACILITY_CLOCK_DAEMON2,
414 + EVEL_SYSLOG_FACILITY_LOCAL0,
415 + EVEL_SYSLOG_FACILITY_LOCAL1,
416 + EVEL_SYSLOG_FACILITY_LOCAL2,
417 + EVEL_SYSLOG_FACILITY_LOCAL3,
418 + EVEL_SYSLOG_FACILITY_LOCAL4,
419 + EVEL_SYSLOG_FACILITY_LOCAL5,
420 + EVEL_SYSLOG_FACILITY_LOCAL6,
421 + EVEL_SYSLOG_FACILITY_LOCAL7,
422 + EVEL_MAX_SYSLOG_FACILITIES
423 +} EVEL_SYSLOG_FACILITIES;
425 +/**************************************************************************//**
427 + * JSON equivalent fields: tcpFlagCountList, tcpFlagList
428 + *****************************************************************************/
442 +/**************************************************************************//**
443 + * Mobile QCI Classes of Service.
444 + * JSON equivalent fields: mobileQciCosCountList, mobileQciCosList
445 + *****************************************************************************/
448 + /***************************************************************************/
449 + /* UMTS Classes of Service. */
450 + /***************************************************************************/
451 + EVEL_QCI_COS_UMTS_CONVERSATIONAL,
452 + EVEL_QCI_COS_UMTS_STREAMING,
453 + EVEL_QCI_COS_UMTS_INTERACTIVE,
454 + EVEL_QCI_COS_UMTS_BACKGROUND,
456 + /***************************************************************************/
457 + /* LTE Classes of Service. */
458 + /***************************************************************************/
459 + EVEL_QCI_COS_LTE_1,
460 + EVEL_QCI_COS_LTE_2,
461 + EVEL_QCI_COS_LTE_3,
462 + EVEL_QCI_COS_LTE_4,
463 + EVEL_QCI_COS_LTE_65,
464 + EVEL_QCI_COS_LTE_66,
465 + EVEL_QCI_COS_LTE_5,
466 + EVEL_QCI_COS_LTE_6,
467 + EVEL_QCI_COS_LTE_7,
468 + EVEL_QCI_COS_LTE_8,
469 + EVEL_QCI_COS_LTE_9,
470 + EVEL_QCI_COS_LTE_69,
471 + EVEL_QCI_COS_LTE_70,
472 + EVEL_MAX_QCI_COS_TYPES
473 +} EVEL_QCI_COS_TYPES;
475 +/**************************************************************************//**
476 + * Service Event endpoint description
477 + * JSON equivalent field: endpointDesc
478 + *****************************************************************************/
480 + EVEL_SERVICE_ENDPOINT_CALLEE,
481 + EVEL_SERVICE_ENDPOINT_CALLER,
482 + EVEL_MAX_SERVICE_ENDPOINT_DESC
483 +} EVEL_SERVICE_ENDPOINT_DESC;
485 +/**************************************************************************//**
486 + * Boolean type for EVEL library.
487 + *****************************************************************************/
493 +/**************************************************************************//**
494 + * Optional parameter holder for double.
495 + *****************************************************************************/
496 +typedef struct evel_option_double
499 + EVEL_BOOLEAN is_set;
500 +} EVEL_OPTION_DOUBLE;
502 +/**************************************************************************//**
503 + * Optional parameter holder for string.
504 + *****************************************************************************/
505 +typedef struct evel_option_string
508 + EVEL_BOOLEAN is_set;
509 +} EVEL_OPTION_STRING;
511 +/**************************************************************************//**
512 + * Optional parameter holder for int.
513 + *****************************************************************************/
514 +typedef struct evel_option_int
517 + EVEL_BOOLEAN is_set;
520 +/**************************************************************************//**
521 + * Optional parameter holder for unsigned long long.
522 + *****************************************************************************/
523 +typedef struct evel_option_ull
525 + unsigned long long value;
526 + EVEL_BOOLEAN is_set;
529 +/**************************************************************************//**
530 + * Optional parameter holder for time_t.
531 + *****************************************************************************/
532 +typedef struct evel_option_time
535 + EVEL_BOOLEAN is_set;
538 +/**************************************************************************//**
539 + * enrichment fields for internal VES Event Listener service use only,
540 + * not supplied by event sources
541 + *****************************************************************************/
542 +typedef struct internal_header_fields
545 + EVEL_BOOLEAN is_set;
546 +} EVEL_OPTION_INTHEADER_FIELDS;
548 +/*****************************************************************************/
549 +/* Supported Common Event Header version. */
550 +/*****************************************************************************/
551 +#define EVEL_HEADER_MAJOR_VERSION 1
552 +#define EVEL_HEADER_MINOR_VERSION 2
554 +/**************************************************************************//**
556 + * JSON equivalent field: commonEventHeader
557 + *****************************************************************************/
558 +typedef struct event_header {
559 + /***************************************************************************/
561 + /***************************************************************************/
565 + /***************************************************************************/
566 + /* Mandatory fields */
567 + /***************************************************************************/
568 + EVEL_EVENT_DOMAINS event_domain;
571 + char * source_name;
572 + char * reporting_entity_name;
573 + EVEL_EVENT_PRIORITIES priority;
574 + unsigned long long start_epoch_microsec;
575 + unsigned long long last_epoch_microsec;
578 + /***************************************************************************/
579 + /* Optional fields */
580 + /***************************************************************************/
581 + EVEL_OPTION_STRING event_type;
582 + EVEL_OPTION_STRING source_id;
583 + EVEL_OPTION_STRING reporting_entity_id;
584 + EVEL_OPTION_INTHEADER_FIELDS internal_field;
585 + EVEL_OPTION_STRING nfcnaming_code;
586 + EVEL_OPTION_STRING nfnaming_code;
590 +/*****************************************************************************/
591 +/* Supported Fault version. */
592 +/*****************************************************************************/
593 +#define EVEL_FAULT_MAJOR_VERSION 2
594 +#define EVEL_FAULT_MINOR_VERSION 1
596 +/**************************************************************************//**
598 + * JSON equivalent field: faultFields
599 + *****************************************************************************/
600 +typedef struct event_fault {
601 + /***************************************************************************/
602 + /* Header and version */
603 + /***************************************************************************/
604 + EVENT_HEADER header;
608 + /***************************************************************************/
609 + /* Mandatory fields */
610 + /***************************************************************************/
611 + EVEL_SEVERITIES event_severity;
612 + EVEL_SOURCE_TYPES event_source_type;
613 + char * alarm_condition;
614 + char * specific_problem;
615 + EVEL_VF_STATUSES vf_status;
617 + /***************************************************************************/
618 + /* Optional fields */
619 + /***************************************************************************/
620 + EVEL_OPTION_STRING category;
621 + EVEL_OPTION_STRING alarm_interface_a;
622 + DLIST additional_info;
626 +/**************************************************************************//**
627 + * Fault Additional Info.
628 + * JSON equivalent field: alarmAdditionalInformation
629 + *****************************************************************************/
630 +typedef struct fault_additional_info {
636 +/**************************************************************************//**
637 + * optional field block for fields specific to heartbeat events
638 + *****************************************************************************/
639 +typedef struct event_heartbeat_fields
641 + /***************************************************************************/
642 + /* Header and version */
643 + /***************************************************************************/
644 + EVENT_HEADER header;
648 + /***************************************************************************/
649 + /* Mandatory fields */
650 + /***************************************************************************/
651 + double heartbeat_version;
652 + int heartbeat_interval;
654 + /***************************************************************************/
655 + /* Optional fields */
656 + /***************************************************************************/
657 + DLIST additional_info;
659 +} EVENT_HEARTBEAT_FIELD;
661 +/**************************************************************************//**
662 + * tuple which provides the name of a key along with its value and
664 + *****************************************************************************/
665 +typedef struct internal_key
668 + EVEL_OPTION_INT keyorder;
669 + EVEL_OPTION_STRING keyvalue;
670 +} EVEL_INTERNAL_KEY;
672 +/**************************************************************************//**
673 + * meta-information about an instance of a jsonObject along with
674 + * the actual object instance
675 + *****************************************************************************/
676 +typedef struct json_object_instance
680 + unsigned long long objinst_epoch_microsec;
681 + DLIST object_keys; /*EVEL_INTERNAL_KEY list */
683 +} EVEL_JSON_OBJECT_INSTANCE;
684 +#define MAX_JSON_TOKENS 128
685 +/**************************************************************************//**
686 + * Create a new json object instance.
688 + * @note The mandatory fields on the Other must be supplied to this factory
689 + * function and are immutable once set. Optional fields have explicit
690 + * setter functions, but again values may only be set once so that the
691 + * Other has immutable properties.
692 + * @param yourjson json string.
693 + * @returns pointer to the newly manufactured ::EVEL_JSON_OBJECT_INSTANCE.
694 + * not used (i.e. posted) it must be released using ::evel_free_jsonobjectinstance.
695 + * @retval NULL Failed to create the json object instance.
696 + *****************************************************************************/
697 +EVEL_JSON_OBJECT_INSTANCE * evel_new_jsonobjinstance(const char *const yourjson);
698 +/**************************************************************************//**
699 + * Free an json object instance.
701 + * Free off the json object instance supplied.
702 + * Will free all the contained allocated memory.
704 + *****************************************************************************/
705 +void evel_free_jsonobjinst(EVEL_JSON_OBJECT_INSTANCE * objinst);
707 +/**************************************************************************//**
708 + * enrichment fields for internal VES Event Listener service use only,
709 + * not supplied by event sources
710 + *****************************************************************************/
711 +typedef struct json_object
715 + EVEL_OPTION_STRING objectschema;
716 + EVEL_OPTION_STRING objectschemaurl;
717 + EVEL_OPTION_STRING nfsubscribedobjname;
718 + EVEL_OPTION_STRING nfsubscriptionid;
719 + DLIST jsonobjectinstances; /* EVEL_JSON_OBJECT_INSTANCE list */
723 +/**************************************************************************//**
724 + * Create a new json object.
726 + * @note The mandatory fields on the Other must be supplied to this factory
727 + * function and are immutable once set. Optional fields have explicit
728 + * setter functions, but again values may only be set once so that the
729 + * Other has immutable properties.
730 + * @param name name of the object.
731 + * @returns pointer to the newly manufactured ::EVEL_JSON_OBJECT.
732 + * not used (i.e. posted) it must be released using ::evel_free_jsonobject.
733 + * @retval NULL Failed to create the json object.
734 + *****************************************************************************/
735 +EVEL_JSON_OBJECT * evel_new_jsonobject(const char *const name);
736 +/**************************************************************************//**
737 + * Free an json object.
739 + * Free off the json object instance supplied.
740 + * Will free all the contained allocated memory.
742 + *****************************************************************************/
743 +void evel_free_jsonobject(EVEL_JSON_OBJECT * jsobj);
744 +/*****************************************************************************/
745 +/* Supported Measurement version. */
746 +/*****************************************************************************/
747 +#define EVEL_MEASUREMENT_MAJOR_VERSION 2
748 +#define EVEL_MEASUREMENT_MINOR_VERSION 1
750 +/**************************************************************************//**
752 + * JSON equivalent field: errors
753 + *****************************************************************************/
754 +typedef struct measurement_errors {
755 + int receive_discards;
756 + int receive_errors;
757 + int transmit_discards;
758 + int transmit_errors;
759 +} MEASUREMENT_ERRORS;
761 +/**************************************************************************//**
763 + * JSON equivalent field: measurementsForVfScalingFields
764 + *****************************************************************************/
765 +typedef struct event_measurement {
766 + /***************************************************************************/
767 + /* Header and version */
768 + /***************************************************************************/
769 + EVENT_HEADER header;
773 + /***************************************************************************/
774 + /* Mandatory fields */
775 + /***************************************************************************/
776 + double measurement_interval;
778 + /***************************************************************************/
779 + /* Optional fields */
780 + /***************************************************************************/
781 + DLIST additional_info;
782 + DLIST additional_measurements;
783 + DLIST additional_objects;
785 + EVEL_OPTION_INT concurrent_sessions;
786 + EVEL_OPTION_INT configured_entities;
789 + MEASUREMENT_ERRORS * errors;
790 + DLIST feature_usage;
791 + DLIST filesystem_usage;
792 + DLIST latency_distribution;
793 + EVEL_OPTION_DOUBLE mean_request_latency;
795 + EVEL_OPTION_INT media_ports_in_use;
796 + EVEL_OPTION_INT request_rate;
797 + EVEL_OPTION_INT vnfc_scaling_metric;
800 +} EVENT_MEASUREMENT;
802 +/**************************************************************************//**
804 + * JSON equivalent field: cpuUsage
805 + *****************************************************************************/
806 +typedef struct measurement_cpu_use {
809 + EVEL_OPTION_DOUBLE idle;
810 + EVEL_OPTION_DOUBLE intrpt;
811 + EVEL_OPTION_DOUBLE nice;
812 + EVEL_OPTION_DOUBLE softirq;
813 + EVEL_OPTION_DOUBLE steal;
814 + EVEL_OPTION_DOUBLE sys;
815 + EVEL_OPTION_DOUBLE user;
816 + EVEL_OPTION_DOUBLE wait;
817 +} MEASUREMENT_CPU_USE;
820 +/**************************************************************************//**
822 + * JSON equivalent field: diskUsage
823 + *****************************************************************************/
824 +typedef struct measurement_disk_use {
826 + EVEL_OPTION_DOUBLE iotimeavg;
827 + EVEL_OPTION_DOUBLE iotimelast;
828 + EVEL_OPTION_DOUBLE iotimemax;
829 + EVEL_OPTION_DOUBLE iotimemin;
830 + EVEL_OPTION_DOUBLE mergereadavg;
831 + EVEL_OPTION_DOUBLE mergereadlast;
832 + EVEL_OPTION_DOUBLE mergereadmax;
833 + EVEL_OPTION_DOUBLE mergereadmin;
834 + EVEL_OPTION_DOUBLE mergewriteavg;
835 + EVEL_OPTION_DOUBLE mergewritelast;
836 + EVEL_OPTION_DOUBLE mergewritemax;
837 + EVEL_OPTION_DOUBLE mergewritemin;
838 + EVEL_OPTION_DOUBLE octetsreadavg;
839 + EVEL_OPTION_DOUBLE octetsreadlast;
840 + EVEL_OPTION_DOUBLE octetsreadmax;
841 + EVEL_OPTION_DOUBLE octetsreadmin;
842 + EVEL_OPTION_DOUBLE octetswriteavg;
843 + EVEL_OPTION_DOUBLE octetswritelast;
844 + EVEL_OPTION_DOUBLE octetswritemax;
845 + EVEL_OPTION_DOUBLE octetswritemin;
846 + EVEL_OPTION_DOUBLE opsreadavg;
847 + EVEL_OPTION_DOUBLE opsreadlast;
848 + EVEL_OPTION_DOUBLE opsreadmax;
849 + EVEL_OPTION_DOUBLE opsreadmin;
850 + EVEL_OPTION_DOUBLE opswriteavg;
851 + EVEL_OPTION_DOUBLE opswritelast;
852 + EVEL_OPTION_DOUBLE opswritemax;
853 + EVEL_OPTION_DOUBLE opswritemin;
854 + EVEL_OPTION_DOUBLE pendingopsavg;
855 + EVEL_OPTION_DOUBLE pendingopslast;
856 + EVEL_OPTION_DOUBLE pendingopsmax;
857 + EVEL_OPTION_DOUBLE pendingopsmin;
858 + EVEL_OPTION_DOUBLE timereadavg;
859 + EVEL_OPTION_DOUBLE timereadlast;
860 + EVEL_OPTION_DOUBLE timereadmax;
861 + EVEL_OPTION_DOUBLE timereadmin;
862 + EVEL_OPTION_DOUBLE timewriteavg;
863 + EVEL_OPTION_DOUBLE timewritelast;
864 + EVEL_OPTION_DOUBLE timewritemax;
865 + EVEL_OPTION_DOUBLE timewritemin;
867 +} MEASUREMENT_DISK_USE;
869 +/**************************************************************************//**
870 + * Add an additional Disk usage value name/value pair to the Measurement.
872 + * The name and value are null delimited ASCII strings. The library takes
873 + * a copy so the caller does not have to preserve values after the function
876 + * @param measurement Pointer to the measurement.
877 + * @param id ASCIIZ string with the CPU's identifier.
878 + * @param usage Disk utilization.
879 + *****************************************************************************/
880 +MEASUREMENT_DISK_USE * evel_measurement_new_disk_use_add(EVENT_MEASUREMENT * measurement, char * id);
882 +/**************************************************************************//**
883 + * Filesystem Usage.
884 + * JSON equivalent field: filesystemUsage
885 + *****************************************************************************/
886 +typedef struct measurement_fsys_use {
887 + char * filesystem_name;
888 + double block_configured;
891 + double ephemeral_configured;
892 + int ephemeral_iops;
893 + double ephemeral_used;
894 +} MEASUREMENT_FSYS_USE;
896 +/**************************************************************************//**
898 + * JSON equivalent field: memoryUsage
899 + *****************************************************************************/
900 +typedef struct measurement_mem_use {
904 + EVEL_OPTION_DOUBLE memcache;
905 + EVEL_OPTION_DOUBLE memconfig;
906 + EVEL_OPTION_DOUBLE memfree;
907 + EVEL_OPTION_DOUBLE slabrecl;
908 + EVEL_OPTION_DOUBLE slabunrecl;
909 + EVEL_OPTION_DOUBLE memused;
910 +} MEASUREMENT_MEM_USE;
912 +/**************************************************************************//**
913 + * Add an additional Memory usage value name/value pair to the Measurement.
915 + * The name and value are null delimited ASCII strings. The library takes
916 + * a copy so the caller does not have to preserve values after the function
919 + * @param measurement Pointer to the measurement.
920 + * @param id ASCIIZ string with the Memory identifier.
921 + * @param vmidentifier ASCIIZ string with the VM's identifier.
922 + * @param membuffsz Memory Size.
924 + * @return Returns pointer to memory use structure in measurements
925 + *****************************************************************************/
926 +MEASUREMENT_MEM_USE * evel_measurement_new_mem_use_add(EVENT_MEASUREMENT * measurement,
927 + char * id, char *vmidentifier, double membuffsz);
929 +/**************************************************************************//**
930 + * Set kilobytes of memory used for cache
932 + * @note The property is treated as immutable: it is only valid to call
933 + * the setter once. However, we don't assert if the caller tries to
934 + * overwrite, just ignoring the update instead.
936 + * @param mem_use Pointer to the Memory Use.
937 + * @param val double
938 + *****************************************************************************/
939 +void evel_measurement_mem_use_memcache_set(MEASUREMENT_MEM_USE * const mem_use,
941 +/**************************************************************************//**
942 + * Set kilobytes of memory configured in the virtual machine on which the VNFC reporting
944 + * @note The property is treated as immutable: it is only valid to call
945 + * the setter once. However, we don't assert if the caller tries to
946 + * overwrite, just ignoring the update instead.
948 + * @param mem_use Pointer to the Memory Use.
949 + * @param val double
950 + *****************************************************************************/
951 +void evel_measurement_mem_use_memconfig_set(MEASUREMENT_MEM_USE * const mem_use,
953 +/**************************************************************************//**
954 + * Set kilobytes of physical RAM left unused by the system
956 + * @note The property is treated as immutable: it is only valid to call
957 + * the setter once. However, we don't assert if the caller tries to
958 + * overwrite, just ignoring the update instead.
960 + * @param mem_use Pointer to the Memory Use.
961 + * @param val double
962 + *****************************************************************************/
963 +void evel_measurement_mem_use_memfree_set(MEASUREMENT_MEM_USE * const mem_use,
965 +/**************************************************************************//**
966 + * Set the part of the slab that can be reclaimed such as caches measured in kilobytes
968 + * @note The property is treated as immutable: it is only valid to call
969 + * the setter once. However, we don't assert if the caller tries to
970 + * overwrite, just ignoring the update instead.
972 + * @param mem_use Pointer to the Memory Use.
973 + * @param val double
974 + *****************************************************************************/
975 +void evel_measurement_mem_use_slab_reclaimed_set(MEASUREMENT_MEM_USE * const mem_use,
977 +/**************************************************************************//**
978 + * Set the part of the slab that cannot be reclaimed such as caches measured in kilobytes
980 + * @note The property is treated as immutable: it is only valid to call
981 + * the setter once. However, we don't assert if the caller tries to
982 + * overwrite, just ignoring the update instead.
984 + * @param mem_use Pointer to the Memory Use.
985 + * @param val double
986 + *****************************************************************************/
987 +void evel_measurement_mem_use_slab_unreclaimable_set(MEASUREMENT_MEM_USE * const mem_use,
989 +/**************************************************************************//**
990 + * Set the total memory minus the sum of free, buffered, cached and slab memory in kilobytes
992 + * @note The property is treated as immutable: it is only valid to call
993 + * the setter once. However, we don't assert if the caller tries to
994 + * overwrite, just ignoring the update instead.
996 + * @param mem_use Pointer to the Memory Use.
997 + * @param val double
998 + *****************************************************************************/
999 +void evel_measurement_mem_use_usedup_set(MEASUREMENT_MEM_USE * const mem_use,
1000 + const double val);
1001 +/**************************************************************************//**
1003 + * JSON equivalent field: latencyBucketMeasure
1004 + *****************************************************************************/
1005 +typedef struct measurement_latency_bucket {
1008 + /***************************************************************************/
1009 + /* Optional fields */
1010 + /***************************************************************************/
1011 + EVEL_OPTION_DOUBLE high_end;
1012 + EVEL_OPTION_DOUBLE low_end;
1014 +} MEASUREMENT_LATENCY_BUCKET;
1016 +/**************************************************************************//**
1017 + * Virtual NIC usage.
1018 + * JSON equivalent field: vNicUsage
1019 + *****************************************************************************/
1020 +typedef struct measurement_vnic_performance {
1021 + /***************************************************************************/
1022 + /* Optional fields */
1023 + /***************************************************************************/
1024 + /*Cumulative count of broadcast packets received as read at the end of
1025 + the measurement interval*/
1026 + EVEL_OPTION_DOUBLE recvd_bcast_packets_acc;
1027 + /*Count of broadcast packets received within the measurement interval*/
1028 + EVEL_OPTION_DOUBLE recvd_bcast_packets_delta;
1029 + /*Cumulative count of discarded packets received as read at the end of
1030 + the measurement interval*/
1031 + EVEL_OPTION_DOUBLE recvd_discarded_packets_acc;
1032 + /*Count of discarded packets received within the measurement interval*/
1033 + EVEL_OPTION_DOUBLE recvd_discarded_packets_delta;
1034 + /*Cumulative count of error packets received as read at the end of
1035 + the measurement interval*/
1036 + EVEL_OPTION_DOUBLE recvd_error_packets_acc;
1037 + /*Count of error packets received within the measurement interval*/
1038 + EVEL_OPTION_DOUBLE recvd_error_packets_delta;
1039 + /*Cumulative count of multicast packets received as read at the end of
1040 + the measurement interval*/
1041 + EVEL_OPTION_DOUBLE recvd_mcast_packets_acc;
1042 + /*Count of mcast packets received within the measurement interval*/
1043 + EVEL_OPTION_DOUBLE recvd_mcast_packets_delta;
1044 + /*Cumulative count of octets received as read at the end of
1045 + the measurement interval*/
1046 + EVEL_OPTION_DOUBLE recvd_octets_acc;
1047 + /*Count of octets received within the measurement interval*/
1048 + EVEL_OPTION_DOUBLE recvd_octets_delta;
1049 + /*Cumulative count of all packets received as read at the end of
1050 + the measurement interval*/
1051 + EVEL_OPTION_DOUBLE recvd_total_packets_acc;
1052 + /*Count of all packets received within the measurement interval*/
1053 + EVEL_OPTION_DOUBLE recvd_total_packets_delta;
1054 + /*Cumulative count of unicast packets received as read at the end of
1055 + the measurement interval*/
1056 + EVEL_OPTION_DOUBLE recvd_ucast_packets_acc;
1057 + /*Count of unicast packets received within the measurement interval*/
1058 + EVEL_OPTION_DOUBLE recvd_ucast_packets_delta;
1059 + /*Cumulative count of transmitted broadcast packets at the end of
1060 + the measurement interval*/
1061 + EVEL_OPTION_DOUBLE tx_bcast_packets_acc;
1062 + /*Count of transmitted broadcast packets within the measurement interval*/
1063 + EVEL_OPTION_DOUBLE tx_bcast_packets_delta;
1064 + /*Cumulative count of transmit discarded packets at the end of
1065 + the measurement interval*/
1066 + EVEL_OPTION_DOUBLE tx_discarded_packets_acc;
1067 + /*Count of transmit discarded packets within the measurement interval*/
1068 + EVEL_OPTION_DOUBLE tx_discarded_packets_delta;
1069 + /*Cumulative count of transmit error packets at the end of
1070 + the measurement interval*/
1071 + EVEL_OPTION_DOUBLE tx_error_packets_acc;
1072 + /*Count of transmit error packets within the measurement interval*/
1073 + EVEL_OPTION_DOUBLE tx_error_packets_delta;
1074 + /*Cumulative count of transmit multicast packets at the end of
1075 + the measurement interval*/
1076 + EVEL_OPTION_DOUBLE tx_mcast_packets_acc;
1077 + /*Count of transmit multicast packets within the measurement interval*/
1078 + EVEL_OPTION_DOUBLE tx_mcast_packets_delta;
1079 + /*Cumulative count of transmit octets at the end of
1080 + the measurement interval*/
1081 + EVEL_OPTION_DOUBLE tx_octets_acc;
1082 + /*Count of transmit octets received within the measurement interval*/
1083 + EVEL_OPTION_DOUBLE tx_octets_delta;
1084 + /*Cumulative count of all transmit packets at the end of
1085 + the measurement interval*/
1086 + EVEL_OPTION_DOUBLE tx_total_packets_acc;
1087 + /*Count of transmit packets within the measurement interval*/
1088 + EVEL_OPTION_DOUBLE tx_total_packets_delta;
1089 + /*Cumulative count of all transmit unicast packets at the end of
1090 + the measurement interval*/
1091 + EVEL_OPTION_DOUBLE tx_ucast_packets_acc;
1092 + /*Count of transmit unicast packets within the measurement interval*/
1093 + EVEL_OPTION_DOUBLE tx_ucast_packets_delta;
1094 + /* Indicates whether vNicPerformance values are likely inaccurate
1095 + due to counter overflow or other condtions*/
1096 + char *valuesaresuspect;
1099 +} MEASUREMENT_VNIC_PERFORMANCE;
1101 +/**************************************************************************//**
1103 + * JSON equivalent field: codecsInUse
1104 + *****************************************************************************/
1105 +typedef struct measurement_codec_use {
1107 + int number_in_use;
1108 +} MEASUREMENT_CODEC_USE;
1110 +/**************************************************************************//**
1112 + * JSON equivalent field: featuresInUse
1113 + *****************************************************************************/
1114 +typedef struct measurement_feature_use {
1115 + char * feature_id;
1116 + int feature_utilization;
1117 +} MEASUREMENT_FEATURE_USE;
1119 +/**************************************************************************//**
1120 + * Measurement Group.
1121 + * JSON equivalent field: additionalMeasurements
1122 + *****************************************************************************/
1123 +typedef struct measurement_group {
1125 + DLIST measurements;
1126 +} MEASUREMENT_GROUP;
1128 +/**************************************************************************//**
1129 + * Custom Defined Measurement.
1130 + * JSON equivalent field: measurements
1131 + *****************************************************************************/
1132 +typedef struct custom_measurement {
1135 +} CUSTOM_MEASUREMENT;
1137 +/*****************************************************************************/
1138 +/* Supported Report version. */
1139 +/*****************************************************************************/
1140 +#define EVEL_REPORT_MAJOR_VERSION 1
1141 +#define EVEL_REPORT_MINOR_VERSION 1
1143 +/**************************************************************************//**
1145 + * JSON equivalent field: measurementsForVfReportingFields
1147 + * @note This is an experimental event type and is not currently a formal part
1148 + * of AT&T's specification.
1149 + *****************************************************************************/
1150 +typedef struct event_report {
1151 + /***************************************************************************/
1152 + /* Header and version */
1153 + /***************************************************************************/
1154 + EVENT_HEADER header;
1155 + int major_version;
1156 + int minor_version;
1158 + /***************************************************************************/
1159 + /* Mandatory fields */
1160 + /***************************************************************************/
1161 + double measurement_interval;
1163 + /***************************************************************************/
1164 + /* Optional fields */
1165 + /***************************************************************************/
1166 + DLIST feature_usage;
1167 + DLIST measurement_groups;
1171 +/**************************************************************************//**
1172 + * Mobile GTP Per Flow Metrics.
1173 + * JSON equivalent field: gtpPerFlowMetrics
1174 + *****************************************************************************/
1175 +typedef struct mobile_gtp_per_flow_metrics {
1176 + double avg_bit_error_rate;
1177 + double avg_packet_delay_variation;
1178 + int avg_packet_latency;
1179 + int avg_receive_throughput;
1180 + int avg_transmit_throughput;
1181 + int flow_activation_epoch;
1182 + int flow_activation_microsec;
1183 + int flow_deactivation_epoch;
1184 + int flow_deactivation_microsec;
1185 + time_t flow_deactivation_time;
1186 + char * flow_status;
1187 + int max_packet_delay_variation;
1188 + int num_activation_failures;
1189 + int num_bit_errors;
1190 + int num_bytes_received;
1191 + int num_bytes_transmitted;
1192 + int num_dropped_packets;
1193 + int num_l7_bytes_received;
1194 + int num_l7_bytes_transmitted;
1195 + int num_lost_packets;
1196 + int num_out_of_order_packets;
1197 + int num_packet_errors;
1198 + int num_packets_received_excl_retrans;
1199 + int num_packets_received_incl_retrans;
1200 + int num_packets_transmitted_incl_retrans;
1203 + int num_tunneled_l7_bytes_received;
1204 + int round_trip_time;
1205 + int time_to_first_byte;
1207 + /***************************************************************************/
1208 + /* Optional fields */
1209 + /***************************************************************************/
1210 + EVEL_OPTION_INT ip_tos_counts[EVEL_TOS_SUPPORTED];
1211 + EVEL_OPTION_INT tcp_flag_counts[EVEL_MAX_TCP_FLAGS];
1212 + EVEL_OPTION_INT qci_cos_counts[EVEL_MAX_QCI_COS_TYPES];
1213 + EVEL_OPTION_INT dur_connection_failed_status;
1214 + EVEL_OPTION_INT dur_tunnel_failed_status;
1215 + EVEL_OPTION_STRING flow_activated_by;
1216 + EVEL_OPTION_TIME flow_activation_time;
1217 + EVEL_OPTION_STRING flow_deactivated_by;
1218 + EVEL_OPTION_STRING gtp_connection_status;
1219 + EVEL_OPTION_STRING gtp_tunnel_status;
1220 + EVEL_OPTION_INT large_packet_rtt;
1221 + EVEL_OPTION_DOUBLE large_packet_threshold;
1222 + EVEL_OPTION_INT max_receive_bit_rate;
1223 + EVEL_OPTION_INT max_transmit_bit_rate;
1224 + EVEL_OPTION_INT num_gtp_echo_failures;
1225 + EVEL_OPTION_INT num_gtp_tunnel_errors;
1226 + EVEL_OPTION_INT num_http_errors;
1228 +} MOBILE_GTP_PER_FLOW_METRICS;
1230 +/*****************************************************************************/
1231 +/* Supported Mobile Flow version. */
1232 +/*****************************************************************************/
1233 +#define EVEL_MOBILE_FLOW_MAJOR_VERSION 1
1234 +#define EVEL_MOBILE_FLOW_MINOR_VERSION 2
1236 +/**************************************************************************//**
1238 + * JSON equivalent field: mobileFlow
1239 + *****************************************************************************/
1240 +typedef struct event_mobile_flow {
1241 + /***************************************************************************/
1242 + /* Header and version */
1243 + /***************************************************************************/
1244 + EVENT_HEADER header;
1245 + int major_version;
1246 + int minor_version;
1248 + /***************************************************************************/
1249 + /* Mandatory fields */
1250 + /***************************************************************************/
1251 + char * flow_direction;
1252 + MOBILE_GTP_PER_FLOW_METRICS * gtp_per_flow_metrics;
1253 + char * ip_protocol_type;
1254 + char * ip_version;
1255 + char * other_endpoint_ip_address;
1256 + int other_endpoint_port;
1257 + char * reporting_endpoint_ip_addr;
1258 + int reporting_endpoint_port;
1259 + DLIST additional_info; /* JSON: additionalFields */
1261 + /***************************************************************************/
1262 + /* Optional fields */
1263 + /***************************************************************************/
1264 + EVEL_OPTION_STRING application_type;
1265 + EVEL_OPTION_STRING app_protocol_type;
1266 + EVEL_OPTION_STRING app_protocol_version;
1267 + EVEL_OPTION_STRING cid;
1268 + EVEL_OPTION_STRING connection_type;
1269 + EVEL_OPTION_STRING ecgi;
1270 + EVEL_OPTION_STRING gtp_protocol_type;
1271 + EVEL_OPTION_STRING gtp_version;
1272 + EVEL_OPTION_STRING http_header;
1273 + EVEL_OPTION_STRING imei;
1274 + EVEL_OPTION_STRING imsi;
1275 + EVEL_OPTION_STRING lac;
1276 + EVEL_OPTION_STRING mcc;
1277 + EVEL_OPTION_STRING mnc;
1278 + EVEL_OPTION_STRING msisdn;
1279 + EVEL_OPTION_STRING other_functional_role;
1280 + EVEL_OPTION_STRING rac;
1281 + EVEL_OPTION_STRING radio_access_technology;
1282 + EVEL_OPTION_STRING sac;
1283 + EVEL_OPTION_INT sampling_algorithm;
1284 + EVEL_OPTION_STRING tac;
1285 + EVEL_OPTION_STRING tunnel_id;
1286 + EVEL_OPTION_STRING vlan_id;
1288 +} EVENT_MOBILE_FLOW;
1290 +/*****************************************************************************/
1291 +/* Supported Other field version. */
1292 +/*****************************************************************************/
1293 +#define EVEL_OTHER_EVENT_MAJOR_VERSION 1
1294 +#define EVEL_OTHER_EVENT_MINOR_VERSION 1
1296 +/**************************************************************************//**
1298 + * JSON equivalent field: otherFields
1299 + *****************************************************************************/
1300 +typedef struct event_other {
1301 + EVENT_HEADER header;
1302 + int major_version;
1303 + int minor_version;
1305 + HASHTABLE_T *namedarrays; /* HASHTABLE_T */
1306 + DLIST jsonobjects; /* DLIST of EVEL_JSON_OBJECT */
1307 + DLIST namedvalues;
1310 +/**************************************************************************//**
1312 + * JSON equivalent field: otherFields
1313 + *****************************************************************************/
1314 +typedef struct other_field {
1320 +/*****************************************************************************/
1321 +/* Supported Service Events version. */
1322 +/*****************************************************************************/
1323 +#define EVEL_HEARTBEAT_FIELD_MAJOR_VERSION 1
1324 +#define EVEL_HEARTBEAT_FIELD_MINOR_VERSION 1
1327 +/*****************************************************************************/
1328 +/* Supported Signaling version. */
1329 +/*****************************************************************************/
1330 +#define EVEL_SIGNALING_MAJOR_VERSION 2
1331 +#define EVEL_SIGNALING_MINOR_VERSION 1
1333 +/**************************************************************************//**
1334 + * Vendor VNF Name fields.
1335 + * JSON equivalent field: vendorVnfNameFields
1336 + *****************************************************************************/
1337 +typedef struct vendor_vnfname_field {
1338 + char * vendorname;
1339 + EVEL_OPTION_STRING vfmodule;
1340 + EVEL_OPTION_STRING vnfname;
1341 +} VENDOR_VNFNAME_FIELD;
1343 +/**************************************************************************//**
1345 + * JSON equivalent field: signalingFields
1346 + *****************************************************************************/
1347 +typedef struct event_signaling {
1348 + /***************************************************************************/
1349 + /* Header and version */
1350 + /***************************************************************************/
1351 + EVENT_HEADER header;
1352 + int major_version;
1353 + int minor_version;
1355 + /***************************************************************************/
1356 + /* Mandatory fields */
1357 + /***************************************************************************/
1358 + VENDOR_VNFNAME_FIELD vnfname_field;
1359 + EVEL_OPTION_STRING correlator; /* JSON: correlator */
1360 + EVEL_OPTION_STRING local_ip_address; /* JSON: localIpAddress */
1361 + EVEL_OPTION_STRING local_port; /* JSON: localPort */
1362 + EVEL_OPTION_STRING remote_ip_address; /* JSON: remoteIpAddress */
1363 + EVEL_OPTION_STRING remote_port; /* JSON: remotePort */
1365 + /***************************************************************************/
1366 + /* Optional fields */
1367 + /***************************************************************************/
1368 + EVEL_OPTION_STRING compressed_sip; /* JSON: compressedSip */
1369 + EVEL_OPTION_STRING summary_sip; /* JSON: summarySip */
1370 + DLIST additional_info;
1374 +/**************************************************************************//**
1375 + * Sgnaling Additional Field.
1376 + * JSON equivalent field: additionalFields
1377 + *****************************************************************************/
1378 +typedef struct signaling_additional_field {
1381 +} SIGNALING_ADDL_FIELD;
1383 +/*****************************************************************************/
1384 +/* Supported State Change version. */
1385 +/*****************************************************************************/
1386 +#define EVEL_STATE_CHANGE_MAJOR_VERSION 1
1387 +#define EVEL_STATE_CHANGE_MINOR_VERSION 2
1389 +/**************************************************************************//**
1391 + * JSON equivalent field: stateChangeFields
1392 + *****************************************************************************/
1393 +typedef struct event_state_change {
1394 + /***************************************************************************/
1395 + /* Header and version */
1396 + /***************************************************************************/
1397 + EVENT_HEADER header;
1398 + int major_version;
1399 + int minor_version;
1401 + /***************************************************************************/
1402 + /* Mandatory fields */
1403 + /***************************************************************************/
1404 + EVEL_ENTITY_STATE new_state;
1405 + EVEL_ENTITY_STATE old_state;
1406 + char * state_interface;
1409 + /***************************************************************************/
1410 + /* Optional fields */
1411 + /***************************************************************************/
1412 + DLIST additional_fields;
1414 +} EVENT_STATE_CHANGE;
1416 +/**************************************************************************//**
1417 + * State Change Additional Field.
1418 + * JSON equivalent field: additionalFields
1419 + *****************************************************************************/
1420 +typedef struct state_change_additional_field {
1423 +} STATE_CHANGE_ADDL_FIELD;
1425 +/*****************************************************************************/
1426 +/* Supported Syslog version. */
1427 +/*****************************************************************************/
1428 +#define EVEL_SYSLOG_MAJOR_VERSION 1
1429 +#define EVEL_SYSLOG_MINOR_VERSION 2
1431 +/**************************************************************************//**
1433 + * JSON equivalent field: syslogFields
1434 + *****************************************************************************/
1435 +typedef struct event_syslog {
1436 + /***************************************************************************/
1437 + /* Header and version */
1438 + /***************************************************************************/
1439 + EVENT_HEADER header;
1440 + int major_version;
1441 + int minor_version;
1443 + /***************************************************************************/
1444 + /* Mandatory fields */
1445 + /***************************************************************************/
1446 + EVEL_SOURCE_TYPES event_source_type;
1447 + char * syslog_msg;
1448 + char * syslog_tag;
1450 + /***************************************************************************/
1451 + /* Optional fields */
1452 + /***************************************************************************/
1453 + EVEL_OPTION_STRING additional_filters;
1454 + EVEL_OPTION_STRING event_source_host;
1455 + EVEL_OPTION_INT syslog_facility;
1456 + EVEL_OPTION_INT syslog_priority;
1457 + EVEL_OPTION_STRING syslog_proc;
1458 + EVEL_OPTION_INT syslog_proc_id;
1459 + EVEL_OPTION_STRING syslog_s_data;
1460 + EVEL_OPTION_STRING syslog_sdid;
1461 + EVEL_OPTION_STRING syslog_severity;
1462 + double syslog_fver;
1463 + EVEL_OPTION_INT syslog_ver;
1467 +/**************************************************************************//**
1469 + * JSON equivalent object: attCopyrightNotice
1470 + *****************************************************************************/
1471 +typedef struct copyright {
1472 + char * useAndRedistribution;
1473 + char * condition1;
1474 + char * condition2;
1475 + char * condition3;
1476 + char * condition4;
1477 + char * disclaimerLine1;
1478 + char * disclaimerLine2;
1479 + char * disclaimerLine3;
1480 + char * disclaimerLine4;
1483 +/**************************************************************************//**
1484 + * Library initialization.
1486 + * Initialize the EVEL library.
1488 + * @note This function initializes the cURL library. Applications making use
1489 + * of libcurl may need to pull the initialization out of here. Note
1490 + * also that this function is not threadsafe as a result - refer to
1491 + * libcurl's API documentation for relevant warnings.
1493 + * @sa Matching Term function.
1495 + * @param fqdn The API's FQDN or IP address.
1496 + * @param port The API's port.
1497 + * @param path The optional path (may be NULL).
1498 + * @param topic The optional topic part of the URL (may be NULL).
1499 + * @param secure Whether to use HTTPS (0=HTTP, 1=HTTPS).
1500 + * @param username Username for Basic Authentication of requests.
1501 + * @param password Password for Basic Authentication of requests.
1502 + * @param source_type The kind of node we represent.
1503 + * @param role The role this node undertakes.
1504 + * @param verbosity 0 for normal operation, positive values for chattier
1507 + * @returns Status code
1508 + * @retval EVEL_SUCCESS On success
1509 + * @retval ::EVEL_ERR_CODES On failure.
1510 + *****************************************************************************/
1511 +EVEL_ERR_CODES evel_initialize(const char * const fqdn,
1513 + const char * const path,
1514 + const char * const topic,
1516 + const char * const username,
1517 + const char * const password,
1518 + EVEL_SOURCE_TYPES source_type,
1519 + const char * const role,
1523 +/**************************************************************************//**
1524 + * Clean up the EVEL library.
1526 + * @note that at present don't expect Init/Term cycling not to leak memory!
1528 + * @returns Status code
1529 + * @retval EVEL_SUCCESS On success
1530 + * @retval "One of ::EVEL_ERR_CODES" On failure.
1531 + *****************************************************************************/
1532 +EVEL_ERR_CODES evel_terminate(void);
1534 +EVEL_ERR_CODES evel_post_event(EVENT_HEADER * event);
1535 +const char * evel_error_string(void);
1538 +/**************************************************************************//**
1541 + * Free off the event supplied. Will free all the contained allocated memory.
1543 + * @note It is safe to free a NULL pointer.
1544 + *****************************************************************************/
1545 +void evel_free_event(void * event);
1547 +/**************************************************************************//**
1548 + * Encode the event as a JSON event object according to AT&T's schema.
1550 + * @param json Pointer to where to store the JSON encoded data.
1551 + * @param max_size Size of storage available in json_body.
1552 + * @param event Pointer to the ::EVENT_HEADER to encode.
1553 + * @returns Number of bytes actually written.
1554 + *****************************************************************************/
1555 +int evel_json_encode_event(char * json,
1557 + EVENT_HEADER * event);
1559 +/**************************************************************************//**
1560 + * Initialize an event instance id.
1562 + * @param vfield Pointer to the event vnfname field being initialized.
1563 + * @param vendor_id The vendor id to encode in the event instance id.
1564 + * @param event_id The event id to encode in the event instance id.
1565 + *****************************************************************************/
1566 +void evel_init_vendor_field(VENDOR_VNFNAME_FIELD * const vfield,
1567 + const char * const vendor_name);
1569 +/**************************************************************************//**
1570 + * Set the Vendor module property of the Vendor.
1572 + * @note The property is treated as immutable: it is only valid to call
1573 + * the setter once. However, we don't assert if the caller tries to
1574 + * overwrite, just ignoring the update instead.
1576 + * @param vfield Pointer to the Vendor field.
1577 + * @param module_name The module name to be set. ASCIIZ string. The caller
1578 + * does not need to preserve the value once the function
1580 + *****************************************************************************/
1581 +void evel_vendor_field_module_set(VENDOR_VNFNAME_FIELD * const vfield,
1582 + const char * const module_name);
1583 +/**************************************************************************//**
1584 + * Set the Vendor module property of the Vendor.
1586 + * @note The property is treated as immutable: it is only valid to call
1587 + * the setter once. However, we don't assert if the caller tries to
1588 + * overwrite, just ignoring the update instead.
1590 + * @param vfield Pointer to the Vendor field.
1591 + * @param module_name The module name to be set. ASCIIZ string. The caller
1592 + * does not need to preserve the value once the function
1594 + *****************************************************************************/
1595 +void evel_vendor_field_vnfname_set(VENDOR_VNFNAME_FIELD * const vfield,
1596 + const char * const vnfname);
1597 +/**************************************************************************//**
1598 + * Free an event instance id.
1600 + * @param vfield Pointer to the event vnfname_field being freed.
1601 + *****************************************************************************/
1602 +void evel_free_event_vendor_field(VENDOR_VNFNAME_FIELD * const vfield);
1604 +/**************************************************************************//**
1605 + * Callback function to provide returned data.
1607 + * Copy data into the supplied buffer, write_callback::ptr, checking size
1610 + * @returns Number of bytes placed into write_callback::ptr. 0 for EOF.
1611 + *****************************************************************************/
1612 +size_t evel_write_callback(void *contents,
1617 +/*****************************************************************************/
1618 +/*****************************************************************************/
1620 +/* HEARTBEAT - (includes common header, too) */
1622 +/*****************************************************************************/
1623 +/*****************************************************************************/
1625 +/**************************************************************************//**
1626 + * Create a new heartbeat event.
1628 + * @note that the heartbeat is just a "naked" commonEventHeader!
1630 + * @returns pointer to the newly manufactured ::EVENT_HEADER. If the event is
1631 + * not used it must be released using ::evel_free_event
1632 + * @retval NULL Failed to create the event.
1633 + *****************************************************************************/
1634 +EVENT_HEADER * evel_new_heartbeat(void);
1636 +/**************************************************************************//**
1637 + * Create a new heartbeat event of given name and type.
1639 + * @note that the heartbeat is just a "naked" commonEventHeader!
1641 + * @param event_name Unique Event Name confirming Domain AsdcModel Description
1642 + * @param event_id A universal identifier of the event for: troubleshooting correlation, analysis, etc
1644 + * @returns pointer to the newly manufactured ::EVENT_HEADER. If the event is
1645 + * not used it must be released using ::evel_free_event
1646 + * @retval NULL Failed to create the event.
1647 + *****************************************************************************/
1648 +EVENT_HEADER * evel_new_heartbeat_nameid(const char* ev_name, const char *ev_id);
1651 +/**************************************************************************//**
1652 + * Free an event header.
1654 + * Free off the event header supplied. Will free all the contained allocated
1657 + * @note It does not free the header itself, since that may be part of a
1658 + * larger structure.
1659 + *****************************************************************************/
1660 +void evel_free_header(EVENT_HEADER * const event);
1662 +/**************************************************************************//**
1663 + * Initialize a newly created event header.
1665 + * @param header Pointer to the header being initialized.
1666 + *****************************************************************************/
1667 +void evel_init_header(EVENT_HEADER * const header,const char *const eventname);
1669 +/**************************************************************************//**
1670 + * Set the Event Type property of the event header.
1672 + * @param header Pointer to the ::EVENT_HEADER.
1673 + * @param type The Event Type to be set. ASCIIZ string. The caller
1674 + * does not need to preserve the value once the function
1676 + *****************************************************************************/
1677 +void evel_header_type_set(EVENT_HEADER * const header,
1678 + const char * const type);
1680 +/**************************************************************************//**
1681 + * Set the Start Epoch property of the event header.
1683 + * @note The Start Epoch defaults to the time of event creation.
1685 + * @param header Pointer to the ::EVENT_HEADER.
1686 + * @param start_epoch_microsec
1687 + * The start epoch to set, in microseconds.
1688 + *****************************************************************************/
1689 +void evel_start_epoch_set(EVENT_HEADER * const header,
1690 + const unsigned long long start_epoch_microsec);
1692 +/**************************************************************************//**
1693 + * Set the Last Epoch property of the event header.
1695 + * @note The Last Epoch defaults to the time of event creation.
1697 + * @param header Pointer to the ::EVENT_HEADER.
1698 + * @param last_epoch_microsec
1699 + * The last epoch to set, in microseconds.
1700 + *****************************************************************************/
1701 +void evel_last_epoch_set(EVENT_HEADER * const header,
1702 + const unsigned long long last_epoch_microsec);
1704 +/**************************************************************************//**
1705 + * Set the Reporting Entity Name property of the event header.
1707 + * @note The Reporting Entity Name defaults to the OpenStack VM Name.
1709 + * @param header Pointer to the ::EVENT_HEADER.
1710 + * @param entity_name The entity name to set.
1711 + *****************************************************************************/
1712 +void evel_reporting_entity_name_set(EVENT_HEADER * const header,
1713 + const char * const entity_name);
1715 +/**************************************************************************//**
1716 + * Set the Reporting Entity Id property of the event header.
1718 + * @note The Reporting Entity Id defaults to the OpenStack VM UUID.
1720 + * @param header Pointer to the ::EVENT_HEADER.
1721 + * @param entity_id The entity id to set.
1722 + *****************************************************************************/
1723 +void evel_reporting_entity_id_set(EVENT_HEADER * const header,
1724 + const char * const entity_id);
1726 +/**************************************************************************//**
1727 + * Set the NFC Naming code property of the event header.
1729 + * @param header Pointer to the ::EVENT_HEADER.
1730 + * @param nfcnamingcode String
1731 + *****************************************************************************/
1732 +void evel_nfcnamingcode_set(EVENT_HEADER * const header,
1733 + const char * const nfcnam);
1734 +/**************************************************************************//**
1735 + * Set the NF Naming code property of the event header.
1737 + * @param header Pointer to the ::EVENT_HEADER.
1738 + * @param nfnamingcode String
1739 + *****************************************************************************/
1740 +void evel_nfnamingcode_set(EVENT_HEADER * const header,
1741 + const char * const nfnam);
1743 +/*****************************************************************************/
1744 +/*****************************************************************************/
1748 +/*****************************************************************************/
1749 +/*****************************************************************************/
1751 +/**************************************************************************//**
1752 + * Create a new fault event.
1754 + * @note The mandatory fields on the Fault must be supplied to this factory
1755 + * function and are immutable once set. Optional fields have explicit
1756 + * setter functions, but again values may only be set once so that the
1757 + * Fault has immutable properties.
1758 + * @param event_name Unique Event Name
1759 + * @param event_id A universal identifier of the event for analysis etc
1760 + * @param condition The condition indicated by the Fault.
1761 + * @param specific_problem The specific problem triggering the fault.
1762 + * @param priority The priority of the event.
1763 + * @param severity The severity of the Fault.
1764 + * @param ev_source_type Source of Alarm event
1765 + * @param version fault version
1766 + * @param status status of Virtual Function
1767 + * @returns pointer to the newly manufactured ::EVENT_FAULT. If the event is
1768 + * not used (i.e. posted) it must be released using ::evel_free_fault.
1769 + * @retval NULL Failed to create the event.
1770 + *****************************************************************************/
1771 +EVENT_FAULT * evel_new_fault(const char* ev_name, const char *ev_id,
1772 + const char * const condition,
1773 + const char * const specific_problem,
1774 + EVEL_EVENT_PRIORITIES priority,
1775 + EVEL_SEVERITIES severity,
1776 + EVEL_SOURCE_TYPES ev_source_type,
1777 + EVEL_VF_STATUSES status);
1779 +/**************************************************************************//**
1782 + * Free off the Fault supplied. Will free all the contained allocated memory.
1784 + * @note It does not free the Fault itself, since that may be part of a
1785 + * larger structure.
1786 + *****************************************************************************/
1787 +void evel_free_fault(EVENT_FAULT * event);
1789 +/**************************************************************************//**
1790 + * Set the Fault Category property of the Fault.
1792 + * @note The property is treated as immutable: it is only valid to call
1793 + * the setter once. However, we don't assert if the caller tries to
1794 + * overwrite, just ignoring the update instead.
1796 + * @param fault Pointer to the fault.
1797 + * @param category Category : license, link, routing, security, signaling.
1798 + * ASCIIZ string. The caller
1799 + * does not need to preserve the value once the function
1801 + *****************************************************************************/
1802 +void evel_fault_category_set(EVENT_FAULT * fault,
1803 + const char * const category);
1805 +/**************************************************************************//**
1806 + * Set the Alarm Interface A property of the Fault.
1808 + * @note The property is treated as immutable: it is only valid to call
1809 + * the setter once. However, we don't assert if the caller tries to
1810 + * overwrite, just ignoring the update instead.
1812 + * @param fault Pointer to the fault.
1813 + * @param interface The Alarm Interface A to be set. ASCIIZ string. The caller
1814 + * does not need to preserve the value once the function
1816 + *****************************************************************************/
1817 +void evel_fault_interface_set(EVENT_FAULT * fault,
1818 + const char * const interface);
1820 +/**************************************************************************//**
1821 + * Add an additional value name/value pair to the Fault.
1823 + * The name and value are null delimited ASCII strings. The library takes
1824 + * a copy so the caller does not have to preserve values after the function
1827 + * @param fault Pointer to the fault.
1828 + * @param name ASCIIZ string with the attribute's name.
1829 + * @param value ASCIIZ string with the attribute's value.
1830 + *****************************************************************************/
1831 +void evel_fault_addl_info_add(EVENT_FAULT * fault, char * name, char * value);
1833 +/**************************************************************************//**
1834 + * Set the Event Type property of the Fault.
1836 + * @note The property is treated as immutable: it is only valid to call
1837 + * the setter once. However, we don't assert if the caller tries to
1838 + * overwrite, just ignoring the update instead.
1840 + * @param fault Pointer to the fault.
1841 + * @param type The Event Type to be set. ASCIIZ string. The caller
1842 + * does not need to preserve the value once the function
1844 + *****************************************************************************/
1845 +void evel_fault_type_set(EVENT_FAULT * fault, const char * const type);
1847 +/*****************************************************************************/
1848 +/*****************************************************************************/
1852 +/*****************************************************************************/
1853 +/*****************************************************************************/
1855 +/**************************************************************************//**
1856 + * Create a new Measurement event.
1858 + * @note The mandatory fields on the Measurement must be supplied to this
1859 + * factory function and are immutable once set. Optional fields have
1860 + * explicit setter functions, but again values may only be set once so
1861 + * that the Measurement has immutable properties.
1863 + * @param measurement_interval
1864 + * @param event_name Unique Event Name
1865 + * @param event_id A universal identifier of the event for analysis etc
1867 + * @returns pointer to the newly manufactured ::EVENT_MEASUREMENT. If the
1868 + * event is not used (i.e. posted) it must be released using
1869 + * ::evel_free_event.
1870 + * @retval NULL Failed to create the event.
1871 + *****************************************************************************/
1872 +EVENT_MEASUREMENT * evel_new_measurement(double measurement_interval,const char* ev_name, const char *ev_id);
1874 +/**************************************************************************//**
1875 + * Free a Measurement.
1877 + * Free off the Measurement supplied. Will free all the contained allocated
1880 + * @note It does not free the Measurement itself, since that may be part of a
1881 + * larger structure.
1882 + *****************************************************************************/
1883 +void evel_free_measurement(EVENT_MEASUREMENT * event);
1885 +/**************************************************************************//**
1886 + * Set the Event Type property of the Measurement.
1888 + * @note The property is treated as immutable: it is only valid to call
1889 + * the setter once. However, we don't assert if the caller tries to
1890 + * overwrite, just ignoring the update instead.
1892 + * @param measurement Pointer to the Measurement.
1893 + * @param type The Event Type to be set. ASCIIZ string. The caller
1894 + * does not need to preserve the value once the function
1896 + *****************************************************************************/
1897 +void evel_measurement_type_set(EVENT_MEASUREMENT * measurement,
1898 + const char * const type);
1900 +/**************************************************************************//**
1901 + * Set the Concurrent Sessions property of the Measurement.
1903 + * @note The property is treated as immutable: it is only valid to call
1904 + * the setter once. However, we don't assert if the caller tries to
1905 + * overwrite, just ignoring the update instead.
1907 + * @param measurement Pointer to the Measurement.
1908 + * @param concurrent_sessions The Concurrent Sessions to be set.
1909 + *****************************************************************************/
1910 +void evel_measurement_conc_sess_set(EVENT_MEASUREMENT * measurement,
1911 + int concurrent_sessions);
1913 +/**************************************************************************//**
1914 + * Set the Configured Entities property of the Measurement.
1916 + * @note The property is treated as immutable: it is only valid to call
1917 + * the setter once. However, we don't assert if the caller tries to
1918 + * overwrite, just ignoring the update instead.
1920 + * @param measurement Pointer to the Measurement.
1921 + * @param configured_entities The Configured Entities to be set.
1922 + *****************************************************************************/
1923 +void evel_measurement_cfg_ents_set(EVENT_MEASUREMENT * measurement,
1924 + int configured_entities);
1926 +/**************************************************************************//**
1927 + * Add an additional set of Errors to the Measurement.
1929 + * @note The property is treated as immutable: it is only valid to call
1930 + * the setter once. However, we don't assert if the caller tries to
1931 + * overwrite, just ignoring the update instead.
1933 + * @param measurement Pointer to the measurement.
1934 + * @param receive_discards The number of receive discards.
1935 + * @param receive_errors The number of receive errors.
1936 + * @param transmit_discards The number of transmit discards.
1937 + * @param transmit_errors The number of transmit errors.
1938 + *****************************************************************************/
1939 +void evel_measurement_errors_set(EVENT_MEASUREMENT * measurement,
1940 + int receive_discards,
1941 + int receive_errors,
1942 + int transmit_discards,
1943 + int transmit_errors);
1945 +/**************************************************************************//**
1946 + * Set the Mean Request Latency property of the Measurement.
1948 + * @note The property is treated as immutable: it is only valid to call
1949 + * the setter once. However, we don't assert if the caller tries to
1950 + * overwrite, just ignoring the update instead.
1952 + * @param measurement Pointer to the Measurement.
1953 + * @param mean_request_latency The Mean Request Latency to be set.
1954 + *****************************************************************************/
1955 +void evel_measurement_mean_req_lat_set(EVENT_MEASUREMENT * measurement,
1956 + double mean_request_latency);
1958 +/**************************************************************************//**
1959 + * Set the Request Rate property of the Measurement.
1961 + * @note The property is treated as immutable: it is only valid to call
1962 + * the setter once. However, we don't assert if the caller tries to
1963 + * overwrite, just ignoring the update instead.
1965 + * @param measurement Pointer to the Measurement.
1966 + * @param request_rate The Request Rate to be set.
1967 + *****************************************************************************/
1968 +void evel_measurement_request_rate_set(EVENT_MEASUREMENT * measurement,
1969 + int request_rate);
1971 +/**************************************************************************//**
1972 + * Add an additional CPU usage value name/value pair to the Measurement.
1974 + * The name and value are null delimited ASCII strings. The library takes
1975 + * a copy so the caller does not have to preserve values after the function
1978 + * @param measurement Pointer to the measurement.
1979 + * @param id ASCIIZ string with the CPU's identifier.
1980 + * @param usage CPU utilization.
1981 + *****************************************************************************/
1982 +MEASUREMENT_CPU_USE * evel_measurement_new_cpu_use_add(EVENT_MEASUREMENT * measurement, char * id, double usage);
1984 +/**************************************************************************//**
1985 + * Set the CPU Idle value in measurement interval
1986 + * percentage of CPU time spent in the idle task
1988 + * @note The property is treated as immutable: it is only valid to call
1989 + * the setter once. However, we don't assert if the caller tries to
1990 + * overwrite, just ignoring the update instead.
1992 + * @param cpu_use Pointer to the CPU Use.
1993 + * @param val double
1994 + *****************************************************************************/
1995 +void evel_measurement_cpu_use_idle_set(MEASUREMENT_CPU_USE *const cpu_use,
1996 + const double val);
1998 +/**************************************************************************//**
1999 + * Set the percentage of time spent servicing interrupts
2001 + * @note The property is treated as immutable: it is only valid to call
2002 + * the setter once. However, we don't assert if the caller tries to
2003 + * overwrite, just ignoring the update instead.
2005 + * @param cpu_use Pointer to the CPU Use.
2006 + * @param val double
2007 + *****************************************************************************/
2008 +void evel_measurement_cpu_use_interrupt_set(MEASUREMENT_CPU_USE * const cpu_use,
2009 + const double val);
2011 +/**************************************************************************//**
2012 + * Set the percentage of time spent running user space processes that have been niced
2014 + * @note The property is treated as immutable: it is only valid to call
2015 + * the setter once. However, we don't assert if the caller tries to
2016 + * overwrite, just ignoring the update instead.
2018 + * @param cpu_use Pointer to the CPU Use.
2019 + * @param val double
2020 + *****************************************************************************/
2021 +void evel_measurement_cpu_use_nice_set(MEASUREMENT_CPU_USE * const cpu_use,
2022 + const double val);
2024 +/**************************************************************************//**
2025 + * Set the percentage of time spent handling soft irq interrupts
2027 + * @note The property is treated as immutable: it is only valid to call
2028 + * the setter once. However, we don't assert if the caller tries to
2029 + * overwrite, just ignoring the update instead.
2031 + * @param cpu_use Pointer to the CPU Use.
2032 + * @param val double
2033 + *****************************************************************************/
2034 +void evel_measurement_cpu_use_softirq_set(MEASUREMENT_CPU_USE * const cpu_use,
2035 + const double val);
2036 +/**************************************************************************//**
2037 + * Set the percentage of time spent in involuntary wait
2039 + * @note The property is treated as immutable: it is only valid to call
2040 + * the setter once. However, we don't assert if the caller tries to
2041 + * overwrite, just ignoring the update instead.
2043 + * @param cpu_use Pointer to the CPU Use.
2044 + * @param val double
2045 + *****************************************************************************/
2046 +void evel_measurement_cpu_use_steal_set(MEASUREMENT_CPU_USE * const cpu_use,
2047 + const double val);
2048 +/**************************************************************************//**
2049 + * Set the percentage of time spent on system tasks running the kernel
2051 + * @note The property is treated as immutable: it is only valid to call
2052 + * the setter once. However, we don't assert if the caller tries to
2053 + * overwrite, just ignoring the update instead.
2055 + * @param cpu_use Pointer to the CPU Use.
2056 + * @param val double
2057 + *****************************************************************************/
2058 +void evel_measurement_cpu_use_system_set(MEASUREMENT_CPU_USE * const cpu_use,
2059 + const double val);
2060 +/**************************************************************************//**
2061 + * Set the percentage of time spent running un-niced user space processes
2063 + * @note The property is treated as immutable: it is only valid to call
2064 + * the setter once. However, we don't assert if the caller tries to
2065 + * overwrite, just ignoring the update instead.
2067 + * @param cpu_use Pointer to the CPU Use.
2068 + * @param val double
2069 + *****************************************************************************/
2070 +void evel_measurement_cpu_use_usageuser_set(MEASUREMENT_CPU_USE * const cpu_use,
2071 + const double val);
2072 +/**************************************************************************//**
2073 + * Set the percentage of CPU time spent waiting for I/O operations to complete
2075 + * @note The property is treated as immutable: it is only valid to call
2076 + * the setter once. However, we don't assert if the caller tries to
2077 + * overwrite, just ignoring the update instead.
2079 + * @param cpu_use Pointer to the CPU Use.
2080 + * @param val double
2081 + *****************************************************************************/
2082 +void evel_measurement_cpu_use_wait_set(MEASUREMENT_CPU_USE * const cpu_use,
2083 + const double val);
2085 +/**************************************************************************//**
2086 + * Add an additional File System usage value name/value pair to the
2089 + * The filesystem_name is null delimited ASCII string. The library takes a
2090 + * copy so the caller does not have to preserve values after the function
2093 + * @param measurement Pointer to the measurement.
2094 + * @param filesystem_name ASCIIZ string with the file-system's UUID.
2095 + * @param block_configured Block storage configured.
2096 + * @param block_used Block storage in use.
2097 + * @param block_iops Block storage IOPS.
2098 + * @param ephemeral_configured Ephemeral storage configured.
2099 + * @param ephemeral_used Ephemeral storage in use.
2100 + * @param ephemeral_iops Ephemeral storage IOPS.
2101 + *****************************************************************************/
2102 +void evel_measurement_fsys_use_add(EVENT_MEASUREMENT * measurement,
2103 + char * filesystem_name,
2104 + double block_configured,
2105 + double block_used,
2107 + double ephemeral_configured,
2108 + double ephemeral_used,
2109 + int ephemeral_iops);
2111 +/**************************************************************************//**
2112 + * Add a Feature usage value name/value pair to the Measurement.
2114 + * The name is null delimited ASCII string. The library takes
2115 + * a copy so the caller does not have to preserve values after the function
2118 + * @param measurement Pointer to the measurement.
2119 + * @param feature ASCIIZ string with the feature's name.
2120 + * @param utilization Utilization of the feature.
2121 + *****************************************************************************/
2122 +void evel_measurement_feature_use_add(EVENT_MEASUREMENT * measurement,
2126 +/**************************************************************************//**
2127 + * Add a Additional Measurement value name/value pair to the Measurement.
2129 + * The name is null delimited ASCII string. The library takes
2130 + * a copy so the caller does not have to preserve values after the function
2133 + * @param measurement Pointer to the Measurement.
2134 + * @param group ASCIIZ string with the measurement group's name.
2135 + * @param name ASCIIZ string containing the measurement's name.
2136 + * @param name ASCIIZ string containing the measurement's value.
2137 + *****************************************************************************/
2138 +void evel_measurement_custom_measurement_add(EVENT_MEASUREMENT * measurement,
2139 + const char * const group,
2140 + const char * const name,
2141 + const char * const value);
2143 +/**************************************************************************//**
2144 + * Add a Codec usage value name/value pair to the Measurement.
2146 + * The name is null delimited ASCII string. The library takes
2147 + * a copy so the caller does not have to preserve values after the function
2150 + * @param measurement Pointer to the measurement.
2151 + * @param codec ASCIIZ string with the codec's name.
2152 + * @param utilization Utilization of the feature.
2153 + *****************************************************************************/
2154 +void evel_measurement_codec_use_add(EVENT_MEASUREMENT * measurement,
2158 +/**************************************************************************//**
2159 + * Set the Media Ports in Use property of the Measurement.
2161 + * @note The property is treated as immutable: it is only valid to call
2162 + * the setter once. However, we don't assert if the caller tries to
2163 + * overwrite, just ignoring the update instead.
2165 + * @param measurement Pointer to the measurement.
2166 + * @param media_ports_in_use The media port usage to set.
2167 + *****************************************************************************/
2168 +void evel_measurement_media_port_use_set(EVENT_MEASUREMENT * measurement,
2169 + int media_ports_in_use);
2171 +/**************************************************************************//**
2172 + * Set the VNFC Scaling Metric property of the Measurement.
2174 + * @note The property is treated as immutable: it is only valid to call
2175 + * the setter once. However, we don't assert if the caller tries to
2176 + * overwrite, just ignoring the update instead.
2178 + * @param measurement Pointer to the measurement.
2179 + * @param scaling_metric The scaling metric to set.
2180 + *****************************************************************************/
2181 +void evel_measurement_vnfc_scaling_metric_set(EVENT_MEASUREMENT * measurement,
2182 + int scaling_metric);
2184 +/**************************************************************************//**
2185 + * Create a new Latency Bucket to be added to a Measurement event.
2187 + * @note The mandatory fields on the ::MEASUREMENT_LATENCY_BUCKET must be
2188 + * supplied to this factory function and are immutable once set.
2189 + * Optional fields have explicit setter functions, but again values
2190 + * may only be set once so that the ::MEASUREMENT_LATENCY_BUCKET has
2191 + * immutable properties.
2193 + * @param count Count of events in this bucket.
2195 + * @returns pointer to the newly manufactured ::MEASUREMENT_LATENCY_BUCKET.
2196 + * @retval NULL Failed to create the Latency Bucket.
2197 + *****************************************************************************/
2198 +MEASUREMENT_LATENCY_BUCKET * evel_new_meas_latency_bucket(const int count);
2200 +/**************************************************************************//**
2201 + * Set the High End property of the Measurement Latency Bucket.
2203 + * @note The property is treated as immutable: it is only valid to call
2204 + * the setter once. However, we don't assert if the caller tries to
2205 + * overwrite, just ignoring the update instead.
2207 + * @param bucket Pointer to the Measurement Latency Bucket.
2208 + * @param high_end High end of the bucket's range.
2209 + *****************************************************************************/
2210 +void evel_meas_latency_bucket_high_end_set(
2211 + MEASUREMENT_LATENCY_BUCKET * const bucket,
2212 + const double high_end);
2214 +/**************************************************************************//**
2215 + * Set the Low End property of the Measurement Latency Bucket.
2217 + * @note The property is treated as immutable: it is only valid to call
2218 + * the setter once. However, we don't assert if the caller tries to
2219 + * overwrite, just ignoring the update instead.
2221 + * @param bucket Pointer to the Measurement Latency Bucket.
2222 + * @param low_end Low end of the bucket's range.
2223 + *****************************************************************************/
2224 +void evel_meas_latency_bucket_low_end_set(
2225 + MEASUREMENT_LATENCY_BUCKET * const bucket,
2226 + const double low_end);
2228 +/**************************************************************************//**
2229 + * Add an additional Measurement Latency Bucket to the specified event.
2231 + * @param measurement Pointer to the Measurement event.
2232 + * @param bucket Pointer to the Measurement Latency Bucket to add.
2233 + *****************************************************************************/
2234 +void evel_meas_latency_bucket_add(EVENT_MEASUREMENT * const measurement,
2235 + MEASUREMENT_LATENCY_BUCKET * const bucket);
2237 +/**************************************************************************//**
2238 + * Add an additional Latency Distribution bucket to the Measurement.
2240 + * This function implements the previous API, purely for convenience.
2242 + * @param measurement Pointer to the measurement.
2243 + * @param low_end Low end of the bucket's range.
2244 + * @param high_end High end of the bucket's range.
2245 + * @param count Count of events in this bucket.
2246 + *****************************************************************************/
2247 +void evel_measurement_latency_add(EVENT_MEASUREMENT * const measurement,
2248 + const double low_end,
2249 + const double high_end,
2252 +/**************************************************************************//**
2253 + * Create a new vNIC Use to be added to a Measurement event.
2255 + * @note The mandatory fields on the ::MEASUREMENT_VNIC_PERFORMANCE must be supplied
2256 + * to this factory function and are immutable once set. Optional
2257 + * fields have explicit setter functions, but again values may only be
2258 + * set once so that the ::MEASUREMENT_VNIC_PERFORMANCE has immutable
2261 + * @param vnic_id ASCIIZ string with the vNIC's ID.
2262 + * @param val_suspect True or false confidence in data.
2264 + * @returns pointer to the newly manufactured ::MEASUREMENT_VNIC_PERFORMANCE.
2265 + * If the structure is not used it must be released using
2266 + * ::evel_measurement_free_vnic_performance.
2267 + * @retval NULL Failed to create the vNIC Use.
2268 + *****************************************************************************/
2269 +MEASUREMENT_VNIC_PERFORMANCE * evel_measurement_new_vnic_performance(char * const vnic_id, char * const val_suspect);
2271 +/**************************************************************************//**
2272 + * Free a vNIC Use.
2274 + * Free off the ::MEASUREMENT_VNIC_PERFORMANCE supplied. Will free all the contained
2275 + * allocated memory.
2277 + * @note It does not free the vNIC Use itself, since that may be part of a
2278 + * larger structure.
2279 + *****************************************************************************/
2280 +void evel_measurement_free_vnic_performance(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance);
2282 +/**************************************************************************//**
2283 + * Set the Accumulated Broadcast Packets Received in measurement interval
2284 + * property of the vNIC performance.
2286 + * @note The property is treated as immutable: it is only valid to call
2287 + * the setter once. However, we don't assert if the caller tries to
2288 + * overwrite, just ignoring the update instead.
2290 + * @param vnic_performance Pointer to the vNIC Use.
2291 + * @param recvd_bcast_packets_acc
2292 + *****************************************************************************/
2293 +void evel_vnic_performance_rx_bcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2294 + const double recvd_bcast_packets_acc);
2295 +/**************************************************************************//**
2296 + * Set the Delta Broadcast Packets Received in measurement interval
2297 + * property of the vNIC performance.
2299 + * @note The property is treated as immutable: it is only valid to call
2300 + * the setter once. However, we don't assert if the caller tries to
2301 + * overwrite, just ignoring the update instead.
2303 + * @param vnic_performance Pointer to the vNIC Use.
2304 + * @param recvd_bcast_packets_delta
2305 + *****************************************************************************/
2306 +void evel_vnic_performance_rx_bcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2307 + const double recvd_bcast_packets_delta);
2308 +/**************************************************************************//**
2309 + * Set the Discarded Packets Received in measurement interval
2310 + * property of the vNIC performance.
2312 + * @note The property is treated as immutable: it is only valid to call
2313 + * the setter once. However, we don't assert if the caller tries to
2314 + * overwrite, just ignoring the update instead.
2316 + * @param vnic_performance Pointer to the vNIC Use.
2317 + * @param recvd_discard_packets_acc
2318 + *****************************************************************************/
2319 +void evel_vnic_performance_rx_discard_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2320 + const double recvd_discard_packets_acc);
2321 +/**************************************************************************//**
2322 + * Set the Delta Discarded Packets Received in measurement interval
2323 + * property of the vNIC performance.
2325 + * @note The property is treated as immutable: it is only valid to call
2326 + * the setter once. However, we don't assert if the caller tries to
2327 + * overwrite, just ignoring the update instead.
2329 + * @param vnic_performance Pointer to the vNIC Use.
2330 + * @param recvd_discard_packets_delta
2331 + *****************************************************************************/
2332 +void evel_vnic_performance_rx_discard_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2333 + const double recvd_discard_packets_delta);
2334 +/**************************************************************************//**
2335 + * Set the Error Packets Received in measurement interval
2336 + * property of the vNIC performance.
2338 + * @note The property is treated as immutable: it is only valid to call
2339 + * the setter once. However, we don't assert if the caller tries to
2340 + * overwrite, just ignoring the update instead.
2342 + * @param vnic_performance Pointer to the vNIC Use.
2343 + * @param recvd_error_packets_acc
2344 + *****************************************************************************/
2345 +void evel_vnic_performance_rx_error_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2346 + const double recvd_error_packets_acc);
2347 +/**************************************************************************//**
2348 + * Set the Delta Error Packets Received in measurement interval
2349 + * property of the vNIC performance.
2351 + * @note The property is treated as immutable: it is only valid to call
2352 + * the setter once. However, we don't assert if the caller tries to
2353 + * overwrite, just ignoring the update instead.
2355 + * @param vnic_performance Pointer to the vNIC Use.
2356 + * @param recvd_error_packets_delta
2357 + *****************************************************************************/
2358 +void evel_vnic_performance_rx_error_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2359 + const double recvd_error_packets_delta);
2360 +/**************************************************************************//**
2361 + * Set the Accumulated Multicast Packets Received in measurement interval
2362 + * property of the vNIC performance.
2364 + * @note The property is treated as immutable: it is only valid to call
2365 + * the setter once. However, we don't assert if the caller tries to
2366 + * overwrite, just ignoring the update instead.
2368 + * @param vnic_performance Pointer to the vNIC Use.
2369 + * @param recvd_mcast_packets_acc
2370 + *****************************************************************************/
2371 +void evel_vnic_performance_rx_mcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2372 + const double recvd_mcast_packets_acc);
2373 +/**************************************************************************//**
2374 + * Set the Delta Multicast Packets Received in measurement interval
2375 + * property of the vNIC performance.
2377 + * @note The property is treated as immutable: it is only valid to call
2378 + * the setter once. However, we don't assert if the caller tries to
2379 + * overwrite, just ignoring the update instead.
2381 + * @param vnic_performance Pointer to the vNIC Use.
2382 + * @param recvd_mcast_packets_delta
2383 + *****************************************************************************/
2384 +void evel_vnic_performance_rx_mcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2385 + const double recvd_mcast_packets_delta);
2386 +/**************************************************************************//**
2387 + * Set the Accumulated Octets Received in measurement interval
2388 + * property of the vNIC performance.
2390 + * @note The property is treated as immutable: it is only valid to call
2391 + * the setter once. However, we don't assert if the caller tries to
2392 + * overwrite, just ignoring the update instead.
2394 + * @param vnic_performance Pointer to the vNIC Use.
2395 + * @param recvd_octets_acc
2396 + *****************************************************************************/
2397 +void evel_vnic_performance_rx_octets_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2398 + const double recvd_octets_acc);
2399 +/**************************************************************************//**
2400 + * Set the Delta Octets Received in measurement interval
2401 + * property of the vNIC performance.
2403 + * @note The property is treated as immutable: it is only valid to call
2404 + * the setter once. However, we don't assert if the caller tries to
2405 + * overwrite, just ignoring the update instead.
2407 + * @param vnic_performance Pointer to the vNIC Use.
2408 + * @param recvd_octets_delta
2409 + *****************************************************************************/
2410 +void evel_vnic_performance_rx_octets_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2411 + const double recvd_octets_delta);
2412 +/**************************************************************************//**
2413 + * Set the Accumulated Total Packets Received in measurement interval
2414 + * property of the vNIC performance.
2416 + * @note The property is treated as immutable: it is only valid to call
2417 + * the setter once. However, we don't assert if the caller tries to
2418 + * overwrite, just ignoring the update instead.
2420 + * @param vnic_performance Pointer to the vNIC Use.
2421 + * @param recvd_total_packets_acc
2422 + *****************************************************************************/
2423 +void evel_vnic_performance_rx_total_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2424 + const double recvd_total_packets_acc);
2425 +/**************************************************************************//**
2426 + * Set the Delta Total Packets Received in measurement interval
2427 + * property of the vNIC performance.
2429 + * @note The property is treated as immutable: it is only valid to call
2430 + * the setter once. However, we don't assert if the caller tries to
2431 + * overwrite, just ignoring the update instead.
2433 + * @param vnic_performance Pointer to the vNIC Use.
2434 + * @param recvd_total_packets_delta
2435 + *****************************************************************************/
2436 +void evel_vnic_performance_rx_total_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2437 + const double recvd_total_packets_delta);
2438 +/**************************************************************************//**
2439 + * Set the Accumulated Unicast Packets Received in measurement interval
2440 + * property of the vNIC performance.
2442 + * @note The property is treated as immutable: it is only valid to call
2443 + * the setter once. However, we don't assert if the caller tries to
2444 + * overwrite, just ignoring the update instead.
2446 + * @param vnic_performance Pointer to the vNIC Use.
2447 + * @param recvd_ucast_packets_acc
2448 + *****************************************************************************/
2449 +void evel_vnic_performance_rx_ucast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2450 + const double recvd_ucast_packets_acc);
2451 +/**************************************************************************//**
2452 + * Set the Delta Unicast packets Received in measurement interval
2453 + * property of the vNIC performance.
2455 + * @note The property is treated as immutable: it is only valid to call
2456 + * the setter once. However, we don't assert if the caller tries to
2457 + * overwrite, just ignoring the update instead.
2459 + * @param vnic_performance Pointer to the vNIC Use.
2460 + * @param recvd_ucast_packets_delta
2461 + *****************************************************************************/
2462 +void evel_vnic_performance_rx_ucast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2463 + const double recvd_ucast_packets_delta);
2464 +/**************************************************************************//**
2465 + * Set the Transmitted Broadcast Packets in measurement interval
2466 + * property of the vNIC performance.
2468 + * @note The property is treated as immutable: it is only valid to call
2469 + * the setter once. However, we don't assert if the caller tries to
2470 + * overwrite, just ignoring the update instead.
2472 + * @param vnic_performance Pointer to the vNIC Use.
2473 + * @param tx_bcast_packets_acc
2474 + *****************************************************************************/
2475 +void evel_vnic_performance_tx_bcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2476 + const double tx_bcast_packets_acc);
2477 +/**************************************************************************//**
2478 + * Set the Delta Broadcast packets Transmitted in measurement interval
2479 + * property of the vNIC performance.
2481 + * @note The property is treated as immutable: it is only valid to call
2482 + * the setter once. However, we don't assert if the caller tries to
2483 + * overwrite, just ignoring the update instead.
2485 + * @param vnic_performance Pointer to the vNIC Use.
2486 + * @param tx_bcast_packets_delta
2487 + *****************************************************************************/
2488 +void evel_vnic_performance_tx_bcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2489 + const double tx_bcast_packets_delta);
2490 +/**************************************************************************//**
2491 + * Set the Transmitted Discarded Packets in measurement interval
2492 + * property of the vNIC performance.
2494 + * @note The property is treated as immutable: it is only valid to call
2495 + * the setter once. However, we don't assert if the caller tries to
2496 + * overwrite, just ignoring the update instead.
2498 + * @param vnic_performance Pointer to the vNIC Use.
2499 + * @param tx_discarded_packets_acc
2500 + *****************************************************************************/
2501 +void evel_vnic_performance_tx_discarded_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2502 + const double tx_discarded_packets_acc);
2503 +/**************************************************************************//**
2504 + * Set the Delta Discarded packets Transmitted in measurement interval
2505 + * property of the vNIC performance.
2507 + * @note The property is treated as immutable: it is only valid to call
2508 + * the setter once. However, we don't assert if the caller tries to
2509 + * overwrite, just ignoring the update instead.
2511 + * @param vnic_performance Pointer to the vNIC Use.
2512 + * @param tx_discarded_packets_delta
2513 + *****************************************************************************/
2514 +void evel_vnic_performance_tx_discarded_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2515 + const double tx_discarded_packets_delta);
2516 +/**************************************************************************//**
2517 + * Set the Transmitted Errored Packets in measurement interval
2518 + * property of the vNIC performance.
2520 + * @note The property is treated as immutable: it is only valid to call
2521 + * the setter once. However, we don't assert if the caller tries to
2522 + * overwrite, just ignoring the update instead.
2524 + * @param vnic_performance Pointer to the vNIC Use.
2525 + * @param tx_error_packets_acc
2526 + *****************************************************************************/
2527 +void evel_vnic_performance_tx_error_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2528 + const double tx_error_packets_acc);
2529 +/**************************************************************************//**
2530 + * Set the Delta Errored packets Transmitted in measurement interval
2531 + * property of the vNIC performance.
2533 + * @note The property is treated as immutable: it is only valid to call
2534 + * the setter once. However, we don't assert if the caller tries to
2535 + * overwrite, just ignoring the update instead.
2537 + * @param vnic_performance Pointer to the vNIC Use.
2538 + * @param tx_error_packets_delta
2539 + *****************************************************************************/
2540 +void evel_vnic_performance_tx_error_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2541 + const double tx_error_packets_delta);
2542 +/**************************************************************************//**
2543 + * Set the Transmitted Multicast Packets in measurement interval
2544 + * property of the vNIC performance.
2546 + * @note The property is treated as immutable: it is only valid to call
2547 + * the setter once. However, we don't assert if the caller tries to
2548 + * overwrite, just ignoring the update instead.
2550 + * @param vnic_performance Pointer to the vNIC Use.
2551 + * @param tx_mcast_packets_acc
2552 + *****************************************************************************/
2553 +void evel_vnic_performance_tx_mcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2554 + const double tx_mcast_packets_acc);
2555 +/**************************************************************************//**
2556 + * Set the Delta Multicast packets Transmitted in measurement interval
2557 + * property of the vNIC performance.
2559 + * @note The property is treated as immutable: it is only valid to call
2560 + * the setter once. However, we don't assert if the caller tries to
2561 + * overwrite, just ignoring the update instead.
2563 + * @param vnic_performance Pointer to the vNIC Use.
2564 + * @param tx_mcast_packets_delta
2565 + *****************************************************************************/
2566 +void evel_vnic_performance_tx_mcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2567 + const double tx_mcast_packets_delta);
2568 +/**************************************************************************//**
2569 + * Set the Transmitted Octets in measurement interval
2570 + * property of the vNIC performance.
2572 + * @note The property is treated as immutable: it is only valid to call
2573 + * the setter once. However, we don't assert if the caller tries to
2574 + * overwrite, just ignoring the update instead.
2576 + * @param vnic_performance Pointer to the vNIC Use.
2577 + * @param tx_octets_acc
2578 + *****************************************************************************/
2579 +void evel_vnic_performance_tx_octets_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2580 + const double tx_octets_acc);
2581 +/**************************************************************************//**
2582 + * Set the Delta Octets Transmitted in measurement interval
2583 + * property of the vNIC performance.
2585 + * @note The property is treated as immutable: it is only valid to call
2586 + * the setter once. However, we don't assert if the caller tries to
2587 + * overwrite, just ignoring the update instead.
2589 + * @param vnic_performance Pointer to the vNIC Use.
2590 + * @param tx_octets_delta
2591 + *****************************************************************************/
2592 +void evel_vnic_performance_tx_octets_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2593 + const double tx_octets_delta);
2594 +/**************************************************************************//**
2595 + * Set the Transmitted Total Packets in measurement interval
2596 + * property of the vNIC performance.
2598 + * @note The property is treated as immutable: it is only valid to call
2599 + * the setter once. However, we don't assert if the caller tries to
2600 + * overwrite, just ignoring the update instead.
2602 + * @param vnic_performance Pointer to the vNIC Use.
2603 + * @param tx_total_packets_acc
2604 + *****************************************************************************/
2605 +void evel_vnic_performance_tx_total_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2606 + const double tx_total_packets_acc);
2607 +/**************************************************************************//**
2608 + * Set the Delta Total Packets Transmitted in measurement interval
2609 + * property of the vNIC performance.
2611 + * @note The property is treated as immutable: it is only valid to call
2612 + * the setter once. However, we don't assert if the caller tries to
2613 + * overwrite, just ignoring the update instead.
2615 + * @param vnic_performance Pointer to the vNIC Use.
2616 + * @param tx_total_packets_delta
2617 + *****************************************************************************/
2618 +void evel_vnic_performance_tx_total_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2619 + const double tx_total_packets_delta);
2620 +/**************************************************************************//**
2621 + * Set the Transmitted Unicast Packets in measurement interval
2622 + * property of the vNIC performance.
2624 + * @note The property is treated as immutable: it is only valid to call
2625 + * the setter once. However, we don't assert if the caller tries to
2626 + * overwrite, just ignoring the update instead.
2628 + * @param vnic_performance Pointer to the vNIC Use.
2629 + * @param tx_ucast_packets_acc
2630 + *****************************************************************************/
2631 +void evel_vnic_performance_tx_ucast_packets_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2632 + const double tx_ucast_packets_acc);
2633 +/**************************************************************************//**
2634 + * Set the Delta Octets Transmitted in measurement interval
2635 + * property of the vNIC performance.
2637 + * @note The property is treated as immutable: it is only valid to call
2638 + * the setter once. However, we don't assert if the caller tries to
2639 + * overwrite, just ignoring the update instead.
2641 + * @param vnic_performance Pointer to the vNIC Use.
2642 + * @param tx_ucast_packets_delta
2643 + *****************************************************************************/
2644 +void evel_vnic_performance_tx_ucast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2645 + const double tx_ucast_packets_delta);
2647 +/**************************************************************************//**
2648 + * Add an additional vNIC Use to the specified Measurement event.
2650 + * @param measurement Pointer to the measurement.
2651 + * @param vnic_performance Pointer to the vNIC Use to add.
2652 + *****************************************************************************/
2653 +void evel_meas_vnic_performance_add(EVENT_MEASUREMENT * const measurement,
2654 + MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance);
2656 +/**************************************************************************//**
2657 + * Add an additional vNIC usage record Measurement.
2659 + * This function implements the previous API, purely for convenience.
2661 + * The ID is null delimited ASCII string. The library takes a copy so the
2662 + * caller does not have to preserve values after the function returns.
2664 + * @param measurement Pointer to the measurement.
2665 + * @param vnic_id ASCIIZ string with the vNIC's ID.
2666 + * @param valset true or false confidence level
2667 + * @param recvd_bcast_packets_acc Recieved broadcast packets
2668 + * @param recvd_bcast_packets_delta Received delta broadcast packets
2669 + * @param recvd_discarded_packets_acc Recieved discarded packets
2670 + * @param recvd_discarded_packets_delta Received discarded delta packets
2671 + * @param recvd_error_packets_acc Received error packets
2672 + * @param recvd_error_packets_delta, Received delta error packets
2673 + * @param recvd_mcast_packets_acc Received multicast packets
2674 + * @param recvd_mcast_packets_delta Received delta multicast packets
2675 + * @param recvd_octets_acc Received octets
2676 + * @param recvd_octets_delta Received delta octets
2677 + * @param recvd_total_packets_acc Received total packets
2678 + * @param recvd_total_packets_delta Received delta total packets
2679 + * @param recvd_ucast_packets_acc Received Unicast packets
2680 + * @param recvd_ucast_packets_delta Received delta unicast packets
2681 + * @param tx_bcast_packets_acc Transmitted broadcast packets
2682 + * @param tx_bcast_packets_delta Transmitted delta broadcast packets
2683 + * @param tx_discarded_packets_acc Transmitted packets discarded
2684 + * @param tx_discarded_packets_delta Transmitted delta discarded packets
2685 + * @param tx_error_packets_acc Transmitted error packets
2686 + * @param tx_error_packets_delta Transmitted delta error packets
2687 + * @param tx_mcast_packets_acc Transmitted multicast packets accumulated
2688 + * @param tx_mcast_packets_delta Transmitted delta multicast packets
2689 + * @param tx_octets_acc Transmitted octets
2690 + * @param tx_octets_delta Transmitted delta octets
2691 + * @param tx_total_packets_acc Transmitted total packets
2692 + * @param tx_total_packets_delta Transmitted delta total packets
2693 + * @param tx_ucast_packets_acc Transmitted Unicast packets
2694 + * @param tx_ucast_packets_delta Transmitted delta Unicast packets
2695 + *****************************************************************************/
2696 +void evel_measurement_vnic_performance_add(EVENT_MEASUREMENT * const measurement,
2697 + char * const vnic_id,
2699 + double recvd_bcast_packets_acc,
2700 + double recvd_bcast_packets_delta,
2701 + double recvd_discarded_packets_acc,
2702 + double recvd_discarded_packets_delta,
2703 + double recvd_error_packets_acc,
2704 + double recvd_error_packets_delta,
2705 + double recvd_mcast_packets_acc,
2706 + double recvd_mcast_packets_delta,
2707 + double recvd_octets_acc,
2708 + double recvd_octets_delta,
2709 + double recvd_total_packets_acc,
2710 + double recvd_total_packets_delta,
2711 + double recvd_ucast_packets_acc,
2712 + double recvd_ucast_packets_delta,
2713 + double tx_bcast_packets_acc,
2714 + double tx_bcast_packets_delta,
2715 + double tx_discarded_packets_acc,
2716 + double tx_discarded_packets_delta,
2717 + double tx_error_packets_acc,
2718 + double tx_error_packets_delta,
2719 + double tx_mcast_packets_acc,
2720 + double tx_mcast_packets_delta,
2721 + double tx_octets_acc,
2722 + double tx_octets_delta,
2723 + double tx_total_packets_acc,
2724 + double tx_total_packets_delta,
2725 + double tx_ucast_packets_acc,
2726 + double tx_ucast_packets_delta);
2728 +/*****************************************************************************/
2729 +/*****************************************************************************/
2733 +/*****************************************************************************/
2734 +/*****************************************************************************/
2736 +/**************************************************************************//**
2737 + * Create a new Report event.
2739 + * @note The mandatory fields on the Report must be supplied to this
2740 + * factory function and are immutable once set. Optional fields have
2741 + * explicit setter functions, but again values may only be set once so
2742 + * that the Report has immutable properties.
2744 + * @param measurement_interval
2745 + * @param event_name Unique Event Name
2746 + * @param event_id A universal identifier of the event for analysis etc
2748 + * @returns pointer to the newly manufactured ::EVENT_REPORT. If the event is
2749 + * not used (i.e. posted) it must be released using
2750 + * ::evel_free_report.
2751 + * @retval NULL Failed to create the event.
2752 + *****************************************************************************/
2753 +EVENT_REPORT * evel_new_report(double measurement_interval,const char* ev_name, const char *ev_id);
2755 +/**************************************************************************//**
2758 + * Free off the Report supplied. Will free all the contained allocated memory.
2760 + * @note It does not free the Report itself, since that may be part of a
2761 + * larger structure.
2762 + *****************************************************************************/
2763 +void evel_free_report(EVENT_REPORT * event);
2765 +/**************************************************************************//**
2766 + * Set the Event Type property of the Report.
2768 + * @note The property is treated as immutable: it is only valid to call
2769 + * the setter once. However, we don't assert if the caller tries to
2770 + * overwrite, just ignoring the update instead.
2772 + * @param report Pointer to the Report.
2773 + * @param type The Event Type to be set. ASCIIZ string. The caller
2774 + * does not need to preserve the value once the function
2776 + *****************************************************************************/
2777 +void evel_report_type_set(EVENT_REPORT * report, const char * const type);
2779 +/**************************************************************************//**
2780 + * Add a Feature usage value name/value pair to the Report.
2782 + * The name is null delimited ASCII string. The library takes
2783 + * a copy so the caller does not have to preserve values after the function
2786 + * @param report Pointer to the report.
2787 + * @param feature ASCIIZ string with the feature's name.
2788 + * @param utilization Utilization of the feature.
2789 + *****************************************************************************/
2790 +void evel_report_feature_use_add(EVENT_REPORT * report,
2794 +/**************************************************************************//**
2795 + * Add a Additional Measurement value name/value pair to the Report.
2797 + * The name is null delimited ASCII string. The library takes
2798 + * a copy so the caller does not have to preserve values after the function
2801 + * @param report Pointer to the report.
2802 + * @param group ASCIIZ string with the measurement group's name.
2803 + * @param name ASCIIZ string containing the measurement's name.
2804 + * @param value ASCIIZ string containing the measurement's value.
2805 + *****************************************************************************/
2806 +void evel_report_custom_measurement_add(EVENT_REPORT * report,
2807 + const char * const group,
2808 + const char * const name,
2809 + const char * const value);
2811 +/*****************************************************************************/
2812 +/*****************************************************************************/
2816 +/*****************************************************************************/
2817 +/*****************************************************************************/
2819 +/**************************************************************************//**
2820 + * Create a new Mobile Flow event.
2822 + * @note The mandatory fields on the Mobile Flow must be supplied to this
2823 + * factory function and are immutable once set. Optional fields have
2824 + * explicit setter functions, but again values may only be set once so
2825 + * that the Mobile Flow has immutable properties.
2827 + * @param event_name Unique Event Name
2828 + * @param event_id A universal identifier of the event for analysis etc
2829 + * @param flow_direction
2830 + * @param gtp_per_flow_metrics
2831 + * @param ip_protocol_type
2832 + * @param ip_version
2833 + * @param other_endpoint_ip_address
2834 + * @param other_endpoint_port
2835 + * @param reporting_endpoint_ip_addr
2836 + * @param reporting_endpoint_port
2838 + * @returns pointer to the newly manufactured ::EVENT_MOBILE_FLOW. If the
2839 + * event is not used (i.e. posted) it must be released using
2840 + * ::evel_free_mobile_flow.
2841 + * @retval NULL Failed to create the event.
2842 + *****************************************************************************/
2843 +EVENT_MOBILE_FLOW * evel_new_mobile_flow(
2844 + const char* ev_name, const char *ev_id,
2845 + const char * const flow_direction,
2846 + MOBILE_GTP_PER_FLOW_METRICS * gtp_per_flow_metrics,
2847 + const char * const ip_protocol_type,
2848 + const char * const ip_version,
2849 + const char * const other_endpoint_ip_address,
2850 + int other_endpoint_port,
2851 + const char * const reporting_endpoint_ip_addr,
2852 + int reporting_endpoint_port);
2854 +/**************************************************************************//**
2855 + * Free a Mobile Flow.
2857 + * Free off the Mobile Flow supplied. Will free all the contained allocated
2860 + * @note It does not free the Mobile Flow itself, since that may be part of a
2861 + * larger structure.
2862 + *****************************************************************************/
2863 +void evel_free_mobile_flow(EVENT_MOBILE_FLOW * event);
2865 +/**************************************************************************//**
2866 + * Set the Event Type property of the Mobile Flow.
2868 + * @note The property is treated as immutable: it is only valid to call
2869 + * the setter once. However, we don't assert if the caller tries to
2870 + * overwrite, just ignoring the update instead.
2872 + * @param mobile_flow Pointer to the Mobile Flow.
2873 + * @param type The Event Type to be set. ASCIIZ string. The caller
2874 + * does not need to preserve the value once the function
2876 + *****************************************************************************/
2877 +void evel_mobile_flow_type_set(EVENT_MOBILE_FLOW * mobile_flow,
2878 + const char * const type);
2880 +/**************************************************************************//**
2881 + * Set the Application Type property of the Mobile Flow.
2883 + * @note The property is treated as immutable: it is only valid to call
2884 + * the setter once. However, we don't assert if the caller tries to
2885 + * overwrite, just ignoring the update instead.
2887 + * @param mobile_flow Pointer to the Mobile Flow.
2888 + * @param type The Application Type to be set. ASCIIZ string. The caller
2889 + * does not need to preserve the value once the function
2891 + *****************************************************************************/
2892 +void evel_mobile_flow_app_type_set(EVENT_MOBILE_FLOW * mobile_flow,
2893 + const char * const type);
2895 +/**************************************************************************//**
2896 + * Set the Application Protocol Type property of the Mobile Flow.
2898 + * @note The property is treated as immutable: it is only valid to call
2899 + * the setter once. However, we don't assert if the caller tries to
2900 + * overwrite, just ignoring the update instead.
2902 + * @param mobile_flow Pointer to the Mobile Flow.
2903 + * @param type The Application Protocol Type to be set. ASCIIZ string.
2904 + * The caller does not need to preserve the value once the
2905 + * function returns.
2906 + *****************************************************************************/
2907 +void evel_mobile_flow_app_prot_type_set(EVENT_MOBILE_FLOW * mobile_flow,
2908 + const char * const type);
2910 +/**************************************************************************//**
2911 + * Set the Application Protocol Version property of the Mobile Flow.
2913 + * @note The property is treated as immutable: it is only valid to call
2914 + * the setter once. However, we don't assert if the caller tries to
2915 + * overwrite, just ignoring the update instead.
2917 + * @param mobile_flow Pointer to the Mobile Flow.
2918 + * @param version The Application Protocol Version to be set. ASCIIZ
2919 + * string. The caller does not need to preserve the value
2920 + * once the function returns.
2921 + *****************************************************************************/
2922 +void evel_mobile_flow_app_prot_ver_set(EVENT_MOBILE_FLOW * mobile_flow,
2923 + const char * const version);
2925 +/**************************************************************************//**
2926 + * Set the CID property of the Mobile Flow.
2928 + * @note The property is treated as immutable: it is only valid to call
2929 + * the setter once. However, we don't assert if the caller tries to
2930 + * overwrite, just ignoring the update instead.
2932 + * @param mobile_flow Pointer to the Mobile Flow.
2933 + * @param cid The CID to be set. ASCIIZ string. The caller does not
2934 + * need to preserve the value once the function returns.
2935 + *****************************************************************************/
2936 +void evel_mobile_flow_cid_set(EVENT_MOBILE_FLOW * mobile_flow,
2937 + const char * const cid);
2939 +/**************************************************************************//**
2940 + * Set the Connection Type property of the Mobile Flow.
2942 + * @note The property is treated as immutable: it is only valid to call
2943 + * the setter once. However, we don't assert if the caller tries to
2944 + * overwrite, just ignoring the update instead.
2946 + * @param mobile_flow Pointer to the Mobile Flow.
2947 + * @param type The Connection Type to be set. ASCIIZ string. The caller
2948 + * does not need to preserve the value once the function
2950 + *****************************************************************************/
2951 +void evel_mobile_flow_con_type_set(EVENT_MOBILE_FLOW * mobile_flow,
2952 + const char * const type);
2954 +/**************************************************************************//**
2955 + * Set the ECGI property of the Mobile Flow.
2957 + * @note The property is treated as immutable: it is only valid to call
2958 + * the setter once. However, we don't assert if the caller tries to
2959 + * overwrite, just ignoring the update instead.
2961 + * @param mobile_flow Pointer to the Mobile Flow.
2962 + * @param ecgi The ECGI to be set. ASCIIZ string. The caller does not
2963 + * need to preserve the value once the function returns.
2964 + *****************************************************************************/
2965 +void evel_mobile_flow_ecgi_set(EVENT_MOBILE_FLOW * mobile_flow,
2966 + const char * const ecgi);
2968 +/**************************************************************************//**
2969 + * Set the GTP Protocol Type property of the Mobile Flow.
2971 + * @note The property is treated as immutable: it is only valid to call
2972 + * the setter once. However, we don't assert if the caller tries to
2973 + * overwrite, just ignoring the update instead.
2975 + * @param mobile_flow Pointer to the Mobile Flow.
2976 + * @param type The GTP Protocol Type to be set. ASCIIZ string. The
2977 + * caller does not need to preserve the value once the
2978 + * function returns.
2979 + *****************************************************************************/
2980 +void evel_mobile_flow_gtp_prot_type_set(EVENT_MOBILE_FLOW * mobile_flow,
2981 + const char * const type);
2983 +/**************************************************************************//**
2984 + * Set the GTP Protocol Version property of the Mobile Flow.
2986 + * @note The property is treated as immutable: it is only valid to call
2987 + * the setter once. However, we don't assert if the caller tries to
2988 + * overwrite, just ignoring the update instead.
2990 + * @param mobile_flow Pointer to the Mobile Flow.
2991 + * @param version The GTP Protocol Version to be set. ASCIIZ string. The
2992 + * caller does not need to preserve the value once the
2993 + * function returns.
2994 + *****************************************************************************/
2995 +void evel_mobile_flow_gtp_prot_ver_set(EVENT_MOBILE_FLOW * mobile_flow,
2996 + const char * const version);
2998 +/**************************************************************************//**
2999 + * Set the HTTP Header property of the Mobile Flow.
3001 + * @note The property is treated as immutable: it is only valid to call
3002 + * the setter once. However, we don't assert if the caller tries to
3003 + * overwrite, just ignoring the update instead.
3005 + * @param mobile_flow Pointer to the Mobile Flow.
3006 + * @param header The HTTP header to be set. ASCIIZ string. The caller does
3007 + * not need to preserve the value once the function returns.
3008 + *****************************************************************************/
3009 +void evel_mobile_flow_http_header_set(EVENT_MOBILE_FLOW * mobile_flow,
3010 + const char * const header);
3012 +/**************************************************************************//**
3013 + * Set the IMEI property of the Mobile Flow.
3015 + * @note The property is treated as immutable: it is only valid to call
3016 + * the setter once. However, we don't assert if the caller tries to
3017 + * overwrite, just ignoring the update instead.
3019 + * @param mobile_flow Pointer to the Mobile Flow.
3020 + * @param imei The IMEI to be set. ASCIIZ string. The caller does not
3021 + * need to preserve the value once the function returns.
3022 + *****************************************************************************/
3023 +void evel_mobile_flow_imei_set(EVENT_MOBILE_FLOW * mobile_flow,
3024 + const char * const imei);
3026 +/**************************************************************************//**
3027 + * Set the IMSI property of the Mobile Flow.
3029 + * @note The property is treated as immutable: it is only valid to call
3030 + * the setter once. However, we don't assert if the caller tries to
3031 + * overwrite, just ignoring the update instead.
3033 + * @param mobile_flow Pointer to the Mobile Flow.
3034 + * @param imsi The IMSI to be set. ASCIIZ string. The caller does not
3035 + * need to preserve the value once the function returns.
3036 + *****************************************************************************/
3037 +void evel_mobile_flow_imsi_set(EVENT_MOBILE_FLOW * mobile_flow,
3038 + const char * const imsi);
3040 +/**************************************************************************//**
3041 + * Set the LAC property of the Mobile Flow.
3043 + * @note The property is treated as immutable: it is only valid to call
3044 + * the setter once. However, we don't assert if the caller tries to
3045 + * overwrite, just ignoring the update instead.
3047 + * @param mobile_flow Pointer to the Mobile Flow.
3048 + * @param lac The LAC to be set. ASCIIZ string. The caller does not
3049 + * need to preserve the value once the function returns.
3050 + *****************************************************************************/
3051 +void evel_mobile_flow_lac_set(EVENT_MOBILE_FLOW * mobile_flow,
3052 + const char * const lac);
3054 +/**************************************************************************//**
3055 + * Set the MCC property of the Mobile Flow.
3057 + * @note The property is treated as immutable: it is only valid to call
3058 + * the setter once. However, we don't assert if the caller tries to
3059 + * overwrite, just ignoring the update instead.
3061 + * @param mobile_flow Pointer to the Mobile Flow.
3062 + * @param mcc The MCC to be set. ASCIIZ string. The caller does not
3063 + * need to preserve the value once the function returns.
3064 + *****************************************************************************/
3065 +void evel_mobile_flow_mcc_set(EVENT_MOBILE_FLOW * mobile_flow,
3066 + const char * const mcc);
3068 +/**************************************************************************//**
3069 + * Set the MNC property of the Mobile Flow.
3071 + * @note The property is treated as immutable: it is only valid to call
3072 + * the setter once. However, we don't assert if the caller tries to
3073 + * overwrite, just ignoring the update instead.
3075 + * @param mobile_flow Pointer to the Mobile Flow.
3076 + * @param mnc The MNC to be set. ASCIIZ string. The caller does not
3077 + * need to preserve the value once the function returns.
3078 + *****************************************************************************/
3079 +void evel_mobile_flow_mnc_set(EVENT_MOBILE_FLOW * mobile_flow,
3080 + const char * const mnc);
3082 +/**************************************************************************//**
3083 + * Set the MSISDN property of the Mobile Flow.
3085 + * @note The property is treated as immutable: it is only valid to call
3086 + * the setter once. However, we don't assert if the caller tries to
3087 + * overwrite, just ignoring the update instead.
3089 + * @param mobile_flow Pointer to the Mobile Flow.
3090 + * @param msisdn The MSISDN to be set. ASCIIZ string. The caller does not
3091 + * need to preserve the value once the function returns.
3092 + *****************************************************************************/
3093 +void evel_mobile_flow_msisdn_set(EVENT_MOBILE_FLOW * mobile_flow,
3094 + const char * const msisdn);
3096 +/**************************************************************************//**
3097 + * Set the Other Functional Role property of the Mobile Flow.
3099 + * @note The property is treated as immutable: it is only valid to call
3100 + * the setter once. However, we don't assert if the caller tries to
3101 + * overwrite, just ignoring the update instead.
3103 + * @param mobile_flow Pointer to the Mobile Flow.
3104 + * @param role The Other Functional Role to be set. ASCIIZ string. The
3105 + * caller does not need to preserve the value once the
3106 + * function returns.
3107 + *****************************************************************************/
3108 +void evel_mobile_flow_other_func_role_set(EVENT_MOBILE_FLOW * mobile_flow,
3109 + const char * const role);
3111 +/**************************************************************************//**
3112 + * Set the RAC property of the Mobile Flow.
3114 + * @note The property is treated as immutable: it is only valid to call
3115 + * the setter once. However, we don't assert if the caller tries to
3116 + * overwrite, just ignoring the update instead.
3118 + * @param mobile_flow Pointer to the Mobile Flow.
3119 + * @param rac The RAC to be set. ASCIIZ string. The caller does not
3120 + * need to preserve the value once the function returns.
3121 + *****************************************************************************/
3122 +void evel_mobile_flow_rac_set(EVENT_MOBILE_FLOW * mobile_flow,
3123 + const char * const rac);
3125 +/**************************************************************************//**
3126 + * Set the Radio Access Technology property of the Mobile Flow.
3128 + * @note The property is treated as immutable: it is only valid to call
3129 + * the setter once. However, we don't assert if the caller tries to
3130 + * overwrite, just ignoring the update instead.
3132 + * @param mobile_flow Pointer to the Mobile Flow.
3133 + * @param tech The Radio Access Technology to be set. ASCIIZ string. The
3134 + * caller does not need to preserve the value once the
3135 + * function returns.
3136 + *****************************************************************************/
3137 +void evel_mobile_flow_radio_acc_tech_set(EVENT_MOBILE_FLOW * mobile_flow,
3138 + const char * const tech);
3140 +/**************************************************************************//**
3141 + * Set the SAC property of the Mobile Flow.
3143 + * @note The property is treated as immutable: it is only valid to call
3144 + * the setter once. However, we don't assert if the caller tries to
3145 + * overwrite, just ignoring the update instead.
3147 + * @param mobile_flow Pointer to the Mobile Flow.
3148 + * @param sac The SAC to be set. ASCIIZ string. The caller does not
3149 + * need to preserve the value once the function returns.
3150 + *****************************************************************************/
3151 +void evel_mobile_flow_sac_set(EVENT_MOBILE_FLOW * mobile_flow,
3152 + const char * const sac);
3154 +/**************************************************************************//**
3155 + * Set the Sampling Algorithm property of the Mobile Flow.
3157 + * @note The property is treated as immutable: it is only valid to call
3158 + * the setter once. However, we don't assert if the caller tries to
3159 + * overwrite, just ignoring the update instead.
3161 + * @param mobile_flow Pointer to the Mobile Flow.
3162 + * @param algorithm The Sampling Algorithm to be set.
3163 + *****************************************************************************/
3164 +void evel_mobile_flow_samp_alg_set(EVENT_MOBILE_FLOW * mobile_flow,
3167 +/**************************************************************************//**
3168 + * Set the TAC property of the Mobile Flow.
3170 + * @note The property is treated as immutable: it is only valid to call
3171 + * the setter once. However, we don't assert if the caller tries to
3172 + * overwrite, just ignoring the update instead.
3174 + * @param mobile_flow Pointer to the Mobile Flow.
3175 + * @param tac The TAC to be set. ASCIIZ string. The caller does not
3176 + * need to preserve the value once the function returns.
3177 + *****************************************************************************/
3178 +void evel_mobile_flow_tac_set(EVENT_MOBILE_FLOW * mobile_flow,
3179 + const char * const tac);
3181 +/**************************************************************************//**
3182 + * Set the Tunnel ID property of the Mobile Flow.
3184 + * @note The property is treated as immutable: it is only valid to call
3185 + * the setter once. However, we don't assert if the caller tries to
3186 + * overwrite, just ignoring the update instead.
3188 + * @param mobile_flow Pointer to the Mobile Flow.
3189 + * @param tunnel_id The Tunnel ID to be set. ASCIIZ string. The caller does
3190 + * not need to preserve the value once the function returns.
3191 + *****************************************************************************/
3192 +void evel_mobile_flow_tunnel_id_set(EVENT_MOBILE_FLOW * mobile_flow,
3193 + const char * const tunnel_id);
3195 +/**************************************************************************//**
3196 + * Set the VLAN ID property of the Mobile Flow.
3198 + * @note The property is treated as immutable: it is only valid to call
3199 + * the setter once. However, we don't assert if the caller tries to
3200 + * overwrite, just ignoring the update instead.
3202 + * @param mobile_flow Pointer to the Mobile Flow.
3203 + * @param vlan_id The VLAN ID to be set. ASCIIZ string. The caller does
3204 + * not need to preserve the value once the function returns.
3205 + *****************************************************************************/
3206 +void evel_mobile_flow_vlan_id_set(EVENT_MOBILE_FLOW * mobile_flow,
3207 + const char * const vlan_id);
3209 +/**************************************************************************//**
3210 + * Create a new Mobile GTP Per Flow Metrics.
3212 + * @note The mandatory fields on the Mobile GTP Per Flow Metrics must be
3213 + * supplied to this factory function and are immutable once set.
3214 + * Optional fields have explicit setter functions, but again values
3215 + * may only be set once so that the Mobile GTP Per Flow Metrics has
3216 + * immutable properties.
3218 + * @param avg_bit_error_rate
3219 + * @param avg_packet_delay_variation
3220 + * @param avg_packet_latency
3221 + * @param avg_receive_throughput
3222 + * @param avg_transmit_throughput
3223 + * @param flow_activation_epoch
3224 + * @param flow_activation_microsec
3225 + * @param flow_deactivation_epoch
3226 + * @param flow_deactivation_microsec
3227 + * @param flow_deactivation_time
3228 + * @param flow_status
3229 + * @param max_packet_delay_variation
3230 + * @param num_activation_failures
3231 + * @param num_bit_errors
3232 + * @param num_bytes_received
3233 + * @param num_bytes_transmitted
3234 + * @param num_dropped_packets
3235 + * @param num_l7_bytes_received
3236 + * @param num_l7_bytes_transmitted
3237 + * @param num_lost_packets
3238 + * @param num_out_of_order_packets
3239 + * @param num_packet_errors
3240 + * @param num_packets_received_excl_retrans
3241 + * @param num_packets_received_incl_retrans
3242 + * @param num_packets_transmitted_incl_retrans
3243 + * @param num_retries
3244 + * @param num_timeouts
3245 + * @param num_tunneled_l7_bytes_received
3246 + * @param round_trip_time
3247 + * @param time_to_first_byte
3249 + * @returns pointer to the newly manufactured ::MOBILE_GTP_PER_FLOW_METRICS.
3250 + * If the structure is not used it must be released using
3251 + * ::evel_free_mobile_gtp_flow_metrics.
3252 + * @retval NULL Failed to create the event.
3253 + *****************************************************************************/
3254 +MOBILE_GTP_PER_FLOW_METRICS * evel_new_mobile_gtp_flow_metrics(
3255 + double avg_bit_error_rate,
3256 + double avg_packet_delay_variation,
3257 + int avg_packet_latency,
3258 + int avg_receive_throughput,
3259 + int avg_transmit_throughput,
3260 + int flow_activation_epoch,
3261 + int flow_activation_microsec,
3262 + int flow_deactivation_epoch,
3263 + int flow_deactivation_microsec,
3264 + time_t flow_deactivation_time,
3265 + const char * const flow_status,
3266 + int max_packet_delay_variation,
3267 + int num_activation_failures,
3268 + int num_bit_errors,
3269 + int num_bytes_received,
3270 + int num_bytes_transmitted,
3271 + int num_dropped_packets,
3272 + int num_l7_bytes_received,
3273 + int num_l7_bytes_transmitted,
3274 + int num_lost_packets,
3275 + int num_out_of_order_packets,
3276 + int num_packet_errors,
3277 + int num_packets_received_excl_retrans,
3278 + int num_packets_received_incl_retrans,
3279 + int num_packets_transmitted_incl_retrans,
3282 + int num_tunneled_l7_bytes_received,
3283 + int round_trip_time,
3284 + int time_to_first_byte);
3286 +/**************************************************************************//**
3287 + * Free a Mobile GTP Per Flow Metrics.
3289 + * Free off the Mobile GTP Per Flow Metrics supplied. Will free all the
3290 + * contained allocated memory.
3292 + * @note It does not free the Mobile GTP Per Flow Metrics itself, since that
3293 + * may be part of a larger structure.
3294 + *****************************************************************************/
3295 +void evel_free_mobile_gtp_flow_metrics(MOBILE_GTP_PER_FLOW_METRICS * metrics);
3297 +/**************************************************************************//**
3298 + * Set the Duration of Connection Failed Status property of the Mobile GTP Per
3301 + * @note The property is treated as immutable: it is only valid to call
3302 + * the setter once. However, we don't assert if the caller tries to
3303 + * overwrite, just ignoring the update instead.
3305 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3306 + * @param duration The Duration of Connection Failed Status to be set.
3307 + *****************************************************************************/
3308 +void evel_mobile_gtp_metrics_dur_con_fail_set(
3309 + MOBILE_GTP_PER_FLOW_METRICS * metrics,
3312 +/**************************************************************************//**
3313 + * Set the Duration of Tunnel Failed Status property of the Mobile GTP Per Flow
3316 + * @note The property is treated as immutable: it is only valid to call
3317 + * the setter once. However, we don't assert if the caller tries to
3318 + * overwrite, just ignoring the update instead.
3320 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3321 + * @param duration The Duration of Tunnel Failed Status to be set.
3322 + *****************************************************************************/
3323 +void evel_mobile_gtp_metrics_dur_tun_fail_set(
3324 + MOBILE_GTP_PER_FLOW_METRICS * metrics,
3327 +/**************************************************************************//**
3328 + * Set the Activated By property of the Mobile GTP Per Flow metrics.
3330 + * @note The property is treated as immutable: it is only valid to call
3331 + * the setter once. However, we don't assert if the caller tries to
3332 + * overwrite, just ignoring the update instead.
3334 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3335 + * @param act_by The Activated By to be set. ASCIIZ string. The caller
3336 + * does not need to preserve the value once the function
3338 + *****************************************************************************/
3339 +void evel_mobile_gtp_metrics_act_by_set(MOBILE_GTP_PER_FLOW_METRICS * metrics,
3340 + const char * const act_by);
3342 +/**************************************************************************//**
3343 + * Set the Activation Time property of the Mobile GTP Per Flow metrics.
3345 + * @note The property is treated as immutable: it is only valid to call
3346 + * the setter once. However, we don't assert if the caller tries to
3347 + * overwrite, just ignoring the update instead.
3349 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3350 + * @param act_time The Activation Time to be set. ASCIIZ string. The caller
3351 + * does not need to preserve the value once the function
3353 + *****************************************************************************/
3354 +void evel_mobile_gtp_metrics_act_time_set(
3355 + MOBILE_GTP_PER_FLOW_METRICS * metrics,
3358 +/**************************************************************************//**
3359 + * Set the Deactivated By property of the Mobile GTP Per Flow metrics.
3361 + * @note The property is treated as immutable: it is only valid to call
3362 + * the setter once. However, we don't assert if the caller tries to
3363 + * overwrite, just ignoring the update instead.
3365 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3366 + * @param deact_by The Deactivated By to be set. ASCIIZ string. The caller
3367 + * does not need to preserve the value once the function
3369 + *****************************************************************************/
3370 +void evel_mobile_gtp_metrics_deact_by_set(
3371 + MOBILE_GTP_PER_FLOW_METRICS * metrics,
3372 + const char * const deact_by);
3374 +/**************************************************************************//**
3375 + * Set the GTP Connection Status property of the Mobile GTP Per Flow metrics.
3377 + * @note The property is treated as immutable: it is only valid to call
3378 + * the setter once. However, we don't assert if the caller tries to
3379 + * overwrite, just ignoring the update instead.
3381 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3382 + * @param status The GTP Connection Status to be set. ASCIIZ string. The
3383 + * caller does not need to preserve the value once the
3384 + * function returns.
3385 + *****************************************************************************/
3386 +void evel_mobile_gtp_metrics_con_status_set(
3387 + MOBILE_GTP_PER_FLOW_METRICS * metrics,
3388 + const char * const status);
3390 +/**************************************************************************//**
3391 + * Set the GTP Tunnel Status property of the Mobile GTP Per Flow metrics.
3393 + * @note The property is treated as immutable: it is only valid to call
3394 + * the setter once. However, we don't assert if the caller tries to
3395 + * overwrite, just ignoring the update instead.
3397 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3398 + * @param status The GTP Tunnel Status to be set. ASCIIZ string. The
3399 + * caller does not need to preserve the value once the
3400 + * function returns.
3401 + *****************************************************************************/
3402 +void evel_mobile_gtp_metrics_tun_status_set(
3403 + MOBILE_GTP_PER_FLOW_METRICS * metrics,
3404 + const char * const status);
3406 +/**************************************************************************//**
3407 + * Set an IP Type-of-Service count property of the Mobile GTP Per Flow metrics.
3409 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3410 + * @param index The index of the IP Type-of-Service.
3411 + * @param count The count.
3412 + *****************************************************************************/
3413 +void evel_mobile_gtp_metrics_iptos_set(MOBILE_GTP_PER_FLOW_METRICS * metrics,
3417 +/**************************************************************************//**
3418 + * Set the Large Packet Round-Trip Time property of the Mobile GTP Per Flow
3421 + * @note The property is treated as immutable: it is only valid to call
3422 + * the setter once. However, we don't assert if the caller tries to
3423 + * overwrite, just ignoring the update instead.
3425 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3426 + * @param rtt The Large Packet Round-Trip Time to be set.
3427 + *****************************************************************************/
3428 +void evel_mobile_gtp_metrics_large_pkt_rtt_set(
3429 + MOBILE_GTP_PER_FLOW_METRICS * metrics,
3432 +/**************************************************************************//**
3433 + * Set the Large Packet Threshold property of the Mobile GTP Per Flow Metrics.
3435 + * @note The property is treated as immutable: it is only valid to call
3436 + * the setter once. However, we don't assert if the caller tries to
3437 + * overwrite, just ignoring the update instead.
3439 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3440 + * @param threshold The Large Packet Threshold to be set.
3441 + *****************************************************************************/
3442 +void evel_mobile_gtp_metrics_large_pkt_thresh_set(
3443 + MOBILE_GTP_PER_FLOW_METRICS * metrics,
3444 + double threshold);
3446 +/**************************************************************************//**
3447 + * Set the Max Receive Bit Rate property of the Mobile GTP Per Flow Metrics.
3449 + * @note The property is treated as immutable: it is only valid to call
3450 + * the setter once. However, we don't assert if the caller tries to
3451 + * overwrite, just ignoring the update instead.
3453 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3454 + * @param rate The Max Receive Bit Rate to be set.
3455 + *****************************************************************************/
3456 +void evel_mobile_gtp_metrics_max_rcv_bit_rate_set(
3457 + MOBILE_GTP_PER_FLOW_METRICS * metrics,
3460 +/**************************************************************************//**
3461 + * Set the Max Transmit Bit Rate property of the Mobile GTP Per Flow Metrics.
3463 + * @note The property is treated as immutable: it is only valid to call
3464 + * the setter once. However, we don't assert if the caller tries to
3465 + * overwrite, just ignoring the update instead.
3467 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3468 + * @param rate The Max Transmit Bit Rate to be set.
3469 + *****************************************************************************/
3470 +void evel_mobile_gtp_metrics_max_trx_bit_rate_set(
3471 + MOBILE_GTP_PER_FLOW_METRICS * metrics,
3474 +/**************************************************************************//**
3475 + * Set the Number of GTP Echo Failures property of the Mobile GTP Per Flow
3478 + * @note The property is treated as immutable: it is only valid to call
3479 + * the setter once. However, we don't assert if the caller tries to
3480 + * overwrite, just ignoring the update instead.
3482 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3483 + * @param num The Number of GTP Echo Failures to be set.
3484 + *****************************************************************************/
3485 +void evel_mobile_gtp_metrics_num_echo_fail_set(
3486 + MOBILE_GTP_PER_FLOW_METRICS * metrics,
3489 +/**************************************************************************//**
3490 + * Set the Number of GTP Tunnel Errors property of the Mobile GTP Per Flow
3493 + * @note The property is treated as immutable: it is only valid to call
3494 + * the setter once. However, we don't assert if the caller tries to
3495 + * overwrite, just ignoring the update instead.
3497 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3498 + * @param num The Number of GTP Tunnel Errors to be set.
3499 + *****************************************************************************/
3500 +void evel_mobile_gtp_metrics_num_tun_fail_set(
3501 + MOBILE_GTP_PER_FLOW_METRICS * metrics,
3504 +/**************************************************************************//**
3505 + * Set the Number of HTTP Errors property of the Mobile GTP Per Flow Metrics.
3507 + * @note The property is treated as immutable: it is only valid to call
3508 + * the setter once. However, we don't assert if the caller tries to
3509 + * overwrite, just ignoring the update instead.
3511 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3512 + * @param num The Number of HTTP Errors to be set.
3513 + *****************************************************************************/
3514 +void evel_mobile_gtp_metrics_num_http_errors_set(
3515 + MOBILE_GTP_PER_FLOW_METRICS * metrics,
3518 +/**************************************************************************//**
3519 + * Add a TCP flag count to the metrics.
3521 + * @note The property is treated as immutable: it is only valid to call
3522 + * the setter once. However, we don't assert if the caller tries to
3523 + * overwrite, just ignoring the update instead.
3525 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3526 + * @param tcp_flag The TCP flag count to be updated.
3527 + * @param count The associated flag count.
3528 + *****************************************************************************/
3529 +void evel_mobile_gtp_metrics_tcp_flag_count_add(
3530 + MOBILE_GTP_PER_FLOW_METRICS * metrics,
3531 + const EVEL_TCP_FLAGS tcp_flag,
3534 +/**************************************************************************//**
3535 + * Add a QCI COS count to the metrics.
3537 + * @note The property is treated as immutable: it is only valid to call
3538 + * the setter once. However, we don't assert if the caller tries to
3539 + * overwrite, just ignoring the update instead.
3541 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3542 + * @param qci_cos The QCI COS count to be updated.
3543 + * @param count The associated QCI COS count.
3544 + *****************************************************************************/
3545 +void evel_mobile_gtp_metrics_qci_cos_count_add(
3546 + MOBILE_GTP_PER_FLOW_METRICS * metrics,
3547 + const EVEL_QCI_COS_TYPES qci_cos,
3550 +/*****************************************************************************/
3551 +/*****************************************************************************/
3555 +/*****************************************************************************/
3556 +/*****************************************************************************/
3558 +/**************************************************************************//**
3559 + * Create a new Signaling event.
3561 + * @note The mandatory fields on the Signaling must be supplied to
3562 + * this factory function and are immutable once set. Optional fields
3563 + * have explicit setter functions, but again values may only be set
3564 + * once so that the event has immutable properties.
3565 + * @param event_name Unique Event Name
3566 + * @param event_id A universal identifier of the event for analysis etc
3567 + * @param vendor_name The vendor id to encode in the event vnf field.
3568 + * @param module The module to encode in the event.
3569 + * @param vnfname The Virtual network function to encode in the event.
3570 + * @returns pointer to the newly manufactured ::EVENT_SIGNALING. If the event
3571 + * is not used (i.e. posted) it must be released using
3572 + * ::evel_free_signaling.
3573 + * @retval NULL Failed to create the event.
3574 + *****************************************************************************/
3575 +EVENT_SIGNALING * evel_new_signaling(const char* ev_name, const char *ev_id,
3576 + const char * const vendor_name,
3577 + const char * const correlator,
3578 + const char * const local_ip_address,
3579 + const char * const local_port,
3580 + const char * const remote_ip_address,
3581 + const char * const remote_port);
3583 +/**************************************************************************//**
3584 + * Free a Signaling event.
3586 + * Free off the event supplied. Will free all the contained allocated memory.
3588 + * @note It does not free the event itself, since that may be part of a larger
3590 + *****************************************************************************/
3591 +void evel_free_signaling(EVENT_SIGNALING * const event);
3593 +/**************************************************************************//**
3594 + * Set the Event Type property of the Signaling event.
3596 + * @note The property is treated as immutable: it is only valid to call
3597 + * the setter once. However, we don't assert if the caller tries to
3598 + * overwrite, just ignoring the update instead.
3600 + * @param event Pointer to the Signaling event.
3601 + * @param type The Event Type to be set. ASCIIZ string. The caller
3602 + * does not need to preserve the value once the function
3604 + *****************************************************************************/
3605 +void evel_signaling_type_set(EVENT_SIGNALING * const event,
3606 + const char * const type);
3608 +/**************************************************************************//**
3609 + * Add an additional value name/value pair to the SIP signaling.
3611 + * The name and value are null delimited ASCII strings. The library takes
3612 + * a copy so the caller does not have to preserve values after the function
3615 + * @param event Pointer to the fault.
3616 + * @param name ASCIIZ string with the attribute's name. The caller
3617 + * does not need to preserve the value once the function
3619 + * @param value ASCIIZ string with the attribute's value. The caller
3620 + * does not need to preserve the value once the function
3622 + *****************************************************************************/
3623 +void evel_signaling_addl_info_add(EVENT_SIGNALING * event, char * name, char * value);
3625 +/**************************************************************************//**
3626 + * Set the Correlator property of the Signaling event.
3628 + * @note The property is treated as immutable: it is only valid to call
3629 + * the setter once. However, we don't assert if the caller tries to
3630 + * overwrite, just ignoring the update instead.
3632 + * @param event Pointer to the Signaling event.
3633 + * @param correlator The correlator to be set. ASCIIZ string. The caller
3634 + * does not need to preserve the value once the function
3636 + *****************************************************************************/
3637 +void evel_signaling_correlator_set(EVENT_SIGNALING * const event,
3638 + const char * const correlator);
3640 +/**************************************************************************//**
3641 + * Set the Local Ip Address property of the Signaling event.
3643 + * @note The property is treated as immutable: it is only valid to call
3644 + * the setter once. However, we don't assert if the caller tries to
3645 + * overwrite, just ignoring the update instead.
3647 + * @param event Pointer to the Signaling event.
3648 + * @param local_ip_address
3649 + * The Local Ip Address to be set. ASCIIZ string. The
3650 + * caller does not need to preserve the value once the
3651 + * function returns.
3652 + *****************************************************************************/
3653 +void evel_signaling_local_ip_address_set(EVENT_SIGNALING * const event,
3654 + const char * const local_ip_address);
3656 +/**************************************************************************//**
3657 + * Set the Local Port property of the Signaling event.
3659 + * @note The property is treated as immutable: it is only valid to call
3660 + * the setter once. However, we don't assert if the caller tries to
3661 + * overwrite, just ignoring the update instead.
3663 + * @param event Pointer to the Signaling event.
3664 + * @param local_port The Local Port to be set. ASCIIZ string. The caller
3665 + * does not need to preserve the value once the function
3667 + *****************************************************************************/
3668 +void evel_signaling_local_port_set(EVENT_SIGNALING * const event,
3669 + const char * const local_port);
3671 +/**************************************************************************//**
3672 + * Set the Remote Ip Address property of the Signaling event.
3674 + * @note The property is treated as immutable: it is only valid to call
3675 + * the setter once. However, we don't assert if the caller tries to
3676 + * overwrite, just ignoring the update instead.
3678 + * @param event Pointer to the Signaling event.
3679 + * @param remote_ip_address
3680 + * The Remote Ip Address to be set. ASCIIZ string. The
3681 + * caller does not need to preserve the value once the
3682 + * function returns.
3683 + *****************************************************************************/
3684 +void evel_signaling_remote_ip_address_set(EVENT_SIGNALING * const event,
3685 + const char * const remote_ip_address);
3687 +/**************************************************************************//**
3688 + * Set the Remote Port property of the Signaling event.
3690 + * @note The property is treated as immutable: it is only valid to call
3691 + * the setter once. However, we don't assert if the caller tries to
3692 + * overwrite, just ignoring the update instead.
3694 + * @param event Pointer to the Signaling event.
3695 + * @param remote_port The Remote Port to be set. ASCIIZ string. The caller
3696 + * does not need to preserve the value once the function
3698 + *****************************************************************************/
3699 +void evel_signaling_remote_port_set(EVENT_SIGNALING * const event,
3700 + const char * const remote_port);
3701 +/**************************************************************************//**
3702 + * Set the Vendor module property of the Signaling event.
3704 + * @note The property is treated as immutable: it is only valid to call
3705 + * the setter once. However, we don't assert if the caller tries to
3706 + * overwrite, just ignoring the update instead.
3708 + * @param event Pointer to the Signaling event.
3709 + * @param modulename The module name to be set. ASCIIZ string. The caller
3710 + * does not need to preserve the value once the function
3712 + *****************************************************************************/
3713 +void evel_signaling_vnfmodule_name_set(EVENT_SIGNALING * const event,
3714 + const char * const module_name);
3715 +/**************************************************************************//**
3716 + * Set the Vendor module property of the Signaling event.
3718 + * @note The property is treated as immutable: it is only valid to call
3719 + * the setter once. However, we don't assert if the caller tries to
3720 + * overwrite, just ignoring the update instead.
3722 + * @param event Pointer to the Signaling event.
3723 + * @param vnfname The Virtual Network function to be set. ASCIIZ string.
3724 + * The caller does not need to preserve the value once
3725 + * the function returns.
3726 + *****************************************************************************/
3727 +void evel_signaling_vnfname_set(EVENT_SIGNALING * const event,
3728 + const char * const vnfname);
3730 +/**************************************************************************//**
3731 + * Set the Compressed SIP property of the Signaling event.
3733 + * @note The property is treated as immutable: it is only valid to call
3734 + * the setter once. However, we don't assert if the caller tries to
3735 + * overwrite, just ignoring the update instead.
3737 + * @param event Pointer to the Signaling event.
3738 + * @param compressed_sip
3739 + * The Compressed SIP to be set. ASCIIZ string. The caller
3740 + * does not need to preserve the value once the function
3742 + *****************************************************************************/
3743 +void evel_signaling_compressed_sip_set(EVENT_SIGNALING * const event,
3744 + const char * const compressed_sip);
3746 +/**************************************************************************//**
3747 + * Set the Summary SIP property of the Signaling event.
3749 + * @note The property is treated as immutable: it is only valid to call
3750 + * the setter once. However, we don't assert if the caller tries to
3751 + * overwrite, just ignoring the update instead.
3753 + * @param event Pointer to the Signaling event.
3754 + * @param summary_sip The Summary SIP to be set. ASCIIZ string. The caller
3755 + * does not need to preserve the value once the function
3757 + *****************************************************************************/
3758 +void evel_signaling_summary_sip_set(EVENT_SIGNALING * const event,
3759 + const char * const summary_sip);
3762 +/*****************************************************************************/
3763 +/*****************************************************************************/
3767 +/*****************************************************************************/
3768 +/*****************************************************************************/
3770 +/**************************************************************************//**
3771 + * Create a new State Change event.
3773 + * @note The mandatory fields on the Syslog must be supplied to this factory
3774 + * function and are immutable once set. Optional fields have explicit
3775 + * setter functions, but again values may only be set once so that the
3776 + * Syslog has immutable properties.
3778 + * @param event_name Unique Event Name
3779 + * @param event_id A universal identifier of the event for analysis etc
3780 + * @param new_state The new state of the reporting entity.
3781 + * @param old_state The old state of the reporting entity.
3782 + * @param interface The card or port name of the reporting entity.
3784 + * @returns pointer to the newly manufactured ::EVENT_STATE_CHANGE. If the
3785 + * event is not used it must be released using
3786 + * ::evel_free_state_change
3787 + * @retval NULL Failed to create the event.
3788 + *****************************************************************************/
3789 +EVENT_STATE_CHANGE * evel_new_state_change(const char* ev_name, const char *ev_id,
3790 + const EVEL_ENTITY_STATE new_state,
3791 + const EVEL_ENTITY_STATE old_state,
3792 + const char * const interface);
3794 +/**************************************************************************//**
3795 + * Free a State Change.
3797 + * Free off the State Change supplied. Will free all the contained allocated
3800 + * @note It does not free the State Change itself, since that may be part of a
3801 + * larger structure.
3802 + *****************************************************************************/
3803 +void evel_free_state_change(EVENT_STATE_CHANGE * const state_change);
3805 +/**************************************************************************//**
3806 + * Set the Event Type property of the State Change.
3808 + * @note The property is treated as immutable: it is only valid to call
3809 + * the setter once. However, we don't assert if the caller tries to
3810 + * overwrite, just ignoring the update instead.
3812 + * @param state_change Pointer to the ::EVENT_STATE_CHANGE.
3813 + * @param type The Event Type to be set. ASCIIZ string. The caller
3814 + * does not need to preserve the value once the function
3816 + *****************************************************************************/
3817 +void evel_state_change_type_set(EVENT_STATE_CHANGE * const state_change,
3818 + const char * const type);
3820 +/**************************************************************************//**
3821 + * Add an additional field name/value pair to the State Change.
3823 + * The name and value are null delimited ASCII strings. The library takes
3824 + * a copy so the caller does not have to preserve values after the function
3827 + * @param state_change Pointer to the ::EVENT_STATE_CHANGE.
3828 + * @param name ASCIIZ string with the attribute's name. The caller
3829 + * does not need to preserve the value once the function
3831 + * @param value ASCIIZ string with the attribute's value. The caller
3832 + * does not need to preserve the value once the function
3834 + *****************************************************************************/
3835 +void evel_state_change_addl_field_add(EVENT_STATE_CHANGE * const state_change,
3836 + const char * const name,
3837 + const char * const value);
3839 +/*****************************************************************************/
3840 +/*****************************************************************************/
3844 +/*****************************************************************************/
3845 +/*****************************************************************************/
3847 +/**************************************************************************//**
3848 + * Create a new syslog event.
3850 + * @note The mandatory fields on the Syslog must be supplied to this factory
3851 + * function and are immutable once set. Optional fields have explicit
3852 + * setter functions, but again values may only be set once so that the
3853 + * Syslog has immutable properties.
3855 + * @param event_name Unique Event Name
3856 + * @param event_id A universal identifier of the event for analysis etc
3857 + * @param event_source_type
3858 + * @param syslog_msg
3859 + * @param syslog_tag
3862 + * @returns pointer to the newly manufactured ::EVENT_SYSLOG. If the event is
3863 + * not used it must be released using ::evel_free_syslog
3864 + * @retval NULL Failed to create the event.
3865 + *****************************************************************************/
3866 +EVENT_SYSLOG * evel_new_syslog(const char* ev_name, const char *ev_id,
3867 + EVEL_SOURCE_TYPES event_source_type,
3868 + const char * const syslog_msg,
3869 + const char * const syslog_tag);
3871 +/**************************************************************************//**
3872 + * Set the Event Type property of the Syslog.
3874 + * @note The property is treated as immutable: it is only valid to call
3875 + * the setter once. However, we don't assert if the caller tries to
3876 + * overwrite, just ignoring the update instead.
3878 + * @param syslog Pointer to the syslog.
3879 + * @param type The Event Type to be set. ASCIIZ string. The caller
3880 + * does not need to preserve the value once the function
3882 + *****************************************************************************/
3883 +void evel_syslog_type_set(EVENT_SYSLOG * syslog,
3884 + const char * const type);
3886 +/**************************************************************************//**
3889 + * Free off the Syslog supplied. Will free all the contained allocated memory.
3891 + * @note It does not free the Syslog itself, since that may be part of a
3892 + * larger structure.
3893 + *****************************************************************************/
3894 +void evel_free_syslog(EVENT_SYSLOG * event);
3896 +/**************************************************************************//**
3897 + * Add an additional field name/value pair to the Syslog.
3899 + * The name and value are null delimited ASCII strings. The library takes
3900 + * a copy so the caller does not have to preserve values after the function
3903 + * @param syslog Pointer to the syslog.
3904 + * @param name ASCIIZ string with the attribute's name. The caller
3905 + * does not need to preserve the value once the function
3907 + * @param value ASCIIZ string with the attribute's value. The caller
3908 + * does not need to preserve the value once the function
3910 + *****************************************************************************/
3911 +void evel_syslog_addl_field_add(EVENT_SYSLOG * syslog,
3915 +/**************************************************************************//**
3916 + * Set the Event Source Host property of the Syslog.
3918 + * @note The property is treated as immutable: it is only valid to call
3919 + * the setter once. However, we don't assert if the caller tries to
3920 + * overwrite, just ignoring the update instead.
3922 + * @param syslog Pointer to the Syslog.
3923 + * @param host The Event Source Host to be set. ASCIIZ string. The
3924 + * caller does not need to preserve the value once the
3925 + * function returns.
3926 + *****************************************************************************/
3927 +void evel_syslog_event_source_host_set(EVENT_SYSLOG * syslog,
3928 + const char * const host);
3930 +/**************************************************************************//**
3931 + * Set the Syslog Facility property of the Syslog.
3933 + * @note The property is treated as immutable: it is only valid to call
3934 + * the setter once. However, we don't assert if the caller tries to
3935 + * overwrite, just ignoring the update instead.
3937 + * @param syslog Pointer to the Syslog.
3938 + * @param facility The Syslog Facility to be set. ASCIIZ string. The caller
3939 + * does not need to preserve the value once the function
3941 + *****************************************************************************/
3942 +void evel_syslog_facility_set(EVENT_SYSLOG * syslog,
3943 + EVEL_SYSLOG_FACILITIES facility);
3945 +/**************************************************************************//**
3946 + * Set the Process property of the Syslog.
3948 + * @note The property is treated as immutable: it is only valid to call
3949 + * the setter once. However, we don't assert if the caller tries to
3950 + * overwrite, just ignoring the update instead.
3952 + * @param syslog Pointer to the Syslog.
3953 + * @param proc The Process to be set. ASCIIZ string. The caller does
3954 + * not need to preserve the value once the function returns.
3955 + *****************************************************************************/
3956 +void evel_syslog_proc_set(EVENT_SYSLOG * syslog, const char * const proc);
3958 +/**************************************************************************//**
3959 + * Set the Process ID property of the Syslog.
3961 + * @note The property is treated as immutable: it is only valid to call
3962 + * the setter once. However, we don't assert if the caller tries to
3963 + * overwrite, just ignoring the update instead.
3965 + * @param syslog Pointer to the Syslog.
3966 + * @param proc_id The Process ID to be set.
3967 + *****************************************************************************/
3968 +void evel_syslog_proc_id_set(EVENT_SYSLOG * syslog, int proc_id);
3970 +/**************************************************************************//**
3971 + * Set the Version property of the Syslog.
3973 + * @note The property is treated as immutable: it is only valid to call
3974 + * the setter once. However, we don't assert if the caller tries to
3975 + * overwrite, just ignoring the update instead.
3977 + * @param syslog Pointer to the Syslog.
3978 + * @param version The Version to be set.
3979 + *****************************************************************************/
3980 +void evel_syslog_version_set(EVENT_SYSLOG * syslog, int version);
3982 +/**************************************************************************//**
3983 + * Set the Structured Data property of the Syslog.
3985 + * @note The property is treated as immutable: it is only valid to call
3986 + * the setter once. However, we don't assert if the caller tries to
3987 + * overwrite, just ignoring the update instead.
3989 + * @param syslog Pointer to the Syslog.
3990 + * @param s_data The Structured Data to be set. ASCIIZ string. The caller
3991 + * does not need to preserve the value once the function
3993 + *****************************************************************************/
3994 +void evel_syslog_s_data_set(EVENT_SYSLOG * syslog, const char * const s_data);
3996 +/**************************************************************************//**
3997 + * Set the Structured SDID property of the Syslog.
3999 + * @note The property is treated as immutable: it is only valid to call
4000 + * the setter once. However, we don't assert if the caller tries to
4001 + * overwrite, just ignoring the update instead.
4003 + * @param syslog Pointer to the Syslog.
4004 + * @param sdid The Structured Data to be set. ASCIIZ string. name@number
4005 + * Caller does not need to preserve the value once the function
4007 + *****************************************************************************/
4008 +void evel_syslog_sdid_set(EVENT_SYSLOG * syslog, const char * const sdid);
4010 +/**************************************************************************//**
4011 + * Set the Structured Severity property of the Syslog.
4013 + * @note The property is treated as immutable: it is only valid to call
4014 + * the setter once. However, we don't assert if the caller tries to
4015 + * overwrite, just ignoring the update instead.
4017 + * @param syslog Pointer to the Syslog.
4018 + * @param sdid The Structured Data to be set. ASCIIZ string.
4019 + * Caller does not need to preserve the value once the function
4021 + *****************************************************************************/
4022 +void evel_syslog_severity_set(EVENT_SYSLOG * syslog, const char * const severty);
4025 +/*****************************************************************************/
4026 +/*****************************************************************************/
4030 +/*****************************************************************************/
4031 +/*****************************************************************************/
4033 +/**************************************************************************//**
4034 + * Create a new other event.
4036 + * @param event_name Unique Event Name
4037 + * @param event_id A universal identifier of the event for analysis etc
4039 + * @returns pointer to the newly manufactured ::EVENT_OTHER. If the event is
4040 + * not used it must be released using ::evel_free_other.
4041 + * @retval NULL Failed to create the event.
4042 + *****************************************************************************/
4043 +EVENT_OTHER * evel_new_other(const char* ev_name, const char *ev_id);
4045 +/**************************************************************************//**
4048 + * Free off the Other supplied. Will free all the contained allocated memory.
4050 + * @note It does not free the Other itself, since that may be part of a
4051 + * larger structure.
4052 + *****************************************************************************/
4053 +void evel_free_other(EVENT_OTHER * event);
4055 +/**************************************************************************//**
4056 + * Set the Event Type property of the Other.
4058 + * @note The property is treated as immutable: it is only valid to call
4059 + * the setter once. However, we don't assert if the caller tries to
4060 + * overwrite, just ignoring the update instead.
4062 + * @param other Pointer to the Other.
4063 + * @param type The Event Type to be set. ASCIIZ string. The caller
4064 + * does not need to preserve the value once the function
4066 + *****************************************************************************/
4067 +void evel_other_type_set(EVENT_OTHER * other,
4068 + const char * const type);
4070 +/**************************************************************************//**
4071 + * Add a value name/value pair to the Other.
4073 + * The name and value are null delimited ASCII strings. The library takes
4074 + * a copy so the caller does not have to preserve values after the function
4077 + * @param other Pointer to the Other.
4078 + * @param name ASCIIZ string with the attribute's name.
4079 + * @param value ASCIIZ string with the attribute's value.
4080 + *****************************************************************************/
4081 +void evel_other_field_add(EVENT_OTHER * other,
4085 +/*****************************************************************************/
4086 +/*****************************************************************************/
4090 +/*****************************************************************************/
4091 +/*****************************************************************************/
4093 +/**************************************************************************//**
4094 + * Return the current measurement interval provided by the Event Listener.
4096 + * @returns The current measurement interval
4097 + * @retval EVEL_MEASUREMENT_INTERVAL_UKNOWN (0) - interval has not been
4099 + *****************************************************************************/
4100 +int evel_get_measurement_interval();
4102 +/*****************************************************************************/
4103 +/* Supported Report version. */
4104 +/*****************************************************************************/
4105 +#define EVEL_VOICEQ_MAJOR_VERSION 1
4106 +#define EVEL_VOICEQ_MINOR_VERSION 1
4108 +/**************************************************************************//**
4109 + * End of Call Voice Quality Metrices
4110 + * JSON equivalent field: endOfCallVqmSummaries
4111 + *****************************************************************************/
4112 +typedef struct end_of_call_vqm_summaries {
4113 + /***************************************************************************/
4114 + /* Mandatory fields */
4115 + /***************************************************************************/
4116 + char* adjacencyName;
4117 + char* endpointDescription;
4119 + /***************************************************************************/
4120 + /* Optional fields */
4121 + /***************************************************************************/
4122 + EVEL_OPTION_INT endpointJitter;
4123 + EVEL_OPTION_INT endpointRtpOctetsDiscarded;
4124 + EVEL_OPTION_INT endpointRtpOctetsReceived;
4125 + EVEL_OPTION_INT endpointRtpOctetsSent;
4126 + EVEL_OPTION_INT endpointRtpPacketsDiscarded;
4127 + EVEL_OPTION_INT endpointRtpPacketsReceived;
4128 + EVEL_OPTION_INT endpointRtpPacketsSent;
4129 + EVEL_OPTION_INT localJitter;
4130 + EVEL_OPTION_INT localRtpOctetsDiscarded;
4131 + EVEL_OPTION_INT localRtpOctetsReceived;
4132 + EVEL_OPTION_INT localRtpOctetsSent;
4133 + EVEL_OPTION_INT localRtpPacketsDiscarded;
4134 + EVEL_OPTION_INT localRtpPacketsReceived;
4135 + EVEL_OPTION_INT localRtpPacketsSent;
4136 + EVEL_OPTION_INT mosCqe;
4137 + EVEL_OPTION_INT packetsLost;
4138 + EVEL_OPTION_INT packetLossPercent;
4139 + EVEL_OPTION_INT rFactor;
4140 + EVEL_OPTION_INT roundTripDelay;
4142 +} END_OF_CALL_VOICE_QUALITY_METRICS;
4144 +/**************************************************************************//**
4146 +* JSON equivalent field: voiceQualityFields
4147 +*****************************************************************************/
4149 +typedef struct event_voiceQuality {
4150 + /***************************************************************************/
4151 + /* Header and version */
4152 + /***************************************************************************/
4153 + EVENT_HEADER header;
4154 + int major_version;
4155 + int minor_version;
4157 + /***************************************************************************/
4158 + /* Mandatory fields */
4159 + /***************************************************************************/
4161 + char *calleeSideCodec;
4162 + char *callerSideCodec;
4164 + char *midCallRtcp;
4165 + VENDOR_VNFNAME_FIELD vendorVnfNameFields;
4166 + END_OF_CALL_VOICE_QUALITY_METRICS *endOfCallVqmSummaries;
4168 + /***************************************************************************/
4169 + /* Optional fields */
4170 + /***************************************************************************/
4171 + EVEL_OPTION_STRING phoneNumber;
4172 + DLIST additionalInformation;
4174 +} EVENT_VOICE_QUALITY;
4175 +/**************************************************************************//**
4176 + * Voice Quality Additional Info.
4177 + * JSON equivalent field: additionalInformation
4178 + *****************************************************************************/
4179 +typedef struct voice_quality_additional_info {
4182 +} VOICE_QUALITY_ADDL_INFO;
4184 +/**************************************************************************//**
4185 + * Create a new voice quality event.
4187 + * @note The mandatory fields on the Voice Quality must be supplied to this
4188 + * factory function and are immutable once set. Optional fields have
4189 + * explicit setter functions, but again values may only be set once
4190 + * so that the Voice Quality has immutable properties.
4191 + * @param event_name Unique Event Name
4192 + * @param event_id A universal identifier of the event for analysis etc
4193 + * @param calleeSideCodec Callee codec for the call.
4194 + * @param callerSideCodec Caller codec for the call.
4195 + * @param correlator Constant across all events on this call.
4196 + * @param midCallRtcp Base64 encoding of the binary RTCP data
4197 + * (excluding Eth/IP/UDP headers).
4198 + * @param vendorVnfNameFields Vendor, VNF and VfModule names.
4199 + * @returns pointer to the newly manufactured ::EVENT_VOICE_QUALITY. If the
4200 + * event is not used (i.e. posted) it must be released using
4201 + ::evel_free_voice_quality.
4202 + * @retval NULL Failed to create the event.
4203 + *****************************************************************************/
4204 +EVENT_VOICE_QUALITY * evel_new_voice_quality(const char* ev_name, const char *ev_id,
4205 + const char * const calleeSideCodec,
4206 + const char * const callerSideCodec, const char * const correlator,
4207 + const char * const midCallRtcp, const char * const vendorVnfNameFields);
4209 +/**************************************************************************//**
4210 + * Set the Callee side codec for Call for domain Voice Quality
4212 + * @note The property is treated as immutable: it is only valid to call
4213 + * the setter once. However, we don't assert if the caller tries to
4214 + * overwrite, just ignoring the update instead.
4216 + * @param voiceQuality Pointer to the Voice Quality Event.
4217 + * @param calleeCodecForCall The Callee Side Codec to be set. ASCIIZ
4218 + * string. The caller does not need to
4219 + * preserve the value once the function
4221 + *****************************************************************************/
4222 +void evel_voice_quality_callee_codec_set(EVENT_VOICE_QUALITY * voiceQuality,
4223 + const char * const calleeCodecForCall);
4225 +/**************************************************************************//**
4226 + * Set the Caller side codec for Call for domain Voice Quality
4228 + * @note The property is treated as immutable: it is only valid to call
4229 + * the setter once. However, we don't assert if the caller tries to
4230 + * overwrite, just ignoring the update instead.
4232 + * @param voiceQuality Pointer to the Voice Quality Event.
4233 + * @param callerCodecForCall The Caller Side Codec to be set. ASCIIZ
4234 + * string. The caller does not need to
4235 + * preserve the value once the function
4237 + *****************************************************************************/
4238 +void evel_voice_quality_caller_codec_set(EVENT_VOICE_QUALITY * voiceQuality,
4239 + const char * const callerCodecForCall);
4241 +/**************************************************************************//**
4242 + * Set the correlator for domain Voice Quality
4244 + * @note The property is treated as immutable: it is only valid to call
4245 + * the setter once. However, we don't assert if the caller tries to
4246 + * overwrite, just ignoring the update instead.
4248 + * @param voiceQuality Pointer to the Voice Quality Event.
4249 + * @param correlator The correlator value to be set. ASCIIZ
4250 + * string. The caller does not need to
4251 + * preserve the value once the function
4253 + *****************************************************************************/
4254 +void evel_voice_quality_correlator_set(EVENT_VOICE_QUALITY * voiceQuality,
4255 + const char * const vCorrelator);
4257 +/**************************************************************************//**
4258 + * Set the RTCP Call Data for domain Voice Quality
4260 + * @note The property is treated as immutable: it is only valid to call
4261 + * the setter once. However, we don't assert if the caller tries to
4262 + * overwrite, just ignoring the update instead.
4264 + * @param voiceQuality Pointer to the Voice Quality Event.
4265 + * @param rtcpCallData The RTCP Call Data to be set. ASCIIZ
4266 + * string. The caller does not need to
4267 + * preserve the value once the function
4269 + *****************************************************************************/
4270 +void evel_voice_quality_rtcp_data_set(EVENT_VOICE_QUALITY * voiceQuality,
4271 + const char * const rtcpCallData);
4273 +/**************************************************************************//**
4274 + * Set the Vendor VNF Name fields for domain Voice Quality
4276 + * @note The property is treated as immutable: it is only valid to call
4277 + * the setter once. However, we don't assert if the caller tries to
4278 + * overwrite, just ignoring the update instead.
4280 + * @param voiceQuality Pointer to the Voice Quality Event.
4281 + * @param nameFields The Vendor, VNF and VfModule names to be set.
4282 + * ASCIIZ string. The caller does not need to
4283 + * preserve the value once the function
4285 + *****************************************************************************/
4286 +void evel_voice_quality_name_fields_set(EVENT_VOICE_QUALITY * voiceQuality,
4287 + const char * const nameFields);
4289 +/**************************************************************************//**
4290 + * Add an End of Call Voice Quality Metrices
4292 + * The adjacencyName and endpointDescription is null delimited ASCII string.
4293 + * The library takes a copy so the caller does not have to preserve values
4294 + * after the function returns.
4296 + * @param voiceQuality Pointer to the measurement.
4297 + * @param adjacencyName Adjacency name
4298 + * @param endpointDescription Enumeration: ‘Caller’, ‘Callee’.
4299 + * @param endpointJitter Endpoint jitter
4300 + * @param endpointRtpOctetsDiscarded Endpoint RTP octets discarded.
4301 + * @param endpointRtpOctetsReceived Endpoint RTP octets received.
4302 + * @param endpointRtpOctetsSent Endpoint RTP octets sent
4303 + * @param endpointRtpPacketsDiscarded Endpoint RTP packets discarded.
4304 + * @param endpointRtpPacketsReceived Endpoint RTP packets received.
4305 + * @param endpointRtpPacketsSent Endpoint RTP packets sent.
4306 + * @param localJitter Local jitter.
4307 + * @param localRtpOctetsDiscarded Local RTP octets discarded.
4308 + * @param localRtpOctetsReceived Local RTP octets received.
4309 + * @param localRtpOctetsSent Local RTP octets sent.
4310 + * @param localRtpPacketsDiscarded Local RTP packets discarded.
4311 + * @param localRtpPacketsReceived Local RTP packets received.
4312 + * @param localRtpPacketsSent Local RTP packets sent.
4313 + * @param mosCqe Decimal range from 1 to 5
4314 + * (1 decimal place)
4315 + * @param packetsLost No Packets lost
4316 + * @param packetLossPercent Calculated percentage packet loss
4317 + * @param rFactor rFactor from 0 to 100
4318 + * @param roundTripDelay Round trip delay in milliseconds
4319 + *****************************************************************************/
4320 +void evel_voice_quality_end_metrics_add(EVENT_VOICE_QUALITY * voiceQuality,
4321 + const char * adjacencyName, EVEL_SERVICE_ENDPOINT_DESC endpointDescription,
4322 + int endpointJitter,
4323 + int endpointRtpOctetsDiscarded,
4324 + int endpointRtpOctetsReceived,
4325 + int endpointRtpOctetsSent,
4326 + int endpointRtpPacketsDiscarded,
4327 + int endpointRtpPacketsReceived,
4328 + int endpointRtpPacketsSent,
4330 + int localRtpOctetsDiscarded,
4331 + int localRtpOctetsReceived,
4332 + int localRtpOctetsSent,
4333 + int localRtpPacketsDiscarded,
4334 + int localRtpPacketsReceived,
4335 + int localRtpPacketsSent,
4338 + int packetLossPercent,
4340 + int roundTripDelay);
4342 +/**************************************************************************//**
4343 + * Free a Voice Quality.
4345 + * Free off the Voce Quality supplied. Will free all the contained allocated
4348 + * @note It does not free the Voice Quality itself, since that may be part of a
4349 + * larger structure.
4350 + *****************************************************************************/
4351 +void evel_free_voice_quality(EVENT_VOICE_QUALITY * voiceQuality);
4353 +/**************************************************************************//**
4354 + * Add an additional value name/value pair to the Voice Quality.
4356 + * The name and value are null delimited ASCII strings. The library takes
4357 + * a copy so the caller does not have to preserve values after the function
4360 + * @param fault Pointer to the fault.
4361 + * @param name ASCIIZ string with the attribute's name. The caller
4362 + * does not need to preserve the value once the function
4364 + * @param value ASCIIZ string with the attribute's value. The caller
4365 + * does not need to preserve the value once the function
4367 + *****************************************************************************/
4368 +void evel_voice_quality_addl_info_add(EVENT_VOICE_QUALITY * voiceQuality, char * name, char * value);
4371 +/*****************************************************************************/
4372 +/*****************************************************************************/
4374 +/* THRESHOLD CROSSING ALERT */
4376 +/*****************************************************************************/
4377 +/*****************************************************************************/
4379 +typedef enum evel_event_action {
4380 + EVEL_EVENT_ACTION_CLEAR,
4381 + EVEL_EVENT_ACTION_CONTINUE,
4382 + EVEL_EVENT_ACTION_SET,
4383 + EVEL_MAX_EVENT_ACTION
4384 +}EVEL_EVENT_ACTION;
4386 +typedef enum evel_alert_type {
4387 + EVEL_CARD_ANOMALY,
4388 + EVEL_ELEMENT_ANOMALY,
4389 + EVEL_INTERFACE_ANOMALY,
4390 + EVEL_SERVICE_ANOMALY,
4395 +typedef struct perf_counter {
4396 + char * criticality;
4398 + char * thresholdCrossed;
4403 +/*****************************************************************************/
4404 +/* Supported Threshold Crossing version. */
4405 +/*****************************************************************************/
4406 +#define EVEL_THRESHOLD_CROSS_MAJOR_VERSION 1
4407 +#define EVEL_THRESHOLD_CROSS_MINOR_VERSION 1
4409 +/**************************************************************************//**
4410 + * Threshold Crossing.
4411 + * JSON equivalent field: Threshold Cross Fields
4412 + *****************************************************************************/
4413 +typedef struct event_threshold_cross {
4414 + /***************************************************************************/
4415 + /* Header and version */
4416 + /***************************************************************************/
4417 + EVENT_HEADER header;
4418 + int major_version;
4419 + int minor_version;
4421 + /***************************************************************************/
4422 + /* Mandatory fields */
4423 + /***************************************************************************/
4424 + PERF_COUNTER additionalParameters;
4425 + EVEL_EVENT_ACTION alertAction;
4426 + char * alertDescription;
4427 + EVEL_ALERT_TYPE alertType;
4428 + unsigned long long collectionTimestamp;
4429 + EVEL_SEVERITIES eventSeverity;
4430 + unsigned long long eventStartTimestamp;
4432 + /***************************************************************************/
4433 + /* Optional fields */
4434 + /***************************************************************************/
4435 + DLIST additional_info;
4436 + EVEL_OPTION_STRING alertValue;
4437 + DLIST alertidList;
4438 + EVEL_OPTION_STRING dataCollector;
4439 + EVEL_OPTION_STRING elementType;
4440 + EVEL_OPTION_STRING interfaceName;
4441 + EVEL_OPTION_STRING networkService;
4442 + EVEL_OPTION_STRING possibleRootCause;
4444 +} EVENT_THRESHOLD_CROSS;
4447 +/**************************************************************************//**
4448 + * Create a new Threshold Crossing Alert event.
4450 + * @note The mandatory fields on the TCA must be supplied to this factory
4451 + * function and are immutable once set. Optional fields have explicit
4452 + * setter functions, but again values may only be set once so that the
4453 + * TCA has immutable properties.
4455 + * @param event_name Unique Event Name
4456 + * @param event_id A universal identifier of the event for analysis etc
4457 + * @param char* tcriticality Performance Counter Criticality MAJ MIN,
4458 + * @param char* tname Performance Counter Threshold name
4459 + * @param char* tthresholdCrossed Counter Threshold crossed value
4460 + * @param char* tvalue Counter actual value
4461 + * @param EVEL_EVENT_ACTION talertAction Alert set continue or clear
4462 + * @param char* talertDescription
4463 + * @param EVEL_ALERT_TYPE talertType Kind of anamoly
4464 + * @param unsigned long long tcollectionTimestamp time at which alert was collected
4465 + * @param EVEL_SEVERITIES teventSeverity Severity of Alert
4466 + * @param unsigned long long teventStartTimestamp Time when this alert started
4468 + * @returns pointer to the newly manufactured ::EVENT_THRESHOLD_CROSS. If the
4469 + * event is not used it must be released using
4470 + * ::evel_free_threshold_cross
4471 + * @retval NULL Failed to create the event.
4472 + *****************************************************************************/
4473 +EVENT_THRESHOLD_CROSS * evel_new_threshold_cross(
4474 + const char* ev_name, const char *ev_id,
4475 + char * tcriticality,
4477 + char * tthresholdCrossed,
4479 + EVEL_EVENT_ACTION talertAction,
4480 + char * talertDescription,
4481 + EVEL_ALERT_TYPE talertType,
4482 + unsigned long long tcollectionTimestamp,
4483 + EVEL_SEVERITIES teventSeverity,
4484 + unsigned long long teventStartTimestamp);
4486 +/**************************************************************************//**
4487 + * Free a Threshold cross event.
4489 + * Free off the Threshold crossing event supplied. Will free all the contained allocated
4492 + * @note It does not free the Threshold Cross itself, since that may be part of a
4493 + * larger structure.
4494 + *****************************************************************************/
4495 +void evel_free_threshold_cross(EVENT_THRESHOLD_CROSS * const tcp);
4497 +/**************************************************************************//**
4498 + * Set the Event Type property of the Threshold Cross.
4500 + * @note The property is treated as immutable: it is only valid to call
4501 + * the setter once. However, we don't assert if the caller tries to
4502 + * overwrite, just ignoring the update instead.
4504 + * @param tcp Pointer to the ::EVENT_THRESHOLD_CROSS.
4505 + * @param type The Event Type to be set. ASCIIZ string. The caller
4506 + * does not need to preserve the value once the function
4508 + *****************************************************************************/
4509 +void evel_threshold_cross_type_set(EVENT_THRESHOLD_CROSS * const tcp, char * type);
4511 +/**************************************************************************//**
4512 + * Add an optional additional alertid value to Alert.
4514 + * @param alertid Adds Alert ID
4515 + *****************************************************************************/
4516 +void evel_threshold_cross_alertid_add(EVENT_THRESHOLD_CROSS * const event,char * alertid);
4518 + /**************************************************************************//**
4519 + * Set the TCA probable Root cause.
4521 + * @param sheader Possible root cause to Threshold
4522 + *****************************************************************************/
4523 + void evel_threshold_cross_possible_rootcause_set(EVENT_THRESHOLD_CROSS * const event, char * sheader);
4524 + /**************************************************************************//**
4525 + * Set the TCA networking cause.
4527 + * @param sheader Possible networking service value to Threshold
4528 + *****************************************************************************/
4529 + void evel_threshold_cross_networkservice_set(EVENT_THRESHOLD_CROSS * const event, char * sheader);
4530 + /**************************************************************************//**
4531 + * Set the TCA Interface name.
4533 + * @param sheader Interface name to threshold
4534 + *****************************************************************************/
4535 + void evel_threshold_cross_interfacename_set(EVENT_THRESHOLD_CROSS * const event,char * sheader);
4536 + /**************************************************************************//**
4537 + * Set the TCA Data element type.
4539 + * @param sheader element type of Threshold
4540 + *****************************************************************************/
4541 + void evel_threshold_cross_data_elementtype_set(EVENT_THRESHOLD_CROSS * const event,char * sheader);
4542 + /**************************************************************************//**
4543 + * Set the TCA Data collector value.
4545 + * @param sheader Data collector value
4546 + *****************************************************************************/
4547 + void evel_threshold_cross_data_collector_set(EVENT_THRESHOLD_CROSS * const event,char * sheader);
4548 + /**************************************************************************//**
4549 + * Set the TCA alert value.
4551 + * @param sheader Possible alert value
4552 + *****************************************************************************/
4553 + void evel_threshold_cross_alertvalue_set(EVENT_THRESHOLD_CROSS * const event,char * sheader);
4555 +/**************************************************************************//**
4556 + * Add an additional field name/value pair to the THRESHOLD CROSS event.
4558 + * The name and value are null delimited ASCII strings. The library takes
4559 + * a copy so the caller does not have to preserve values after the function
4562 + * @param state_change Pointer to the ::EVENT_THRESHOLD_CROSS.
4563 + * @param name ASCIIZ string with the attribute's name. The caller
4564 + * does not need to preserve the value once the function
4566 + * @param value ASCIIZ string with the attribute's value. The caller
4567 + * does not need to preserve the value once the function
4569 + *****************************************************************************/
4570 +void evel_threshold_cross_addl_info_add(EVENT_THRESHOLD_CROSS * const tcp,
4571 + const char * const name,
4572 + const char * const value);
4574 +/*****************************************************************************/
4575 +/*****************************************************************************/
4579 +/*****************************************************************************/
4580 +/*****************************************************************************/
4582 +/*****************************************************************************/
4583 +/* Debug macros. */
4584 +/*****************************************************************************/
4585 +#define EVEL_DEBUG(FMT, ...) log_debug(EVEL_LOG_DEBUG, (FMT), ##__VA_ARGS__)
4586 +#define EVEL_INFO(FMT, ...) log_debug(EVEL_LOG_INFO, (FMT), ##__VA_ARGS__)
4587 +#define EVEL_SPAMMY(FMT, ...) log_debug(EVEL_LOG_SPAMMY, (FMT), ##__VA_ARGS__)
4588 +#define EVEL_ERROR(FMT, ...) log_debug(EVEL_LOG_ERROR, "ERROR: " FMT, \
4590 +#define EVEL_ENTER() \
4592 + log_debug(EVEL_LOG_DEBUG, "Enter %s {", __FUNCTION__); \
4593 + debug_indent += 2; \
4595 +#define EVEL_EXIT() \
4597 + debug_indent -= 2; \
4598 + log_debug(EVEL_LOG_DEBUG, "Exit %s }", __FUNCTION__); \
4601 +#define INDENT_SEPARATORS \
4602 + "| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "
4604 +extern EVEL_LOG_LEVELS debug_level;
4605 +extern int debug_indent;
4606 +extern FILE * fout;
4608 +#define EVEL_DEBUG_ON() ((debug_level) >= EVEL_LOG_DEBUG)
4610 +/**************************************************************************//**
4611 + * Initialize logging
4613 + * @param[in] level The debugging level - one of ::EVEL_LOG_LEVELS.
4614 + * @param[in] ident The identifier for our logs.
4615 + *****************************************************************************/
4616 +void log_initialize(EVEL_LOG_LEVELS level, const char * ident);
4618 +/**************************************************************************//**
4619 + * Log debug information
4621 + * Logs debugging information in a platform independent manner.
4623 + * @param[in] level The debugging level - one of ::EVEL_LOG_LEVELS.
4624 + * @param[in] format Log formatting string in printf format.
4625 + * @param[in] ... Variable argument list.
4626 + *****************************************************************************/
4627 +void log_debug(EVEL_LOG_LEVELS level, char * format, ...);
4629 +/***************************************************************************//*
4630 + * Store the formatted string into the static error string and log the error.
4632 + * @param format Error string in standard printf format.
4633 + * @param ... Variable parameters to be substituted into the format string.
4634 + *****************************************************************************/
4635 +void log_error_state(char * format, ...);
4643 diff --git a/src/plugins/ves/include/evel_internal.h b/src/plugins/ves/include/evel_internal.h
4644 new file mode 100644
4645 index 00000000..46f71af1
4647 +++ b/src/plugins/ves/include/evel_internal.h
4649 +/*************************************************************************//**
4651 + * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
4653 + * Licensed under the Apache License, Version 2.0 (the "License");
4654 + * you may not use this file except in compliance with the License.
4655 + * You may obtain a copy of the License at
4656 + * http://www.apache.org/licenses/LICENSE-2.0
4658 + * Unless required by applicable law or agreed to in writing, software
4659 + * distributed under the License is distributed on an "AS IS" BASIS,
4660 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4661 + * See the License for the specific language governing permissions and
4662 + * limitations under the License.
4664 + ****************************************************************************/
4665 +/**************************************************************************//**
4667 + * EVEL internal definitions.
4669 + * These are internal definitions which need to be shared between modules
4670 + * within the library but are not intended for external consumption.
4672 + ****************************************************************************/
4674 +#ifndef EVEL_INTERNAL_INCLUDED
4675 +#define EVEL_INTERNAL_INCLUDED
4679 +/*****************************************************************************/
4680 +/* Define some type-safe min/max macros. */
4681 +/*****************************************************************************/
4683 + ({ __typeof__ (a) _a = (a); \
4684 + __typeof__ (b) _b = (b); \
4685 + _a > _b ? _a : _b; })
4688 + ({ __typeof__ (a) _a = (a); \
4689 + __typeof__ (b) _b = (b); \
4690 + _a < _b ? _a : _b; })
4693 +/**************************************************************************//**
4694 + * Compile-time assertion.
4695 + *****************************************************************************/
4696 +#define EVEL_CT_ASSERT(X) switch (0) {case 0: case (X):;}
4698 +/**************************************************************************//**
4699 + * The Functional Role of the equipment represented by this VNF.
4700 + *****************************************************************************/
4701 +extern char * functional_role;
4703 +/**************************************************************************//**
4704 + * The type of equipment represented by this VNF.
4705 + *****************************************************************************/
4706 +extern EVEL_SOURCE_TYPES event_source_type;
4708 +/**************************************************************************//**
4709 + * A chunk of memory used in the cURL functions.
4710 + *****************************************************************************/
4711 +typedef struct memory_chunk {
4716 +/**************************************************************************//**
4717 + * Global commands that may be sent to the Event Handler thread.
4718 + *****************************************************************************/
4720 + EVT_CMD_TERMINATE,
4721 + EVT_CMD_MAX_COMMANDS
4722 +} EVT_HANDLER_COMMAND;
4724 +/**************************************************************************//**
4725 + * State of the Event Handler thread.
4726 + *****************************************************************************/
4728 + EVT_HANDLER_UNINITIALIZED, /** The library cannot handle events. */
4729 + EVT_HANDLER_INACTIVE, /** The event handler thread not started. */
4730 + EVT_HANDLER_ACTIVE, /** The event handler thread is started. */
4731 + EVT_HANDLER_REQUEST_TERMINATE, /** Initial stages of shutdown. */
4732 + EVT_HANDLER_TERMINATING, /** The ring-buffer is being depleted. */
4733 + EVT_HANDLER_TERMINATED, /** The library is exited. */
4734 + EVT_HANDLER_MAX_STATES /** Maximum number of valid states. */
4735 +} EVT_HANDLER_STATE;
4737 +/**************************************************************************//**
4739 + * Pseudo-event used for routing internal commands.
4740 + *****************************************************************************/
4741 +typedef struct event_internal {
4742 + EVENT_HEADER header;
4743 + EVT_HANDLER_COMMAND command;
4746 +/**************************************************************************//**
4747 + * Suppressed NV pairs list entry.
4748 + * JSON equivalent field: suppressedNvPairs
4749 + *****************************************************************************/
4750 +typedef struct evel_suppressed_nv_pairs {
4752 + /***************************************************************************/
4753 + /* Mandatory fields */
4754 + /* JSON equivalent field: nvPairFieldName */
4755 + /***************************************************************************/
4756 + char * nv_pair_field_name;
4758 + /***************************************************************************/
4759 + /* Optional fields */
4760 + /* JSON equivalent field: suppressedNvPairNames */
4761 + /* Type of each list entry: char * */
4762 + /***************************************************************************/
4763 + DLIST suppressed_nv_pair_names;
4765 + /***************************************************************************/
4766 + /* Hash table containing suppressed_nv_pair_names as keys. */
4767 + /***************************************************************************/
4768 + struct hsearch_data * hash_nv_pair_names;
4770 +} EVEL_SUPPRESSED_NV_PAIRS;
4772 +/**************************************************************************//**
4773 + * Event Throttling Specification for a domain which is in a throttled state.
4774 + * JSON equivalent object: eventThrottlingState
4775 + *****************************************************************************/
4776 +typedef struct evel_throttle_spec {
4778 + /***************************************************************************/
4779 + /* List of field names to be suppressed. */
4780 + /* JSON equivalent field: suppressedFieldNames */
4781 + /* Type of each list entry: char * */
4782 + /***************************************************************************/
4783 + DLIST suppressed_field_names;
4785 + /***************************************************************************/
4786 + /* List of name-value pairs to be suppressed. */
4787 + /* JSON equivalent field: suppressedNvPairsList */
4788 + /* Type of each list entry: EVEL_SUPPRESSED_NV_PAIRS * */
4789 + /***************************************************************************/
4790 + DLIST suppressed_nv_pairs_list;
4792 + /***************************************************************************/
4793 + /* Hash table containing suppressed_nv_pair_names as keys. */
4794 + /***************************************************************************/
4795 + struct hsearch_data * hash_field_names;
4797 + /***************************************************************************/
4798 + /* Hash table containing nv_pair_field_name as keys, and */
4799 + /* suppressed_nv_pairs_list as values. */
4800 + /***************************************************************************/
4801 + struct hsearch_data * hash_nv_pairs_list;
4803 +} EVEL_THROTTLE_SPEC;
4805 +/*****************************************************************************/
4806 +/* RFC2822 format string for strftime. */
4807 +/*****************************************************************************/
4808 +#define EVEL_RFC2822_STRFTIME_FORMAT "%a, %d %b %Y %T %z"
4810 +/*****************************************************************************/
4811 +/* EVEL_JSON_BUFFER depth at which we throttle fields. */
4812 +/*****************************************************************************/
4813 +#define EVEL_THROTTLE_FIELD_DEPTH 3
4815 +/**************************************************************************//**
4816 + * Initialize the event handler.
4818 + * Primarily responsible for getting cURL ready for use.
4820 + * @param[in] event_api_url
4821 + * The URL where the Vendor Event Listener API is expected
4823 + * @param[in] throt_api_url
4824 + * The URL where the Throttling API is expected to be.
4825 + * @param[in] username The username for the Basic Authentication of requests.
4826 + * @param[in] password The password for the Basic Authentication of requests.
4827 + * @param verbosity 0 for normal operation, positive values for chattier
4829 + *****************************************************************************/
4830 +EVEL_ERR_CODES event_handler_initialize(const char * const event_api_url,
4831 + const char * const throt_api_url,
4832 + const char * const username,
4833 + const char * const password,
4836 +/**************************************************************************//**
4837 + * Terminate the event handler.
4839 + * Shuts down the event handler thread in as clean a way as possible. Sets the
4840 + * global exit flag and then signals the thread to interrupt it since it's
4841 + * most likely waiting on the ring-buffer.
4843 + * Having achieved an orderly shutdown of the event handler thread, clean up
4844 + * the cURL library's resources cleanly.
4846 + * @return Status code.
4847 + * @retval ::EVEL_SUCCESS if everything OK.
4848 + * @retval One of ::EVEL_ERR_CODES if there was a problem.
4849 + *****************************************************************************/
4850 +EVEL_ERR_CODES event_handler_terminate();
4852 +/**************************************************************************//**
4853 + * Run the event handler.
4855 + * Spawns the thread responsible for handling events and sending them to the
4858 + * @return Status code.
4859 + * @retval ::EVEL_SUCCESS if everything OK.
4860 + * @retval One of ::EVEL_ERR_CODES if there was a problem.
4861 + *****************************************************************************/
4862 +EVEL_ERR_CODES event_handler_run();
4864 +/**************************************************************************//**
4865 + * Create a new internal event.
4867 + * @note The mandatory fields on the Fault must be supplied to this factory
4868 + * function and are immutable once set. Optional fields have explicit
4869 + * setter functions, but again values may only be set once so that the
4870 + * Fault has immutable properties.
4871 + * @param command The condition indicated by the event.
4872 + * @returns pointer to the newly manufactured ::EVENT_INTERNAL. If the event
4873 + * is not used (i.e. posted) it must be released using
4874 + * ::evel_free_event.
4875 + * @retval NULL Failed to create the event.
4876 + *****************************************************************************/
4877 +EVENT_INTERNAL * evel_new_internal_event(EVT_HANDLER_COMMAND command,const char* ev_name, const char *ev_id);
4879 +/**************************************************************************//**
4880 + * Free an internal event.
4882 + * Free off the event supplied. Will free all the contained* allocated memory.
4884 + * @note It does not free the internal event itself, since that may be part of
4885 + * a larger structure.
4886 + *****************************************************************************/
4887 +void evel_free_internal_event(EVENT_INTERNAL * event);
4889 +/*****************************************************************************/
4890 +/* Structure to hold JSON buffer and associated tracking, as it is written. */
4891 +/*****************************************************************************/
4892 +typedef struct evel_json_buffer
4898 + /***************************************************************************/
4899 + /* The working throttle specification, which can be NULL. */
4900 + /***************************************************************************/
4901 + EVEL_THROTTLE_SPEC * throttle_spec;
4903 + /***************************************************************************/
4904 + /* Current object/list nesting depth. */
4905 + /***************************************************************************/
4908 + /***************************************************************************/
4909 + /* The checkpoint. */
4910 + /***************************************************************************/
4913 +} EVEL_JSON_BUFFER;
4915 +/**************************************************************************//**
4916 + * Encode the event as a JSON event object according to AT&T's schema.
4918 + * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
4919 + * @param event Pointer to the ::EVENT_HEADER to encode.
4920 + *****************************************************************************/
4921 +void evel_json_encode_header(EVEL_JSON_BUFFER * jbuf,
4922 + EVENT_HEADER * event);
4924 +/**************************************************************************//**
4925 + * Encode the fault in JSON according to AT&T's schema for the fault type.
4927 + * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
4928 + * @param event Pointer to the ::EVENT_HEADER to encode.
4929 + *****************************************************************************/
4930 +void evel_json_encode_fault(EVEL_JSON_BUFFER * jbuf,
4931 + EVENT_FAULT * event);
4933 +/**************************************************************************//**
4934 + * Encode the measurement as a JSON measurement.
4936 + * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
4937 + * @param event Pointer to the ::EVENT_HEADER to encode.
4938 + *****************************************************************************/
4939 +void evel_json_encode_measurement(EVEL_JSON_BUFFER * jbuf,
4940 + EVENT_MEASUREMENT * event);
4942 +/**************************************************************************//**
4943 + * Encode the Mobile Flow in JSON according to AT&T's schema for the event
4946 + * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
4947 + * @param event Pointer to the ::EVENT_HEADER to encode.
4948 + *****************************************************************************/
4949 +void evel_json_encode_mobile_flow(EVEL_JSON_BUFFER * jbuf,
4950 + EVENT_MOBILE_FLOW * event);
4952 +/**************************************************************************//**
4953 + * Encode the report as a JSON report.
4955 + * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
4956 + * @param event Pointer to the ::EVENT_HEADER to encode.
4957 + *****************************************************************************/
4958 +void evel_json_encode_report(EVEL_JSON_BUFFER * jbuf,
4959 + EVENT_REPORT * event);
4961 +/**************************************************************************//**
4962 + * Encode the Heartbeat fields in JSON according to AT&T's schema for the
4965 + * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
4966 + * @param event Pointer to the ::EVENT_HEADER to encode.
4967 + *****************************************************************************/
4968 +void evel_json_encode_hrtbt_field(EVEL_JSON_BUFFER * const jbuf,
4969 + EVENT_HEARTBEAT_FIELD * const event);
4971 +/**************************************************************************//**
4972 + * Encode the Signaling in JSON according to AT&T's schema for the event type.
4974 + * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
4975 + * @param event Pointer to the ::EVENT_HEADER to encode.
4976 + *****************************************************************************/
4977 +void evel_json_encode_signaling(EVEL_JSON_BUFFER * const jbuf,
4978 + EVENT_SIGNALING * const event);
4980 +/**************************************************************************//**
4981 + * Encode the state change as a JSON state change.
4983 + * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
4984 + * @param state_change Pointer to the ::EVENT_STATE_CHANGE to encode.
4985 + *****************************************************************************/
4986 +void evel_json_encode_state_change(EVEL_JSON_BUFFER * jbuf,
4987 + EVENT_STATE_CHANGE * state_change);
4989 +/**************************************************************************//**
4990 + * Encode the Syslog in JSON according to AT&T's schema for the event type.
4992 + * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
4993 + * @param event Pointer to the ::EVENT_HEADER to encode.
4994 + *****************************************************************************/
4995 +void evel_json_encode_syslog(EVEL_JSON_BUFFER * jbuf,
4996 + EVENT_SYSLOG * event);
4998 +/**************************************************************************//**
4999 + * Encode the Other in JSON according to AT&T's schema for the event type.
5001 + * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
5002 + * @param event Pointer to the ::EVENT_HEADER to encode.
5003 + *****************************************************************************/
5004 +void evel_json_encode_other(EVEL_JSON_BUFFER * jbuf,
5005 + EVENT_OTHER * event);
5007 +/**************************************************************************//**
5008 + * Set the next event_sequence to use.
5010 + * @param sequence The next sequence number to use.
5011 + *****************************************************************************/
5012 +void evel_set_next_event_sequence(const int sequence);
5014 +/**************************************************************************//**
5015 + * Handle a JSON response from the listener, contained in a ::MEMORY_CHUNK.
5017 + * Tokenize the response, and decode any tokens found.
5019 + * @param chunk The memory chunk containing the response.
5020 + * @param post The memory chunk in which to place any resulting POST.
5021 + *****************************************************************************/
5022 +void evel_handle_event_response(const MEMORY_CHUNK * const chunk,
5023 + MEMORY_CHUNK * const post);
5025 +/**************************************************************************//**
5026 + * Initialize a ::EVEL_JSON_BUFFER.
5028 + * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to initialise.
5029 + * @param json Pointer to the underlying working buffer to use.
5030 + * @param max_size Size of storage available in the JSON buffer.
5031 + * @param throttle_spec Pointer to throttle specification. Can be NULL.
5032 + *****************************************************************************/
5033 +void evel_json_buffer_init(EVEL_JSON_BUFFER * jbuf,
5034 + char * const json,
5035 + const int max_size,
5036 + EVEL_THROTTLE_SPEC * throttle_spec);
5038 +/**************************************************************************//**
5039 + * Encode a string key and string value to a ::EVEL_JSON_BUFFER.
5041 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5042 + * @param key Pointer to the key to encode.
5043 + * @param option Pointer to holder of the corresponding value to encode.
5044 + * @return true if the key, value was added, false if it was suppressed.
5045 + *****************************************************************************/
5046 +bool evel_enc_kv_opt_string(EVEL_JSON_BUFFER * jbuf,
5047 + const char * const key,
5048 + const EVEL_OPTION_STRING * const option);
5050 +/**************************************************************************//**
5051 + * Encode a string key and string value to a ::EVEL_JSON_BUFFER.
5053 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5054 + * @param key Pointer to the key to encode.
5055 + * @param value Pointer to the corresponding value to encode.
5056 + *****************************************************************************/
5057 +void evel_enc_kv_string(EVEL_JSON_BUFFER * jbuf,
5058 + const char * const key,
5059 + const char * const value);
5061 +/**************************************************************************//**
5062 + * Encode a string key and integer value to a ::EVEL_JSON_BUFFER.
5064 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5065 + * @param key Pointer to the key to encode.
5066 + * @param option Pointer to holder of the corresponding value to encode.
5067 + * @return true if the key, value was added, false if it was suppressed.
5068 + *****************************************************************************/
5069 +bool evel_enc_kv_opt_int(EVEL_JSON_BUFFER * jbuf,
5070 + const char * const key,
5071 + const EVEL_OPTION_INT * const option);
5073 +/**************************************************************************//**
5074 + * Encode a string key and integer value to a ::EVEL_JSON_BUFFER.
5076 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5077 + * @param key Pointer to the key to encode.
5078 + * @param value The corresponding value to encode.
5079 + *****************************************************************************/
5080 +void evel_enc_kv_int(EVEL_JSON_BUFFER * jbuf,
5081 + const char * const key,
5084 +/**************************************************************************//**
5085 + * Encode a string key and double value to a ::EVEL_JSON_BUFFER.
5087 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5088 + * @param key Pointer to the key to encode.
5089 + * @param option Pointer to holder of the corresponding value to encode.
5090 + * @return true if the key, value was added, false if it was suppressed.
5091 + *****************************************************************************/
5092 +bool evel_enc_kv_opt_double(EVEL_JSON_BUFFER * jbuf,
5093 + const char * const key,
5094 + const EVEL_OPTION_DOUBLE * const option);
5096 +/**************************************************************************//**
5097 + * Encode a string key and double value to a ::EVEL_JSON_BUFFER.
5099 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5100 + * @param key Pointer to the key to encode.
5101 + * @param value The corresponding value to encode.
5102 + *****************************************************************************/
5103 +void evel_enc_kv_double(EVEL_JSON_BUFFER * jbuf,
5104 + const char * const key,
5105 + const double value);
5107 +/**************************************************************************//**
5108 + * Encode a string key and unsigned long long value to a ::EVEL_JSON_BUFFER.
5110 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5111 + * @param key Pointer to the key to encode.
5112 + * @param option Pointer to holder of the corresponding value to encode.
5113 + * @return true if the key, value was added, false if it was suppressed.
5114 + *****************************************************************************/
5115 +bool evel_enc_kv_opt_ull(EVEL_JSON_BUFFER * jbuf,
5116 + const char * const key,
5117 + const EVEL_OPTION_ULL * const option);
5119 +/**************************************************************************//**
5120 + * Encode a string key and unsigned long long value to a ::EVEL_JSON_BUFFER.
5122 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5123 + * @param key Pointer to the key to encode.
5124 + * @param value The corresponding value to encode.
5125 + *****************************************************************************/
5126 +void evel_enc_kv_ull(EVEL_JSON_BUFFER * jbuf,
5127 + const char * const key,
5128 + const unsigned long long value);
5130 +/**************************************************************************//**
5131 + * Encode a string key and time value to a ::EVEL_JSON_BUFFER.
5133 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5134 + * @param key Pointer to the key to encode.
5135 + * @param option Pointer to holder of the corresponding value to encode.
5136 + * @return true if the key, value was added, false if it was suppressed.
5137 + *****************************************************************************/
5138 +bool evel_enc_kv_opt_time(EVEL_JSON_BUFFER * jbuf,
5139 + const char * const key,
5140 + const EVEL_OPTION_TIME * const option);
5142 +/**************************************************************************//**
5143 + * Encode a string key and time value to a ::EVEL_JSON_BUFFER.
5145 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5146 + * @param key Pointer to the key to encode.
5147 + * @param time Pointer to the time to encode.
5148 + *****************************************************************************/
5149 +void evel_enc_kv_time(EVEL_JSON_BUFFER * jbuf,
5150 + const char * const key,
5151 + const time_t * time);
5153 +/**************************************************************************//**
5154 + * Encode a key and version.
5156 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5157 + * @param key Pointer to the key to encode.
5158 + * @param major_version The major version to encode.
5159 + * @param minor_version The minor version to encode.
5160 + *****************************************************************************/
5161 +void evel_enc_version(EVEL_JSON_BUFFER * jbuf,
5162 + const char * const key,
5163 + const int major_version,
5164 + const int minor_version);
5166 +/**************************************************************************//**
5167 + * Add the key and opening bracket of an optional named list to a JSON buffer.
5169 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5170 + * @param key Pointer to the key to encode.
5171 + * @return true if the list was opened, false if it was suppressed.
5172 + *****************************************************************************/
5173 +bool evel_json_open_opt_named_list(EVEL_JSON_BUFFER * jbuf,
5174 + const char * const key);
5176 +/**************************************************************************//**
5177 + * Add the key and opening bracket of a named list to a JSON buffer.
5179 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5180 + * @param key Pointer to the key to encode.
5181 + *****************************************************************************/
5182 +void evel_json_open_named_list(EVEL_JSON_BUFFER * jbuf,
5183 + const char * const key);
5185 +/**************************************************************************//**
5186 + * Add the closing bracket of a list to a JSON buffer.
5188 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5189 + *****************************************************************************/
5190 +void evel_json_close_list(EVEL_JSON_BUFFER * jbuf);
5192 +/**************************************************************************//**
5193 + * Encode a list item with format and param list to a ::EVEL_JSON_BUFFER.
5195 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5196 + * @param format Format string in standard printf format.
5197 + * @param ... Variable parameters for format string.
5198 + *****************************************************************************/
5199 +void evel_enc_list_item(EVEL_JSON_BUFFER * jbuf,
5200 + const char * const format,
5203 +/**************************************************************************//**
5204 + * Add the opening bracket of an optional named object to a JSON buffer.
5206 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5207 + * @param key Pointer to the key to encode.
5208 + *****************************************************************************/
5209 +bool evel_json_open_opt_named_object(EVEL_JSON_BUFFER * jbuf,
5210 + const char * const key);
5212 +/**************************************************************************//**
5213 + * Add the opening bracket of an object to a JSON buffer.
5215 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5216 + * @param key Pointer to the key to encode.
5217 + * @return true if the object was opened, false if it was suppressed.
5218 + *****************************************************************************/
5219 +void evel_json_open_named_object(EVEL_JSON_BUFFER * jbuf,
5220 + const char * const key);
5222 +/**************************************************************************//**
5223 + * Add the opening bracket of an object to a JSON buffer.
5225 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5226 + *****************************************************************************/
5227 +void evel_json_open_object(EVEL_JSON_BUFFER * jbuf);
5229 +/**************************************************************************//**
5230 + * Add the closing bracket of an object to a JSON buffer.
5232 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5233 + *****************************************************************************/
5234 +void evel_json_close_object(EVEL_JSON_BUFFER * jbuf);
5236 +/**************************************************************************//**
5237 + * Add a checkpoint - a stake in the ground to which we can rewind.
5239 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5240 + *****************************************************************************/
5241 +void evel_json_checkpoint(EVEL_JSON_BUFFER * jbuf);
5243 +/**************************************************************************//**
5244 + * Rewind to the latest checkoint.
5246 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5247 + *****************************************************************************/
5248 +void evel_json_rewind(EVEL_JSON_BUFFER * jbuf);
5250 +/**************************************************************************//**
5251 + * Free the underlying resources of an ::EVEL_OPTION_STRING.
5253 + * @param option Pointer to the ::EVEL_OPTION_STRING.
5254 + *****************************************************************************/
5255 +void evel_free_option_string(EVEL_OPTION_STRING * const option);
5257 +/**************************************************************************//**
5258 + * Initialize an ::EVEL_OPTION_STRING to a not-set state.
5260 + * @param option Pointer to the ::EVEL_OPTION_STRING.
5261 + *****************************************************************************/
5262 +void evel_init_option_string(EVEL_OPTION_STRING * const option);
5264 +/**************************************************************************//**
5265 + * Set the value of an ::EVEL_OPTION_STRING.
5267 + * @param option Pointer to the ::EVEL_OPTION_STRING.
5268 + * @param value The value to set.
5269 + * @param description Description to be used in logging.
5270 + *****************************************************************************/
5271 +void evel_set_option_string(EVEL_OPTION_STRING * const option,
5272 + const char * const value,
5273 + const char * const description);
5275 +/**************************************************************************//**
5276 + * Force the value of an ::EVEL_OPTION_STRING.
5278 + * @param option Pointer to the ::EVEL_OPTION_STRING.
5279 + * @param value The value to set.
5280 + *****************************************************************************/
5281 +void evel_force_option_string(EVEL_OPTION_STRING * const option,
5282 + const char * const value);
5284 +/**************************************************************************//**
5285 + * Initialize an ::EVEL_OPTION_INT to a not-set state.
5287 + * @param option Pointer to the ::EVEL_OPTION_INT.
5288 + *****************************************************************************/
5289 +void evel_init_option_int(EVEL_OPTION_INT * const option);
5291 +/**************************************************************************//**
5292 + * Force the value of an ::EVEL_OPTION_INT.
5294 + * @param option Pointer to the ::EVEL_OPTION_INT.
5295 + * @param value The value to set.
5296 + *****************************************************************************/
5297 +void evel_force_option_int(EVEL_OPTION_INT * const option,
5300 +/**************************************************************************//**
5301 + * Set the value of an ::EVEL_OPTION_INT.
5303 + * @param option Pointer to the ::EVEL_OPTION_INT.
5304 + * @param value The value to set.
5305 + * @param description Description to be used in logging.
5306 + *****************************************************************************/
5307 +void evel_set_option_int(EVEL_OPTION_INT * const option,
5309 + const char * const description);
5311 +/**************************************************************************//**
5312 + * Initialize an ::EVEL_OPTION_DOUBLE to a not-set state.
5314 + * @param option Pointer to the ::EVEL_OPTION_DOUBLE.
5315 + *****************************************************************************/
5316 +void evel_init_option_double(EVEL_OPTION_DOUBLE * const option);
5318 +/**************************************************************************//**
5319 + * Force the value of an ::EVEL_OPTION_DOUBLE.
5321 + * @param option Pointer to the ::EVEL_OPTION_DOUBLE.
5322 + * @param value The value to set.
5323 + *****************************************************************************/
5324 +void evel_force_option_double(EVEL_OPTION_DOUBLE * const option,
5325 + const double value);
5327 +/**************************************************************************//**
5328 + * Set the value of an ::EVEL_OPTION_DOUBLE.
5330 + * @param option Pointer to the ::EVEL_OPTION_DOUBLE.
5331 + * @param value The value to set.
5332 + * @param description Description to be used in logging.
5333 + *****************************************************************************/
5334 +void evel_set_option_double(EVEL_OPTION_DOUBLE * const option,
5335 + const double value,
5336 + const char * const description);
5338 +/**************************************************************************//**
5339 + * Initialize an ::EVEL_OPTION_ULL to a not-set state.
5341 + * @param option Pointer to the ::EVEL_OPTION_ULL.
5342 + *****************************************************************************/
5343 +void evel_init_option_ull(EVEL_OPTION_ULL * const option);
5345 +/**************************************************************************//**
5346 + * Force the value of an ::EVEL_OPTION_ULL.
5348 + * @param option Pointer to the ::EVEL_OPTION_ULL.
5349 + * @param value The value to set.
5350 + *****************************************************************************/
5351 +void evel_force_option_ull(EVEL_OPTION_ULL * const option,
5352 + const unsigned long long value);
5354 +/**************************************************************************//**
5355 + * Set the value of an ::EVEL_OPTION_ULL.
5357 + * @param option Pointer to the ::EVEL_OPTION_ULL.
5358 + * @param value The value to set.
5359 + * @param description Description to be used in logging.
5360 + *****************************************************************************/
5361 +void evel_set_option_ull(EVEL_OPTION_ULL * const option,
5362 + const unsigned long long value,
5363 + const char * const description);
5365 +/**************************************************************************//**
5366 + * Initialize an ::EVEL_OPTION_TIME to a not-set state.
5368 + * @param option Pointer to the ::EVEL_OPTION_TIME.
5369 + *****************************************************************************/
5370 +void evel_init_option_time(EVEL_OPTION_TIME * const option);
5372 +/**************************************************************************//**
5373 + * Force the value of an ::EVEL_OPTION_TIME.
5375 + * @param option Pointer to the ::EVEL_OPTION_TIME.
5376 + * @param value The value to set.
5377 + *****************************************************************************/
5378 +void evel_force_option_time(EVEL_OPTION_TIME * const option,
5379 + const time_t value);
5381 +/**************************************************************************//**
5382 + * Set the value of an ::EVEL_OPTION_TIME.
5384 + * @param option Pointer to the ::EVEL_OPTION_TIME.
5385 + * @param value The value to set.
5386 + * @param description Description to be used in logging.
5387 + *****************************************************************************/
5388 +void evel_set_option_time(EVEL_OPTION_TIME * const option,
5389 + const time_t value,
5390 + const char * const description);
5392 +/**************************************************************************//**
5393 + * Map an ::EVEL_COUNTER_CRITICALITIES enum value to the equivalent string.
5395 + * @param criticality The criticality to convert.
5396 + * @returns The equivalent string.
5397 + *****************************************************************************/
5398 +char * evel_criticality(const EVEL_COUNTER_CRITICALITIES criticality);
5400 +/**************************************************************************//**
5401 + * Map an ::EVEL_SEVERITIES enum value to the equivalent string.
5403 + * @param severity The severity to convert.
5404 + * @returns The equivalent string.
5405 + *****************************************************************************/
5406 +char * evel_severity(const EVEL_SEVERITIES severity);
5408 +/**************************************************************************//**
5409 + * Map an ::EVEL_ALERT_ACTIONS enum value to the equivalent string.
5411 + * @param alert_action The alert_action to convert.
5412 + * @returns The equivalent string.
5413 + *****************************************************************************/
5414 +char * evel_alert_action(const EVEL_ALERT_ACTIONS alert_action);
5416 +/**************************************************************************//**
5417 + * Map an ::EVEL_ALERT_TYPES enum value to the equivalent string.
5419 + * @param alert_type The alert_type to convert.
5420 + * @returns The equivalent string.
5421 + *****************************************************************************/
5422 +char * evel_alert_type(const EVEL_ALERT_TYPES alert_type);
5424 +/**************************************************************************//**
5425 + * Map an ::EVEL_EVENT_DOMAINS enum value to the equivalent string.
5427 + * @param domain The domain to convert.
5428 + * @returns The equivalent string.
5429 + *****************************************************************************/
5430 +char * evel_event_domain(const EVEL_EVENT_DOMAINS domain);
5432 +/**************************************************************************//**
5433 + * Map an ::EVEL_EVENT_PRIORITIES enum value to the equivalent string.
5435 + * @param priority The priority to convert.
5436 + * @returns The equivalent string.
5437 + *****************************************************************************/
5438 +char * evel_event_priority(const EVEL_EVENT_PRIORITIES priority);
5440 +/**************************************************************************//**
5441 + * Map an ::EVEL_SOURCE_TYPES enum value to the equivalent string.
5443 + * @param source_type The source type to convert.
5444 + * @returns The equivalent string.
5445 + *****************************************************************************/
5446 +char * evel_source_type(const EVEL_SOURCE_TYPES source_type);
5448 +/**************************************************************************//**
5449 + * Map an ::EVEL_VF_STATUSES enum value to the equivalent string.
5451 + * @param vf_status The vf_status to convert.
5452 + * @returns The equivalent string.
5453 + *****************************************************************************/
5454 +char * evel_vf_status(const EVEL_VF_STATUSES vf_status);
5456 +/**************************************************************************//**
5457 + * Convert a ::EVEL_ENTITY_STATE to it's string form for JSON encoding.
5459 + * @param state The entity state to encode.
5461 + * @returns the corresponding string
5462 + *****************************************************************************/
5463 +char * evel_entity_state(const EVEL_ENTITY_STATE state);
5465 +/**************************************************************************//**
5466 + * Convert a ::EVEL_SERVICE_ENDPOINT_DESC to string form for JSON encoding.
5468 + * @param endpoint_desc endpoint description to encode.
5470 + * @returns the corresponding string
5471 + *****************************************************************************/
5472 +char * evel_service_endpoint_desc(const EVEL_ENTITY_STATE endpoint_desc);
5475 +/**************************************************************************//**
5476 + * Initialize an ::EVEL_OPTION_INTHEADER_FIELDS to a not-set state.
5478 + * @param option Pointer to the ::EVEL_OPTION_INTHEADER_FIELDS.
5479 + *****************************************************************************/
5480 +void evel_init_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option);
5481 +/**************************************************************************//**
5482 + * Force the value of an ::EVEL_OPTION_INTHEADER_FIELDS.
5484 + * @param option Pointer to the ::EVEL_OPTION_INTHEADER_FIELDS.
5485 + * @param value The value to set.
5486 + *****************************************************************************/
5487 +void evel_force_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option,
5488 + const void* value);
5489 +/**************************************************************************//**
5490 + * Set the value of an ::EVEL_OPTION_INTHEADER_FIELDS.
5492 + * @param option Pointer to the ::EVEL_OPTION_INTHEADER_FIELDS.
5493 + * @param value The value to set.
5494 + * @param description Description to be used in logging.
5495 + *****************************************************************************/
5496 +void evel_set_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option,
5497 + const void * value,
5498 + const char * const description);
5499 +/**************************************************************************//**
5500 + * Free the underlying resources of an ::EVEL_OPTION_INTHEADER_FIELDS.
5502 + * @param option Pointer to the ::EVEL_OPTION_INTHEADER_FIELDS.
5503 + *****************************************************************************/
5504 +void evel_free_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option);
5507 diff --git a/src/plugins/ves/include/evel_throttle.h b/src/plugins/ves/include/evel_throttle.h
5508 new file mode 100644
5509 index 00000000..c97b3c37
5511 +++ b/src/plugins/ves/include/evel_throttle.h
5513 +/*************************************************************************//**
5515 + * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
5517 + * Licensed under the Apache License, Version 2.0 (the "License");
5518 + * you may not use this file except in compliance with the License.
5519 + * You may obtain a copy of the License at
5520 + * http://www.apache.org/licenses/LICENSE-2.0
5522 + * Unless required by applicable law or agreed to in writing, software
5523 + * distributed under the License is distributed on an "AS IS" BASIS,
5524 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5525 + * See the License for the specific language governing permissions and
5526 + * limitations under the License.
5528 + ****************************************************************************/
5529 +/**************************************************************************//**
5531 + * EVEL throttle definitions.
5533 + * These are internal definitions related to throttling specicications, which
5534 + * are required within the library but are not intended for external
5537 + ****************************************************************************/
5539 +#ifndef EVEL_THROTTLE_INCLUDED
5540 +#define EVEL_THROTTLE_INCLUDED
5542 +#include "evel_internal.h"
5545 +/*****************************************************************************/
5546 +/* Maximum depth of JSON response that we can handle. */
5547 +/*****************************************************************************/
5548 +#define EVEL_JSON_STACK_DEPTH 10
5550 +/**************************************************************************//**
5551 + * Maximum number of tokens that we allow for in a JSON response.
5552 + *****************************************************************************/
5553 +#define EVEL_MAX_RESPONSE_TOKENS 1024
5555 +/**************************************************************************//**
5556 + * The nature of the next token that we are iterating through. Within an
5557 + * object, we alternate between collecting keys and values. Within an array,
5558 + * we only collect items.
5559 + *****************************************************************************/
5566 +/**************************************************************************//**
5567 + * States which we move through during JSON processing, tracking our way
5568 + * through the supported JSON structure.
5569 + *****************************************************************************/
5572 + /***************************************************************************/
5573 + /* Initial state. */
5574 + /***************************************************************************/
5577 + /***************************************************************************/
5578 + /* {"commandList": [ */
5579 + /***************************************************************************/
5580 + EVEL_JCS_COMMAND_LIST,
5582 + /***************************************************************************/
5583 + /* {"commandList": [{ */
5584 + /***************************************************************************/
5585 + EVEL_JCS_COMMAND_LIST_ENTRY,
5587 + /***************************************************************************/
5588 + /* {"commandList": [{"command": { */
5589 + /***************************************************************************/
5592 + /***************************************************************************/
5593 + /* ... "eventDomainThrottleSpecification": { */
5594 + /***************************************************************************/
5597 + /***************************************************************************/
5598 + /* ... "suppressedFieldNames": [ */
5599 + /***************************************************************************/
5600 + EVEL_JCS_FIELD_NAMES,
5602 + /***************************************************************************/
5603 + /* ... "suppressedNvPairsList": [ */
5604 + /***************************************************************************/
5605 + EVEL_JCS_PAIRS_LIST,
5607 + /***************************************************************************/
5608 + /* ... "suppressedNvPairsList": [{ */
5609 + /***************************************************************************/
5610 + EVEL_JCS_PAIRS_LIST_ENTRY,
5612 + /***************************************************************************/
5613 + /* ... "suppressedNvPairNames": [ */
5614 + /***************************************************************************/
5615 + EVEL_JCS_NV_PAIR_NAMES,
5618 +} EVEL_JSON_COMMAND_STATE;
5620 +/**************************************************************************//**
5621 + * An entry in the JSON stack.
5622 + *****************************************************************************/
5623 +typedef struct evel_json_stack_entry {
5625 + /***************************************************************************/
5626 + /* The number of elements required at this level. */
5627 + /***************************************************************************/
5630 + /***************************************************************************/
5631 + /* The number of elements collected at this level. */
5632 + /***************************************************************************/
5635 + /***************************************************************************/
5636 + /* The collection state at this level in the JSON stack. */
5637 + /***************************************************************************/
5638 + EVEL_JSON_STATE json_state;
5640 + /***************************************************************************/
5641 + /* The key being collected (if json_state is EVEL_JSON_VALUE), or NULL. */
5642 + /***************************************************************************/
5645 +} EVEL_JSON_STACK_ENTRY;
5647 +/**************************************************************************//**
5649 + *****************************************************************************/
5650 +typedef struct evel_json_stack {
5652 + /***************************************************************************/
5653 + /* The current position of the stack - starting at zero. */
5654 + /***************************************************************************/
5657 + /***************************************************************************/
5658 + /* The stack itself. */
5659 + /***************************************************************************/
5660 + EVEL_JSON_STACK_ENTRY entry[EVEL_JSON_STACK_DEPTH];
5662 + /***************************************************************************/
5663 + /* The underlying memory chunk. */
5664 + /***************************************************************************/
5665 + const MEMORY_CHUNK * chunk;
5669 +/**************************************************************************//**
5670 + * Initialize event throttling to the default state.
5672 + * Called from ::evel_initialize.
5673 + *****************************************************************************/
5674 +void evel_throttle_initialize();
5676 +/**************************************************************************//**
5677 + * Clean up event throttling.
5679 + * Called from ::evel_terminate.
5680 + *****************************************************************************/
5681 +void evel_throttle_terminate();
5683 +/**************************************************************************//**
5684 + * Handle a JSON response from the listener, as a list of tokens from JSMN.
5686 + * @param chunk Memory chunk containing the JSON buffer.
5687 + * @param json_tokens Array of tokens to handle.
5688 + * @param num_tokens The number of tokens to handle.
5689 + * @param post The memory chunk in which to place any resulting POST.
5690 + * @return true if the command was handled, false otherwise.
5691 + *****************************************************************************/
5692 +bool evel_handle_command_list(const MEMORY_CHUNK * const chunk,
5693 + const jsmntok_t * const json_tokens,
5694 + const int num_tokens,
5695 + MEMORY_CHUNK * const post);
5697 +/**************************************************************************//**
5698 + * Return the ::EVEL_THROTTLE_SPEC for a given domain.
5700 + * @param domain The domain for which to return state.
5701 + *****************************************************************************/
5702 +EVEL_THROTTLE_SPEC * evel_get_throttle_spec(EVEL_EVENT_DOMAINS domain);
5704 +/**************************************************************************//**
5705 + * Determine whether a field_name should be suppressed.
5707 + * @param throttle_spec Throttle specification for the domain being encoded.
5708 + * @param field_name The field name to encoded or suppress.
5709 + * @return true if the field_name should be suppressed, false otherwise.
5710 + *****************************************************************************/
5711 +bool evel_throttle_suppress_field(EVEL_THROTTLE_SPEC * throttle_spec,
5712 + const char * const field_name);
5714 +/**************************************************************************//**
5715 + * Determine whether a name-value pair should be allowed (not suppressed).
5717 + * @param throttle_spec Throttle specification for the domain being encoded.
5718 + * @param field_name The field name holding the name-value pairs.
5719 + * @param name The name of the name-value pair to encoded or suppress.
5720 + * @return true if the name-value pair should be suppressed, false otherwise.
5721 + *****************************************************************************/
5722 +bool evel_throttle_suppress_nv_pair(EVEL_THROTTLE_SPEC * throttle_spec,
5723 + const char * const field_name,
5724 + const char * const name);
5727 diff --git a/src/plugins/ves/include/hashtable.h b/src/plugins/ves/include/hashtable.h
5728 new file mode 100644
5729 index 00000000..8be17dc1
5731 +++ b/src/plugins/ves/include/hashtable.h
5733 +#ifndef HASHTABLE_INCLUDED
5734 +#define HASHTABLE_INCLUDED
5736 +/*************************************************************************//**
5738 + * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
5740 + * Licensed under the Apache License, Version 2.0 (the "License");
5741 + * you may not use this file except in compliance with the License.
5742 + * You may obtain a copy of the License at
5743 + * http://www.apache.org/licenses/LICENSE-2.0
5745 + * Unless required by applicable law or agreed to in writing, software
5746 + * distributed under the License is distributed on an "AS IS" BASIS,
5747 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5748 + * See the License for the specific language governing permissions and
5749 + * limitations under the License.
5751 + ****************************************************************************/
5753 +/**************************************************************************//**
5755 + * A simple hashtable.
5757 + * @note No thread protection so you will need to use appropriate
5758 + * synchronization if use spans multiple threads.
5759 +*****************************************************************************/
5761 +typedef struct entry_s {
5764 + struct entry_s *next;
5767 +/**************************************************************************//**
5768 + * Hashtable structure
5769 + *****************************************************************************/
5771 +typedef struct hashtable_s {
5773 + struct entry_s **table;
5776 +/**************************************************************************//**
5777 + * Hashtable initialization.
5779 + * Initialize the list supplied to be empty.
5781 + * @param size Size of hashtable
5783 + * @returns Hashtable pointer
5784 +******************************************************************************/
5785 +/* Create a new hashtable. */
5786 +HASHTABLE_T *ht_create( size_t size );
5788 +/**************************************************************************//**
5789 + * Hash a string for a particular hash table.
5791 + * Initialize the list supplied to be empty.
5793 + * @param hashtable Pointer to the hashtable
5794 + * @param key String
5796 + * @returns hashvalue
5797 +******************************************************************************/
5798 +size_t ht_hash( HASHTABLE_T *hashtable, char *key );
5800 +/**************************************************************************//**
5801 + * Create a key-value pair.
5803 + * @param key key string
5804 + * @param value value string
5806 + * @returns hashtable entry
5807 +******************************************************************************/
5808 +ENTRY_T *ht_newpair( char *key, void *value );
5810 +/**************************************************************************//**
5811 + * Insert a key-value pair into a hash table.
5813 + * @param key key string
5814 + * @param value value string
5816 + * @returns Nothing
5817 +******************************************************************************/
5818 +void ht_set( HASHTABLE_T *hashtable, char *key, void *value );
5820 +/**************************************************************************//**
5821 + * Retrieve a key-value pair from a hash table.
5823 + * @param key key string
5825 + * @returns value string
5826 +******************************************************************************/
5827 +void *ht_get( HASHTABLE_T *hashtable, char *key );
5830 diff --git a/src/plugins/ves/include/jsmn.h b/src/plugins/ves/include/jsmn.h
5831 new file mode 100644
5832 index 00000000..4ae6d9b4
5834 +++ b/src/plugins/ves/include/jsmn.h
5836 +/*************************************************************************//**
5838 + * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
5840 + * Licensed under the Apache License, Version 2.0 (the "License");
5841 + * you may not use this file except in compliance with the License.
5842 + * You may obtain a copy of the License at
5843 + * http://www.apache.org/licenses/LICENSE-2.0
5845 + * Unless required by applicable law or agreed to in writing, software
5846 + * distributed under the License is distributed on an "AS IS" BASIS,
5847 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5848 + * See the License for the specific language governing permissions and
5849 + * limitations under the License.
5851 + ****************************************************************************/
5856 +#include <stddef.h>
5863 + * JSON type identifier. Basic types are:
5867 + * o Other primitive: number, boolean (true/false) or null
5870 + JSMN_UNDEFINED = 0,
5874 + JSMN_PRIMITIVE = 4
5878 + /* Not enough tokens were provided */
5879 + JSMN_ERROR_NOMEM = -1,
5880 + /* Invalid character inside JSON string */
5881 + JSMN_ERROR_INVAL = -2,
5882 + /* The string is not a full JSON packet, more bytes expected */
5883 + JSMN_ERROR_PART = -3
5887 + * JSON token description.
5888 + * @param type type (object, array, string etc.)
5889 + * @param start start position in JSON data string
5890 + * @param end end position in JSON data string
5897 +#ifdef JSMN_PARENT_LINKS
5903 + * JSON parser. Contains an array of token blocks available. Also stores
5904 + * the string being parsed now and current position in that string
5907 + unsigned int pos; /* offset in the JSON string */
5908 + unsigned int toknext; /* next token to allocate */
5909 + int toksuper; /* superior token node, e.g parent object or array */
5913 + * Create JSON parser over an array of tokens
5915 +void jsmn_init(jsmn_parser *parser);
5918 + * Run JSON parser. It parses a JSON data string into and array of tokens, each describing
5919 + * a single JSON object.
5921 +int jsmn_parse(jsmn_parser *parser, const char *js, size_t len,
5922 + jsmntok_t *tokens, unsigned int num_tokens);
5928 +#endif /* __JSMN_H_ */
5929 diff --git a/src/plugins/ves/include/metadata.h b/src/plugins/ves/include/metadata.h
5930 new file mode 100644
5931 index 00000000..1ee44092
5933 +++ b/src/plugins/ves/include/metadata.h
5935 +#ifndef METADATA_INCLUDED
5936 +#define METADATA_INCLUDED
5937 +/*************************************************************************//**
5939 + * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
5941 + * Licensed under the Apache License, Version 2.0 (the "License");
5942 + * you may not use this file except in compliance with the License.
5943 + * You may obtain a copy of the License at
5944 + * http://www.apache.org/licenses/LICENSE-2.0
5946 + * Unless required by applicable law or agreed to in writing, software
5947 + * distributed under the License is distributed on an "AS IS" BASIS,
5948 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5949 + * See the License for the specific language governing permissions and
5950 + * limitations under the License.
5952 + ****************************************************************************/
5954 +/**************************************************************************//**
5956 + * Wrap the OpenStack metadata service.
5958 + ****************************************************************************/
5962 +/**************************************************************************//**
5963 + * Download metadata from the OpenStack metadata service.
5965 + * @param verbosity Controls whether to generate debug to stdout. Zero:
5966 + * none. Non-zero: generate debug.
5967 + * @returns Status code
5968 + * @retval EVEL_SUCCESS On success
5969 + * @retval ::EVEL_ERR_CODES On failure.
5970 + *****************************************************************************/
5971 +EVEL_ERR_CODES openstack_metadata(int verbosity);
5973 +/**************************************************************************//**
5974 + * Initialize default values for vm_name and vm_uuid - for testing purposes.
5975 + *****************************************************************************/
5976 +void openstack_metadata_initialize();
5978 +/**************************************************************************//**
5979 + * Get the VM name provided by the metadata service.
5981 + * @returns VM name
5982 + *****************************************************************************/
5983 +const char *openstack_vm_name();
5985 +/**************************************************************************//**
5986 + * Get the VM UUID provided by the metadata service.
5988 + * @returns VM UUID
5989 + *****************************************************************************/
5990 +const char *openstack_vm_uuid();
5993 diff --git a/src/plugins/ves/include/ring_buffer.h b/src/plugins/ves/include/ring_buffer.h
5994 new file mode 100644
5995 index 00000000..1236b78b
5997 +++ b/src/plugins/ves/include/ring_buffer.h
5999 +/*************************************************************************//**
6001 + * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6003 + * Licensed under the Apache License, Version 2.0 (the "License");
6004 + * you may not use this file except in compliance with the License.
6005 + * You may obtain a copy of the License at
6006 + * http://www.apache.org/licenses/LICENSE-2.0
6008 + * Unless required by applicable law or agreed to in writing, software
6009 + * distributed under the License is distributed on an "AS IS" BASIS,
6010 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6011 + * See the License for the specific language governing permissions and
6012 + * limitations under the License.
6014 + ****************************************************************************/
6016 +#ifndef RING_BUFFER_INCLUDED
6017 +#define RING_BUFFER_INCLUDED
6019 +/**************************************************************************//**
6021 + * Ring buffer to handle message requests.
6023 + ****************************************************************************/
6025 +#include <pthread.h>
6027 +/**************************************************************************//**
6028 + * Ring buffer structure.
6029 + *****************************************************************************/
6030 +typedef struct ring_buffer
6036 + pthread_cond_t ring_cv;
6037 + pthread_mutex_t ring_mutex;
6040 +/**************************************************************************//**
6041 + * Ring buffer initialization.
6043 + * Initialize the buffer supplied to the specified size.
6045 + * @param buffer Pointer to the ring-buffer to be initialized.
6046 + * @param size How many elements to be stored in the ring-buffer.
6048 + * @returns Nothing
6049 +******************************************************************************/
6050 +void ring_buffer_initialize(ring_buffer * buffer, int size);
6052 +/**************************************************************************//**
6053 + * Read an element from a ring_buffer.
6055 + * Reads an element from the ring_buffer, advancing the next-read position.
6056 + * Operation is synchronized and therefore MT-safe. Blocks if no data is
6059 + * @param buffer Pointer to the ring-buffer to be read.
6061 + * @returns Pointer to the element read from the buffer.
6062 +******************************************************************************/
6063 +void * ring_buffer_read(ring_buffer * buffer);
6065 +/**************************************************************************//**
6066 + * Write an element into a ring_buffer.
6068 + * Writes an element into the ring_buffer, advancing the next-write position.
6069 + * Operation is synchronized and therefore MT-safe. Fails if the buffer is
6070 + * full without blocking.
6072 + * @param buffer Pointer to the ring-buffer to be written.
6073 + * @param msg Pointer to data to be stored in the ring_buffer.
6075 + * @returns Number of items written.
6076 + * @retval 1 The data was written successfully.
6077 + * @retval 0 The ring_buffer was full so no data written.
6078 +******************************************************************************/
6079 +int ring_buffer_write(ring_buffer * buffer, void * msg);
6081 +/**************************************************************************//**
6082 + * Tests whether there is data in the ring_buffer.
6084 + * Tests whether there is currently data in the ring_buffer without blocking.
6086 + * @param buffer Pointer to the ring-buffer to be tested.
6088 + * @returns Whether there is data in the ring_buffer.
6089 + * @retval 0 There isn't any data in the ring_buffer.
6090 + * @retval 1 There is data in the ring_buffer.
6091 +******************************************************************************/
6092 +int ring_buffer_is_empty(ring_buffer * buffer);
6095 diff --git a/src/plugins/ves/ves.api b/src/plugins/ves/ves.api
6096 new file mode 100644
6097 index 00000000..a7106f8d
6099 +++ b/src/plugins/ves/ves.api
6102 + * Copyright (c) 2017 Intel and/or its affiliates.
6103 + * Licensed under the Apache License, Version 2.0 (the "License");
6104 + * you may not use this file except in compliance with the License.
6105 + * You may obtain a copy of the License at:
6107 + * http://www.apache.org/licenses/LICENSE-2.0
6109 + * Unless required by applicable law or agreed to in writing, software
6110 + * distributed under the License is distributed on an "AS IS" BASIS,
6111 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6112 + * See the License for the specific language governing permissions and
6113 + * limitations under the License.
6116 +/** \brief VES Agent config add / del request
6117 + @param client_index - opaque cookie to identify the sender
6118 + @param context - sender context, to match reply w/ request
6119 + @param server_port - VES Server port
6120 + @param read_interval - Time period for each loop
6121 + @param is_add - add the config if non-zero, else delete
6122 + @param server_addr[] - server address
6124 +define ves_agent_config
6129 + u32 read_interval;
6131 + u8 server_addr[16];
6134 +/** \brief VES Agent config response
6135 + @param context - sender context, to match reply w/ request
6136 + @param retval - return code for the request
6138 +define ves_agent_config_reply
6144 +/** \brief VES Agent mode set request
6145 + @param client_index - opaque cookie to identify the sender
6146 + @param context - sender context, to match reply w/ request
6147 + @param pkt_loss_rate - Base packet loss rate if Demo Mode
6148 + @param work_mode[] - Agent's work mode, real or demo
6150 +define ves_agent_mode
6154 + u32 pkt_loss_rate;
6158 +/** \brief VES Agent Mode response
6159 + @param context - sender context, to match reply w/ request
6160 + @param retval - return code for the request
6162 +define ves_agent_mode_reply
6169 + * Local Variables:
6170 + * eval: (c-set-style "gnu")
6173 diff --git a/src/plugins/ves/ves_all_api_h.h b/src/plugins/ves/ves_all_api_h.h
6174 new file mode 100644
6175 index 00000000..72b15697
6177 +++ b/src/plugins/ves/ves_all_api_h.h
6180 + * ves_all_api_h.h - skeleton vpp engine plug-in api #include file
6182 + * Copyright (c) 2017 Intel and/or its affiliates.
6183 + * Licensed under the Apache License, Version 2.0 (the "License");
6184 + * you may not use this file except in compliance with the License.
6185 + * You may obtain a copy of the License at:
6187 + * http://www.apache.org/licenses/LICENSE-2.0
6189 + * Unless required by applicable law or agreed to in writing, software
6190 + * distributed under the License is distributed on an "AS IS" BASIS,
6191 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6192 + * See the License for the specific language governing permissions and
6193 + * limitations under the License.
6196 +#include <ves/ves.api.h>
6197 diff --git a/src/plugins/ves/ves_api.c b/src/plugins/ves/ves_api.c
6198 new file mode 100644
6199 index 00000000..7a9b8004
6201 +++ b/src/plugins/ves/ves_api.c
6204 + *------------------------------------------------------------------
6205 + * ves_api.c - ves api
6207 + * Copyright (c) 2017 Intel and/or its affiliates.
6208 + * Licensed under the Apache License, Version 2.0 (the "License");
6209 + * you may not use this file except in compliance with the License.
6210 + * You may obtain a copy of the License at:
6212 + * http://www.apache.org/licenses/LICENSE-2.0
6214 + * Unless required by applicable law or agreed to in writing, software
6215 + * distributed under the License is distributed on an "AS IS" BASIS,
6216 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6217 + * See the License for the specific language governing permissions and
6218 + * limitations under the License.
6219 + *------------------------------------------------------------------
6222 +#include <vnet/vnet.h>
6223 +#include <vlibmemory/api.h>
6225 +#include <vnet/interface.h>
6226 +#include <vnet/api_errno.h>
6227 +#include <vnet/ip/ip.h>
6228 +#include <vnet/ip/ip4.h>
6230 +#include <ves/ves_node.h>
6232 +#include <ves/ves_msg_enum.h> /* define message IDs */
6234 +#define vl_typedefs /* define message structures */
6235 +#include <ves/ves_all_api_h.h>
6238 +#define vl_endianfun /* define message structures */
6239 +#include <ves/ves_all_api_h.h>
6240 +#undef vl_endianfun
6242 +/* instantiate all the print functions we know about */
6243 +#define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
6245 +#define vl_printfun
6246 +#include <ves/ves_all_api_h.h>
6250 +#include <vlibapi/api_helper_macros.h>
6252 +#define foreach_vpe_api_msg \
6253 +_(VES_AGENT_CONFIG,ves_agent_config) \
6254 +_(VES_AGENT_MODE,ves_agent_mode)
6256 +static void vl_api_ves_agent_config_t_handler
6257 + (vl_api_ves_agent_config_t *mp)
6259 + vl_api_ves_agent_config_reply_t *rmp;
6260 + ip46_address_t server;
6263 + ip46_address_reset (&server);
6264 + clib_memcpy (&server.ip4, mp->server_addr, sizeof (server.ip4));
6266 + rv = ves_set_server(&server,
6267 + (u32) ntohl (mp->server_port),
6268 + (u32) ntohl (mp->read_interval),
6269 + (int) (mp->is_add == 0));
6271 + REPLY_MACRO (VL_API_VES_AGENT_CONFIG_REPLY);
6274 +static void vl_api_ves_agent_mode_t_handler
6275 + (vl_api_ves_agent_mode_t *mp)
6277 + vl_api_ves_agent_mode_reply_t *rmp;
6278 + ves_agent_mode_t mode = VES_AGENT_MODE_REAL;
6281 + if (!strcmp((char *)mp->work_mode, "demo")
6282 + || !strcmp((char *)mp->work_mode, "Demo")
6283 + || !strcmp((char *)mp->work_mode, "DEMO"))
6284 + mode = VES_AGENT_MODE_DEMO;
6286 + rv = ves_agent_set_mode(mode, (u32) ntohl(mp->pkt_loss_rate));
6288 + REPLY_MACRO (VL_API_VES_AGENT_MODE_REPLY);
6293 + * Add vpe's API message handlers to the table.
6294 + * vlib has alread mapped shared memory and
6295 + * added the client registration handlers.
6296 + * See .../vlib-api/vlibmemory/memclnt_vlib.c:memclnt_process()
6298 +#define vl_msg_name_crc_list
6299 +#include <ves/ves_all_api_h.h>
6300 +#undef vl_msg_name_crc_list
6303 +setup_message_id_table (api_main_t * am)
6305 +#define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
6306 + foreach_vl_msg_name_crc_ves;
6310 +static clib_error_t *
6311 +ves_api_hookup (vlib_main_t * vm)
6313 + api_main_t *am = &api_main;
6316 + vl_msg_api_set_handlers(VL_API_##N, #n, \
6317 + vl_api_##n##_t_handler, \
6318 + vl_noop_handler, \
6319 + vl_api_##n##_t_endian, \
6320 + vl_api_##n##_t_print, \
6321 + sizeof(vl_api_##n##_t), 1);
6322 + foreach_vpe_api_msg;
6326 + * Set up the (msg_name, crc, message-id) table
6328 + setup_message_id_table (am);
6333 +VLIB_API_INIT_FUNCTION (ves_api_hookup);
6336 + * fd.io coding-style-patch-verification: ON
6338 + * Local Variables:
6339 + * eval: (c-set-style "gnu")
6342 diff --git a/src/plugins/ves/ves_msg_enum.h b/src/plugins/ves/ves_msg_enum.h
6343 new file mode 100644
6344 index 00000000..6e8a5dfa
6346 +++ b/src/plugins/ves/ves_msg_enum.h
6349 + * ves_msg_enum.h - vpp engine plug-in message enumeration
6351 + * Copyright (c) 2017 Intel and/or its affiliates.
6352 + * Licensed under the Apache License, Version 2.0 (the "License");
6353 + * you may not use this file except in compliance with the License.
6354 + * You may obtain a copy of the License at:
6356 + * http://www.apache.org/licenses/LICENSE-2.0
6358 + * Unless required by applicable law or agreed to in writing, software
6359 + * distributed under the License is distributed on an "AS IS" BASIS,
6360 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6361 + * See the License for the specific language governing permissions and
6362 + * limitations under the License.
6364 +#ifndef _VES_MSG_ENUM_H_
6365 +#define _VES_MSG_ENUM_H_
6367 +#include <vppinfra/byte_order.h>
6369 +#define vl_msg_id(n,h) n,
6372 +#include <ves/ves_all_api_h.h>
6373 + /* We'll want to know how many messages IDs we need... */
6374 + VL_MSG_FIRST_AVAILABLE,
6378 +#endif /* _VES_MSG_ENUM_H_ */
6379 diff --git a/src/plugins/ves/ves_node.c b/src/plugins/ves/ves_node.c
6380 new file mode 100644
6381 index 00000000..7540dd16
6383 +++ b/src/plugins/ves/ves_node.c
6386 + * Copyright (c) 2017 Intel and/or its affiliates.
6387 + * Licensed under the Apache License, Version 2.0 (the "License");
6388 + * you may not use this file except in compliance with the License.
6389 + * You may obtain a copy of the License at:
6391 + * http://www.apache.org/licenses/LICENSE-2.0
6393 + * Unless required by applicable law or agreed to in writing, software
6394 + * distributed under the License is distributed on an "AS IS" BASIS,
6395 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6396 + * See the License for the specific language governing permissions and
6397 + * limitations under the License.
6401 +#include <stdlib.h>
6402 +#include <unistd.h>
6403 +#include <string.h>
6404 +#include <sys/time.h>
6406 +#include <vnet/plugin/plugin.h>
6407 +#include <vpp/app/version.h>
6409 +#include "ves_node.h"
6411 +#define BUFSIZE 128
6413 +typedef struct dummy_vpp_metrics_struct {
6418 +} vpp_metrics_struct;
6420 +static vlib_node_registration_t ves_agent_process_node;
6421 +vpp_metrics_struct *last_vpp_metrics;
6422 +vpp_metrics_struct *curr_vpp_metrics;
6423 +time_t start_epoch;
6425 +char hostname[BUFSIZE];
6427 +static u8 *format_ves_agent_config(u8 *s, va_list *args);
6429 +void read_vpp_metrics(vpp_metrics_struct *vpp_metrics, char *vnic) {
6430 + // Define an array of char that contains the parameters of the unix 'cut' command
6431 + char* params[] = {"-f3", "-f11", "-f4", "-f12"};
6432 + // Define the unix command to execute in order to read metrics from the vNIC
6433 + char* cmd_prefix = "sudo cat /proc/net/dev | grep \"";
6434 + char* cmd_mid = "\" | tr -s \' \' | cut -d\' \' ";
6435 + char cmd[BUFSIZE];
6436 + // Define other variables
6437 + char buf[BUFSIZE]; /* buffer used to store VPP metrics */
6438 + int temp[] = {0, 0, 0, 0}; /* temp array that contains VPP values */
6439 + FILE *fp; /* file descriptor to pipe cmd to shell */
6442 + for(i = 0; i < 4; i++) {
6444 + memset(buf, 0, BUFSIZE);
6445 + memset(cmd, 0, BUFSIZE);
6446 + // Build shell command to read metrics from the vNIC
6447 + strcat(cmd, cmd_prefix);
6448 + strcat(cmd, vnic);
6449 + strcat(cmd, cmd_mid);
6450 + strcat(cmd, params[i]);
6452 + // Open a pipe and read VPP values
6453 + if ((fp = popen(cmd, "r")) == NULL) {
6454 + printf("Error opening pipe!\n");
6458 + while (fgets(buf, BUFSIZE, fp) != NULL);
6459 + temp[i] = atoi(buf);
6462 + printf("Command not found or exited with error status\n");
6467 + // Store metrics read from the vNIC in the struct passed from the main function
6468 + vpp_metrics->bytes_in = temp[0];
6469 + vpp_metrics->bytes_out = temp[1];
6470 + vpp_metrics->packets_in = temp[2];
6471 + vpp_metrics->packets_out = temp[3];
6474 +/**************************************************************************//**
6475 + * tap live cpu stats
6476 + *****************************************************************************/
6477 +void evel_get_cpu_stats(EVENT_MEASUREMENT * measurement)
6490 + MEASUREMENT_CPU_USE *cpu_use = NULL;
6492 + /* Open the command for reading. */
6493 + //fp = popen("/bin/ls /etc/", "r");
6494 + fp = popen("/usr/bin/top -bn 2 -d 0.01 | grep '^%Cpu' | tail -n 1 ", "r");
6496 + printf("Failed to run command\n" );
6500 + /* Read the output a line at a time - output it. */
6501 + while (fgets(path, sizeof(path)-1, fp) != NULL) {
6502 + printf("%s", path+10);
6503 + sscanf(path+10," %lf us, %lf sy, %lf ni, %lf id, %lf wa, %lf hi, %lf si, %lf st",
6504 + &user,&sys,&nice,&idle,&wait,&intrpt,&softirq,&steal);
6510 + cpu_use = evel_measurement_new_cpu_use_add(measurement, "cpu1", usage);
6511 + if( cpu_use != NULL ){
6512 + evel_measurement_cpu_use_idle_set(cpu_use,idle);
6513 + //evel_measurement_cpu_use_interrupt_set(cpu_use,intrpt);
6514 + //evel_measurement_cpu_use_nice_set(cpu_use,nice);
6515 + //evel_measurement_cpu_use_softirq_set(cpu_use,softirq);
6516 + //evel_measurement_cpu_use_steal_set(cpu_use,steal);
6517 + evel_measurement_cpu_use_system_set(cpu_use,sys);
6518 + evel_measurement_cpu_use_usageuser_set(cpu_use,user);
6519 + //evel_measurement_cpu_use_wait_set(cpu_use,wait);
6520 + //evel_measurement_cpu_use_add(measurement, "cpu2", usage,idle,intrpt,nice,softirq,steal,sys,user,wait);
6525 +ves_agent_report_vnic_stats(ves_agent_main_t *vam)
6527 + EVEL_ERR_CODES evel_rc = EVEL_SUCCESS;
6528 + EVENT_MEASUREMENT* vpp_m = NULL;
6529 + EVENT_HEADER* vpp_m_header = NULL;
6530 + int bytes_in_this_round;
6531 + int bytes_out_this_round;
6532 + int packets_in_this_round;
6533 + int packets_out_this_round;
6534 + struct timeval time_val;
6536 + /* Is not enabled, do nothing */
6537 + if (vam->config.is_enabled == VES_AGENT_DISABLED) {
6541 + memset(curr_vpp_metrics, 0, sizeof(vpp_metrics_struct));
6542 + read_vpp_metrics(curr_vpp_metrics, DEFAULT_MEASURE_ETH);
6544 + if(curr_vpp_metrics->bytes_in - last_vpp_metrics->bytes_in > 0) {
6545 + bytes_in_this_round = curr_vpp_metrics->bytes_in - last_vpp_metrics->bytes_in;
6547 + bytes_in_this_round = 0;
6550 + if(curr_vpp_metrics->bytes_out - last_vpp_metrics->bytes_out > 0) {
6551 + bytes_out_this_round = curr_vpp_metrics->bytes_out - last_vpp_metrics->bytes_out;
6553 + bytes_out_this_round = 0;
6556 + if(curr_vpp_metrics->packets_in - last_vpp_metrics->packets_in > 0) {
6557 + packets_in_this_round = curr_vpp_metrics->packets_in - last_vpp_metrics->packets_in;
6559 + packets_in_this_round = 0;
6562 + if(curr_vpp_metrics->packets_out - last_vpp_metrics->packets_out > 0) {
6563 + packets_out_this_round = curr_vpp_metrics->packets_out - last_vpp_metrics->packets_out;
6565 + packets_out_this_round = 0;
6568 + vpp_m = evel_new_measurement(vam->config.read_interval, "Measurement_vGMUX", "Generic_traffic");
6569 + if(vpp_m != NULL) {
6570 + char str_pkt_loss[12];
6571 + MEASUREMENT_VNIC_PERFORMANCE * vnic_performance = NULL;
6573 + printf("New measurement report created...\n");
6575 + vnic_performance = (MEASUREMENT_VNIC_PERFORMANCE *)evel_measurement_new_vnic_performance(
6576 + DEFAULT_MEASURE_ETH, "true");
6577 + evel_meas_vnic_performance_add(vpp_m, vnic_performance);
6578 + evel_measurement_type_set(vpp_m, "HTTP request rate");
6579 + evel_measurement_request_rate_set(vpp_m, rand()%10000);
6581 + evel_vnic_performance_rx_total_pkt_delta_set(vnic_performance, packets_in_this_round);
6582 + evel_vnic_performance_tx_total_pkt_delta_set(vnic_performance, packets_out_this_round);
6584 + evel_vnic_performance_rx_octets_delta_set(vnic_performance, bytes_in_this_round);
6585 + evel_vnic_performance_tx_octets_delta_set(vnic_performance, bytes_out_this_round);
6586 + evel_get_cpu_stats(vpp_m);
6589 + evel_measurement_vnic_use_add(vpp_m, /* Pointer to the measurement */
6590 + DEFAULT_MEASURE_ETH, /* ASCII string with the vNIC's ID */
6591 + packets_in_this_round, /* Packets received */
6592 + packets_out_this_round, /* Packets transmitted */
6593 + 0, /* Broadcast packets received */
6594 + 0, /* Broadcast packets transmitted */
6595 + bytes_in_this_round, /* Total bytes received */
6596 + bytes_out_this_round, /* Total bytes transmitted */
6597 + 0, /* Multicast packets received */
6598 + 0, /* Multicast packets transmitted */
6599 + 0, /* Unicast packets received */
6600 + 0); /* Unicast packets transmitted */
6603 + sprintf(str_pkt_loss, "%.1f %%", (double) vam->config.base_pkt_loss);
6604 + evel_measurement_custom_measurement_add(vpp_m, /* Pointer to the measurement */
6605 + "ONAP-DCAE", /* measurement group's name */
6606 + "Packet-Loss-Rate", /* the measurement's name */
6607 + str_pkt_loss); /* The measurement's value */
6609 + last_epoch = start_epoch + vam->config.read_interval * 1000000;
6610 + vpp_m_header = (EVENT_HEADER *)vpp_m;
6611 + vpp_m_header->start_epoch_microsec = start_epoch;
6612 + vpp_m_header->last_epoch_microsec = last_epoch;
6613 + strcpy(vpp_m_header->reporting_entity_id.value, "No UUID available");
6614 + strcpy(vpp_m_header->reporting_entity_name, hostname);
6616 + evel_rc = evel_post_event(vpp_m_header);
6617 + if(evel_rc == EVEL_SUCCESS) {
6618 + printf("Measurement report correctly sent to the collector!\n");
6621 + printf("Post failed %d (%s)\n", evel_rc, evel_error_string());
6625 + printf("New measurement report failed (%s)\n", evel_error_string());
6628 + last_vpp_metrics->bytes_in = curr_vpp_metrics->bytes_in;
6629 + last_vpp_metrics->bytes_out = curr_vpp_metrics->bytes_out;
6630 + last_vpp_metrics->packets_in = curr_vpp_metrics->packets_in;
6631 + last_vpp_metrics->packets_out = curr_vpp_metrics->packets_out;
6632 + gettimeofday(&time_val, NULL);
6633 + start_epoch = time_val.tv_sec * 1000000 + time_val.tv_usec;
6639 +ves_agent_start(ves_agent_main_t *vam)
6641 + vlib_main_t *vm = vam->vlib_main;
6642 + struct timeval time_val;
6643 + char fqdn[16]; /* "xxx.xxx.xxx.xxx" */
6644 + //char *fqdn = "127.0.0.1"; /* "xxx.xxx.xxx.xxx" */
6646 + sprintf(fqdn, "%d.%d.%d.%d", vam->config.server_addr.data[0],
6647 + vam->config.server_addr.data[1],
6648 + vam->config.server_addr.data[2],
6649 + vam->config.server_addr.data[3]);
6650 + /* Always success. TODO: Error check in next version */
6651 + last_vpp_metrics = malloc(sizeof(vpp_metrics_struct));
6652 + curr_vpp_metrics = malloc(sizeof(vpp_metrics_struct));
6654 + if(evel_initialize(fqdn, /* FQDN */
6655 + vam->config.server_port, /* Port */
6656 + NULL, /* optional path */
6657 + NULL, /* optional topic */
6659 + "", /* Username */
6660 + "", /* Password */
6661 + EVEL_SOURCE_VIRTUAL_MACHINE, /* Source type */
6662 + "vG-MUX", /* Role */
6663 + 1)) /* Verbosity */
6665 + fprintf(stderr, "\nFailed to initialize the EVEL library!!!\n");
6669 + gethostname(hostname, BUFSIZE);
6670 + memset(last_vpp_metrics, 0, sizeof(vpp_metrics_struct));
6671 + read_vpp_metrics(last_vpp_metrics, DEFAULT_MEASURE_ETH);
6672 + gettimeofday(&time_val, NULL);
6673 + start_epoch = time_val.tv_sec * 1000000 + time_val.tv_usec;
6675 + vlib_process_wait_for_event_or_clock(vm, (f64)(vam->config.read_interval));
6681 +ves_agent_stop(void)
6684 + free(last_vpp_metrics);
6685 + free(curr_vpp_metrics);
6692 +VLIB_PLUGIN_REGISTER () = {
6693 + .version = VPP_BUILD_VER,
6694 + .description = "VNF Event Stream Agent",
6699 +ves_agent_process (vlib_main_t * vm,
6700 + vlib_node_runtime_t * rt,
6703 + ves_agent_main_t *vam = &ves_agent_main;
6705 + uword * event_data = 0;
6707 + if (vam->config.read_interval == 0) {
6708 + vam->config.read_interval = DEFAULT_READ_INTERVAL;
6713 + vlib_process_wait_for_event_or_clock(vm, (f64)(vam->config.read_interval));
6715 + event_type = vlib_process_get_events (vm, &event_data);
6717 + switch (event_type)
6719 + case EVENT_VES_AGENT_START:
6720 + ves_agent_start(vam);
6722 + case EVENT_VES_AGENT_STOP:
6726 + ves_agent_report_vnic_stats(vam);
6730 + vec_reset_length (event_data);
6737 +VLIB_REGISTER_NODE (ves_agent_process_node, static) = {
6738 + .function = ves_agent_process,
6739 + .type = VLIB_NODE_TYPE_PROCESS,
6740 + .name = "ves-agent-process",
6741 + .process_log2_n_stack_bytes = 16,
6745 +ves_set_server (ip46_address_t *addr,
6747 + u32 read_interval,
6750 + ves_agent_main_t *vam = &ves_agent_main;
6751 + vlib_main_t *vm = vam->vlib_main;
6754 + if (ip46_address_is_zero(addr))
6755 + return VNET_API_ERROR_INVALID_DST_ADDRESS;
6759 + if (vam->config.is_enabled == VES_AGENT_DISABLED) {
6763 + if ((vam->config.server_addr.as_u32 != addr->ip4.as_u32)
6764 + || (vam->config.server_port != server_port))
6765 + return VNET_API_ERROR_NO_SUCH_ENTRY;
6767 + memset(&(vam->config.server_addr), 0, sizeof(ip4_address_t));
6768 + vam->config.server_port = DEFAULT_SERVER_PORT;
6769 + vam->config.read_interval = DEFAULT_READ_INTERVAL;
6770 + vam->config.is_enabled = VES_AGENT_DISABLED;
6771 + vlib_process_signal_event (vm, ves_agent_process_node.index,
6772 + EVENT_VES_AGENT_STOP, 0);
6774 + // Already enabled the same config.
6775 + if ((vam->config.server_addr.as_u32 == addr->ip4.as_u32)
6776 + && (vam->config.server_port != server_port)
6777 + && vam->config.read_interval == read_interval
6778 + && vam->config.is_enabled == VES_AGENT_ENABLED) {
6782 + // Already enabled, but not exact match.
6783 + if (vam->config.is_enabled == VES_AGENT_ENABLED) {
6784 + return VNET_API_ERROR_VALUE_EXIST;
6787 + vam->config.server_addr.as_u32 = addr->ip4.as_u32;
6788 + vam->config.server_port = server_port;
6789 + if (read_interval) {
6790 + vam->config.read_interval = read_interval;
6792 + vam->config.read_interval = DEFAULT_READ_INTERVAL;
6794 + vam->config.is_enabled = VES_AGENT_ENABLED;
6795 + vlib_process_signal_event (vm, ves_agent_process_node.index,
6796 + EVENT_VES_AGENT_START, 0);
6803 +format_ves_agent_set_error(u8 *s, va_list *args)
6805 + s = format(s, "%s\n\n", "Caution, set fails due to enabled config:");
6806 + s = format(s, "%U", format_ves_agent_config, NULL);
6810 +static clib_error_t *
6811 +ves_server_set_command_fn(vlib_main_t * vm,
6812 + unformat_input_t * input,
6813 + vlib_cli_command_t * cmd)
6815 + ip46_address_t server_addr;
6816 + u32 server_port = DEFAULT_SERVER_PORT, inter_val = DEFAULT_READ_INTERVAL;
6817 + int is_del = 0, set_server = 0;
6819 + memset(&server_addr, 0, sizeof(server_addr));
6821 + while (unformat_check_input(input) != UNFORMAT_END_OF_INPUT)
6823 + if (unformat (input, "server %U",
6824 + unformat_ip4_address, &server_addr.ip4))
6826 + else if (unformat (input, "port %u", &server_port))
6828 + else if (unformat (input, "intval %u", &inter_val))
6830 + else if (unformat (input, "delete") ||
6831 + unformat (input, "del"))
6837 + if (is_del || set_server)
6841 + rv = ves_set_server (&server_addr, server_port, inter_val, is_del);
6847 + case VNET_API_ERROR_INVALID_DST_ADDRESS:
6848 + return clib_error_return (0, "Invalid address");
6850 + case VNET_API_ERROR_NO_SUCH_ENTRY:
6851 + return clib_error_return(0, "No such Entry found");
6853 + case VNET_API_ERROR_VALUE_EXIST:
6854 + vlib_cli_output (vm, "%U\n", format_ves_agent_set_error, NULL);
6855 + return clib_error_return (0, "BUG found!");
6858 + return clib_error_return (0, "BUG: rv %d", rv);
6861 + return clib_error_return (0, "parse error`%U'",
6862 + format_unformat_error, input);
6866 +VLIB_CLI_COMMAND (ves_server_set_command, static) = {
6867 + .path = "set ves agent",
6868 + .short_help = "set ves agent [del] server <ipaddr> port <port> [intval <inter-value>]",
6869 + .function = ves_server_set_command_fn,
6873 +format_ves_agent_config(u8 *s, va_list *args)
6875 + ves_agent_main_t *vam = &ves_agent_main;
6876 + char fqdn[16]; /* "xxx.xxx.xxx.xxx" */
6878 + s = format(s, "%=16s %=12s %=8s %s\n", "Server Addr",
6879 + "Server Port", "Interval", "Enabled");
6880 + if (vam->config.is_enabled == VES_AGENT_DISABLED) {
6884 + sprintf(fqdn, "%d.%d.%d.%d", vam->config.server_addr.data[0],
6885 + vam->config.server_addr.data[1],
6886 + vam->config.server_addr.data[2],
6887 + vam->config.server_addr.data[3]);
6889 + s = format(s, "%=16s %=12d %=8d %s\n", fqdn,
6890 + vam->config.server_port,
6891 + vam->config.read_interval,
6892 + vam->config.is_enabled ? "True" : "False");
6897 +static clib_error_t *
6898 +ves_server_show_command_fn(vlib_main_t * vm,
6899 + unformat_input_t * input,
6900 + vlib_cli_command_t * cmd)
6902 + vlib_cli_output (vm, "%U", format_ves_agent_config, NULL);
6907 +VLIB_CLI_COMMAND (ves_server_show_command, static) = {
6908 + .path = "show ves agent",
6909 + .short_help = "Display VES Agent Configuration",
6910 + .function = ves_server_show_command_fn,
6914 +ves_agent_set_mode(ves_agent_mode_t mode,
6915 + u32 pkt_loss_rate)
6917 + ves_agent_main_t *vam = &ves_agent_main;
6920 + if (VES_AGENT_MODE_DEMO == mode) {
6921 + if (pkt_loss_rate > 100) {
6922 + vam->config.mode = VES_AGENT_MODE_REAL;
6923 + vam->config.base_pkt_loss = 0;
6926 + vam->config.mode = VES_AGENT_MODE_DEMO;
6927 + vam->config.base_pkt_loss = pkt_loss_rate;
6928 + } else { /* Only demo or real for current stage */
6929 + vam->config.mode = VES_AGENT_MODE_REAL;
6930 + vam->config.base_pkt_loss = 0;
6936 +static clib_error_t *
6937 +ves_mode_set_command_fn(vlib_main_t * vm,
6938 + unformat_input_t * input,
6939 + vlib_cli_command_t * cmd)
6941 + u32 pkt_loss_rate = 0;
6942 + ves_agent_mode_t mode = VES_AGENT_MODE_REAL;
6945 + while (unformat_check_input(input) != UNFORMAT_END_OF_INPUT)
6947 + if (unformat (input, "demo") || unformat (input, "Demo")
6948 + || unformat (input, "DEMO"))
6950 + mode = VES_AGENT_MODE_DEMO;
6953 + else if (unformat (input, "real") || unformat (input, "Real")
6954 + || unformat (input, "REAL"))
6956 + else if (unformat (input, "base %u", &pkt_loss_rate))
6964 + int retval = ves_agent_set_mode(mode, pkt_loss_rate);
6968 + return clib_error_return (0, "BUG found!");
6970 + return clib_error_return (0, "parse error`%U'",
6971 + format_unformat_error, input);
6975 +VLIB_CLI_COMMAND (ves_mode_set_command, static) = {
6976 + .path = "set ves mode",
6977 + .short_help = "set ves mode <demo|real> [base <pkt-loss-rate>]",
6978 + .function = ves_mode_set_command_fn,
6982 +format_ves_agent_mode(u8 *s, va_list *args)
6984 + ves_agent_main_t *vam = &ves_agent_main;
6986 + s = format(s, "%=8s %s\n", "Mode", "Base Packet Loss Rate");
6988 + s = format(s, "%=8s %.1f %%\n",
6989 + vam->config.mode == VES_AGENT_MODE_DEMO ? "Demo" : "Real",
6990 + (double) vam->config.base_pkt_loss);
6995 +static clib_error_t *
6996 +ves_agent_mode_show_command_fn(vlib_main_t * vm,
6997 + unformat_input_t * input,
6998 + vlib_cli_command_t * cmd)
7000 + vlib_cli_output (vm, "%U", format_ves_agent_mode, NULL);
7005 +VLIB_CLI_COMMAND (ves_agent_mode_show_command, static) = {
7006 + .path = "show ves mode",
7007 + .short_help = "Display VES Agent Mode Information",
7008 + .function = ves_agent_mode_show_command_fn,
7011 +static clib_error_t *
7012 +ves_agent_init(vlib_main_t * vm)
7014 + ves_agent_main_t *vam = &ves_agent_main;
7016 + vam->vlib_main = vm;
7017 + vam->vnet_main = vnet_get_main();
7022 +VLIB_INIT_FUNCTION (ves_agent_init);
7025 + * fd.io coding-style-patch-verification: ON
7027 + * Local Variables:
7028 + * eval: (c-set-style "gnu")
7031 diff --git a/src/plugins/ves/ves_node.h b/src/plugins/ves/ves_node.h
7032 new file mode 100644
7033 index 00000000..7b773843
7035 +++ b/src/plugins/ves/ves_node.h
7038 + * Copyright (c) 2017 Intel and/or its affiliates.
7039 + * Licensed under the Apache License, Version 2.0 (the "License");
7040 + * you may not use this file except in compliance with the License.
7041 + * You may obtain a copy of the License at:
7043 + * http://www.apache.org/licenses/LICENSE-2.0
7045 + * Unless required by applicable law or agreed to in writing, software
7046 + * distributed under the License is distributed on an "AS IS" BASIS,
7047 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7048 + * See the License for the specific language governing permissions and
7049 + * limitations under the License.
7052 +#ifndef _VES_NODE_H_
7053 +#define _VES_NODE_H_
7055 +#include <vnet/ip/ip.h>
7057 +#include "include/evel.h"
7059 +#define DEFAULT_SERVER_IP "127.0.0.1"
7060 +#define DEFAULT_MEASURE_ETH "eth0"
7061 +#define DEFAULT_SERVER_PORT 8080
7062 +#define DEFAULT_READ_INTERVAL 100
7065 + VES_AGENT_MODE_REAL = 0,
7066 + VES_AGENT_MODE_DEMO,
7067 + _NUM_VES_AGENT_MODES
7068 +} ves_agent_mode_t;
7070 +/* VES Agent Server configuration */
7072 + ip4_address_t server_addr;
7074 + u32 read_interval;
7076 + u32 base_pkt_loss; /* For demo only */
7077 + ves_agent_mode_t mode; /* Demo or Real */
7078 +} ves_agent_config_t;
7081 + ves_agent_config_t config;
7084 + vlib_main_t * vlib_main;
7085 + vnet_main_t * vnet_main;
7086 +} ves_agent_main_t;
7088 +ves_agent_main_t ves_agent_main;
7090 +#define EVENT_VES_AGENT_START 1
7091 +#define EVENT_VES_AGENT_STOP 0
7093 +#define VES_AGENT_DISABLED 0
7094 +#define VES_AGENT_ENABLED 1
7096 +int ves_set_server(ip46_address_t *addr, u32 server_port,
7097 + u32 read_interval, int is_del);
7099 +int ves_agent_set_mode(ves_agent_mode_t mode,
7100 + u32 pkt_loss_rate);
7102 +#endif /* _VES_NODE_H_ */
7103 diff --git a/src/vpp-api/java/Makefile.am b/src/vpp-api/java/Makefile.am
7104 index f18e0c24..7f4738d8 100644
7105 --- a/src/vpp-api/java/Makefile.am
7106 +++ b/src/vpp-api/java/Makefile.am
7107 @@ -148,6 +148,26 @@ jvpp-snat/io_fd_vpp_jvpp_snat_JVppSnatImpl.h: $(jvpp_registry_ok) $(jvpp_snat_js
7108 $(call japigen,snat,JVppSnatImpl)
7114 +if ENABLE_VES_PLUGIN
7115 +noinst_LTLIBRARIES += libjvpp_ves.la
7116 +libjvpp_ves_la_SOURCES = jvpp-ves/jvpp_ves.c
7117 +libjvpp_ves_la_CPPFLAGS = -Ijvpp-ves
7118 +libjvpp_ves_la_LIBADD = $(JVPP_LIBS)
7119 +libjvpp_ves_la_DEPENDENCIES = libjvpp_common.la
7121 +BUILT_SOURCES += jvpp-ves/io_fd_vpp_jvpp_ves_JVppVesImpl.h
7122 +JAR_FILES += jvpp-ves-$(PACKAGE_VERSION).jar
7123 +CLEANDIRS += jvpp-ves/target
7125 +jvpp_ves_json_files = @top_builddir@/plugins/ves/ves.api.json
7127 +jvpp-ves/io_fd_vpp_jvpp_ves_JVppVesImpl.h: $(jvpp_registry_ok) $(jvpp_ves_json_files)
7128 + $(call japigen,ves,JVppVesImpl)
7134 diff --git a/src/vpp-api/java/jvpp-ves/jvpp_ves.c b/src/vpp-api/java/jvpp-ves/jvpp_ves.c
7135 new file mode 100644
7136 index 00000000..60e325b5
7138 +++ b/src/vpp-api/java/jvpp-ves/jvpp_ves.c
7141 + * Copyright (c) 2017 Intel Corp and/or its affiliates.
7143 + * Licensed under the Apache License, Version 2.0 (the "License");
7144 + * you may not use this file except in compliance with the License.
7145 + * You may obtain a copy of the License at:
7147 + * http://www.apache.org/licenses/LICENSE-2.0
7149 + * Unless required by applicable law or agreed to in writing, software
7150 + * distributed under the License is distributed on an "AS IS" BASIS,
7151 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7152 + * See the License for the specific language governing permissions and
7153 + * limitations under the License.
7156 +#include <vnet/vnet.h>
7158 +#include <ves/ves_msg_enum.h>
7159 +#define vl_typedefs /* define message structures */
7160 +#include <ves/ves_all_api_h.h>
7163 +#include <vnet/api_errno.h>
7164 +#include <vlibapi/api.h>
7165 +#include <vlibmemory/api.h>
7167 +#if VPPJNI_DEBUG == 1
7168 + #define DEBUG_LOG(...) clib_warning(__VA_ARGS__)
7170 + #define DEBUG_LOG(...)
7173 +#include <jvpp-common/jvpp_common.h>
7175 +#include "jvpp-ves/io_fd_vpp_jvpp_ves_JVppVesImpl.h"
7176 +#include "jvpp_ves.h"
7177 +#include "jvpp-ves/jvpp_ves_gen.h"
7180 + * Class: io_fd_vpp_jvpp_ves_JVppVesImpl
7182 + * Signature: (JI)V
7184 +JNIEXPORT void JNICALL Java_io_fd_vpp_jvpp_ves_JVppVesImpl_init0
7185 + (JNIEnv *env, jclass clazz, jobject callback, jlong queue_address, jint my_client_index) {
7186 + ves_main_t * plugin_main = &ves_main;
7187 + clib_warning ("Java_io_fd_vpp_jvpp_ves_JVppVesImpl_init0");
7189 + plugin_main->my_client_index = my_client_index;
7190 + plugin_main->vl_input_queue = (unix_shared_memory_queue_t *)queue_address;
7192 + plugin_main->callbackObject = (*env)->NewGlobalRef(env, callback);
7193 + plugin_main->callbackClass = (jclass)(*env)->NewGlobalRef(env, (*env)->GetObjectClass(env, callback));
7195 + // verify API has not changed since jar generation
7197 + get_message_id(env, #N);
7198 + foreach_supported_api_message;
7202 + vl_msg_api_set_handlers(get_message_id(env, #N), #n, \
7203 + vl_api_##n##_t_handler, \
7204 + vl_noop_handler, \
7205 + vl_noop_handler, \
7206 + vl_noop_handler, \
7207 + sizeof(vl_api_##n##_t), 1);
7208 + foreach_api_reply_handler;
7212 +JNIEXPORT void JNICALL Java_io_fd_vpp_jvpp_ves_JVppVesImpl_close0
7213 +(JNIEnv *env, jclass clazz) {
7214 + ves_main_t * plugin_main = &ves_main;
7217 + (*env)->DeleteGlobalRef(env, plugin_main->callbackClass);
7218 + (*env)->DeleteGlobalRef(env, plugin_main->callbackObject);
7220 + plugin_main->callbackClass = NULL;
7221 + plugin_main->callbackObject = NULL;
7224 +/* Attach thread to JVM and cache class references when initiating JVPP VES */
7225 +jint JNI_OnLoad(JavaVM *vm, void *reserved) {
7228 + if ((*vm)->GetEnv(vm, (void**) &env, JNI_VERSION_1_8) != JNI_OK) {
7229 + return JNI_EVERSION;
7232 + if (cache_class_references(env) != 0) {
7233 + clib_warning ("Failed to cache class references\n");
7237 + return JNI_VERSION_1_8;
7240 +/* Clean up cached references when disposing JVPP VES */
7241 +void JNI_OnUnload(JavaVM *vm, void *reserved) {
7243 + if ((*vm)->GetEnv(vm, (void**) &env, JNI_VERSION_1_8) != JNI_OK) {
7246 + delete_class_references(env);
7248 diff --git a/src/vpp-api/java/jvpp-ves/jvpp_ves.h b/src/vpp-api/java/jvpp-ves/jvpp_ves.h
7249 new file mode 100644
7250 index 00000000..642101ca
7252 +++ b/src/vpp-api/java/jvpp-ves/jvpp_ves.h
7255 + * Copyright (c) 2017 Intel Corp and/or its affiliates.
7257 + * Licensed under the Apache License, Version 2.0 (the "License");
7258 + * you may not use this file except in compliance with the License.
7259 + * You may obtain a copy of the License at:
7261 + * http://www.apache.org/licenses/LICENSE-2.0
7263 + * Unless required by applicable law or agreed to in writing, software
7264 + * distributed under the License is distributed on an "AS IS" BASIS,
7265 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7266 + * See the License for the specific language governing permissions and
7267 + * limitations under the License.
7269 +#ifndef __included_jvpp_ves_h__
7270 +#define __included_jvpp_ves_h__
7272 +#include <vnet/vnet.h>
7273 +#include <vnet/ip/ip.h>
7274 +#include <vnet/api_errno.h>
7275 +#include <vlibapi/api.h>
7276 +#include <vlibmemory/api.h>
7279 +/* Global state for JVPP-VES */
7281 + /* Pointer to shared memory queue */
7282 + unix_shared_memory_queue_t * vl_input_queue;
7284 + /* VPP api client index */
7285 + u32 my_client_index;
7287 + /* Callback object and class references enabling asynchronous Java calls */
7288 + jobject callbackObject;
7289 + jclass callbackClass;
7293 +ves_main_t ves_main __attribute__((aligned (64)));
7296 +#endif /* __included_jvpp_ves_h__ */