opensips/modules/enum/enum_mod.c

changeset 19
3374f578f080
parent 18
8ec65b8f6e2c
child 20
2ff1f58715ce
     1.1 --- a/opensips/modules/enum/enum_mod.c	Wed Feb 10 21:25:01 2010 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,170 +0,0 @@
     1.4 -/*
     1.5 - * $Id: enum_mod.c 5976 2009-08-18 13:35:23Z bogdan_iancu $
     1.6 - *
     1.7 - * Enum module
     1.8 - *
     1.9 - * Copyright (C) 2002-2008 Juha Heinanen
    1.10 - *
    1.11 - * This file is part of opensips, a free SIP server.
    1.12 - *
    1.13 - * opensips is free software; you can redistribute it and/or modify
    1.14 - * it under the terms of the GNU General Public License as published by
    1.15 - * the Free Software Foundation; either version 2 of the License, or
    1.16 - * (at your option) any later version
    1.17 - *
    1.18 - * opensips is distributed in the hope that it will be useful,
    1.19 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.20 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.21 - * GNU General Public License for more details.
    1.22 - *
    1.23 - * You should have received a copy of the GNU General Public License 
    1.24 - * along with this program; if not, write to the Free Software 
    1.25 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1.26 - *
    1.27 - * History:
    1.28 - * -------
    1.29 - * 2003-03-11: New module interface (janakj)
    1.30 - * 2003-03-16: flags export parameter added (janakj)
    1.31 - * 2003-12-15: added suffix parameter to enum_query (jh)
    1.32 - */
    1.33 -
    1.34 -
    1.35 -#include "enum_mod.h"
    1.36 -#include <stdio.h>
    1.37 -#include <stdlib.h>
    1.38 -#include "../../sr_module.h"
    1.39 -#include "../../error.h"
    1.40 -#include "../../mod_fix.h"
    1.41 -#include "enum.h"
    1.42 -
    1.43 -
    1.44 -
    1.45 -/*
    1.46 - * Module initialization function prototype
    1.47 - */
    1.48 -static int mod_init(void);
    1.49 -
    1.50 -
    1.51 -/*
    1.52 - * Module parameter variables
    1.53 - */
    1.54 -char* domain_suffix = "e164.arpa.";
    1.55 -char* tel_uri_params = "";
    1.56 -
    1.57 -char* branchlabel = "i";
    1.58 -char* i_enum_suffix = "e164.arpa.";
    1.59 -char* bl_algorithm = "cc";
    1.60 -
    1.61 -char* isn_suffix = "freenum.org.";
    1.62 -
    1.63 -
    1.64 -/*
    1.65 - * Internal module variables
    1.66 - */
    1.67 -str suffix;
    1.68 -str param;
    1.69 -str service;
    1.70 -
    1.71 -str i_suffix;
    1.72 -str i_branchlabel;
    1.73 -str i_bl_alg;
    1.74 -
    1.75 -str isnsuffix;
    1.76 -
    1.77 -
    1.78 -/*
    1.79 - * Exported functions
    1.80 - */
    1.81 -static cmd_export_t cmds[] = {
    1.82 -	{"enum_query", (cmd_function)enum_query_0, 0, 0, 0, REQUEST_ROUTE},
    1.83 -	{"enum_query", (cmd_function)enum_query_1, 1, fixup_str_null,
    1.84 -	 fixup_free_str_null, REQUEST_ROUTE},
    1.85 -	{"enum_query", (cmd_function)enum_query_2, 2, fixup_str_str, 
    1.86 -	 fixup_free_str_str, REQUEST_ROUTE},
    1.87 -	{"enum_pv_query", (cmd_function)enum_pv_query_1, 1, fixup_pvar_null,
    1.88 -	 fixup_free_pvar_null, REQUEST_ROUTE},
    1.89 -	{"enum_pv_query", (cmd_function)enum_pv_query_2, 2, fixup_pvar_str,
    1.90 -	 fixup_free_pvar_str, REQUEST_ROUTE},
    1.91 -	{"enum_pv_query", (cmd_function)enum_pv_query_3, 3,
    1.92 -	 fixup_pvar_str_str, fixup_free_pvar_str_str, REQUEST_ROUTE},
    1.93 -	{"is_from_user_enum", (cmd_function)is_from_user_enum_0, 0, 0, 0,
    1.94 -	 REQUEST_ROUTE},
    1.95 -	{"is_from_user_enum", (cmd_function)is_from_user_enum_1, 1,
    1.96 -	 fixup_str_null, fixup_free_str_null, REQUEST_ROUTE},
    1.97 -	{"is_from_user_enum", (cmd_function)is_from_user_enum_2, 2,
    1.98 -	 fixup_str_str, fixup_free_str_str, REQUEST_ROUTE},
    1.99 -	{"i_enum_query", (cmd_function)i_enum_query_0, 0, 0, 0, REQUEST_ROUTE},
   1.100 -	{"i_enum_query", (cmd_function)i_enum_query_1, 1, fixup_str_null, 0,
   1.101 -	 REQUEST_ROUTE},
   1.102 -	{"i_enum_query", (cmd_function)i_enum_query_2, 2, fixup_str_str, 0,
   1.103 -	 REQUEST_ROUTE},
   1.104 -	{"isn_query", (cmd_function)isn_query_0, 0, 0, 0, REQUEST_ROUTE},
   1.105 -	{"isn_query", (cmd_function)isn_query_1, 1, fixup_str_null,
   1.106 -	 fixup_free_str_null, REQUEST_ROUTE},
   1.107 -	{"isn_query", (cmd_function)isn_query_2, 2, fixup_str_str, 
   1.108 -	 fixup_free_str_str, REQUEST_ROUTE},
   1.109 -	{0, 0, 0, 0, 0, 0}
   1.110 -};
   1.111 -
   1.112 -
   1.113 -/*
   1.114 - * Exported parameters
   1.115 - */
   1.116 -static param_export_t params[] = {
   1.117 -	{"domain_suffix", STR_PARAM, &domain_suffix},
   1.118 -	{"tel_uri_params", STR_PARAM, &tel_uri_params},
   1.119 -	{"branchlabel", STR_PARAM, &branchlabel},
   1.120 -	{"i_enum_suffix", STR_PARAM, &i_enum_suffix},
   1.121 -	{"bl_algorithm", STR_PARAM, &bl_algorithm},
   1.122 -	{"isn_suffix", STR_PARAM, &isn_suffix},
   1.123 -	{0, 0, 0}
   1.124 -};
   1.125 -
   1.126 -
   1.127 -/*
   1.128 - * Module parameter variables
   1.129 - */
   1.130 -struct module_exports exports = {
   1.131 -	"enum", 
   1.132 -	MODULE_VERSION,
   1.133 -	DEFAULT_DLFLAGS, /* dlopen flags */
   1.134 -	cmds,     /* Exported functions */
   1.135 -	params,   /* Exported parameters */
   1.136 -	0,        /* exported statistics */
   1.137 -	0,        /* exported MI functions */
   1.138 -	0,        /* exported pseudo-variables */
   1.139 -	0,        /* extra processes */
   1.140 -	mod_init, /* module initialization function */
   1.141 -	0,        /* response function*/
   1.142 -	0,        /* destroy function */
   1.143 -	0         /* per-child init function */
   1.144 -};
   1.145 -
   1.146 -
   1.147 -static int mod_init(void)
   1.148 -{
   1.149 -	LM_DBG("Initializing\n");
   1.150 -	
   1.151 -	suffix.s = domain_suffix;
   1.152 -	suffix.len = strlen(suffix.s);
   1.153 -
   1.154 -	param.s = tel_uri_params;
   1.155 -	param.len = strlen(param.s);
   1.156 -
   1.157 -	service.len = 0;
   1.158 -
   1.159 -	i_suffix.s = i_enum_suffix;
   1.160 -	i_suffix.len = strlen(i_enum_suffix);
   1.161 -
   1.162 -	i_branchlabel.s = branchlabel;
   1.163 -	i_branchlabel.len = strlen(branchlabel);
   1.164 -
   1.165 -	i_bl_alg.s = bl_algorithm;
   1.166 -	i_bl_alg.len = strlen(bl_algorithm);
   1.167 -
   1.168 -	isnsuffix.s = isn_suffix;
   1.169 -	isnsuffix.len = strlen(isnsuffix.s);
   1.170 -
   1.171 -	return 0;
   1.172 -}
   1.173 -

mercurial