diff options
Diffstat (limited to 'vnfs/VES5.0/evel/evel-library/code/evel_library/evel.h')
-rw-r--r-- | vnfs/VES5.0/evel/evel-library/code/evel_library/evel.h | 87 |
1 files changed, 71 insertions, 16 deletions
diff --git a/vnfs/VES5.0/evel/evel-library/code/evel_library/evel.h b/vnfs/VES5.0/evel/evel-library/code/evel_library/evel.h index 0ae1713e..6b7a8720 100644 --- a/vnfs/VES5.0/evel/evel-library/code/evel_library/evel.h +++ b/vnfs/VES5.0/evel/evel-library/code/evel_library/evel.h @@ -1,5 +1,3 @@ -#ifndef EVEL_INCLUDED -#define EVEL_INCLUDED /*************************************************************************//** * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. @@ -29,6 +27,9 @@ * be one of ::EVEL_ERR_CODES. *****************************************************************************/ +#ifndef EVEL_INCLUDED +#define EVEL_INCLUDED + #ifdef __cplusplus extern "C" { #endif @@ -86,7 +87,7 @@ typedef enum { /* Maximum string lengths. */ /*****************************************************************************/ #define EVEL_MAX_STRING_LEN 4096 -#define EVEL_MAX_JSON_BODY 16000 +#define EVEL_MAX_JSON_BODY 160000 #define EVEL_MAX_ERROR_STRING_LEN 255 #define EVEL_MAX_URL_LEN 511 @@ -117,6 +118,7 @@ static const int EVEL_EVENT_BUFFER_DEPTH = 100; *****************************************************************************/ typedef enum { EVEL_DOMAIN_INTERNAL, /** Internal event, not for external routing. */ + EVEL_DOMAIN_BATCH, /** Batch event, composite event. */ EVEL_DOMAIN_HEARTBEAT, /** A Heartbeat event (event header only). */ EVEL_DOMAIN_FAULT, /** A Fault event. */ EVEL_DOMAIN_MEASUREMENT, /** A Measurement for VF Scaling event. */ @@ -400,9 +402,11 @@ typedef struct internal_header_fields /*****************************************************************************/ /* Supported Common Event Header version. */ /*****************************************************************************/ -#define EVEL_HEADER_MAJOR_VERSION 1 -#define EVEL_HEADER_MINOR_VERSION 2 +#define EVEL_HEADER_MAJOR_VERSION 3 +#define EVEL_HEADER_MINOR_VERSION 0 +#define EVEL_BATCH_MAJOR_VERSION 1 +#define EVEL_BATCH_MINOR_VERSION 0 /**************************************************************************//** * Event header. * JSON equivalent field: commonEventHeader @@ -436,9 +440,57 @@ typedef struct event_header { EVEL_OPTION_INTHEADER_FIELDS internal_field; EVEL_OPTION_STRING nfcnaming_code; EVEL_OPTION_STRING nfnaming_code; + DLIST batch_events; } EVENT_HEADER; +/**************************************************************************//** + * Initialize a newly created event header. + * + * @param header Pointer to the header being initialized. + * @param eventname Eventname string + * @param eventid Event id : unique id for classification and analysis + * @param header Pointer to the header being initialized. + *****************************************************************************/ +void evel_init_header_nameid(EVENT_HEADER * const header,const char *const eventname, const char *eventid); + +/**************************************************************************//** + * Create a new Batch event. + * + * @note The mandatory fields on the Batch must be supplied to this factory + * function and are immutable once set. Optional fields have explicit + * setter functions, but again values may only be set once so that the + * Batch has immutable properties. At this time evename and eventid + * for batch events are set but not used in json encoding + * @returns pointer to the newly manufactured ::EVENT_HEADER. If the event is + * not used (i.e. posted) it must be released using ::evel_free_batch. + * @retval NULL Failed to create the event. + *****************************************************************************/ +EVENT_HEADER * evel_new_batch(const char* ev_name, const char *ev_id); + + +/**************************************************************************//** + * Add an Event into Batch Event + * + * The name and value are null delimited ASCII strings. The library takes + * a copy so the caller does not have to preserve values after the function + * returns. + * + * @param other Pointer to the Batch Event. + * @param jsonobj Pointer to additional Event + *****************************************************************************/ +void evel_batch_add_event(EVENT_HEADER * batchev, EVENT_HEADER *child); + +/**************************************************************************//** + * Free an Batch. + * + * Free off the Batch supplied. Will free all the contained allocated memory. + * + * @note It does not free the Batch itself, since that may be part of a + * larger structure. + *****************************************************************************/ +void evel_free_batch(EVENT_HEADER * event); + /*****************************************************************************/ /* Supported Fault version. */ /*****************************************************************************/ @@ -1082,8 +1134,8 @@ typedef struct mobile_gtp_per_flow_metrics { /*****************************************************************************/ /* Supported Mobile Flow version. */ /*****************************************************************************/ -#define EVEL_MOBILE_FLOW_MAJOR_VERSION 1 -#define EVEL_MOBILE_FLOW_MINOR_VERSION 2 +#define EVEL_MOBILE_FLOW_MAJOR_VERSION 2 +#define EVEL_MOBILE_FLOW_MINOR_VERSION 0 /**************************************************************************//** * Mobile Flow. @@ -1179,8 +1231,8 @@ typedef struct other_field { /*****************************************************************************/ /* Supported Signaling version. */ /*****************************************************************************/ -#define EVEL_SIGNALING_MAJOR_VERSION 2 -#define EVEL_SIGNALING_MINOR_VERSION 1 +#define EVEL_SIGNALING_MAJOR_VERSION 1 +#define EVEL_SIGNALING_MINOR_VERSION 0 /**************************************************************************//** * Vendor VNF Name fields. @@ -1277,8 +1329,8 @@ typedef struct state_change_additional_field { /*****************************************************************************/ /* Supported Syslog version. */ /*****************************************************************************/ -#define EVEL_SYSLOG_MAJOR_VERSION 1 -#define EVEL_SYSLOG_MINOR_VERSION 2 +#define EVEL_SYSLOG_MAJOR_VERSION 3 +#define EVEL_SYSLOG_MINOR_VERSION 0 /**************************************************************************//** * Syslog. @@ -1400,6 +1452,7 @@ void evel_free_event(void * event); * Encode the event as a JSON event object according to AT&T's schema. * * @param json Pointer to where to store the JSON encoded data. + * @param mode Event mode or Batch mode * @param max_size Size of storage available in json_body. * @param event Pointer to the ::EVENT_HEADER to encode. * @returns Number of bytes actually written. @@ -1407,7 +1460,9 @@ void evel_free_event(void * event); int evel_json_encode_event(char * json, int max_size, EVENT_HEADER * event); - +int evel_json_encode_batch_event(char * json, + int max_size, + EVENT_HEADER * event); /**************************************************************************//** * Initialize an event instance id. * @@ -1490,8 +1545,8 @@ EVENT_HEADER * evel_new_heartbeat(void); * * @note that the heartbeat is just a "naked" commonEventHeader! * - * @param event_name Unique Event Name confirming Domain AsdcModel Description - * @param event_id A universal identifier of the event for: troubleshooting correlation, analysis, etc + * @param event_name Unique Event Name: {DomainAbbreviation}_{AsdcModel or ApplicationPlatform}_{DescriptionOfInfoBeingConveyed} + * @param event_id A universal identifier of the event for: troubleshooting, cross-referencing of alarms for alarm correlation, offline log analysis, etc * * @returns pointer to the newly manufactured ::EVENT_HEADER. If the event is * not used it must be released using ::evel_free_event @@ -4255,8 +4310,8 @@ typedef struct perf_counter { /*****************************************************************************/ /* Supported Threshold Crossing version. */ /*****************************************************************************/ -#define EVEL_THRESHOLD_CROSS_MAJOR_VERSION 1 -#define EVEL_THRESHOLD_CROSS_MINOR_VERSION 1 +#define EVEL_THRESHOLD_CROSS_MAJOR_VERSION 2 +#define EVEL_THRESHOLD_CROSS_MINOR_VERSION 0 /**************************************************************************//** * Threshold Crossing. |