/[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 1235 - (show annotations) (download) (as text)
Fri Dec 4 11:35:24 2009 UTC (12 years, 10 months ago) by aramv
File MIME type: text/x-csrc
File size: 3629 byte(s)
Moved around control logic of the parser to stop and report errors if they are encountered
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_modules_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
28 #if HAVE_CONFIG_H
29 #include "config.h"
30 #endif
31 #if HAVE_STDIO_H
32 #include <stdio.h>
33 #endif
34 #if HAVE_STDLIB_H
35 #include <stdlib.h>
36 #endif
37 #include "plugin_manager.h"
38 #include "eef_polytypes.h"
39 #include "eef_log.h"
40
41 #define TRUE 1
42 #define FALSE 0
43
44 /* lifecycle functions */
45 EES_RC start_pdl_parser(char *config_file, int number_of_policies, char* names_of_policies[]);
46 EES_RC wrap_yacc(const char* config_file);
47 EES_RC pdl_term(policy_t* policies);
48 EES_RC add_plugin_structs(void);
49
50 policy_t* get_policies(void);
51 policy_t* reduce_policies(policy_t* policies, int number_of_policies, char* names_of_policies[]);
52 EES_RC link_rules_to_plugins(policy_t* policies);
53 void link_rule_to_plugin(policy_t *policy, rule_t *rule);
54
55 EES_RC clean_variables_list(void);
56 EES_RC clean_policies_list(policy_t* policies);
57 rule_t* clean_rules_list(rule_t*);
58 rule_t* clean_rules_tree(rule_t*);
59
60 /* callback functions */
61 void set_pdl_path(record_t*);
62 void add_policy(record_t*, rule_t*);
63 rule_t * add_rule(record_t*, record_t*, record_t*);
64 const char * get_pdl_path(void);
65 void remove_policy(record_t* policy);
66 policy_t* remove_policy_by_name(policy_t* policies, char* policy);
67 void add_variable(record_t* name, record_t* value);
68 EES_RC allow_rules(int);
69 EES_RC allowed_policy_rule(const char* label);
70
71 /* convenience methods used by the lexer */
72 record_t * concat_strings(record_t*, record_t*);
73 record_t * concat_strings_with_space(record_t*, record_t*);
74 char ** _var_to_argv(char*, int*);
75 var_t* get_variable_by_name(char*);
76 rule_t* get_left_hand_rule(rule_t*, const char*);
77 rule_t* get_right_hand_rule(rule_t*, const char*);
78 rule_t* check_for_recursion(rule_t*, rule_t*);
79 void free_args(int argc, char** argv);
80 void link_dead_end_rules_in_policies(policy_t* policy);
81 void link_dead_end_rules(policy_t* policy, rule_t* rule);
82 EES_RC remove_unreachable_rules_in_policies(policy_t* policies);
83 rule_t* remove_unreachable_rules(rule_t* rules, EES_RC*);
84
85
86 /* Lex/Yacc stuff */
87 int yyerror(char*);
88 void set_yylval(record_t* r);
89
90 /* debug functions */
91 void print_policies(policy_t* policies);
92 void print_rules(policy_t* policy, rule_t* rules);
93
94 #endif

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