Coverage Report

Created: 2024-07-23 06:12

/src/rtpproxy/src/rtpp_str.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright (c) 2023 Sippy Software, Inc., http://www.sippysoft.com
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24
 * SUCH DAMAGE.
25
 *
26
 */
27
28
#pragma once
29
30
struct rtpp_str_mutble {
31
    char *s;
32
    size_t len;
33
};
34
35
struct rtpp_str_const {
36
    const char *s;
37
    size_t len;
38
};
39
40
struct rtpp_str_fixed {
41
    const char * const s;
42
    const size_t len;
43
};
44
45
typedef struct rtpp_str_mutble rtpp_str_mutble_t;
46
typedef struct rtpp_str_const rtpp_str_const_t;
47
typedef struct rtpp_str_fixed rtpp_str_t;
48
49
struct rtpp_str {
50
    union {
51
        rtpp_str_mutble_t rw;
52
        rtpp_str_const_t ro;
53
        const rtpp_str_t fx;
54
    };
55
};
56
57
6.99k
#define rtpp_str_fix(src) ((const rtpp_str_t *)(src))
58
59
0
#define rtpp_str_dup2(src, dst) _Generic((src), \
60
0
    rtpp_str_const_t *: _rtpp_str_dup2_sc, \
61
0
    const rtpp_str_t *: _rtpp_str_dup2_sf, \
62
0
    struct rtpp_str *: _rtpp_str_dup2 \
63
0
)(src, dst)
64
65
0
#define rtpp_str_match(sp1, sp2) (((sp1)->len == (sp2)->len) && \
66
0
  memcmp((sp1)->s, (sp2)->s, (sp1)->len) == 0)
67
68
1.54k
#define FMTSTR(sp) (int)(sp)->len, (sp)->s
69
70
#define RTPP_STR_ITERATE(sp, cp) for((cp) = (sp)->s; (cp) < ((sp)->s + (sp)->len); (cp)++)
71
72
struct rtpp_str *_rtpp_str_dup2(const struct rtpp_str *,
73
  struct rtpp_str *dst);
74
75
static inline struct rtpp_str *
76
_rtpp_str_dup2_sc(const struct rtpp_str_const *src, struct rtpp_str_const *dst)
77
0
{
78
79
0
    return (_rtpp_str_dup2((const struct rtpp_str *)src, (struct rtpp_str *)dst));
80
0
}
Unexecuted instantiation: fuzz_command_parser.c:_rtpp_str_dup2_sc
Unexecuted instantiation: main.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rtpp_command.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rtpp_notify.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rtpp_command_async.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rtpp_proc.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rtpp_command_parse.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rpcpv1_copy.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rpcpv1_ul.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rtpp_hash_table.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rpcpv1_stats.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rtpp_command_stream.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rpcpv1_query.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rtpp_command_rcache.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rtpp_sessinfo.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rtpp_weakref.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rtpp_proc_servers.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rtpp_stream.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rtpp_proc_ttl.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rpcpv1_delete.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rpcpv1_record.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rpcpv1_play.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rpcpv1_ver.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rtpp_timeout_data.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rpcpv1_norecord.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rpcpv1_ul_subc.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rtpp_modman.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rtpp_module_if.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rtpp_catch_dtmf.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rtpp_dtls_gw.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rtpp_record.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rtpp_session.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rtpp_str.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rtpp_dtls.c:_rtpp_str_dup2_sc
Unexecuted instantiation: rtpp_dtls_conn.c:_rtpp_str_dup2_sc
81
82
static inline struct rtpp_str *
83
_rtpp_str_dup2_sf(const struct rtpp_str_fixed *src, struct rtpp_str_const *dst)
84
0
{
85
86
0
    return (_rtpp_str_dup2((const struct rtpp_str *)src, (struct rtpp_str *)dst));
87
0
}
Unexecuted instantiation: fuzz_command_parser.c:_rtpp_str_dup2_sf
Unexecuted instantiation: main.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rtpp_command.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rtpp_notify.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rtpp_command_async.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rtpp_proc.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rtpp_command_parse.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rpcpv1_copy.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rpcpv1_ul.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rtpp_hash_table.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rpcpv1_stats.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rtpp_command_stream.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rpcpv1_query.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rtpp_command_rcache.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rtpp_sessinfo.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rtpp_weakref.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rtpp_proc_servers.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rtpp_stream.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rtpp_proc_ttl.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rpcpv1_delete.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rpcpv1_record.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rpcpv1_play.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rpcpv1_ver.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rtpp_timeout_data.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rpcpv1_norecord.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rpcpv1_ul_subc.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rtpp_modman.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rtpp_module_if.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rtpp_catch_dtmf.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rtpp_dtls_gw.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rtpp_record.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rtpp_session.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rtpp_str.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rtpp_dtls.c:_rtpp_str_dup2_sf
Unexecuted instantiation: rtpp_dtls_conn.c:_rtpp_str_dup2_sf