-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.c
46 lines (36 loc) · 847 Bytes
/
main.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
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include "mouse.h"
#include "keyboard.h"
#include "server.h"
#include "logger.h"
MOUSE * gMouse = NULL;
KEYBOARD * gKeyboard = NULL;
static SERVER * Server = NULL;
int StopSignalHandler(int Signal);
int main() {
Logger_New(STDOUT);
gMouse = InitializeMouseDevice ();
gKeyboard = InitializeKeyboardDevice ();
#ifndef USE_SSL
Server = InitializeServer(8000);
#else
Server = InitializeServerSSL(8000);
#endif
if (Server == NULL) {
Logger->Error(__FUNCTION__, __LINE__, "Could not initialize Server data structure");
goto FINISH;
}
signal(SIGINT, StopSignalHandler);
while(!Server->IsStop) {
Server->Start(Server);
}
FINISH:
Logger->Dispose();
Server->Dispose(&Server);
return 0;
}
int StopSignalHandler(int Signal) {
Server->Stop(Server);
}