Go to the source code of this file.
Typedefs | |
typedef struct fr_jpath_node | fr_jpath_node_t |
Functions | |
char * | fr_jpath_asprint (TALLOC_CTX *ctx, fr_jpath_node_t const *head) |
Print a node list to a string for debugging. More... | |
size_t | fr_jpath_escape_func (UNUSED REQUEST *request, char *out, size_t outlen, char const *in, UNUSED void *arg) |
Escapes special chars. More... | |
int | fr_jpath_evaluate_leaf (TALLOC_CTX *ctx, value_data_t **out, PW_TYPE dst_type, fr_dict_attr_t const *dst_enumv, json_object *root, fr_jpath_node_t const *jpath) |
Evaluate a parsed jpath expression against a json-c tree. More... | |
ssize_t | fr_jpath_parse (TALLOC_CTX *ctx, fr_jpath_node_t **head, char const *in, size_t inlen) |
Parse a jpath string. More... | |
size_t | fr_json_from_pair (char *out, size_t outlen, VALUE_PAIR const *vp) |
Prints attribute as string, escaped suitably for use as JSON string. More... | |
int | fr_json_object_to_value_data (TALLOC_CTX *ctx, value_data_t *out, json_object *object, PW_TYPE dst_type, fr_dict_attr_t const *dst_enumv) |
Convert json object to value_data_t. More... | |
void | fr_json_version_print (void) |
Print JSON-C version. More... | |
typedef struct fr_jpath_node fr_jpath_node_t |
char* fr_jpath_asprint | ( | TALLOC_CTX * | ctx, |
fr_jpath_node_t const * | head | ||
) |
Print a node list to a string for debugging.
Will not be identical to the original parsed string, but should be sufficient for testing purposes.
ctx | to allocate string in. |
head | of the node list. |
Definition at line 411 of file jpath.c.
size_t fr_jpath_escape_func | ( | UNUSED REQUEST * | request, |
char * | out, | ||
size_t | outlen, | ||
char const * | in, | ||
UNUSED void * | arg | ||
) |
Escapes special chars.
Escapes any characters that may have special meaning within a jpath expression
request | Current request (unused may be NULL). |
out | Where to write the escaped string. |
outlen | Length of the output buffer. |
in | data to escape. |
arg | uctx data, not used. |
Definition at line 110 of file jpath.c.
int fr_jpath_evaluate_leaf | ( | TALLOC_CTX * | ctx, |
value_data_t ** | out, | ||
PW_TYPE | dst_type, | ||
fr_dict_attr_t const * | dst_enumv, | ||
json_object * | root, | ||
fr_jpath_node_t const * | jpath | ||
) |
Evaluate a parsed jpath expression against a json-c tree.
Will produce one or more value_data_t structures of the desired type, or error out if the conversion between types fails.
[in,out] | ctx | to allocate value_data_t in. |
[out] | out | Where to write value_data_t. |
[in] | dst_type | FreeRADIUS type to convert to. |
[in] | dst_enumv | Enumeration values to allow string to integer conversions. |
[in] | root | of the json-c tree. |
[in] | jpath | to evaluate. |
Definition at line 379 of file jpath.c.
ssize_t fr_jpath_parse | ( | TALLOC_CTX * | ctx, |
fr_jpath_node_t ** | head, | ||
char const * | in, | ||
size_t | inlen | ||
) |
Parse a jpath string.
Based on the syntax described here http://goessner.net/articles/JsonPath/
Implements parser for everything except unions and expressions
Definition at line 817 of file jpath.c.
size_t fr_json_from_pair | ( | char * | out, |
size_t | outlen, | ||
VALUE_PAIR const * | vp | ||
) |
Prints attribute as string, escaped suitably for use as JSON string.
Returns < 0 if the buffer may be (or have been) too small to write the encoded JSON value to.
out | Where to write the string. |
outlen | Lenth of output buffer. |
vp | to print. |
Definition at line 150 of file json.c.
int fr_json_object_to_value_data | ( | TALLOC_CTX * | ctx, |
value_data_t * | out, | ||
json_object * | object, | ||
PW_TYPE | dst_type, | ||
fr_dict_attr_t const * | dst_enumv | ||
) |
Convert json object to value_data_t.
ctx | to allocate any value buffers in (should usually be the same as out). |
out | Where to write value_data. |
object | to convert. |
dst_type | FreeRADIUS type to convert to. |
dst_enumv | Enumeration values to allow string to integer conversions. |
Definition at line 42 of file json.c.