Coverage Report

Created: 2026-03-11 06:20

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/rtpproxy/src/rtpp_timeout_data.c
Line
Count
Source
1
/*
2
 * Copyright (c) 2019 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
#include <stddef.h>
29
#include <stdlib.h>
30
#include <string.h>
31
32
#include "rtpp_types.h"
33
#include "rtpp_refcnt.h"
34
#include "rtpp_mallocs.h"
35
#include "rtpp_timeout_data.h"
36
37
struct rtpp_timeout_data_priv {
38
   struct rtpp_timeout_data pub;
39
   struct rtpp_str tag;
40
   char tagdata[0];
41
};
42
43
struct rtpp_timeout_data *
44
rtpp_timeout_data_ctor(struct rtpp_tnotify_target *ttp, const rtpp_str_t *tag)
45
1.46k
{
46
1.46k
    struct rtpp_timeout_data_priv *pvt;
47
1.46k
    size_t allocsize;
48
49
1.46k
    allocsize = sizeof(struct rtpp_timeout_data_priv);
50
1.46k
    allocsize += tag->len + 1;
51
1.46k
    pvt = rtpp_rzmalloc(allocsize, PVT_RCOFFS(pvt));
52
1.46k
    if (pvt == NULL) {
53
0
        goto e0;
54
0
    }
55
1.46k
    memcpy(pvt->tagdata, tag->s, tag->len);
56
1.46k
    pvt->tagdata[tag->len] = '\0';
57
1.46k
    pvt->tag.rw.s = pvt->tagdata;
58
1.46k
    pvt->tag.rw.len = tag->len;
59
1.46k
    pvt->pub.notify_target = ttp;
60
1.46k
    pvt->pub.notify_tag = &pvt->tag.fx;
61
1.46k
    return ((&pvt->pub));
62
63
0
e0:
64
    return (NULL);
65
1.46k
}