/[pdpsoft]/trunk/grid-mw-security/ees/include/common/pdl.h
ViewVC logotype

Contents of /trunk/grid-mw-security/ees/include/common/pdl.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 891 - (show annotations) (download) (as text)
Sun Oct 11 14:00:29 2009 UTC (12 years, 3 months ago) by aramv
File MIME type: text/x-csrc
File size: 3543 byte(s)
Moved config_file_ok variable into C file
1 /*!
2
3 \file pdl.h
4 \brief Callback functions for parser of the evaluation manager
5 \author Aram Verstegen
6
7 This header contains some callback functions used for the PDL parser:
8 It contains the following functions:
9
10 -# pdl_init(const char*): Inilizes the parser
11 -# pdl_term(void): terminates the parser
12 -# set_path(record_t*): sets the path to use for plug-ins (used by the parser)
13 -# get_pdl_path(void): returns the path read from the config file or empty string if none was parsed
14 -# add_policy(record_t*, rule_t*): adds a new policy
15 -# add_rule(record_t*, record_t*, record_t*): adds a new rule
16 -# remove_policy(record_t* policy): removes a policy
17 -# add_variable(record_t* name, record_t* value): adds a variable (plug-in) to the list
18 -# allow_rules(int):
19 -# allowed_policy_rule(const char* label):
20
21 -# concat_strings(record_t*, record_t*): concatenates two strings
22 -# concat_strings_with_space(record_t*, record_t*): concatenates two strings separated by a space
23 */
24
25 #ifndef PDL_H
26 #define PDL_H
27 #if HAVE_CONFIG_H
28 #include "config.h"
29 #endif
30 #if HAVE_STDIO_H
31 #include <stdio.h>
32 #endif
33 #if HAVE_STDLIB_H
34 #include <stdlib.h>
35 #endif
36 #include "plugin_manager.h"
37 #include "eef_log.h"
38
39 #undef TRUE
40 #undef FALSE
41 #undef BOOL
42 #define TRUE 1
43 #define FALSE (!TRUE)
44
45 /*!
46 * \brief Structure for symbols used by the parser internally
47 */
48 typedef struct record_s {
49 char* string; /*!< Hold the symbol that lex has found. */
50 int lineno; /*!< Hold the line number the symbol has been found. */
51 } record_t;
52
53 /*!
54 * \brief Structure to make a tree of
55 *
56 */
57 typedef struct rule_s {
58 const char* state; /*!< Name of the state.*/
59 unsigned int lineno; /*!< Line number where rule appeared. */
60 struct rule_s* true_branch; /*!< Name of the true_branch, or 0 if none. */
61 struct rule_s* false_branch; /*!< Name of the false_branch, or 0 if none. */
62 } rule_t;
63
64 /*!
65 * \brief Structure to build a tree of plugins as defined in a policy in the config file
66 */
67 typedef struct policy_s {
68 eef_plugindl_t* current;
69 eef_plugindl_t* next_success;
70 eef_plugindl_t* next_failure;
71 struct rule_s* head_rule;
72 } policy_t;
73
74 /*!
75 * \brief Structure keeps track of the variables, their value and the line number they are defined on.
76 */
77 typedef struct var_s {
78 const char* name; /*!< Name of the variable. */
79 char* value; /*!< Value of the variable. */
80 unsigned int lineno; /*!< Line number the variable appears on. */
81 struct var_s* next; /*!< Next variable, or 0 if none. */
82 } var_t;
83
84 /* lifecycle functions */
85 EES_RC pdl_init(const char*);
86 EES_RC pdl_term(void);
87 EES_RC clean_variables(void);
88 EES_RC initialize_plugins(void);
89
90 /* callback functions */
91 void set_path(record_t*);
92 void add_policy(record_t*, rule_t*);
93 rule_t * add_rule(record_t*, record_t*, record_t*);
94 const char * get_pdl_path(void);
95 void remove_policy(record_t* policy);
96 void add_variable(record_t* name, record_t* value);
97 EES_RC allow_rules(int);
98 EES_RC allowed_policy_rule(const char* label);
99
100 /* convenience methods used by the lexer */
101 record_t * concat_strings(record_t*, record_t*);
102 record_t * concat_strings_with_space(record_t*, record_t*);
103 char ** _var_to_argv(char*, int*);
104
105
106 /* Lex/Yacc stuff */
107 int yyerror(char*);
108 void set_yylval(record_t* r);
109
110 #endif

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28