suricata
|
#include "suricata-common.h"
Go to the source code of this file.
Functions | |
int | SCLogMatchFGFilterWL (const char *file, const char *function, int line) |
Checks if there is a match for the incoming log_message with any of the FG filters. If there is a match, it allows the message to be logged, else it rejects that message. More... | |
int | SCLogMatchFGFilterBL (const char *file, const char *function, int line) |
Checks if there is a match for the incoming log_message with any of the FG filters. If there is a match it rejects the logging for that messages, else it allows that message to be logged. More... | |
int | SCLogAddFGFilterWL (const char *file, const char *function, int line) |
Adds a Whitelist(WL) fine-grained(FG) filter. A FG filter WL filter allows messages that match this filter, to be logged, while the filter is defined using a file_name, function_name and line_number. More... | |
int | SCLogAddFGFilterBL (const char *file, const char *function, int line) |
Adds a Blacklist(BL) fine-grained(FG) filter. A FG filter BL filter allows messages that don't match this filter, to be logged, while the filter is defined using a file_name, function_name and line_number. More... | |
void | SCLogReleaseFGFilters (void) |
int | SCLogPrintFGFilters () |
Prints the FG filters(both WL and BL). Used for debugging purposes. More... | |
int | SCLogMatchFDFilter (const char *function) |
Checks if there is a match for the incoming log_message with any of the FD filters. More... | |
int | SCLogCheckFDFilterEntry (const char *function) |
Updates a FD filter, based on whether the function that calls this function, is registered as a FD filter or not. This is called by a function only on its entry. More... | |
void | SCLogCheckFDFilterExit (const char *function) |
Updates a FD filter, based on whether the function that calls this function, is registered as a FD filter or not. This is called by a function only before its exit. More... | |
int | SCLogAddFDFilter (const char *function) |
Adds a Function-Dependent(FD) filter. More... | |
void | SCLogReleaseFDFilters (void) |
Releases all the FD filters added to the logging module. More... | |
int | SCLogRemoveFDFilter (const char *function) |
Removes a Function-Dependent(FD) filter. More... | |
int | SCLogPrintFDFilters (void) |
Prints the FG filters(both WL and BL). Used for debugging purposes. More... | |
void | SCLogAddToFGFFileList (SCLogFGFilterFile *fgf_file, const char *file, const char *function, int line, int listtype) |
Helper function used internally to add a FG filter. This function is called when the file component of the incoming filter has no entry in the filter list. More... | |
void | SCLogAddToFGFFuncList (SCLogFGFilterFile *fgf_file, SCLogFGFilterFunc *fgf_func, const char *function, int line) |
Helper function used internally to add a FG filter. This function is called when the file component of the incoming filter has an entry in the filter list, but the function component doesn't have an entry for the corresponding file component. More... | |
void | SCLogAddToFGFLineList (SCLogFGFilterFunc *fgf_func, SCLogFGFilterLine *fgf_line, int line) |
Helper function used internally to add a FG filter. This function is called when the file and function components of the incoming filter have an entry in the filter list, but the line component doesn't have an entry for the corresponding function component. More... | |
void | SCLogReleaseFDFilter (SCLogFDFilter *fdf) |
Releases the memory alloted to a FD filter. More... | |
Variables | |
int | sc_log_module_initialized |
Used to indicate whether the logging module has been init or not. More... | |
int | sc_log_module_cleaned |
Used to indicate whether the logging module has been cleaned or not. More... | |
int | sc_log_fg_filters_present = 0 |
int | sc_log_fd_filters_present = 0 |
SCLogFGFilterFile * | sc_log_fg_filters [SC_LOG_FILTER_MAX] = { NULL, NULL } |
Holds the fine-grained filters. More... | |
Debug filter utility functions
Definition in file util-debug-filters.c.
int SCLogAddFDFilter | ( | const char * | function | ) |
Adds a Function-Dependent(FD) filter.
Name | of the function for which a FD filter has to be registered |
0 | on success |
-1 | on failure |
Definition at line 662 of file util-debug-filters.c.
References SCLogFDFilter_::func, SCLogFDFilter_::next, sc_log_fd_filters_present, sc_log_module_initialized, SCMalloc, SCMutexLock, SCMutexUnlock, and SCStrdup.
Referenced by SCLogDeInitLogModule().
int SCLogAddFGFilterBL | ( | const char * | file, |
const char * | function, | ||
int | line | ||
) |
Adds a Blacklist(BL) fine-grained(FG) filter. A FG filter BL filter allows messages that don't match this filter, to be logged, while the filter is defined using a file_name, function_name and line_number.
If a particular paramter in the fg-filter(file, function and line), shouldn't be considered while logging the message, one can supply NULL for the file_name or function_name and a negative line_no.
file | File_name of the filter |
function | Function_name of the filter |
line | Line number of the filter |
0 | on successfully adding the filter |
-1 | on failure |
Definition at line 351 of file util-debug-filters.c.
References SC_LOG_FILTER_BL.
Referenced by SCLogDeInitLogModule().
int SCLogAddFGFilterWL | ( | const char * | file, |
const char * | function, | ||
int | line | ||
) |
Adds a Whitelist(WL) fine-grained(FG) filter. A FG filter WL filter allows messages that match this filter, to be logged, while the filter is defined using a file_name, function_name and line_number.
If a particular paramter in the fg-filter(file, function and line), shouldn't be considered while logging the message, one can supply NULL for the file_name or function_name and a negative line_no.
file | File_name of the filter |
function | Function_name of the filter |
line | Line number of the filter |
0 | on successfully adding the filter; |
-1 | on failure |
Definition at line 330 of file util-debug-filters.c.
References SC_LOG_FILTER_WL.
void SCLogAddToFGFFileList | ( | SCLogFGFilterFile * | fgf_file, |
const char * | file, | ||
const char * | function, | ||
int | line, | ||
int | listtype | ||
) |
Helper function used internally to add a FG filter. This function is called when the file component of the incoming filter has no entry in the filter list.
fgf_file | The file component(basically the position in the list) from the filter list, after which the new filter has to be added |
file | File_name of the filter |
function | Function_name of the filter |
line | Line number of the filter |
listtype | The filter listtype. Can be either a blacklist or whitelist filter listtype(SC_LOG_FILTER_BL or SC_LOG_FILTER_WL) |
Definition at line 855 of file util-debug-filters.c.
References SCLogFGFilterFile_::file, SCLogFGFilterFunc_::func, SCLogFGFilterFile_::func, SCLogFGFilterLine_::line, SCLogFGFilterFunc_::line, SCLogFGFilterFile_::next, SC_ERR_FATAL, SCLogError, SCMalloc, and SCStrdup.
void SCLogAddToFGFFuncList | ( | SCLogFGFilterFile * | fgf_file, |
SCLogFGFilterFunc * | fgf_func, | ||
const char * | function, | ||
int | line | ||
) |
Helper function used internally to add a FG filter. This function is called when the file component of the incoming filter has an entry in the filter list, but the function component doesn't have an entry for the corresponding file component.
fgf_file | The file component from the filter list to which the new filter has to be added |
fgf_func | The function component(basically the position in the list), from the filter list, after which the new filter has to be added |
function | Function_name of the filter |
line | Line number of the filter |
Definition at line 921 of file util-debug-filters.c.
References SCLogFGFilterFunc_::func, SCLogFGFilterFile_::func, SCLogFGFilterLine_::line, SCLogFGFilterFunc_::line, SCLogFGFilterFunc_::next, SC_ERR_FATAL, SCLogError, SCMalloc, and SCStrdup.
void SCLogAddToFGFLineList | ( | SCLogFGFilterFunc * | fgf_func, |
SCLogFGFilterLine * | fgf_line, | ||
int | line | ||
) |
Helper function used internally to add a FG filter. This function is called when the file and function components of the incoming filter have an entry in the filter list, but the line component doesn't have an entry for the corresponding function component.
fgf_func | The function component from the filter list to which the new filter has to be added |
fgf_line | The function component(basically the position in the list), from the filter list, after which the new filter has to be added |
line | Line number of the filter |
Definition at line 971 of file util-debug-filters.c.
References SCLogFGFilterLine_::line, SCLogFGFilterFunc_::line, SCLogFGFilterLine_::next, SC_ERR_FATAL, SCLogError, and SCMalloc.
int SCLogCheckFDFilterEntry | ( | const char * | function | ) |
Updates a FD filter, based on whether the function that calls this function, is registered as a FD filter or not. This is called by a function only on its entry.
function | Function_name from where the log_message originated |
1 | Since it is a hack to get things working inside the macros |
Definition at line 529 of file util-debug-filters.c.
References SCLogFDFilterThreadList_::entered, SCLogFDFilter_::func, SCLogFDFilterThreadList_::next, SCLogFDFilter_::next, sc_log_module_initialized, SCMalloc, SCMutexLock, SCMutexUnlock, and SCLogFDFilterThreadList_::t.
void SCLogCheckFDFilterExit | ( | const char * | function | ) |
Updates a FD filter, based on whether the function that calls this function, is registered as a FD filter or not. This is called by a function only before its exit.
function | Function_name from where the log_message originated |
Definition at line 603 of file util-debug-filters.c.
References SCLogFDFilterThreadList_::entered, SCLogFDFilter_::func, SCLogFDFilterThreadList_::next, SCLogFDFilter_::next, sc_log_module_initialized, SCMutexLock, SCMutexUnlock, and SCLogFDFilterThreadList_::t.
int SCLogMatchFDFilter | ( | const char * | function | ) |
Checks if there is a match for the incoming log_message with any of the FD filters.
function | Function_name from where the log_message originated |
1 | if there is a match |
0 | on no match; |
Definition at line 476 of file util-debug-filters.c.
References SCLogFDFilterThreadList_::entered, SCLogFDFilterThreadList_::next, sc_log_module_initialized, SCMutexLock, SCMutexUnlock, and SCLogFDFilterThreadList_::t.
int SCLogMatchFGFilterBL | ( | const char * | file, |
const char * | function, | ||
int | line | ||
) |
Checks if there is a match for the incoming log_message with any of the FG filters. If there is a match it rejects the logging for that messages, else it allows that message to be logged.
file File_name from where the log_message originated
function | Function_name from where the log_message originated |
line | Line number from where the log_message originated |
1 | if there is a match |
0 | on no match |
-1 | on failure |
Definition at line 309 of file util-debug-filters.c.
References SC_LOG_FILTER_BL.
int SCLogMatchFGFilterWL | ( | const char * | file, |
const char * | function, | ||
int | line | ||
) |
Checks if there is a match for the incoming log_message with any of the FG filters. If there is a match, it allows the message to be logged, else it rejects that message.
file | File_name from where the log_message originated |
function | Function_name from where the log_message originated |
line | Line number from where the log_message originated |
1 | if there is a match |
0 | on no match |
-1 | on failure |
Definition at line 291 of file util-debug-filters.c.
References SC_LOG_FILTER_WL.
int SCLogPrintFDFilters | ( | void | ) |
Prints the FG filters(both WL and BL). Used for debugging purposes.
count | The no of FG filters |
Definition at line 811 of file util-debug-filters.c.
References SCLogFDFilter_::func, SCLogFDFilter_::next, sc_log_module_initialized, SCMutexLock, and SCMutexUnlock.
Referenced by SCLogDeInitLogModule().
int SCLogPrintFGFilters | ( | void | ) |
Prints the FG filters(both WL and BL). Used for debugging purposes.
count | The no of FG filters |
Definition at line 408 of file util-debug-filters.c.
References SCLogFGFilterFile_::file, SCLogFGFilterFunc_::func, SCLogFGFilterFile_::func, SCLogFGFilterLine_::line, SCLogFGFilterFunc_::line, SCLogFGFilterLine_::next, SCLogFGFilterFunc_::next, SCLogFGFilterFile_::next, SC_LOG_FILTER_MAX, sc_log_module_initialized, SCMutexLock, and SCMutexUnlock.
Referenced by SCLogDeInitLogModule().
void SCLogReleaseFDFilter | ( | SCLogFDFilter * | fdf | ) |
Releases the memory alloted to a FD filter.
Pointer | to the FD filter that has to be freed |
Definition at line 999 of file util-debug-filters.c.
References SCLogFDFilter_::func, and SCFree.
Referenced by SCLogReleaseFDFilters(), and SCLogRemoveFDFilter().
void SCLogReleaseFDFilters | ( | void | ) |
Releases all the FD filters added to the logging module.
Definition at line 722 of file util-debug-filters.c.
References SCLogFDFilter_::next, SCLogReleaseFDFilter(), SCMutexLock, and SCMutexUnlock.
Referenced by SCLogDeInitLogModule().
void SCLogReleaseFGFilters | ( | void | ) |
Definition at line 356 of file util-debug-filters.c.
References SCLogFGFilterFile_::file, SCLogFGFilterFunc_::func, SCLogFGFilterFile_::func, SCLogFGFilterFunc_::line, SCLogFGFilterLine_::next, SCLogFGFilterFunc_::next, SCLogFGFilterFile_::next, SC_LOG_FILTER_MAX, SCFree, SCMutexLock, and SCMutexUnlock.
Referenced by SCLogDeInitLogModule().
int SCLogRemoveFDFilter | ( | const char * | function | ) |
Removes a Function-Dependent(FD) filter.
Name | of the function for which a FD filter has to be unregistered |
0 | on success(the filter was removed or the filter was not present) |
-1 | on failure/error |
Definition at line 751 of file util-debug-filters.c.
References SCLogFDFilter_::func, SCLogFDFilter_::next, sc_log_fd_filters_present, sc_log_module_initialized, SCLogReleaseFDFilter(), SCMutexLock, and SCMutexUnlock.
Referenced by SCLogDeInitLogModule().
int sc_log_fd_filters_present = 0 |
Definition at line 36 of file util-debug-filters.c.
Referenced by SCLogAddFDFilter(), and SCLogRemoveFDFilter().
SCLogFGFilterFile* sc_log_fg_filters[SC_LOG_FILTER_MAX] = { NULL, NULL } |
Holds the fine-grained filters.
Definition at line 41 of file util-debug-filters.c.
int sc_log_fg_filters_present = 0 |
Definition at line 33 of file util-debug-filters.c.
int sc_log_module_cleaned |
Used to indicate whether the logging module has been cleaned or not.
Definition at line 105 of file util-debug.c.
int sc_log_module_initialized |
Used to indicate whether the logging module has been init or not.
Definition at line 100 of file util-debug.c.
Referenced by SCLogAddFDFilter(), SCLogCheckFDFilterEntry(), SCLogCheckFDFilterExit(), SCLogMatchFDFilter(), SCLogPrintFDFilters(), SCLogPrintFGFilters(), and SCLogRemoveFDFilter().