Coverage Report

Created: 2024-02-25 06:34

/src/kamailio/src/core/dns_func.c
Line
Count
Source (jump to first uncovered line)
1
2
/*
3
 * Copyright (C) 2013  mariuszbi@gmail.com
4
 *
5
 * Permission to use, copy, modify, and distribute this software for any
6
 * purpose with or without fee is hereby granted, provided that the above
7
 * copyright notice and this permission notice appear in all copies.
8
 *
9
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
 */
17
/*!
18
 * \file
19
 * \brief Kamailio core :: DNS wrappers
20
 * \author mariuszbi@gmail.com
21
 * \ingroup core
22
 * Module: \ref core
23
 */
24
25
#include "dns_func.h"
26
27
#include <netinet/in.h>
28
#include <resolv.h>
29
#include <sys/types.h>
30
#include <netdb.h>
31
32
struct hostent;
33
34
struct dns_func_t dns_func = {res_init, res_search, gethostbyname,
35
#ifdef HAVE_GETHOSTBYNAME2
36
    gethostbyname2
37
#else
38
    NULL
39
#endif
40
};
41
42
43
void load_dnsfunc(struct dns_func_t *d)
44
0
{
45
0
  dns_func.sr_res_init = d->sr_res_init;
46
0
  dns_func.sr_res_search = d->sr_res_search;
47
0
  dns_func.sr_gethostbyname = d->sr_gethostbyname;
48
0
  dns_func.sr_gethostbyname2 = d->sr_gethostbyname2;
49
0
}