Coverage Report

Created: 2025-08-24 06:22

/src/kamailio/src/core/stun.c
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright (C) 2013 Crocodile RCS Ltd
3
 *
4
 * This file is part of Kamailio, a free SIP server.
5
 *
6
 * SPDX-License-Identifier: GPL-2.0-or-later
7
 *
8
 * Kamailio is free software; you can redistribute it and/or modify
9
 * it under the terms of the GNU General Public License as published by
10
 * the Free Software Foundation; either version 2 of the License, or
11
 * (at your option) any later version
12
 *
13
 * Kamailio is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
 *
22
 */
23
/*!
24
 * \file
25
 * \brief Kamailio core :: STUN support
26
 * STUN support callback, used by the STUN module
27
 * \ingroup core
28
 * Module: \ref core
29
 */
30
31
#include "events.h"
32
#include "ip_addr.h"
33
#include "stun.h"
34
35
int stun_process_msg(char *buf, unsigned int len, struct receive_info *ri)
36
0
{
37
0
  int ret;
38
0
  stun_event_info_t sev;
39
0
  sr_event_param_t evp = {0};
40
41
0
  ret = 0;
42
0
  LM_DBG("STUN Message: [[>>>\n%.*s<<<]]\n", len, buf);
43
0
  if(likely(sr_event_enabled(SREV_STUN_IN))) {
44
0
    memset(&sev, 0, sizeof(stun_event_info_t));
45
0
    sev.buf = buf;
46
0
    sev.len = len;
47
0
    sev.rcv = ri;
48
0
    evp.data = (void *)&sev;
49
0
    ret = sr_event_exec(SREV_STUN_IN, &evp);
50
0
  } else {
51
0
    LM_DBG("no callback registering for handling STUN -"
52
0
         " dropping!\n");
53
0
  }
54
0
  return ret;
55
0
}