Coverage Report

Created: 2025-07-18 06:32

/src/opensips/trace_api.c
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright (C) 2016 - OpenSIPS Solutions
3
 *
4
 * This file is part of opensips, a free SIP server.
5
 *
6
 * opensips is free software; you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation; either version 2 of the License, or
9
 * (at your option) any later version
10
 *
11
 * opensips 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, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
 *
20
 *
21
 * History:
22
 * -------
23
 *  2016-09-02  first version (Ionut Ionita)
24
 */
25
#include "trace_api.h"
26
#include "dprint.h"
27
28
register_trace_type_f register_trace_type=NULL;
29
check_is_traced_f check_is_traced=NULL;
30
get_next_destination_f get_next_destination=NULL;
31
sip_context_trace_f sip_context_trace=NULL;
32
33
trace_proto_t* global_trace_api=NULL;
34
35
int trace_prot_bind(char* module_name, trace_proto_t* prot)
36
0
{
37
0
  trace_bind_api_f bind_f;
38
39
0
  if (!module_name || !prot) {
40
0
    LM_ERR("null argument\n");
41
0
    return -1;
42
0
  }
43
44
0
  bind_f = (trace_bind_api_f) find_mod_export(module_name,
45
0
            "trace_bind_api", 0);
46
47
0
  if (bind_f) {
48
0
    LM_DBG("using trace bind api for %s\n", module_name);
49
50
0
    if (bind_f(prot)) {
51
0
      LM_ERR("failed to bind proto for module %s\n", module_name);
52
0
      return -1;
53
0
    }
54
0
  } else {
55
0
    LM_DBG("<%s> has no bind api function\n", module_name);
56
0
    return -1;
57
0
  }
58
59
0
  return 0;
60
0
}