enum_mod.c

Go to the documentation of this file.
00001 /*
00002  * $Id: enum_mod.c 4948 2008-09-18 10:45:11Z henningw $
00003  *
00004  * Enum module
00005  *
00006  * Copyright (C) 2002-2008 Juha Heinanen
00007  *
00008  * This file is part of Kamailio, a free SIP server.
00009  *
00010  * Kamailio is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version
00014  *
00015  * Kamailio is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License 
00021  * along with this program; if not, write to the Free Software 
00022  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023  *
00024  * History:
00025  * -------
00026  * 2003-03-11: New module interface (janakj)
00027  * 2003-03-16: flags export parameter added (janakj)
00028  * 2003-12-15: added suffix parameter to enum_query (jh)
00029  */
00030 
00031 
00032 #include "enum_mod.h"
00033 #include <stdio.h>
00034 #include <stdlib.h>
00035 #include "../../sr_module.h"
00036 #include "../../error.h"
00037 #include "../../mod_fix.h"
00038 #include "enum.h"
00039 
00040 MODULE_VERSION
00041 
00042 /*
00043  * Module initialization function prototype
00044  */
00045 static int mod_init(void);
00046 
00047 
00048 /*
00049  * Module parameter variables
00050  */
00051 char* domain_suffix = "e164.arpa.";
00052 char* tel_uri_params = "";
00053 
00054 char* branchlabel = "i";
00055 char* i_enum_suffix = "e164.arpa.";
00056 char* bl_algorithm = "cc";
00057 
00058 
00059 /*
00060  * Internal module variables
00061  */
00062 str suffix;
00063 str param;
00064 str service;
00065 
00066 str i_suffix;
00067 str i_branchlabel;
00068 str i_bl_alg;
00069 
00070 
00071 /*
00072  * Exported functions
00073  */
00074 static cmd_export_t cmds[] = {
00075    {"enum_query", (cmd_function)enum_query_0, 0, 0, 0, REQUEST_ROUTE},
00076    {"enum_query", (cmd_function)enum_query_1, 1, fixup_str_null,
00077     fixup_free_str_null, REQUEST_ROUTE},
00078    {"enum_query", (cmd_function)enum_query_2, 2, fixup_str_str, 
00079     fixup_free_str_str, REQUEST_ROUTE},
00080    {"enum_pv_query", (cmd_function)enum_pv_query_1, 1, fixup_pvar_null,
00081     fixup_free_pvar_null, REQUEST_ROUTE},
00082    {"enum_pv_query", (cmd_function)enum_pv_query_2, 2, fixup_pvar_str,
00083     fixup_free_pvar_str, REQUEST_ROUTE},
00084    {"enum_pv_query", (cmd_function)enum_pv_query_3, 3,
00085     fixup_pvar_str_str, fixup_free_pvar_str_str, REQUEST_ROUTE},
00086    {"is_from_user_enum", (cmd_function)is_from_user_enum_0, 0, 0, 0,
00087     REQUEST_ROUTE},
00088    {"is_from_user_enum", (cmd_function)is_from_user_enum_1, 1,
00089     fixup_str_null, fixup_free_str_null, REQUEST_ROUTE},
00090    {"is_from_user_enum", (cmd_function)is_from_user_enum_2, 2,
00091     fixup_str_str, fixup_free_str_str, REQUEST_ROUTE},
00092    {"i_enum_query", (cmd_function)i_enum_query_0, 0, 0, 0, REQUEST_ROUTE},
00093    {"i_enum_query", (cmd_function)i_enum_query_1, 1, fixup_str_null, 0,
00094     REQUEST_ROUTE},
00095    {"i_enum_query", (cmd_function)i_enum_query_2, 2, fixup_str_str, 0,
00096     REQUEST_ROUTE},
00097    {0, 0, 0, 0, 0, 0}
00098 };
00099 
00100 
00101 /*
00102  * Exported parameters
00103  */
00104 static param_export_t params[] = {
00105    {"domain_suffix", STR_PARAM, &domain_suffix},
00106    {"tel_uri_params", STR_PARAM, &tel_uri_params},
00107    {"branchlabel", STR_PARAM, &branchlabel},
00108    {"i_enum_suffix", STR_PARAM, &i_enum_suffix},
00109    {"bl_algorithm", STR_PARAM, &bl_algorithm},
00110    {0, 0, 0}
00111 };
00112 
00113 
00114 /*
00115  * Module parameter variables
00116  */
00117 struct module_exports exports = {
00118    "enum", 
00119    DEFAULT_DLFLAGS, /* dlopen flags */
00120    cmds,     /* Exported functions */
00121    params,   /* Exported parameters */
00122    0,        /* exported statistics */
00123    0,        /* exported MI functions */
00124    0,        /* exported pseudo-variables */
00125    0,        /* extra processes */
00126    mod_init, /* module initialization function */
00127    0,        /* response function*/
00128    0,        /* destroy function */
00129    0         /* per-child init function */
00130 };
00131 
00132 
00133 static int mod_init(void)
00134 {
00135    suffix.s = domain_suffix;
00136    suffix.len = strlen(suffix.s);
00137 
00138    param.s = tel_uri_params;
00139    param.len = strlen(param.s);
00140 
00141    service.len = 0;
00142 
00143    i_suffix.s = i_enum_suffix;
00144    i_suffix.len = strlen(i_enum_suffix);
00145 
00146    i_branchlabel.s = branchlabel;
00147    i_branchlabel.len = strlen(branchlabel);
00148 
00149    i_bl_alg.s = bl_algorithm;
00150    i_bl_alg.len = strlen(bl_algorithm);
00151 
00152    return 0;
00153 }
00154 

Generated on Wed May 23 06:00:45 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6