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

Source module relating to internal EVEL_JSON_BUFFER manipulation functions. More...

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

Go to the source code of this file.

Functions

void evel_json_buffer_init (EVEL_JSON_BUFFER *jbuf, char *const json, const int max_size, EVEL_THROTTLE_SPEC *throttle_spec)
 Initialize a EVEL_JSON_BUFFER. More...
 
void evel_enc_int (EVEL_JSON_BUFFER *jbuf, const int value)
 Encode an integer value to a JSON buffer. More...
 
bool evel_enc_kv_opt_string (EVEL_JSON_BUFFER *jbuf, const char *const key, const EVEL_OPTION_STRING *const option)
 Encode a string key and string value to a EVEL_JSON_BUFFER. More...
 
void evel_enc_kv_string (EVEL_JSON_BUFFER *jbuf, const char *const key, const char *const value)
 Encode a string key and string value to a EVEL_JSON_BUFFER. More...
 
bool evel_enc_kv_opt_int (EVEL_JSON_BUFFER *jbuf, const char *const key, const EVEL_OPTION_INT *const option)
 Encode a string key and integer value to a EVEL_JSON_BUFFER. More...
 
void evel_enc_kv_int (EVEL_JSON_BUFFER *jbuf, const char *const key, const int value)
 Encode a string key and integer value to a EVEL_JSON_BUFFER. More...
 
bool evel_enc_kv_opt_double (EVEL_JSON_BUFFER *jbuf, const char *const key, const EVEL_OPTION_DOUBLE *const option)
 Encode a string key and double value to a EVEL_JSON_BUFFER. More...
 
void evel_enc_kv_double (EVEL_JSON_BUFFER *jbuf, const char *const key, const double value)
 Encode a string key and double value to a EVEL_JSON_BUFFER. More...
 
bool evel_enc_kv_opt_ull (EVEL_JSON_BUFFER *jbuf, const char *const key, const EVEL_OPTION_ULL *const option)
 Encode a string key and unsigned long long value to a EVEL_JSON_BUFFER. More...
 
void evel_enc_kv_ull (EVEL_JSON_BUFFER *jbuf, const char *const key, const unsigned long long value)
 Encode a string key and unsigned long long value to a EVEL_JSON_BUFFER. More...
 
bool evel_enc_kv_opt_time (EVEL_JSON_BUFFER *jbuf, const char *const key, const EVEL_OPTION_TIME *const option)
 Encode a string key and time value to a EVEL_JSON_BUFFER. More...
 
void evel_enc_kv_time (EVEL_JSON_BUFFER *jbuf, const char *const key, const time_t *time)
 Encode a string key and time value to a EVEL_JSON_BUFFER. More...
 
void evel_enc_version (EVEL_JSON_BUFFER *jbuf, const char *const key, const int major_version, const int minor_version)
 Encode a key and version. More...
 
bool evel_json_open_opt_named_list (EVEL_JSON_BUFFER *jbuf, const char *const key)
 Add the key and opening bracket of an optional named list to a JSON buffer. More...
 
void evel_json_open_named_list (EVEL_JSON_BUFFER *jbuf, const char *const key)
 Add the key and opening bracket of a named list to a JSON buffer. More...
 
void evel_json_close_list (EVEL_JSON_BUFFER *jbuf)
 Add the closing bracket of a list to a JSON buffer. More...
 
void evel_enc_list_item (EVEL_JSON_BUFFER *jbuf, const char *const format,...)
 Encode a list item with format and param list to a EVEL_JSON_BUFFER. More...
 
bool evel_json_open_opt_named_object (EVEL_JSON_BUFFER *jbuf, const char *const key)
 Add the opening bracket of an optional named object to a JSON buffer. More...
 
void evel_json_open_named_object (EVEL_JSON_BUFFER *jbuf, const char *const key)
 Add the opening bracket of an object to a JSON buffer. More...
 
void evel_json_open_object (EVEL_JSON_BUFFER *jbuf)
 Add the opening bracket of an object to a JSON buffer. More...
 
void evel_json_close_object (EVEL_JSON_BUFFER *jbuf)
 Add the closing bracket of an object to a JSON buffer. More...
 
void evel_json_checkpoint (EVEL_JSON_BUFFER *jbuf)
 Add a checkpoint - a stake in the ground to which we can rewind. More...
 
void evel_json_rewind (EVEL_JSON_BUFFER *jbuf)
 Rewind to the latest checkoint. More...
 

Detailed Description

Source module relating to internal EVEL_JSON_BUFFER manipulation functions.

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

Function Documentation

§ evel_enc_int()

void evel_enc_int ( EVEL_JSON_BUFFER jbuf,
const int  value 
)

Encode an integer value to a JSON buffer.

Parameters
jbufPointer to working EVEL_JSON_BUFFER.
valueThe integer to add to it.

Definition at line 80 of file evel_json_buffer.c.

§ evel_enc_kv_double()

void evel_enc_kv_double ( EVEL_JSON_BUFFER jbuf,
const char *const  key,
const double  value 
)

Encode a string key and double value to a EVEL_JSON_BUFFER.

Parameters
jbufPointer to working EVEL_JSON_BUFFER.
keyPointer to the key to encode.
valueThe corresponding value to encode.

Definition at line 323 of file evel_json_buffer.c.

§ evel_enc_kv_int()

void evel_enc_kv_int ( EVEL_JSON_BUFFER jbuf,
const char *const  key,
const int  value 
)

Encode a string key and integer value to a EVEL_JSON_BUFFER.

Parameters
jbufPointer to working EVEL_JSON_BUFFER.
keyPointer to the key to encode.
valueThe corresponding value to encode.

Definition at line 252 of file evel_json_buffer.c.

§ evel_enc_kv_opt_double()

bool evel_enc_kv_opt_double ( EVEL_JSON_BUFFER jbuf,
const char *const  key,
const EVEL_OPTION_DOUBLE *const  option 
)

Encode a string key and double value to a EVEL_JSON_BUFFER.

Parameters
jbufPointer to working EVEL_JSON_BUFFER.
keyPointer to the key to encode.
optionPointer to holder of the corresponding value to encode.
Returns
true if the key, value was added, false if it was suppressed.

Definition at line 282 of file evel_json_buffer.c.

§ evel_enc_kv_opt_int()

bool evel_enc_kv_opt_int ( EVEL_JSON_BUFFER jbuf,
const char *const  key,
const EVEL_OPTION_INT *const  option 
)

Encode a string key and integer value to a EVEL_JSON_BUFFER.

Parameters
jbufPointer to working EVEL_JSON_BUFFER.
keyPointer to the key to encode.
optionPointer to holder of the corresponding value to encode.
Returns
true if the key, value was added, false if it was suppressed.

Definition at line 211 of file evel_json_buffer.c.

§ evel_enc_kv_opt_string()

bool evel_enc_kv_opt_string ( EVEL_JSON_BUFFER jbuf,
const char *const  key,
const EVEL_OPTION_STRING *const  option 
)

Encode a string key and string value to a EVEL_JSON_BUFFER.

Parameters
jbufPointer to working EVEL_JSON_BUFFER.
keyPointer to the key to encode.
optionPointer to holder of the corresponding value to encode.
Returns
true if the key, value was added, false if it was suppressed.

Definition at line 105 of file evel_json_buffer.c.

§ evel_enc_kv_opt_time()

bool evel_enc_kv_opt_time ( EVEL_JSON_BUFFER jbuf,
const char *const  key,
const EVEL_OPTION_TIME *const  option 
)

Encode a string key and time value to a EVEL_JSON_BUFFER.

Parameters
jbufPointer to working EVEL_JSON_BUFFER.
keyPointer to the key to encode.
optionPointer to holder of the corresponding value to encode.
Returns
true if the key, value was added, false if it was suppressed.

Definition at line 424 of file evel_json_buffer.c.

§ evel_enc_kv_opt_ull()

bool evel_enc_kv_opt_ull ( EVEL_JSON_BUFFER jbuf,
const char *const  key,
const EVEL_OPTION_ULL *const  option 
)

Encode a string key and unsigned long long value to a EVEL_JSON_BUFFER.

Parameters
jbufPointer to working EVEL_JSON_BUFFER.
keyPointer to the key to encode.
optionPointer to holder of the corresponding value to encode.
Returns
true if the key, value was added, false if it was suppressed.

Definition at line 353 of file evel_json_buffer.c.

§ evel_enc_kv_string()

void evel_enc_kv_string ( EVEL_JSON_BUFFER jbuf,
const char *const  key,
const char *const  value 
)

Encode a string key and string value to a EVEL_JSON_BUFFER.

Parameters
jbufPointer to working EVEL_JSON_BUFFER.
keyPointer to the key to encode.
valuePointer to the corresponding value to encode.

Definition at line 146 of file evel_json_buffer.c.

§ evel_enc_kv_time()

void evel_enc_kv_time ( EVEL_JSON_BUFFER jbuf,
const char *const  key,
const time_t *  time 
)

Encode a string key and time value to a EVEL_JSON_BUFFER.

Parameters
jbufPointer to working EVEL_JSON_BUFFER.
keyPointer to the key to encode.
timePointer to the time to encode.

Definition at line 465 of file evel_json_buffer.c.

§ evel_enc_kv_ull()

void evel_enc_kv_ull ( EVEL_JSON_BUFFER jbuf,
const char *const  key,
const unsigned long long  value 
)

Encode a string key and unsigned long long value to a EVEL_JSON_BUFFER.

Parameters
jbufPointer to working EVEL_JSON_BUFFER.
keyPointer to the key to encode.
valueThe corresponding value to encode.

Definition at line 394 of file evel_json_buffer.c.

§ evel_enc_list_item()

void evel_enc_list_item ( EVEL_JSON_BUFFER jbuf,
const char *const  format,
  ... 
)

Encode a list item with format and param list to a EVEL_JSON_BUFFER.

Parameters
jbufPointer to working EVEL_JSON_BUFFER.
formatFormat string in standard printf format.
...Variable parameters for format string.

Definition at line 620 of file evel_json_buffer.c.

§ evel_enc_version()

void evel_enc_version ( EVEL_JSON_BUFFER jbuf,
const char *const  key,
const int  major_version,
const int  minor_version 
)

Encode a key and version.

Parameters
jbufPointer to working EVEL_JSON_BUFFER.
keyPointer to the key to encode.
major_versionThe major version to encode.
minor_versionThe minor version to encode.

Definition at line 501 of file evel_json_buffer.c.

§ evel_json_buffer_init()

void evel_json_buffer_init ( EVEL_JSON_BUFFER jbuf,
char *const  json,
const int  max_size,
EVEL_THROTTLE_SPEC throttle_spec 
)

Initialize a EVEL_JSON_BUFFER.

Parameters
jbufPointer to the EVEL_JSON_BUFFER to initialise.
jsonPointer to the underlying working buffer to use.
max_sizeSize of storage available in the JSON buffer.
throttle_specPointer to throttle specification. Can be NULL.

Definition at line 55 of file evel_json_buffer.c.

§ evel_json_checkpoint()

void evel_json_checkpoint ( EVEL_JSON_BUFFER jbuf)

Add a checkpoint - a stake in the ground to which we can rewind.

Parameters
jbufPointer to working EVEL_JSON_BUFFER.

Definition at line 813 of file evel_json_buffer.c.

§ evel_json_close_list()

void evel_json_close_list ( EVEL_JSON_BUFFER jbuf)

Add the closing bracket of a list to a JSON buffer.

Parameters
jbufPointer to working EVEL_JSON_BUFFER.

Definition at line 596 of file evel_json_buffer.c.

§ evel_json_close_object()

void evel_json_close_object ( EVEL_JSON_BUFFER jbuf)

Add the closing bracket of an object to a JSON buffer.

Parameters
jbufPointer to working EVEL_JSON_BUFFER.

Definition at line 758 of file evel_json_buffer.c.

§ evel_json_open_named_list()

void evel_json_open_named_list ( EVEL_JSON_BUFFER jbuf,
const char *const  key 
)

Add the key and opening bracket of a named list to a JSON buffer.

Parameters
jbufPointer to working EVEL_JSON_BUFFER.
keyPointer to the key to encode.

Definition at line 570 of file evel_json_buffer.c.

§ evel_json_open_named_object()

void evel_json_open_named_object ( EVEL_JSON_BUFFER jbuf,
const char *const  key 
)

Add the opening bracket of an object to a JSON buffer.

Parameters
jbufPointer to working EVEL_JSON_BUFFER.
keyPointer to the key to encode.
Returns
true if the object was opened, false if it was suppressed.

Definition at line 698 of file evel_json_buffer.c.

§ evel_json_open_object()

void evel_json_open_object ( EVEL_JSON_BUFFER jbuf)

Add the opening bracket of an object to a JSON buffer.

Parameters
jbufPointer to working EVEL_JSON_BUFFER.

Definition at line 724 of file evel_json_buffer.c.

§ evel_json_open_opt_named_list()

bool evel_json_open_opt_named_list ( EVEL_JSON_BUFFER jbuf,
const char *const  key 
)

Add the key and opening bracket of an optional named list to a JSON buffer.

Parameters
jbufPointer to working EVEL_JSON_BUFFER.
keyPointer to the key to encode.
Returns
true if the list was opened, false if it was suppressed.

Definition at line 533 of file evel_json_buffer.c.

§ evel_json_open_opt_named_object()

bool evel_json_open_opt_named_object ( EVEL_JSON_BUFFER jbuf,
const char *const  key 
)

Add the opening bracket of an optional named object to a JSON buffer.

Parameters
jbufPointer to working EVEL_JSON_BUFFER.
keyPointer to the key to encode.

Definition at line 660 of file evel_json_buffer.c.

§ evel_json_rewind()

void evel_json_rewind ( EVEL_JSON_BUFFER jbuf)

Rewind to the latest checkoint.

Parameters
jbufPointer to working EVEL_JSON_BUFFER.

Definition at line 835 of file evel_json_buffer.c.