/src/open5gs/lib/core/ogs-core.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> |
3 | | * |
4 | | * This file is part of Open5GS. |
5 | | * |
6 | | * This program is free software: you can redistribute it and/or modify |
7 | | * it under the terms of the GNU Affero General Public License as published by |
8 | | * the Free Software Foundation, either version 3 of the License, or |
9 | | * (at your option) any later version. |
10 | | * |
11 | | * This program is distributed in the hope that it will be useful, |
12 | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | | * GNU General Public License for more details. |
15 | | * |
16 | | * You should have received a copy of the GNU General Public License |
17 | | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
18 | | */ |
19 | | |
20 | | #include "ogs-core.h" |
21 | | |
22 | | int __ogs_mem_domain; |
23 | | int __ogs_sock_domain; |
24 | | int __ogs_event_domain; |
25 | | int __ogs_thread_domain; |
26 | | int __ogs_tlv_domain; |
27 | | |
28 | | static ogs_core_context_t self = { |
29 | | .log.pool = 8, |
30 | | .log.domain_pool = 64, |
31 | | .log.level = OGS_LOG_DEFAULT, |
32 | | |
33 | | .pkbuf.pool = 8, |
34 | | .pkbuf.config_pool = 8, |
35 | | |
36 | | .tlv.pool = 512, |
37 | | }; |
38 | | |
39 | | void ogs_core_initialize(void) |
40 | 1 | { |
41 | 1 | ogs_mem_init(); |
42 | 1 | ogs_log_init(); |
43 | 1 | ogs_pkbuf_init(); |
44 | 1 | ogs_socket_init(); |
45 | 1 | ogs_tlv_init(); |
46 | | |
47 | 1 | ogs_log_install_domain(&__ogs_mem_domain, "mem", ogs_core()->log.level); |
48 | 1 | ogs_log_install_domain(&__ogs_sock_domain, "sock", ogs_core()->log.level); |
49 | 1 | ogs_log_install_domain(&__ogs_event_domain, "event", ogs_core()->log.level); |
50 | 1 | ogs_log_install_domain(&__ogs_thread_domain, |
51 | 1 | "thread", ogs_core()->log.level); |
52 | 1 | ogs_log_install_domain(&__ogs_tlv_domain, "tlv", ogs_core()->log.level); |
53 | 1 | } |
54 | | |
55 | | void ogs_core_terminate(void) |
56 | 0 | { |
57 | 0 | ogs_tlv_final(); |
58 | 0 | ogs_socket_final(); |
59 | 0 | ogs_pkbuf_final(); |
60 | 0 | ogs_log_final(); |
61 | 0 | ogs_mem_final(); |
62 | 0 | } |
63 | | |
64 | | ogs_core_context_t *ogs_core(void) |
65 | 606 | { |
66 | 606 | return &self; |
67 | 606 | } |