~ubuntu-branches/debian/sid/kamailio/sid

« back to all changes in this revision

Viewing changes to modules/dnssec/dnssec_mod.c

  • Committer: Package Import Robot
  • Author(s): Victor Seva
  • Date: 2014-01-06 11:47:13 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20140106114713-t8xidp4arzrnyeya
Tags: 4.1.1-1
* New upstream release
* debian/patches:
  - add upstream fixes
* Added tls outbound websocket autheph dnssec modules
  - openssl exception added to their license
* removing sparc and ia64 from supported archs
  for mono module (Closes: #728915)

Show diffs side-by-side

added added

removed removed

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