[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

A.3.2 grad_instr_conditional

(This message will disappear, once this node revised.)

Instruction: grad_instr_conditional_t cond iftrue iffalse
 
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.

RPL representation

RPL defun: COND expr if-true [if-false]
expr

Textual representation of Rewrite conditional expression or its entry point.

if-true

RPL expression executed if expr evaluates to t.

if-true

Optional RPL expression that is executed if expr evaluates to nil.

Example

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")))
     

This document was generated by Sergey Poznyakoff on December, 6 2008 using texi2html 1.78.