Coverage Report

Created: 2026-07-14 06:05

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/open5gs/lib/proto/event.c
Line
Count
Source
1
/*
2
 * Copyright (C) 2019-2023 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-proto.h"
21
22
const char *OGS_EVENT_NAME_SBI_SERVER = "OGS_EVENT_NAME_SBI_SERVER";
23
const char *OGS_EVENT_NAME_SBI_CLIENT = "OGS_EVENT_NAME_SBI_CLIENT";
24
const char *OGS_EVENT_NAME_SBI_TIMER = "OGS_EVENT_NAME_SBI_TIMER";
25
26
void *ogs_event_size(int id, size_t size)
27
0
{
28
0
    ogs_event_t *e = NULL;
29
30
0
    e = ogs_calloc(1, size);
31
0
    ogs_assert(e);
32
33
0
    e->id = id;
34
35
0
    return e;
36
0
}
37
38
ogs_event_t *ogs_event_new(int id)
39
0
{
40
0
    return ogs_event_size(id, OGS_EVENT_SIZE);
41
0
}
42
43
void ogs_event_free(void *e)
44
0
{
45
0
    ogs_assert(e);
46
0
    ogs_free(e);
47
0
}
48
49
const char *ogs_event_get_name(ogs_event_t *e)
50
0
{
51
0
    if (e == NULL) {
52
0
        return OGS_FSM_NAME_INIT_SIG;
53
0
    }
54
55
0
    switch (e->id) {
56
0
    case OGS_FSM_ENTRY_SIG:
57
0
        return OGS_FSM_NAME_ENTRY_SIG;
58
0
    case OGS_FSM_EXIT_SIG:
59
0
        return OGS_FSM_NAME_EXIT_SIG;
60
61
0
    case OGS_EVENT_SBI_SERVER:
62
0
        return OGS_EVENT_NAME_SBI_SERVER;
63
0
    case OGS_EVENT_SBI_CLIENT:
64
0
        return OGS_EVENT_NAME_SBI_CLIENT;
65
0
    case OGS_EVENT_SBI_TIMER:
66
0
        return OGS_EVENT_NAME_SBI_TIMER;
67
68
0
    default:
69
0
        break;
70
0
    }
71
72
0
    ogs_error("Unknown Event[%d]", e->id);
73
0
    return "UNKNOWN_EVENT";
74
0
}