Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

pdl.h File Reference

General include file. More...

#include <stdio.h>

Go to the source code of this file.

Data Structures

struct  plugin_s
 Structure holds a plugin name and its arguments, as well as the line number the plugin is first mentioned. More...

struct  record_s
 Structure is used to keep track of strings and the line they appear on. More...


Defines

#define TRUE   1

Typedefs

typedef record_s record_t
 Structure is used to keep track of strings and the line they appear on.

typedef plugin_s plugin_t
 Structure holds a plugin name and its arguments, as well as the line number the plugin is first mentioned.


Enumerations

enum  pdl_error_t {
  PDL_UNKNOWN, PDL_INFO, PDL_WARNING, PDL_ERROR,
  PDL_SAME
}
enum  plugin_status_t { EVALUATION_START, EVALUATION_SUCCESS, EVALUATION_FAILURE }

Functions

int pdl_init (const char *name)
const char * pdl_path (void)
int yyparse_errors (void)
int yyerror (const char *)
void set_path (record_t *_path)
record_tconcat_strings (record_t *s1, record_t *s2)
record_tconcat_strings_with_space (record_t *s1, record_t *s2)
const plugin_tget_plugins (void)
void warning (pdl_error_t error, const char *s,...)
void free_resources (void)
const char * pdl_next_plugin (plugin_status_t status)

Variables

unsigned int lineno
 The first line of a configuration sctipt is labeled 1.


Detailed Description

General include file.

In this include file all general "things" can be found.

Author:
G.M. Venekamp (venekamp@nikhef.nl)
Version:
Revision
1.17
Date:
Date
2004/12/01 14:48:37

Definition in file pdl.h.


Define Documentation

#define TRUE   1
 

The evaluation manager defines its own boolean type. It first undefines any existing type defenitions before it defines it itself.

Definition at line 51 of file pdl.h.

Referenced by _add_policy(), _add_variable(), allowed_policy_rule(), check_policies_for_recursion(), check_rule_for_recursion(), free_path(), getPluginNameAndArgs(), make_list(), pdl_init(), plugin_exists(), reduce_policies(), reduce_to_var(), and warning().


Typedef Documentation

typedef struct record_s record_t
 

Structure is used to keep track of strings and the line they appear on.

When lex finds a match, this structure is used to keep track of the relevant information. The matchig string as well as the line number are saved. The line number can be used for later references when an error related to the symbol has occured. This allows for easier debugging of the configuration file.

Referenced by _add_policy(), _add_rule(), _add_variable(), _concat_strings(), _set_path(), add_policy(), add_rule(), add_variable(), concat_strings(), concat_strings_with_space(), remove_policy(), and set_path().


Enumeration Type Documentation

enum pdl_error_t
 

Different levels of error logging.

Enumeration values:
PDL_UNKNOWN  Unknown error level.
PDL_INFO  Informational level.
PDL_WARNING  Warning level.
PDL_ERROR  Error level.
PDL_SAME  Repeat the previous level.

Definition at line 59 of file pdl.h.

enum plugin_status_t
 

Guide the selection of the next plugin.

Enumeration values:
EVALUATION_START  The evaluation process has just started.
EVALUATION_SUCCESS  The evaluation of the plugin was successful.
EVALUATION_FAILURE  The evaluation of the plugin was unsuccessfyl.

Definition at line 72 of file pdl.h.

Referenced by runEvaluationManager().


Function Documentation

record_t* concat_strings record_t s1,
record_t s2
 

Concatenate two strings. The orginal two strings are freed. When the concatenation fails, the origial strings are still freed. The actual concatenation is done by _concat_strings().

Parameters:
s1 first half of the string.
s2 second half of the string.
Returns:
new string which is the concatenation of s1 and s2.

Definition at line 451 of file pdl_main.c.

References _concat_strings(), record_t, and record_s::string.

record_t* concat_strings_with_space record_t s1,
record_t s2
 

Concatenate two strings. The orginal two strings are freed. When the concatenation fails, the origial strings are still freed. The actual concatenation is done by _concat_strings().

Parameters:
s1 First string.
s2 Second string
Returns:
Concatenated strings of s1 + s2.

Definition at line 507 of file pdl_main.c.

References _concat_strings(), record_t, and record_s::string.

void free_resources void   ) 
 

Free the resources.

Definition at line 671 of file pdl_main.c.

References free_path(), free_plugins(), free_policies(), free_variables(), script_name, and top_plugin.

Referenced by stopEvaluationManager().

const plugin_t* get_plugins void   ) 
 

Get a list of plugins as known by the configuration file.

Returns:
Plugin list (linked list).

Definition at line 154 of file pdl_main.c.

References rule_s::false_branch, FALSE_BRANCH, get_policies(), lcmaps_log(), lcmaps_log_debug(), policy_s::name, rule_s::next, policy_s::next, plugin_t, policies_have_been_reduced(), policy_t, policy_s::rule, rule_t, rule_s::state, STATE, top_plugin, rule_s::true_branch, and TRUE_BRANCH.

Referenced by getPluginNameAndArgs().

int pdl_init const char *  name  ) 
 

Init the pdl engine. The function takes one argument, the name of a configuration file to use.

Parameters:
name Name of the configuration file to use.
Returns:
0 in case the initialization is successful; -1 in case of not being successful.

Definition at line 93 of file pdl_main.c.

References d_path, default_path, free_plugins(), level_str, parse_error, path, PDL_ERROR, PDL_INFO, PDL_UNKNOWN, PDL_WARNING, script_name, top_plugin, TRUE, and warning().

Referenced by startEvaluationManager().

const char* pdl_next_plugin plugin_status_t  status  ) 
 

Find the next plugin to evaluate based on the return status of the previous plugin evaluation. There are three statuses, two of which are rather obvious: either the previous evaluation has succeeded (EVALUATION_SUCCESS), or it has failed (EVALUATION_FAILURE). Based on these results, the next plugin should be the true_branch or false_branch respectively. There is one situation where there is no previous evaluation and that is at the very beginning. The very first call to this function should have (EVALUATION_START) as arguments. In this case the current state of the rule is returned as the next plugin to evaluate.

Parameters:
status Status of previous evaluation.
Returns:
plugin name to be evaluation according to the configuration file.

Definition at line 557 of file pdl_main.c.

References EVALUATION_FAILURE, EVALUATION_START, EVALUATION_SUCCESS, rule_s::false_branch, find_state(), get_policies(), lcmaps_log_debug(), policy_s::name, policy_s::next, PDL_ERROR, pdl_path(), resetCredentialData(), policy_s::rule, rule_s::state, rule_s::true_branch, and warning().

Referenced by runEvaluationManager().

const char* pdl_path void   ) 
 

Get the path.

Returns:
Path.

Definition at line 364 of file pdl_main.c.

References path.

Referenced by getPluginNameAndArgs(), and pdl_next_plugin().

void set_path record_t path  ) 
 

Function is called when the parser has found the value of the reserved path word. This function acts as a wrapper for the _set_path() function.

Parameters:
path 

Definition at line 394 of file pdl_main.c.

References _set_path(), path, and record_t.

void warning pdl_error_t  error,
const char *  s,
... 
 

Display a warning message.

Parameters:
error Severity of the error.
s The text string.
... Additional values; much like printf(char *, ...);

Definition at line 710 of file pdl_main.c.

References lcmaps_log(), level_str, lineno, parse_error, PDL_ERROR, PDL_SAME, PDL_UNKNOWN, script_name, and TRUE.

Referenced by _add_policy(), _add_rule(), _add_variable(), _concat_strings(), _set_path(), check_rule_for_recursion(), has_recursion(), pdl_init(), pdl_next_plugin(), reduce_to_var(), and yyerror().

int yyerror const char *  s  ) 
 

When yacc encounters an error during the parsing process of the configuration file, it calls yyerror(). The actual message formatting is done in waring();

Parameters:
s error string.

Definition at line 377 of file pdl_main.c.

References PDL_ERROR, and warning().

int yyparse_errors void   ) 
 

Tell if there were errors/warning during parsing.

Returns:
0, if the are no errors/warnings, -1 otherwise.

Definition at line 142 of file pdl_main.c.

References parse_error.

Referenced by startEvaluationManager().


Generated on Sun May 29 21:22:13 2005 for lcmaps by doxygen 1.3.5