Functions

switch.c File Reference

SIP-router core ::Module: SIP-router core. More...

#include "switch.h"
#include "rvalue.h"
#include "route.h"
#include "mem/mem.h"
#include "error.h"
Include dependency graph for switch.c:

Go to the source code of this file.

Functions


Detailed Description

Definition in file switch.c.


Function Documentation

static int fix_match ( struct action *  t  )  [static]

can produce 3 different action types:

  • BLOCK_T (actions) - actions grouped in a block, break ends the block execution.
  • EVAL_T (cond) - null switch block, but the condition has to be evaluated due to possible side-effects.
  • MATCH_COND_T(cond, jumps) - condition table

Definition at line 422 of file switch.c.

References _str::len, mk_match_cond_table(), rval_destroy(), rval_expr_eval(), rval_get_str(), rve_destroy(), rve_has_side_effects(), rve_is_constant(), _str::s, and scr_opt_lev.

Referenced by fix_switch().

Here is the call graph for this function:

Here is the caller graph for this function:

int fix_switch ( struct action *  t  ) 

can produce 4 different action types:

  • BLOCK_T (actions) - actions grouped in a block, break ends the block execution.
  • EVAL_T (cond) - null switch block, but the condition has to be evaluated due to possible side-effects.
  • SWITCH_COND_T(cond, jumps) - condition table
  • SWITCH_JT_T(cond, jumptable) - jumptable + condition table TODO: external optimizers that would "flatten" BLOCK_T w/no breaks or breaks at the end.

Definition at line 150 of file switch.c.

References fix_match(), mk_switch_cond_table(), mk_switch_jmp_table(), rval_expr_eval_int(), rve_destroy(), rve_has_side_effects(), rve_is_constant(), and scr_opt_lev.

Here is the call graph for this function:

static struct match_cond_table* mk_match_cond_table ( int  n  )  [static, read]
Returns:
0 on error, pointer on success

Definition at line 98 of file switch.c.

Referenced by fix_match().

Here is the caller graph for this function:

static struct switch_cond_table* mk_switch_cond_table ( int  n  )  [static, read]
Returns:
0 on error, pointer on success

Definition at line 47 of file switch.c.

Referenced by fix_switch().

Here is the caller graph for this function:

static struct switch_jmp_table* mk_switch_jmp_table ( int  jmp_size,
int  rest 
) [static, read]
Parameters:
jmp_size - size of the jump table
rest - size of the fallback condition table
Returns:
0 on error, pointer on success

Definition at line 71 of file switch.c.

Referenced by fix_switch().

Here is the caller graph for this function: