-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
60 lines (49 loc) · 1.04 KB
/
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
* Copyright (C) 2024 TDT AG <[email protected]>
*
* This is free software, licensed under the GNU General Public License v2.
* See https://www.gnu.org/licenses/gpl-2.0.txt for more information.
*
*/
#include <libubox/uloop.h>
#include <stdio.h>
#include <stdlib.h>
#include "interface.h"
#include "logging.h"
#include "ubus.h"
int main(int argc, const char *argv[])
{
int ret;
logging_open("mwan4");
LOGGING_INFO("Starting...");
ret = uloop_init();
if (ret < 0) {
LOGGING_CRIT("%s: could not initialize uloop", __func__);
logging_close();
return -1;
}
ret = ubus_init();
if (ret < 0) {
LOGGING_CRIT("%s: could not initialize ubus", __func__);
uloop_done();
logging_close();
return -2;
}
ret = interfaces_init();
if (ret < 0) {
LOGGING_CRIT("%s: could not read uci config", __func__);
ubus_done();
uloop_done();
logging_close();
return -3;
}
/* main loop */
LOGGING_INFO("Running...");
uloop_run();
uloop_done();
LOGGING_INFO("Stopping...");
interfaces_done();
ubus_done();
logging_close();
return 0;
}