2 * $Id: re.h,v 1.6 2004/11/12 16:58:58 andrei Exp $
4 * regexp and regexp substitutions implementations
6 * Copyright (C) 2001-2003 FhG Fokus
8 * This file is part of ser, a free SIP server.
10 * ser is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version
15 * For a license to use the ser software under conditions
16 * other than those described here, or to purchase support for this
17 * software, please contact iptel.org by e-mail at the following addresses:
20 * ser is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 * 2003-08-04 created by andrei
33 * 2004-11-12 minor api extension, added *count (andrei)
40 #include "parser/msg_parser.h"
41 #include <sys/types.h> /* for regex */
44 enum replace_special { REPLACE_NMATCH, REPLACE_CHAR, REPLACE_URI };
47 int offset; /* offset in string */
48 int size; /* size of replace "anchor" in string */
49 enum replace_special type;
60 int n_escapes; /* escapes number (replace[] size) */
61 int max_pmatch ; /* highest () referenced */
62 struct replace_with replace[1]; /* 0 does not work on all compilers */
67 int size; /* at offset, delete size bytes and replace them with rpl */
69 struct replace_lst *next;
74 void subst_expr_free(struct subst_expr* se);
75 void replace_lst_free(struct replace_lst* l);
76 struct subst_expr* subst_parser(str* subst);
77 struct replace_lst* subst_run( struct subst_expr* se, const char* input,
78 struct sip_msg* msg, int *count);
79 str* subst_str(const char* input, struct sip_msg* msg,
80 struct subst_expr* se, int* count);