[1] | 1 | /* SAMHAIN file system integrity testing */
|
---|
| 2 | /* Copyright (C) 1999 Rainer Wichmann */
|
---|
| 3 | /* */
|
---|
| 4 | /* This program is free software; you can redistribute it */
|
---|
| 5 | /* and/or modify */
|
---|
| 6 | /* it under the terms of the GNU General Public License as */
|
---|
| 7 | /* published by */
|
---|
| 8 | /* the Free Software Foundation; either version 2 of the License, or */
|
---|
| 9 | /* (at your option) any later version. */
|
---|
| 10 | /* */
|
---|
| 11 | /* This program 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 this program; if not, write to the Free Software */
|
---|
| 18 | /* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
---|
| 19 |
|
---|
| 20 |
|
---|
| 21 | /* Public interface for error routines
|
---|
| 22 | */
|
---|
| 23 | #ifndef SH_ERROR_H
|
---|
| 24 | #define SH_ERROR_H
|
---|
| 25 |
|
---|
| 26 | #include "sh_error_min.h"
|
---|
| 27 |
|
---|
| 28 |
|
---|
| 29 | enum {
|
---|
| 30 | SH_ERR_T_START = 0,
|
---|
| 31 |
|
---|
[27] | 32 | /* 1-13 = SH_LEVEL_XXX */
|
---|
[1] | 33 |
|
---|
| 34 | SH_ERR_T_RO = SH_LEVEL_READONLY,
|
---|
| 35 | SH_ERR_T_LOGS = SH_LEVEL_LOGFILES,
|
---|
| 36 | SH_ERR_T_GLOG = SH_LEVEL_LOGGROW,
|
---|
| 37 | SH_ERR_T_NOIG = SH_LEVEL_NOIGNORE,
|
---|
| 38 | SH_ERR_T_ALLIG = SH_LEVEL_ALLIGNORE,
|
---|
| 39 | SH_ERR_T_ATTR = SH_LEVEL_ATTRIBUTES,
|
---|
| 40 | SH_ERR_T_USER0 = SH_LEVEL_USER0,
|
---|
| 41 | SH_ERR_T_USER1 = SH_LEVEL_USER1,
|
---|
[27] | 42 | SH_ERR_T_USER2 = SH_LEVEL_USER2,
|
---|
| 43 | SH_ERR_T_USER3 = SH_LEVEL_USER3,
|
---|
| 44 | SH_ERR_T_USER4 = SH_LEVEL_USER4,
|
---|
[1] | 45 | SH_ERR_T_PRELINK = SH_LEVEL_PRELINK,
|
---|
| 46 |
|
---|
[27] | 47 | SH_ERR_T_DIR = 13,
|
---|
| 48 | SH_ERR_T_FILE = 14,
|
---|
| 49 | SH_ERR_T_NAME = 15,
|
---|
[1] | 50 |
|
---|
[27] | 51 | SH_ERR_T_END = 16
|
---|
[1] | 52 | };
|
---|
| 53 |
|
---|
| 54 |
|
---|
| 55 | typedef struct _errFlags {
|
---|
| 56 | int debug;
|
---|
| 57 | int HaveLog;
|
---|
| 58 |
|
---|
| 59 | int loglevel;
|
---|
| 60 | int loglevel_temp;
|
---|
| 61 | int printlevel;
|
---|
| 62 | int maillevel;
|
---|
| 63 | int exportlevel;
|
---|
| 64 | int sysloglevel;
|
---|
| 65 | int externallevel;
|
---|
| 66 | int databaselevel;
|
---|
| 67 |
|
---|
| 68 | int log_class;
|
---|
| 69 | int print_class;
|
---|
| 70 | int mail_class;
|
---|
| 71 | int export_class;
|
---|
| 72 | int syslog_class;
|
---|
| 73 | int external_class;
|
---|
| 74 | int database_class;
|
---|
| 75 |
|
---|
| 76 | /* HAVE_LIBPRELUDE */
|
---|
| 77 | int preludelevel;
|
---|
| 78 | int prelude_class;
|
---|
| 79 |
|
---|
| 80 | } blurb_errFlags;
|
---|
| 81 |
|
---|
| 82 | extern int ShDFLevel[SH_ERR_T_END];
|
---|
| 83 |
|
---|
| 84 | /* set mask for message class
|
---|
| 85 | */
|
---|
[22] | 86 | int sh_error_log_mask (const char * c);
|
---|
| 87 | int sh_error_print_mask (const char * c);
|
---|
| 88 | int sh_error_mail_mask (const char * c);
|
---|
| 89 | int sh_error_export_mask (const char * c);
|
---|
| 90 | int sh_error_syslog_mask (const char * c);
|
---|
| 91 | int sh_error_external_mask (const char * c);
|
---|
| 92 | int sh_error_database_mask (const char * c);
|
---|
| 93 | int sh_error_prelude_mask (const char * c);
|
---|
[1] | 94 |
|
---|
| 95 |
|
---|
[20] | 96 | int sh_error_verify (const char * s);
|
---|
| 97 | int sh_error_logverify_mod (const char * s); /* just list, don't verify */
|
---|
| 98 | int sh_error_logverify (const char * s);
|
---|
[1] | 99 |
|
---|
| 100 | void sh_error_dbg_switch(void);
|
---|
| 101 |
|
---|
| 102 | #ifdef SH_WITH_SERVER
|
---|
[283] | 103 |
|
---|
[1] | 104 | void sh_error_set_peer(const char * str);
|
---|
[283] | 105 | #ifdef HAVE_LIBPRELUDE
|
---|
| 106 | void sh_error_set_peer_ip(const char * str);
|
---|
| 107 | #endif
|
---|
[22] | 108 | int set_flag_sep_log (const char * str);
|
---|
[1] | 109 | #endif
|
---|
| 110 |
|
---|
| 111 | /* init or re-init log facilities that need it
|
---|
| 112 | */
|
---|
[170] | 113 | void sh_error_fixup(void);
|
---|
[1] | 114 |
|
---|
| 115 | /* only to stderr (GOOD/BAD)
|
---|
| 116 | */
|
---|
| 117 | void sh_error_only_stderr (int flag);
|
---|
| 118 |
|
---|
[86] | 119 | /* facilities unsafe for closeall()
|
---|
| 120 | */
|
---|
| 121 | void sh_error_enable_unsafe (int flag);
|
---|
| 122 |
|
---|
[1] | 123 | /* set syslog facility
|
---|
| 124 | */
|
---|
[22] | 125 | int sh_log_set_facility (const char * c);
|
---|
[1] | 126 |
|
---|
[279] | 127 | /* map heartbeat messages
|
---|
| 128 | */
|
---|
| 129 | int sh_log_set_stamp_priority (const char * c);
|
---|
| 130 |
|
---|
[1] | 131 | /* define message header
|
---|
| 132 | */
|
---|
[22] | 133 | int sh_error_ehead (/*@null@*/const char * s);
|
---|
[1] | 134 |
|
---|
| 135 | /* set level for error logging
|
---|
| 136 | */
|
---|
[20] | 137 | int sh_error_setlog(const char * str_s);
|
---|
[1] | 138 |
|
---|
| 139 | /* set severity levels
|
---|
| 140 | */
|
---|
[22] | 141 | int sh_error_set_iv (int iv, const char * severity_s);
|
---|
[1] | 142 |
|
---|
| 143 | /* set priorities
|
---|
| 144 | */
|
---|
[20] | 145 | int sh_error_set_level(const char * str_s, int *facility);
|
---|
[1] | 146 |
|
---|
| 147 | /* set level for TCP export
|
---|
| 148 | */
|
---|
[20] | 149 | int sh_error_setexport(const char * str_s);
|
---|
[1] | 150 |
|
---|
| 151 | /* set level for syslog
|
---|
| 152 | */
|
---|
[20] | 153 | int sh_error_set_syslog (const char * flag_s);
|
---|
[1] | 154 |
|
---|
| 155 | /* set level for printing
|
---|
| 156 | */
|
---|
[20] | 157 | int sh_error_setprint(const char * flag_s);
|
---|
[1] | 158 |
|
---|
| 159 | /* set severity for external
|
---|
| 160 | */
|
---|
[20] | 161 | int sh_error_set_external (const char * str_s);
|
---|
[1] | 162 |
|
---|
| 163 | /* set severity for external
|
---|
| 164 | */
|
---|
[20] | 165 | int sh_error_set_database (const char * str_s);
|
---|
[1] | 166 |
|
---|
| 167 | /* set severity for external
|
---|
| 168 | */
|
---|
[20] | 169 | int sh_error_set_prelude (const char * str_s);
|
---|
[1] | 170 |
|
---|
| 171 |
|
---|
| 172 | /* set level for mailing
|
---|
| 173 | */
|
---|
[20] | 174 | int sh_error_setseverity (const char * flag);
|
---|
[1] | 175 |
|
---|
| 176 | /* set debug level
|
---|
| 177 | */
|
---|
| 178 | int sh_error_setdebug (char * debug_s);
|
---|
| 179 |
|
---|
| 180 | /* error messages
|
---|
| 181 | */
|
---|
[132] | 182 | /*@owned@*/char * sh_error_message (int tellme, char * str, size_t len);
|
---|
[1] | 183 |
|
---|
| 184 | /* switch on/off log to file temporarily
|
---|
| 185 | */
|
---|
| 186 | void sh_error_logoff(void);
|
---|
| 187 | void sh_error_logrestore(void);
|
---|
| 188 |
|
---|
| 189 | /* (re)set the console device(s)
|
---|
| 190 | */
|
---|
[22] | 191 | int sh_log_set_console (const char * address);
|
---|
[1] | 192 | void reset_count_dev_console(void);
|
---|
| 193 |
|
---|
| 194 | #ifdef WITH_MESSAGE_QUEUE
|
---|
| 195 | /* close the message queue
|
---|
| 196 | */
|
---|
| 197 | void close_ipc (void);
|
---|
| 198 |
|
---|
| 199 | /* enable message queue
|
---|
| 200 | */
|
---|
[22] | 201 | int enable_msgq(const char * foo);
|
---|
[1] | 202 | #endif
|
---|
| 203 |
|
---|
| 204 | #endif
|
---|