11 #include <arpa/inet.h>
13 #include <event2/event.h>
14 #include <event2/thread.h>
16 #include <openssl/ssl.h>
17 #include <openssl/crypto.h>
18 #include <openssl/err.h>
24 #define DEFAULT_CONFIG_FILE "conf/lemu.conf"
26 #define USAGE_FLAGS_LONG (1<<0)
28 usage_(char *prog
, unsigned int usage_flags
)
32 x
= strrchr(prog
, '/');
37 printf("Usage: %s [-c config_file]\n", prog
);
38 if (! (usage_flags
& USAGE_FLAGS_LONG
)) {
42 "\t-h \t : this help\n"
43 "\t-c config_file\t : loads the specified config file [default: '" DEFAULT_CONFIG_FILE
"']\n"
48 main(int argc
, char **argv
)
50 struct server
*server
;
51 char *conf_file
= DEFAULT_CONFIG_FILE
;
55 /* enable threading in libevent before anything tries to use it */
56 if ( (r
= evthread_use_pthreads()) ) {
57 NOTIFY_ERROR("%s:%d", "evthread_use_pthreads", r
);
60 SSL_load_error_strings();
62 OpenSSL_add_all_algorithms();
64 while ( (opt
= getopt(argc
, argv
, "c:h")) != -1 ) {
70 usage_(argv
[0], USAGE_FLAGS_LONG
);
79 server
= server_new();
81 NOTIFY_FATAL("server_new");
85 if (server_init(server
, conf_file
)) {
86 NOTIFY_FATAL("error parsing config file '%s'", conf_file
);