56 pool_handle_t *cfg_pool; |
56 pool_handle_t *cfg_pool; |
57 |
57 |
58 // TODO: Funktion für ConfigDirective -> directive |
58 // TODO: Funktion für ConfigDirective -> directive |
59 // TODO: Funktion für UcxList parameter list -> pblock |
59 // TODO: Funktion für UcxList parameter list -> pblock |
60 |
60 |
61 void load_init_conf(char *file) { |
61 int load_init_conf(char *file) { |
62 printf("load_init_conf\n"); |
62 printf("load_init_conf\n"); |
63 |
63 |
64 InitConfig *cfg = load_init_config(file); |
64 InitConfig *cfg = load_init_config(file); |
65 UcxMempool *mp = cfg->parser.mp; |
65 UcxMempool *mp = cfg->parser.mp; |
66 if(cfg == NULL) { |
66 if(cfg == NULL) { |
67 return; |
67 return 1; |
68 } |
68 } |
69 |
69 |
70 cfg_pool = pool_create(); // one pool for one Configuration |
70 cfg_pool = pool_create(); // one pool for one Configuration |
71 UcxDlist *dirs = cfg->directives; |
71 UcxDlist *dirs = cfg->directives; |
72 while(dirs != NULL) { |
72 while(dirs != NULL) { |
91 /* get function */ |
91 /* get function */ |
92 char *func_name = pblock_findval("fn", d->param); |
92 char *func_name = pblock_findval("fn", d->param); |
93 d->func = get_function(func_name); |
93 d->func = get_function(func_name); |
94 if(d->func == NULL) { |
94 if(d->func == NULL) { |
95 free(d); |
95 free(d); |
96 dirs = dirs->next; |
96 pblock_free(d->param); |
97 continue; |
97 //dirs = dirs->next; |
|
98 log_ereport( |
|
99 LOG_MISCONFIG, |
|
100 "Cannot find Init function %s", |
|
101 func_name); |
|
102 return 1; |
98 } |
103 } |
99 |
104 |
100 /* execute init directive */ |
105 /* execute init directive */ |
101 d->func->func(d->param, NULL, NULL); |
106 int ret = d->func->func(d->param, NULL, NULL); |
|
107 if(ret != REQ_PROCEED || ret != REQ_NOACTION) { |
|
108 log_ereport( |
|
109 LOG_FAILURE, |
|
110 "Error running Init function %s", |
|
111 func_name); |
|
112 return 1; |
|
113 } |
102 |
114 |
103 dirs = dirs->next; |
115 dirs = dirs->next; |
104 } |
116 } |
105 |
117 |
106 free_init_config(cfg); |
118 free_init_config(cfg); |
|
119 |
|
120 return 0; |
107 } |
121 } |
108 |
122 |
109 ServerConfiguration* load_server_conf(ServerConfiguration *old, char *file) { |
123 ServerConfiguration* load_server_conf(ServerConfiguration *old, char *file) { |
110 printf("load_server_conf\n"); |
124 printf("load_server_conf\n"); |
111 |
125 |