added files
[bcm963xx.git] / userapps / opensource / net-snmp / include / net-snmp / library / snmp_logging.h
1 #ifndef SNMP_LOGGING_H
2 #define SNMP_LOGGING_H
3
4 #ifdef __cplusplus
5 extern          "C" {
6 #endif
7
8 #if HAVE_SYSLOG_H
9 #include <syslog.h>
10 #endif
11 #if HAVE_STDARG_H
12 #include <stdarg.h>
13 #else
14 #include <varargs.h>
15 #endif
16
17 #ifndef LOG_ERR
18 #define LOG_EMERG       0       /* system is unusable */
19 #define LOG_ALERT       1       /* action must be taken immediately */
20 #define LOG_CRIT        2       /* critical conditions */
21 #define LOG_ERR         3       /* error conditions */
22 #define LOG_WARNING     4       /* warning conditions */
23 #define LOG_NOTICE      5       /* normal but significant condition */
24 #define LOG_INFO        6       /* informational */
25 #define LOG_DEBUG       7       /* debug-level messages */
26 #endif
27
28     struct snmp_log_message {
29         int             priority;
30         const char     *msg;
31     };
32
33 #ifndef DEFAULT_LOG_ID
34 #define DEFAULT_LOG_ID "net-snmp"
35 #endif
36
37     void            init_snmp_logging(void);
38     int             snmp_get_do_logging(void);
39     void            snmp_disable_syslog(void);
40     void            snmp_disable_filelog(void);
41     void            snmp_disable_stderrlog(void);
42     void            snmp_disable_calllog(void);
43     void            snmp_disable_log(void);
44     void            snmp_enable_syslog(void);
45     void            snmp_enable_syslog_ident(const char *ident,
46                                              const int   facility);
47     void            snmp_enable_filelog(const char *logfilename,
48                                         int dont_zero_log);
49     void            snmp_enable_stderrlog(void);
50     void            snmp_enable_calllog(void);
51
52 #if HAVE_STDARG_H
53     int             snmp_log(int priority, const char *format, ...);
54 #else
55     int             snmp_log(va_alist);
56 #endif
57     int             snmp_vlog(int priority, const char *format,
58                               va_list ap);
59     /*
60      * 0 - successful message formatting 
61      */
62     /*
63      * -1 - Could not format log-string 
64      */
65     /*
66      * -2 - Could not allocate memory for log-message 
67      */
68     /*
69      * -3 - Log-message too long! 
70      */
71
72     void            snmp_log_perror(const char *s);
73
74 #ifdef __cplusplus
75 }
76 #endif
77 #endif                          /* SNMP_LOGGING_H */