Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00036 #ifndef _DP_DIALPLAN_H
00037 #define _DP_DIALPLAN_H
00038
00039 #include <pcre.h>
00040 #include "../../pvar.h"
00041 #include "../../parser/msg_parser.h"
00042
00043 #define DP_EQUAL_OP 0
00044 #define DP_REGEX_OP 1
00045 #define DP_FNMATCH_OP 2
00046
00047 #define MAX_REPLACE_WITH 10
00048
00049 typedef struct dpl_node{
00050 int dpid;
00051 int pr;
00052 int matchop;
00053 int matchlen;
00054 str match_exp, subst_exp, repl_exp;
00055 pcre *match_comp, *subst_comp;
00056 struct subst_expr * repl_comp;
00057 str attrs;
00058
00059 struct dpl_node * next;
00060 }dpl_node_t, *dpl_node_p;
00061
00062
00063 typedef struct dpl_index{
00064 int len;
00065 dpl_node_t * first_rule;
00066 dpl_node_t * last_rule;
00067
00068 struct dpl_index * next;
00069 }dpl_index_t, *dpl_index_p;
00070
00071
00072 typedef struct dpl_id{
00073 int dp_id;
00074 dpl_index_t* first_index;
00075 struct dpl_id * next;
00076 }dpl_id_t,*dpl_id_p;
00077
00078
00079 #define DP_VAL_INT 0
00080 #define DP_VAL_SPEC 1
00081
00082 typedef struct dp_param{
00083 int type;
00084 union {
00085 int id;
00086 pv_spec_t sp[2];
00087 } v;
00088 }dp_param_t, *dp_param_p;
00089
00090 int init_data();
00091 void destroy_data();
00092 int dp_load_db();
00093
00094 dpl_id_p select_dpid(int id);
00095
00096 struct subst_expr* repl_exp_parse(str subst);
00097 void repl_expr_free(struct subst_expr *se);
00098 int translate(struct sip_msg *msg, str user_name, str* repl_user, dpl_id_p idp, str *);
00099 int rule_translate(struct sip_msg *msg, str , dpl_node_t * rule, str *);
00100 #endif