#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lcmaps_log.h"
#include "pdl_rule.h"
#include "pdl_policy.h"
#include "pdl_variable.h"
Include dependency graph for pdl_rule.c:
Go to the source code of this file.
Functions | |
rule_t* | _add_rule (const record_t *state, const record_t *true_branch, const record_t *false_branch) |
const rule_t* | find_state (const rule_t *rule, const char *state) |
int | find_insert_position (const int *list, const int rule_number, unsigned int high) |
unsigned int | rule_number (const rule_t *rule) |
BOOL | make_list (int *new_list, const int *list, const int rule_number, const unsigned int depth) |
unsigned int | count_rules (const rule_t *rule) |
void | update_list (unsigned int *rules, unsigned int rule) |
const rule_t* | get_rule_number (unsigned int rule_num) |
void | start_new_rules (void) |
void | allow_new_rules (BOOL allow) |
rule_t* | add_rule (record_t *state, record_t *true_branch, record_t *false_branch) |
BOOL | check_rule_for_recursion (const rule_t *rule) |
recursion_t | has_recursion (const rule_t *rule, int *list, unsigned int depth, unsigned int *seen_rules) |
void | reduce_rule (rule_t *rule) |
void | show_rules (const rule_t *rule) |
void | free_rules (rule_t *rule) |
const rule_t* | get_top_rule (void) |
void | set_top_rule (const rule_t *rule) |
Definition in file pdl_rule.c.
|
Rules come in three different forms:
Definition at line 144 of file pdl_rule.c. Referenced by add_rule().
|
|
Add a new rule to the list of rules. This function acts as a wrapper function for _add_rule().
Definition at line 86 of file pdl_rule.c. |
|
Is it allowed to add new rules?
Definition at line 71 of file pdl_rule.c. |
|
Check the rule for occurances of recursion.
Definition at line 220 of file pdl_rule.c. |
|
Count the number of rules that follow 'rule' inclusive.
Definition at line 257 of file pdl_rule.c. Referenced by check_rule_for_recursion().
|
|
Based on a sorted list, find the position where to insert an new element without disturbing the ordering in the list. The search is a binary search.
Definition at line 488 of file pdl_rule.c. Referenced by make_list(), and update_list().
|
|
Find a state with name state.
Definition at line 202 of file pdl_rule.c. |
|
Free all resource associated with the rule.
Definition at line 637 of file pdl_rule.c. |
|
Give the position of the rule in the policy, return that rule.
Definition at line 278 of file pdl_rule.c. Referenced by check_rule_for_recursion().
|
|
Get the top rule.
Definition at line 658 of file pdl_rule.c. |
|
Check the a rule for recursion. This is done in a recursive manner. From the top rule, all possible paths are considered. Each path becomes a top of its own and from their all possible paths are traveled. Each time the tree is searched at a greater depth, a list is kept to tell which states have been seen for the current path. In this list of states no duplicates should be present. If a seen state state already appears in the list, the path taken is recursive. This information is propagated back up the traveled tree. At the same time another list is maintained. In this list all visited states are remembered. Duplicates are not added. When all possible paths have been traveled, the list tells all visited rules. When a particular rule is not part of the tree, it is also not listed in the list. This way one can check for disconnected rules.
Definition at line 318 of file pdl_rule.c. Referenced by check_rule_for_recursion().
|
|
Make a new sorted list based on the current list and the element to be inserted. The element will only be added to the list if it is not already present.
Definition at line 526 of file pdl_rule.c. Referenced by has_recursion().
|
|
Reduce a rule to its elementry form, i.e. all variables in the rule are substituted by their respective values.
Definition at line 558 of file pdl_rule.c. |
|
Given a rule, find the corresponding position in the policy.
Definition at line 425 of file pdl_rule.c. Referenced by has_recursion().
|
|
Set the top rule to a new value.
Definition at line 670 of file pdl_rule.c. |
|
Show a rule and its descendants.
Definition at line 615 of file pdl_rule.c. |
|
Start a new list of rules. Definition at line 58 of file pdl_rule.c. Referenced by add_policy().
|
|
Update the list that hold the visited rules. This is a sorted list for easy insertion and look-up. Duplicate rules are not inserted. The first element of the list tells the total number of elements that follow.
Definition at line 453 of file pdl_rule.c. Referenced by has_recursion().
|