modules_s/xlog/xl_lib.h

00001 /*
00002  * $Id$
00003  *
00004  * Copyright (C) 2001-2003 FhG Fokus
00005  *
00006  * This file is part of ser, a free SIP server.
00007  *
00008  * ser is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version
00012  *
00013  * For a license to use the ser software under conditions
00014  * other than those described here, or to purchase support for this
00015  * software, please contact iptel.org by e-mail at the following addresses:
00016  *    info@iptel.org
00017  *
00018  * ser is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  * GNU General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU General Public License 
00024  * along with this program; if not, write to the Free Software 
00025  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026  */
00027 
00028 #ifndef _XL_LIB_H_
00029 #define _XL_LIB_H_
00030 
00031 #include "../../parser/msg_parser.h"
00032 
00033 typedef int (*item_func_t) (struct sip_msg*, str*, str*, int, int);
00034 typedef void (*item_free_t) (str*);
00035 
00036 typedef struct _xl_elog
00037 {
00038         str text;
00039         str hparam;
00040         int hindex;
00041         int hflags;
00042         item_func_t itf;
00043         item_free_t free_f;
00044         struct _xl_elog *next;
00045 } xl_elog_t, *xl_elog_p;
00046 
00047 /* callback function to parse the regular expression
00048  * back references */
00049 typedef int (*xl_parse_cb) (str *, int, xl_elog_p);
00050 
00051 typedef int (xl_elog_free_all_f)(xl_elog_p log);
00052 /* int xl_elog_free_all(xl_elog_p log); */
00053 typedef int (xl_parse_format_f)(char *s, xl_elog_p *el);
00054 //int xl_parse_format(char *s, xl_elog_p *el);
00055 typedef int (xl_parse_format2_f)(char *s, xl_elog_p *el, xl_parse_cb cb);
00056 typedef int (xl_print_log_f)(struct sip_msg*, xl_elog_t*, char*, int*);
00057 //int xl_print_log(struct sip_msg* msg, xl_elog_p log, char *buf, int *len);
00058 typedef str* (xl_get_nulstr_f)(void);
00059 
00060 typedef struct xl_api {
00061         xl_print_log_f          *xprint;
00062         xl_parse_format_f       *xparse;
00063         xl_parse_format_f       *shm_xparse;
00064         xl_parse_format2_f      *xparse2;
00065         xl_parse_format2_f      *shm_xparse2;
00066         xl_elog_free_all_f      *xfree;
00067         xl_elog_free_all_f      *shm_xfree;
00068         xl_get_nulstr_f         *xnulstr;
00069 } xl_api_t;
00070 
00071 typedef int (xl_bind_f)(xl_api_t *xl_api);
00072 
00073 /* bind to the xl_lib api */
00074 xl_bind_f xl_bind;
00075 /* parse and free functions that work with pkg memory */
00076 xl_elog_free_all_f xl_elog_free_all;
00077 xl_parse_format_f xl_parse_format;
00078 /* parse and free functions that work with shm memory */
00079 xl_elog_free_all_f xl_elog_shm_free_all;
00080 xl_parse_format_f xl_shm_parse_format;
00081 /* parse function supporting regexp back references - pkg mem version */
00082 xl_parse_format2_f xl_parse_format2;
00083 /* parse function supporting regexp back references - shm mem version */
00084 xl_parse_format2_f xl_shm_parse_format2;
00085 
00086 
00087 xl_print_log_f xl_print_log;
00088 xl_get_nulstr_f xl_get_nulstr;
00089 
00090 int xl_mod_init();
00091 int xl_child_init(int);
00092 #endif
00093