Revert "Revert "and added files""
[bcm963xx.git] / userapps / opensource / siproxd / src / log.h
1 /*
2     Copyright (C) 2002-2005  Thomas Ries <tries@gmx.net>
3
4     This file is part of Siproxd.
5     
6     Siproxd is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10     
11     Siproxd is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15     
16     You should have received a copy of the GNU General Public License
17     along with Siproxd; if not, write to the Free Software
18     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
19 */
20
21 /* $Id: log.h,v 1.11 2005/01/08 10:05:12 hb9xar Exp $ */
22
23 #include <stdarg.h>
24
25 #define DBCLASS_BABBLE  0x00000001      /* babble (like entering/leaving fnc)*/
26 #define DBCLASS_NET     0x00000002      /* network                           */
27 #define DBCLASS_SIP     0x00000004      /* SIP manipulations                 */
28 #define DBCLASS_REG     0x00000008      /* Client registration               */
29 #define DBCLASS_NOSPEC  0x00000010      /* non specified class               */
30 #define DBCLASS_PROXY   0x00000020      /* proxy                             */
31 #define DBCLASS_DNS     0x00000040      /* DNS stuff                         */
32 #define DBCLASS_NETTRAF 0x00000080      /* network traffic                   */
33 #define DBCLASS_CONFIG  0x00000100      /* configuration                     */
34 #define DBCLASS_RTP     0x00000200      /* RTP proxy                         */
35 #define DBCLASS_ACCESS  0x00000400      /* Access list evaluation            */
36 #define DBCLASS_AUTH    0x00000800      /* Authentication                    */
37 #define DBCLASS_ALL     0xffffffff      /* All  classes                      */
38
39
40 void log_set_pattern(int pattern);
41 int  log_get_pattern(void);
42 void log_set_stderr(int tostdout);
43 void log_set_silence(int level);
44 void log_set_listen_port(int port);
45 void log_tcp_listen(void);
46 void log_tcp_connect(void);
47
48 #undef DEBUG
49 #define DEBUG(F...) log_debug(1,__FILE__, __LINE__,F)
50
51 #define DEBUGC(C,F...) log_debug(C,__FILE__, __LINE__,F)
52 void log_debug(int class, char *file, int line, const char *format, ...);
53
54 #define ERROR(F...) log_error(__FILE__, __LINE__,F)
55 void log_error(char *file, int line, const char *format, ...);
56
57 #define WARN(F...) log_warn(__FILE__, __LINE__,F)
58 void log_warn(char *file, int line, const char *format, ...);
59
60 #define INFO(F...) log_info(__FILE__, __LINE__,F)
61 void log_info(char *file, int line, const char *format, ...);
62
63 /* tobedone: dump a buffer */
64 #define DUMP_BUFFER(C,F,L) log_dump_buffer(C,__FILE__, __LINE__,F,L)
65 void log_dump_buffer(int class, char *file, int line,
66                      char *buffer, int length);