1 /* Copyright (C) 2007-2020 Open Information Security Foundation 2 * 3 * You can copy, redistribute or modify this Program under the terms of 4 * the GNU General Public License version 2 as published by the Free 5 * Software Foundation. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * version 2 along with this program; if not, write to the Free Software 14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 15 * 02110-1301, USA. 16 */ 17 18 /** 19 * \file 20 * 21 * \author Anoop Saldanha <anoopsaldanha@gmail.com> 22 */ 23 24 #ifndef __ERROR_H__ 25 #define __ERROR_H__ 26 27 28 /* different error types */ 29 typedef enum { 30 SC_OK, 31 SC_ERR_MEM_ALLOC, 32 SC_ERR_PCRE_MATCH, 33 SC_ERR_ACTION_ORDER, 34 SC_ERR_PCRE_GET_SUBSTRING, 35 SC_ERR_PCRE_COMPILE, 36 SC_ERR_PCRE_STUDY, 37 SC_ERR_PCRE_PARSE, 38 SC_ERR_LOG_MODULE_NOT_INIT, 39 SC_ERR_LOG_FG_FILTER_MATCH, 40 SC_ERR_COUNTER_EXCEEDED, 41 SC_ERR_INVALID_CHECKSUM, 42 SC_ERR_SPRINTF, 43 SC_ERR_INVALID_ARGUMENT, 44 SC_ERR_SPINLOCK, 45 SC_ERR_INVALID_ENUM_MAP, 46 SC_ERR_INVALID_IP_NETBLOCK, 47 SC_ERR_INVALID_IPV4_ADDR, 48 SC_ERR_INVALID_IPV6_ADDR, 49 SC_ERR_INVALID_RUNMODE, 50 SC_ERR_PCAP_DISPATCH, 51 SC_ERR_PCAP_CREATE, 52 SC_ERR_PCAP_SET_SNAPLEN, 53 SC_ERR_PCAP_SET_PROMISC, 54 SC_ERR_PCAP_SET_TIMEOUT, 55 SC_ERR_PCAP_OPEN_LIVE, 56 SC_ERR_PCAP_OPEN_OFFLINE, 57 SC_ERR_PCAP_ACTIVATE_HANDLE, 58 SC_ERR_PCAP_SET_BUFF_SIZE, 59 SC_ERR_NO_PCAP_SET_BUFFER_SIZE, 60 SC_ERR_NO_PF_RING, 61 SC_ERR_PF_RING_RECV, 62 SC_ERR_PF_RING_GET_CLUSTERID_FAILED, 63 SC_ERR_PF_RING_GET_INTERFACE_FAILED, 64 SC_ERR_PF_RING_OPEN, 65 SC_ERR_GET_CLUSTER_TYPE_FAILED, 66 SC_ERR_INVALID_CLUSTER_TYPE, 67 SC_ERR_PF_RING_SET_CLUSTER_FAILED, 68 SC_ERR_DATALINK_UNIMPLEMENTED, 69 SC_ERR_INVALID_SIGNATURE, 70 SC_ERR_OPENING_FILE, 71 SC_ERR_OPENING_RULE_FILE, 72 SC_ERR_NO_RULES, 73 SC_ERR_NO_RULES_LOADED, 74 SC_ERR_FOPEN, 75 SC_ERR_INITIALIZATION, 76 SC_ERR_THREAD_SPAWN, 77 SC_ERR_THREAD_NICE_PRIO, 78 SC_ERR_THREAD_CREATE, 79 SC_ERR_THREAD_INIT, /**< thread's initialization function failed */ 80 SC_ERR_SYSCALL, 81 SC_ERR_SYSCONF, 82 SC_ERR_INVALID_ARGUMENTS, 83 SC_ERR_STATS_NOT_INIT, 84 SC_ERR_COMPLETE_PORT_SPACE_NEGATED, 85 SC_ERR_NO_PORTS_LEFT_AFTER_MERGE, 86 SC_ERR_NEGATED_VALUE_IN_PORT_RANGE, 87 SC_ERR_PORT_PARSE_INSERT_STRING, 88 SC_ERR_UNREACHABLE_CODE_REACHED, 89 SC_ERR_ALPARSER, 90 SC_ERR_INVALID_NUMERIC_VALUE, 91 SC_ERR_NUMERIC_VALUE_ERANGE, 92 SC_ERR_INVALID_NUM_BYTES, 93 SC_ERR_ARG_LEN_LONG, 94 SC_ERR_POOL_EMPTY, 95 SC_ERR_REASSEMBLY, 96 SC_ERR_POOL_INIT, 97 SC_ERR_NFQ_NOSUPPORT, 98 SC_ERR_NFQ_OPEN, 99 SC_ERR_NFQ_BIND, 100 SC_ERR_NFQ_UNBIND, 101 SC_ERR_NFQ_MAXLEN, 102 SC_ERR_NFQ_CREATE_QUEUE, 103 SC_ERR_NFQ_SET_MODE, 104 SC_ERR_NFQ_SETSOCKOPT, 105 SC_ERR_NFQ_RECV, 106 SC_ERR_NFQ_HANDLE_PKT, 107 SC_ERR_NFQ_SET_VERDICT, 108 SC_ERR_NFQ_THREAD_INIT, 109 SC_ERR_IPFW_NOSUPPORT, 110 SC_ERR_IPFW_BIND, 111 SC_ERR_IPFW_SOCK, 112 SC_ERR_IPFW_NOPORT, 113 SC_WARN_IPFW_RECV, 114 SC_WARN_IPFW_XMIT, 115 SC_WARN_IPFW_SETSOCKOPT, 116 SC_WARN_IPFW_UNBIND, 117 SC_ERR_DAEMON, 118 SC_ERR_UNIMPLEMENTED, 119 SC_ERR_ADDRESS_ENGINE_GENERIC, 120 SC_ERR_PORT_ENGINE_GENERIC, 121 SC_ERR_IPONLY_RADIX, 122 SC_ERR_FAST_LOG_GENERIC, 123 SC_ERR_DEBUG_LOG_GENERIC, 124 SC_ERR_UNIFIED_LOG_GENERIC, 125 SC_ERR_HTTP_LOG_GENERIC, 126 SC_ERR_TLS_LOG_GENERIC, 127 SC_ERR_UNIFIED_ALERT_GENERIC, 128 SC_ERR_UNIFIED2_ALERT_GENERIC, 129 SC_ERR_FWRITE, 130 SC_ERR_THRESHOLD_HASH_ADD, 131 SC_ERR_UNDEFINED_VAR, 132 SC_ERR_RULE_KEYWORD_UNKNOWN, 133 SC_ERR_FLAGS_MODIFIER, 134 SC_ERR_DISTANCE_MISSING_CONTENT, 135 SC_ERR_WITHIN_MISSING_CONTENT, 136 SC_ERR_WITHIN_INVALID, 137 SC_ERR_OFFSET_MISSING_CONTENT, 138 SC_ERR_DEPTH_MISSING_CONTENT, 139 SC_ERR_BYTETEST_MISSING_CONTENT, 140 SC_ERR_BYTEJUMP_MISSING_CONTENT, 141 SC_ERR_NOCASE_MISSING_PATTERN, 142 SC_ERR_RAWBYTES_MISSING_CONTENT, 143 SC_ERR_NO_URICONTENT_NEGATION, 144 SC_ERR_HASH_TABLE_INIT, 145 SC_ERR_STAT, 146 SC_ERR_LOGDIR_CONFIG, 147 SC_ERR_LOGDIR_CMDLINE, 148 SC_ERR_MISSING_CONFIG_PARAM, 149 SC_ERR_RADIX_TREE_GENERIC, 150 SC_ERR_MISSING_QUOTE, 151 SC_ERR_MUTEX, 152 SC_ERR_REPUTATION_INVALID_OPERATION, 153 SC_ERR_REPUTATION_INVALID_TYPE, 154 SC_ERR_UNKNOWN_PROTOCOL, /**< signature contains invalid protocol */ 155 SC_ERR_UNKNOWN_RUN_MODE, 156 SC_ERR_MULTIPLE_RUN_MODE, 157 SC_ERR_BPF, 158 SC_ERR_BYTE_EXTRACT_FAILED, 159 SC_ERR_UNKNOWN_VALUE, 160 SC_ERR_INVALID_VALUE, 161 SC_ERR_UNKNOWN_REGEX_MOD, 162 SC_ERR_INVALID_OPERATOR, 163 SC_ERR_PCAP_RECV_INIT, 164 SC_ERR_CUDA_ERROR, 165 SC_ERR_CUDA_HANDLER_ERROR, 166 SC_ERR_TM_THREADS_ERROR, 167 SC_ERR_TM_MODULES_ERROR, 168 SC_ERR_AC_CUDA_ERROR, 169 SC_ERR_INVALID_YAML_CONF_ENTRY, 170 SC_ERR_TMQ_ALREADY_REGISTERED, 171 SC_ERR_CONFLICTING_RULE_KEYWORDS, 172 SC_ERR_INVALID_ACTION, 173 SC_ERR_LIBNET_REQUIRED_FOR_ACTION, 174 SC_ERR_LIBNET_INIT, 175 SC_ERR_LIBNET_INVALID_DIR, 176 SC_ERR_LIBNET_BUILD_FAILED, 177 SC_ERR_LIBNET_WRITE_FAILED, 178 SC_ERR_LIBNET_NOT_ENABLED, 179 SC_ERR_UNIFIED_LOG_FILE_HEADER, /**< Error to indicate the unified file 180 header writing function has been 181 failed */ 182 SC_ERR_REFERENCE_UNKNOWN, /**< unknown reference key (cve, url, etc) */ 183 SC_ERR_PIDFILE_SNPRINTF, 184 SC_ERR_PIDFILE_OPEN, 185 SC_ERR_PIDFILE_WRITE, 186 SC_ERR_PIDFILE_DAEMON, 187 SC_ERR_UID_FAILED, 188 SC_ERR_GID_FAILED, 189 SC_ERR_CHANGING_CAPS_FAILED, 190 SC_ERR_LIBCAP_NG_REQUIRED, 191 SC_ERR_LIBNET11_INCOMPATIBLE_WITH_LIBCAP_NG, 192 SC_WARN_FLOW_EMERGENCY, 193 SC_WARN_COMPATIBILITY, 194 SC_ERR_SVC, 195 SC_ERR_ERF_DAG_OPEN_FAILED, 196 SC_ERR_ERF_DAG_STREAM_OPEN_FAILED, 197 SC_ERR_ERF_DAG_STREAM_START_FAILED, 198 SC_ERR_ERF_DAG_STREAM_SET_FAILED, 199 SC_ERR_ERF_DAG_STREAM_READ_FAILED, 200 SC_WARN_ERF_DAG_REC_LEN_CHANGED, 201 SC_ERR_DAG_REQUIRED, 202 SC_ERR_DAG_NOSUPPORT, /**< no ERF/DAG support compiled in */ 203 SC_ERR_FATAL, 204 SC_ERR_DCERPC, 205 SC_ERR_DETECT_PREPARE, /**< preparing the detection engine failed */ 206 SC_ERR_AHO_CORASICK, 207 SC_ERR_REFERENCE_CONFIG, 208 SC_ERR_DUPLICATE_SIG, /**< Error to indicate that signature is duplicate */ 209 SC_WARN_PCAP_MULTI_DEV_EXPERIMENTAL, 210 SC_ERR_PCAP_MULTI_DEV_NO_SUPPORT, 211 SC_ERR_HTTP_METHOD_NEEDS_PRECEEDING_CONTENT, 212 SC_ERR_HTTP_METHOD_INCOMPATIBLE_WITH_RAWBYTES, 213 SC_ERR_HTTP_METHOD_RELATIVE_MISSING, 214 SC_ERR_HTTP_COOKIE_NEEDS_PRECEEDING_CONTENT, 215 SC_ERR_HTTP_COOKIE_INCOMPATIBLE_WITH_RAWBYTES, 216 SC_ERR_HTTP_COOKIE_RELATIVE_MISSING, 217 SC_ERR_LOGPCAP_SGUIL_BASE_DIR_MISSING, 218 SC_ERR_UNKNOWN_DECODE_EVENT, 219 SC_ERR_RUNMODE, 220 SC_ERR_SHUTDOWN, 221 SC_ERR_INVALID_DIRECTION, 222 SC_ERR_AFP_CREATE, 223 SC_ERR_AFP_READ, 224 SC_ERR_AFP_DISPATCH, 225 SC_ERR_NO_AF_PACKET, 226 SC_ERR_PCAP_FILE_DELETE_FAILED, 227 SC_ERR_CMD_LINE, 228 SC_ERR_MAGIC_OPEN, 229 SC_ERR_MAGIC_LOAD, 230 SC_ERR_SIZE_PARSE, 231 SC_ERR_RAWBYTES_BUFFER, 232 SC_ERR_SOCKET, 233 SC_ERR_PCAP_TRANSLATE, /* failed to translate ip to dev */ 234 SC_WARN_OUTDATED_LIBHTP, 235 SC_WARN_DEPRECATED, 236 SC_WARN_PROFILE, 237 SC_ERR_FLOW_INIT, 238 SC_ERR_HOST_INIT, 239 SC_ERR_MEM_BUFFER_API, 240 SC_ERR_INVALID_MD5, 241 SC_ERR_NO_MD5_SUPPORT, 242 SC_ERR_EVENT_ENGINE, 243 SC_ERR_NO_LUA_SUPPORT, 244 SC_ERR_LUA_ERROR, 245 SC_ERR_DEFRAG_INIT, 246 SC_ERR_NAPATECH_OPEN_FAILED, 247 SC_ERR_NAPATECH_STREAM_NEXT_FAILED, 248 SC_ERR_NAPATECH_NOSUPPORT, 249 SC_ERR_NAPATECH_REQUIRED, 250 SC_ERR_NAPATECH_TIMESTAMP_TYPE_NOT_SUPPORTED, 251 SC_ERR_NAPATECH_INIT_FAILED, 252 SC_ERR_NAPATECH_CONFIG_STREAM, 253 SC_ERR_NAPATECH_STREAMS_REGISTER_FAILED, 254 SC_ERR_NAPATECH_STAT_DROPS_FAILED, 255 SC_ERR_NAPATECH_PARSE_CONFIG, 256 SC_ERR_NO_REPUTATION, 257 SC_ERR_NOT_SUPPORTED, 258 SC_ERR_IPFW_SETSOCKOPT, 259 SC_ERR_NO_GEOIP_SUPPORT, 260 SC_ERR_GEOIP_ERROR, 261 SC_ERR_LIVE_RULE_SWAP, 262 SC_WARN_UNCOMMON, 263 SC_ERR_CUDA_BUFFER_ERROR, 264 SC_ERR_DNS_LOG_GENERIC, 265 SC_WARN_OPTION_OBSOLETE, 266 SC_WARN_NO_UNITTESTS, 267 SC_ERR_THREAD_QUEUE, 268 SC_WARN_XFF_INVALID_MODE, 269 SC_WARN_XFF_INVALID_HEADER, 270 SC_WARN_XFF_INVALID_DEPLOYMENT, 271 SC_ERR_THRESHOLD_SETUP, 272 SC_ERR_DNS_CONFIG, 273 SC_ERR_MODBUS_CONFIG, 274 SC_ERR_CONF_YAML_ERROR, 275 SC_ERR_CONF_NAME_TOO_LONG, 276 SC_ERR_APP_LAYER_PROTOCOL_DETECTION, 277 SC_ERR_PCIE_INIT_FAILED, 278 SC_ERR_NFLOG_NOSUPPORT, 279 SC_ERR_NFLOG_OPEN, 280 SC_ERR_NFLOG_BIND, 281 SC_ERR_NFLOG_UNBIND, 282 SC_ERR_NFLOG_MAX_BUFSIZ, 283 SC_ERR_NFLOG_SET_MODE, 284 SC_ERR_NFLOG_HANDLE_PKT, 285 SC_ERR_NFLOG_GROUP, 286 SC_ERR_NFLOG_FD, 287 SC_WARN_NFLOG_RECV, 288 SC_WARN_NFLOG_LOSING_EVENTS, 289 SC_WARN_NFLOG_MAXBUFSIZ_REACHED, 290 SC_WARN_NFLOG_SETSOCKOPT, 291 SC_WARN_LUA_SCRIPT, 292 SC_ERR_LUA_SCRIPT, 293 SC_WARN_NO_STATS_LOGGERS, 294 SC_ERR_NO_NETMAP, 295 SC_ERR_NETMAP_CREATE, 296 SC_ERR_NETMAP_READ, 297 SC_ERR_THREAD_DEINIT, /**< thread's deinit function failed */ 298 SC_ERR_IPPAIR_INIT, 299 SC_ERR_MT_NO_SELECTOR, 300 SC_ERR_MT_DUPLICATE_TENANT, 301 SC_ERR_NO_JSON_SUPPORT, 302 SC_ERR_INVALID_RULE_ARGUMENT, /**< Generic error code for invalid 303 * rule argument. */ 304 SC_ERR_MT_NO_MAPPING, 305 SC_ERR_STATS_LOG_NEGATED, /**< When totals and threads are both NO in yaml **/ 306 SC_ERR_JSON_STATS_LOG_NEGATED, /**< When totals and threads are both NO in yaml **/ 307 SC_ERR_DEPRECATED_CONF, /**< Deprecated configuration parameter. */ 308 SC_WARN_FASTER_CAPTURE_AVAILABLE, 309 SC_WARN_POOR_RULE, 310 SC_ERR_ALERT_PAYLOAD_BUFFER, 311 SC_ERR_STATS_LOG_GENERIC, 312 SC_ERR_TCPDATA_LOG_GENERIC, 313 SC_ERR_FLOW_LOG_GENERIC, 314 SC_ERR_NETFLOW_LOG_GENERIC, 315 SC_ERR_SMTP_LOG_GENERIC, 316 SC_ERR_SSH_LOG_GENERIC, 317 SC_ERR_NIC_OFFLOADING, 318 SC_ERR_NO_FILES_FOR_PROTOCOL, 319 SC_ERR_INVALID_HASH, 320 SC_ERR_NO_SHA1_SUPPORT, 321 SC_ERR_NO_SHA256_SUPPORT, 322 SC_ERR_ENIP_CONFIG, 323 SC_ERR_DNP3_CONFIG, 324 SC_ERR_DIR_OPEN, 325 SC_WARN_REMOVE_FILE, 326 SC_ERR_NO_MAGIC_SUPPORT, 327 SC_ERR_REDIS, 328 SC_ERR_VAR_LIMIT, 329 SC_WARN_DUPLICATE_OUTPUT, 330 SC_WARN_CHMOD, 331 SC_WARN_LOG_CF_TOO_MANY_NODES, 332 SC_WARN_EVENT_DROPPED, 333 SC_ERR_NO_REDIS_ASYNC, 334 SC_ERR_REDIS_CONFIG, 335 SC_ERR_BYPASS_NOT_SUPPORTED, 336 SC_WARN_RENAMING_FILE, 337 SC_ERR_PF_RING_VLAN, 338 SC_ERR_CREATE_DIRECTORY, 339 SC_WARN_FLOWBIT, 340 SC_ERR_SMB_CONFIG, 341 SC_WARN_NO_JA3_SUPPORT, 342 SC_WARN_JA3_DISABLED, 343 SC_ERR_PCAP_LOG_COMPRESS, 344 SC_ERR_FSEEK, 345 SC_ERR_WINDIVERT_GENERIC, 346 SC_ERR_WINDIVERT_NOSUPPORT, 347 SC_ERR_WINDIVERT_INVALID_FILTER, 348 SC_ERR_WINDIVERT_TOOLONG_FILTER, 349 SC_WARN_RUST_NOT_AVAILABLE, 350 SC_WARN_DEFAULT_WILL_CHANGE, 351 SC_WARN_EVE_MISSING_EVENTS, 352 SC_ERR_PLEDGE_FAILED, 353 SC_ERR_FTP_LOG_GENERIC, 354 SC_ERR_THASH_INIT, 355 SC_ERR_DATASET, 356 SC_WARN_ANOMALY_CONFIG, 357 SC_WARN_ALERT_CONFIG, 358 SC_ERR_PCRE_COPY_SUBSTRING, 359 SC_WARN_PCRE_JITSTACK, 360 SC_WARN_REGISTRATION_FAILED, 361 SC_ERR_ERF_BAD_RLEN, 362 SC_WARN_ERSPAN_CONFIG, 363 SC_WARN_HASSH_DISABLED, 364 SC_WARN_FILESTORE_CONFIG, 365 SC_WARN_PATH_READ_ERROR, 366 SC_ERR_HTTP2_LOG_GENERIC, 367 SC_ERR_PLUGIN, 368 SC_ERR_LOG_OUTPUT, 369 SC_ERR_RULE_INVALID_UTF8, 370 371 SC_ERR_MAX 372 } SCError; 373 374 const char *SCErrorToString(SCError); 375 376 377 #endif /* __ERROR_H__ */ 378