Coverage Report

Created: 2025-11-24 06:50

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/open5gs/lib/core/ogs-conv.h
Line
Count
Source
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
#if !defined(OGS_CORE_INSIDE) && !defined(OGS_CORE_COMPILATION)
21
#error "This header cannot be included directly."
22
#endif
23
24
#ifndef OGS_CONV_H
25
#define OGS_CONV_H
26
27
#ifdef __cplusplus
28
extern "C" {
29
#endif
30
31
int ogs_ascii_to_hex(char *in, int in_len, void *out, int out_len);
32
static ogs_inline void *ogs_hex_from_string(
33
        const char *str, void *out, int out_len)
34
0
{
35
0
    ogs_ascii_to_hex((char*)str, strlen(str), out, out_len);
36
0
    return out;
37
0
}
Unexecuted instantiation: nas-message-fuzz.c:ogs_hex_from_string
Unexecuted instantiation: decoder.c:ogs_hex_from_string
Unexecuted instantiation: ies.c:ogs_hex_from_string
Unexecuted instantiation: types.c:ogs_hex_from_string
Unexecuted instantiation: ogs-abort.c:ogs_hex_from_string
Unexecuted instantiation: ogs-strings.c:ogs_hex_from_string
Unexecuted instantiation: ogs-conv.c:ogs_hex_from_string
Unexecuted instantiation: ogs-log.c:ogs_hex_from_string
Unexecuted instantiation: ogs-pkbuf.c:ogs_hex_from_string
Unexecuted instantiation: ogs-memory.c:ogs_hex_from_string
Unexecuted instantiation: ogs-sockaddr.c:ogs_hex_from_string
Unexecuted instantiation: ogs-hash.c:ogs_hex_from_string
Unexecuted instantiation: ogs-core.c:ogs_hex_from_string
Unexecuted instantiation: ogs-errno.c:ogs_hex_from_string
Unexecuted instantiation: ogs-time.c:ogs_hex_from_string
Unexecuted instantiation: ogs-socket.c:ogs_hex_from_string
Unexecuted instantiation: ogs-tlv.c:ogs_hex_from_string
Unexecuted instantiation: gtp-message-fuzz.c:ogs_hex_from_string
Unexecuted instantiation: context.c:ogs_hex_from_string
Unexecuted instantiation: xact.c:ogs_hex_from_string
Unexecuted instantiation: conv.c:ogs_hex_from_string
Unexecuted instantiation: message.c:ogs_hex_from_string
Unexecuted instantiation: path.c:ogs_hex_from_string
Unexecuted instantiation: build.c:ogs_hex_from_string
Unexecuted instantiation: ogs-timer.c:ogs_hex_from_string
Unexecuted instantiation: ogs-socknode.c:ogs_hex_from_string
Unexecuted instantiation: ogs-udp.c:ogs_hex_from_string
Unexecuted instantiation: ogs-poll.c:ogs_hex_from_string
Unexecuted instantiation: ogs-tlv-msg.c:ogs_hex_from_string
Unexecuted instantiation: ogs-epoll.c:ogs_hex_from_string
Unexecuted instantiation: ogs-rbtree.c:ogs_hex_from_string
Unexecuted instantiation: ogs-sockopt.c:ogs_hex_from_string
Unexecuted instantiation: ogs-notify.c:ogs_hex_from_string
Unexecuted instantiation: ogs-yaml.c:ogs_hex_from_string
Unexecuted instantiation: ogs-context.c:ogs_hex_from_string
Unexecuted instantiation: ogs-config.c:ogs_hex_from_string
Unexecuted instantiation: ogs-init.c:ogs_hex_from_string
Unexecuted instantiation: ogs-queue.c:ogs_hex_from_string
Unexecuted instantiation: ogs-env.c:ogs_hex_from_string
38
39
void *ogs_hex_to_ascii(const void *in, int in_len, void *out, int out_len);
40
void *ogs_uint64_to_buffer(uint64_t num, int size, void *buffer);
41
uint64_t ogs_buffer_to_uint64(void *buffer, int size);
42
void *ogs_bcd_to_buffer(const char *in, void *out, int *out_len);
43
void *ogs_bcd_to_buffer_reverse_order(const char *in, void *out, int *out_len);
44
void *ogs_buffer_to_bcd(uint8_t *in, int in_len, void *out);
45
46
char ogs_from_hex(char ch);
47
char ogs_to_hex(char ch);
48
49
char *ogs_uint24_to_0string(ogs_uint24_t x);
50
char *ogs_uint28_to_0string(uint32_t x);
51
char *ogs_uint32_to_0string(uint32_t x);
52
char *ogs_uint36_to_0string(uint64_t x);
53
char *ogs_uint64_to_0string(uint64_t x);
54
char *ogs_uint64_to_string(uint64_t x);
55
56
#define ogs_uint24_from_string_decimal(str) \
57
    ogs_uint24_from_string((str), 10)
58
#define ogs_uint24_from_string_hexadecimal(str) \
59
0
    ogs_uint24_from_string((str), 16)
60
ogs_uint24_t ogs_uint24_from_string(char *str, int base);
61
62
#define ogs_uint64_from_string_decimal(str) \
63
0
    ogs_uint64_from_string((str), 10)
64
#define ogs_uint64_from_string_hexadecimal(str) \
65
    ogs_uint64_from_string((str), 16)
66
uint64_t ogs_uint64_from_string(char *str, int base);
67
68
double *ogs_alloc_double(double value);
69
70
#ifdef __cplusplus
71
}
72
#endif
73
74
#endif /* OGS_CONV_H */