AT&T ECOMP Vendor Event Listener library  0.1
Macros | Functions | Variables
evel_throttle.c File Reference

Event Manager. More...

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

Go to the source code of this file.

Macros

#define _GNU_SOURCE
 
#define JSON_TOKEN_TYPES   (JSMN_PRIMITIVE + 1)
 

Functions

int evel_get_measurement_interval ()
 Return the current measurement interval provided by the Event Listener. More...
 
EVEL_THROTTLE_SPECevel_get_throttle_spec (EVEL_EVENT_DOMAINS domain)
 Return the EVEL_THROTTLE_SPEC for a given domain. More...
 
bool evel_throttle_suppress_field (EVEL_THROTTLE_SPEC *throttle_spec, const char *const field_name)
 Determine whether a field_name should be suppressed. More...
 
bool evel_throttle_suppress_nv_pair (EVEL_THROTTLE_SPEC *throttle_spec, const char *const field_name, const char *const name)
 Determine whether a name-value pair should be allowed (not suppressed). More...
 
void evel_throttle_initialize ()
 Initialize event throttling to the default state. More...
 
void evel_throttle_terminate ()
 Clean up event throttling. More...
 
bool evel_handle_command_list (const MEMORY_CHUNK *const chunk, const jsmntok_t *const json_tokens, const int num_tokens, MEMORY_CHUNK *const post)
 Handle a JSON response from the listener, as a list of tokens from JSMN. More...
 

Variables

EVEL_JSON_COMMAND_STATE evel_json_command_state
 

Detailed Description

Event Manager.

Simple event manager that is responsible for taking events (Heartbeats, Faults and Measurements) from the ring-buffer and posting them to the API.

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

Macro Definition Documentation

§ _GNU_SOURCE

#define _GNU_SOURCE

Definition at line 40 of file evel_throttle.c.

§ JSON_TOKEN_TYPES

#define JSON_TOKEN_TYPES   (JSMN_PRIMITIVE + 1)

Definition at line 126 of file evel_throttle.c.

Function Documentation

§ evel_get_measurement_interval()

int evel_get_measurement_interval ( )

Return the current measurement interval provided by the Event Listener.

Returns
The current measurement interval
Return values
EVEL_MEASUREMENT_INTERVAL_UKNOWN(0) - interval has not been specified

Definition at line 206 of file evel_throttle.c.

§ evel_get_throttle_spec()

EVEL_THROTTLE_SPEC* evel_get_throttle_spec ( EVEL_EVENT_DOMAINS  domain)

Return the EVEL_THROTTLE_SPEC for a given domain.

Parameters
domainThe domain for which to return state.

Definition at line 229 of file evel_throttle.c.

§ evel_handle_command_list()

bool evel_handle_command_list ( const MEMORY_CHUNK *const  chunk,
const jsmntok_t *const  json_tokens,
const int  num_tokens,
MEMORY_CHUNK *const  post 
)

Handle a JSON response from the listener, as a list of tokens from JSMN.

Parameters
chunkMemory chunk containing the JSON buffer.
json_tokensArray of tokens to handle.
num_tokensThe number of tokens to handle.
postThe memory chunk in which to place any resulting POST.
Returns
true if the command was handled, false otherwise.

Definition at line 648 of file evel_throttle.c.

§ evel_throttle_initialize()

void evel_throttle_initialize ( )

Initialize event throttling to the default state.

Called from evel_initialize.

Definition at line 352 of file evel_throttle.c.

§ evel_throttle_suppress_field()

bool evel_throttle_suppress_field ( EVEL_THROTTLE_SPEC throttle_spec,
const char *const  field_name 
)

Determine whether a field_name should be suppressed.

Parameters
throttle_specThrottle specification for the domain being encoded.
field_nameThe field name to encoded or suppress.
Returns
true if the field_name should be suppressed, false otherwise.

Definition at line 254 of file evel_throttle.c.

§ evel_throttle_suppress_nv_pair()

bool evel_throttle_suppress_nv_pair ( EVEL_THROTTLE_SPEC throttle_spec,
const char *const  field_name,
const char *const  name 
)

Determine whether a name-value pair should be allowed (not suppressed).

Parameters
throttle_specThrottle specification for the domain being encoded.
field_nameThe field name holding the name-value pairs.
nameThe name of the name-value pair to encoded or suppress.
Returns
true if the name-value pair should be suppressed, false otherwise.

Definition at line 293 of file evel_throttle.c.

§ evel_throttle_terminate()

void evel_throttle_terminate ( )

Clean up event throttling.

Called from evel_terminate.

Definition at line 377 of file evel_throttle.c.

Variable Documentation

§ evel_json_command_state

EVEL_JSON_COMMAND_STATE evel_json_command_state

Definition at line 106 of file evel_throttle.c.