AT&T ECOMP Vendor Event Listener library  0.1
Functions
evel_event.c File Reference

Implementation of EVEL functions relating to Event Headers - since Heartbeats only contain the Event Header, the Heartbeat factory function is here too. More...

#include <string.h>
#include <assert.h>
#include <stdlib.h>
#include <sys/time.h>
#include "evel.h"
#include "evel_internal.h"
#include "evel_throttle.h"
#include "metadata.h"
Include dependency graph for evel_event.c:

Go to the source code of this file.

Functions

void evel_set_next_event_sequence (const int sequence)
 Set the next event_sequence to use. More...
 
EVENT_HEADERevel_new_heartbeat ()
 Create a new heartbeat event. More...
 
void evel_init_header (EVENT_HEADER *const header)
 Initialize a newly created event header. More...
 
void evel_header_type_set (EVENT_HEADER *const header, const char *const type)
 Set the Event Type property of the event header. More...
 
void evel_start_epoch_set (EVENT_HEADER *const header, const unsigned long long start_epoch_microsec)
 Set the Start Epoch property of the event header. More...
 
void evel_last_epoch_set (EVENT_HEADER *const header, const unsigned long long last_epoch_microsec)
 Set the Last Epoch property of the event header. More...
 
void evel_reporting_entity_name_set (EVENT_HEADER *const header, const char *const entity_name)
 Set the Reporting Entity Name property of the event header. More...
 
void evel_reporting_entity_id_set (EVENT_HEADER *const header, const char *const entity_id)
 Set the Reporting Entity Id property of the event header. More...
 
void evel_json_encode_header (EVEL_JSON_BUFFER *jbuf, EVENT_HEADER *event)
 Encode the event as a JSON event object according to AT&T's schema. More...
 
void evel_free_header (EVENT_HEADER *const event)
 Free an event header. More...
 
int evel_json_encode_event (char *json, int max_size, EVENT_HEADER *event)
 Encode the event as a JSON event object according to AT&T's schema. More...
 
void evel_init_event_instance_id (EVEL_EVENT_INSTANCE_ID *const instance_id, const char *const vendor_id, const char *const event_id)
 Initialize an event instance id. More...
 
void evel_free_event_instance_id (EVEL_EVENT_INSTANCE_ID *const instance_id)
 Free an event instance id. More...
 
void evel_json_encode_instance_id (EVEL_JSON_BUFFER *jbuf, EVEL_EVENT_INSTANCE_ID *instance_id)
 Encode the instance id as a JSON object according to AT&T's schema. More...
 

Detailed Description

Implementation of EVEL functions relating to Event Headers - since Heartbeats only contain the Event Header, the Heartbeat factory function is here too.

License

Copyright(c) <2016>, AT&T Intellectual Property. All other rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. All advertising materials mentioning features or use of this software must display the following acknowledgement: This product includes software developed by the AT&T.
  4. Neither the name of AT&T nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY AT&T INTELLECTUAL PROPERTY ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AT&T INTELLECTUAL PROPERTY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file evel_event.c.

Function Documentation

§ evel_free_event_instance_id()

void evel_free_event_instance_id ( EVEL_EVENT_INSTANCE_ID *const  instance_id)

Free an event instance id.

Parameters
instance_idPointer to the event instance id being initialized.

Definition at line 505 of file evel_event.c.

§ evel_free_header()

void evel_free_header ( EVENT_HEADER *const  event)

Free an event header.

Free off the event header supplied. Will free all the contained allocated memory.

Note
It does not free the header itself, since that may be part of a larger structure.

Definition at line 349 of file evel_event.c.

§ evel_header_type_set()

void evel_header_type_set ( EVENT_HEADER *const  header,
const char *const  type 
)

Set the Event Type property of the event header.

Note
The property is treated as immutable: it is only valid to call the setter once. However, we don't assert if the caller tries to overwrite, just ignoring the update instead.
Parameters
headerPointer to the EVENT_HEADER.
typeThe Event Type to be set. ASCIIZ string. The caller does not need to preserve the value once the function returns.

Definition at line 164 of file evel_event.c.

§ evel_init_event_instance_id()

void evel_init_event_instance_id ( EVEL_EVENT_INSTANCE_ID *const  instance_id,
const char *const  vendor_id,
const char *const  event_id 
)

Initialize an event instance id.

Initialize an event instance id, typically embedded in an event.

Parameters
instance_idPointer to the event instance id being initialized.
vendor_idThe vendor id to encode in the event instance id.
event_idThe event id to encode in the event instance id.

Definition at line 471 of file evel_event.c.

§ evel_init_header()

void evel_init_header ( EVENT_HEADER *const  header)

Initialize a newly created event header.

Parameters
headerPointer to the header being initialized.

Definition at line 112 of file evel_event.c.

§ evel_json_encode_event()

int evel_json_encode_event ( char *  json,
int  max_size,
EVENT_HEADER event 
)

Encode the event as a JSON event object according to AT&T's schema.

Parameters
jsonPointer to where to store the JSON encoded data.
max_sizeSize of storage available in json_body.
eventPointer to the EVENT_HEADER to encode.
Returns
Number of bytes actually written.

Definition at line 381 of file evel_event.c.

§ evel_json_encode_header()

void evel_json_encode_header ( EVEL_JSON_BUFFER jbuf,
EVENT_HEADER event 
)

Encode the event as a JSON event object according to AT&T's schema.

Parameters
jbufPointer to the EVEL_JSON_BUFFER to encode into.
eventPointer to the EVENT_HEADER to encode.

Definition at line 291 of file evel_event.c.

§ evel_json_encode_instance_id()

void evel_json_encode_instance_id ( EVEL_JSON_BUFFER jbuf,
EVEL_EVENT_INSTANCE_ID instance_id 
)

Encode the instance id as a JSON object according to AT&T's schema.

Parameters
jbufPointer to the EVEL_JSON_BUFFER to encode into.
instance_idPointer to the EVEL_EVENT_INSTANCE_ID to encode.

Definition at line 534 of file evel_event.c.

§ evel_last_epoch_set()

void evel_last_epoch_set ( EVENT_HEADER *const  header,
const unsigned long long  last_epoch_microsec 
)

Set the Last Epoch property of the event header.

Note
The Last Epoch defaults to the time of event creation.
Parameters
headerPointer to the EVENT_HEADER.
last_epoch_microsecThe last epoch to set, in microseconds.

Definition at line 212 of file evel_event.c.

§ evel_new_heartbeat()

EVENT_HEADER* evel_new_heartbeat ( void  )

Create a new heartbeat event.

Note
that the heartbeat is just a "naked" commonEventHeader!
Returns
pointer to the newly manufactured EVENT_HEADER. If the event is not used it must be released using evel_free_event
Return values
NULLFailed to create the event.

Definition at line 78 of file evel_event.c.

§ evel_reporting_entity_id_set()

void evel_reporting_entity_id_set ( EVENT_HEADER *const  header,
const char *const  entity_id 
)

Set the Reporting Entity Id property of the event header.

Note
The Reporting Entity Id defaults to the OpenStack VM UUID.
Parameters
headerPointer to the EVENT_HEADER.
entity_idThe entity id to set.

Definition at line 264 of file evel_event.c.

§ evel_reporting_entity_name_set()

void evel_reporting_entity_name_set ( EVENT_HEADER *const  header,
const char *const  entity_name 
)

Set the Reporting Entity Name property of the event header.

Note
The Reporting Entity Name defaults to the OpenStack VM Name.
Parameters
headerPointer to the EVENT_HEADER.
entity_nameThe entity name to set.

Definition at line 234 of file evel_event.c.

§ evel_set_next_event_sequence()

void evel_set_next_event_sequence ( const int  sequence)

Set the next event_sequence to use.

Parameters
sequenceThe next sequence number to use.

Definition at line 59 of file evel_event.c.

§ evel_start_epoch_set()

void evel_start_epoch_set ( EVENT_HEADER *const  header,
const unsigned long long  start_epoch_microsec 
)

Set the Start Epoch property of the event header.

Note
The Start Epoch defaults to the time of event creation.
Parameters
headerPointer to the EVENT_HEADER.
start_epoch_microsecThe start epoch to set, in microseconds.

Definition at line 189 of file evel_event.c.