All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
json.c File Reference

Common functions for working with json-c. More...

#include <freeradius-devel/rad_assert.h>
#include "json.h"
+ Include dependency graph for json.c:

Go to the source code of this file.

Functions

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

Detailed Description

Common functions for working with json-c.

Id:
0451c64e51a15ffdaa9cdf251833255de0eee70c
Author
Arran Cudbard-Bell

Definition in file json.c.

Function Documentation

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.

Parameters
outWhere to write the string.
outlenLenth of output buffer.
vpto print.
Returns
  • Length of data written to out.
  • value >= outlen on truncation.

Definition at line 150 of file json.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

Parameters
ctxto allocate any value buffers in (should usually be the same as out).
outWhere to write value_data.
objectto convert.
dst_typeFreeRADIUS type to convert to.
dst_enumvEnumeration values to allow string to integer conversions.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 42 of file json.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void fr_json_version_print ( void  )

Print JSON-C version.

Definition at line 265 of file json.c.

+ Here is the caller graph for this function: