#include <sys/queue.h>
#include <pthread.h>
#include <json-c/json_object.h>
#include <json-c/json_tokener.h>
#include <json-c/json_util.h>
#include <json-c/json_visit.h>
#include <json-c/linkhash.h>
#include <stddef.h>
#include <stdint.h>
#include "jcfg.h"
Go to the source code of this file.
|
int | jcfg_list_add (jcfg_list_t *lst, void *obj) |
|
int | _decode_defaults (struct json_object *obj, int flags, struct json_object *parent, const char *key, size_t *index, void *arg) |
|
int | jcfg_decode_lport_groups_end (jcfg_info_t *jinfo, void *arg) |
|
int | __decoder_val_get (obj_value_t *val, uint64_t *v) |
|
int | __decoder_array_val_get (obj_value_t *val, obj_value_t **arr) |
|
int | __decode_object (obj_value_t *val, struct json_object *obj, enum json_type type) |
|
The internal decode APIs and defines for JCFG.
Definition in file jcfg_decode.h.
◆ jcfg_list_add()
Add an object pointer to a jcfg_list_t structure
The jcfg_list_t.list array uses realloc() to grow the list as needed.
- Parameters
-
lst | The pointer to a jcfg_list_ structure |
obj | The object pointer to add to the list array. |
- Returns
- -1 on error or 0 - N for the location of the object in the array.
◆ _decode_defaults()
int _decode_defaults |
( |
struct json_object * |
obj, |
|
|
int |
flags, |
|
|
struct json_object * |
parent, |
|
|
const char * |
key, |
|
|
size_t * |
index, |
|
|
void * |
arg |
|
) |
| |
Decode the default,umem,lport, ... sections in the JSON file (private or internal)
These are private functions and each supports the different sections in the JSON file format.
- Parameters
-
obj | The json object to decode from JSON object |
flags | The flags used by the JSON-C parser |
parent | The JSON-C parent of this object. |
key | The pointer to the key value of the JSON object |
index | The new index value returned from JSON parsing to be placed in this index pointer location |
arg | The user supplied argument to be passed to the callback routines |
- Returns
- The JSON parsing flags are returned, including OK and error
◆ jcfg_decode_lport_groups_end()
int jcfg_decode_lport_groups_end |
( |
jcfg_info_t * |
jinfo, |
|
|
void * |
arg |
|
) |
| |
Finish lport_group decoding after all sections have been decoded
This function creates logical ports and assigns them to threads, which can only be done after all other sections have been decoded.
- Parameters
-
jinfo | The jcfg information structure pointer |
arg | The user supplied argument (currently unused) |
- Returns
- 0 on success or -1 on error
◆ __decoder_val_get()
int __decoder_val_get |
( |
obj_value_t * |
val, |
|
|
uint64_t * |
v |
|
) |
| |
Decoder value get routine for scalar object.
- Parameters
-
val | The obj_value_t pointer to extract the value into 'v' return pointer. |
v | The location to put the returned object value. |
- Returns
- 0 on success or -1 on error
◆ __decoder_array_val_get()
Decoder value get routine for array object.
- Parameters
-
val | The obj_value_t pointer to extract the values into 'arr' return pointer. |
arr | The location to put the array of returned object values. |
- Returns
- 0 on success or -1 on error
◆ __decode_object()
int __decode_object |
( |
obj_value_t * |
val, |
|
|
struct json_object * |
obj, |
|
|
enum json_type |
type |
|
) |
| |
Decode a common object given its type and value.
- Parameters
-
val | The object value pointer to decode the object from JSON to JCFG |
obj | The JSON object to decode |
type | The type of JSON object to decode |
- Returns
- 0 on success or -1 on error