1 |
aramv |
530 |
#ifndef PDL_H |
2 |
|
|
#define PDL_H |
3 |
|
|
#include "nextgen.h" |
4 |
|
|
#include <stdio.h> |
5 |
|
|
|
6 |
|
|
#undef TRUE |
7 |
|
|
#undef FALSE |
8 |
|
|
#undef BOOL |
9 |
|
|
#define TRUE 1 |
10 |
|
|
#define FALSE (!TRUE) |
11 |
|
|
|
12 |
aramv |
573 |
extern const char* _pdl_path; |
13 |
aramv |
530 |
|
14 |
|
|
extern int yylex(void); |
15 |
aramv |
566 |
extern int yyparse(void); |
16 |
aramv |
530 |
extern FILE* yyin; |
17 |
|
|
FILE* file; |
18 |
aramv |
566 |
extern int yylex_destroy(void); |
19 |
aramv |
530 |
|
20 |
|
|
typedef struct record_s { |
21 |
|
|
char* string; //!< Hold the symbol that lex has found. |
22 |
|
|
int lineno; //!< Hold the line number the symbol has been found. |
23 |
|
|
} record_t; |
24 |
|
|
|
25 |
|
|
/*! |
26 |
|
|
* \brief Structure keeps track of the state and the true/false |
27 |
|
|
* braches. |
28 |
|
|
* |
29 |
|
|
*/ |
30 |
|
|
typedef struct rule_s { |
31 |
|
|
const char* state; //!< Name of the state. |
32 |
|
|
unsigned int lineno; //!< Line number where rule appeared. |
33 |
aramv |
566 |
struct rule_s* true_branch; //!< Name of the true_branch, or 0 if none. |
34 |
|
|
struct rule_s* false_branch; //!< Name of the false_branch, or 0 if none. |
35 |
aramv |
530 |
} rule_t; |
36 |
|
|
|
37 |
|
|
typedef struct policy_s { |
38 |
|
|
lcmaps_plugindl_t* current; |
39 |
|
|
lcmaps_plugindl_t* next_success; |
40 |
|
|
lcmaps_plugindl_t* next_failure; |
41 |
aramv |
566 |
struct rule_s* head_rule; |
42 |
aramv |
530 |
} policy_t; |
43 |
|
|
|
44 |
|
|
NG_RC pdl_init(const char*); |
45 |
|
|
NG_RC pdl_term(); |
46 |
|
|
record_t* concat_strings(record_t*, record_t*); |
47 |
aramv |
566 |
record_t* concat_strings_with_space(record_t*, record_t*); |
48 |
aramv |
530 |
|
49 |
|
|
int yyerror(const char*); |
50 |
|
|
void set_path(record_t*); |
51 |
|
|
void add_policy(record_t*, rule_t*); |
52 |
aramv |
566 |
rule_t* add_rule(record_t*, record_t*, record_t*); |
53 |
aramv |
530 |
const char* pdl_path(void); |
54 |
|
|
void remove_policy(record_t* policy); |
55 |
|
|
void add_variable(record_t* name, record_t* value); |
56 |
|
|
NG_RC allow_rules(int); |
57 |
|
|
NG_RC allowed_policy_rule(const char* label); |
58 |
|
|
|
59 |
|
|
#endif |