1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
|
/*
* $Id$
*
* DNSSEC module
*
* Copyright (C) 2013 mariuszbi@gmail.com
*
* This file is part of Kamailio, a free SIP server.
*
* Kamailio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version
*
* Kamailio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* History:
* --------
* 2013-03 initial implementation
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include "../../sr_module.h"
#include "../../error.h"
#include "../../dprint.h"
#include "../../ut.h"
#include "../../dns_func.h"
#include "dnssec_func.h"
MODULE_VERSION
static int dnssec_init(void);
static int dnssec_exit(void);
/* parameters */
static unsigned int flags=0;
/* global variables */
gen_lock_t* timer_lock=0;
struct list_link* timer = 0;
static cmd_export_t cmds[]={
{0,0,0,0,0,0}
};
static param_export_t params[]={
{"general_query_flags", INT_PARAM, &flags},
{0,0,0}
};
static mi_export_t mi_cmds [] = {
{0,0,0,0,0}
};
struct module_exports exports= {
"dnssec",
DEFAULT_DLFLAGS, /* dlopen flags */
cmds,
params,
0, /* exported statistics */
mi_cmds, /* exported MI functions */
0, /* exported pseudo-variables */
0, /* extra processes */
dnssec_init, /* module initialization function */
0,
(destroy_function) dnssec_exit, /* module exit function */
0 /* per-child init function */
};
static int load_dns(void)
{
struct dns_func_t *f = pkg_malloc(sizeof(struct dns_func_t));
if( NULL == f ) {
return -1;
}
memset(f, 0, sizeof(struct dns_func_t));
f->sr_res_init = dnssec_res_init;
f->sr_gethostbyname = dnssec_gethostbyname;
f->sr_gethostbyname2 = dnssec_gethostbyname2;
f->sr_res_search = dnssec_res_search;
load_dnsfunc(f);
return 0;
}
static int dnssec_init(void)
{
LOG(L_INFO, "DNSSEC - initializing\n");
/* if(register_mi_mod(exports.name, mi_cmds)!=0)
{
LM_ERR("failed to register MI commands\n");
return -1;
}
*/
//set parameters
if(flags) set_context_flags(flags);
if(load_dns() != 0) {
LM_ERR("loaded dnssec wrappers failed\n");
}
/* load dnssec resolver wrappers */
return 0;
}
static int dnssec_exit(void)
{
(void)dnssec_res_destroy();
return 0;
}
|