size_t at_in = fr_sbuff_used_total(out);
xlat_rcode_inst_t *inst = instance;
- FR_SBUFF_IN_STRCPY_LITERAL_RETURN(out, "%expr.rcode('");
+ FR_SBUFF_IN_STRCPY_LITERAL_RETURN(out, "%interpreter.rcode('");
if (xlat_exp_head(node->call.args)) {
ssize_t slen;
*
* Example:
@verbatim
-%expr.rcode('handled') == true
+%interpreter.rcode('handled') == true
# ...or how it's used normally used
if (handled) {
XLAT_REGISTER_NARY_OP(T_LAND, logical_and, logical);
XLAT_REGISTER_NARY_OP(T_LOR, logical_or, logical);
+ XLAT_REGISTER_BOOL("interpreter.rcode", xlat_func_expr_rcode, xlat_func_expr_rcode_arg, FR_TYPE_BOOL);
+ xlat_func_instantiate_set(xlat, xlat_instantiate_expr_rcode, xlat_rcode_inst_t, NULL, NULL);
+ xlat_func_print_set(xlat, xlat_expr_print_rcode);
+
XLAT_REGISTER_BOOL("expr.rcode", xlat_func_expr_rcode, xlat_func_expr_rcode_arg, FR_TYPE_BOOL);
+ xlat->deprecated = true;
xlat_func_instantiate_set(xlat, xlat_instantiate_expr_rcode, xlat_rcode_inst_t, NULL, NULL);
xlat_func_print_set(xlat, xlat_expr_print_rcode);
/*
* @todo - allow for attributes to have the name "ok-foo" ???
*/
- func = xlat_func_find("expr.rcode", -1);
+ func = xlat_func_find("interpreter.rcode", -1);
fr_assert(func != NULL);
MEM(node = xlat_exp_alloc(head, XLAT_FUNC, fr_sbuff_start(&our_in), slen));
# sillyness is OK, but cleaned up.
condition ((((((ok))))))
-match %expr.rcode('ok')
+match %interpreter.rcode('ok')
#
# Extra braces get squashed
match (User-Name == User-Password)
condition (!ok)
-match !%expr.rcode('ok')
+match !%interpreter.rcode('ok')
condition !(ok)
-match !%expr.rcode('ok')
+match !%interpreter.rcode('ok')
condition !!ok
match ERROR offset 1: Double operator is invalid
# @todo - peephole - do optimization to get rid of double negation?
#
condition !(!ok)
-match !!%expr.rcode('ok')
+match !!%interpreter.rcode('ok')
#
# These next two are identical after normalization
match ERROR passed in 43, returned 42
condition (handled && (Packet-Type == ::Access-Challenge))
-match (%expr.rcode('handled') && (Packet-Type == ::Access-Challenge))
+match (%interpreter.rcode('handled') && (Packet-Type == ::Access-Challenge))
# This is OK, without the braces
condition handled && Packet-Type == ::Access-Challenge
-match (%expr.rcode('handled') && (Packet-Type == ::Access-Challenge))
+match (%interpreter.rcode('handled') && (Packet-Type == ::Access-Challenge))
# and this, though it's not a good idea.
condition handled &&&Packet-Type == ::Access-Challenge
-match (%expr.rcode('handled') && (Packet-Type == ::Access-Challenge))
+match (%interpreter.rcode('handled') && (Packet-Type == ::Access-Challenge))
condition reply == request
match ERROR offset 0: Cannot use list references in condition
# Module return codes are OK
#
condition (ok)
-match %expr.rcode('ok')
+match %interpreter.rcode('ok')
condition (handled)
-match %expr.rcode('handled')
+match %interpreter.rcode('handled')
condition (fail)
-match %expr.rcode('fail')
+match %interpreter.rcode('fail')
condition ("a")
match "a"
# rcode tests
#
xlat_purify handled && (User-Name == "bob")
-match (%expr.rcode('handled') && (User-Name == "bob"))
+match (%interpreter.rcode('handled') && (User-Name == "bob"))
xlat_purify (User-Name == "bob") && (User-Password == "bob") && handled
-match ((User-Name == "bob") && (User-Password == "bob") && %expr.rcode('handled'))
+match ((User-Name == "bob") && (User-Password == "bob") && %interpreter.rcode('handled'))
xlat_purify handledx
match ERROR offset 0: Attribute 'handledx' not found. Searched in: RADIUS, internal: Unresolved attributes are not allowed here
xlat_purify handled
-match %expr.rcode('handled')
+match %interpreter.rcode('handled')
#
# Automatic casting
# These are just booleans now. We can subtract and invert them.
#
xlat_purify -fail
-match -%expr.rcode('fail')
+match -%interpreter.rcode('fail')
xlat_purify ~fail
-match ~%expr.rcode('fail')
+match ~%interpreter.rcode('fail')
xlat_purify !fail
-match !%expr.rcode('fail')
+match !%interpreter.rcode('fail')
#
# Casts and such