Parses JSON responses.
More...
#include <freeradius-devel/radiusd.h>
#include <freeradius-devel/modules.h>
#include <freeradius-devel/map_proc.h>
#include <freeradius-devel/rad_assert.h>
#include <ctype.h>
#include "json.h"
Go to the source code of this file.
|
static int | _json_map_proc_get_value (TALLOC_CTX *ctx, VALUE_PAIR **out, REQUEST *request, vp_map_t const *map, void *uctx) |
| Converts a string value into a VALUE_PAIR. More...
|
|
static ssize_t | jpath_validate_xlat (char **out, size_t outlen, UNUSED void const *mod_inst, UNUSED void const *xlat_inst, REQUEST *request, char const *fmt) |
| Determine if a jpath expression is valid. More...
|
|
static int | mod_bootstrap (UNUSED CONF_SECTION *conf, void *instance) |
|
static rlm_rcode_t | mod_map_proc (UNUSED void *mod_inst, void *proc_inst, REQUEST *request, char const *src, vp_map_t const *maps) |
| Parses a JSON string, and executes jpath queries against it to map values to attributes. More...
|
|
static int | mod_map_proc_instantiate (void *proc_inst, UNUSED void *mod_inst, UNUSED vp_tmpl_t const *src, vp_map_t const *maps) |
| Pre-parse and validate literal jpath expressions for maps. More...
|
|
Parses JSON responses.
- Id:
- 4610c92d83fcf2d3fe6b0287bf7292cb8dc59675
- Author
- Arran Cudbard-Bell
- Copyright
- 2015 Arran Cudbard-Bell a.cud.nosp@m.bard.nosp@m.b@fre.nosp@m.erad.nosp@m.ius.o.nosp@m.rg
-
2015 Network RADIUS SARL info@.nosp@m.netw.nosp@m.orkra.nosp@m.dius.nosp@m..com
-
2015 The FreeRADIUS Server Project
Definition in file rlm_json.c.
struct rlm_json_jpath_cache |
struct rlm_json_jpath_to_eval |
Forms a linked list of jpath head node pointers (a list of jpaths)
Definition at line 44 of file rlm_json.c.
static int _json_map_proc_get_value |
( |
TALLOC_CTX * |
ctx, |
|
|
VALUE_PAIR ** |
out, |
|
|
REQUEST * |
request, |
|
|
vp_map_t const * |
map, |
|
|
void * |
uctx |
|
) |
| |
|
static |
Converts a string value into a VALUE_PAIR.
- Parameters
-
[in,out] | ctx | to allocate VALUE_PAIR (s). |
[out] | out | where to write the resulting VALUE_PAIR. |
[in] | request | The current request. |
[in] | map | to process. |
[in] | uctx | The json tree/jpath expression to evaluate. |
- Returns
- 0 on success.
- -1 on failure.
Definition at line 177 of file rlm_json.c.
static ssize_t jpath_validate_xlat |
( |
char ** |
out, |
|
|
size_t |
outlen, |
|
|
UNUSED void const * |
mod_inst, |
|
|
UNUSED void const * |
xlat_inst, |
|
|
REQUEST * |
request, |
|
|
char const * |
fmt |
|
) |
| |
|
static |
Determine if a jpath expression is valid.
- Parameters
-
mod_inst | data. |
xlat_inst | data. |
out | Where to write the output (in the format<bytes parsed>[:error] ). |
outlen | How big out is. |
request | The current request. |
fmt | jpath expression to parse. |
- Returns
- number of bytes written to out.
Definition at line 65 of file rlm_json.c.
Parses a JSON string, and executes jpath queries against it to map values to attributes.
- Parameters
-
mod_inst | unused. |
proc_inst | cached jpath sequences. |
request | The current request. |
src | string to parse. |
maps | Head of the map list. |
- Returns
-
Definition at line 229 of file rlm_json.c.
Pre-parse and validate literal jpath expressions for maps.
- Parameters
-
[out] | proc_inst | the cache structure to fill. |
[in] | mod_inst | module instance (unused). |
[in] | src | Where to get the JSON data from (unused). |
[in] | maps | set of maps to translate to jpaths. |
- Returns
-
Definition at line 98 of file rlm_json.c.
Initial value:= {
.name = "json",
}
#define RLM_TYPE_THREAD_SAFE
Module is threadsafe.
static int mod_bootstrap(UNUSED CONF_SECTION *conf, void *instance)
Definition at line 327 of file rlm_json.c.