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 v3: Add option to configure source name for VES event
8 v2: Use VES 5.x as agent library
9 v1: Add VES agent to report statistics
11 Signed-off-by: Johnson Li <johnson.li@intel.com>
13 diff --git a/src/configure.ac b/src/configure.ac
14 index fb2ead6..ea64152 100644
15 --- a/src/configure.ac
16 +++ b/src/configure.ac
17 @@ -154,6 +154,7 @@ PLUGIN_ENABLED(lb)
23 ###############################################################################
25 diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
26 index 623892e..8451375 100644
27 --- a/src/plugins/Makefile.am
28 +++ b/src/plugins/Makefile.am
29 @@ -69,6 +69,10 @@ if ENABLE_SNAT_PLUGIN
37 include ../suffix-rules.mk
40 diff --git a/src/plugins/ves.am b/src/plugins/ves.am
42 index 0000000..10f2194
44 +++ b/src/plugins/ves.am
46 +# Copyright (c) <current-year> <your-organization>
47 +# Licensed under the Apache License, Version 2.0 (the "License");
48 +# you may not use this file except in compliance with the License.
49 +# You may obtain a copy of the License at:
51 +# http://www.apache.org/licenses/LICENSE-2.0
53 +# Unless required by applicable law or agreed to in writing, software
54 +# distributed under the License is distributed on an "AS IS" BASIS,
55 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
56 +# See the License for the specific language governing permissions and
57 +# limitations under the License.
59 +vppplugins_LTLIBRARIES += ves_plugin.la
61 +LIBS_DIR=$(CURDIR)/ves/libs
62 +ves_plugin_la_LDFLAGS = $(AM_LDFLAGS) -L$(LIBS_DIR)
63 +ves_plugin_la_LDFLAGS += -Wl,--whole-archive -level -Wl,--no-whole-archive
64 +ves_plugin_la_LDFLAGS += -Wl,-lpthread,-lcurl
66 +ves_plugin_la_SOURCES = ves/ves_node.c \
73 +API_FILES += ves/ves.api
75 +nobase_apiinclude_HEADERS += \
76 + ves/ves_all_api_h.h \
77 + ves/ves_msg_enum.h \
81 diff --git a/src/plugins/ves/include/double_list.h b/src/plugins/ves/include/double_list.h
83 index 0000000..5cf7e1a
85 +++ b/src/plugins/ves/include/double_list.h
87 +/*************************************************************************//**
89 + * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
91 + * Licensed under the Apache License, Version 2.0 (the "License");
92 + * you may not use this file except in compliance with the License.
93 + * You may obtain a copy of the License at
94 + * http://www.apache.org/licenses/LICENSE-2.0
96 + * Unless required by applicable law or agreed to in writing, software
97 + * distributed under the License is distributed on an "AS IS" BASIS,
98 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
99 + * See the License for the specific language governing permissions and
100 + * limitations under the License.
102 + ****************************************************************************/
104 +/**************************************************************************//**
106 + * A simple double-linked list.
108 + * @note No thread protection so you will need to use appropriate
109 + * synchronization if use spans multiple threads.
111 + ****************************************************************************/
113 +#ifndef DOUBLE_LIST_INCLUDED
114 +#define DOUBLE_LIST_INCLUDED
116 +typedef struct dlist_item
118 + struct dlist_item * previous;
119 + struct dlist_item * next;
123 +/**************************************************************************//**
124 + * Double-linked list structure
125 + *****************************************************************************/
126 +typedef struct dlist
133 +void dlist_initialize(DLIST * list);
134 +void * dlist_pop_last(DLIST * list);
135 +void dlist_push_first(DLIST * list, void * item);
136 +void dlist_push_last(DLIST * list, void * item);
137 +DLIST_ITEM * dlist_get_first(DLIST * list);
138 +DLIST_ITEM * dlist_get_last(DLIST * list);
139 +DLIST_ITEM * dlist_get_next(DLIST_ITEM * item);
140 +int dlist_is_empty(DLIST * list);
141 +int dlist_count(DLIST * list);
144 diff --git a/src/plugins/ves/include/evel.h b/src/plugins/ves/include/evel.h
146 index 0000000..d696085
148 +++ b/src/plugins/ves/include/evel.h
150 +#ifndef EVEL_INCLUDED
151 +#define EVEL_INCLUDED
152 +/*************************************************************************//**
154 + * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
156 + * Licensed under the Apache License, Version 2.0 (the "License");
157 + * you may not use this file except in compliance with the License.
158 + * You may obtain a copy of the License at
159 + * http://www.apache.org/licenses/LICENSE-2.0
161 + * Unless required by applicable law or agreed to in writing, software
162 + * distributed under the License is distributed on an "AS IS" BASIS,
163 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
164 + * See the License for the specific language governing permissions and
165 + * limitations under the License.
167 + ****************************************************************************/
169 +/**************************************************************************//**
171 + * Header for EVEL library
173 + * This file implements the EVEL library which is intended to provide a
174 + * simple wrapper around the complexity of AT&T's Vendor Event Listener API so
175 + * that VNFs can use it without worrying about details of the API transport.
177 + * Zero return value is success (::EVEL_SUCCESS), non-zero is failure and will
178 + * be one of ::EVEL_ERR_CODES.
179 + *****************************************************************************/
185 +#include <stdbool.h>
191 +#include "double_list.h"
192 +#include "hashtable.h"
194 +/*****************************************************************************/
195 +/* Supported API version. */
196 +/*****************************************************************************/
197 +#define EVEL_API_MAJOR_VERSION 5
198 +#define EVEL_API_MINOR_VERSION 0
200 +/**************************************************************************//**
203 + * Error codes for EVEL low level interface
204 + *****************************************************************************/
206 + EVEL_SUCCESS, /** The operation was successful. */
207 + EVEL_ERR_GEN_FAIL, /** Non-specific failure. */
208 + EVEL_CURL_LIBRARY_FAIL, /** A cURL library operation failed. */
209 + EVEL_PTHREAD_LIBRARY_FAIL, /** A Posix threads operation failed. */
210 + EVEL_OUT_OF_MEMORY, /** A memory allocation failure occurred. */
211 + EVEL_EVENT_BUFFER_FULL, /** Too many events in the ring-buffer. */
212 + EVEL_EVENT_HANDLER_INACTIVE, /** Attempt to raise event when inactive. */
213 + EVEL_NO_METADATA, /** Failed to retrieve OpenStack metadata. */
214 + EVEL_BAD_METADATA, /** OpenStack metadata invalid format. */
215 + EVEL_BAD_JSON_FORMAT, /** JSON failed to parse correctly. */
216 + EVEL_JSON_KEY_NOT_FOUND, /** Failed to find the specified JSON key. */
217 + EVEL_MAX_ERROR_CODES /** Maximum number of valid error codes. */
220 +/**************************************************************************//**
223 + * Variable levels of verbosity in the logging functions.
224 + *****************************************************************************/
227 + EVEL_LOG_SPAMMY = 30,
228 + EVEL_LOG_DEBUG = 40,
229 + EVEL_LOG_INFO = 50,
230 + EVEL_LOG_ERROR = 60,
234 +/*****************************************************************************/
235 +/* Maximum string lengths. */
236 +/*****************************************************************************/
237 +#define EVEL_MAX_STRING_LEN 4096
238 +#define EVEL_MAX_JSON_BODY 16000
239 +#define EVEL_MAX_ERROR_STRING_LEN 255
240 +#define EVEL_MAX_URL_LEN 511
242 +/**************************************************************************//**
243 + * This value represents there being no restriction on the reporting interval.
244 + *****************************************************************************/
245 +static const int EVEL_MEASUREMENT_INTERVAL_UKNOWN = 0;
247 +/**************************************************************************//**
248 + * How many events can be backed-up before we start dropping events on the
251 + * @note This value should be tuned in accordance with expected burstiness of
252 + * the event load and the expected response time of the ECOMP event
253 + * listener so that the probability of the buffer filling is suitably
255 + *****************************************************************************/
256 +static const int EVEL_EVENT_BUFFER_DEPTH = 100;
258 +/*****************************************************************************/
259 +/* How many different IP Types-of-Service are supported. */
260 +/*****************************************************************************/
261 +#define EVEL_TOS_SUPPORTED 256
263 +/**************************************************************************//**
264 + * Event domains for the various events we support.
265 + * JSON equivalent field: domain
266 + *****************************************************************************/
268 + EVEL_DOMAIN_INTERNAL, /** Internal event, not for external routing. */
269 + EVEL_DOMAIN_HEARTBEAT, /** A Heartbeat event (event header only). */
270 + EVEL_DOMAIN_FAULT, /** A Fault event. */
271 + EVEL_DOMAIN_MEASUREMENT, /** A Measurement for VF Scaling event. */
272 + EVEL_DOMAIN_MOBILE_FLOW, /** A Mobile Flow event. */
273 + EVEL_DOMAIN_REPORT, /** A Measurement for VF Reporting event. */
274 + EVEL_DOMAIN_HEARTBEAT_FIELD,/** A Heartbeat field event. */
275 + EVEL_DOMAIN_SIPSIGNALING, /** A Signaling event. */
276 + EVEL_DOMAIN_STATE_CHANGE, /** A State Change event. */
277 + EVEL_DOMAIN_SYSLOG, /** A Syslog event. */
278 + EVEL_DOMAIN_OTHER, /** Another event. */
279 + EVEL_DOMAIN_THRESHOLD_CROSS, /** A Threshold Crossing Event */
280 + EVEL_DOMAIN_VOICE_QUALITY, /** A Voice Quality Event */
281 + EVEL_MAX_DOMAINS /** Maximum number of recognized Event types. */
282 +} EVEL_EVENT_DOMAINS;
284 +/**************************************************************************//**
285 + * Event priorities.
286 + * JSON equivalent field: priority
287 + *****************************************************************************/
289 + EVEL_PRIORITY_HIGH,
290 + EVEL_PRIORITY_MEDIUM,
291 + EVEL_PRIORITY_NORMAL,
293 + EVEL_MAX_PRIORITIES
294 +} EVEL_EVENT_PRIORITIES;
296 +/**************************************************************************//**
297 + * Fault / Threshold severities.
298 + * JSON equivalent field: eventSeverity
299 + *****************************************************************************/
301 + EVEL_SEVERITY_CRITICAL,
302 + EVEL_SEVERITY_MAJOR,
303 + EVEL_SEVERITY_MINOR,
304 + EVEL_SEVERITY_WARNING,
305 + EVEL_SEVERITY_NORMAL,
306 + EVEL_MAX_SEVERITIES
309 +/**************************************************************************//**
310 + * Fault source types.
311 + * JSON equivalent field: eventSourceType
312 + *****************************************************************************/
315 + EVEL_SOURCE_ROUTER,
316 + EVEL_SOURCE_SWITCH,
320 + EVEL_SOURCE_SLOT_THRESHOLD,
321 + EVEL_SOURCE_PORT_THRESHOLD,
322 + EVEL_SOURCE_VIRTUAL_MACHINE,
323 + EVEL_SOURCE_VIRTUAL_NETWORK_FUNCTION,
324 + /***************************************************************************/
325 + /* START OF VENDOR-SPECIFIC VALUES */
327 + /* Vendor-specific values should be added here, and handled appropriately */
328 + /* in evel_event.c. */
329 + /***************************************************************************/
331 + /***************************************************************************/
332 + /* END OF VENDOR-SPECIFIC VALUES */
333 + /***************************************************************************/
334 + EVEL_MAX_SOURCE_TYPES
335 +} EVEL_SOURCE_TYPES;
337 +/**************************************************************************//**
338 + * Fault VNF Status.
339 + * JSON equivalent field: vfStatus
340 + *****************************************************************************/
342 + EVEL_VF_STATUS_ACTIVE,
343 + EVEL_VF_STATUS_IDLE,
344 + EVEL_VF_STATUS_PREP_TERMINATE,
345 + EVEL_VF_STATUS_READY_TERMINATE,
346 + EVEL_VF_STATUS_REQ_TERMINATE,
347 + EVEL_MAX_VF_STATUSES
350 +/**************************************************************************//**
351 + * Counter criticalities.
352 + * JSON equivalent field: criticality
353 + *****************************************************************************/
355 + EVEL_COUNTER_CRITICALITY_CRIT,
356 + EVEL_COUNTER_CRITICALITY_MAJ,
357 + EVEL_MAX_COUNTER_CRITICALITIES
358 +} EVEL_COUNTER_CRITICALITIES;
360 +/**************************************************************************//**
362 + * JSON equivalent field: alertAction
363 + *****************************************************************************/
365 + EVEL_ALERT_ACTION_CLEAR,
366 + EVEL_ALERT_ACTION_CONT,
367 + EVEL_ALERT_ACTION_SET,
368 + EVEL_MAX_ALERT_ACTIONS
369 +} EVEL_ALERT_ACTIONS;
371 +/**************************************************************************//**
373 + * JSON equivalent field: alertType
374 + *****************************************************************************/
376 + EVEL_ALERT_TYPE_CARD,
377 + EVEL_ALERT_TYPE_ELEMENT,
378 + EVEL_ALERT_TYPE_INTERFACE,
379 + EVEL_ALERT_TYPE_SERVICE,
380 + EVEL_MAX_ALERT_TYPES
383 +/**************************************************************************//**
385 + * JSON equivalent fields: newState, oldState
386 + *****************************************************************************/
388 + EVEL_ENTITY_STATE_IN_SERVICE,
389 + EVEL_ENTITY_STATE_MAINTENANCE,
390 + EVEL_ENTITY_STATE_OUT_OF_SERVICE,
391 + EVEL_MAX_ENTITY_STATES
392 +} EVEL_ENTITY_STATE;
394 +/**************************************************************************//**
395 + * Syslog facilities.
396 + * JSON equivalent field: syslogFacility
397 + *****************************************************************************/
399 + EVEL_SYSLOG_FACILITY_KERNEL,
400 + EVEL_SYSLOG_FACILITY_USER,
401 + EVEL_SYSLOG_FACILITY_MAIL,
402 + EVEL_SYSLOG_FACILITY_SYSTEM_DAEMON,
403 + EVEL_SYSLOG_FACILITY_SECURITY_AUTH,
404 + EVEL_SYSLOG_FACILITY_INTERNAL,
405 + EVEL_SYSLOG_FACILITY_LINE_PRINTER,
406 + EVEL_SYSLOG_FACILITY_NETWORK_NEWS,
407 + EVEL_SYSLOG_FACILITY_UUCP,
408 + EVEL_SYSLOG_FACILITY_CLOCK_DAEMON,
409 + EVEL_SYSLOG_FACILITY_SECURITY_AUTH2,
410 + EVEL_SYSLOG_FACILITY_FTP_DAEMON,
411 + EVEL_SYSLOG_FACILITY_NTP,
412 + EVEL_SYSLOG_FACILITY_LOG_AUDIT,
413 + EVEL_SYSLOG_FACILITY_LOG_ALERT,
414 + EVEL_SYSLOG_FACILITY_CLOCK_DAEMON2,
415 + EVEL_SYSLOG_FACILITY_LOCAL0,
416 + EVEL_SYSLOG_FACILITY_LOCAL1,
417 + EVEL_SYSLOG_FACILITY_LOCAL2,
418 + EVEL_SYSLOG_FACILITY_LOCAL3,
419 + EVEL_SYSLOG_FACILITY_LOCAL4,
420 + EVEL_SYSLOG_FACILITY_LOCAL5,
421 + EVEL_SYSLOG_FACILITY_LOCAL6,
422 + EVEL_SYSLOG_FACILITY_LOCAL7,
423 + EVEL_MAX_SYSLOG_FACILITIES
424 +} EVEL_SYSLOG_FACILITIES;
426 +/**************************************************************************//**
428 + * JSON equivalent fields: tcpFlagCountList, tcpFlagList
429 + *****************************************************************************/
443 +/**************************************************************************//**
444 + * Mobile QCI Classes of Service.
445 + * JSON equivalent fields: mobileQciCosCountList, mobileQciCosList
446 + *****************************************************************************/
449 + /***************************************************************************/
450 + /* UMTS Classes of Service. */
451 + /***************************************************************************/
452 + EVEL_QCI_COS_UMTS_CONVERSATIONAL,
453 + EVEL_QCI_COS_UMTS_STREAMING,
454 + EVEL_QCI_COS_UMTS_INTERACTIVE,
455 + EVEL_QCI_COS_UMTS_BACKGROUND,
457 + /***************************************************************************/
458 + /* LTE Classes of Service. */
459 + /***************************************************************************/
460 + EVEL_QCI_COS_LTE_1,
461 + EVEL_QCI_COS_LTE_2,
462 + EVEL_QCI_COS_LTE_3,
463 + EVEL_QCI_COS_LTE_4,
464 + EVEL_QCI_COS_LTE_65,
465 + EVEL_QCI_COS_LTE_66,
466 + EVEL_QCI_COS_LTE_5,
467 + EVEL_QCI_COS_LTE_6,
468 + EVEL_QCI_COS_LTE_7,
469 + EVEL_QCI_COS_LTE_8,
470 + EVEL_QCI_COS_LTE_9,
471 + EVEL_QCI_COS_LTE_69,
472 + EVEL_QCI_COS_LTE_70,
473 + EVEL_MAX_QCI_COS_TYPES
474 +} EVEL_QCI_COS_TYPES;
476 +/**************************************************************************//**
477 + * Service Event endpoint description
478 + * JSON equivalent field: endpointDesc
479 + *****************************************************************************/
481 + EVEL_SERVICE_ENDPOINT_CALLEE,
482 + EVEL_SERVICE_ENDPOINT_CALLER,
483 + EVEL_MAX_SERVICE_ENDPOINT_DESC
484 +} EVEL_SERVICE_ENDPOINT_DESC;
486 +/**************************************************************************//**
487 + * Boolean type for EVEL library.
488 + *****************************************************************************/
494 +/**************************************************************************//**
495 + * Optional parameter holder for double.
496 + *****************************************************************************/
497 +typedef struct evel_option_double
500 + EVEL_BOOLEAN is_set;
501 +} EVEL_OPTION_DOUBLE;
503 +/**************************************************************************//**
504 + * Optional parameter holder for string.
505 + *****************************************************************************/
506 +typedef struct evel_option_string
509 + EVEL_BOOLEAN is_set;
510 +} EVEL_OPTION_STRING;
512 +/**************************************************************************//**
513 + * Optional parameter holder for int.
514 + *****************************************************************************/
515 +typedef struct evel_option_int
518 + EVEL_BOOLEAN is_set;
521 +/**************************************************************************//**
522 + * Optional parameter holder for unsigned long long.
523 + *****************************************************************************/
524 +typedef struct evel_option_ull
526 + unsigned long long value;
527 + EVEL_BOOLEAN is_set;
530 +/**************************************************************************//**
531 + * Optional parameter holder for time_t.
532 + *****************************************************************************/
533 +typedef struct evel_option_time
536 + EVEL_BOOLEAN is_set;
539 +/**************************************************************************//**
540 + * enrichment fields for internal VES Event Listener service use only,
541 + * not supplied by event sources
542 + *****************************************************************************/
543 +typedef struct internal_header_fields
546 + EVEL_BOOLEAN is_set;
547 +} EVEL_OPTION_INTHEADER_FIELDS;
549 +/*****************************************************************************/
550 +/* Supported Common Event Header version. */
551 +/*****************************************************************************/
552 +#define EVEL_HEADER_MAJOR_VERSION 1
553 +#define EVEL_HEADER_MINOR_VERSION 2
555 +/**************************************************************************//**
557 + * JSON equivalent field: commonEventHeader
558 + *****************************************************************************/
559 +typedef struct event_header {
560 + /***************************************************************************/
562 + /***************************************************************************/
566 + /***************************************************************************/
567 + /* Mandatory fields */
568 + /***************************************************************************/
569 + EVEL_EVENT_DOMAINS event_domain;
572 + char * source_name;
573 + char * reporting_entity_name;
574 + EVEL_EVENT_PRIORITIES priority;
575 + unsigned long long start_epoch_microsec;
576 + unsigned long long last_epoch_microsec;
579 + /***************************************************************************/
580 + /* Optional fields */
581 + /***************************************************************************/
582 + EVEL_OPTION_STRING event_type;
583 + EVEL_OPTION_STRING source_id;
584 + EVEL_OPTION_STRING reporting_entity_id;
585 + EVEL_OPTION_INTHEADER_FIELDS internal_field;
586 + EVEL_OPTION_STRING nfcnaming_code;
587 + EVEL_OPTION_STRING nfnaming_code;
591 +/*****************************************************************************/
592 +/* Supported Fault version. */
593 +/*****************************************************************************/
594 +#define EVEL_FAULT_MAJOR_VERSION 2
595 +#define EVEL_FAULT_MINOR_VERSION 1
597 +/**************************************************************************//**
599 + * JSON equivalent field: faultFields
600 + *****************************************************************************/
601 +typedef struct event_fault {
602 + /***************************************************************************/
603 + /* Header and version */
604 + /***************************************************************************/
605 + EVENT_HEADER header;
609 + /***************************************************************************/
610 + /* Mandatory fields */
611 + /***************************************************************************/
612 + EVEL_SEVERITIES event_severity;
613 + EVEL_SOURCE_TYPES event_source_type;
614 + char * alarm_condition;
615 + char * specific_problem;
616 + EVEL_VF_STATUSES vf_status;
618 + /***************************************************************************/
619 + /* Optional fields */
620 + /***************************************************************************/
621 + EVEL_OPTION_STRING category;
622 + EVEL_OPTION_STRING alarm_interface_a;
623 + DLIST additional_info;
627 +/**************************************************************************//**
628 + * Fault Additional Info.
629 + * JSON equivalent field: alarmAdditionalInformation
630 + *****************************************************************************/
631 +typedef struct fault_additional_info {
637 +/**************************************************************************//**
638 + * optional field block for fields specific to heartbeat events
639 + *****************************************************************************/
640 +typedef struct event_heartbeat_fields
642 + /***************************************************************************/
643 + /* Header and version */
644 + /***************************************************************************/
645 + EVENT_HEADER header;
649 + /***************************************************************************/
650 + /* Mandatory fields */
651 + /***************************************************************************/
652 + double heartbeat_version;
653 + int heartbeat_interval;
655 + /***************************************************************************/
656 + /* Optional fields */
657 + /***************************************************************************/
658 + DLIST additional_info;
660 +} EVENT_HEARTBEAT_FIELD;
662 +/**************************************************************************//**
663 + * tuple which provides the name of a key along with its value and
665 + *****************************************************************************/
666 +typedef struct internal_key
669 + EVEL_OPTION_INT keyorder;
670 + EVEL_OPTION_STRING keyvalue;
671 +} EVEL_INTERNAL_KEY;
673 +/**************************************************************************//**
674 + * meta-information about an instance of a jsonObject along with
675 + * the actual object instance
676 + *****************************************************************************/
677 +typedef struct json_object_instance
681 + unsigned long long objinst_epoch_microsec;
682 + DLIST object_keys; /*EVEL_INTERNAL_KEY list */
684 +} EVEL_JSON_OBJECT_INSTANCE;
685 +#define MAX_JSON_TOKENS 128
686 +/**************************************************************************//**
687 + * Create a new json object instance.
689 + * @note The mandatory fields on the Other must be supplied to this factory
690 + * function and are immutable once set. Optional fields have explicit
691 + * setter functions, but again values may only be set once so that the
692 + * Other has immutable properties.
693 + * @param yourjson json string.
694 + * @returns pointer to the newly manufactured ::EVEL_JSON_OBJECT_INSTANCE.
695 + * not used (i.e. posted) it must be released using ::evel_free_jsonobjectinstance.
696 + * @retval NULL Failed to create the json object instance.
697 + *****************************************************************************/
698 +EVEL_JSON_OBJECT_INSTANCE * evel_new_jsonobjinstance(const char *const yourjson);
699 +/**************************************************************************//**
700 + * Free an json object instance.
702 + * Free off the json object instance supplied.
703 + * Will free all the contained allocated memory.
705 + *****************************************************************************/
706 +void evel_free_jsonobjinst(EVEL_JSON_OBJECT_INSTANCE * objinst);
708 +/**************************************************************************//**
709 + * enrichment fields for internal VES Event Listener service use only,
710 + * not supplied by event sources
711 + *****************************************************************************/
712 +typedef struct json_object
716 + EVEL_OPTION_STRING objectschema;
717 + EVEL_OPTION_STRING objectschemaurl;
718 + EVEL_OPTION_STRING nfsubscribedobjname;
719 + EVEL_OPTION_STRING nfsubscriptionid;
720 + DLIST jsonobjectinstances; /* EVEL_JSON_OBJECT_INSTANCE list */
724 +/**************************************************************************//**
725 + * Create a new json object.
727 + * @note The mandatory fields on the Other must be supplied to this factory
728 + * function and are immutable once set. Optional fields have explicit
729 + * setter functions, but again values may only be set once so that the
730 + * Other has immutable properties.
731 + * @param name name of the object.
732 + * @returns pointer to the newly manufactured ::EVEL_JSON_OBJECT.
733 + * not used (i.e. posted) it must be released using ::evel_free_jsonobject.
734 + * @retval NULL Failed to create the json object.
735 + *****************************************************************************/
736 +EVEL_JSON_OBJECT * evel_new_jsonobject(const char *const name);
737 +/**************************************************************************//**
738 + * Free an json object.
740 + * Free off the json object instance supplied.
741 + * Will free all the contained allocated memory.
743 + *****************************************************************************/
744 +void evel_free_jsonobject(EVEL_JSON_OBJECT * jsobj);
745 +/*****************************************************************************/
746 +/* Supported Measurement version. */
747 +/*****************************************************************************/
748 +#define EVEL_MEASUREMENT_MAJOR_VERSION 2
749 +#define EVEL_MEASUREMENT_MINOR_VERSION 1
751 +/**************************************************************************//**
753 + * JSON equivalent field: errors
754 + *****************************************************************************/
755 +typedef struct measurement_errors {
756 + int receive_discards;
757 + int receive_errors;
758 + int transmit_discards;
759 + int transmit_errors;
760 +} MEASUREMENT_ERRORS;
762 +/**************************************************************************//**
764 + * JSON equivalent field: measurementsForVfScalingFields
765 + *****************************************************************************/
766 +typedef struct event_measurement {
767 + /***************************************************************************/
768 + /* Header and version */
769 + /***************************************************************************/
770 + EVENT_HEADER header;
774 + /***************************************************************************/
775 + /* Mandatory fields */
776 + /***************************************************************************/
777 + double measurement_interval;
779 + /***************************************************************************/
780 + /* Optional fields */
781 + /***************************************************************************/
782 + DLIST additional_info;
783 + DLIST additional_measurements;
784 + DLIST additional_objects;
786 + EVEL_OPTION_INT concurrent_sessions;
787 + EVEL_OPTION_INT configured_entities;
790 + MEASUREMENT_ERRORS * errors;
791 + DLIST feature_usage;
792 + DLIST filesystem_usage;
793 + DLIST latency_distribution;
794 + EVEL_OPTION_DOUBLE mean_request_latency;
796 + EVEL_OPTION_INT media_ports_in_use;
797 + EVEL_OPTION_INT request_rate;
798 + EVEL_OPTION_INT vnfc_scaling_metric;
801 +} EVENT_MEASUREMENT;
803 +/**************************************************************************//**
805 + * JSON equivalent field: cpuUsage
806 + *****************************************************************************/
807 +typedef struct measurement_cpu_use {
810 + EVEL_OPTION_DOUBLE idle;
811 + EVEL_OPTION_DOUBLE intrpt;
812 + EVEL_OPTION_DOUBLE nice;
813 + EVEL_OPTION_DOUBLE softirq;
814 + EVEL_OPTION_DOUBLE steal;
815 + EVEL_OPTION_DOUBLE sys;
816 + EVEL_OPTION_DOUBLE user;
817 + EVEL_OPTION_DOUBLE wait;
818 +} MEASUREMENT_CPU_USE;
821 +/**************************************************************************//**
823 + * JSON equivalent field: diskUsage
824 + *****************************************************************************/
825 +typedef struct measurement_disk_use {
827 + EVEL_OPTION_DOUBLE iotimeavg;
828 + EVEL_OPTION_DOUBLE iotimelast;
829 + EVEL_OPTION_DOUBLE iotimemax;
830 + EVEL_OPTION_DOUBLE iotimemin;
831 + EVEL_OPTION_DOUBLE mergereadavg;
832 + EVEL_OPTION_DOUBLE mergereadlast;
833 + EVEL_OPTION_DOUBLE mergereadmax;
834 + EVEL_OPTION_DOUBLE mergereadmin;
835 + EVEL_OPTION_DOUBLE mergewriteavg;
836 + EVEL_OPTION_DOUBLE mergewritelast;
837 + EVEL_OPTION_DOUBLE mergewritemax;
838 + EVEL_OPTION_DOUBLE mergewritemin;
839 + EVEL_OPTION_DOUBLE octetsreadavg;
840 + EVEL_OPTION_DOUBLE octetsreadlast;
841 + EVEL_OPTION_DOUBLE octetsreadmax;
842 + EVEL_OPTION_DOUBLE octetsreadmin;
843 + EVEL_OPTION_DOUBLE octetswriteavg;
844 + EVEL_OPTION_DOUBLE octetswritelast;
845 + EVEL_OPTION_DOUBLE octetswritemax;
846 + EVEL_OPTION_DOUBLE octetswritemin;
847 + EVEL_OPTION_DOUBLE opsreadavg;
848 + EVEL_OPTION_DOUBLE opsreadlast;
849 + EVEL_OPTION_DOUBLE opsreadmax;
850 + EVEL_OPTION_DOUBLE opsreadmin;
851 + EVEL_OPTION_DOUBLE opswriteavg;
852 + EVEL_OPTION_DOUBLE opswritelast;
853 + EVEL_OPTION_DOUBLE opswritemax;
854 + EVEL_OPTION_DOUBLE opswritemin;
855 + EVEL_OPTION_DOUBLE pendingopsavg;
856 + EVEL_OPTION_DOUBLE pendingopslast;
857 + EVEL_OPTION_DOUBLE pendingopsmax;
858 + EVEL_OPTION_DOUBLE pendingopsmin;
859 + EVEL_OPTION_DOUBLE timereadavg;
860 + EVEL_OPTION_DOUBLE timereadlast;
861 + EVEL_OPTION_DOUBLE timereadmax;
862 + EVEL_OPTION_DOUBLE timereadmin;
863 + EVEL_OPTION_DOUBLE timewriteavg;
864 + EVEL_OPTION_DOUBLE timewritelast;
865 + EVEL_OPTION_DOUBLE timewritemax;
866 + EVEL_OPTION_DOUBLE timewritemin;
868 +} MEASUREMENT_DISK_USE;
870 +/**************************************************************************//**
871 + * Add an additional Disk usage value name/value pair to the Measurement.
873 + * The name and value are null delimited ASCII strings. The library takes
874 + * a copy so the caller does not have to preserve values after the function
877 + * @param measurement Pointer to the measurement.
878 + * @param id ASCIIZ string with the CPU's identifier.
879 + * @param usage Disk utilization.
880 + *****************************************************************************/
881 +MEASUREMENT_DISK_USE * evel_measurement_new_disk_use_add(EVENT_MEASUREMENT * measurement, char * id);
883 +/**************************************************************************//**
884 + * Filesystem Usage.
885 + * JSON equivalent field: filesystemUsage
886 + *****************************************************************************/
887 +typedef struct measurement_fsys_use {
888 + char * filesystem_name;
889 + double block_configured;
892 + double ephemeral_configured;
893 + int ephemeral_iops;
894 + double ephemeral_used;
895 +} MEASUREMENT_FSYS_USE;
897 +/**************************************************************************//**
899 + * JSON equivalent field: memoryUsage
900 + *****************************************************************************/
901 +typedef struct measurement_mem_use {
905 + EVEL_OPTION_DOUBLE memcache;
906 + EVEL_OPTION_DOUBLE memconfig;
907 + EVEL_OPTION_DOUBLE memfree;
908 + EVEL_OPTION_DOUBLE slabrecl;
909 + EVEL_OPTION_DOUBLE slabunrecl;
910 + EVEL_OPTION_DOUBLE memused;
911 +} MEASUREMENT_MEM_USE;
913 +/**************************************************************************//**
914 + * Add an additional Memory usage value name/value pair to the Measurement.
916 + * The name and value are null delimited ASCII strings. The library takes
917 + * a copy so the caller does not have to preserve values after the function
920 + * @param measurement Pointer to the measurement.
921 + * @param id ASCIIZ string with the Memory identifier.
922 + * @param vmidentifier ASCIIZ string with the VM's identifier.
923 + * @param membuffsz Memory Size.
925 + * @return Returns pointer to memory use structure in measurements
926 + *****************************************************************************/
927 +MEASUREMENT_MEM_USE * evel_measurement_new_mem_use_add(EVENT_MEASUREMENT * measurement,
928 + char * id, char *vmidentifier, double membuffsz);
930 +/**************************************************************************//**
931 + * Set kilobytes of memory used for cache
933 + * @note The property is treated as immutable: it is only valid to call
934 + * the setter once. However, we don't assert if the caller tries to
935 + * overwrite, just ignoring the update instead.
937 + * @param mem_use Pointer to the Memory Use.
938 + * @param val double
939 + *****************************************************************************/
940 +void evel_measurement_mem_use_memcache_set(MEASUREMENT_MEM_USE * const mem_use,
942 +/**************************************************************************//**
943 + * Set kilobytes of memory configured in the virtual machine on which the VNFC reporting
945 + * @note The property is treated as immutable: it is only valid to call
946 + * the setter once. However, we don't assert if the caller tries to
947 + * overwrite, just ignoring the update instead.
949 + * @param mem_use Pointer to the Memory Use.
950 + * @param val double
951 + *****************************************************************************/
952 +void evel_measurement_mem_use_memconfig_set(MEASUREMENT_MEM_USE * const mem_use,
954 +/**************************************************************************//**
955 + * Set kilobytes of physical RAM left unused by the system
957 + * @note The property is treated as immutable: it is only valid to call
958 + * the setter once. However, we don't assert if the caller tries to
959 + * overwrite, just ignoring the update instead.
961 + * @param mem_use Pointer to the Memory Use.
962 + * @param val double
963 + *****************************************************************************/
964 +void evel_measurement_mem_use_memfree_set(MEASUREMENT_MEM_USE * const mem_use,
966 +/**************************************************************************//**
967 + * Set the part of the slab that can be reclaimed such as caches measured in kilobytes
969 + * @note The property is treated as immutable: it is only valid to call
970 + * the setter once. However, we don't assert if the caller tries to
971 + * overwrite, just ignoring the update instead.
973 + * @param mem_use Pointer to the Memory Use.
974 + * @param val double
975 + *****************************************************************************/
976 +void evel_measurement_mem_use_slab_reclaimed_set(MEASUREMENT_MEM_USE * const mem_use,
978 +/**************************************************************************//**
979 + * Set the part of the slab that cannot be reclaimed such as caches measured in kilobytes
981 + * @note The property is treated as immutable: it is only valid to call
982 + * the setter once. However, we don't assert if the caller tries to
983 + * overwrite, just ignoring the update instead.
985 + * @param mem_use Pointer to the Memory Use.
986 + * @param val double
987 + *****************************************************************************/
988 +void evel_measurement_mem_use_slab_unreclaimable_set(MEASUREMENT_MEM_USE * const mem_use,
990 +/**************************************************************************//**
991 + * Set the total memory minus the sum of free, buffered, cached and slab memory in kilobytes
993 + * @note The property is treated as immutable: it is only valid to call
994 + * the setter once. However, we don't assert if the caller tries to
995 + * overwrite, just ignoring the update instead.
997 + * @param mem_use Pointer to the Memory Use.
998 + * @param val double
999 + *****************************************************************************/
1000 +void evel_measurement_mem_use_usedup_set(MEASUREMENT_MEM_USE * const mem_use,
1001 + const double val);
1002 +/**************************************************************************//**
1004 + * JSON equivalent field: latencyBucketMeasure
1005 + *****************************************************************************/
1006 +typedef struct measurement_latency_bucket {
1009 + /***************************************************************************/
1010 + /* Optional fields */
1011 + /***************************************************************************/
1012 + EVEL_OPTION_DOUBLE high_end;
1013 + EVEL_OPTION_DOUBLE low_end;
1015 +} MEASUREMENT_LATENCY_BUCKET;
1017 +/**************************************************************************//**
1018 + * Virtual NIC usage.
1019 + * JSON equivalent field: vNicUsage
1020 + *****************************************************************************/
1021 +typedef struct measurement_vnic_performance {
1022 + /***************************************************************************/
1023 + /* Optional fields */
1024 + /***************************************************************************/
1025 + /*Cumulative count of broadcast packets received as read at the end of
1026 + the measurement interval*/
1027 + EVEL_OPTION_DOUBLE recvd_bcast_packets_acc;
1028 + /*Count of broadcast packets received within the measurement interval*/
1029 + EVEL_OPTION_DOUBLE recvd_bcast_packets_delta;
1030 + /*Cumulative count of discarded packets received as read at the end of
1031 + the measurement interval*/
1032 + EVEL_OPTION_DOUBLE recvd_discarded_packets_acc;
1033 + /*Count of discarded packets received within the measurement interval*/
1034 + EVEL_OPTION_DOUBLE recvd_discarded_packets_delta;
1035 + /*Cumulative count of error packets received as read at the end of
1036 + the measurement interval*/
1037 + EVEL_OPTION_DOUBLE recvd_error_packets_acc;
1038 + /*Count of error packets received within the measurement interval*/
1039 + EVEL_OPTION_DOUBLE recvd_error_packets_delta;
1040 + /*Cumulative count of multicast packets received as read at the end of
1041 + the measurement interval*/
1042 + EVEL_OPTION_DOUBLE recvd_mcast_packets_acc;
1043 + /*Count of mcast packets received within the measurement interval*/
1044 + EVEL_OPTION_DOUBLE recvd_mcast_packets_delta;
1045 + /*Cumulative count of octets received as read at the end of
1046 + the measurement interval*/
1047 + EVEL_OPTION_DOUBLE recvd_octets_acc;
1048 + /*Count of octets received within the measurement interval*/
1049 + EVEL_OPTION_DOUBLE recvd_octets_delta;
1050 + /*Cumulative count of all packets received as read at the end of
1051 + the measurement interval*/
1052 + EVEL_OPTION_DOUBLE recvd_total_packets_acc;
1053 + /*Count of all packets received within the measurement interval*/
1054 + EVEL_OPTION_DOUBLE recvd_total_packets_delta;
1055 + /*Cumulative count of unicast packets received as read at the end of
1056 + the measurement interval*/
1057 + EVEL_OPTION_DOUBLE recvd_ucast_packets_acc;
1058 + /*Count of unicast packets received within the measurement interval*/
1059 + EVEL_OPTION_DOUBLE recvd_ucast_packets_delta;
1060 + /*Cumulative count of transmitted broadcast packets at the end of
1061 + the measurement interval*/
1062 + EVEL_OPTION_DOUBLE tx_bcast_packets_acc;
1063 + /*Count of transmitted broadcast packets within the measurement interval*/
1064 + EVEL_OPTION_DOUBLE tx_bcast_packets_delta;
1065 + /*Cumulative count of transmit discarded packets at the end of
1066 + the measurement interval*/
1067 + EVEL_OPTION_DOUBLE tx_discarded_packets_acc;
1068 + /*Count of transmit discarded packets within the measurement interval*/
1069 + EVEL_OPTION_DOUBLE tx_discarded_packets_delta;
1070 + /*Cumulative count of transmit error packets at the end of
1071 + the measurement interval*/
1072 + EVEL_OPTION_DOUBLE tx_error_packets_acc;
1073 + /*Count of transmit error packets within the measurement interval*/
1074 + EVEL_OPTION_DOUBLE tx_error_packets_delta;
1075 + /*Cumulative count of transmit multicast packets at the end of
1076 + the measurement interval*/
1077 + EVEL_OPTION_DOUBLE tx_mcast_packets_acc;
1078 + /*Count of transmit multicast packets within the measurement interval*/
1079 + EVEL_OPTION_DOUBLE tx_mcast_packets_delta;
1080 + /*Cumulative count of transmit octets at the end of
1081 + the measurement interval*/
1082 + EVEL_OPTION_DOUBLE tx_octets_acc;
1083 + /*Count of transmit octets received within the measurement interval*/
1084 + EVEL_OPTION_DOUBLE tx_octets_delta;
1085 + /*Cumulative count of all transmit packets at the end of
1086 + the measurement interval*/
1087 + EVEL_OPTION_DOUBLE tx_total_packets_acc;
1088 + /*Count of transmit packets within the measurement interval*/
1089 + EVEL_OPTION_DOUBLE tx_total_packets_delta;
1090 + /*Cumulative count of all transmit unicast packets at the end of
1091 + the measurement interval*/
1092 + EVEL_OPTION_DOUBLE tx_ucast_packets_acc;
1093 + /*Count of transmit unicast packets within the measurement interval*/
1094 + EVEL_OPTION_DOUBLE tx_ucast_packets_delta;
1095 + /* Indicates whether vNicPerformance values are likely inaccurate
1096 + due to counter overflow or other condtions*/
1097 + char *valuesaresuspect;
1100 +} MEASUREMENT_VNIC_PERFORMANCE;
1102 +/**************************************************************************//**
1104 + * JSON equivalent field: codecsInUse
1105 + *****************************************************************************/
1106 +typedef struct measurement_codec_use {
1108 + int number_in_use;
1109 +} MEASUREMENT_CODEC_USE;
1111 +/**************************************************************************//**
1113 + * JSON equivalent field: featuresInUse
1114 + *****************************************************************************/
1115 +typedef struct measurement_feature_use {
1116 + char * feature_id;
1117 + int feature_utilization;
1118 +} MEASUREMENT_FEATURE_USE;
1120 +/**************************************************************************//**
1121 + * Measurement Group.
1122 + * JSON equivalent field: additionalMeasurements
1123 + *****************************************************************************/
1124 +typedef struct measurement_group {
1126 + DLIST measurements;
1127 +} MEASUREMENT_GROUP;
1129 +/**************************************************************************//**
1130 + * Custom Defined Measurement.
1131 + * JSON equivalent field: measurements
1132 + *****************************************************************************/
1133 +typedef struct custom_measurement {
1136 +} CUSTOM_MEASUREMENT;
1138 +/*****************************************************************************/
1139 +/* Supported Report version. */
1140 +/*****************************************************************************/
1141 +#define EVEL_REPORT_MAJOR_VERSION 1
1142 +#define EVEL_REPORT_MINOR_VERSION 1
1144 +/**************************************************************************//**
1146 + * JSON equivalent field: measurementsForVfReportingFields
1148 + * @note This is an experimental event type and is not currently a formal part
1149 + * of AT&T's specification.
1150 + *****************************************************************************/
1151 +typedef struct event_report {
1152 + /***************************************************************************/
1153 + /* Header and version */
1154 + /***************************************************************************/
1155 + EVENT_HEADER header;
1156 + int major_version;
1157 + int minor_version;
1159 + /***************************************************************************/
1160 + /* Mandatory fields */
1161 + /***************************************************************************/
1162 + double measurement_interval;
1164 + /***************************************************************************/
1165 + /* Optional fields */
1166 + /***************************************************************************/
1167 + DLIST feature_usage;
1168 + DLIST measurement_groups;
1172 +/**************************************************************************//**
1173 + * Mobile GTP Per Flow Metrics.
1174 + * JSON equivalent field: gtpPerFlowMetrics
1175 + *****************************************************************************/
1176 +typedef struct mobile_gtp_per_flow_metrics {
1177 + double avg_bit_error_rate;
1178 + double avg_packet_delay_variation;
1179 + int avg_packet_latency;
1180 + int avg_receive_throughput;
1181 + int avg_transmit_throughput;
1182 + int flow_activation_epoch;
1183 + int flow_activation_microsec;
1184 + int flow_deactivation_epoch;
1185 + int flow_deactivation_microsec;
1186 + time_t flow_deactivation_time;
1187 + char * flow_status;
1188 + int max_packet_delay_variation;
1189 + int num_activation_failures;
1190 + int num_bit_errors;
1191 + int num_bytes_received;
1192 + int num_bytes_transmitted;
1193 + int num_dropped_packets;
1194 + int num_l7_bytes_received;
1195 + int num_l7_bytes_transmitted;
1196 + int num_lost_packets;
1197 + int num_out_of_order_packets;
1198 + int num_packet_errors;
1199 + int num_packets_received_excl_retrans;
1200 + int num_packets_received_incl_retrans;
1201 + int num_packets_transmitted_incl_retrans;
1204 + int num_tunneled_l7_bytes_received;
1205 + int round_trip_time;
1206 + int time_to_first_byte;
1208 + /***************************************************************************/
1209 + /* Optional fields */
1210 + /***************************************************************************/
1211 + EVEL_OPTION_INT ip_tos_counts[EVEL_TOS_SUPPORTED];
1212 + EVEL_OPTION_INT tcp_flag_counts[EVEL_MAX_TCP_FLAGS];
1213 + EVEL_OPTION_INT qci_cos_counts[EVEL_MAX_QCI_COS_TYPES];
1214 + EVEL_OPTION_INT dur_connection_failed_status;
1215 + EVEL_OPTION_INT dur_tunnel_failed_status;
1216 + EVEL_OPTION_STRING flow_activated_by;
1217 + EVEL_OPTION_TIME flow_activation_time;
1218 + EVEL_OPTION_STRING flow_deactivated_by;
1219 + EVEL_OPTION_STRING gtp_connection_status;
1220 + EVEL_OPTION_STRING gtp_tunnel_status;
1221 + EVEL_OPTION_INT large_packet_rtt;
1222 + EVEL_OPTION_DOUBLE large_packet_threshold;
1223 + EVEL_OPTION_INT max_receive_bit_rate;
1224 + EVEL_OPTION_INT max_transmit_bit_rate;
1225 + EVEL_OPTION_INT num_gtp_echo_failures;
1226 + EVEL_OPTION_INT num_gtp_tunnel_errors;
1227 + EVEL_OPTION_INT num_http_errors;
1229 +} MOBILE_GTP_PER_FLOW_METRICS;
1231 +/*****************************************************************************/
1232 +/* Supported Mobile Flow version. */
1233 +/*****************************************************************************/
1234 +#define EVEL_MOBILE_FLOW_MAJOR_VERSION 1
1235 +#define EVEL_MOBILE_FLOW_MINOR_VERSION 2
1237 +/**************************************************************************//**
1239 + * JSON equivalent field: mobileFlow
1240 + *****************************************************************************/
1241 +typedef struct event_mobile_flow {
1242 + /***************************************************************************/
1243 + /* Header and version */
1244 + /***************************************************************************/
1245 + EVENT_HEADER header;
1246 + int major_version;
1247 + int minor_version;
1249 + /***************************************************************************/
1250 + /* Mandatory fields */
1251 + /***************************************************************************/
1252 + char * flow_direction;
1253 + MOBILE_GTP_PER_FLOW_METRICS * gtp_per_flow_metrics;
1254 + char * ip_protocol_type;
1255 + char * ip_version;
1256 + char * other_endpoint_ip_address;
1257 + int other_endpoint_port;
1258 + char * reporting_endpoint_ip_addr;
1259 + int reporting_endpoint_port;
1260 + DLIST additional_info; /* JSON: additionalFields */
1262 + /***************************************************************************/
1263 + /* Optional fields */
1264 + /***************************************************************************/
1265 + EVEL_OPTION_STRING application_type;
1266 + EVEL_OPTION_STRING app_protocol_type;
1267 + EVEL_OPTION_STRING app_protocol_version;
1268 + EVEL_OPTION_STRING cid;
1269 + EVEL_OPTION_STRING connection_type;
1270 + EVEL_OPTION_STRING ecgi;
1271 + EVEL_OPTION_STRING gtp_protocol_type;
1272 + EVEL_OPTION_STRING gtp_version;
1273 + EVEL_OPTION_STRING http_header;
1274 + EVEL_OPTION_STRING imei;
1275 + EVEL_OPTION_STRING imsi;
1276 + EVEL_OPTION_STRING lac;
1277 + EVEL_OPTION_STRING mcc;
1278 + EVEL_OPTION_STRING mnc;
1279 + EVEL_OPTION_STRING msisdn;
1280 + EVEL_OPTION_STRING other_functional_role;
1281 + EVEL_OPTION_STRING rac;
1282 + EVEL_OPTION_STRING radio_access_technology;
1283 + EVEL_OPTION_STRING sac;
1284 + EVEL_OPTION_INT sampling_algorithm;
1285 + EVEL_OPTION_STRING tac;
1286 + EVEL_OPTION_STRING tunnel_id;
1287 + EVEL_OPTION_STRING vlan_id;
1289 +} EVENT_MOBILE_FLOW;
1291 +/*****************************************************************************/
1292 +/* Supported Other field version. */
1293 +/*****************************************************************************/
1294 +#define EVEL_OTHER_EVENT_MAJOR_VERSION 1
1295 +#define EVEL_OTHER_EVENT_MINOR_VERSION 1
1297 +/**************************************************************************//**
1299 + * JSON equivalent field: otherFields
1300 + *****************************************************************************/
1301 +typedef struct event_other {
1302 + EVENT_HEADER header;
1303 + int major_version;
1304 + int minor_version;
1306 + HASHTABLE_T *namedarrays; /* HASHTABLE_T */
1307 + DLIST jsonobjects; /* DLIST of EVEL_JSON_OBJECT */
1308 + DLIST namedvalues;
1311 +/**************************************************************************//**
1313 + * JSON equivalent field: otherFields
1314 + *****************************************************************************/
1315 +typedef struct other_field {
1321 +/*****************************************************************************/
1322 +/* Supported Service Events version. */
1323 +/*****************************************************************************/
1324 +#define EVEL_HEARTBEAT_FIELD_MAJOR_VERSION 1
1325 +#define EVEL_HEARTBEAT_FIELD_MINOR_VERSION 1
1328 +/*****************************************************************************/
1329 +/* Supported Signaling version. */
1330 +/*****************************************************************************/
1331 +#define EVEL_SIGNALING_MAJOR_VERSION 2
1332 +#define EVEL_SIGNALING_MINOR_VERSION 1
1334 +/**************************************************************************//**
1335 + * Vendor VNF Name fields.
1336 + * JSON equivalent field: vendorVnfNameFields
1337 + *****************************************************************************/
1338 +typedef struct vendor_vnfname_field {
1339 + char * vendorname;
1340 + EVEL_OPTION_STRING vfmodule;
1341 + EVEL_OPTION_STRING vnfname;
1342 +} VENDOR_VNFNAME_FIELD;
1344 +/**************************************************************************//**
1346 + * JSON equivalent field: signalingFields
1347 + *****************************************************************************/
1348 +typedef struct event_signaling {
1349 + /***************************************************************************/
1350 + /* Header and version */
1351 + /***************************************************************************/
1352 + EVENT_HEADER header;
1353 + int major_version;
1354 + int minor_version;
1356 + /***************************************************************************/
1357 + /* Mandatory fields */
1358 + /***************************************************************************/
1359 + VENDOR_VNFNAME_FIELD vnfname_field;
1360 + EVEL_OPTION_STRING correlator; /* JSON: correlator */
1361 + EVEL_OPTION_STRING local_ip_address; /* JSON: localIpAddress */
1362 + EVEL_OPTION_STRING local_port; /* JSON: localPort */
1363 + EVEL_OPTION_STRING remote_ip_address; /* JSON: remoteIpAddress */
1364 + EVEL_OPTION_STRING remote_port; /* JSON: remotePort */
1366 + /***************************************************************************/
1367 + /* Optional fields */
1368 + /***************************************************************************/
1369 + EVEL_OPTION_STRING compressed_sip; /* JSON: compressedSip */
1370 + EVEL_OPTION_STRING summary_sip; /* JSON: summarySip */
1371 + DLIST additional_info;
1375 +/**************************************************************************//**
1376 + * Sgnaling Additional Field.
1377 + * JSON equivalent field: additionalFields
1378 + *****************************************************************************/
1379 +typedef struct signaling_additional_field {
1382 +} SIGNALING_ADDL_FIELD;
1384 +/*****************************************************************************/
1385 +/* Supported State Change version. */
1386 +/*****************************************************************************/
1387 +#define EVEL_STATE_CHANGE_MAJOR_VERSION 1
1388 +#define EVEL_STATE_CHANGE_MINOR_VERSION 2
1390 +/**************************************************************************//**
1392 + * JSON equivalent field: stateChangeFields
1393 + *****************************************************************************/
1394 +typedef struct event_state_change {
1395 + /***************************************************************************/
1396 + /* Header and version */
1397 + /***************************************************************************/
1398 + EVENT_HEADER header;
1399 + int major_version;
1400 + int minor_version;
1402 + /***************************************************************************/
1403 + /* Mandatory fields */
1404 + /***************************************************************************/
1405 + EVEL_ENTITY_STATE new_state;
1406 + EVEL_ENTITY_STATE old_state;
1407 + char * state_interface;
1410 + /***************************************************************************/
1411 + /* Optional fields */
1412 + /***************************************************************************/
1413 + DLIST additional_fields;
1415 +} EVENT_STATE_CHANGE;
1417 +/**************************************************************************//**
1418 + * State Change Additional Field.
1419 + * JSON equivalent field: additionalFields
1420 + *****************************************************************************/
1421 +typedef struct state_change_additional_field {
1424 +} STATE_CHANGE_ADDL_FIELD;
1426 +/*****************************************************************************/
1427 +/* Supported Syslog version. */
1428 +/*****************************************************************************/
1429 +#define EVEL_SYSLOG_MAJOR_VERSION 1
1430 +#define EVEL_SYSLOG_MINOR_VERSION 2
1432 +/**************************************************************************//**
1434 + * JSON equivalent field: syslogFields
1435 + *****************************************************************************/
1436 +typedef struct event_syslog {
1437 + /***************************************************************************/
1438 + /* Header and version */
1439 + /***************************************************************************/
1440 + EVENT_HEADER header;
1441 + int major_version;
1442 + int minor_version;
1444 + /***************************************************************************/
1445 + /* Mandatory fields */
1446 + /***************************************************************************/
1447 + EVEL_SOURCE_TYPES event_source_type;
1448 + char * syslog_msg;
1449 + char * syslog_tag;
1451 + /***************************************************************************/
1452 + /* Optional fields */
1453 + /***************************************************************************/
1454 + EVEL_OPTION_STRING additional_filters;
1455 + EVEL_OPTION_STRING event_source_host;
1456 + EVEL_OPTION_INT syslog_facility;
1457 + EVEL_OPTION_INT syslog_priority;
1458 + EVEL_OPTION_STRING syslog_proc;
1459 + EVEL_OPTION_INT syslog_proc_id;
1460 + EVEL_OPTION_STRING syslog_s_data;
1461 + EVEL_OPTION_STRING syslog_sdid;
1462 + EVEL_OPTION_STRING syslog_severity;
1463 + double syslog_fver;
1464 + EVEL_OPTION_INT syslog_ver;
1468 +/**************************************************************************//**
1470 + * JSON equivalent object: attCopyrightNotice
1471 + *****************************************************************************/
1472 +typedef struct copyright {
1473 + char * useAndRedistribution;
1474 + char * condition1;
1475 + char * condition2;
1476 + char * condition3;
1477 + char * condition4;
1478 + char * disclaimerLine1;
1479 + char * disclaimerLine2;
1480 + char * disclaimerLine3;
1481 + char * disclaimerLine4;
1484 +/**************************************************************************//**
1485 + * Library initialization.
1487 + * Initialize the EVEL library.
1489 + * @note This function initializes the cURL library. Applications making use
1490 + * of libcurl may need to pull the initialization out of here. Note
1491 + * also that this function is not threadsafe as a result - refer to
1492 + * libcurl's API documentation for relevant warnings.
1494 + * @sa Matching Term function.
1496 + * @param fqdn The API's FQDN or IP address.
1497 + * @param port The API's port.
1498 + * @param path The optional path (may be NULL).
1499 + * @param topic The optional topic part of the URL (may be NULL).
1500 + * @param secure Whether to use HTTPS (0=HTTP, 1=HTTPS).
1501 + * @param username Username for Basic Authentication of requests.
1502 + * @param password Password for Basic Authentication of requests.
1503 + * @param source_type The kind of node we represent.
1504 + * @param role The role this node undertakes.
1505 + * @param verbosity 0 for normal operation, positive values for chattier
1508 + * @returns Status code
1509 + * @retval EVEL_SUCCESS On success
1510 + * @retval ::EVEL_ERR_CODES On failure.
1511 + *****************************************************************************/
1512 +EVEL_ERR_CODES evel_initialize(const char * const fqdn,
1514 + const char * const path,
1515 + const char * const topic,
1517 + const char * const username,
1518 + const char * const password,
1519 + EVEL_SOURCE_TYPES source_type,
1520 + const char * const role,
1524 +/**************************************************************************//**
1525 + * Clean up the EVEL library.
1527 + * @note that at present don't expect Init/Term cycling not to leak memory!
1529 + * @returns Status code
1530 + * @retval EVEL_SUCCESS On success
1531 + * @retval "One of ::EVEL_ERR_CODES" On failure.
1532 + *****************************************************************************/
1533 +EVEL_ERR_CODES evel_terminate(void);
1535 +EVEL_ERR_CODES evel_post_event(EVENT_HEADER * event);
1536 +const char * evel_error_string(void);
1539 +/**************************************************************************//**
1542 + * Free off the event supplied. Will free all the contained allocated memory.
1544 + * @note It is safe to free a NULL pointer.
1545 + *****************************************************************************/
1546 +void evel_free_event(void * event);
1548 +/**************************************************************************//**
1549 + * Encode the event as a JSON event object according to AT&T's schema.
1551 + * @param json Pointer to where to store the JSON encoded data.
1552 + * @param max_size Size of storage available in json_body.
1553 + * @param event Pointer to the ::EVENT_HEADER to encode.
1554 + * @returns Number of bytes actually written.
1555 + *****************************************************************************/
1556 +int evel_json_encode_event(char * json,
1558 + EVENT_HEADER * event);
1560 +/**************************************************************************//**
1561 + * Initialize an event instance id.
1563 + * @param vfield Pointer to the event vnfname field being initialized.
1564 + * @param vendor_id The vendor id to encode in the event instance id.
1565 + * @param event_id The event id to encode in the event instance id.
1566 + *****************************************************************************/
1567 +void evel_init_vendor_field(VENDOR_VNFNAME_FIELD * const vfield,
1568 + const char * const vendor_name);
1570 +/**************************************************************************//**
1571 + * Set the Vendor module property of the Vendor.
1573 + * @note The property is treated as immutable: it is only valid to call
1574 + * the setter once. However, we don't assert if the caller tries to
1575 + * overwrite, just ignoring the update instead.
1577 + * @param vfield Pointer to the Vendor field.
1578 + * @param module_name The module name to be set. ASCIIZ string. The caller
1579 + * does not need to preserve the value once the function
1581 + *****************************************************************************/
1582 +void evel_vendor_field_module_set(VENDOR_VNFNAME_FIELD * const vfield,
1583 + const char * const module_name);
1584 +/**************************************************************************//**
1585 + * Set the Vendor module property of the Vendor.
1587 + * @note The property is treated as immutable: it is only valid to call
1588 + * the setter once. However, we don't assert if the caller tries to
1589 + * overwrite, just ignoring the update instead.
1591 + * @param vfield Pointer to the Vendor field.
1592 + * @param module_name The module name to be set. ASCIIZ string. The caller
1593 + * does not need to preserve the value once the function
1595 + *****************************************************************************/
1596 +void evel_vendor_field_vnfname_set(VENDOR_VNFNAME_FIELD * const vfield,
1597 + const char * const vnfname);
1598 +/**************************************************************************//**
1599 + * Free an event instance id.
1601 + * @param vfield Pointer to the event vnfname_field being freed.
1602 + *****************************************************************************/
1603 +void evel_free_event_vendor_field(VENDOR_VNFNAME_FIELD * const vfield);
1605 +/**************************************************************************//**
1606 + * Callback function to provide returned data.
1608 + * Copy data into the supplied buffer, write_callback::ptr, checking size
1611 + * @returns Number of bytes placed into write_callback::ptr. 0 for EOF.
1612 + *****************************************************************************/
1613 +size_t evel_write_callback(void *contents,
1618 +/*****************************************************************************/
1619 +/*****************************************************************************/
1621 +/* HEARTBEAT - (includes common header, too) */
1623 +/*****************************************************************************/
1624 +/*****************************************************************************/
1626 +/**************************************************************************//**
1627 + * Create a new heartbeat event.
1629 + * @note that the heartbeat is just a "naked" commonEventHeader!
1631 + * @returns pointer to the newly manufactured ::EVENT_HEADER. If the event is
1632 + * not used it must be released using ::evel_free_event
1633 + * @retval NULL Failed to create the event.
1634 + *****************************************************************************/
1635 +EVENT_HEADER * evel_new_heartbeat(void);
1637 +/**************************************************************************//**
1638 + * Create a new heartbeat event of given name and type.
1640 + * @note that the heartbeat is just a "naked" commonEventHeader!
1642 + * @param event_name Unique Event Name confirming Domain AsdcModel Description
1643 + * @param event_id A universal identifier of the event for: troubleshooting correlation, analysis, etc
1645 + * @returns pointer to the newly manufactured ::EVENT_HEADER. If the event is
1646 + * not used it must be released using ::evel_free_event
1647 + * @retval NULL Failed to create the event.
1648 + *****************************************************************************/
1649 +EVENT_HEADER * evel_new_heartbeat_nameid(const char* ev_name, const char *ev_id);
1652 +/**************************************************************************//**
1653 + * Free an event header.
1655 + * Free off the event header supplied. Will free all the contained allocated
1658 + * @note It does not free the header itself, since that may be part of a
1659 + * larger structure.
1660 + *****************************************************************************/
1661 +void evel_free_header(EVENT_HEADER * const event);
1663 +/**************************************************************************//**
1664 + * Initialize a newly created event header.
1666 + * @param header Pointer to the header being initialized.
1667 + *****************************************************************************/
1668 +void evel_init_header(EVENT_HEADER * const header,const char *const eventname);
1670 +/**************************************************************************//**
1671 + * Set the Event Type property of the event header.
1673 + * @param header Pointer to the ::EVENT_HEADER.
1674 + * @param type The Event Type to be set. ASCIIZ string. The caller
1675 + * does not need to preserve the value once the function
1677 + *****************************************************************************/
1678 +void evel_header_type_set(EVENT_HEADER * const header,
1679 + const char * const type);
1681 +/**************************************************************************//**
1682 + * Set the Start Epoch property of the event header.
1684 + * @note The Start Epoch defaults to the time of event creation.
1686 + * @param header Pointer to the ::EVENT_HEADER.
1687 + * @param start_epoch_microsec
1688 + * The start epoch to set, in microseconds.
1689 + *****************************************************************************/
1690 +void evel_start_epoch_set(EVENT_HEADER * const header,
1691 + const unsigned long long start_epoch_microsec);
1693 +/**************************************************************************//**
1694 + * Set the Last Epoch property of the event header.
1696 + * @note The Last Epoch defaults to the time of event creation.
1698 + * @param header Pointer to the ::EVENT_HEADER.
1699 + * @param last_epoch_microsec
1700 + * The last epoch to set, in microseconds.
1701 + *****************************************************************************/
1702 +void evel_last_epoch_set(EVENT_HEADER * const header,
1703 + const unsigned long long last_epoch_microsec);
1705 +/**************************************************************************//**
1706 + * Set the Reporting Entity Name property of the event header.
1708 + * @note The Reporting Entity Name defaults to the OpenStack VM Name.
1710 + * @param header Pointer to the ::EVENT_HEADER.
1711 + * @param entity_name The entity name to set.
1712 + *****************************************************************************/
1713 +void evel_reporting_entity_name_set(EVENT_HEADER * const header,
1714 + const char * const entity_name);
1716 +/**************************************************************************//**
1717 + * Set the Reporting Entity Id property of the event header.
1719 + * @note The Reporting Entity Id defaults to the OpenStack VM UUID.
1721 + * @param header Pointer to the ::EVENT_HEADER.
1722 + * @param entity_id The entity id to set.
1723 + *****************************************************************************/
1724 +void evel_reporting_entity_id_set(EVENT_HEADER * const header,
1725 + const char * const entity_id);
1727 +/**************************************************************************//**
1728 + * Set the NFC Naming code property of the event header.
1730 + * @param header Pointer to the ::EVENT_HEADER.
1731 + * @param nfcnamingcode String
1732 + *****************************************************************************/
1733 +void evel_nfcnamingcode_set(EVENT_HEADER * const header,
1734 + const char * const nfcnam);
1735 +/**************************************************************************//**
1736 + * Set the NF Naming code property of the event header.
1738 + * @param header Pointer to the ::EVENT_HEADER.
1739 + * @param nfnamingcode String
1740 + *****************************************************************************/
1741 +void evel_nfnamingcode_set(EVENT_HEADER * const header,
1742 + const char * const nfnam);
1744 +/*****************************************************************************/
1745 +/*****************************************************************************/
1749 +/*****************************************************************************/
1750 +/*****************************************************************************/
1752 +/**************************************************************************//**
1753 + * Create a new fault event.
1755 + * @note The mandatory fields on the Fault must be supplied to this factory
1756 + * function and are immutable once set. Optional fields have explicit
1757 + * setter functions, but again values may only be set once so that the
1758 + * Fault has immutable properties.
1759 + * @param event_name Unique Event Name
1760 + * @param event_id A universal identifier of the event for analysis etc
1761 + * @param condition The condition indicated by the Fault.
1762 + * @param specific_problem The specific problem triggering the fault.
1763 + * @param priority The priority of the event.
1764 + * @param severity The severity of the Fault.
1765 + * @param ev_source_type Source of Alarm event
1766 + * @param version fault version
1767 + * @param status status of Virtual Function
1768 + * @returns pointer to the newly manufactured ::EVENT_FAULT. If the event is
1769 + * not used (i.e. posted) it must be released using ::evel_free_fault.
1770 + * @retval NULL Failed to create the event.
1771 + *****************************************************************************/
1772 +EVENT_FAULT * evel_new_fault(const char* ev_name, const char *ev_id,
1773 + const char * const condition,
1774 + const char * const specific_problem,
1775 + EVEL_EVENT_PRIORITIES priority,
1776 + EVEL_SEVERITIES severity,
1777 + EVEL_SOURCE_TYPES ev_source_type,
1778 + EVEL_VF_STATUSES status);
1780 +/**************************************************************************//**
1783 + * Free off the Fault supplied. Will free all the contained allocated memory.
1785 + * @note It does not free the Fault itself, since that may be part of a
1786 + * larger structure.
1787 + *****************************************************************************/
1788 +void evel_free_fault(EVENT_FAULT * event);
1790 +/**************************************************************************//**
1791 + * Set the Fault Category property of the Fault.
1793 + * @note The property is treated as immutable: it is only valid to call
1794 + * the setter once. However, we don't assert if the caller tries to
1795 + * overwrite, just ignoring the update instead.
1797 + * @param fault Pointer to the fault.
1798 + * @param category Category : license, link, routing, security, signaling.
1799 + * ASCIIZ string. The caller
1800 + * does not need to preserve the value once the function
1802 + *****************************************************************************/
1803 +void evel_fault_category_set(EVENT_FAULT * fault,
1804 + const char * const category);
1806 +/**************************************************************************//**
1807 + * Set the Alarm Interface A property of the Fault.
1809 + * @note The property is treated as immutable: it is only valid to call
1810 + * the setter once. However, we don't assert if the caller tries to
1811 + * overwrite, just ignoring the update instead.
1813 + * @param fault Pointer to the fault.
1814 + * @param interface The Alarm Interface A to be set. ASCIIZ string. The caller
1815 + * does not need to preserve the value once the function
1817 + *****************************************************************************/
1818 +void evel_fault_interface_set(EVENT_FAULT * fault,
1819 + const char * const interface);
1821 +/**************************************************************************//**
1822 + * Add an additional value name/value pair to the Fault.
1824 + * The name and value are null delimited ASCII strings. The library takes
1825 + * a copy so the caller does not have to preserve values after the function
1828 + * @param fault Pointer to the fault.
1829 + * @param name ASCIIZ string with the attribute's name.
1830 + * @param value ASCIIZ string with the attribute's value.
1831 + *****************************************************************************/
1832 +void evel_fault_addl_info_add(EVENT_FAULT * fault, char * name, char * value);
1834 +/**************************************************************************//**
1835 + * Set the Event Type property of the Fault.
1837 + * @note The property is treated as immutable: it is only valid to call
1838 + * the setter once. However, we don't assert if the caller tries to
1839 + * overwrite, just ignoring the update instead.
1841 + * @param fault Pointer to the fault.
1842 + * @param type The Event Type to be set. ASCIIZ string. The caller
1843 + * does not need to preserve the value once the function
1845 + *****************************************************************************/
1846 +void evel_fault_type_set(EVENT_FAULT * fault, const char * const type);
1848 +/*****************************************************************************/
1849 +/*****************************************************************************/
1853 +/*****************************************************************************/
1854 +/*****************************************************************************/
1856 +/**************************************************************************//**
1857 + * Create a new Measurement event.
1859 + * @note The mandatory fields on the Measurement must be supplied to this
1860 + * factory function and are immutable once set. Optional fields have
1861 + * explicit setter functions, but again values may only be set once so
1862 + * that the Measurement has immutable properties.
1864 + * @param measurement_interval
1865 + * @param event_name Unique Event Name
1866 + * @param event_id A universal identifier of the event for analysis etc
1868 + * @returns pointer to the newly manufactured ::EVENT_MEASUREMENT. If the
1869 + * event is not used (i.e. posted) it must be released using
1870 + * ::evel_free_event.
1871 + * @retval NULL Failed to create the event.
1872 + *****************************************************************************/
1873 +EVENT_MEASUREMENT * evel_new_measurement(double measurement_interval,const char* ev_name, const char *ev_id, const char *ev_source_name);
1875 +/**************************************************************************//**
1876 + * Free a Measurement.
1878 + * Free off the Measurement supplied. Will free all the contained allocated
1881 + * @note It does not free the Measurement itself, since that may be part of a
1882 + * larger structure.
1883 + *****************************************************************************/
1884 +void evel_free_measurement(EVENT_MEASUREMENT * event);
1886 +/**************************************************************************//**
1887 + * Set the Event Type property of the Measurement.
1889 + * @note The property is treated as immutable: it is only valid to call
1890 + * the setter once. However, we don't assert if the caller tries to
1891 + * overwrite, just ignoring the update instead.
1893 + * @param measurement Pointer to the Measurement.
1894 + * @param type The Event Type to be set. ASCIIZ string. The caller
1895 + * does not need to preserve the value once the function
1897 + *****************************************************************************/
1898 +void evel_measurement_type_set(EVENT_MEASUREMENT * measurement,
1899 + const char * const type);
1901 +/**************************************************************************//**
1902 + * Set the Concurrent Sessions property of the Measurement.
1904 + * @note The property is treated as immutable: it is only valid to call
1905 + * the setter once. However, we don't assert if the caller tries to
1906 + * overwrite, just ignoring the update instead.
1908 + * @param measurement Pointer to the Measurement.
1909 + * @param concurrent_sessions The Concurrent Sessions to be set.
1910 + *****************************************************************************/
1911 +void evel_measurement_conc_sess_set(EVENT_MEASUREMENT * measurement,
1912 + int concurrent_sessions);
1914 +/**************************************************************************//**
1915 + * Set the Configured Entities property of the Measurement.
1917 + * @note The property is treated as immutable: it is only valid to call
1918 + * the setter once. However, we don't assert if the caller tries to
1919 + * overwrite, just ignoring the update instead.
1921 + * @param measurement Pointer to the Measurement.
1922 + * @param configured_entities The Configured Entities to be set.
1923 + *****************************************************************************/
1924 +void evel_measurement_cfg_ents_set(EVENT_MEASUREMENT * measurement,
1925 + int configured_entities);
1927 +/**************************************************************************//**
1928 + * Add an additional set of Errors to the Measurement.
1930 + * @note The property is treated as immutable: it is only valid to call
1931 + * the setter once. However, we don't assert if the caller tries to
1932 + * overwrite, just ignoring the update instead.
1934 + * @param measurement Pointer to the measurement.
1935 + * @param receive_discards The number of receive discards.
1936 + * @param receive_errors The number of receive errors.
1937 + * @param transmit_discards The number of transmit discards.
1938 + * @param transmit_errors The number of transmit errors.
1939 + *****************************************************************************/
1940 +void evel_measurement_errors_set(EVENT_MEASUREMENT * measurement,
1941 + int receive_discards,
1942 + int receive_errors,
1943 + int transmit_discards,
1944 + int transmit_errors);
1946 +/**************************************************************************//**
1947 + * Set the Mean Request Latency property of the Measurement.
1949 + * @note The property is treated as immutable: it is only valid to call
1950 + * the setter once. However, we don't assert if the caller tries to
1951 + * overwrite, just ignoring the update instead.
1953 + * @param measurement Pointer to the Measurement.
1954 + * @param mean_request_latency The Mean Request Latency to be set.
1955 + *****************************************************************************/
1956 +void evel_measurement_mean_req_lat_set(EVENT_MEASUREMENT * measurement,
1957 + double mean_request_latency);
1959 +/**************************************************************************//**
1960 + * Set the Request Rate property of the Measurement.
1962 + * @note The property is treated as immutable: it is only valid to call
1963 + * the setter once. However, we don't assert if the caller tries to
1964 + * overwrite, just ignoring the update instead.
1966 + * @param measurement Pointer to the Measurement.
1967 + * @param request_rate The Request Rate to be set.
1968 + *****************************************************************************/
1969 +void evel_measurement_request_rate_set(EVENT_MEASUREMENT * measurement,
1970 + int request_rate);
1972 +/**************************************************************************//**
1973 + * Add an additional CPU usage value name/value pair to the Measurement.
1975 + * The name and value are null delimited ASCII strings. The library takes
1976 + * a copy so the caller does not have to preserve values after the function
1979 + * @param measurement Pointer to the measurement.
1980 + * @param id ASCIIZ string with the CPU's identifier.
1981 + * @param usage CPU utilization.
1982 + *****************************************************************************/
1983 +MEASUREMENT_CPU_USE * evel_measurement_new_cpu_use_add(EVENT_MEASUREMENT * measurement, char * id, double usage);
1985 +/**************************************************************************//**
1986 + * Set the CPU Idle value in measurement interval
1987 + * percentage of CPU time spent in the idle task
1989 + * @note The property is treated as immutable: it is only valid to call
1990 + * the setter once. However, we don't assert if the caller tries to
1991 + * overwrite, just ignoring the update instead.
1993 + * @param cpu_use Pointer to the CPU Use.
1994 + * @param val double
1995 + *****************************************************************************/
1996 +void evel_measurement_cpu_use_idle_set(MEASUREMENT_CPU_USE *const cpu_use,
1997 + const double val);
1999 +/**************************************************************************//**
2000 + * Set the percentage of time spent servicing interrupts
2002 + * @note The property is treated as immutable: it is only valid to call
2003 + * the setter once. However, we don't assert if the caller tries to
2004 + * overwrite, just ignoring the update instead.
2006 + * @param cpu_use Pointer to the CPU Use.
2007 + * @param val double
2008 + *****************************************************************************/
2009 +void evel_measurement_cpu_use_interrupt_set(MEASUREMENT_CPU_USE * const cpu_use,
2010 + const double val);
2012 +/**************************************************************************//**
2013 + * Set the percentage of time spent running user space processes that have been niced
2015 + * @note The property is treated as immutable: it is only valid to call
2016 + * the setter once. However, we don't assert if the caller tries to
2017 + * overwrite, just ignoring the update instead.
2019 + * @param cpu_use Pointer to the CPU Use.
2020 + * @param val double
2021 + *****************************************************************************/
2022 +void evel_measurement_cpu_use_nice_set(MEASUREMENT_CPU_USE * const cpu_use,
2023 + const double val);
2025 +/**************************************************************************//**
2026 + * Set the percentage of time spent handling soft irq interrupts
2028 + * @note The property is treated as immutable: it is only valid to call
2029 + * the setter once. However, we don't assert if the caller tries to
2030 + * overwrite, just ignoring the update instead.
2032 + * @param cpu_use Pointer to the CPU Use.
2033 + * @param val double
2034 + *****************************************************************************/
2035 +void evel_measurement_cpu_use_softirq_set(MEASUREMENT_CPU_USE * const cpu_use,
2036 + const double val);
2037 +/**************************************************************************//**
2038 + * Set the percentage of time spent in involuntary wait
2040 + * @note The property is treated as immutable: it is only valid to call
2041 + * the setter once. However, we don't assert if the caller tries to
2042 + * overwrite, just ignoring the update instead.
2044 + * @param cpu_use Pointer to the CPU Use.
2045 + * @param val double
2046 + *****************************************************************************/
2047 +void evel_measurement_cpu_use_steal_set(MEASUREMENT_CPU_USE * const cpu_use,
2048 + const double val);
2049 +/**************************************************************************//**
2050 + * Set the percentage of time spent on system tasks running the kernel
2052 + * @note The property is treated as immutable: it is only valid to call
2053 + * the setter once. However, we don't assert if the caller tries to
2054 + * overwrite, just ignoring the update instead.
2056 + * @param cpu_use Pointer to the CPU Use.
2057 + * @param val double
2058 + *****************************************************************************/
2059 +void evel_measurement_cpu_use_system_set(MEASUREMENT_CPU_USE * const cpu_use,
2060 + const double val);
2061 +/**************************************************************************//**
2062 + * Set the percentage of time spent running un-niced user space processes
2064 + * @note The property is treated as immutable: it is only valid to call
2065 + * the setter once. However, we don't assert if the caller tries to
2066 + * overwrite, just ignoring the update instead.
2068 + * @param cpu_use Pointer to the CPU Use.
2069 + * @param val double
2070 + *****************************************************************************/
2071 +void evel_measurement_cpu_use_usageuser_set(MEASUREMENT_CPU_USE * const cpu_use,
2072 + const double val);
2073 +/**************************************************************************//**
2074 + * Set the percentage of CPU time spent waiting for I/O operations to complete
2076 + * @note The property is treated as immutable: it is only valid to call
2077 + * the setter once. However, we don't assert if the caller tries to
2078 + * overwrite, just ignoring the update instead.
2080 + * @param cpu_use Pointer to the CPU Use.
2081 + * @param val double
2082 + *****************************************************************************/
2083 +void evel_measurement_cpu_use_wait_set(MEASUREMENT_CPU_USE * const cpu_use,
2084 + const double val);
2086 +/**************************************************************************//**
2087 + * Add an additional File System usage value name/value pair to the
2090 + * The filesystem_name is null delimited ASCII string. The library takes a
2091 + * copy so the caller does not have to preserve values after the function
2094 + * @param measurement Pointer to the measurement.
2095 + * @param filesystem_name ASCIIZ string with the file-system's UUID.
2096 + * @param block_configured Block storage configured.
2097 + * @param block_used Block storage in use.
2098 + * @param block_iops Block storage IOPS.
2099 + * @param ephemeral_configured Ephemeral storage configured.
2100 + * @param ephemeral_used Ephemeral storage in use.
2101 + * @param ephemeral_iops Ephemeral storage IOPS.
2102 + *****************************************************************************/
2103 +void evel_measurement_fsys_use_add(EVENT_MEASUREMENT * measurement,
2104 + char * filesystem_name,
2105 + double block_configured,
2106 + double block_used,
2108 + double ephemeral_configured,
2109 + double ephemeral_used,
2110 + int ephemeral_iops);
2112 +/**************************************************************************//**
2113 + * Add a Feature usage value name/value pair to the Measurement.
2115 + * The name is null delimited ASCII string. The library takes
2116 + * a copy so the caller does not have to preserve values after the function
2119 + * @param measurement Pointer to the measurement.
2120 + * @param feature ASCIIZ string with the feature's name.
2121 + * @param utilization Utilization of the feature.
2122 + *****************************************************************************/
2123 +void evel_measurement_feature_use_add(EVENT_MEASUREMENT * measurement,
2127 +/**************************************************************************//**
2128 + * Add a Additional Measurement value name/value pair to the Measurement.
2130 + * The name is null delimited ASCII string. The library takes
2131 + * a copy so the caller does not have to preserve values after the function
2134 + * @param measurement Pointer to the Measurement.
2135 + * @param group ASCIIZ string with the measurement group's name.
2136 + * @param name ASCIIZ string containing the measurement's name.
2137 + * @param name ASCIIZ string containing the measurement's value.
2138 + *****************************************************************************/
2139 +void evel_measurement_custom_measurement_add(EVENT_MEASUREMENT * measurement,
2140 + const char * const group,
2141 + const char * const name,
2142 + const char * const value);
2144 +/**************************************************************************//**
2145 + * Add a Codec usage value name/value pair to the Measurement.
2147 + * The name is null delimited ASCII string. The library takes
2148 + * a copy so the caller does not have to preserve values after the function
2151 + * @param measurement Pointer to the measurement.
2152 + * @param codec ASCIIZ string with the codec's name.
2153 + * @param utilization Utilization of the feature.
2154 + *****************************************************************************/
2155 +void evel_measurement_codec_use_add(EVENT_MEASUREMENT * measurement,
2159 +/**************************************************************************//**
2160 + * Set the Media Ports in Use property of the Measurement.
2162 + * @note The property is treated as immutable: it is only valid to call
2163 + * the setter once. However, we don't assert if the caller tries to
2164 + * overwrite, just ignoring the update instead.
2166 + * @param measurement Pointer to the measurement.
2167 + * @param media_ports_in_use The media port usage to set.
2168 + *****************************************************************************/
2169 +void evel_measurement_media_port_use_set(EVENT_MEASUREMENT * measurement,
2170 + int media_ports_in_use);
2172 +/**************************************************************************//**
2173 + * Set the VNFC Scaling Metric property of the Measurement.
2175 + * @note The property is treated as immutable: it is only valid to call
2176 + * the setter once. However, we don't assert if the caller tries to
2177 + * overwrite, just ignoring the update instead.
2179 + * @param measurement Pointer to the measurement.
2180 + * @param scaling_metric The scaling metric to set.
2181 + *****************************************************************************/
2182 +void evel_measurement_vnfc_scaling_metric_set(EVENT_MEASUREMENT * measurement,
2183 + int scaling_metric);
2185 +/**************************************************************************//**
2186 + * Create a new Latency Bucket to be added to a Measurement event.
2188 + * @note The mandatory fields on the ::MEASUREMENT_LATENCY_BUCKET must be
2189 + * supplied to this factory function and are immutable once set.
2190 + * Optional fields have explicit setter functions, but again values
2191 + * may only be set once so that the ::MEASUREMENT_LATENCY_BUCKET has
2192 + * immutable properties.
2194 + * @param count Count of events in this bucket.
2196 + * @returns pointer to the newly manufactured ::MEASUREMENT_LATENCY_BUCKET.
2197 + * @retval NULL Failed to create the Latency Bucket.
2198 + *****************************************************************************/
2199 +MEASUREMENT_LATENCY_BUCKET * evel_new_meas_latency_bucket(const int count);
2201 +/**************************************************************************//**
2202 + * Set the High End property of the Measurement Latency Bucket.
2204 + * @note The property is treated as immutable: it is only valid to call
2205 + * the setter once. However, we don't assert if the caller tries to
2206 + * overwrite, just ignoring the update instead.
2208 + * @param bucket Pointer to the Measurement Latency Bucket.
2209 + * @param high_end High end of the bucket's range.
2210 + *****************************************************************************/
2211 +void evel_meas_latency_bucket_high_end_set(
2212 + MEASUREMENT_LATENCY_BUCKET * const bucket,
2213 + const double high_end);
2215 +/**************************************************************************//**
2216 + * Set the Low End property of the Measurement Latency Bucket.
2218 + * @note The property is treated as immutable: it is only valid to call
2219 + * the setter once. However, we don't assert if the caller tries to
2220 + * overwrite, just ignoring the update instead.
2222 + * @param bucket Pointer to the Measurement Latency Bucket.
2223 + * @param low_end Low end of the bucket's range.
2224 + *****************************************************************************/
2225 +void evel_meas_latency_bucket_low_end_set(
2226 + MEASUREMENT_LATENCY_BUCKET * const bucket,
2227 + const double low_end);
2229 +/**************************************************************************//**
2230 + * Add an additional Measurement Latency Bucket to the specified event.
2232 + * @param measurement Pointer to the Measurement event.
2233 + * @param bucket Pointer to the Measurement Latency Bucket to add.
2234 + *****************************************************************************/
2235 +void evel_meas_latency_bucket_add(EVENT_MEASUREMENT * const measurement,
2236 + MEASUREMENT_LATENCY_BUCKET * const bucket);
2238 +/**************************************************************************//**
2239 + * Add an additional Latency Distribution bucket to the Measurement.
2241 + * This function implements the previous API, purely for convenience.
2243 + * @param measurement Pointer to the measurement.
2244 + * @param low_end Low end of the bucket's range.
2245 + * @param high_end High end of the bucket's range.
2246 + * @param count Count of events in this bucket.
2247 + *****************************************************************************/
2248 +void evel_measurement_latency_add(EVENT_MEASUREMENT * const measurement,
2249 + const double low_end,
2250 + const double high_end,
2253 +/**************************************************************************//**
2254 + * Create a new vNIC Use to be added to a Measurement event.
2256 + * @note The mandatory fields on the ::MEASUREMENT_VNIC_PERFORMANCE must be supplied
2257 + * to this factory function and are immutable once set. Optional
2258 + * fields have explicit setter functions, but again values may only be
2259 + * set once so that the ::MEASUREMENT_VNIC_PERFORMANCE has immutable
2262 + * @param vnic_id ASCIIZ string with the vNIC's ID.
2263 + * @param val_suspect True or false confidence in data.
2265 + * @returns pointer to the newly manufactured ::MEASUREMENT_VNIC_PERFORMANCE.
2266 + * If the structure is not used it must be released using
2267 + * ::evel_measurement_free_vnic_performance.
2268 + * @retval NULL Failed to create the vNIC Use.
2269 + *****************************************************************************/
2270 +MEASUREMENT_VNIC_PERFORMANCE * evel_measurement_new_vnic_performance(char * const vnic_id, char * const val_suspect);
2272 +/**************************************************************************//**
2273 + * Free a vNIC Use.
2275 + * Free off the ::MEASUREMENT_VNIC_PERFORMANCE supplied. Will free all the contained
2276 + * allocated memory.
2278 + * @note It does not free the vNIC Use itself, since that may be part of a
2279 + * larger structure.
2280 + *****************************************************************************/
2281 +void evel_measurement_free_vnic_performance(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance);
2283 +/**************************************************************************//**
2284 + * Set the Accumulated Broadcast Packets Received in measurement interval
2285 + * property of the vNIC performance.
2287 + * @note The property is treated as immutable: it is only valid to call
2288 + * the setter once. However, we don't assert if the caller tries to
2289 + * overwrite, just ignoring the update instead.
2291 + * @param vnic_performance Pointer to the vNIC Use.
2292 + * @param recvd_bcast_packets_acc
2293 + *****************************************************************************/
2294 +void evel_vnic_performance_rx_bcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2295 + const double recvd_bcast_packets_acc);
2296 +/**************************************************************************//**
2297 + * Set the Delta Broadcast Packets Received in measurement interval
2298 + * property of the vNIC performance.
2300 + * @note The property is treated as immutable: it is only valid to call
2301 + * the setter once. However, we don't assert if the caller tries to
2302 + * overwrite, just ignoring the update instead.
2304 + * @param vnic_performance Pointer to the vNIC Use.
2305 + * @param recvd_bcast_packets_delta
2306 + *****************************************************************************/
2307 +void evel_vnic_performance_rx_bcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2308 + const double recvd_bcast_packets_delta);
2309 +/**************************************************************************//**
2310 + * Set the Discarded Packets Received in measurement interval
2311 + * property of the vNIC performance.
2313 + * @note The property is treated as immutable: it is only valid to call
2314 + * the setter once. However, we don't assert if the caller tries to
2315 + * overwrite, just ignoring the update instead.
2317 + * @param vnic_performance Pointer to the vNIC Use.
2318 + * @param recvd_discard_packets_acc
2319 + *****************************************************************************/
2320 +void evel_vnic_performance_rx_discard_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2321 + const double recvd_discard_packets_acc);
2322 +/**************************************************************************//**
2323 + * Set the Delta Discarded Packets Received in measurement interval
2324 + * property of the vNIC performance.
2326 + * @note The property is treated as immutable: it is only valid to call
2327 + * the setter once. However, we don't assert if the caller tries to
2328 + * overwrite, just ignoring the update instead.
2330 + * @param vnic_performance Pointer to the vNIC Use.
2331 + * @param recvd_discard_packets_delta
2332 + *****************************************************************************/
2333 +void evel_vnic_performance_rx_discard_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2334 + const double recvd_discard_packets_delta);
2335 +/**************************************************************************//**
2336 + * Set the Error Packets Received in measurement interval
2337 + * property of the vNIC performance.
2339 + * @note The property is treated as immutable: it is only valid to call
2340 + * the setter once. However, we don't assert if the caller tries to
2341 + * overwrite, just ignoring the update instead.
2343 + * @param vnic_performance Pointer to the vNIC Use.
2344 + * @param recvd_error_packets_acc
2345 + *****************************************************************************/
2346 +void evel_vnic_performance_rx_error_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2347 + const double recvd_error_packets_acc);
2348 +/**************************************************************************//**
2349 + * Set the Delta Error Packets Received in measurement interval
2350 + * property of the vNIC performance.
2352 + * @note The property is treated as immutable: it is only valid to call
2353 + * the setter once. However, we don't assert if the caller tries to
2354 + * overwrite, just ignoring the update instead.
2356 + * @param vnic_performance Pointer to the vNIC Use.
2357 + * @param recvd_error_packets_delta
2358 + *****************************************************************************/
2359 +void evel_vnic_performance_rx_error_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2360 + const double recvd_error_packets_delta);
2361 +/**************************************************************************//**
2362 + * Set the Accumulated Multicast Packets Received in measurement interval
2363 + * property of the vNIC performance.
2365 + * @note The property is treated as immutable: it is only valid to call
2366 + * the setter once. However, we don't assert if the caller tries to
2367 + * overwrite, just ignoring the update instead.
2369 + * @param vnic_performance Pointer to the vNIC Use.
2370 + * @param recvd_mcast_packets_acc
2371 + *****************************************************************************/
2372 +void evel_vnic_performance_rx_mcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2373 + const double recvd_mcast_packets_acc);
2374 +/**************************************************************************//**
2375 + * Set the Delta Multicast Packets Received in measurement interval
2376 + * property of the vNIC performance.
2378 + * @note The property is treated as immutable: it is only valid to call
2379 + * the setter once. However, we don't assert if the caller tries to
2380 + * overwrite, just ignoring the update instead.
2382 + * @param vnic_performance Pointer to the vNIC Use.
2383 + * @param recvd_mcast_packets_delta
2384 + *****************************************************************************/
2385 +void evel_vnic_performance_rx_mcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2386 + const double recvd_mcast_packets_delta);
2387 +/**************************************************************************//**
2388 + * Set the Accumulated Octets Received in measurement interval
2389 + * property of the vNIC performance.
2391 + * @note The property is treated as immutable: it is only valid to call
2392 + * the setter once. However, we don't assert if the caller tries to
2393 + * overwrite, just ignoring the update instead.
2395 + * @param vnic_performance Pointer to the vNIC Use.
2396 + * @param recvd_octets_acc
2397 + *****************************************************************************/
2398 +void evel_vnic_performance_rx_octets_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2399 + const double recvd_octets_acc);
2400 +/**************************************************************************//**
2401 + * Set the Delta Octets Received in measurement interval
2402 + * property of the vNIC performance.
2404 + * @note The property is treated as immutable: it is only valid to call
2405 + * the setter once. However, we don't assert if the caller tries to
2406 + * overwrite, just ignoring the update instead.
2408 + * @param vnic_performance Pointer to the vNIC Use.
2409 + * @param recvd_octets_delta
2410 + *****************************************************************************/
2411 +void evel_vnic_performance_rx_octets_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2412 + const double recvd_octets_delta);
2413 +/**************************************************************************//**
2414 + * Set the Accumulated Total Packets Received in measurement interval
2415 + * property of the vNIC performance.
2417 + * @note The property is treated as immutable: it is only valid to call
2418 + * the setter once. However, we don't assert if the caller tries to
2419 + * overwrite, just ignoring the update instead.
2421 + * @param vnic_performance Pointer to the vNIC Use.
2422 + * @param recvd_total_packets_acc
2423 + *****************************************************************************/
2424 +void evel_vnic_performance_rx_total_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2425 + const double recvd_total_packets_acc);
2426 +/**************************************************************************//**
2427 + * Set the Delta Total Packets Received in measurement interval
2428 + * property of the vNIC performance.
2430 + * @note The property is treated as immutable: it is only valid to call
2431 + * the setter once. However, we don't assert if the caller tries to
2432 + * overwrite, just ignoring the update instead.
2434 + * @param vnic_performance Pointer to the vNIC Use.
2435 + * @param recvd_total_packets_delta
2436 + *****************************************************************************/
2437 +void evel_vnic_performance_rx_total_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2438 + const double recvd_total_packets_delta);
2439 +/**************************************************************************//**
2440 + * Set the Accumulated Unicast Packets Received in measurement interval
2441 + * property of the vNIC performance.
2443 + * @note The property is treated as immutable: it is only valid to call
2444 + * the setter once. However, we don't assert if the caller tries to
2445 + * overwrite, just ignoring the update instead.
2447 + * @param vnic_performance Pointer to the vNIC Use.
2448 + * @param recvd_ucast_packets_acc
2449 + *****************************************************************************/
2450 +void evel_vnic_performance_rx_ucast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2451 + const double recvd_ucast_packets_acc);
2452 +/**************************************************************************//**
2453 + * Set the Delta Unicast packets Received in measurement interval
2454 + * property of the vNIC performance.
2456 + * @note The property is treated as immutable: it is only valid to call
2457 + * the setter once. However, we don't assert if the caller tries to
2458 + * overwrite, just ignoring the update instead.
2460 + * @param vnic_performance Pointer to the vNIC Use.
2461 + * @param recvd_ucast_packets_delta
2462 + *****************************************************************************/
2463 +void evel_vnic_performance_rx_ucast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2464 + const double recvd_ucast_packets_delta);
2465 +/**************************************************************************//**
2466 + * Set the Transmitted Broadcast Packets in measurement interval
2467 + * property of the vNIC performance.
2469 + * @note The property is treated as immutable: it is only valid to call
2470 + * the setter once. However, we don't assert if the caller tries to
2471 + * overwrite, just ignoring the update instead.
2473 + * @param vnic_performance Pointer to the vNIC Use.
2474 + * @param tx_bcast_packets_acc
2475 + *****************************************************************************/
2476 +void evel_vnic_performance_tx_bcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2477 + const double tx_bcast_packets_acc);
2478 +/**************************************************************************//**
2479 + * Set the Delta Broadcast packets Transmitted in measurement interval
2480 + * property of the vNIC performance.
2482 + * @note The property is treated as immutable: it is only valid to call
2483 + * the setter once. However, we don't assert if the caller tries to
2484 + * overwrite, just ignoring the update instead.
2486 + * @param vnic_performance Pointer to the vNIC Use.
2487 + * @param tx_bcast_packets_delta
2488 + *****************************************************************************/
2489 +void evel_vnic_performance_tx_bcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2490 + const double tx_bcast_packets_delta);
2491 +/**************************************************************************//**
2492 + * Set the Transmitted Discarded Packets in measurement interval
2493 + * property of the vNIC performance.
2495 + * @note The property is treated as immutable: it is only valid to call
2496 + * the setter once. However, we don't assert if the caller tries to
2497 + * overwrite, just ignoring the update instead.
2499 + * @param vnic_performance Pointer to the vNIC Use.
2500 + * @param tx_discarded_packets_acc
2501 + *****************************************************************************/
2502 +void evel_vnic_performance_tx_discarded_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2503 + const double tx_discarded_packets_acc);
2504 +/**************************************************************************//**
2505 + * Set the Delta Discarded packets Transmitted in measurement interval
2506 + * property of the vNIC performance.
2508 + * @note The property is treated as immutable: it is only valid to call
2509 + * the setter once. However, we don't assert if the caller tries to
2510 + * overwrite, just ignoring the update instead.
2512 + * @param vnic_performance Pointer to the vNIC Use.
2513 + * @param tx_discarded_packets_delta
2514 + *****************************************************************************/
2515 +void evel_vnic_performance_tx_discarded_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2516 + const double tx_discarded_packets_delta);
2517 +/**************************************************************************//**
2518 + * Set the Transmitted Errored Packets in measurement interval
2519 + * property of the vNIC performance.
2521 + * @note The property is treated as immutable: it is only valid to call
2522 + * the setter once. However, we don't assert if the caller tries to
2523 + * overwrite, just ignoring the update instead.
2525 + * @param vnic_performance Pointer to the vNIC Use.
2526 + * @param tx_error_packets_acc
2527 + *****************************************************************************/
2528 +void evel_vnic_performance_tx_error_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2529 + const double tx_error_packets_acc);
2530 +/**************************************************************************//**
2531 + * Set the Delta Errored packets Transmitted in measurement interval
2532 + * property of the vNIC performance.
2534 + * @note The property is treated as immutable: it is only valid to call
2535 + * the setter once. However, we don't assert if the caller tries to
2536 + * overwrite, just ignoring the update instead.
2538 + * @param vnic_performance Pointer to the vNIC Use.
2539 + * @param tx_error_packets_delta
2540 + *****************************************************************************/
2541 +void evel_vnic_performance_tx_error_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2542 + const double tx_error_packets_delta);
2543 +/**************************************************************************//**
2544 + * Set the Transmitted Multicast Packets in measurement interval
2545 + * property of the vNIC performance.
2547 + * @note The property is treated as immutable: it is only valid to call
2548 + * the setter once. However, we don't assert if the caller tries to
2549 + * overwrite, just ignoring the update instead.
2551 + * @param vnic_performance Pointer to the vNIC Use.
2552 + * @param tx_mcast_packets_acc
2553 + *****************************************************************************/
2554 +void evel_vnic_performance_tx_mcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2555 + const double tx_mcast_packets_acc);
2556 +/**************************************************************************//**
2557 + * Set the Delta Multicast packets Transmitted in measurement interval
2558 + * property of the vNIC performance.
2560 + * @note The property is treated as immutable: it is only valid to call
2561 + * the setter once. However, we don't assert if the caller tries to
2562 + * overwrite, just ignoring the update instead.
2564 + * @param vnic_performance Pointer to the vNIC Use.
2565 + * @param tx_mcast_packets_delta
2566 + *****************************************************************************/
2567 +void evel_vnic_performance_tx_mcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2568 + const double tx_mcast_packets_delta);
2569 +/**************************************************************************//**
2570 + * Set the Transmitted Octets in measurement interval
2571 + * property of the vNIC performance.
2573 + * @note The property is treated as immutable: it is only valid to call
2574 + * the setter once. However, we don't assert if the caller tries to
2575 + * overwrite, just ignoring the update instead.
2577 + * @param vnic_performance Pointer to the vNIC Use.
2578 + * @param tx_octets_acc
2579 + *****************************************************************************/
2580 +void evel_vnic_performance_tx_octets_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2581 + const double tx_octets_acc);
2582 +/**************************************************************************//**
2583 + * Set the Delta Octets Transmitted in measurement interval
2584 + * property of the vNIC performance.
2586 + * @note The property is treated as immutable: it is only valid to call
2587 + * the setter once. However, we don't assert if the caller tries to
2588 + * overwrite, just ignoring the update instead.
2590 + * @param vnic_performance Pointer to the vNIC Use.
2591 + * @param tx_octets_delta
2592 + *****************************************************************************/
2593 +void evel_vnic_performance_tx_octets_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2594 + const double tx_octets_delta);
2595 +/**************************************************************************//**
2596 + * Set the Transmitted Total Packets in measurement interval
2597 + * property of the vNIC performance.
2599 + * @note The property is treated as immutable: it is only valid to call
2600 + * the setter once. However, we don't assert if the caller tries to
2601 + * overwrite, just ignoring the update instead.
2603 + * @param vnic_performance Pointer to the vNIC Use.
2604 + * @param tx_total_packets_acc
2605 + *****************************************************************************/
2606 +void evel_vnic_performance_tx_total_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2607 + const double tx_total_packets_acc);
2608 +/**************************************************************************//**
2609 + * Set the Delta Total Packets Transmitted in measurement interval
2610 + * property of the vNIC performance.
2612 + * @note The property is treated as immutable: it is only valid to call
2613 + * the setter once. However, we don't assert if the caller tries to
2614 + * overwrite, just ignoring the update instead.
2616 + * @param vnic_performance Pointer to the vNIC Use.
2617 + * @param tx_total_packets_delta
2618 + *****************************************************************************/
2619 +void evel_vnic_performance_tx_total_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2620 + const double tx_total_packets_delta);
2621 +/**************************************************************************//**
2622 + * Set the Transmitted Unicast Packets in measurement interval
2623 + * property of the vNIC performance.
2625 + * @note The property is treated as immutable: it is only valid to call
2626 + * the setter once. However, we don't assert if the caller tries to
2627 + * overwrite, just ignoring the update instead.
2629 + * @param vnic_performance Pointer to the vNIC Use.
2630 + * @param tx_ucast_packets_acc
2631 + *****************************************************************************/
2632 +void evel_vnic_performance_tx_ucast_packets_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2633 + const double tx_ucast_packets_acc);
2634 +/**************************************************************************//**
2635 + * Set the Delta Octets Transmitted in measurement interval
2636 + * property of the vNIC performance.
2638 + * @note The property is treated as immutable: it is only valid to call
2639 + * the setter once. However, we don't assert if the caller tries to
2640 + * overwrite, just ignoring the update instead.
2642 + * @param vnic_performance Pointer to the vNIC Use.
2643 + * @param tx_ucast_packets_delta
2644 + *****************************************************************************/
2645 +void evel_vnic_performance_tx_ucast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2646 + const double tx_ucast_packets_delta);
2648 +/**************************************************************************//**
2649 + * Add an additional vNIC Use to the specified Measurement event.
2651 + * @param measurement Pointer to the measurement.
2652 + * @param vnic_performance Pointer to the vNIC Use to add.
2653 + *****************************************************************************/
2654 +void evel_meas_vnic_performance_add(EVENT_MEASUREMENT * const measurement,
2655 + MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance);
2657 +/**************************************************************************//**
2658 + * Add an additional vNIC usage record Measurement.
2660 + * This function implements the previous API, purely for convenience.
2662 + * The ID is null delimited ASCII string. The library takes a copy so the
2663 + * caller does not have to preserve values after the function returns.
2665 + * @param measurement Pointer to the measurement.
2666 + * @param vnic_id ASCIIZ string with the vNIC's ID.
2667 + * @param valset true or false confidence level
2668 + * @param recvd_bcast_packets_acc Recieved broadcast packets
2669 + * @param recvd_bcast_packets_delta Received delta broadcast packets
2670 + * @param recvd_discarded_packets_acc Recieved discarded packets
2671 + * @param recvd_discarded_packets_delta Received discarded delta packets
2672 + * @param recvd_error_packets_acc Received error packets
2673 + * @param recvd_error_packets_delta, Received delta error packets
2674 + * @param recvd_mcast_packets_acc Received multicast packets
2675 + * @param recvd_mcast_packets_delta Received delta multicast packets
2676 + * @param recvd_octets_acc Received octets
2677 + * @param recvd_octets_delta Received delta octets
2678 + * @param recvd_total_packets_acc Received total packets
2679 + * @param recvd_total_packets_delta Received delta total packets
2680 + * @param recvd_ucast_packets_acc Received Unicast packets
2681 + * @param recvd_ucast_packets_delta Received delta unicast packets
2682 + * @param tx_bcast_packets_acc Transmitted broadcast packets
2683 + * @param tx_bcast_packets_delta Transmitted delta broadcast packets
2684 + * @param tx_discarded_packets_acc Transmitted packets discarded
2685 + * @param tx_discarded_packets_delta Transmitted delta discarded packets
2686 + * @param tx_error_packets_acc Transmitted error packets
2687 + * @param tx_error_packets_delta Transmitted delta error packets
2688 + * @param tx_mcast_packets_acc Transmitted multicast packets accumulated
2689 + * @param tx_mcast_packets_delta Transmitted delta multicast packets
2690 + * @param tx_octets_acc Transmitted octets
2691 + * @param tx_octets_delta Transmitted delta octets
2692 + * @param tx_total_packets_acc Transmitted total packets
2693 + * @param tx_total_packets_delta Transmitted delta total packets
2694 + * @param tx_ucast_packets_acc Transmitted Unicast packets
2695 + * @param tx_ucast_packets_delta Transmitted delta Unicast packets
2696 + *****************************************************************************/
2697 +void evel_measurement_vnic_performance_add(EVENT_MEASUREMENT * const measurement,
2698 + char * const vnic_id,
2700 + double recvd_bcast_packets_acc,
2701 + double recvd_bcast_packets_delta,
2702 + double recvd_discarded_packets_acc,
2703 + double recvd_discarded_packets_delta,
2704 + double recvd_error_packets_acc,
2705 + double recvd_error_packets_delta,
2706 + double recvd_mcast_packets_acc,
2707 + double recvd_mcast_packets_delta,
2708 + double recvd_octets_acc,
2709 + double recvd_octets_delta,
2710 + double recvd_total_packets_acc,
2711 + double recvd_total_packets_delta,
2712 + double recvd_ucast_packets_acc,
2713 + double recvd_ucast_packets_delta,
2714 + double tx_bcast_packets_acc,
2715 + double tx_bcast_packets_delta,
2716 + double tx_discarded_packets_acc,
2717 + double tx_discarded_packets_delta,
2718 + double tx_error_packets_acc,
2719 + double tx_error_packets_delta,
2720 + double tx_mcast_packets_acc,
2721 + double tx_mcast_packets_delta,
2722 + double tx_octets_acc,
2723 + double tx_octets_delta,
2724 + double tx_total_packets_acc,
2725 + double tx_total_packets_delta,
2726 + double tx_ucast_packets_acc,
2727 + double tx_ucast_packets_delta);
2729 +/*****************************************************************************/
2730 +/*****************************************************************************/
2734 +/*****************************************************************************/
2735 +/*****************************************************************************/
2737 +/**************************************************************************//**
2738 + * Create a new Report event.
2740 + * @note The mandatory fields on the Report must be supplied to this
2741 + * factory function and are immutable once set. Optional fields have
2742 + * explicit setter functions, but again values may only be set once so
2743 + * that the Report has immutable properties.
2745 + * @param measurement_interval
2746 + * @param event_name Unique Event Name
2747 + * @param event_id A universal identifier of the event for analysis etc
2749 + * @returns pointer to the newly manufactured ::EVENT_REPORT. If the event is
2750 + * not used (i.e. posted) it must be released using
2751 + * ::evel_free_report.
2752 + * @retval NULL Failed to create the event.
2753 + *****************************************************************************/
2754 +EVENT_REPORT * evel_new_report(double measurement_interval,const char* ev_name, const char *ev_id);
2756 +/**************************************************************************//**
2759 + * Free off the Report supplied. Will free all the contained allocated memory.
2761 + * @note It does not free the Report itself, since that may be part of a
2762 + * larger structure.
2763 + *****************************************************************************/
2764 +void evel_free_report(EVENT_REPORT * event);
2766 +/**************************************************************************//**
2767 + * Set the Event Type property of the Report.
2769 + * @note The property is treated as immutable: it is only valid to call
2770 + * the setter once. However, we don't assert if the caller tries to
2771 + * overwrite, just ignoring the update instead.
2773 + * @param report Pointer to the Report.
2774 + * @param type The Event Type to be set. ASCIIZ string. The caller
2775 + * does not need to preserve the value once the function
2777 + *****************************************************************************/
2778 +void evel_report_type_set(EVENT_REPORT * report, const char * const type);
2780 +/**************************************************************************//**
2781 + * Add a Feature usage value name/value pair to the Report.
2783 + * The name is null delimited ASCII string. The library takes
2784 + * a copy so the caller does not have to preserve values after the function
2787 + * @param report Pointer to the report.
2788 + * @param feature ASCIIZ string with the feature's name.
2789 + * @param utilization Utilization of the feature.
2790 + *****************************************************************************/
2791 +void evel_report_feature_use_add(EVENT_REPORT * report,
2795 +/**************************************************************************//**
2796 + * Add a Additional Measurement value name/value pair to the Report.
2798 + * The name is null delimited ASCII string. The library takes
2799 + * a copy so the caller does not have to preserve values after the function
2802 + * @param report Pointer to the report.
2803 + * @param group ASCIIZ string with the measurement group's name.
2804 + * @param name ASCIIZ string containing the measurement's name.
2805 + * @param value ASCIIZ string containing the measurement's value.
2806 + *****************************************************************************/
2807 +void evel_report_custom_measurement_add(EVENT_REPORT * report,
2808 + const char * const group,
2809 + const char * const name,
2810 + const char * const value);
2812 +/*****************************************************************************/
2813 +/*****************************************************************************/
2817 +/*****************************************************************************/
2818 +/*****************************************************************************/
2820 +/**************************************************************************//**
2821 + * Create a new Mobile Flow event.
2823 + * @note The mandatory fields on the Mobile Flow must be supplied to this
2824 + * factory function and are immutable once set. Optional fields have
2825 + * explicit setter functions, but again values may only be set once so
2826 + * that the Mobile Flow has immutable properties.
2828 + * @param event_name Unique Event Name
2829 + * @param event_id A universal identifier of the event for analysis etc
2830 + * @param flow_direction
2831 + * @param gtp_per_flow_metrics
2832 + * @param ip_protocol_type
2833 + * @param ip_version
2834 + * @param other_endpoint_ip_address
2835 + * @param other_endpoint_port
2836 + * @param reporting_endpoint_ip_addr
2837 + * @param reporting_endpoint_port
2839 + * @returns pointer to the newly manufactured ::EVENT_MOBILE_FLOW. If the
2840 + * event is not used (i.e. posted) it must be released using
2841 + * ::evel_free_mobile_flow.
2842 + * @retval NULL Failed to create the event.
2843 + *****************************************************************************/
2844 +EVENT_MOBILE_FLOW * evel_new_mobile_flow(
2845 + const char* ev_name, const char *ev_id,
2846 + const char * const flow_direction,
2847 + MOBILE_GTP_PER_FLOW_METRICS * gtp_per_flow_metrics,
2848 + const char * const ip_protocol_type,
2849 + const char * const ip_version,
2850 + const char * const other_endpoint_ip_address,
2851 + int other_endpoint_port,
2852 + const char * const reporting_endpoint_ip_addr,
2853 + int reporting_endpoint_port);
2855 +/**************************************************************************//**
2856 + * Free a Mobile Flow.
2858 + * Free off the Mobile Flow supplied. Will free all the contained allocated
2861 + * @note It does not free the Mobile Flow itself, since that may be part of a
2862 + * larger structure.
2863 + *****************************************************************************/
2864 +void evel_free_mobile_flow(EVENT_MOBILE_FLOW * event);
2866 +/**************************************************************************//**
2867 + * Set the Event Type property of the Mobile Flow.
2869 + * @note The property is treated as immutable: it is only valid to call
2870 + * the setter once. However, we don't assert if the caller tries to
2871 + * overwrite, just ignoring the update instead.
2873 + * @param mobile_flow Pointer to the Mobile Flow.
2874 + * @param type The Event Type to be set. ASCIIZ string. The caller
2875 + * does not need to preserve the value once the function
2877 + *****************************************************************************/
2878 +void evel_mobile_flow_type_set(EVENT_MOBILE_FLOW * mobile_flow,
2879 + const char * const type);
2881 +/**************************************************************************//**
2882 + * Set the Application Type property of the Mobile Flow.
2884 + * @note The property is treated as immutable: it is only valid to call
2885 + * the setter once. However, we don't assert if the caller tries to
2886 + * overwrite, just ignoring the update instead.
2888 + * @param mobile_flow Pointer to the Mobile Flow.
2889 + * @param type The Application Type to be set. ASCIIZ string. The caller
2890 + * does not need to preserve the value once the function
2892 + *****************************************************************************/
2893 +void evel_mobile_flow_app_type_set(EVENT_MOBILE_FLOW * mobile_flow,
2894 + const char * const type);
2896 +/**************************************************************************//**
2897 + * Set the Application Protocol Type property of the Mobile Flow.
2899 + * @note The property is treated as immutable: it is only valid to call
2900 + * the setter once. However, we don't assert if the caller tries to
2901 + * overwrite, just ignoring the update instead.
2903 + * @param mobile_flow Pointer to the Mobile Flow.
2904 + * @param type The Application Protocol Type to be set. ASCIIZ string.
2905 + * The caller does not need to preserve the value once the
2906 + * function returns.
2907 + *****************************************************************************/
2908 +void evel_mobile_flow_app_prot_type_set(EVENT_MOBILE_FLOW * mobile_flow,
2909 + const char * const type);
2911 +/**************************************************************************//**
2912 + * Set the Application Protocol Version property of the Mobile Flow.
2914 + * @note The property is treated as immutable: it is only valid to call
2915 + * the setter once. However, we don't assert if the caller tries to
2916 + * overwrite, just ignoring the update instead.
2918 + * @param mobile_flow Pointer to the Mobile Flow.
2919 + * @param version The Application Protocol Version to be set. ASCIIZ
2920 + * string. The caller does not need to preserve the value
2921 + * once the function returns.
2922 + *****************************************************************************/
2923 +void evel_mobile_flow_app_prot_ver_set(EVENT_MOBILE_FLOW * mobile_flow,
2924 + const char * const version);
2926 +/**************************************************************************//**
2927 + * Set the CID property of the Mobile Flow.
2929 + * @note The property is treated as immutable: it is only valid to call
2930 + * the setter once. However, we don't assert if the caller tries to
2931 + * overwrite, just ignoring the update instead.
2933 + * @param mobile_flow Pointer to the Mobile Flow.
2934 + * @param cid The CID to be set. ASCIIZ string. The caller does not
2935 + * need to preserve the value once the function returns.
2936 + *****************************************************************************/
2937 +void evel_mobile_flow_cid_set(EVENT_MOBILE_FLOW * mobile_flow,
2938 + const char * const cid);
2940 +/**************************************************************************//**
2941 + * Set the Connection Type property of the Mobile Flow.
2943 + * @note The property is treated as immutable: it is only valid to call
2944 + * the setter once. However, we don't assert if the caller tries to
2945 + * overwrite, just ignoring the update instead.
2947 + * @param mobile_flow Pointer to the Mobile Flow.
2948 + * @param type The Connection Type to be set. ASCIIZ string. The caller
2949 + * does not need to preserve the value once the function
2951 + *****************************************************************************/
2952 +void evel_mobile_flow_con_type_set(EVENT_MOBILE_FLOW * mobile_flow,
2953 + const char * const type);
2955 +/**************************************************************************//**
2956 + * Set the ECGI property of the Mobile Flow.
2958 + * @note The property is treated as immutable: it is only valid to call
2959 + * the setter once. However, we don't assert if the caller tries to
2960 + * overwrite, just ignoring the update instead.
2962 + * @param mobile_flow Pointer to the Mobile Flow.
2963 + * @param ecgi The ECGI to be set. ASCIIZ string. The caller does not
2964 + * need to preserve the value once the function returns.
2965 + *****************************************************************************/
2966 +void evel_mobile_flow_ecgi_set(EVENT_MOBILE_FLOW * mobile_flow,
2967 + const char * const ecgi);
2969 +/**************************************************************************//**
2970 + * Set the GTP Protocol Type property of the Mobile Flow.
2972 + * @note The property is treated as immutable: it is only valid to call
2973 + * the setter once. However, we don't assert if the caller tries to
2974 + * overwrite, just ignoring the update instead.
2976 + * @param mobile_flow Pointer to the Mobile Flow.
2977 + * @param type The GTP Protocol Type to be set. ASCIIZ string. The
2978 + * caller does not need to preserve the value once the
2979 + * function returns.
2980 + *****************************************************************************/
2981 +void evel_mobile_flow_gtp_prot_type_set(EVENT_MOBILE_FLOW * mobile_flow,
2982 + const char * const type);
2984 +/**************************************************************************//**
2985 + * Set the GTP Protocol Version property of the Mobile Flow.
2987 + * @note The property is treated as immutable: it is only valid to call
2988 + * the setter once. However, we don't assert if the caller tries to
2989 + * overwrite, just ignoring the update instead.
2991 + * @param mobile_flow Pointer to the Mobile Flow.
2992 + * @param version The GTP Protocol Version to be set. ASCIIZ string. The
2993 + * caller does not need to preserve the value once the
2994 + * function returns.
2995 + *****************************************************************************/
2996 +void evel_mobile_flow_gtp_prot_ver_set(EVENT_MOBILE_FLOW * mobile_flow,
2997 + const char * const version);
2999 +/**************************************************************************//**
3000 + * Set the HTTP Header property of the Mobile Flow.
3002 + * @note The property is treated as immutable: it is only valid to call
3003 + * the setter once. However, we don't assert if the caller tries to
3004 + * overwrite, just ignoring the update instead.
3006 + * @param mobile_flow Pointer to the Mobile Flow.
3007 + * @param header The HTTP header to be set. ASCIIZ string. The caller does
3008 + * not need to preserve the value once the function returns.
3009 + *****************************************************************************/
3010 +void evel_mobile_flow_http_header_set(EVENT_MOBILE_FLOW * mobile_flow,
3011 + const char * const header);
3013 +/**************************************************************************//**
3014 + * Set the IMEI property of the Mobile Flow.
3016 + * @note The property is treated as immutable: it is only valid to call
3017 + * the setter once. However, we don't assert if the caller tries to
3018 + * overwrite, just ignoring the update instead.
3020 + * @param mobile_flow Pointer to the Mobile Flow.
3021 + * @param imei The IMEI to be set. ASCIIZ string. The caller does not
3022 + * need to preserve the value once the function returns.
3023 + *****************************************************************************/
3024 +void evel_mobile_flow_imei_set(EVENT_MOBILE_FLOW * mobile_flow,
3025 + const char * const imei);
3027 +/**************************************************************************//**
3028 + * Set the IMSI property of the Mobile Flow.
3030 + * @note The property is treated as immutable: it is only valid to call
3031 + * the setter once. However, we don't assert if the caller tries to
3032 + * overwrite, just ignoring the update instead.
3034 + * @param mobile_flow Pointer to the Mobile Flow.
3035 + * @param imsi The IMSI to be set. ASCIIZ string. The caller does not
3036 + * need to preserve the value once the function returns.
3037 + *****************************************************************************/
3038 +void evel_mobile_flow_imsi_set(EVENT_MOBILE_FLOW * mobile_flow,
3039 + const char * const imsi);
3041 +/**************************************************************************//**
3042 + * Set the LAC property of the Mobile Flow.
3044 + * @note The property is treated as immutable: it is only valid to call
3045 + * the setter once. However, we don't assert if the caller tries to
3046 + * overwrite, just ignoring the update instead.
3048 + * @param mobile_flow Pointer to the Mobile Flow.
3049 + * @param lac The LAC to be set. ASCIIZ string. The caller does not
3050 + * need to preserve the value once the function returns.
3051 + *****************************************************************************/
3052 +void evel_mobile_flow_lac_set(EVENT_MOBILE_FLOW * mobile_flow,
3053 + const char * const lac);
3055 +/**************************************************************************//**
3056 + * Set the MCC property of the Mobile Flow.
3058 + * @note The property is treated as immutable: it is only valid to call
3059 + * the setter once. However, we don't assert if the caller tries to
3060 + * overwrite, just ignoring the update instead.
3062 + * @param mobile_flow Pointer to the Mobile Flow.
3063 + * @param mcc The MCC to be set. ASCIIZ string. The caller does not
3064 + * need to preserve the value once the function returns.
3065 + *****************************************************************************/
3066 +void evel_mobile_flow_mcc_set(EVENT_MOBILE_FLOW * mobile_flow,
3067 + const char * const mcc);
3069 +/**************************************************************************//**
3070 + * Set the MNC property of the Mobile Flow.
3072 + * @note The property is treated as immutable: it is only valid to call
3073 + * the setter once. However, we don't assert if the caller tries to
3074 + * overwrite, just ignoring the update instead.
3076 + * @param mobile_flow Pointer to the Mobile Flow.
3077 + * @param mnc The MNC to be set. ASCIIZ string. The caller does not
3078 + * need to preserve the value once the function returns.
3079 + *****************************************************************************/
3080 +void evel_mobile_flow_mnc_set(EVENT_MOBILE_FLOW * mobile_flow,
3081 + const char * const mnc);
3083 +/**************************************************************************//**
3084 + * Set the MSISDN property of the Mobile Flow.
3086 + * @note The property is treated as immutable: it is only valid to call
3087 + * the setter once. However, we don't assert if the caller tries to
3088 + * overwrite, just ignoring the update instead.
3090 + * @param mobile_flow Pointer to the Mobile Flow.
3091 + * @param msisdn The MSISDN to be set. ASCIIZ string. The caller does not
3092 + * need to preserve the value once the function returns.
3093 + *****************************************************************************/
3094 +void evel_mobile_flow_msisdn_set(EVENT_MOBILE_FLOW * mobile_flow,
3095 + const char * const msisdn);
3097 +/**************************************************************************//**
3098 + * Set the Other Functional Role property of the Mobile Flow.
3100 + * @note The property is treated as immutable: it is only valid to call
3101 + * the setter once. However, we don't assert if the caller tries to
3102 + * overwrite, just ignoring the update instead.
3104 + * @param mobile_flow Pointer to the Mobile Flow.
3105 + * @param role The Other Functional Role to be set. ASCIIZ string. The
3106 + * caller does not need to preserve the value once the
3107 + * function returns.
3108 + *****************************************************************************/
3109 +void evel_mobile_flow_other_func_role_set(EVENT_MOBILE_FLOW * mobile_flow,
3110 + const char * const role);
3112 +/**************************************************************************//**
3113 + * Set the RAC property of the Mobile Flow.
3115 + * @note The property is treated as immutable: it is only valid to call
3116 + * the setter once. However, we don't assert if the caller tries to
3117 + * overwrite, just ignoring the update instead.
3119 + * @param mobile_flow Pointer to the Mobile Flow.
3120 + * @param rac The RAC to be set. ASCIIZ string. The caller does not
3121 + * need to preserve the value once the function returns.
3122 + *****************************************************************************/
3123 +void evel_mobile_flow_rac_set(EVENT_MOBILE_FLOW * mobile_flow,
3124 + const char * const rac);
3126 +/**************************************************************************//**
3127 + * Set the Radio Access Technology property of the Mobile Flow.
3129 + * @note The property is treated as immutable: it is only valid to call
3130 + * the setter once. However, we don't assert if the caller tries to
3131 + * overwrite, just ignoring the update instead.
3133 + * @param mobile_flow Pointer to the Mobile Flow.
3134 + * @param tech The Radio Access Technology to be set. ASCIIZ string. The
3135 + * caller does not need to preserve the value once the
3136 + * function returns.
3137 + *****************************************************************************/
3138 +void evel_mobile_flow_radio_acc_tech_set(EVENT_MOBILE_FLOW * mobile_flow,
3139 + const char * const tech);
3141 +/**************************************************************************//**
3142 + * Set the SAC property of the Mobile Flow.
3144 + * @note The property is treated as immutable: it is only valid to call
3145 + * the setter once. However, we don't assert if the caller tries to
3146 + * overwrite, just ignoring the update instead.
3148 + * @param mobile_flow Pointer to the Mobile Flow.
3149 + * @param sac The SAC to be set. ASCIIZ string. The caller does not
3150 + * need to preserve the value once the function returns.
3151 + *****************************************************************************/
3152 +void evel_mobile_flow_sac_set(EVENT_MOBILE_FLOW * mobile_flow,
3153 + const char * const sac);
3155 +/**************************************************************************//**
3156 + * Set the Sampling Algorithm property of the Mobile Flow.
3158 + * @note The property is treated as immutable: it is only valid to call
3159 + * the setter once. However, we don't assert if the caller tries to
3160 + * overwrite, just ignoring the update instead.
3162 + * @param mobile_flow Pointer to the Mobile Flow.
3163 + * @param algorithm The Sampling Algorithm to be set.
3164 + *****************************************************************************/
3165 +void evel_mobile_flow_samp_alg_set(EVENT_MOBILE_FLOW * mobile_flow,
3168 +/**************************************************************************//**
3169 + * Set the TAC property of the Mobile Flow.
3171 + * @note The property is treated as immutable: it is only valid to call
3172 + * the setter once. However, we don't assert if the caller tries to
3173 + * overwrite, just ignoring the update instead.
3175 + * @param mobile_flow Pointer to the Mobile Flow.
3176 + * @param tac The TAC to be set. ASCIIZ string. The caller does not
3177 + * need to preserve the value once the function returns.
3178 + *****************************************************************************/
3179 +void evel_mobile_flow_tac_set(EVENT_MOBILE_FLOW * mobile_flow,
3180 + const char * const tac);
3182 +/**************************************************************************//**
3183 + * Set the Tunnel ID property of the Mobile Flow.
3185 + * @note The property is treated as immutable: it is only valid to call
3186 + * the setter once. However, we don't assert if the caller tries to
3187 + * overwrite, just ignoring the update instead.
3189 + * @param mobile_flow Pointer to the Mobile Flow.
3190 + * @param tunnel_id The Tunnel ID to be set. ASCIIZ string. The caller does
3191 + * not need to preserve the value once the function returns.
3192 + *****************************************************************************/
3193 +void evel_mobile_flow_tunnel_id_set(EVENT_MOBILE_FLOW * mobile_flow,
3194 + const char * const tunnel_id);
3196 +/**************************************************************************//**
3197 + * Set the VLAN ID property of the Mobile Flow.
3199 + * @note The property is treated as immutable: it is only valid to call
3200 + * the setter once. However, we don't assert if the caller tries to
3201 + * overwrite, just ignoring the update instead.
3203 + * @param mobile_flow Pointer to the Mobile Flow.
3204 + * @param vlan_id The VLAN ID to be set. ASCIIZ string. The caller does
3205 + * not need to preserve the value once the function returns.
3206 + *****************************************************************************/
3207 +void evel_mobile_flow_vlan_id_set(EVENT_MOBILE_FLOW * mobile_flow,
3208 + const char * const vlan_id);
3210 +/**************************************************************************//**
3211 + * Create a new Mobile GTP Per Flow Metrics.
3213 + * @note The mandatory fields on the Mobile GTP Per Flow Metrics must be
3214 + * supplied to this factory function and are immutable once set.
3215 + * Optional fields have explicit setter functions, but again values
3216 + * may only be set once so that the Mobile GTP Per Flow Metrics has
3217 + * immutable properties.
3219 + * @param avg_bit_error_rate
3220 + * @param avg_packet_delay_variation
3221 + * @param avg_packet_latency
3222 + * @param avg_receive_throughput
3223 + * @param avg_transmit_throughput
3224 + * @param flow_activation_epoch
3225 + * @param flow_activation_microsec
3226 + * @param flow_deactivation_epoch
3227 + * @param flow_deactivation_microsec
3228 + * @param flow_deactivation_time
3229 + * @param flow_status
3230 + * @param max_packet_delay_variation
3231 + * @param num_activation_failures
3232 + * @param num_bit_errors
3233 + * @param num_bytes_received
3234 + * @param num_bytes_transmitted
3235 + * @param num_dropped_packets
3236 + * @param num_l7_bytes_received
3237 + * @param num_l7_bytes_transmitted
3238 + * @param num_lost_packets
3239 + * @param num_out_of_order_packets
3240 + * @param num_packet_errors
3241 + * @param num_packets_received_excl_retrans
3242 + * @param num_packets_received_incl_retrans
3243 + * @param num_packets_transmitted_incl_retrans
3244 + * @param num_retries
3245 + * @param num_timeouts
3246 + * @param num_tunneled_l7_bytes_received
3247 + * @param round_trip_time
3248 + * @param time_to_first_byte
3250 + * @returns pointer to the newly manufactured ::MOBILE_GTP_PER_FLOW_METRICS.
3251 + * If the structure is not used it must be released using
3252 + * ::evel_free_mobile_gtp_flow_metrics.
3253 + * @retval NULL Failed to create the event.
3254 + *****************************************************************************/
3255 +MOBILE_GTP_PER_FLOW_METRICS * evel_new_mobile_gtp_flow_metrics(
3256 + double avg_bit_error_rate,
3257 + double avg_packet_delay_variation,
3258 + int avg_packet_latency,
3259 + int avg_receive_throughput,
3260 + int avg_transmit_throughput,
3261 + int flow_activation_epoch,
3262 + int flow_activation_microsec,
3263 + int flow_deactivation_epoch,
3264 + int flow_deactivation_microsec,
3265 + time_t flow_deactivation_time,
3266 + const char * const flow_status,
3267 + int max_packet_delay_variation,
3268 + int num_activation_failures,
3269 + int num_bit_errors,
3270 + int num_bytes_received,
3271 + int num_bytes_transmitted,
3272 + int num_dropped_packets,
3273 + int num_l7_bytes_received,
3274 + int num_l7_bytes_transmitted,
3275 + int num_lost_packets,
3276 + int num_out_of_order_packets,
3277 + int num_packet_errors,
3278 + int num_packets_received_excl_retrans,
3279 + int num_packets_received_incl_retrans,
3280 + int num_packets_transmitted_incl_retrans,
3283 + int num_tunneled_l7_bytes_received,
3284 + int round_trip_time,
3285 + int time_to_first_byte);
3287 +/**************************************************************************//**
3288 + * Free a Mobile GTP Per Flow Metrics.
3290 + * Free off the Mobile GTP Per Flow Metrics supplied. Will free all the
3291 + * contained allocated memory.
3293 + * @note It does not free the Mobile GTP Per Flow Metrics itself, since that
3294 + * may be part of a larger structure.
3295 + *****************************************************************************/
3296 +void evel_free_mobile_gtp_flow_metrics(MOBILE_GTP_PER_FLOW_METRICS * metrics);
3298 +/**************************************************************************//**
3299 + * Set the Duration of Connection Failed Status property of the Mobile GTP Per
3302 + * @note The property is treated as immutable: it is only valid to call
3303 + * the setter once. However, we don't assert if the caller tries to
3304 + * overwrite, just ignoring the update instead.
3306 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3307 + * @param duration The Duration of Connection Failed Status to be set.
3308 + *****************************************************************************/
3309 +void evel_mobile_gtp_metrics_dur_con_fail_set(
3310 + MOBILE_GTP_PER_FLOW_METRICS * metrics,
3313 +/**************************************************************************//**
3314 + * Set the Duration of Tunnel Failed Status property of the Mobile GTP Per Flow
3317 + * @note The property is treated as immutable: it is only valid to call
3318 + * the setter once. However, we don't assert if the caller tries to
3319 + * overwrite, just ignoring the update instead.
3321 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3322 + * @param duration The Duration of Tunnel Failed Status to be set.
3323 + *****************************************************************************/
3324 +void evel_mobile_gtp_metrics_dur_tun_fail_set(
3325 + MOBILE_GTP_PER_FLOW_METRICS * metrics,
3328 +/**************************************************************************//**
3329 + * Set the Activated By property of the Mobile GTP Per Flow metrics.
3331 + * @note The property is treated as immutable: it is only valid to call
3332 + * the setter once. However, we don't assert if the caller tries to
3333 + * overwrite, just ignoring the update instead.
3335 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3336 + * @param act_by The Activated By to be set. ASCIIZ string. The caller
3337 + * does not need to preserve the value once the function
3339 + *****************************************************************************/
3340 +void evel_mobile_gtp_metrics_act_by_set(MOBILE_GTP_PER_FLOW_METRICS * metrics,
3341 + const char * const act_by);
3343 +/**************************************************************************//**
3344 + * Set the Activation Time property of the Mobile GTP Per Flow metrics.
3346 + * @note The property is treated as immutable: it is only valid to call
3347 + * the setter once. However, we don't assert if the caller tries to
3348 + * overwrite, just ignoring the update instead.
3350 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3351 + * @param act_time The Activation Time to be set. ASCIIZ string. The caller
3352 + * does not need to preserve the value once the function
3354 + *****************************************************************************/
3355 +void evel_mobile_gtp_metrics_act_time_set(
3356 + MOBILE_GTP_PER_FLOW_METRICS * metrics,
3359 +/**************************************************************************//**
3360 + * Set the Deactivated By property of the Mobile GTP Per Flow metrics.
3362 + * @note The property is treated as immutable: it is only valid to call
3363 + * the setter once. However, we don't assert if the caller tries to
3364 + * overwrite, just ignoring the update instead.
3366 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3367 + * @param deact_by The Deactivated By to be set. ASCIIZ string. The caller
3368 + * does not need to preserve the value once the function
3370 + *****************************************************************************/
3371 +void evel_mobile_gtp_metrics_deact_by_set(
3372 + MOBILE_GTP_PER_FLOW_METRICS * metrics,
3373 + const char * const deact_by);
3375 +/**************************************************************************//**
3376 + * Set the GTP Connection Status property of the Mobile GTP Per Flow metrics.
3378 + * @note The property is treated as immutable: it is only valid to call
3379 + * the setter once. However, we don't assert if the caller tries to
3380 + * overwrite, just ignoring the update instead.
3382 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3383 + * @param status The GTP Connection Status to be set. ASCIIZ string. The
3384 + * caller does not need to preserve the value once the
3385 + * function returns.
3386 + *****************************************************************************/
3387 +void evel_mobile_gtp_metrics_con_status_set(
3388 + MOBILE_GTP_PER_FLOW_METRICS * metrics,
3389 + const char * const status);
3391 +/**************************************************************************//**
3392 + * Set the GTP Tunnel Status property of the Mobile GTP Per Flow metrics.
3394 + * @note The property is treated as immutable: it is only valid to call
3395 + * the setter once. However, we don't assert if the caller tries to
3396 + * overwrite, just ignoring the update instead.
3398 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3399 + * @param status The GTP Tunnel Status to be set. ASCIIZ string. The
3400 + * caller does not need to preserve the value once the
3401 + * function returns.
3402 + *****************************************************************************/
3403 +void evel_mobile_gtp_metrics_tun_status_set(
3404 + MOBILE_GTP_PER_FLOW_METRICS * metrics,
3405 + const char * const status);
3407 +/**************************************************************************//**
3408 + * Set an IP Type-of-Service count property of the Mobile GTP Per Flow metrics.
3410 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3411 + * @param index The index of the IP Type-of-Service.
3412 + * @param count The count.
3413 + *****************************************************************************/
3414 +void evel_mobile_gtp_metrics_iptos_set(MOBILE_GTP_PER_FLOW_METRICS * metrics,
3418 +/**************************************************************************//**
3419 + * Set the Large Packet Round-Trip Time property of the Mobile GTP Per Flow
3422 + * @note The property is treated as immutable: it is only valid to call
3423 + * the setter once. However, we don't assert if the caller tries to
3424 + * overwrite, just ignoring the update instead.
3426 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3427 + * @param rtt The Large Packet Round-Trip Time to be set.
3428 + *****************************************************************************/
3429 +void evel_mobile_gtp_metrics_large_pkt_rtt_set(
3430 + MOBILE_GTP_PER_FLOW_METRICS * metrics,
3433 +/**************************************************************************//**
3434 + * Set the Large Packet Threshold property of the Mobile GTP Per Flow Metrics.
3436 + * @note The property is treated as immutable: it is only valid to call
3437 + * the setter once. However, we don't assert if the caller tries to
3438 + * overwrite, just ignoring the update instead.
3440 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3441 + * @param threshold The Large Packet Threshold to be set.
3442 + *****************************************************************************/
3443 +void evel_mobile_gtp_metrics_large_pkt_thresh_set(
3444 + MOBILE_GTP_PER_FLOW_METRICS * metrics,
3445 + double threshold);
3447 +/**************************************************************************//**
3448 + * Set the Max Receive Bit Rate property of the Mobile GTP Per Flow Metrics.
3450 + * @note The property is treated as immutable: it is only valid to call
3451 + * the setter once. However, we don't assert if the caller tries to
3452 + * overwrite, just ignoring the update instead.
3454 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3455 + * @param rate The Max Receive Bit Rate to be set.
3456 + *****************************************************************************/
3457 +void evel_mobile_gtp_metrics_max_rcv_bit_rate_set(
3458 + MOBILE_GTP_PER_FLOW_METRICS * metrics,
3461 +/**************************************************************************//**
3462 + * Set the Max Transmit Bit Rate property of the Mobile GTP Per Flow Metrics.
3464 + * @note The property is treated as immutable: it is only valid to call
3465 + * the setter once. However, we don't assert if the caller tries to
3466 + * overwrite, just ignoring the update instead.
3468 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3469 + * @param rate The Max Transmit Bit Rate to be set.
3470 + *****************************************************************************/
3471 +void evel_mobile_gtp_metrics_max_trx_bit_rate_set(
3472 + MOBILE_GTP_PER_FLOW_METRICS * metrics,
3475 +/**************************************************************************//**
3476 + * Set the Number of GTP Echo Failures property of the Mobile GTP Per Flow
3479 + * @note The property is treated as immutable: it is only valid to call
3480 + * the setter once. However, we don't assert if the caller tries to
3481 + * overwrite, just ignoring the update instead.
3483 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3484 + * @param num The Number of GTP Echo Failures to be set.
3485 + *****************************************************************************/
3486 +void evel_mobile_gtp_metrics_num_echo_fail_set(
3487 + MOBILE_GTP_PER_FLOW_METRICS * metrics,
3490 +/**************************************************************************//**
3491 + * Set the Number of GTP Tunnel Errors property of the Mobile GTP Per Flow
3494 + * @note The property is treated as immutable: it is only valid to call
3495 + * the setter once. However, we don't assert if the caller tries to
3496 + * overwrite, just ignoring the update instead.
3498 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3499 + * @param num The Number of GTP Tunnel Errors to be set.
3500 + *****************************************************************************/
3501 +void evel_mobile_gtp_metrics_num_tun_fail_set(
3502 + MOBILE_GTP_PER_FLOW_METRICS * metrics,
3505 +/**************************************************************************//**
3506 + * Set the Number of HTTP Errors property of the Mobile GTP Per Flow Metrics.
3508 + * @note The property is treated as immutable: it is only valid to call
3509 + * the setter once. However, we don't assert if the caller tries to
3510 + * overwrite, just ignoring the update instead.
3512 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3513 + * @param num The Number of HTTP Errors to be set.
3514 + *****************************************************************************/
3515 +void evel_mobile_gtp_metrics_num_http_errors_set(
3516 + MOBILE_GTP_PER_FLOW_METRICS * metrics,
3519 +/**************************************************************************//**
3520 + * Add a TCP flag count to the metrics.
3522 + * @note The property is treated as immutable: it is only valid to call
3523 + * the setter once. However, we don't assert if the caller tries to
3524 + * overwrite, just ignoring the update instead.
3526 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3527 + * @param tcp_flag The TCP flag count to be updated.
3528 + * @param count The associated flag count.
3529 + *****************************************************************************/
3530 +void evel_mobile_gtp_metrics_tcp_flag_count_add(
3531 + MOBILE_GTP_PER_FLOW_METRICS * metrics,
3532 + const EVEL_TCP_FLAGS tcp_flag,
3535 +/**************************************************************************//**
3536 + * Add a QCI COS count to the metrics.
3538 + * @note The property is treated as immutable: it is only valid to call
3539 + * the setter once. However, we don't assert if the caller tries to
3540 + * overwrite, just ignoring the update instead.
3542 + * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
3543 + * @param qci_cos The QCI COS count to be updated.
3544 + * @param count The associated QCI COS count.
3545 + *****************************************************************************/
3546 +void evel_mobile_gtp_metrics_qci_cos_count_add(
3547 + MOBILE_GTP_PER_FLOW_METRICS * metrics,
3548 + const EVEL_QCI_COS_TYPES qci_cos,
3551 +/*****************************************************************************/
3552 +/*****************************************************************************/
3556 +/*****************************************************************************/
3557 +/*****************************************************************************/
3559 +/**************************************************************************//**
3560 + * Create a new Signaling event.
3562 + * @note The mandatory fields on the Signaling must be supplied to
3563 + * this factory function and are immutable once set. Optional fields
3564 + * have explicit setter functions, but again values may only be set
3565 + * once so that the event has immutable properties.
3566 + * @param event_name Unique Event Name
3567 + * @param event_id A universal identifier of the event for analysis etc
3568 + * @param vendor_name The vendor id to encode in the event vnf field.
3569 + * @param module The module to encode in the event.
3570 + * @param vnfname The Virtual network function to encode in the event.
3571 + * @returns pointer to the newly manufactured ::EVENT_SIGNALING. If the event
3572 + * is not used (i.e. posted) it must be released using
3573 + * ::evel_free_signaling.
3574 + * @retval NULL Failed to create the event.
3575 + *****************************************************************************/
3576 +EVENT_SIGNALING * evel_new_signaling(const char* ev_name, const char *ev_id,
3577 + const char * const vendor_name,
3578 + const char * const correlator,
3579 + const char * const local_ip_address,
3580 + const char * const local_port,
3581 + const char * const remote_ip_address,
3582 + const char * const remote_port);
3584 +/**************************************************************************//**
3585 + * Free a Signaling event.
3587 + * Free off the event supplied. Will free all the contained allocated memory.
3589 + * @note It does not free the event itself, since that may be part of a larger
3591 + *****************************************************************************/
3592 +void evel_free_signaling(EVENT_SIGNALING * const event);
3594 +/**************************************************************************//**
3595 + * Set the Event Type property of the Signaling event.
3597 + * @note The property is treated as immutable: it is only valid to call
3598 + * the setter once. However, we don't assert if the caller tries to
3599 + * overwrite, just ignoring the update instead.
3601 + * @param event Pointer to the Signaling event.
3602 + * @param type The Event Type to be set. ASCIIZ string. The caller
3603 + * does not need to preserve the value once the function
3605 + *****************************************************************************/
3606 +void evel_signaling_type_set(EVENT_SIGNALING * const event,
3607 + const char * const type);
3609 +/**************************************************************************//**
3610 + * Add an additional value name/value pair to the SIP signaling.
3612 + * The name and value are null delimited ASCII strings. The library takes
3613 + * a copy so the caller does not have to preserve values after the function
3616 + * @param event Pointer to the fault.
3617 + * @param name ASCIIZ string with the attribute's name. The caller
3618 + * does not need to preserve the value once the function
3620 + * @param value ASCIIZ string with the attribute's value. The caller
3621 + * does not need to preserve the value once the function
3623 + *****************************************************************************/
3624 +void evel_signaling_addl_info_add(EVENT_SIGNALING * event, char * name, char * value);
3626 +/**************************************************************************//**
3627 + * Set the Correlator property of the Signaling event.
3629 + * @note The property is treated as immutable: it is only valid to call
3630 + * the setter once. However, we don't assert if the caller tries to
3631 + * overwrite, just ignoring the update instead.
3633 + * @param event Pointer to the Signaling event.
3634 + * @param correlator The correlator to be set. ASCIIZ string. The caller
3635 + * does not need to preserve the value once the function
3637 + *****************************************************************************/
3638 +void evel_signaling_correlator_set(EVENT_SIGNALING * const event,
3639 + const char * const correlator);
3641 +/**************************************************************************//**
3642 + * Set the Local Ip Address property of the Signaling event.
3644 + * @note The property is treated as immutable: it is only valid to call
3645 + * the setter once. However, we don't assert if the caller tries to
3646 + * overwrite, just ignoring the update instead.
3648 + * @param event Pointer to the Signaling event.
3649 + * @param local_ip_address
3650 + * The Local Ip Address to be set. ASCIIZ string. The
3651 + * caller does not need to preserve the value once the
3652 + * function returns.
3653 + *****************************************************************************/
3654 +void evel_signaling_local_ip_address_set(EVENT_SIGNALING * const event,
3655 + const char * const local_ip_address);
3657 +/**************************************************************************//**
3658 + * Set the Local Port property of the Signaling event.
3660 + * @note The property is treated as immutable: it is only valid to call
3661 + * the setter once. However, we don't assert if the caller tries to
3662 + * overwrite, just ignoring the update instead.
3664 + * @param event Pointer to the Signaling event.
3665 + * @param local_port The Local Port to be set. ASCIIZ string. The caller
3666 + * does not need to preserve the value once the function
3668 + *****************************************************************************/
3669 +void evel_signaling_local_port_set(EVENT_SIGNALING * const event,
3670 + const char * const local_port);
3672 +/**************************************************************************//**
3673 + * Set the Remote Ip Address property of the Signaling event.
3675 + * @note The property is treated as immutable: it is only valid to call
3676 + * the setter once. However, we don't assert if the caller tries to
3677 + * overwrite, just ignoring the update instead.
3679 + * @param event Pointer to the Signaling event.
3680 + * @param remote_ip_address
3681 + * The Remote Ip Address to be set. ASCIIZ string. The
3682 + * caller does not need to preserve the value once the
3683 + * function returns.
3684 + *****************************************************************************/
3685 +void evel_signaling_remote_ip_address_set(EVENT_SIGNALING * const event,
3686 + const char * const remote_ip_address);
3688 +/**************************************************************************//**
3689 + * Set the Remote Port property of the Signaling event.
3691 + * @note The property is treated as immutable: it is only valid to call
3692 + * the setter once. However, we don't assert if the caller tries to
3693 + * overwrite, just ignoring the update instead.
3695 + * @param event Pointer to the Signaling event.
3696 + * @param remote_port The Remote Port to be set. ASCIIZ string. The caller
3697 + * does not need to preserve the value once the function
3699 + *****************************************************************************/
3700 +void evel_signaling_remote_port_set(EVENT_SIGNALING * const event,
3701 + const char * const remote_port);
3702 +/**************************************************************************//**
3703 + * Set the Vendor module property of the Signaling event.
3705 + * @note The property is treated as immutable: it is only valid to call
3706 + * the setter once. However, we don't assert if the caller tries to
3707 + * overwrite, just ignoring the update instead.
3709 + * @param event Pointer to the Signaling event.
3710 + * @param modulename The module name to be set. ASCIIZ string. The caller
3711 + * does not need to preserve the value once the function
3713 + *****************************************************************************/
3714 +void evel_signaling_vnfmodule_name_set(EVENT_SIGNALING * const event,
3715 + const char * const module_name);
3716 +/**************************************************************************//**
3717 + * Set the Vendor module property of the Signaling event.
3719 + * @note The property is treated as immutable: it is only valid to call
3720 + * the setter once. However, we don't assert if the caller tries to
3721 + * overwrite, just ignoring the update instead.
3723 + * @param event Pointer to the Signaling event.
3724 + * @param vnfname The Virtual Network function to be set. ASCIIZ string.
3725 + * The caller does not need to preserve the value once
3726 + * the function returns.
3727 + *****************************************************************************/
3728 +void evel_signaling_vnfname_set(EVENT_SIGNALING * const event,
3729 + const char * const vnfname);
3731 +/**************************************************************************//**
3732 + * Set the Compressed SIP property of the Signaling event.
3734 + * @note The property is treated as immutable: it is only valid to call
3735 + * the setter once. However, we don't assert if the caller tries to
3736 + * overwrite, just ignoring the update instead.
3738 + * @param event Pointer to the Signaling event.
3739 + * @param compressed_sip
3740 + * The Compressed SIP to be set. ASCIIZ string. The caller
3741 + * does not need to preserve the value once the function
3743 + *****************************************************************************/
3744 +void evel_signaling_compressed_sip_set(EVENT_SIGNALING * const event,
3745 + const char * const compressed_sip);
3747 +/**************************************************************************//**
3748 + * Set the Summary SIP property of the Signaling event.
3750 + * @note The property is treated as immutable: it is only valid to call
3751 + * the setter once. However, we don't assert if the caller tries to
3752 + * overwrite, just ignoring the update instead.
3754 + * @param event Pointer to the Signaling event.
3755 + * @param summary_sip The Summary SIP to be set. ASCIIZ string. The caller
3756 + * does not need to preserve the value once the function
3758 + *****************************************************************************/
3759 +void evel_signaling_summary_sip_set(EVENT_SIGNALING * const event,
3760 + const char * const summary_sip);
3763 +/*****************************************************************************/
3764 +/*****************************************************************************/
3768 +/*****************************************************************************/
3769 +/*****************************************************************************/
3771 +/**************************************************************************//**
3772 + * Create a new State Change event.
3774 + * @note The mandatory fields on the Syslog must be supplied to this factory
3775 + * function and are immutable once set. Optional fields have explicit
3776 + * setter functions, but again values may only be set once so that the
3777 + * Syslog has immutable properties.
3779 + * @param event_name Unique Event Name
3780 + * @param event_id A universal identifier of the event for analysis etc
3781 + * @param new_state The new state of the reporting entity.
3782 + * @param old_state The old state of the reporting entity.
3783 + * @param interface The card or port name of the reporting entity.
3785 + * @returns pointer to the newly manufactured ::EVENT_STATE_CHANGE. If the
3786 + * event is not used it must be released using
3787 + * ::evel_free_state_change
3788 + * @retval NULL Failed to create the event.
3789 + *****************************************************************************/
3790 +EVENT_STATE_CHANGE * evel_new_state_change(const char* ev_name, const char *ev_id,
3791 + const EVEL_ENTITY_STATE new_state,
3792 + const EVEL_ENTITY_STATE old_state,
3793 + const char * const interface);
3795 +/**************************************************************************//**
3796 + * Free a State Change.
3798 + * Free off the State Change supplied. Will free all the contained allocated
3801 + * @note It does not free the State Change itself, since that may be part of a
3802 + * larger structure.
3803 + *****************************************************************************/
3804 +void evel_free_state_change(EVENT_STATE_CHANGE * const state_change);
3806 +/**************************************************************************//**
3807 + * Set the Event Type property of the State Change.
3809 + * @note The property is treated as immutable: it is only valid to call
3810 + * the setter once. However, we don't assert if the caller tries to
3811 + * overwrite, just ignoring the update instead.
3813 + * @param state_change Pointer to the ::EVENT_STATE_CHANGE.
3814 + * @param type The Event Type to be set. ASCIIZ string. The caller
3815 + * does not need to preserve the value once the function
3817 + *****************************************************************************/
3818 +void evel_state_change_type_set(EVENT_STATE_CHANGE * const state_change,
3819 + const char * const type);
3821 +/**************************************************************************//**
3822 + * Add an additional field name/value pair to the State Change.
3824 + * The name and value are null delimited ASCII strings. The library takes
3825 + * a copy so the caller does not have to preserve values after the function
3828 + * @param state_change Pointer to the ::EVENT_STATE_CHANGE.
3829 + * @param name ASCIIZ string with the attribute's name. The caller
3830 + * does not need to preserve the value once the function
3832 + * @param value ASCIIZ string with the attribute's value. The caller
3833 + * does not need to preserve the value once the function
3835 + *****************************************************************************/
3836 +void evel_state_change_addl_field_add(EVENT_STATE_CHANGE * const state_change,
3837 + const char * const name,
3838 + const char * const value);
3840 +/*****************************************************************************/
3841 +/*****************************************************************************/
3845 +/*****************************************************************************/
3846 +/*****************************************************************************/
3848 +/**************************************************************************//**
3849 + * Create a new syslog event.
3851 + * @note The mandatory fields on the Syslog must be supplied to this factory
3852 + * function and are immutable once set. Optional fields have explicit
3853 + * setter functions, but again values may only be set once so that the
3854 + * Syslog has immutable properties.
3856 + * @param event_name Unique Event Name
3857 + * @param event_id A universal identifier of the event for analysis etc
3858 + * @param event_source_type
3859 + * @param syslog_msg
3860 + * @param syslog_tag
3863 + * @returns pointer to the newly manufactured ::EVENT_SYSLOG. If the event is
3864 + * not used it must be released using ::evel_free_syslog
3865 + * @retval NULL Failed to create the event.
3866 + *****************************************************************************/
3867 +EVENT_SYSLOG * evel_new_syslog(const char* ev_name, const char *ev_id,
3868 + EVEL_SOURCE_TYPES event_source_type,
3869 + const char * const syslog_msg,
3870 + const char * const syslog_tag);
3872 +/**************************************************************************//**
3873 + * Set the Event Type property of the Syslog.
3875 + * @note The property is treated as immutable: it is only valid to call
3876 + * the setter once. However, we don't assert if the caller tries to
3877 + * overwrite, just ignoring the update instead.
3879 + * @param syslog Pointer to the syslog.
3880 + * @param type The Event Type to be set. ASCIIZ string. The caller
3881 + * does not need to preserve the value once the function
3883 + *****************************************************************************/
3884 +void evel_syslog_type_set(EVENT_SYSLOG * syslog,
3885 + const char * const type);
3887 +/**************************************************************************//**
3890 + * Free off the Syslog supplied. Will free all the contained allocated memory.
3892 + * @note It does not free the Syslog itself, since that may be part of a
3893 + * larger structure.
3894 + *****************************************************************************/
3895 +void evel_free_syslog(EVENT_SYSLOG * event);
3897 +/**************************************************************************//**
3898 + * Add an additional field name/value pair to the Syslog.
3900 + * The name and value are null delimited ASCII strings. The library takes
3901 + * a copy so the caller does not have to preserve values after the function
3904 + * @param syslog Pointer to the syslog.
3905 + * @param name ASCIIZ string with the attribute's name. The caller
3906 + * does not need to preserve the value once the function
3908 + * @param value ASCIIZ string with the attribute's value. The caller
3909 + * does not need to preserve the value once the function
3911 + *****************************************************************************/
3912 +void evel_syslog_addl_field_add(EVENT_SYSLOG * syslog,
3916 +/**************************************************************************//**
3917 + * Set the Event Source Host property of the Syslog.
3919 + * @note The property is treated as immutable: it is only valid to call
3920 + * the setter once. However, we don't assert if the caller tries to
3921 + * overwrite, just ignoring the update instead.
3923 + * @param syslog Pointer to the Syslog.
3924 + * @param host The Event Source Host to be set. ASCIIZ string. The
3925 + * caller does not need to preserve the value once the
3926 + * function returns.
3927 + *****************************************************************************/
3928 +void evel_syslog_event_source_host_set(EVENT_SYSLOG * syslog,
3929 + const char * const host);
3931 +/**************************************************************************//**
3932 + * Set the Syslog Facility property of the Syslog.
3934 + * @note The property is treated as immutable: it is only valid to call
3935 + * the setter once. However, we don't assert if the caller tries to
3936 + * overwrite, just ignoring the update instead.
3938 + * @param syslog Pointer to the Syslog.
3939 + * @param facility The Syslog Facility to be set. ASCIIZ string. The caller
3940 + * does not need to preserve the value once the function
3942 + *****************************************************************************/
3943 +void evel_syslog_facility_set(EVENT_SYSLOG * syslog,
3944 + EVEL_SYSLOG_FACILITIES facility);
3946 +/**************************************************************************//**
3947 + * Set the Process property of the Syslog.
3949 + * @note The property is treated as immutable: it is only valid to call
3950 + * the setter once. However, we don't assert if the caller tries to
3951 + * overwrite, just ignoring the update instead.
3953 + * @param syslog Pointer to the Syslog.
3954 + * @param proc The Process to be set. ASCIIZ string. The caller does
3955 + * not need to preserve the value once the function returns.
3956 + *****************************************************************************/
3957 +void evel_syslog_proc_set(EVENT_SYSLOG * syslog, const char * const proc);
3959 +/**************************************************************************//**
3960 + * Set the Process ID property of the Syslog.
3962 + * @note The property is treated as immutable: it is only valid to call
3963 + * the setter once. However, we don't assert if the caller tries to
3964 + * overwrite, just ignoring the update instead.
3966 + * @param syslog Pointer to the Syslog.
3967 + * @param proc_id The Process ID to be set.
3968 + *****************************************************************************/
3969 +void evel_syslog_proc_id_set(EVENT_SYSLOG * syslog, int proc_id);
3971 +/**************************************************************************//**
3972 + * Set the Version property of the Syslog.
3974 + * @note The property is treated as immutable: it is only valid to call
3975 + * the setter once. However, we don't assert if the caller tries to
3976 + * overwrite, just ignoring the update instead.
3978 + * @param syslog Pointer to the Syslog.
3979 + * @param version The Version to be set.
3980 + *****************************************************************************/
3981 +void evel_syslog_version_set(EVENT_SYSLOG * syslog, int version);
3983 +/**************************************************************************//**
3984 + * Set the Structured Data property of the Syslog.
3986 + * @note The property is treated as immutable: it is only valid to call
3987 + * the setter once. However, we don't assert if the caller tries to
3988 + * overwrite, just ignoring the update instead.
3990 + * @param syslog Pointer to the Syslog.
3991 + * @param s_data The Structured Data to be set. ASCIIZ string. The caller
3992 + * does not need to preserve the value once the function
3994 + *****************************************************************************/
3995 +void evel_syslog_s_data_set(EVENT_SYSLOG * syslog, const char * const s_data);
3997 +/**************************************************************************//**
3998 + * Set the Structured SDID property of the Syslog.
4000 + * @note The property is treated as immutable: it is only valid to call
4001 + * the setter once. However, we don't assert if the caller tries to
4002 + * overwrite, just ignoring the update instead.
4004 + * @param syslog Pointer to the Syslog.
4005 + * @param sdid The Structured Data to be set. ASCIIZ string. name@number
4006 + * Caller does not need to preserve the value once the function
4008 + *****************************************************************************/
4009 +void evel_syslog_sdid_set(EVENT_SYSLOG * syslog, const char * const sdid);
4011 +/**************************************************************************//**
4012 + * Set the Structured Severity property of the Syslog.
4014 + * @note The property is treated as immutable: it is only valid to call
4015 + * the setter once. However, we don't assert if the caller tries to
4016 + * overwrite, just ignoring the update instead.
4018 + * @param syslog Pointer to the Syslog.
4019 + * @param sdid The Structured Data to be set. ASCIIZ string.
4020 + * Caller does not need to preserve the value once the function
4022 + *****************************************************************************/
4023 +void evel_syslog_severity_set(EVENT_SYSLOG * syslog, const char * const severty);
4026 +/*****************************************************************************/
4027 +/*****************************************************************************/
4031 +/*****************************************************************************/
4032 +/*****************************************************************************/
4034 +/**************************************************************************//**
4035 + * Create a new other event.
4037 + * @param event_name Unique Event Name
4038 + * @param event_id A universal identifier of the event for analysis etc
4040 + * @returns pointer to the newly manufactured ::EVENT_OTHER. If the event is
4041 + * not used it must be released using ::evel_free_other.
4042 + * @retval NULL Failed to create the event.
4043 + *****************************************************************************/
4044 +EVENT_OTHER * evel_new_other(const char* ev_name, const char *ev_id);
4046 +/**************************************************************************//**
4049 + * Free off the Other supplied. Will free all the contained allocated memory.
4051 + * @note It does not free the Other itself, since that may be part of a
4052 + * larger structure.
4053 + *****************************************************************************/
4054 +void evel_free_other(EVENT_OTHER * event);
4056 +/**************************************************************************//**
4057 + * Set the Event Type property of the Other.
4059 + * @note The property is treated as immutable: it is only valid to call
4060 + * the setter once. However, we don't assert if the caller tries to
4061 + * overwrite, just ignoring the update instead.
4063 + * @param other Pointer to the Other.
4064 + * @param type The Event Type to be set. ASCIIZ string. The caller
4065 + * does not need to preserve the value once the function
4067 + *****************************************************************************/
4068 +void evel_other_type_set(EVENT_OTHER * other,
4069 + const char * const type);
4071 +/**************************************************************************//**
4072 + * Add a value name/value pair to the Other.
4074 + * The name and value are null delimited ASCII strings. The library takes
4075 + * a copy so the caller does not have to preserve values after the function
4078 + * @param other Pointer to the Other.
4079 + * @param name ASCIIZ string with the attribute's name.
4080 + * @param value ASCIIZ string with the attribute's value.
4081 + *****************************************************************************/
4082 +void evel_other_field_add(EVENT_OTHER * other,
4086 +/*****************************************************************************/
4087 +/*****************************************************************************/
4091 +/*****************************************************************************/
4092 +/*****************************************************************************/
4094 +/**************************************************************************//**
4095 + * Return the current measurement interval provided by the Event Listener.
4097 + * @returns The current measurement interval
4098 + * @retval EVEL_MEASUREMENT_INTERVAL_UKNOWN (0) - interval has not been
4100 + *****************************************************************************/
4101 +int evel_get_measurement_interval();
4103 +/*****************************************************************************/
4104 +/* Supported Report version. */
4105 +/*****************************************************************************/
4106 +#define EVEL_VOICEQ_MAJOR_VERSION 1
4107 +#define EVEL_VOICEQ_MINOR_VERSION 1
4109 +/**************************************************************************//**
4110 + * End of Call Voice Quality Metrices
4111 + * JSON equivalent field: endOfCallVqmSummaries
4112 + *****************************************************************************/
4113 +typedef struct end_of_call_vqm_summaries {
4114 + /***************************************************************************/
4115 + /* Mandatory fields */
4116 + /***************************************************************************/
4117 + char* adjacencyName;
4118 + char* endpointDescription;
4120 + /***************************************************************************/
4121 + /* Optional fields */
4122 + /***************************************************************************/
4123 + EVEL_OPTION_INT endpointJitter;
4124 + EVEL_OPTION_INT endpointRtpOctetsDiscarded;
4125 + EVEL_OPTION_INT endpointRtpOctetsReceived;
4126 + EVEL_OPTION_INT endpointRtpOctetsSent;
4127 + EVEL_OPTION_INT endpointRtpPacketsDiscarded;
4128 + EVEL_OPTION_INT endpointRtpPacketsReceived;
4129 + EVEL_OPTION_INT endpointRtpPacketsSent;
4130 + EVEL_OPTION_INT localJitter;
4131 + EVEL_OPTION_INT localRtpOctetsDiscarded;
4132 + EVEL_OPTION_INT localRtpOctetsReceived;
4133 + EVEL_OPTION_INT localRtpOctetsSent;
4134 + EVEL_OPTION_INT localRtpPacketsDiscarded;
4135 + EVEL_OPTION_INT localRtpPacketsReceived;
4136 + EVEL_OPTION_INT localRtpPacketsSent;
4137 + EVEL_OPTION_INT mosCqe;
4138 + EVEL_OPTION_INT packetsLost;
4139 + EVEL_OPTION_INT packetLossPercent;
4140 + EVEL_OPTION_INT rFactor;
4141 + EVEL_OPTION_INT roundTripDelay;
4143 +} END_OF_CALL_VOICE_QUALITY_METRICS;
4145 +/**************************************************************************//**
4147 +* JSON equivalent field: voiceQualityFields
4148 +*****************************************************************************/
4150 +typedef struct event_voiceQuality {
4151 + /***************************************************************************/
4152 + /* Header and version */
4153 + /***************************************************************************/
4154 + EVENT_HEADER header;
4155 + int major_version;
4156 + int minor_version;
4158 + /***************************************************************************/
4159 + /* Mandatory fields */
4160 + /***************************************************************************/
4162 + char *calleeSideCodec;
4163 + char *callerSideCodec;
4165 + char *midCallRtcp;
4166 + VENDOR_VNFNAME_FIELD vendorVnfNameFields;
4167 + END_OF_CALL_VOICE_QUALITY_METRICS *endOfCallVqmSummaries;
4169 + /***************************************************************************/
4170 + /* Optional fields */
4171 + /***************************************************************************/
4172 + EVEL_OPTION_STRING phoneNumber;
4173 + DLIST additionalInformation;
4175 +} EVENT_VOICE_QUALITY;
4176 +/**************************************************************************//**
4177 + * Voice Quality Additional Info.
4178 + * JSON equivalent field: additionalInformation
4179 + *****************************************************************************/
4180 +typedef struct voice_quality_additional_info {
4183 +} VOICE_QUALITY_ADDL_INFO;
4185 +/**************************************************************************//**
4186 + * Create a new voice quality event.
4188 + * @note The mandatory fields on the Voice Quality must be supplied to this
4189 + * factory function and are immutable once set. Optional fields have
4190 + * explicit setter functions, but again values may only be set once
4191 + * so that the Voice Quality has immutable properties.
4192 + * @param event_name Unique Event Name
4193 + * @param event_id A universal identifier of the event for analysis etc
4194 + * @param calleeSideCodec Callee codec for the call.
4195 + * @param callerSideCodec Caller codec for the call.
4196 + * @param correlator Constant across all events on this call.
4197 + * @param midCallRtcp Base64 encoding of the binary RTCP data
4198 + * (excluding Eth/IP/UDP headers).
4199 + * @param vendorVnfNameFields Vendor, VNF and VfModule names.
4200 + * @returns pointer to the newly manufactured ::EVENT_VOICE_QUALITY. If the
4201 + * event is not used (i.e. posted) it must be released using
4202 + ::evel_free_voice_quality.
4203 + * @retval NULL Failed to create the event.
4204 + *****************************************************************************/
4205 +EVENT_VOICE_QUALITY * evel_new_voice_quality(const char* ev_name, const char *ev_id,
4206 + const char * const calleeSideCodec,
4207 + const char * const callerSideCodec, const char * const correlator,
4208 + const char * const midCallRtcp, const char * const vendorVnfNameFields);
4210 +/**************************************************************************//**
4211 + * Set the Callee side codec for Call for domain Voice Quality
4213 + * @note The property is treated as immutable: it is only valid to call
4214 + * the setter once. However, we don't assert if the caller tries to
4215 + * overwrite, just ignoring the update instead.
4217 + * @param voiceQuality Pointer to the Voice Quality Event.
4218 + * @param calleeCodecForCall The Callee Side Codec to be set. ASCIIZ
4219 + * string. The caller does not need to
4220 + * preserve the value once the function
4222 + *****************************************************************************/
4223 +void evel_voice_quality_callee_codec_set(EVENT_VOICE_QUALITY * voiceQuality,
4224 + const char * const calleeCodecForCall);
4226 +/**************************************************************************//**
4227 + * Set the Caller side codec for Call for domain Voice Quality
4229 + * @note The property is treated as immutable: it is only valid to call
4230 + * the setter once. However, we don't assert if the caller tries to
4231 + * overwrite, just ignoring the update instead.
4233 + * @param voiceQuality Pointer to the Voice Quality Event.
4234 + * @param callerCodecForCall The Caller Side Codec to be set. ASCIIZ
4235 + * string. The caller does not need to
4236 + * preserve the value once the function
4238 + *****************************************************************************/
4239 +void evel_voice_quality_caller_codec_set(EVENT_VOICE_QUALITY * voiceQuality,
4240 + const char * const callerCodecForCall);
4242 +/**************************************************************************//**
4243 + * Set the correlator for domain Voice Quality
4245 + * @note The property is treated as immutable: it is only valid to call
4246 + * the setter once. However, we don't assert if the caller tries to
4247 + * overwrite, just ignoring the update instead.
4249 + * @param voiceQuality Pointer to the Voice Quality Event.
4250 + * @param correlator The correlator value to be set. ASCIIZ
4251 + * string. The caller does not need to
4252 + * preserve the value once the function
4254 + *****************************************************************************/
4255 +void evel_voice_quality_correlator_set(EVENT_VOICE_QUALITY * voiceQuality,
4256 + const char * const vCorrelator);
4258 +/**************************************************************************//**
4259 + * Set the RTCP Call Data for domain Voice Quality
4261 + * @note The property is treated as immutable: it is only valid to call
4262 + * the setter once. However, we don't assert if the caller tries to
4263 + * overwrite, just ignoring the update instead.
4265 + * @param voiceQuality Pointer to the Voice Quality Event.
4266 + * @param rtcpCallData The RTCP Call Data to be set. ASCIIZ
4267 + * string. The caller does not need to
4268 + * preserve the value once the function
4270 + *****************************************************************************/
4271 +void evel_voice_quality_rtcp_data_set(EVENT_VOICE_QUALITY * voiceQuality,
4272 + const char * const rtcpCallData);
4274 +/**************************************************************************//**
4275 + * Set the Vendor VNF Name fields for domain Voice Quality
4277 + * @note The property is treated as immutable: it is only valid to call
4278 + * the setter once. However, we don't assert if the caller tries to
4279 + * overwrite, just ignoring the update instead.
4281 + * @param voiceQuality Pointer to the Voice Quality Event.
4282 + * @param nameFields The Vendor, VNF and VfModule names to be set.
4283 + * ASCIIZ string. The caller does not need to
4284 + * preserve the value once the function
4286 + *****************************************************************************/
4287 +void evel_voice_quality_name_fields_set(EVENT_VOICE_QUALITY * voiceQuality,
4288 + const char * const nameFields);
4290 +/**************************************************************************//**
4291 + * Add an End of Call Voice Quality Metrices
4293 + * The adjacencyName and endpointDescription is null delimited ASCII string.
4294 + * The library takes a copy so the caller does not have to preserve values
4295 + * after the function returns.
4297 + * @param voiceQuality Pointer to the measurement.
4298 + * @param adjacencyName Adjacency name
4299 + * @param endpointDescription Enumeration: ‘Caller’, ‘Callee’.
4300 + * @param endpointJitter Endpoint jitter
4301 + * @param endpointRtpOctetsDiscarded Endpoint RTP octets discarded.
4302 + * @param endpointRtpOctetsReceived Endpoint RTP octets received.
4303 + * @param endpointRtpOctetsSent Endpoint RTP octets sent
4304 + * @param endpointRtpPacketsDiscarded Endpoint RTP packets discarded.
4305 + * @param endpointRtpPacketsReceived Endpoint RTP packets received.
4306 + * @param endpointRtpPacketsSent Endpoint RTP packets sent.
4307 + * @param localJitter Local jitter.
4308 + * @param localRtpOctetsDiscarded Local RTP octets discarded.
4309 + * @param localRtpOctetsReceived Local RTP octets received.
4310 + * @param localRtpOctetsSent Local RTP octets sent.
4311 + * @param localRtpPacketsDiscarded Local RTP packets discarded.
4312 + * @param localRtpPacketsReceived Local RTP packets received.
4313 + * @param localRtpPacketsSent Local RTP packets sent.
4314 + * @param mosCqe Decimal range from 1 to 5
4315 + * (1 decimal place)
4316 + * @param packetsLost No Packets lost
4317 + * @param packetLossPercent Calculated percentage packet loss
4318 + * @param rFactor rFactor from 0 to 100
4319 + * @param roundTripDelay Round trip delay in milliseconds
4320 + *****************************************************************************/
4321 +void evel_voice_quality_end_metrics_add(EVENT_VOICE_QUALITY * voiceQuality,
4322 + const char * adjacencyName, EVEL_SERVICE_ENDPOINT_DESC endpointDescription,
4323 + int endpointJitter,
4324 + int endpointRtpOctetsDiscarded,
4325 + int endpointRtpOctetsReceived,
4326 + int endpointRtpOctetsSent,
4327 + int endpointRtpPacketsDiscarded,
4328 + int endpointRtpPacketsReceived,
4329 + int endpointRtpPacketsSent,
4331 + int localRtpOctetsDiscarded,
4332 + int localRtpOctetsReceived,
4333 + int localRtpOctetsSent,
4334 + int localRtpPacketsDiscarded,
4335 + int localRtpPacketsReceived,
4336 + int localRtpPacketsSent,
4339 + int packetLossPercent,
4341 + int roundTripDelay);
4343 +/**************************************************************************//**
4344 + * Free a Voice Quality.
4346 + * Free off the Voce Quality supplied. Will free all the contained allocated
4349 + * @note It does not free the Voice Quality itself, since that may be part of a
4350 + * larger structure.
4351 + *****************************************************************************/
4352 +void evel_free_voice_quality(EVENT_VOICE_QUALITY * voiceQuality);
4354 +/**************************************************************************//**
4355 + * Add an additional value name/value pair to the Voice Quality.
4357 + * The name and value are null delimited ASCII strings. The library takes
4358 + * a copy so the caller does not have to preserve values after the function
4361 + * @param fault Pointer to the fault.
4362 + * @param name ASCIIZ string with the attribute's name. The caller
4363 + * does not need to preserve the value once the function
4365 + * @param value ASCIIZ string with the attribute's value. The caller
4366 + * does not need to preserve the value once the function
4368 + *****************************************************************************/
4369 +void evel_voice_quality_addl_info_add(EVENT_VOICE_QUALITY * voiceQuality, char * name, char * value);
4372 +/*****************************************************************************/
4373 +/*****************************************************************************/
4375 +/* THRESHOLD CROSSING ALERT */
4377 +/*****************************************************************************/
4378 +/*****************************************************************************/
4380 +typedef enum evel_event_action {
4381 + EVEL_EVENT_ACTION_CLEAR,
4382 + EVEL_EVENT_ACTION_CONTINUE,
4383 + EVEL_EVENT_ACTION_SET,
4384 + EVEL_MAX_EVENT_ACTION
4385 +}EVEL_EVENT_ACTION;
4387 +typedef enum evel_alert_type {
4388 + EVEL_CARD_ANOMALY,
4389 + EVEL_ELEMENT_ANOMALY,
4390 + EVEL_INTERFACE_ANOMALY,
4391 + EVEL_SERVICE_ANOMALY,
4396 +typedef struct perf_counter {
4397 + char * criticality;
4399 + char * thresholdCrossed;
4404 +/*****************************************************************************/
4405 +/* Supported Threshold Crossing version. */
4406 +/*****************************************************************************/
4407 +#define EVEL_THRESHOLD_CROSS_MAJOR_VERSION 1
4408 +#define EVEL_THRESHOLD_CROSS_MINOR_VERSION 1
4410 +/**************************************************************************//**
4411 + * Threshold Crossing.
4412 + * JSON equivalent field: Threshold Cross Fields
4413 + *****************************************************************************/
4414 +typedef struct event_threshold_cross {
4415 + /***************************************************************************/
4416 + /* Header and version */
4417 + /***************************************************************************/
4418 + EVENT_HEADER header;
4419 + int major_version;
4420 + int minor_version;
4422 + /***************************************************************************/
4423 + /* Mandatory fields */
4424 + /***************************************************************************/
4425 + PERF_COUNTER additionalParameters;
4426 + EVEL_EVENT_ACTION alertAction;
4427 + char * alertDescription;
4428 + EVEL_ALERT_TYPE alertType;
4429 + unsigned long long collectionTimestamp;
4430 + EVEL_SEVERITIES eventSeverity;
4431 + unsigned long long eventStartTimestamp;
4433 + /***************************************************************************/
4434 + /* Optional fields */
4435 + /***************************************************************************/
4436 + DLIST additional_info;
4437 + EVEL_OPTION_STRING alertValue;
4438 + DLIST alertidList;
4439 + EVEL_OPTION_STRING dataCollector;
4440 + EVEL_OPTION_STRING elementType;
4441 + EVEL_OPTION_STRING interfaceName;
4442 + EVEL_OPTION_STRING networkService;
4443 + EVEL_OPTION_STRING possibleRootCause;
4445 +} EVENT_THRESHOLD_CROSS;
4448 +/**************************************************************************//**
4449 + * Create a new Threshold Crossing Alert event.
4451 + * @note The mandatory fields on the TCA must be supplied to this factory
4452 + * function and are immutable once set. Optional fields have explicit
4453 + * setter functions, but again values may only be set once so that the
4454 + * TCA has immutable properties.
4456 + * @param event_name Unique Event Name
4457 + * @param event_id A universal identifier of the event for analysis etc
4458 + * @param char* tcriticality Performance Counter Criticality MAJ MIN,
4459 + * @param char* tname Performance Counter Threshold name
4460 + * @param char* tthresholdCrossed Counter Threshold crossed value
4461 + * @param char* tvalue Counter actual value
4462 + * @param EVEL_EVENT_ACTION talertAction Alert set continue or clear
4463 + * @param char* talertDescription
4464 + * @param EVEL_ALERT_TYPE talertType Kind of anamoly
4465 + * @param unsigned long long tcollectionTimestamp time at which alert was collected
4466 + * @param EVEL_SEVERITIES teventSeverity Severity of Alert
4467 + * @param unsigned long long teventStartTimestamp Time when this alert started
4469 + * @returns pointer to the newly manufactured ::EVENT_THRESHOLD_CROSS. If the
4470 + * event is not used it must be released using
4471 + * ::evel_free_threshold_cross
4472 + * @retval NULL Failed to create the event.
4473 + *****************************************************************************/
4474 +EVENT_THRESHOLD_CROSS * evel_new_threshold_cross(
4475 + const char* ev_name, const char *ev_id,
4476 + char * tcriticality,
4478 + char * tthresholdCrossed,
4480 + EVEL_EVENT_ACTION talertAction,
4481 + char * talertDescription,
4482 + EVEL_ALERT_TYPE talertType,
4483 + unsigned long long tcollectionTimestamp,
4484 + EVEL_SEVERITIES teventSeverity,
4485 + unsigned long long teventStartTimestamp);
4487 +/**************************************************************************//**
4488 + * Free a Threshold cross event.
4490 + * Free off the Threshold crossing event supplied. Will free all the contained allocated
4493 + * @note It does not free the Threshold Cross itself, since that may be part of a
4494 + * larger structure.
4495 + *****************************************************************************/
4496 +void evel_free_threshold_cross(EVENT_THRESHOLD_CROSS * const tcp);
4498 +/**************************************************************************//**
4499 + * Set the Event Type property of the Threshold Cross.
4501 + * @note The property is treated as immutable: it is only valid to call
4502 + * the setter once. However, we don't assert if the caller tries to
4503 + * overwrite, just ignoring the update instead.
4505 + * @param tcp Pointer to the ::EVENT_THRESHOLD_CROSS.
4506 + * @param type The Event Type to be set. ASCIIZ string. The caller
4507 + * does not need to preserve the value once the function
4509 + *****************************************************************************/
4510 +void evel_threshold_cross_type_set(EVENT_THRESHOLD_CROSS * const tcp, char * type);
4512 +/**************************************************************************//**
4513 + * Add an optional additional alertid value to Alert.
4515 + * @param alertid Adds Alert ID
4516 + *****************************************************************************/
4517 +void evel_threshold_cross_alertid_add(EVENT_THRESHOLD_CROSS * const event,char * alertid);
4519 + /**************************************************************************//**
4520 + * Set the TCA probable Root cause.
4522 + * @param sheader Possible root cause to Threshold
4523 + *****************************************************************************/
4524 + void evel_threshold_cross_possible_rootcause_set(EVENT_THRESHOLD_CROSS * const event, char * sheader);
4525 + /**************************************************************************//**
4526 + * Set the TCA networking cause.
4528 + * @param sheader Possible networking service value to Threshold
4529 + *****************************************************************************/
4530 + void evel_threshold_cross_networkservice_set(EVENT_THRESHOLD_CROSS * const event, char * sheader);
4531 + /**************************************************************************//**
4532 + * Set the TCA Interface name.
4534 + * @param sheader Interface name to threshold
4535 + *****************************************************************************/
4536 + void evel_threshold_cross_interfacename_set(EVENT_THRESHOLD_CROSS * const event,char * sheader);
4537 + /**************************************************************************//**
4538 + * Set the TCA Data element type.
4540 + * @param sheader element type of Threshold
4541 + *****************************************************************************/
4542 + void evel_threshold_cross_data_elementtype_set(EVENT_THRESHOLD_CROSS * const event,char * sheader);
4543 + /**************************************************************************//**
4544 + * Set the TCA Data collector value.
4546 + * @param sheader Data collector value
4547 + *****************************************************************************/
4548 + void evel_threshold_cross_data_collector_set(EVENT_THRESHOLD_CROSS * const event,char * sheader);
4549 + /**************************************************************************//**
4550 + * Set the TCA alert value.
4552 + * @param sheader Possible alert value
4553 + *****************************************************************************/
4554 + void evel_threshold_cross_alertvalue_set(EVENT_THRESHOLD_CROSS * const event,char * sheader);
4556 +/**************************************************************************//**
4557 + * Add an additional field name/value pair to the THRESHOLD CROSS event.
4559 + * The name and value are null delimited ASCII strings. The library takes
4560 + * a copy so the caller does not have to preserve values after the function
4563 + * @param state_change Pointer to the ::EVENT_THRESHOLD_CROSS.
4564 + * @param name ASCIIZ string with the attribute's name. The caller
4565 + * does not need to preserve the value once the function
4567 + * @param value ASCIIZ string with the attribute's value. The caller
4568 + * does not need to preserve the value once the function
4570 + *****************************************************************************/
4571 +void evel_threshold_cross_addl_info_add(EVENT_THRESHOLD_CROSS * const tcp,
4572 + const char * const name,
4573 + const char * const value);
4575 +/*****************************************************************************/
4576 +/*****************************************************************************/
4580 +/*****************************************************************************/
4581 +/*****************************************************************************/
4583 +/*****************************************************************************/
4584 +/* Debug macros. */
4585 +/*****************************************************************************/
4586 +#define EVEL_DEBUG(FMT, ...) log_debug(EVEL_LOG_DEBUG, (FMT), ##__VA_ARGS__)
4587 +#define EVEL_INFO(FMT, ...) log_debug(EVEL_LOG_INFO, (FMT), ##__VA_ARGS__)
4588 +#define EVEL_SPAMMY(FMT, ...) log_debug(EVEL_LOG_SPAMMY, (FMT), ##__VA_ARGS__)
4589 +#define EVEL_ERROR(FMT, ...) log_debug(EVEL_LOG_ERROR, "ERROR: " FMT, \
4591 +#define EVEL_ENTER() \
4593 + log_debug(EVEL_LOG_DEBUG, "Enter %s {", __FUNCTION__); \
4594 + debug_indent += 2; \
4596 +#define EVEL_EXIT() \
4598 + debug_indent -= 2; \
4599 + log_debug(EVEL_LOG_DEBUG, "Exit %s }", __FUNCTION__); \
4602 +#define INDENT_SEPARATORS \
4603 + "| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "
4605 +extern EVEL_LOG_LEVELS debug_level;
4606 +extern int debug_indent;
4607 +extern FILE * fout;
4609 +#define EVEL_DEBUG_ON() ((debug_level) >= EVEL_LOG_DEBUG)
4611 +/**************************************************************************//**
4612 + * Initialize logging
4614 + * @param[in] level The debugging level - one of ::EVEL_LOG_LEVELS.
4615 + * @param[in] ident The identifier for our logs.
4616 + *****************************************************************************/
4617 +void log_initialize(EVEL_LOG_LEVELS level, const char * ident);
4619 +/**************************************************************************//**
4620 + * Log debug information
4622 + * Logs debugging information in a platform independent manner.
4624 + * @param[in] level The debugging level - one of ::EVEL_LOG_LEVELS.
4625 + * @param[in] format Log formatting string in printf format.
4626 + * @param[in] ... Variable argument list.
4627 + *****************************************************************************/
4628 +void log_debug(EVEL_LOG_LEVELS level, char * format, ...);
4630 +/***************************************************************************//*
4631 + * Store the formatted string into the static error string and log the error.
4633 + * @param format Error string in standard printf format.
4634 + * @param ... Variable parameters to be substituted into the format string.
4635 + *****************************************************************************/
4636 +void log_error_state(char * format, ...);
4644 diff --git a/src/plugins/ves/include/evel_internal.h b/src/plugins/ves/include/evel_internal.h
4645 new file mode 100644
4646 index 0000000..46f71af
4648 +++ b/src/plugins/ves/include/evel_internal.h
4650 +/*************************************************************************//**
4652 + * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
4654 + * Licensed under the Apache License, Version 2.0 (the "License");
4655 + * you may not use this file except in compliance with the License.
4656 + * You may obtain a copy of the License at
4657 + * http://www.apache.org/licenses/LICENSE-2.0
4659 + * Unless required by applicable law or agreed to in writing, software
4660 + * distributed under the License is distributed on an "AS IS" BASIS,
4661 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4662 + * See the License for the specific language governing permissions and
4663 + * limitations under the License.
4665 + ****************************************************************************/
4666 +/**************************************************************************//**
4668 + * EVEL internal definitions.
4670 + * These are internal definitions which need to be shared between modules
4671 + * within the library but are not intended for external consumption.
4673 + ****************************************************************************/
4675 +#ifndef EVEL_INTERNAL_INCLUDED
4676 +#define EVEL_INTERNAL_INCLUDED
4680 +/*****************************************************************************/
4681 +/* Define some type-safe min/max macros. */
4682 +/*****************************************************************************/
4684 + ({ __typeof__ (a) _a = (a); \
4685 + __typeof__ (b) _b = (b); \
4686 + _a > _b ? _a : _b; })
4689 + ({ __typeof__ (a) _a = (a); \
4690 + __typeof__ (b) _b = (b); \
4691 + _a < _b ? _a : _b; })
4694 +/**************************************************************************//**
4695 + * Compile-time assertion.
4696 + *****************************************************************************/
4697 +#define EVEL_CT_ASSERT(X) switch (0) {case 0: case (X):;}
4699 +/**************************************************************************//**
4700 + * The Functional Role of the equipment represented by this VNF.
4701 + *****************************************************************************/
4702 +extern char * functional_role;
4704 +/**************************************************************************//**
4705 + * The type of equipment represented by this VNF.
4706 + *****************************************************************************/
4707 +extern EVEL_SOURCE_TYPES event_source_type;
4709 +/**************************************************************************//**
4710 + * A chunk of memory used in the cURL functions.
4711 + *****************************************************************************/
4712 +typedef struct memory_chunk {
4717 +/**************************************************************************//**
4718 + * Global commands that may be sent to the Event Handler thread.
4719 + *****************************************************************************/
4721 + EVT_CMD_TERMINATE,
4722 + EVT_CMD_MAX_COMMANDS
4723 +} EVT_HANDLER_COMMAND;
4725 +/**************************************************************************//**
4726 + * State of the Event Handler thread.
4727 + *****************************************************************************/
4729 + EVT_HANDLER_UNINITIALIZED, /** The library cannot handle events. */
4730 + EVT_HANDLER_INACTIVE, /** The event handler thread not started. */
4731 + EVT_HANDLER_ACTIVE, /** The event handler thread is started. */
4732 + EVT_HANDLER_REQUEST_TERMINATE, /** Initial stages of shutdown. */
4733 + EVT_HANDLER_TERMINATING, /** The ring-buffer is being depleted. */
4734 + EVT_HANDLER_TERMINATED, /** The library is exited. */
4735 + EVT_HANDLER_MAX_STATES /** Maximum number of valid states. */
4736 +} EVT_HANDLER_STATE;
4738 +/**************************************************************************//**
4740 + * Pseudo-event used for routing internal commands.
4741 + *****************************************************************************/
4742 +typedef struct event_internal {
4743 + EVENT_HEADER header;
4744 + EVT_HANDLER_COMMAND command;
4747 +/**************************************************************************//**
4748 + * Suppressed NV pairs list entry.
4749 + * JSON equivalent field: suppressedNvPairs
4750 + *****************************************************************************/
4751 +typedef struct evel_suppressed_nv_pairs {
4753 + /***************************************************************************/
4754 + /* Mandatory fields */
4755 + /* JSON equivalent field: nvPairFieldName */
4756 + /***************************************************************************/
4757 + char * nv_pair_field_name;
4759 + /***************************************************************************/
4760 + /* Optional fields */
4761 + /* JSON equivalent field: suppressedNvPairNames */
4762 + /* Type of each list entry: char * */
4763 + /***************************************************************************/
4764 + DLIST suppressed_nv_pair_names;
4766 + /***************************************************************************/
4767 + /* Hash table containing suppressed_nv_pair_names as keys. */
4768 + /***************************************************************************/
4769 + struct hsearch_data * hash_nv_pair_names;
4771 +} EVEL_SUPPRESSED_NV_PAIRS;
4773 +/**************************************************************************//**
4774 + * Event Throttling Specification for a domain which is in a throttled state.
4775 + * JSON equivalent object: eventThrottlingState
4776 + *****************************************************************************/
4777 +typedef struct evel_throttle_spec {
4779 + /***************************************************************************/
4780 + /* List of field names to be suppressed. */
4781 + /* JSON equivalent field: suppressedFieldNames */
4782 + /* Type of each list entry: char * */
4783 + /***************************************************************************/
4784 + DLIST suppressed_field_names;
4786 + /***************************************************************************/
4787 + /* List of name-value pairs to be suppressed. */
4788 + /* JSON equivalent field: suppressedNvPairsList */
4789 + /* Type of each list entry: EVEL_SUPPRESSED_NV_PAIRS * */
4790 + /***************************************************************************/
4791 + DLIST suppressed_nv_pairs_list;
4793 + /***************************************************************************/
4794 + /* Hash table containing suppressed_nv_pair_names as keys. */
4795 + /***************************************************************************/
4796 + struct hsearch_data * hash_field_names;
4798 + /***************************************************************************/
4799 + /* Hash table containing nv_pair_field_name as keys, and */
4800 + /* suppressed_nv_pairs_list as values. */
4801 + /***************************************************************************/
4802 + struct hsearch_data * hash_nv_pairs_list;
4804 +} EVEL_THROTTLE_SPEC;
4806 +/*****************************************************************************/
4807 +/* RFC2822 format string for strftime. */
4808 +/*****************************************************************************/
4809 +#define EVEL_RFC2822_STRFTIME_FORMAT "%a, %d %b %Y %T %z"
4811 +/*****************************************************************************/
4812 +/* EVEL_JSON_BUFFER depth at which we throttle fields. */
4813 +/*****************************************************************************/
4814 +#define EVEL_THROTTLE_FIELD_DEPTH 3
4816 +/**************************************************************************//**
4817 + * Initialize the event handler.
4819 + * Primarily responsible for getting cURL ready for use.
4821 + * @param[in] event_api_url
4822 + * The URL where the Vendor Event Listener API is expected
4824 + * @param[in] throt_api_url
4825 + * The URL where the Throttling API is expected to be.
4826 + * @param[in] username The username for the Basic Authentication of requests.
4827 + * @param[in] password The password for the Basic Authentication of requests.
4828 + * @param verbosity 0 for normal operation, positive values for chattier
4830 + *****************************************************************************/
4831 +EVEL_ERR_CODES event_handler_initialize(const char * const event_api_url,
4832 + const char * const throt_api_url,
4833 + const char * const username,
4834 + const char * const password,
4837 +/**************************************************************************//**
4838 + * Terminate the event handler.
4840 + * Shuts down the event handler thread in as clean a way as possible. Sets the
4841 + * global exit flag and then signals the thread to interrupt it since it's
4842 + * most likely waiting on the ring-buffer.
4844 + * Having achieved an orderly shutdown of the event handler thread, clean up
4845 + * the cURL library's resources cleanly.
4847 + * @return Status code.
4848 + * @retval ::EVEL_SUCCESS if everything OK.
4849 + * @retval One of ::EVEL_ERR_CODES if there was a problem.
4850 + *****************************************************************************/
4851 +EVEL_ERR_CODES event_handler_terminate();
4853 +/**************************************************************************//**
4854 + * Run the event handler.
4856 + * Spawns the thread responsible for handling events and sending them to the
4859 + * @return Status code.
4860 + * @retval ::EVEL_SUCCESS if everything OK.
4861 + * @retval One of ::EVEL_ERR_CODES if there was a problem.
4862 + *****************************************************************************/
4863 +EVEL_ERR_CODES event_handler_run();
4865 +/**************************************************************************//**
4866 + * Create a new internal event.
4868 + * @note The mandatory fields on the Fault must be supplied to this factory
4869 + * function and are immutable once set. Optional fields have explicit
4870 + * setter functions, but again values may only be set once so that the
4871 + * Fault has immutable properties.
4872 + * @param command The condition indicated by the event.
4873 + * @returns pointer to the newly manufactured ::EVENT_INTERNAL. If the event
4874 + * is not used (i.e. posted) it must be released using
4875 + * ::evel_free_event.
4876 + * @retval NULL Failed to create the event.
4877 + *****************************************************************************/
4878 +EVENT_INTERNAL * evel_new_internal_event(EVT_HANDLER_COMMAND command,const char* ev_name, const char *ev_id);
4880 +/**************************************************************************//**
4881 + * Free an internal event.
4883 + * Free off the event supplied. Will free all the contained* allocated memory.
4885 + * @note It does not free the internal event itself, since that may be part of
4886 + * a larger structure.
4887 + *****************************************************************************/
4888 +void evel_free_internal_event(EVENT_INTERNAL * event);
4890 +/*****************************************************************************/
4891 +/* Structure to hold JSON buffer and associated tracking, as it is written. */
4892 +/*****************************************************************************/
4893 +typedef struct evel_json_buffer
4899 + /***************************************************************************/
4900 + /* The working throttle specification, which can be NULL. */
4901 + /***************************************************************************/
4902 + EVEL_THROTTLE_SPEC * throttle_spec;
4904 + /***************************************************************************/
4905 + /* Current object/list nesting depth. */
4906 + /***************************************************************************/
4909 + /***************************************************************************/
4910 + /* The checkpoint. */
4911 + /***************************************************************************/
4914 +} EVEL_JSON_BUFFER;
4916 +/**************************************************************************//**
4917 + * Encode the event as a JSON event object according to AT&T's schema.
4919 + * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
4920 + * @param event Pointer to the ::EVENT_HEADER to encode.
4921 + *****************************************************************************/
4922 +void evel_json_encode_header(EVEL_JSON_BUFFER * jbuf,
4923 + EVENT_HEADER * event);
4925 +/**************************************************************************//**
4926 + * Encode the fault in JSON according to AT&T's schema for the fault type.
4928 + * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
4929 + * @param event Pointer to the ::EVENT_HEADER to encode.
4930 + *****************************************************************************/
4931 +void evel_json_encode_fault(EVEL_JSON_BUFFER * jbuf,
4932 + EVENT_FAULT * event);
4934 +/**************************************************************************//**
4935 + * Encode the measurement as a JSON measurement.
4937 + * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
4938 + * @param event Pointer to the ::EVENT_HEADER to encode.
4939 + *****************************************************************************/
4940 +void evel_json_encode_measurement(EVEL_JSON_BUFFER * jbuf,
4941 + EVENT_MEASUREMENT * event);
4943 +/**************************************************************************//**
4944 + * Encode the Mobile Flow in JSON according to AT&T's schema for the event
4947 + * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
4948 + * @param event Pointer to the ::EVENT_HEADER to encode.
4949 + *****************************************************************************/
4950 +void evel_json_encode_mobile_flow(EVEL_JSON_BUFFER * jbuf,
4951 + EVENT_MOBILE_FLOW * event);
4953 +/**************************************************************************//**
4954 + * Encode the report as a JSON report.
4956 + * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
4957 + * @param event Pointer to the ::EVENT_HEADER to encode.
4958 + *****************************************************************************/
4959 +void evel_json_encode_report(EVEL_JSON_BUFFER * jbuf,
4960 + EVENT_REPORT * event);
4962 +/**************************************************************************//**
4963 + * Encode the Heartbeat fields in JSON according to AT&T's schema for the
4966 + * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
4967 + * @param event Pointer to the ::EVENT_HEADER to encode.
4968 + *****************************************************************************/
4969 +void evel_json_encode_hrtbt_field(EVEL_JSON_BUFFER * const jbuf,
4970 + EVENT_HEARTBEAT_FIELD * const event);
4972 +/**************************************************************************//**
4973 + * Encode the Signaling in JSON according to AT&T's schema for the event type.
4975 + * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
4976 + * @param event Pointer to the ::EVENT_HEADER to encode.
4977 + *****************************************************************************/
4978 +void evel_json_encode_signaling(EVEL_JSON_BUFFER * const jbuf,
4979 + EVENT_SIGNALING * const event);
4981 +/**************************************************************************//**
4982 + * Encode the state change as a JSON state change.
4984 + * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
4985 + * @param state_change Pointer to the ::EVENT_STATE_CHANGE to encode.
4986 + *****************************************************************************/
4987 +void evel_json_encode_state_change(EVEL_JSON_BUFFER * jbuf,
4988 + EVENT_STATE_CHANGE * state_change);
4990 +/**************************************************************************//**
4991 + * Encode the Syslog in JSON according to AT&T's schema for the event type.
4993 + * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
4994 + * @param event Pointer to the ::EVENT_HEADER to encode.
4995 + *****************************************************************************/
4996 +void evel_json_encode_syslog(EVEL_JSON_BUFFER * jbuf,
4997 + EVENT_SYSLOG * event);
4999 +/**************************************************************************//**
5000 + * Encode the Other in JSON according to AT&T's schema for the event type.
5002 + * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
5003 + * @param event Pointer to the ::EVENT_HEADER to encode.
5004 + *****************************************************************************/
5005 +void evel_json_encode_other(EVEL_JSON_BUFFER * jbuf,
5006 + EVENT_OTHER * event);
5008 +/**************************************************************************//**
5009 + * Set the next event_sequence to use.
5011 + * @param sequence The next sequence number to use.
5012 + *****************************************************************************/
5013 +void evel_set_next_event_sequence(const int sequence);
5015 +/**************************************************************************//**
5016 + * Handle a JSON response from the listener, contained in a ::MEMORY_CHUNK.
5018 + * Tokenize the response, and decode any tokens found.
5020 + * @param chunk The memory chunk containing the response.
5021 + * @param post The memory chunk in which to place any resulting POST.
5022 + *****************************************************************************/
5023 +void evel_handle_event_response(const MEMORY_CHUNK * const chunk,
5024 + MEMORY_CHUNK * const post);
5026 +/**************************************************************************//**
5027 + * Initialize a ::EVEL_JSON_BUFFER.
5029 + * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to initialise.
5030 + * @param json Pointer to the underlying working buffer to use.
5031 + * @param max_size Size of storage available in the JSON buffer.
5032 + * @param throttle_spec Pointer to throttle specification. Can be NULL.
5033 + *****************************************************************************/
5034 +void evel_json_buffer_init(EVEL_JSON_BUFFER * jbuf,
5035 + char * const json,
5036 + const int max_size,
5037 + EVEL_THROTTLE_SPEC * throttle_spec);
5039 +/**************************************************************************//**
5040 + * Encode a string key and string value to a ::EVEL_JSON_BUFFER.
5042 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5043 + * @param key Pointer to the key to encode.
5044 + * @param option Pointer to holder of the corresponding value to encode.
5045 + * @return true if the key, value was added, false if it was suppressed.
5046 + *****************************************************************************/
5047 +bool evel_enc_kv_opt_string(EVEL_JSON_BUFFER * jbuf,
5048 + const char * const key,
5049 + const EVEL_OPTION_STRING * const option);
5051 +/**************************************************************************//**
5052 + * Encode a string key and string value to a ::EVEL_JSON_BUFFER.
5054 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5055 + * @param key Pointer to the key to encode.
5056 + * @param value Pointer to the corresponding value to encode.
5057 + *****************************************************************************/
5058 +void evel_enc_kv_string(EVEL_JSON_BUFFER * jbuf,
5059 + const char * const key,
5060 + const char * const value);
5062 +/**************************************************************************//**
5063 + * Encode a string key and integer value to a ::EVEL_JSON_BUFFER.
5065 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5066 + * @param key Pointer to the key to encode.
5067 + * @param option Pointer to holder of the corresponding value to encode.
5068 + * @return true if the key, value was added, false if it was suppressed.
5069 + *****************************************************************************/
5070 +bool evel_enc_kv_opt_int(EVEL_JSON_BUFFER * jbuf,
5071 + const char * const key,
5072 + const EVEL_OPTION_INT * const option);
5074 +/**************************************************************************//**
5075 + * Encode a string key and integer value to a ::EVEL_JSON_BUFFER.
5077 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5078 + * @param key Pointer to the key to encode.
5079 + * @param value The corresponding value to encode.
5080 + *****************************************************************************/
5081 +void evel_enc_kv_int(EVEL_JSON_BUFFER * jbuf,
5082 + const char * const key,
5085 +/**************************************************************************//**
5086 + * Encode a string key and double value to a ::EVEL_JSON_BUFFER.
5088 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5089 + * @param key Pointer to the key to encode.
5090 + * @param option Pointer to holder of the corresponding value to encode.
5091 + * @return true if the key, value was added, false if it was suppressed.
5092 + *****************************************************************************/
5093 +bool evel_enc_kv_opt_double(EVEL_JSON_BUFFER * jbuf,
5094 + const char * const key,
5095 + const EVEL_OPTION_DOUBLE * const option);
5097 +/**************************************************************************//**
5098 + * Encode a string key and double value to a ::EVEL_JSON_BUFFER.
5100 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5101 + * @param key Pointer to the key to encode.
5102 + * @param value The corresponding value to encode.
5103 + *****************************************************************************/
5104 +void evel_enc_kv_double(EVEL_JSON_BUFFER * jbuf,
5105 + const char * const key,
5106 + const double value);
5108 +/**************************************************************************//**
5109 + * Encode a string key and unsigned long long value to a ::EVEL_JSON_BUFFER.
5111 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5112 + * @param key Pointer to the key to encode.
5113 + * @param option Pointer to holder of the corresponding value to encode.
5114 + * @return true if the key, value was added, false if it was suppressed.
5115 + *****************************************************************************/
5116 +bool evel_enc_kv_opt_ull(EVEL_JSON_BUFFER * jbuf,
5117 + const char * const key,
5118 + const EVEL_OPTION_ULL * const option);
5120 +/**************************************************************************//**
5121 + * Encode a string key and unsigned long long value to a ::EVEL_JSON_BUFFER.
5123 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5124 + * @param key Pointer to the key to encode.
5125 + * @param value The corresponding value to encode.
5126 + *****************************************************************************/
5127 +void evel_enc_kv_ull(EVEL_JSON_BUFFER * jbuf,
5128 + const char * const key,
5129 + const unsigned long long value);
5131 +/**************************************************************************//**
5132 + * Encode a string key and time value to a ::EVEL_JSON_BUFFER.
5134 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5135 + * @param key Pointer to the key to encode.
5136 + * @param option Pointer to holder of the corresponding value to encode.
5137 + * @return true if the key, value was added, false if it was suppressed.
5138 + *****************************************************************************/
5139 +bool evel_enc_kv_opt_time(EVEL_JSON_BUFFER * jbuf,
5140 + const char * const key,
5141 + const EVEL_OPTION_TIME * const option);
5143 +/**************************************************************************//**
5144 + * Encode a string key and time value to a ::EVEL_JSON_BUFFER.
5146 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5147 + * @param key Pointer to the key to encode.
5148 + * @param time Pointer to the time to encode.
5149 + *****************************************************************************/
5150 +void evel_enc_kv_time(EVEL_JSON_BUFFER * jbuf,
5151 + const char * const key,
5152 + const time_t * time);
5154 +/**************************************************************************//**
5155 + * Encode a key and version.
5157 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5158 + * @param key Pointer to the key to encode.
5159 + * @param major_version The major version to encode.
5160 + * @param minor_version The minor version to encode.
5161 + *****************************************************************************/
5162 +void evel_enc_version(EVEL_JSON_BUFFER * jbuf,
5163 + const char * const key,
5164 + const int major_version,
5165 + const int minor_version);
5167 +/**************************************************************************//**
5168 + * Add the key and opening bracket of an optional named list to a JSON buffer.
5170 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5171 + * @param key Pointer to the key to encode.
5172 + * @return true if the list was opened, false if it was suppressed.
5173 + *****************************************************************************/
5174 +bool evel_json_open_opt_named_list(EVEL_JSON_BUFFER * jbuf,
5175 + const char * const key);
5177 +/**************************************************************************//**
5178 + * Add the key and opening bracket of a named list to a JSON buffer.
5180 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5181 + * @param key Pointer to the key to encode.
5182 + *****************************************************************************/
5183 +void evel_json_open_named_list(EVEL_JSON_BUFFER * jbuf,
5184 + const char * const key);
5186 +/**************************************************************************//**
5187 + * Add the closing bracket of a list to a JSON buffer.
5189 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5190 + *****************************************************************************/
5191 +void evel_json_close_list(EVEL_JSON_BUFFER * jbuf);
5193 +/**************************************************************************//**
5194 + * Encode a list item with format and param list to a ::EVEL_JSON_BUFFER.
5196 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5197 + * @param format Format string in standard printf format.
5198 + * @param ... Variable parameters for format string.
5199 + *****************************************************************************/
5200 +void evel_enc_list_item(EVEL_JSON_BUFFER * jbuf,
5201 + const char * const format,
5204 +/**************************************************************************//**
5205 + * Add the opening bracket of an optional named object to a JSON buffer.
5207 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5208 + * @param key Pointer to the key to encode.
5209 + *****************************************************************************/
5210 +bool evel_json_open_opt_named_object(EVEL_JSON_BUFFER * jbuf,
5211 + const char * const key);
5213 +/**************************************************************************//**
5214 + * Add the opening bracket of an object to a JSON buffer.
5216 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5217 + * @param key Pointer to the key to encode.
5218 + * @return true if the object was opened, false if it was suppressed.
5219 + *****************************************************************************/
5220 +void evel_json_open_named_object(EVEL_JSON_BUFFER * jbuf,
5221 + const char * const key);
5223 +/**************************************************************************//**
5224 + * Add the opening bracket of an object to a JSON buffer.
5226 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5227 + *****************************************************************************/
5228 +void evel_json_open_object(EVEL_JSON_BUFFER * jbuf);
5230 +/**************************************************************************//**
5231 + * Add the closing bracket of an object to a JSON buffer.
5233 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5234 + *****************************************************************************/
5235 +void evel_json_close_object(EVEL_JSON_BUFFER * jbuf);
5237 +/**************************************************************************//**
5238 + * Add a checkpoint - a stake in the ground to which we can rewind.
5240 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5241 + *****************************************************************************/
5242 +void evel_json_checkpoint(EVEL_JSON_BUFFER * jbuf);
5244 +/**************************************************************************//**
5245 + * Rewind to the latest checkoint.
5247 + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
5248 + *****************************************************************************/
5249 +void evel_json_rewind(EVEL_JSON_BUFFER * jbuf);
5251 +/**************************************************************************//**
5252 + * Free the underlying resources of an ::EVEL_OPTION_STRING.
5254 + * @param option Pointer to the ::EVEL_OPTION_STRING.
5255 + *****************************************************************************/
5256 +void evel_free_option_string(EVEL_OPTION_STRING * const option);
5258 +/**************************************************************************//**
5259 + * Initialize an ::EVEL_OPTION_STRING to a not-set state.
5261 + * @param option Pointer to the ::EVEL_OPTION_STRING.
5262 + *****************************************************************************/
5263 +void evel_init_option_string(EVEL_OPTION_STRING * const option);
5265 +/**************************************************************************//**
5266 + * Set the value of an ::EVEL_OPTION_STRING.
5268 + * @param option Pointer to the ::EVEL_OPTION_STRING.
5269 + * @param value The value to set.
5270 + * @param description Description to be used in logging.
5271 + *****************************************************************************/
5272 +void evel_set_option_string(EVEL_OPTION_STRING * const option,
5273 + const char * const value,
5274 + const char * const description);
5276 +/**************************************************************************//**
5277 + * Force the value of an ::EVEL_OPTION_STRING.
5279 + * @param option Pointer to the ::EVEL_OPTION_STRING.
5280 + * @param value The value to set.
5281 + *****************************************************************************/
5282 +void evel_force_option_string(EVEL_OPTION_STRING * const option,
5283 + const char * const value);
5285 +/**************************************************************************//**
5286 + * Initialize an ::EVEL_OPTION_INT to a not-set state.
5288 + * @param option Pointer to the ::EVEL_OPTION_INT.
5289 + *****************************************************************************/
5290 +void evel_init_option_int(EVEL_OPTION_INT * const option);
5292 +/**************************************************************************//**
5293 + * Force the value of an ::EVEL_OPTION_INT.
5295 + * @param option Pointer to the ::EVEL_OPTION_INT.
5296 + * @param value The value to set.
5297 + *****************************************************************************/
5298 +void evel_force_option_int(EVEL_OPTION_INT * const option,
5301 +/**************************************************************************//**
5302 + * Set the value of an ::EVEL_OPTION_INT.
5304 + * @param option Pointer to the ::EVEL_OPTION_INT.
5305 + * @param value The value to set.
5306 + * @param description Description to be used in logging.
5307 + *****************************************************************************/
5308 +void evel_set_option_int(EVEL_OPTION_INT * const option,
5310 + const char * const description);
5312 +/**************************************************************************//**
5313 + * Initialize an ::EVEL_OPTION_DOUBLE to a not-set state.
5315 + * @param option Pointer to the ::EVEL_OPTION_DOUBLE.
5316 + *****************************************************************************/
5317 +void evel_init_option_double(EVEL_OPTION_DOUBLE * const option);
5319 +/**************************************************************************//**
5320 + * Force the value of an ::EVEL_OPTION_DOUBLE.
5322 + * @param option Pointer to the ::EVEL_OPTION_DOUBLE.
5323 + * @param value The value to set.
5324 + *****************************************************************************/
5325 +void evel_force_option_double(EVEL_OPTION_DOUBLE * const option,
5326 + const double value);
5328 +/**************************************************************************//**
5329 + * Set the value of an ::EVEL_OPTION_DOUBLE.
5331 + * @param option Pointer to the ::EVEL_OPTION_DOUBLE.
5332 + * @param value The value to set.
5333 + * @param description Description to be used in logging.
5334 + *****************************************************************************/
5335 +void evel_set_option_double(EVEL_OPTION_DOUBLE * const option,
5336 + const double value,
5337 + const char * const description);
5339 +/**************************************************************************//**
5340 + * Initialize an ::EVEL_OPTION_ULL to a not-set state.
5342 + * @param option Pointer to the ::EVEL_OPTION_ULL.
5343 + *****************************************************************************/
5344 +void evel_init_option_ull(EVEL_OPTION_ULL * const option);
5346 +/**************************************************************************//**
5347 + * Force the value of an ::EVEL_OPTION_ULL.
5349 + * @param option Pointer to the ::EVEL_OPTION_ULL.
5350 + * @param value The value to set.
5351 + *****************************************************************************/
5352 +void evel_force_option_ull(EVEL_OPTION_ULL * const option,
5353 + const unsigned long long value);
5355 +/**************************************************************************//**
5356 + * Set the value of an ::EVEL_OPTION_ULL.
5358 + * @param option Pointer to the ::EVEL_OPTION_ULL.
5359 + * @param value The value to set.
5360 + * @param description Description to be used in logging.
5361 + *****************************************************************************/
5362 +void evel_set_option_ull(EVEL_OPTION_ULL * const option,
5363 + const unsigned long long value,
5364 + const char * const description);
5366 +/**************************************************************************//**
5367 + * Initialize an ::EVEL_OPTION_TIME to a not-set state.
5369 + * @param option Pointer to the ::EVEL_OPTION_TIME.
5370 + *****************************************************************************/
5371 +void evel_init_option_time(EVEL_OPTION_TIME * const option);
5373 +/**************************************************************************//**
5374 + * Force the value of an ::EVEL_OPTION_TIME.
5376 + * @param option Pointer to the ::EVEL_OPTION_TIME.
5377 + * @param value The value to set.
5378 + *****************************************************************************/
5379 +void evel_force_option_time(EVEL_OPTION_TIME * const option,
5380 + const time_t value);
5382 +/**************************************************************************//**
5383 + * Set the value of an ::EVEL_OPTION_TIME.
5385 + * @param option Pointer to the ::EVEL_OPTION_TIME.
5386 + * @param value The value to set.
5387 + * @param description Description to be used in logging.
5388 + *****************************************************************************/
5389 +void evel_set_option_time(EVEL_OPTION_TIME * const option,
5390 + const time_t value,
5391 + const char * const description);
5393 +/**************************************************************************//**
5394 + * Map an ::EVEL_COUNTER_CRITICALITIES enum value to the equivalent string.
5396 + * @param criticality The criticality to convert.
5397 + * @returns The equivalent string.
5398 + *****************************************************************************/
5399 +char * evel_criticality(const EVEL_COUNTER_CRITICALITIES criticality);
5401 +/**************************************************************************//**
5402 + * Map an ::EVEL_SEVERITIES enum value to the equivalent string.
5404 + * @param severity The severity to convert.
5405 + * @returns The equivalent string.
5406 + *****************************************************************************/
5407 +char * evel_severity(const EVEL_SEVERITIES severity);
5409 +/**************************************************************************//**
5410 + * Map an ::EVEL_ALERT_ACTIONS enum value to the equivalent string.
5412 + * @param alert_action The alert_action to convert.
5413 + * @returns The equivalent string.
5414 + *****************************************************************************/
5415 +char * evel_alert_action(const EVEL_ALERT_ACTIONS alert_action);
5417 +/**************************************************************************//**
5418 + * Map an ::EVEL_ALERT_TYPES enum value to the equivalent string.
5420 + * @param alert_type The alert_type to convert.
5421 + * @returns The equivalent string.
5422 + *****************************************************************************/
5423 +char * evel_alert_type(const EVEL_ALERT_TYPES alert_type);
5425 +/**************************************************************************//**
5426 + * Map an ::EVEL_EVENT_DOMAINS enum value to the equivalent string.
5428 + * @param domain The domain to convert.
5429 + * @returns The equivalent string.
5430 + *****************************************************************************/
5431 +char * evel_event_domain(const EVEL_EVENT_DOMAINS domain);
5433 +/**************************************************************************//**
5434 + * Map an ::EVEL_EVENT_PRIORITIES enum value to the equivalent string.
5436 + * @param priority The priority to convert.
5437 + * @returns The equivalent string.
5438 + *****************************************************************************/
5439 +char * evel_event_priority(const EVEL_EVENT_PRIORITIES priority);
5441 +/**************************************************************************//**
5442 + * Map an ::EVEL_SOURCE_TYPES enum value to the equivalent string.
5444 + * @param source_type The source type to convert.
5445 + * @returns The equivalent string.
5446 + *****************************************************************************/
5447 +char * evel_source_type(const EVEL_SOURCE_TYPES source_type);
5449 +/**************************************************************************//**
5450 + * Map an ::EVEL_VF_STATUSES enum value to the equivalent string.
5452 + * @param vf_status The vf_status to convert.
5453 + * @returns The equivalent string.
5454 + *****************************************************************************/
5455 +char * evel_vf_status(const EVEL_VF_STATUSES vf_status);
5457 +/**************************************************************************//**
5458 + * Convert a ::EVEL_ENTITY_STATE to it's string form for JSON encoding.
5460 + * @param state The entity state to encode.
5462 + * @returns the corresponding string
5463 + *****************************************************************************/
5464 +char * evel_entity_state(const EVEL_ENTITY_STATE state);
5466 +/**************************************************************************//**
5467 + * Convert a ::EVEL_SERVICE_ENDPOINT_DESC to string form for JSON encoding.
5469 + * @param endpoint_desc endpoint description to encode.
5471 + * @returns the corresponding string
5472 + *****************************************************************************/
5473 +char * evel_service_endpoint_desc(const EVEL_ENTITY_STATE endpoint_desc);
5476 +/**************************************************************************//**
5477 + * Initialize an ::EVEL_OPTION_INTHEADER_FIELDS to a not-set state.
5479 + * @param option Pointer to the ::EVEL_OPTION_INTHEADER_FIELDS.
5480 + *****************************************************************************/
5481 +void evel_init_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option);
5482 +/**************************************************************************//**
5483 + * Force the value of an ::EVEL_OPTION_INTHEADER_FIELDS.
5485 + * @param option Pointer to the ::EVEL_OPTION_INTHEADER_FIELDS.
5486 + * @param value The value to set.
5487 + *****************************************************************************/
5488 +void evel_force_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option,
5489 + const void* value);
5490 +/**************************************************************************//**
5491 + * Set the value of an ::EVEL_OPTION_INTHEADER_FIELDS.
5493 + * @param option Pointer to the ::EVEL_OPTION_INTHEADER_FIELDS.
5494 + * @param value The value to set.
5495 + * @param description Description to be used in logging.
5496 + *****************************************************************************/
5497 +void evel_set_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option,
5498 + const void * value,
5499 + const char * const description);
5500 +/**************************************************************************//**
5501 + * Free the underlying resources of an ::EVEL_OPTION_INTHEADER_FIELDS.
5503 + * @param option Pointer to the ::EVEL_OPTION_INTHEADER_FIELDS.
5504 + *****************************************************************************/
5505 +void evel_free_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option);
5508 diff --git a/src/plugins/ves/include/evel_throttle.h b/src/plugins/ves/include/evel_throttle.h
5509 new file mode 100644
5510 index 0000000..c97b3c3
5512 +++ b/src/plugins/ves/include/evel_throttle.h
5514 +/*************************************************************************//**
5516 + * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
5518 + * Licensed under the Apache License, Version 2.0 (the "License");
5519 + * you may not use this file except in compliance with the License.
5520 + * You may obtain a copy of the License at
5521 + * http://www.apache.org/licenses/LICENSE-2.0
5523 + * Unless required by applicable law or agreed to in writing, software
5524 + * distributed under the License is distributed on an "AS IS" BASIS,
5525 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5526 + * See the License for the specific language governing permissions and
5527 + * limitations under the License.
5529 + ****************************************************************************/
5530 +/**************************************************************************//**
5532 + * EVEL throttle definitions.
5534 + * These are internal definitions related to throttling specicications, which
5535 + * are required within the library but are not intended for external
5538 + ****************************************************************************/
5540 +#ifndef EVEL_THROTTLE_INCLUDED
5541 +#define EVEL_THROTTLE_INCLUDED
5543 +#include "evel_internal.h"
5546 +/*****************************************************************************/
5547 +/* Maximum depth of JSON response that we can handle. */
5548 +/*****************************************************************************/
5549 +#define EVEL_JSON_STACK_DEPTH 10
5551 +/**************************************************************************//**
5552 + * Maximum number of tokens that we allow for in a JSON response.
5553 + *****************************************************************************/
5554 +#define EVEL_MAX_RESPONSE_TOKENS 1024
5556 +/**************************************************************************//**
5557 + * The nature of the next token that we are iterating through. Within an
5558 + * object, we alternate between collecting keys and values. Within an array,
5559 + * we only collect items.
5560 + *****************************************************************************/
5567 +/**************************************************************************//**
5568 + * States which we move through during JSON processing, tracking our way
5569 + * through the supported JSON structure.
5570 + *****************************************************************************/
5573 + /***************************************************************************/
5574 + /* Initial state. */
5575 + /***************************************************************************/
5578 + /***************************************************************************/
5579 + /* {"commandList": [ */
5580 + /***************************************************************************/
5581 + EVEL_JCS_COMMAND_LIST,
5583 + /***************************************************************************/
5584 + /* {"commandList": [{ */
5585 + /***************************************************************************/
5586 + EVEL_JCS_COMMAND_LIST_ENTRY,
5588 + /***************************************************************************/
5589 + /* {"commandList": [{"command": { */
5590 + /***************************************************************************/
5593 + /***************************************************************************/
5594 + /* ... "eventDomainThrottleSpecification": { */
5595 + /***************************************************************************/
5598 + /***************************************************************************/
5599 + /* ... "suppressedFieldNames": [ */
5600 + /***************************************************************************/
5601 + EVEL_JCS_FIELD_NAMES,
5603 + /***************************************************************************/
5604 + /* ... "suppressedNvPairsList": [ */
5605 + /***************************************************************************/
5606 + EVEL_JCS_PAIRS_LIST,
5608 + /***************************************************************************/
5609 + /* ... "suppressedNvPairsList": [{ */
5610 + /***************************************************************************/
5611 + EVEL_JCS_PAIRS_LIST_ENTRY,
5613 + /***************************************************************************/
5614 + /* ... "suppressedNvPairNames": [ */
5615 + /***************************************************************************/
5616 + EVEL_JCS_NV_PAIR_NAMES,
5619 +} EVEL_JSON_COMMAND_STATE;
5621 +/**************************************************************************//**
5622 + * An entry in the JSON stack.
5623 + *****************************************************************************/
5624 +typedef struct evel_json_stack_entry {
5626 + /***************************************************************************/
5627 + /* The number of elements required at this level. */
5628 + /***************************************************************************/
5631 + /***************************************************************************/
5632 + /* The number of elements collected at this level. */
5633 + /***************************************************************************/
5636 + /***************************************************************************/
5637 + /* The collection state at this level in the JSON stack. */
5638 + /***************************************************************************/
5639 + EVEL_JSON_STATE json_state;
5641 + /***************************************************************************/
5642 + /* The key being collected (if json_state is EVEL_JSON_VALUE), or NULL. */
5643 + /***************************************************************************/
5646 +} EVEL_JSON_STACK_ENTRY;
5648 +/**************************************************************************//**
5650 + *****************************************************************************/
5651 +typedef struct evel_json_stack {
5653 + /***************************************************************************/
5654 + /* The current position of the stack - starting at zero. */
5655 + /***************************************************************************/
5658 + /***************************************************************************/
5659 + /* The stack itself. */
5660 + /***************************************************************************/
5661 + EVEL_JSON_STACK_ENTRY entry[EVEL_JSON_STACK_DEPTH];
5663 + /***************************************************************************/
5664 + /* The underlying memory chunk. */
5665 + /***************************************************************************/
5666 + const MEMORY_CHUNK * chunk;
5670 +/**************************************************************************//**
5671 + * Initialize event throttling to the default state.
5673 + * Called from ::evel_initialize.
5674 + *****************************************************************************/
5675 +void evel_throttle_initialize();
5677 +/**************************************************************************//**
5678 + * Clean up event throttling.
5680 + * Called from ::evel_terminate.
5681 + *****************************************************************************/
5682 +void evel_throttle_terminate();
5684 +/**************************************************************************//**
5685 + * Handle a JSON response from the listener, as a list of tokens from JSMN.
5687 + * @param chunk Memory chunk containing the JSON buffer.
5688 + * @param json_tokens Array of tokens to handle.
5689 + * @param num_tokens The number of tokens to handle.
5690 + * @param post The memory chunk in which to place any resulting POST.
5691 + * @return true if the command was handled, false otherwise.
5692 + *****************************************************************************/
5693 +bool evel_handle_command_list(const MEMORY_CHUNK * const chunk,
5694 + const jsmntok_t * const json_tokens,
5695 + const int num_tokens,
5696 + MEMORY_CHUNK * const post);
5698 +/**************************************************************************//**
5699 + * Return the ::EVEL_THROTTLE_SPEC for a given domain.
5701 + * @param domain The domain for which to return state.
5702 + *****************************************************************************/
5703 +EVEL_THROTTLE_SPEC * evel_get_throttle_spec(EVEL_EVENT_DOMAINS domain);
5705 +/**************************************************************************//**
5706 + * Determine whether a field_name should be suppressed.
5708 + * @param throttle_spec Throttle specification for the domain being encoded.
5709 + * @param field_name The field name to encoded or suppress.
5710 + * @return true if the field_name should be suppressed, false otherwise.
5711 + *****************************************************************************/
5712 +bool evel_throttle_suppress_field(EVEL_THROTTLE_SPEC * throttle_spec,
5713 + const char * const field_name);
5715 +/**************************************************************************//**
5716 + * Determine whether a name-value pair should be allowed (not suppressed).
5718 + * @param throttle_spec Throttle specification for the domain being encoded.
5719 + * @param field_name The field name holding the name-value pairs.
5720 + * @param name The name of the name-value pair to encoded or suppress.
5721 + * @return true if the name-value pair should be suppressed, false otherwise.
5722 + *****************************************************************************/
5723 +bool evel_throttle_suppress_nv_pair(EVEL_THROTTLE_SPEC * throttle_spec,
5724 + const char * const field_name,
5725 + const char * const name);
5728 diff --git a/src/plugins/ves/include/hashtable.h b/src/plugins/ves/include/hashtable.h
5729 new file mode 100644
5730 index 0000000..8be17dc
5732 +++ b/src/plugins/ves/include/hashtable.h
5734 +#ifndef HASHTABLE_INCLUDED
5735 +#define HASHTABLE_INCLUDED
5737 +/*************************************************************************//**
5739 + * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
5741 + * Licensed under the Apache License, Version 2.0 (the "License");
5742 + * you may not use this file except in compliance with the License.
5743 + * You may obtain a copy of the License at
5744 + * http://www.apache.org/licenses/LICENSE-2.0
5746 + * Unless required by applicable law or agreed to in writing, software
5747 + * distributed under the License is distributed on an "AS IS" BASIS,
5748 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5749 + * See the License for the specific language governing permissions and
5750 + * limitations under the License.
5752 + ****************************************************************************/
5754 +/**************************************************************************//**
5756 + * A simple hashtable.
5758 + * @note No thread protection so you will need to use appropriate
5759 + * synchronization if use spans multiple threads.
5760 +*****************************************************************************/
5762 +typedef struct entry_s {
5765 + struct entry_s *next;
5768 +/**************************************************************************//**
5769 + * Hashtable structure
5770 + *****************************************************************************/
5772 +typedef struct hashtable_s {
5774 + struct entry_s **table;
5777 +/**************************************************************************//**
5778 + * Hashtable initialization.
5780 + * Initialize the list supplied to be empty.
5782 + * @param size Size of hashtable
5784 + * @returns Hashtable pointer
5785 +******************************************************************************/
5786 +/* Create a new hashtable. */
5787 +HASHTABLE_T *ht_create( size_t size );
5789 +/**************************************************************************//**
5790 + * Hash a string for a particular hash table.
5792 + * Initialize the list supplied to be empty.
5794 + * @param hashtable Pointer to the hashtable
5795 + * @param key String
5797 + * @returns hashvalue
5798 +******************************************************************************/
5799 +size_t ht_hash( HASHTABLE_T *hashtable, char *key );
5801 +/**************************************************************************//**
5802 + * Create a key-value pair.
5804 + * @param key key string
5805 + * @param value value string
5807 + * @returns hashtable entry
5808 +******************************************************************************/
5809 +ENTRY_T *ht_newpair( char *key, void *value );
5811 +/**************************************************************************//**
5812 + * Insert a key-value pair into a hash table.
5814 + * @param key key string
5815 + * @param value value string
5817 + * @returns Nothing
5818 +******************************************************************************/
5819 +void ht_set( HASHTABLE_T *hashtable, char *key, void *value );
5821 +/**************************************************************************//**
5822 + * Retrieve a key-value pair from a hash table.
5824 + * @param key key string
5826 + * @returns value string
5827 +******************************************************************************/
5828 +void *ht_get( HASHTABLE_T *hashtable, char *key );
5831 diff --git a/src/plugins/ves/include/jsmn.h b/src/plugins/ves/include/jsmn.h
5832 new file mode 100644
5833 index 0000000..4ae6d9b
5835 +++ b/src/plugins/ves/include/jsmn.h
5837 +/*************************************************************************//**
5839 + * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
5841 + * Licensed under the Apache License, Version 2.0 (the "License");
5842 + * you may not use this file except in compliance with the License.
5843 + * You may obtain a copy of the License at
5844 + * http://www.apache.org/licenses/LICENSE-2.0
5846 + * Unless required by applicable law or agreed to in writing, software
5847 + * distributed under the License is distributed on an "AS IS" BASIS,
5848 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5849 + * See the License for the specific language governing permissions and
5850 + * limitations under the License.
5852 + ****************************************************************************/
5857 +#include <stddef.h>
5864 + * JSON type identifier. Basic types are:
5868 + * o Other primitive: number, boolean (true/false) or null
5871 + JSMN_UNDEFINED = 0,
5875 + JSMN_PRIMITIVE = 4
5879 + /* Not enough tokens were provided */
5880 + JSMN_ERROR_NOMEM = -1,
5881 + /* Invalid character inside JSON string */
5882 + JSMN_ERROR_INVAL = -2,
5883 + /* The string is not a full JSON packet, more bytes expected */
5884 + JSMN_ERROR_PART = -3
5888 + * JSON token description.
5889 + * @param type type (object, array, string etc.)
5890 + * @param start start position in JSON data string
5891 + * @param end end position in JSON data string
5898 +#ifdef JSMN_PARENT_LINKS
5904 + * JSON parser. Contains an array of token blocks available. Also stores
5905 + * the string being parsed now and current position in that string
5908 + unsigned int pos; /* offset in the JSON string */
5909 + unsigned int toknext; /* next token to allocate */
5910 + int toksuper; /* superior token node, e.g parent object or array */
5914 + * Create JSON parser over an array of tokens
5916 +void jsmn_init(jsmn_parser *parser);
5919 + * Run JSON parser. It parses a JSON data string into and array of tokens, each describing
5920 + * a single JSON object.
5922 +int jsmn_parse(jsmn_parser *parser, const char *js, size_t len,
5923 + jsmntok_t *tokens, unsigned int num_tokens);
5929 +#endif /* __JSMN_H_ */
5930 diff --git a/src/plugins/ves/include/metadata.h b/src/plugins/ves/include/metadata.h
5931 new file mode 100644
5932 index 0000000..1ee4409
5934 +++ b/src/plugins/ves/include/metadata.h
5936 +#ifndef METADATA_INCLUDED
5937 +#define METADATA_INCLUDED
5938 +/*************************************************************************//**
5940 + * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
5942 + * Licensed under the Apache License, Version 2.0 (the "License");
5943 + * you may not use this file except in compliance with the License.
5944 + * You may obtain a copy of the License at
5945 + * http://www.apache.org/licenses/LICENSE-2.0
5947 + * Unless required by applicable law or agreed to in writing, software
5948 + * distributed under the License is distributed on an "AS IS" BASIS,
5949 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5950 + * See the License for the specific language governing permissions and
5951 + * limitations under the License.
5953 + ****************************************************************************/
5955 +/**************************************************************************//**
5957 + * Wrap the OpenStack metadata service.
5959 + ****************************************************************************/
5963 +/**************************************************************************//**
5964 + * Download metadata from the OpenStack metadata service.
5966 + * @param verbosity Controls whether to generate debug to stdout. Zero:
5967 + * none. Non-zero: generate debug.
5968 + * @returns Status code
5969 + * @retval EVEL_SUCCESS On success
5970 + * @retval ::EVEL_ERR_CODES On failure.
5971 + *****************************************************************************/
5972 +EVEL_ERR_CODES openstack_metadata(int verbosity);
5974 +/**************************************************************************//**
5975 + * Initialize default values for vm_name and vm_uuid - for testing purposes.
5976 + *****************************************************************************/
5977 +void openstack_metadata_initialize();
5979 +/**************************************************************************//**
5980 + * Get the VM name provided by the metadata service.
5982 + * @returns VM name
5983 + *****************************************************************************/
5984 +const char *openstack_vm_name();
5986 +/**************************************************************************//**
5987 + * Get the VM UUID provided by the metadata service.
5989 + * @returns VM UUID
5990 + *****************************************************************************/
5991 +const char *openstack_vm_uuid();
5994 diff --git a/src/plugins/ves/include/ring_buffer.h b/src/plugins/ves/include/ring_buffer.h
5995 new file mode 100644
5996 index 0000000..1236b78
5998 +++ b/src/plugins/ves/include/ring_buffer.h
6000 +/*************************************************************************//**
6002 + * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6004 + * Licensed under the Apache License, Version 2.0 (the "License");
6005 + * you may not use this file except in compliance with the License.
6006 + * You may obtain a copy of the License at
6007 + * http://www.apache.org/licenses/LICENSE-2.0
6009 + * Unless required by applicable law or agreed to in writing, software
6010 + * distributed under the License is distributed on an "AS IS" BASIS,
6011 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6012 + * See the License for the specific language governing permissions and
6013 + * limitations under the License.
6015 + ****************************************************************************/
6017 +#ifndef RING_BUFFER_INCLUDED
6018 +#define RING_BUFFER_INCLUDED
6020 +/**************************************************************************//**
6022 + * Ring buffer to handle message requests.
6024 + ****************************************************************************/
6026 +#include <pthread.h>
6028 +/**************************************************************************//**
6029 + * Ring buffer structure.
6030 + *****************************************************************************/
6031 +typedef struct ring_buffer
6037 + pthread_cond_t ring_cv;
6038 + pthread_mutex_t ring_mutex;
6041 +/**************************************************************************//**
6042 + * Ring buffer initialization.
6044 + * Initialize the buffer supplied to the specified size.
6046 + * @param buffer Pointer to the ring-buffer to be initialized.
6047 + * @param size How many elements to be stored in the ring-buffer.
6049 + * @returns Nothing
6050 +******************************************************************************/
6051 +void ring_buffer_initialize(ring_buffer * buffer, int size);
6053 +/**************************************************************************//**
6054 + * Read an element from a ring_buffer.
6056 + * Reads an element from the ring_buffer, advancing the next-read position.
6057 + * Operation is synchronized and therefore MT-safe. Blocks if no data is
6060 + * @param buffer Pointer to the ring-buffer to be read.
6062 + * @returns Pointer to the element read from the buffer.
6063 +******************************************************************************/
6064 +void * ring_buffer_read(ring_buffer * buffer);
6066 +/**************************************************************************//**
6067 + * Write an element into a ring_buffer.
6069 + * Writes an element into the ring_buffer, advancing the next-write position.
6070 + * Operation is synchronized and therefore MT-safe. Fails if the buffer is
6071 + * full without blocking.
6073 + * @param buffer Pointer to the ring-buffer to be written.
6074 + * @param msg Pointer to data to be stored in the ring_buffer.
6076 + * @returns Number of items written.
6077 + * @retval 1 The data was written successfully.
6078 + * @retval 0 The ring_buffer was full so no data written.
6079 +******************************************************************************/
6080 +int ring_buffer_write(ring_buffer * buffer, void * msg);
6082 +/**************************************************************************//**
6083 + * Tests whether there is data in the ring_buffer.
6085 + * Tests whether there is currently data in the ring_buffer without blocking.
6087 + * @param buffer Pointer to the ring-buffer to be tested.
6089 + * @returns Whether there is data in the ring_buffer.
6090 + * @retval 0 There isn't any data in the ring_buffer.
6091 + * @retval 1 There is data in the ring_buffer.
6092 +******************************************************************************/
6093 +int ring_buffer_is_empty(ring_buffer * buffer);
6096 diff --git a/src/plugins/ves/ves.api b/src/plugins/ves/ves.api
6097 new file mode 100644
6098 index 0000000..bae2620
6100 +++ b/src/plugins/ves/ves.api
6103 + * Copyright (c) 2017 Intel and/or its affiliates.
6104 + * Licensed under the Apache License, Version 2.0 (the "License");
6105 + * you may not use this file except in compliance with the License.
6106 + * You may obtain a copy of the License at:
6108 + * http://www.apache.org/licenses/LICENSE-2.0
6110 + * Unless required by applicable law or agreed to in writing, software
6111 + * distributed under the License is distributed on an "AS IS" BASIS,
6112 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6113 + * See the License for the specific language governing permissions and
6114 + * limitations under the License.
6117 +/** \brief VES Agent config add / del request
6118 + @param client_index - opaque cookie to identify the sender
6119 + @param context - sender context, to match reply w/ request
6120 + @param server_port - VES Server port
6121 + @param read_interval - Time period for each loop
6122 + @param is_add - add the config if non-zero, else delete
6123 + @param server_addr[] - server address
6125 +define ves_agent_config
6130 + u32 read_interval;
6132 + u8 server_addr[16];
6135 +/** \brief VES Agent config response
6136 + @param context - sender context, to match reply w/ request
6137 + @param retval - return code for the request
6139 +define ves_agent_config_reply
6145 +/** \brief VES Agent mode set request
6146 + @param client_index - opaque cookie to identify the sender
6147 + @param context - sender context, to match reply w/ request
6148 + @param pkt_loss_rate - Base packet loss rate if Demo Mode
6149 + @param work_mode[] - Agent's work mode, real or demo
6150 + @param source_name[] - Agent's source name
6152 +define ves_agent_mode
6156 + u32 pkt_loss_rate;
6158 + u8 source_name[129];
6161 +/** \brief VES Agent Mode response
6162 + @param context - sender context, to match reply w/ request
6163 + @param retval - return code for the request
6165 +define ves_agent_mode_reply
6172 + * Local Variables:
6173 + * eval: (c-set-style "gnu")
6176 diff --git a/src/plugins/ves/ves_all_api_h.h b/src/plugins/ves/ves_all_api_h.h
6177 new file mode 100644
6178 index 0000000..72b1569
6180 +++ b/src/plugins/ves/ves_all_api_h.h
6183 + * ves_all_api_h.h - skeleton vpp engine plug-in api #include file
6185 + * Copyright (c) 2017 Intel and/or its affiliates.
6186 + * Licensed under the Apache License, Version 2.0 (the "License");
6187 + * you may not use this file except in compliance with the License.
6188 + * You may obtain a copy of the License at:
6190 + * http://www.apache.org/licenses/LICENSE-2.0
6192 + * Unless required by applicable law or agreed to in writing, software
6193 + * distributed under the License is distributed on an "AS IS" BASIS,
6194 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6195 + * See the License for the specific language governing permissions and
6196 + * limitations under the License.
6199 +#include <ves/ves.api.h>
6200 diff --git a/src/plugins/ves/ves_api.c b/src/plugins/ves/ves_api.c
6201 new file mode 100644
6202 index 0000000..06f0a96
6204 +++ b/src/plugins/ves/ves_api.c
6207 + *------------------------------------------------------------------
6208 + * ves_api.c - ves api
6210 + * Copyright (c) 2017 Intel and/or its affiliates.
6211 + * Licensed under the Apache License, Version 2.0 (the "License");
6212 + * you may not use this file except in compliance with the License.
6213 + * You may obtain a copy of the License at:
6215 + * http://www.apache.org/licenses/LICENSE-2.0
6217 + * Unless required by applicable law or agreed to in writing, software
6218 + * distributed under the License is distributed on an "AS IS" BASIS,
6219 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6220 + * See the License for the specific language governing permissions and
6221 + * limitations under the License.
6222 + *------------------------------------------------------------------
6225 +#include <vnet/vnet.h>
6226 +#include <vlibmemory/api.h>
6228 +#include <vnet/interface.h>
6229 +#include <vnet/api_errno.h>
6230 +#include <vnet/ip/ip.h>
6231 +#include <vnet/ip/ip4.h>
6233 +#include <ves/ves_node.h>
6235 +#include <ves/ves_msg_enum.h> /* define message IDs */
6237 +#define vl_typedefs /* define message structures */
6238 +#include <ves/ves_all_api_h.h>
6241 +#define vl_endianfun /* define message structures */
6242 +#include <ves/ves_all_api_h.h>
6243 +#undef vl_endianfun
6245 +/* instantiate all the print functions we know about */
6246 +#define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
6248 +#define vl_printfun
6249 +#include <ves/ves_all_api_h.h>
6253 +#include <vlibapi/api_helper_macros.h>
6255 +#define foreach_vpe_api_msg \
6256 +_(VES_AGENT_CONFIG,ves_agent_config) \
6257 +_(VES_AGENT_MODE,ves_agent_mode)
6259 +static void vl_api_ves_agent_config_t_handler
6260 + (vl_api_ves_agent_config_t *mp)
6262 + vl_api_ves_agent_config_reply_t *rmp;
6263 + ip46_address_t server;
6266 + ip46_address_reset (&server);
6267 + clib_memcpy (&server.ip4, mp->server_addr, sizeof (server.ip4));
6269 + rv = ves_set_server(&server,
6270 + (u32) ntohl (mp->server_port),
6271 + (u32) ntohl (mp->read_interval),
6272 + (int) (mp->is_add == 0));
6274 + REPLY_MACRO (VL_API_VES_AGENT_CONFIG_REPLY);
6277 +static void vl_api_ves_agent_mode_t_handler
6278 + (vl_api_ves_agent_mode_t *mp)
6280 + vl_api_ves_agent_mode_reply_t *rmp;
6281 + ves_agent_mode_t mode = VES_AGENT_MODE_REAL;
6284 + if (!strcmp((char *)mp->work_mode, "demo")
6285 + || !strcmp((char *)mp->work_mode, "Demo")
6286 + || !strcmp((char *)mp->work_mode, "DEMO"))
6287 + mode = VES_AGENT_MODE_DEMO;
6289 + rv = ves_agent_set_mode(mode, (u32) ntohl(mp->pkt_loss_rate), (char *) mp->source_name);
6291 + REPLY_MACRO (VL_API_VES_AGENT_MODE_REPLY);
6296 + * Add vpe's API message handlers to the table.
6297 + * vlib has alread mapped shared memory and
6298 + * added the client registration handlers.
6299 + * See .../vlib-api/vlibmemory/memclnt_vlib.c:memclnt_process()
6301 +#define vl_msg_name_crc_list
6302 +#include <ves/ves_all_api_h.h>
6303 +#undef vl_msg_name_crc_list
6306 +setup_message_id_table (api_main_t * am)
6308 +#define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
6309 + foreach_vl_msg_name_crc_ves;
6313 +static clib_error_t *
6314 +ves_api_hookup (vlib_main_t * vm)
6316 + api_main_t *am = &api_main;
6319 + vl_msg_api_set_handlers(VL_API_##N, #n, \
6320 + vl_api_##n##_t_handler, \
6321 + vl_noop_handler, \
6322 + vl_api_##n##_t_endian, \
6323 + vl_api_##n##_t_print, \
6324 + sizeof(vl_api_##n##_t), 1);
6325 + foreach_vpe_api_msg;
6329 + * Set up the (msg_name, crc, message-id) table
6331 + setup_message_id_table (am);
6336 +VLIB_API_INIT_FUNCTION (ves_api_hookup);
6339 + * fd.io coding-style-patch-verification: ON
6341 + * Local Variables:
6342 + * eval: (c-set-style "gnu")
6345 diff --git a/src/plugins/ves/ves_msg_enum.h b/src/plugins/ves/ves_msg_enum.h
6346 new file mode 100644
6347 index 0000000..6e8a5df
6349 +++ b/src/plugins/ves/ves_msg_enum.h
6352 + * ves_msg_enum.h - vpp engine plug-in message enumeration
6354 + * Copyright (c) 2017 Intel and/or its affiliates.
6355 + * Licensed under the Apache License, Version 2.0 (the "License");
6356 + * you may not use this file except in compliance with the License.
6357 + * You may obtain a copy of the License at:
6359 + * http://www.apache.org/licenses/LICENSE-2.0
6361 + * Unless required by applicable law or agreed to in writing, software
6362 + * distributed under the License is distributed on an "AS IS" BASIS,
6363 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6364 + * See the License for the specific language governing permissions and
6365 + * limitations under the License.
6367 +#ifndef _VES_MSG_ENUM_H_
6368 +#define _VES_MSG_ENUM_H_
6370 +#include <vppinfra/byte_order.h>
6372 +#define vl_msg_id(n,h) n,
6375 +#include <ves/ves_all_api_h.h>
6376 + /* We'll want to know how many messages IDs we need... */
6377 + VL_MSG_FIRST_AVAILABLE,
6381 +#endif /* _VES_MSG_ENUM_H_ */
6382 diff --git a/src/plugins/ves/ves_node.c b/src/plugins/ves/ves_node.c
6383 new file mode 100644
6384 index 0000000..49d7e87
6386 +++ b/src/plugins/ves/ves_node.c
6389 + * Copyright (c) 2017 Intel and/or its affiliates.
6390 + * Licensed under the Apache License, Version 2.0 (the "License");
6391 + * you may not use this file except in compliance with the License.
6392 + * You may obtain a copy of the License at:
6394 + * http://www.apache.org/licenses/LICENSE-2.0
6396 + * Unless required by applicable law or agreed to in writing, software
6397 + * distributed under the License is distributed on an "AS IS" BASIS,
6398 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6399 + * See the License for the specific language governing permissions and
6400 + * limitations under the License.
6404 +#include <stdlib.h>
6405 +#include <unistd.h>
6406 +#include <string.h>
6407 +#include <sys/time.h>
6409 +#include <vnet/plugin/plugin.h>
6410 +#include <vpp/app/version.h>
6412 +#include "ves_node.h"
6414 +#define BUFSIZE 128
6416 +typedef struct dummy_vpp_metrics_struct {
6421 +} vpp_metrics_struct;
6423 +static vlib_node_registration_t ves_agent_process_node;
6424 +vpp_metrics_struct *last_vpp_metrics;
6425 +vpp_metrics_struct *curr_vpp_metrics;
6426 +time_t start_epoch;
6428 +char hostname[BUFSIZE];
6430 +static u8 *format_ves_agent_config(u8 *s, va_list *args);
6432 +void read_vpp_metrics(vpp_metrics_struct *vpp_metrics, char *vnic) {
6433 + // Define an array of char that contains the parameters of the unix 'cut' command
6434 + char* params[] = {"-f3", "-f11", "-f4", "-f12"};
6435 + // Define the unix command to execute in order to read metrics from the vNIC
6436 + char* cmd_prefix = "sudo cat /proc/net/dev | grep \"";
6437 + char* cmd_mid = "\" | tr -s \' \' | cut -d\' \' ";
6438 + char cmd[BUFSIZE];
6439 + // Define other variables
6440 + char buf[BUFSIZE]; /* buffer used to store VPP metrics */
6441 + int temp[] = {0, 0, 0, 0}; /* temp array that contains VPP values */
6442 + FILE *fp; /* file descriptor to pipe cmd to shell */
6445 + for(i = 0; i < 4; i++) {
6447 + memset(buf, 0, BUFSIZE);
6448 + memset(cmd, 0, BUFSIZE);
6449 + // Build shell command to read metrics from the vNIC
6450 + strcat(cmd, cmd_prefix);
6451 + strcat(cmd, vnic);
6452 + strcat(cmd, cmd_mid);
6453 + strcat(cmd, params[i]);
6455 + // Open a pipe and read VPP values
6456 + if ((fp = popen(cmd, "r")) == NULL) {
6457 + printf("Error opening pipe!\n");
6461 + while (fgets(buf, BUFSIZE, fp) != NULL);
6462 + temp[i] = atoi(buf);
6465 + printf("Command not found or exited with error status\n");
6470 + // Store metrics read from the vNIC in the struct passed from the main function
6471 + vpp_metrics->bytes_in = temp[0];
6472 + vpp_metrics->bytes_out = temp[1];
6473 + vpp_metrics->packets_in = temp[2];
6474 + vpp_metrics->packets_out = temp[3];
6477 +/**************************************************************************//**
6478 + * tap live cpu stats
6479 + *****************************************************************************/
6480 +void evel_get_cpu_stats(EVENT_MEASUREMENT * measurement)
6493 + MEASUREMENT_CPU_USE *cpu_use = NULL;
6495 + /* Open the command for reading. */
6496 + //fp = popen("/bin/ls /etc/", "r");
6497 + fp = popen("/usr/bin/top -bn 2 -d 0.01 | grep '^%Cpu' | tail -n 1 ", "r");
6499 + printf("Failed to run command\n" );
6503 + /* Read the output a line at a time - output it. */
6504 + while (fgets(path, sizeof(path)-1, fp) != NULL) {
6505 + printf("%s", path+10);
6506 + sscanf(path+10," %lf us, %lf sy, %lf ni, %lf id, %lf wa, %lf hi, %lf si, %lf st",
6507 + &user,&sys,&nice,&idle,&wait,&intrpt,&softirq,&steal);
6513 + cpu_use = evel_measurement_new_cpu_use_add(measurement, "cpu1", usage);
6514 + if( cpu_use != NULL ){
6515 + evel_measurement_cpu_use_idle_set(cpu_use,idle);
6516 + //evel_measurement_cpu_use_interrupt_set(cpu_use,intrpt);
6517 + //evel_measurement_cpu_use_nice_set(cpu_use,nice);
6518 + //evel_measurement_cpu_use_softirq_set(cpu_use,softirq);
6519 + //evel_measurement_cpu_use_steal_set(cpu_use,steal);
6520 + evel_measurement_cpu_use_system_set(cpu_use,sys);
6521 + evel_measurement_cpu_use_usageuser_set(cpu_use,user);
6522 + //evel_measurement_cpu_use_wait_set(cpu_use,wait);
6523 + //evel_measurement_cpu_use_add(measurement, "cpu2", usage,idle,intrpt,nice,softirq,steal,sys,user,wait);
6528 +ves_agent_report_vnic_stats(ves_agent_main_t *vam)
6530 + EVEL_ERR_CODES evel_rc = EVEL_SUCCESS;
6531 + EVENT_MEASUREMENT* vpp_m = NULL;
6532 + EVENT_HEADER* vpp_m_header = NULL;
6533 + int bytes_in_this_round;
6534 + int bytes_out_this_round;
6535 + int packets_in_this_round;
6536 + int packets_out_this_round;
6537 + struct timeval time_val;
6539 + /* Is not enabled, do nothing */
6540 + if (vam->config.is_enabled == VES_AGENT_DISABLED) {
6544 + memset(curr_vpp_metrics, 0, sizeof(vpp_metrics_struct));
6545 + read_vpp_metrics(curr_vpp_metrics, DEFAULT_MEASURE_ETH);
6547 + if(curr_vpp_metrics->bytes_in - last_vpp_metrics->bytes_in > 0) {
6548 + bytes_in_this_round = curr_vpp_metrics->bytes_in - last_vpp_metrics->bytes_in;
6550 + bytes_in_this_round = 0;
6553 + if(curr_vpp_metrics->bytes_out - last_vpp_metrics->bytes_out > 0) {
6554 + bytes_out_this_round = curr_vpp_metrics->bytes_out - last_vpp_metrics->bytes_out;
6556 + bytes_out_this_round = 0;
6559 + if(curr_vpp_metrics->packets_in - last_vpp_metrics->packets_in > 0) {
6560 + packets_in_this_round = curr_vpp_metrics->packets_in - last_vpp_metrics->packets_in;
6562 + packets_in_this_round = 0;
6565 + if(curr_vpp_metrics->packets_out - last_vpp_metrics->packets_out > 0) {
6566 + packets_out_this_round = curr_vpp_metrics->packets_out - last_vpp_metrics->packets_out;
6568 + packets_out_this_round = 0;
6571 + vpp_m = evel_new_measurement(vam->config.read_interval, "Measurement_vGMUX", "Generic_traffic", (char *) vam->config.source_name);
6572 + if(vpp_m != NULL) {
6573 + char str_pkt_loss[12];
6574 + MEASUREMENT_VNIC_PERFORMANCE * vnic_performance = NULL;
6576 + printf("New measurement report created...\n");
6578 + vnic_performance = (MEASUREMENT_VNIC_PERFORMANCE *)evel_measurement_new_vnic_performance(
6579 + DEFAULT_MEASURE_ETH, "true");
6580 + evel_meas_vnic_performance_add(vpp_m, vnic_performance);
6581 + evel_measurement_type_set(vpp_m, "HTTP request rate");
6582 + evel_measurement_request_rate_set(vpp_m, rand()%10000);
6584 + evel_vnic_performance_rx_total_pkt_delta_set(vnic_performance, packets_in_this_round);
6585 + evel_vnic_performance_tx_total_pkt_delta_set(vnic_performance, packets_out_this_round);
6587 + evel_vnic_performance_rx_octets_delta_set(vnic_performance, bytes_in_this_round);
6588 + evel_vnic_performance_tx_octets_delta_set(vnic_performance, bytes_out_this_round);
6589 + evel_get_cpu_stats(vpp_m);
6592 + evel_measurement_vnic_use_add(vpp_m, /* Pointer to the measurement */
6593 + DEFAULT_MEASURE_ETH, /* ASCII string with the vNIC's ID */
6594 + packets_in_this_round, /* Packets received */
6595 + packets_out_this_round, /* Packets transmitted */
6596 + 0, /* Broadcast packets received */
6597 + 0, /* Broadcast packets transmitted */
6598 + bytes_in_this_round, /* Total bytes received */
6599 + bytes_out_this_round, /* Total bytes transmitted */
6600 + 0, /* Multicast packets received */
6601 + 0, /* Multicast packets transmitted */
6602 + 0, /* Unicast packets received */
6603 + 0); /* Unicast packets transmitted */
6606 + sprintf(str_pkt_loss, "%.1f", (double) vam->config.base_pkt_loss);
6607 + evel_measurement_custom_measurement_add(vpp_m, /* Pointer to the measurement */
6608 + "ONAP-DCAE", /* measurement group's name */
6609 + "Packet-Loss-Rate", /* the measurement's name */
6610 + str_pkt_loss); /* The measurement's value */
6612 + last_epoch = start_epoch + vam->config.read_interval * 1000000;
6613 + vpp_m_header = (EVENT_HEADER *)vpp_m;
6614 + vpp_m_header->start_epoch_microsec = start_epoch;
6615 + vpp_m_header->last_epoch_microsec = last_epoch;
6616 + strcpy(vpp_m_header->reporting_entity_id.value, "No UUID available");
6617 + strcpy(vpp_m_header->reporting_entity_name, hostname);
6619 + evel_rc = evel_post_event(vpp_m_header);
6620 + if(evel_rc == EVEL_SUCCESS) {
6621 + printf("Measurement report correctly sent to the collector!\n");
6624 + printf("Post failed %d (%s)\n", evel_rc, evel_error_string());
6628 + printf("New measurement report failed (%s)\n", evel_error_string());
6631 + last_vpp_metrics->bytes_in = curr_vpp_metrics->bytes_in;
6632 + last_vpp_metrics->bytes_out = curr_vpp_metrics->bytes_out;
6633 + last_vpp_metrics->packets_in = curr_vpp_metrics->packets_in;
6634 + last_vpp_metrics->packets_out = curr_vpp_metrics->packets_out;
6635 + gettimeofday(&time_val, NULL);
6636 + start_epoch = time_val.tv_sec * 1000000 + time_val.tv_usec;
6642 +ves_agent_start(ves_agent_main_t *vam)
6644 + vlib_main_t *vm = vam->vlib_main;
6645 + struct timeval time_val;
6646 + char fqdn[16]; /* "xxx.xxx.xxx.xxx" */
6647 + //char *fqdn = "127.0.0.1"; /* "xxx.xxx.xxx.xxx" */
6649 + sprintf(fqdn, "%d.%d.%d.%d", vam->config.server_addr.data[0],
6650 + vam->config.server_addr.data[1],
6651 + vam->config.server_addr.data[2],
6652 + vam->config.server_addr.data[3]);
6653 + /* Always success. TODO: Error check in next version */
6654 + last_vpp_metrics = malloc(sizeof(vpp_metrics_struct));
6655 + curr_vpp_metrics = malloc(sizeof(vpp_metrics_struct));
6657 + if(evel_initialize(fqdn, /* FQDN */
6658 + vam->config.server_port, /* Port */
6659 + NULL, /* optional path */
6660 + NULL, /* optional topic */
6662 + "", /* Username */
6663 + "", /* Password */
6664 + EVEL_SOURCE_VIRTUAL_MACHINE, /* Source type */
6665 + "vG-MUX", /* Role */
6666 + 1)) /* Verbosity */
6668 + fprintf(stderr, "\nFailed to initialize the EVEL library!!!\n");
6672 + gethostname(hostname, BUFSIZE);
6673 + memset(last_vpp_metrics, 0, sizeof(vpp_metrics_struct));
6674 + read_vpp_metrics(last_vpp_metrics, DEFAULT_MEASURE_ETH);
6675 + gettimeofday(&time_val, NULL);
6676 + start_epoch = time_val.tv_sec * 1000000 + time_val.tv_usec;
6678 + vlib_process_wait_for_event_or_clock(vm, (f64)(vam->config.read_interval));
6684 +ves_agent_stop(void)
6687 + free(last_vpp_metrics);
6688 + free(curr_vpp_metrics);
6695 +VLIB_PLUGIN_REGISTER () = {
6696 + .version = VPP_BUILD_VER,
6697 + .description = "VNF Event Stream Agent",
6702 +ves_agent_process (vlib_main_t * vm,
6703 + vlib_node_runtime_t * rt,
6706 + ves_agent_main_t *vam = &ves_agent_main;
6708 + uword * event_data = 0;
6710 + if (vam->config.read_interval == 0) {
6711 + vam->config.read_interval = DEFAULT_READ_INTERVAL;
6716 + vlib_process_wait_for_event_or_clock(vm, (f64)(vam->config.read_interval));
6718 + event_type = vlib_process_get_events (vm, &event_data);
6720 + switch (event_type)
6722 + case EVENT_VES_AGENT_START:
6723 + ves_agent_start(vam);
6725 + case EVENT_VES_AGENT_STOP:
6729 + ves_agent_report_vnic_stats(vam);
6733 + vec_reset_length (event_data);
6740 +VLIB_REGISTER_NODE (ves_agent_process_node, static) = {
6741 + .function = ves_agent_process,
6742 + .type = VLIB_NODE_TYPE_PROCESS,
6743 + .name = "ves-agent-process",
6744 + .process_log2_n_stack_bytes = 16,
6748 +ves_set_server (ip46_address_t *addr,
6750 + u32 read_interval,
6753 + ves_agent_main_t *vam = &ves_agent_main;
6754 + vlib_main_t *vm = vam->vlib_main;
6757 + if (ip46_address_is_zero(addr))
6758 + return VNET_API_ERROR_INVALID_DST_ADDRESS;
6762 + if (vam->config.is_enabled == VES_AGENT_DISABLED) {
6766 + if ((vam->config.server_addr.as_u32 != addr->ip4.as_u32)
6767 + || (vam->config.server_port != server_port))
6768 + return VNET_API_ERROR_NO_SUCH_ENTRY;
6770 + memset(&(vam->config.server_addr), 0, sizeof(ip4_address_t));
6771 + vam->config.server_port = DEFAULT_SERVER_PORT;
6772 + vam->config.read_interval = DEFAULT_READ_INTERVAL;
6773 + vam->config.is_enabled = VES_AGENT_DISABLED;
6774 + vlib_process_signal_event (vm, ves_agent_process_node.index,
6775 + EVENT_VES_AGENT_STOP, 0);
6777 + // Already enabled the same config.
6778 + if ((vam->config.server_addr.as_u32 == addr->ip4.as_u32)
6779 + && (vam->config.server_port != server_port)
6780 + && vam->config.read_interval == read_interval
6781 + && vam->config.is_enabled == VES_AGENT_ENABLED) {
6785 + // Already enabled, but not exact match.
6786 + if (vam->config.is_enabled == VES_AGENT_ENABLED) {
6787 + return VNET_API_ERROR_VALUE_EXIST;
6790 + vam->config.server_addr.as_u32 = addr->ip4.as_u32;
6791 + vam->config.server_port = server_port;
6792 + if (read_interval) {
6793 + vam->config.read_interval = read_interval;
6795 + vam->config.read_interval = DEFAULT_READ_INTERVAL;
6797 + vam->config.is_enabled = VES_AGENT_ENABLED;
6798 + vlib_process_signal_event (vm, ves_agent_process_node.index,
6799 + EVENT_VES_AGENT_START, 0);
6806 +format_ves_agent_set_error(u8 *s, va_list *args)
6808 + s = format(s, "%s\n\n", "Caution, set fails due to enabled config:");
6809 + s = format(s, "%U", format_ves_agent_config, NULL);
6813 +static clib_error_t *
6814 +ves_server_set_command_fn(vlib_main_t * vm,
6815 + unformat_input_t * input,
6816 + vlib_cli_command_t * cmd)
6818 + ip46_address_t server_addr;
6819 + u32 server_port = DEFAULT_SERVER_PORT, inter_val = DEFAULT_READ_INTERVAL;
6820 + int is_del = 0, set_server = 0;
6822 + memset(&server_addr, 0, sizeof(server_addr));
6824 + while (unformat_check_input(input) != UNFORMAT_END_OF_INPUT)
6826 + if (unformat (input, "server %U",
6827 + unformat_ip4_address, &server_addr.ip4))
6829 + else if (unformat (input, "port %u", &server_port))
6831 + else if (unformat (input, "intval %u", &inter_val))
6833 + else if (unformat (input, "delete") ||
6834 + unformat (input, "del"))
6840 + if (is_del || set_server)
6844 + rv = ves_set_server (&server_addr, server_port, inter_val, is_del);
6850 + case VNET_API_ERROR_INVALID_DST_ADDRESS:
6851 + return clib_error_return (0, "Invalid address");
6853 + case VNET_API_ERROR_NO_SUCH_ENTRY:
6854 + return clib_error_return(0, "No such Entry found");
6856 + case VNET_API_ERROR_VALUE_EXIST:
6857 + vlib_cli_output (vm, "%U\n", format_ves_agent_set_error, NULL);
6858 + return clib_error_return (0, "BUG found!");
6861 + return clib_error_return (0, "BUG: rv %d", rv);
6864 + return clib_error_return (0, "parse error`%U'",
6865 + format_unformat_error, input);
6869 +VLIB_CLI_COMMAND (ves_server_set_command, static) = {
6870 + .path = "set ves agent",
6871 + .short_help = "set ves agent [del] server <ipaddr> port <port> [intval <inter-value>]",
6872 + .function = ves_server_set_command_fn,
6876 +format_ves_agent_config(u8 *s, va_list *args)
6878 + ves_agent_main_t *vam = &ves_agent_main;
6879 + char fqdn[16]; /* "xxx.xxx.xxx.xxx" */
6881 + s = format(s, "%=16s %=12s %=8s %s\n", "Server Addr",
6882 + "Server Port", "Interval", "Enabled");
6883 + if (vam->config.is_enabled == VES_AGENT_DISABLED) {
6887 + sprintf(fqdn, "%d.%d.%d.%d", vam->config.server_addr.data[0],
6888 + vam->config.server_addr.data[1],
6889 + vam->config.server_addr.data[2],
6890 + vam->config.server_addr.data[3]);
6892 + s = format(s, "%=16s %=12d %=8d %s\n", fqdn,
6893 + vam->config.server_port,
6894 + vam->config.read_interval,
6895 + vam->config.is_enabled ? "True" : "False");
6900 +static clib_error_t *
6901 +ves_server_show_command_fn(vlib_main_t * vm,
6902 + unformat_input_t * input,
6903 + vlib_cli_command_t * cmd)
6905 + vlib_cli_output (vm, "%U", format_ves_agent_config, NULL);
6910 +VLIB_CLI_COMMAND (ves_server_show_command, static) = {
6911 + .path = "show ves agent",
6912 + .short_help = "Display VES Agent Configuration",
6913 + .function = ves_server_show_command_fn,
6917 +ves_agent_set_mode(ves_agent_mode_t mode,
6918 + u32 pkt_loss_rate, char *source_name)
6920 + ves_agent_main_t *vam = &ves_agent_main;
6923 + if (source_name != NULL) {
6924 + strncpy((char *) vam->config.source_name, source_name, MAX_SRC_NAME_LEN);
6925 + vam->config.source_name[MAX_SRC_NAME_LEN] = '\0';
6927 + vam->config.source_name[0] = '\0';
6929 + if (VES_AGENT_MODE_DEMO == mode) {
6930 + if (pkt_loss_rate > 100) {
6931 + vam->config.mode = VES_AGENT_MODE_REAL;
6932 + vam->config.base_pkt_loss = 0;
6935 + vam->config.mode = VES_AGENT_MODE_DEMO;
6936 + vam->config.base_pkt_loss = pkt_loss_rate;
6937 + } else { /* Only demo or real for current stage */
6938 + vam->config.mode = VES_AGENT_MODE_REAL;
6939 + vam->config.base_pkt_loss = 0;
6945 +static clib_error_t *
6946 +ves_mode_set_command_fn(vlib_main_t * vm,
6947 + unformat_input_t * input,
6948 + vlib_cli_command_t * cmd)
6950 + u32 pkt_loss_rate = 0;
6951 + ves_agent_mode_t mode = VES_AGENT_MODE_REAL;
6953 + u8 *source_name = NULL;
6955 + while (unformat_check_input(input) != UNFORMAT_END_OF_INPUT)
6957 + if (unformat (input, "demo") || unformat (input, "Demo")
6958 + || unformat (input, "DEMO"))
6960 + mode = VES_AGENT_MODE_DEMO;
6963 + else if (unformat (input, "real") || unformat (input, "Real")
6964 + || unformat (input, "REAL"))
6966 + else if (unformat (input, "base %u", &pkt_loss_rate))
6968 + else if (unformat (input, "source %s", &source_name))
6976 + int retval = ves_agent_set_mode(mode, pkt_loss_rate, (char *)source_name);
6980 + return clib_error_return (0, "BUG found!");
6982 + return clib_error_return (0, "parse error`%U'",
6983 + format_unformat_error, input);
6987 +VLIB_CLI_COMMAND (ves_mode_set_command, static) = {
6988 + .path = "set ves mode",
6989 + .short_help = "set ves mode <demo|real> [base <pkt-loss-rate>] [source <name>]",
6990 + .function = ves_mode_set_command_fn,
6994 +format_ves_agent_mode(u8 *s, va_list *args)
6996 + ves_agent_main_t *vam = &ves_agent_main;
6998 + s = format(s, "%=8s %s %s\n", "Mode", "Base Packet Loss Rate", "Source Name");
7000 + s = format(s, "%=8s %20.1f%% %s\n",
7001 + vam->config.mode == VES_AGENT_MODE_DEMO ? "Demo" : "Real",
7002 + (double) vam->config.base_pkt_loss,
7003 + (strlen((char *)vam->config.source_name) > 0) ? (char *)vam->config.source_name : "[default]");
7008 +static clib_error_t *
7009 +ves_agent_mode_show_command_fn(vlib_main_t * vm,
7010 + unformat_input_t * input,
7011 + vlib_cli_command_t * cmd)
7013 + vlib_cli_output (vm, "%U", format_ves_agent_mode, NULL);
7018 +VLIB_CLI_COMMAND (ves_agent_mode_show_command, static) = {
7019 + .path = "show ves mode",
7020 + .short_help = "Display VES Agent Mode Information",
7021 + .function = ves_agent_mode_show_command_fn,
7024 +static clib_error_t *
7025 +ves_agent_init(vlib_main_t * vm)
7027 + ves_agent_main_t *vam = &ves_agent_main;
7029 + vam->vlib_main = vm;
7030 + vam->vnet_main = vnet_get_main();
7035 +VLIB_INIT_FUNCTION (ves_agent_init);
7038 + * fd.io coding-style-patch-verification: ON
7040 + * Local Variables:
7041 + * eval: (c-set-style "gnu")
7044 diff --git a/src/plugins/ves/ves_node.h b/src/plugins/ves/ves_node.h
7045 new file mode 100644
7046 index 0000000..9a57f34
7048 +++ b/src/plugins/ves/ves_node.h
7051 + * Copyright (c) 2017 Intel and/or its affiliates.
7052 + * Licensed under the Apache License, Version 2.0 (the "License");
7053 + * you may not use this file except in compliance with the License.
7054 + * You may obtain a copy of the License at:
7056 + * http://www.apache.org/licenses/LICENSE-2.0
7058 + * Unless required by applicable law or agreed to in writing, software
7059 + * distributed under the License is distributed on an "AS IS" BASIS,
7060 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7061 + * See the License for the specific language governing permissions and
7062 + * limitations under the License.
7065 +#ifndef _VES_NODE_H_
7066 +#define _VES_NODE_H_
7068 +#include <vnet/ip/ip.h>
7070 +#include "include/evel.h"
7072 +#define DEFAULT_SERVER_IP "127.0.0.1"
7073 +#define DEFAULT_MEASURE_ETH "eth0"
7074 +#define DEFAULT_SERVER_PORT 8080
7075 +#define DEFAULT_READ_INTERVAL 100
7076 +#define MAX_SRC_NAME_LEN 128
7079 + VES_AGENT_MODE_REAL = 0,
7080 + VES_AGENT_MODE_DEMO,
7081 + _NUM_VES_AGENT_MODES
7082 +} ves_agent_mode_t;
7084 +/* VES Agent Server configuration */
7086 + ip4_address_t server_addr;
7088 + u32 read_interval;
7090 + u32 base_pkt_loss; /* For demo only */
7091 + ves_agent_mode_t mode; /* Demo or Real */
7092 + u8 source_name[MAX_SRC_NAME_LEN+1];
7093 +} ves_agent_config_t;
7096 + ves_agent_config_t config;
7099 + vlib_main_t * vlib_main;
7100 + vnet_main_t * vnet_main;
7101 +} ves_agent_main_t;
7103 +ves_agent_main_t ves_agent_main;
7105 +#define EVENT_VES_AGENT_START 1
7106 +#define EVENT_VES_AGENT_STOP 0
7108 +#define VES_AGENT_DISABLED 0
7109 +#define VES_AGENT_ENABLED 1
7111 +int ves_set_server(ip46_address_t *addr, u32 server_port,
7112 + u32 read_interval, int is_del);
7114 +int ves_agent_set_mode(ves_agent_mode_t mode,
7115 + u32 pkt_loss_rate, char *source_name);
7117 +#endif /* _VES_NODE_H_ */
7118 diff --git a/src/vpp-api/java/Makefile.am b/src/vpp-api/java/Makefile.am
7119 index f18e0c2..7f4738d 100644
7120 --- a/src/vpp-api/java/Makefile.am
7121 +++ b/src/vpp-api/java/Makefile.am
7122 @@ -149,6 +149,26 @@ jvpp-snat/io_fd_vpp_jvpp_snat_JVppSnatImpl.h: $(jvpp_registry_ok) $(jvpp_snat_js
7128 +if ENABLE_VES_PLUGIN
7129 +noinst_LTLIBRARIES += libjvpp_ves.la
7130 +libjvpp_ves_la_SOURCES = jvpp-ves/jvpp_ves.c
7131 +libjvpp_ves_la_CPPFLAGS = -Ijvpp-ves
7132 +libjvpp_ves_la_LIBADD = $(JVPP_LIBS)
7133 +libjvpp_ves_la_DEPENDENCIES = libjvpp_common.la
7135 +BUILT_SOURCES += jvpp-ves/io_fd_vpp_jvpp_ves_JVppVesImpl.h
7136 +JAR_FILES += jvpp-ves-$(PACKAGE_VERSION).jar
7137 +CLEANDIRS += jvpp-ves/target
7139 +jvpp_ves_json_files = @top_builddir@/plugins/ves/ves.api.json
7141 +jvpp-ves/io_fd_vpp_jvpp_ves_JVppVesImpl.h: $(jvpp_registry_ok) $(jvpp_ves_json_files)
7142 + $(call japigen,ves,JVppVesImpl)
7148 if ENABLE_IOAM_PLUGIN
7149 diff --git a/src/vpp-api/java/jvpp-ves/jvpp_ves.c b/src/vpp-api/java/jvpp-ves/jvpp_ves.c
7150 new file mode 100644
7151 index 0000000..60e325b
7153 +++ b/src/vpp-api/java/jvpp-ves/jvpp_ves.c
7156 + * Copyright (c) 2017 Intel Corp and/or its affiliates.
7158 + * Licensed under the Apache License, Version 2.0 (the "License");
7159 + * you may not use this file except in compliance with the License.
7160 + * You may obtain a copy of the License at:
7162 + * http://www.apache.org/licenses/LICENSE-2.0
7164 + * Unless required by applicable law or agreed to in writing, software
7165 + * distributed under the License is distributed on an "AS IS" BASIS,
7166 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7167 + * See the License for the specific language governing permissions and
7168 + * limitations under the License.
7171 +#include <vnet/vnet.h>
7173 +#include <ves/ves_msg_enum.h>
7174 +#define vl_typedefs /* define message structures */
7175 +#include <ves/ves_all_api_h.h>
7178 +#include <vnet/api_errno.h>
7179 +#include <vlibapi/api.h>
7180 +#include <vlibmemory/api.h>
7182 +#if VPPJNI_DEBUG == 1
7183 + #define DEBUG_LOG(...) clib_warning(__VA_ARGS__)
7185 + #define DEBUG_LOG(...)
7188 +#include <jvpp-common/jvpp_common.h>
7190 +#include "jvpp-ves/io_fd_vpp_jvpp_ves_JVppVesImpl.h"
7191 +#include "jvpp_ves.h"
7192 +#include "jvpp-ves/jvpp_ves_gen.h"
7195 + * Class: io_fd_vpp_jvpp_ves_JVppVesImpl
7197 + * Signature: (JI)V
7199 +JNIEXPORT void JNICALL Java_io_fd_vpp_jvpp_ves_JVppVesImpl_init0
7200 + (JNIEnv *env, jclass clazz, jobject callback, jlong queue_address, jint my_client_index) {
7201 + ves_main_t * plugin_main = &ves_main;
7202 + clib_warning ("Java_io_fd_vpp_jvpp_ves_JVppVesImpl_init0");
7204 + plugin_main->my_client_index = my_client_index;
7205 + plugin_main->vl_input_queue = (unix_shared_memory_queue_t *)queue_address;
7207 + plugin_main->callbackObject = (*env)->NewGlobalRef(env, callback);
7208 + plugin_main->callbackClass = (jclass)(*env)->NewGlobalRef(env, (*env)->GetObjectClass(env, callback));
7210 + // verify API has not changed since jar generation
7212 + get_message_id(env, #N);
7213 + foreach_supported_api_message;
7217 + vl_msg_api_set_handlers(get_message_id(env, #N), #n, \
7218 + vl_api_##n##_t_handler, \
7219 + vl_noop_handler, \
7220 + vl_noop_handler, \
7221 + vl_noop_handler, \
7222 + sizeof(vl_api_##n##_t), 1);
7223 + foreach_api_reply_handler;
7227 +JNIEXPORT void JNICALL Java_io_fd_vpp_jvpp_ves_JVppVesImpl_close0
7228 +(JNIEnv *env, jclass clazz) {
7229 + ves_main_t * plugin_main = &ves_main;
7232 + (*env)->DeleteGlobalRef(env, plugin_main->callbackClass);
7233 + (*env)->DeleteGlobalRef(env, plugin_main->callbackObject);
7235 + plugin_main->callbackClass = NULL;
7236 + plugin_main->callbackObject = NULL;
7239 +/* Attach thread to JVM and cache class references when initiating JVPP VES */
7240 +jint JNI_OnLoad(JavaVM *vm, void *reserved) {
7243 + if ((*vm)->GetEnv(vm, (void**) &env, JNI_VERSION_1_8) != JNI_OK) {
7244 + return JNI_EVERSION;
7247 + if (cache_class_references(env) != 0) {
7248 + clib_warning ("Failed to cache class references\n");
7252 + return JNI_VERSION_1_8;
7255 +/* Clean up cached references when disposing JVPP VES */
7256 +void JNI_OnUnload(JavaVM *vm, void *reserved) {
7258 + if ((*vm)->GetEnv(vm, (void**) &env, JNI_VERSION_1_8) != JNI_OK) {
7261 + delete_class_references(env);
7263 diff --git a/src/vpp-api/java/jvpp-ves/jvpp_ves.h b/src/vpp-api/java/jvpp-ves/jvpp_ves.h
7264 new file mode 100644
7265 index 0000000..642101c
7267 +++ b/src/vpp-api/java/jvpp-ves/jvpp_ves.h
7270 + * Copyright (c) 2017 Intel Corp and/or its affiliates.
7272 + * Licensed under the Apache License, Version 2.0 (the "License");
7273 + * you may not use this file except in compliance with the License.
7274 + * You may obtain a copy of the License at:
7276 + * http://www.apache.org/licenses/LICENSE-2.0
7278 + * Unless required by applicable law or agreed to in writing, software
7279 + * distributed under the License is distributed on an "AS IS" BASIS,
7280 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7281 + * See the License for the specific language governing permissions and
7282 + * limitations under the License.
7284 +#ifndef __included_jvpp_ves_h__
7285 +#define __included_jvpp_ves_h__
7287 +#include <vnet/vnet.h>
7288 +#include <vnet/ip/ip.h>
7289 +#include <vnet/api_errno.h>
7290 +#include <vlibapi/api.h>
7291 +#include <vlibmemory/api.h>
7294 +/* Global state for JVPP-VES */
7296 + /* Pointer to shared memory queue */
7297 + unix_shared_memory_queue_t * vl_input_queue;
7299 + /* VPP api client index */
7300 + u32 my_client_index;
7302 + /* Callback object and class references enabling asynchronous Java calls */
7303 + jobject callbackObject;
7304 + jclass callbackClass;
7308 +ves_main_t ves_main __attribute__((aligned (64)));
7311 +#endif /* __included_jvpp_ves_h__ */