Next: grad_instr_call, Previous: Request-processing Instruction, Up: Proposed Solution [Contents][Index]
struct grad_instr_conditional
{
grad_entry_point_t cond; /* Entry point to the compiled
Rewrite condition */
grad_instr_t *iftrue; /* Points to the ``true'' branch */
grad_instr_t *iffalse; /* Points to the ``false'' branch */
};
typedef struct grad_instr_conditional grad_instr_conditional_t;
Instructions of type grad_instr_conditional_t indicate branching.
Upon encountering an grad_instr_conditional_t, the
engine executes a Rewrite expression pointed to by cond.
If the expression evaluates to true, execution branches to
instruction iftrue. Otherwise, if iffalse is not NULL,
execution branches to that instruction. Otherwise, the control flow
passes to grad_instr_t.next, as described in the previous section.
Textual representation of Rewrite conditional expression or its entry point.
RPL expression executed if expr evaluates to t.
Optional RPL expression that is executed if expr evaluates to
nil.
COND with two arguments:
(COND "%[User-Name] ~= \"test-.*\""
(REPLY Access-Reject ("Reply-Message" . "Test accounts disabled")))
COND with three arguments:
(COND "%[Hint] == "PPP" && authorize(PAM)"
(REPLY Access-Accept
("Service-Type" . "Framed-User")
("Framed-Protocol" . "PPP"))
(REPLY Access-Reject
("Reply-Message" . "Access Denied")))