dialplan.h
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
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;
00046 pcre *match_comp, *subst_comp;
00047 struct subst_expr * repl_comp;
00048 str attrs;
00049
00050 struct dpl_node * next;
00051 }dpl_node_t, *dpl_node_p;
00052
00053
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
00063 typedef struct dpl_id{
00064 int dp_id;
00065 dpl_index_t* first_index;
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