/[pdpsoft]/trunk/grid-mw-security/ees/src/eef/eef_common.c
ViewVC logotype

Annotation of /trunk/grid-mw-security/ees/src/eef/eef_common.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1495 - (hide annotations) (download) (as text)
Wed Feb 10 15:05:18 2010 UTC (12 years, 4 months ago) by aramv
File MIME type: text/x-chdr
File size: 2374 byte(s)
Added module for EICs, moved -L flag to CFLAGS - time to test with ETICS
1 aramv 1421 #include "eef_library.h"
2 aramv 1495 #include "eef_xacml_parser.h"
3 aramv 586 #include "pdl.h"
4 aramv 484 #include "plugin_manager.h"
5 aramv 429
6 aramv 1495 static const char* _modules_path; /*! Holds the global path to plug-in modules */
7 aramv 844
8 aramv 1464 /**
9     * Try to initialize the AOS, enable logging, initialize the plug-in manager and try to parse the config file and ascertain the module path
10 aramv 890 */
11 aramv 1096 EES_RC EEF_Init(char *config_file, FILE* log_file, int number_of_policies, char* names_of_policies[]){
12 aramv 1087 start_log(log_file);
13 aramv 1075 eef_log(LOG_NOTICE, "EEF initializing");
14 aramv 589
15 aramv 1060 if (AOS_Init() == EES_SUCCESS){
16 aramv 1142 if(start_plugin_manager() == EES_SUCCESS){
17 aramv 1235 return start_pdl_parser(config_file, number_of_policies, names_of_policies);
18 aramv 589 }
19 aramv 429 }
20 aramv 781 return EES_FAILURE;
21 aramv 429 }
22    
23 aramv 1464 /**
24 aramv 890 * Terminates the parser, stops the plug-in manager, terminates the AOS and closes the log.
25     */
26 aramv 810 EES_RC EEF_Term(){
27 aramv 1495
28 aramv 887 eef_log(LOG_INFO, "Cleaning up...");
29 aramv 1261 if((pdl_term() == EES_SUCCESS) &&
30 aramv 1212 (stop_plugin_manager() == EES_SUCCESS) &&
31     (AOS_Term() == EES_SUCCESS)){
32 aramv 1087 stop_log();
33 aramv 867 return EES_SUCCESS;
34 aramv 586 }
35 aramv 892 eef_log(LOG_ERR, "Errors detected\n");
36 aramv 1075 eef_log(LOG_NOTICE, "EEF terminating...");
37 aramv 1087 stop_log();
38 aramv 781 return EES_FAILURE;
39 aramv 429 }
40    
41 aramv 1464 /**
42     * Opens the log file or logs to syslog if none was provided.
43     * log mask is set depending on whether ENABLE_DEBUG macro is set to true
44     */
45 aramv 1087 EES_RC start_log(FILE* log_file){
46     /* Log file */
47     log_file_fp = log_file;
48    
49     if(!log_file_fp){
50     /* logmask for debug */
51     #if ENABLE_DEBUG
52     setlogmask (LOG_UPTO(LOG_DEBUG));
53     eef_log(LOG_DEBUG, "DEBUG MODE ENABLED\n");
54     #else
55     setlogmask (LOG_UPTO(LOG_INFO));
56     #endif
57     } else {
58     /* Open syslog, regardless of use*/
59     openlog ("ees", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_DAEMON);
60     }
61     return EES_SUCCESS;
62    
63     }
64    
65 aramv 1464 /**
66     * Closes the log file
67     */
68 aramv 1087 EES_RC stop_log(){
69     if(!log_file_fp){
70     closelog();
71     }
72     return EES_SUCCESS;
73     }
74    
75 aramv 1464 /**
76 aramv 1142 * Sets the global modules path to load plug-ins from
77     */
78     void set_modules_path(const char* path){
79     _modules_path = path;
80     }
81 aramv 1087
82 aramv 1464 /**
83 aramv 890 * Returns the global modules path to load plug-ins from
84 aramv 1142 * This can be either the _modules_path as set by the set_modules_path() function or the MODULE_DIR path macro generated by the configure script.
85 aramv 890 */
86 aramv 844 const char* get_modules_path(void){
87 aramv 1142 if(_modules_path != NULL){
88     if(strlen(_modules_path)!=0){
89     return _modules_path;
90     }
91     }
92     return MODULE_DIR;
93 aramv 844 }

Properties

Name Value
svn:mergeinfo

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