dialplan.h

Go to the documentation of this file.
00001 
00002 /*
00003  * $Id: dialplan.h 5054 2008-10-09 13:06:23Z juhe $
00004  *
00005  * Copyright (C)  2007-2008 Voice Sistem SRL
00006  *
00007  * This file is part of Kamailio, a free SIP server.
00008  *
00009  * Kamailio is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version
00013  *
00014  * Kamailio is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License 
00020  * along with this program; if not, write to the Free Software 
00021  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022  *
00023  * History:
00024  * --------
00025  *  2007-08-01 initial version (ancuta onofrei)
00026  */
00027 
00028 #ifndef _DP_DIALPLAN_H
00029 #define _DP_DIALPLAN_H
00030 
00031 #include <pcre.h>
00032 #include "../../pvar.h"
00033 #include "../../parser/msg_parser.h"
00034 
00035 #define REGEX_OP  1
00036 #define EQUAL_OP  0
00037 
00038 #define MAX_REPLACE_WITH   10
00039 
00040 typedef struct dpl_node{
00041    int dpid;
00042    int pr;
00043    int matchop;
00044    int matchlen;
00045    str match_exp, subst_exp, repl_exp; /*keeping the original strings*/
00046    pcre *match_comp, *subst_comp; /*compiled patterns*/
00047    struct subst_expr * repl_comp; 
00048    str attrs;
00049 
00050    struct dpl_node * next; /*next rule*/
00051 }dpl_node_t, *dpl_node_p;
00052 
00053 /*For every distinct length of a matching string*/
00054 typedef struct dpl_index{
00055    int len;
00056    dpl_node_t * first_rule;
00057    dpl_node_t * last_rule;
00058 
00059    struct dpl_index * next; 
00060 }dpl_index_t, *dpl_index_p;
00061 
00062 /*For every DPID*/
00063 typedef struct dpl_id{
00064    int dp_id;
00065    dpl_index_t* first_index;/*fast access :rules with specific length*/
00066    struct dpl_id * next;
00067 }dpl_id_t,*dpl_id_p;
00068 
00069 
00070 #define DP_VAL_INT      0
00071 #define DP_VAL_SPEC     1
00072 
00073 typedef struct dp_param{
00074    int type;
00075    union {
00076       int id;
00077       pv_spec_t sp[2];
00078    } v;
00079 }dp_param_t, *dp_param_p;
00080 
00081 int init_data();
00082 void destroy_data();
00083 int dp_load_db();
00084 
00085 dpl_id_p select_dpid(int id);
00086 
00087 struct subst_expr* repl_exp_parse(str subst);
00088 void repl_expr_free(struct subst_expr *se);
00089 int translate(struct sip_msg *msg, str user_name, str* repl_user, dpl_id_p idp, str *);
00090 int rule_translate(struct sip_msg *msg, str , dpl_node_t * rule,  str *);
00091 #endif

Generated on Tue May 22 16:00:26 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6