acc.h

Go to the documentation of this file.
00001 /*
00002  * $Id$
00003  *
00004  * Copyright (C) 2001-2003 FhG Fokus
00005  * Copyright (C) 2006 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  * 2003-04-04  grand acc cleanup (jiri)
00026  * 2003-11-04  multidomain support for mysql introduced (jiri)
00027  * 2004-06-06  cleanup: acc_db_{bind,init,close} added (andrei)
00028  * 2006-09-08  flexible multi leg accounting support added,
00029  *             code cleanup for low level functions (bogdan)
00030  * 2006-09-19  final stage of a masive re-structuring and cleanup (bogdan)
00031  */
00032 
00041 #ifndef _ACC_ACC_H_
00042 #define _ACC_ACC_H_
00043 
00044 /* leading text for a request accounted from a script */
00045 #define ACC "ACC: "
00046 #define ACC_REQUEST ACC"request accounted: "
00047 #define ACC_REQUEST_LEN (sizeof(ACC_REQUEST)-1)
00048 #define ACC_MISSED ACC"call missed: "
00049 #define ACC_MISSED_LEN (sizeof(ACC_MISSED)-1)
00050 #define ACC_ANSWERED ACC"transaction answered: "
00051 #define ACC_ANSWERED_LEN (sizeof(ACC_ANSWERED)-1)
00052 #define ACC_ACKED ACC"request acknowledged: "
00053 #define ACC_ACKED_LEN (sizeof(ACC_ACKED)-1)
00054 
00055 /* syslog attribute names */
00056 #define A_METHOD "method"
00057 #define A_METHOD_LEN (sizeof(A_METHOD)-1)
00058 #define A_FROMTAG "from_tag"
00059 #define A_FROMTAG_LEN (sizeof(A_FROMTAG)-1)
00060 #define A_TOTAG "to_tag"
00061 #define A_TOTAG_LEN (sizeof(A_TOTAG)-1)
00062 #define A_CALLID "call_id"
00063 #define A_CALLID_LEN (sizeof(A_CALLID)-1)
00064 #define A_CODE "code"
00065 #define A_CODE_LEN (sizeof(A_CODE)-1)
00066 #define A_STATUS "reason"
00067 #define A_STATUS_LEN (sizeof(A_STATUS)-1)
00068 
00069 #define A_SEPARATOR_CHR ';'
00070 #define A_SEPARATOR_CHR_2 ' '
00071 #define A_EQ_CHR '='
00072 
00073 #define MAX_SYSLOG_SIZE  65536
00074 
00075 #define MAX_FAILED_FILTER_COUNT 15
00076 
00077 /* WARNING: This is a flag stored in the sip_msg structure, the flag is
00078  * temporarily defined here to make the module work with the sip-router core,
00079  * I assume it won't be needed once we merge acc implementations from both
00080  * projects. The value of the flag must be kept synchronized with other flags
00081  * defined in parser/msg_parser.h!
00082  */
00083 #define FL_REQ_UPSTREAM (1<<29)
00084 
00085 void acc_log_init(void);
00086 int  acc_log_request( struct sip_msg *req);
00087 
00088 int core2strar(struct sip_msg *req, str *c_vals, int *i_vals, char *t_vals);
00089 
00090 #ifdef SQL_ACC
00091 int  acc_db_init(const str* db_url);
00092 int  acc_db_init_child(const str* db_url);
00093 void acc_db_close(void);
00094 int  acc_db_request( struct sip_msg *req);
00095 #endif
00096 
00097 #ifdef RAD_ACC
00098 int  init_acc_rad(char *rad_cfg, int srv_type);
00099 int  acc_rad_request( struct sip_msg *req );
00100 #endif
00101 
00102 #ifdef DIAM_ACC
00103 int  acc_diam_init(void);
00104 int  acc_diam_request( struct sip_msg *req );
00105 #endif
00106 
00107 #endif