Coverage Report

Created: 2024-02-25 06:34

/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
 * Kamailio 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
 * Kamailio 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19
 *
20
 */
21
/*!
22
 * \file
23
 * \brief Kamailio core :: STUN support
24
 * STUN support callback, used by the STUN module
25
 * \ingroup core
26
 * Module: \ref core
27
 */
28
29
#include "events.h"
30
#include "ip_addr.h"
31
#include "stun.h"
32
33
int stun_process_msg(char *buf, unsigned int len, struct receive_info *ri)
34
0
{
35
0
  int ret;
36
0
  stun_event_info_t sev;
37
0
  sr_event_param_t evp = {0};
38
39
0
  ret = 0;
40
0
  LM_DBG("STUN Message: [[>>>\n%.*s<<<]]\n", len, buf);
41
0
  if(likely(sr_event_enabled(SREV_STUN_IN))) {
42
0
    memset(&sev, 0, sizeof(stun_event_info_t));
43
0
    sev.buf = buf;
44
0
    sev.len = len;
45
0
    sev.rcv = ri;
46
0
    evp.data = (void *)&sev;
47
0
    ret = sr_event_exec(SREV_STUN_IN, &evp);
48
0
  } else {
49
0
    LM_DBG("no callback registering for handling STUN -"
50
0
         " dropping!\n");
51
0
  }
52
0
  return ret;
53
0
}