forked from SpiderLabs/modsecurity-mlogc-ng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mlogc-ng.c
72 lines (58 loc) · 1.15 KB
/
mlogc-ng.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mlogc-ng.h"
#include "configuration.h"
#include "input_batch.h"
#include "pipeline.h"
/*
* mlogc-ng
*
* TODO: write something about it.
*
*/
#ifdef VERBOSE
int verbose = 1;
#else
int verbose = 0;
#endif
#ifdef DEBUG
int debug = 1;
#else
int debug = 0;
#endif
void help (void)
{
p("Use: ./mgloc-ng /path/to/config/file\n\n");
}
int main (int argc, char **argv)
{
int res = 0;
char *config_file = NULL;
struct pipeline_t pipeline;
struct pipeline_element_t *input;
if (argc < 2)
{
help();
goto missing_arguments;
}
config_file = argv[1];
res = read_configuration_file(config_file, &pipeline);
if (res)
{
e("Problems reading the configuration " \
"file: %s\n", config_file);
goto bad_configuration;
}
input = pipeline.elements;
if (input == NULL)
{
e("Missing pipeline.\n");
goto bad_configuration;
}
p("Starting pipeline, input element: '%s'\n", input->name);
input->process(input, NULL);
bad_configuration:
missing_arguments:
return res;
}