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

Implementation of EVEL functions relating to the State Change. More...

#include <string.h>
#include <assert.h>
#include <stdlib.h>
#include "evel_throttle.h"
Include dependency graph for evel_state_change.c:

Go to the source code of this file.

Functions

EVENT_STATE_CHANGEevel_new_state_change (const EVEL_ENTITY_STATE new_state, const EVEL_ENTITY_STATE old_state, const char *const interface)
 Create a new State Change event. More...
 
void evel_free_state_change (EVENT_STATE_CHANGE *const state_change)
 Free a State Change. More...
 
void evel_state_change_type_set (EVENT_STATE_CHANGE *const state_change, const char *const type)
 Set the Event Type property of the State Change. More...
 
void evel_state_change_addl_field_add (EVENT_STATE_CHANGE *const state_change, const char *const name, const char *const value)
 Add an additional field name/value pair to the State Change. More...
 
void evel_json_encode_state_change (EVEL_JSON_BUFFER *jbuf, EVENT_STATE_CHANGE *state_change)
 Encode the state change as a JSON state change. More...
 

Detailed Description

Implementation of EVEL functions relating to the State Change.

License

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_state_change.c.

Function Documentation

§ evel_free_state_change()

void evel_free_state_change ( EVENT_STATE_CHANGE *const  state_change)

Free a State Change.

Free off the State Change supplied. Will free all the contained allocated memory.

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

Definition at line 111 of file evel_state_change.c.

§ evel_json_encode_state_change()

void evel_json_encode_state_change ( EVEL_JSON_BUFFER jbuf,
EVENT_STATE_CHANGE state_change 
)

Encode the state change as a JSON state change.

Parameters
jbufPointer to the EVEL_JSON_BUFFER to encode into.
state_changePointer to the EVENT_STATE_CHANGE to encode.

Definition at line 221 of file evel_state_change.c.

§ evel_new_state_change()

EVENT_STATE_CHANGE* evel_new_state_change ( const EVEL_ENTITY_STATE  new_state,
const EVEL_ENTITY_STATE  old_state,
const char *const  interface 
)

Create a new State Change event.

Note
The mandatory fields on the State Change 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 State Change has immutable properties.
Parameters
new_stateThe new state of the reporting entity.
old_stateThe old state of the reporting entity.
interfaceThe card or port name of the reporting entity.
Returns
pointer to the newly manufactured EVENT_STATE_CHANGE. If the event is not used it must be released using evel_free_state_change
Return values
NULLFailed to create the event.

Definition at line 58 of file evel_state_change.c.

§ evel_state_change_addl_field_add()

void evel_state_change_addl_field_add ( EVENT_STATE_CHANGE *const  state_change,
const char *const  name,
const char *const  value 
)

Add an additional field name/value pair to the State Change.

The name and value are null delimited ASCII strings. The library takes a copy so the caller does not have to preserve values after the function returns.

Parameters
state_changePointer to the EVENT_STATE_CHANGE.
nameASCIIZ string with the attribute's name. The caller does not need to preserve the value once the function returns.
valueASCIIZ string with the attribute's value. The caller does not need to preserve the value once the function returns.

Definition at line 186 of file evel_state_change.c.

§ evel_state_change_type_set()

void evel_state_change_type_set ( EVENT_STATE_CHANGE *const  state_change,
const char *const  type 
)

Set the Event Type property of the State Change.

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

Definition at line 156 of file evel_state_change.c.