AT&T ECOMP Vendor Event Listener library  0.1
Data Structures | Macros | Typedefs | Enumerations | Functions
evel_throttle.h File Reference

EVEL throttle definitions. More...

#include "evel_internal.h"
#include "jsmn.h"
Include dependency graph for evel_throttle.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  evel_json_stack_entry
 An entry in the JSON stack. More...
 
struct  evel_json_stack
 The JSON stack. More...
 

Macros

#define EVEL_JSON_STACK_DEPTH   10
 
#define EVEL_MAX_RESPONSE_TOKENS   1024
 Maximum number of tokens that we allow for in a JSON response. More...
 

Typedefs

typedef struct evel_json_stack_entry EVEL_JSON_STACK_ENTRY
 An entry in the JSON stack. More...
 
typedef struct evel_json_stack EVEL_JSON_STACK
 The JSON stack. More...
 

Enumerations

enum  EVEL_JSON_STATE { EVEL_JSON_KEY, EVEL_JSON_VALUE, EVEL_JSON_ITEM }
 The nature of the next token that we are iterating through. More...
 
enum  EVEL_JSON_COMMAND_STATE {
  EVEL_JCS_START, EVEL_JCS_COMMAND_LIST, EVEL_JCS_COMMAND_LIST_ENTRY, EVEL_JCS_COMMAND,
  EVEL_JCS_SPEC, EVEL_JCS_FIELD_NAMES, EVEL_JCS_PAIRS_LIST, EVEL_JCS_PAIRS_LIST_ENTRY,
  EVEL_JCS_NV_PAIR_NAMES, EVEL_JCS_MAX
}
 States which we move through during JSON processing, tracking our way through the supported JSON structure. More...
 

Functions

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

Detailed Description

EVEL throttle definitions.

These are internal definitions related to throttling specicications, which are required within the library but are not intended for external consumption.

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.h.

Macro Definition Documentation

§ EVEL_JSON_STACK_DEPTH

#define EVEL_JSON_STACK_DEPTH   10

Definition at line 50 of file evel_throttle.h.

§ EVEL_MAX_RESPONSE_TOKENS

#define EVEL_MAX_RESPONSE_TOKENS   1024

Maximum number of tokens that we allow for in a JSON response.

Definition at line 55 of file evel_throttle.h.

Typedef Documentation

§ EVEL_JSON_STACK

The JSON stack.

§ EVEL_JSON_STACK_ENTRY

An entry in the JSON stack.

Enumeration Type Documentation

§ EVEL_JSON_COMMAND_STATE

States which we move through during JSON processing, tracking our way through the supported JSON structure.

Enumerator
EVEL_JCS_START 
EVEL_JCS_COMMAND_LIST 
EVEL_JCS_COMMAND_LIST_ENTRY 
EVEL_JCS_COMMAND 
EVEL_JCS_SPEC 
EVEL_JCS_FIELD_NAMES 
EVEL_JCS_PAIRS_LIST 
EVEL_JCS_PAIRS_LIST_ENTRY 
EVEL_JCS_NV_PAIR_NAMES 
EVEL_JCS_MAX 

Definition at line 72 of file evel_throttle.h.

§ EVEL_JSON_STATE

The nature of the next token that we are iterating through.

Within an object, we alternate between collecting keys and values. Within an array, we only collect items.

Enumerator
EVEL_JSON_KEY 
EVEL_JSON_VALUE 
EVEL_JSON_ITEM 

Definition at line 62 of file evel_throttle.h.

Function Documentation

§ 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.