/[pdpsoft]/trunk/grid-mw-security/ees/src/eval_man/pdl.c
ViewVC logotype

Contents of /trunk/grid-mw-security/ees/src/eval_man/pdl.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 526 - (show annotations) (download) (as text)
Wed Jul 15 09:15:06 2009 UTC (12 years, 11 months ago) by aramv
File MIME type: text/x-chdr
File size: 2227 byte(s)
Added pdl yacc/lex files
1 #include <stdio.h>
2 #include "pdl.h"
3 #include "ng_log.h"
4 #include <stdlib.h>
5
6 NG_RC pdl_init(const char* name){
7 if((file = fopen(name,"r")) != NULL){
8 yyin = file;
9 return NG_SUCCESS;
10 } else {
11 ng_log(LOG_ERR, "Failed to open policy file");
12 return NG_FAILURE;
13 }
14 }
15
16 record_t* concat_strings(record_t* r1, record_t* r2){
17 /*record_t* new_record;*/
18 /*new_record = malloc(sizeof(record_t));*/
19 /*new_record->string = malloc(sizeof(char)*(strlen(r1->string) + strlen(r2->string)));*/
20 /*strcat(new_record->string, r2->string);*/
21 /*return new_record;*/
22 /*free(r1->string);*/
23 free(r1);
24 /*free(r2->string);*/
25 free(r2);
26 return NULL;
27 }
28
29 int yyerror(const char* string){
30 return ng_log(LOG_ERR, string);
31 }
32
33 void set_path(record_t* path){
34 /*ng_log(LOG_ERR, "Found a new path: %s\n", path->string);*/
35 /*free(path);*/
36 }
37
38 void add_policy(record_t* policy, rule_t* rule){
39 ng_log(LOG_ERR, "Found a new policy: %s\n", policy->string);
40 /*ng_log(LOG_ERR, "Found a new rule: %s\n", rule->string);*/
41 free(policy->string);
42 free(policy);
43 /*free(rule->true_branch);*/
44 /*free(rule->false_branch);*/
45 /*free(rule);*/
46 }
47
48 const char* pdl_path(){
49 return _pdl_path;
50 }
51
52 rule_t* add_rule(record_t* state, record_t* true_branch, record_t* false_branch){
53 ng_log(LOG_ERR, "Added a new rule: %s\n", state->string);
54 ng_log(LOG_ERR, "True branch: %s\n", true_branch->string);
55 /*ng_log(LOG_ERR, "False branch: %s\n", false_branch->string);*/
56 free(state->string);
57 free(state);
58 free(true_branch->string);
59 free(true_branch);
60 /*free(false_branch->string);*/
61 free(false_branch);
62 }
63
64 void remove_policy(record_t* policy){
65 ng_log(LOG_ERR, "Deleted policy: %s\n", policy->string);
66 free(policy->string);
67 free(policy);
68 }
69
70 void add_variable(record_t* name, record_t* value){
71 ng_log(LOG_ERR, "Added variable name: %s\n", name->string);
72 /*ng_log(LOG_ERR, "Added variable value: %s\n", value->string);*/
73 free(name->string);
74 free(name);
75 /*free(value->string);*/
76 free(value);
77 }
78
79 NG_RC pdl_term(){
80 if((fclose(file)==0) ){
81 yylex_destroy();
82 return NG_SUCCESS;
83 } else {
84 return NG_FAILURE;
85 }
86 }
87
88 NG_RC allow_rules(int val){
89
90 }
91
92 NG_RC allowed_policy_rule(const char* label){
93
94 }

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