suricata
|
#include "threads.h"
Go to the source code of this file.
Data Structures | |
struct | SCLogFGFilterLine_ |
Structure used to hold the line_no details of a FG filter. More... | |
struct | SCLogFGFilterFunc_ |
structure used to hold the function details of a FG filter More... | |
struct | SCLogFGFilterFile_ |
Structure used to hold FG filters. Encapsulates filename details, func details, which inturn encapsulates the line_no details. More... | |
struct | SCLogFDFilterThreadList_ |
Structure used to hold the thread_list used by FD filters. More... | |
struct | SCLogFDFilter_ |
Structure that holds the FD filters. More... | |
Typedefs | |
typedef struct SCLogFGFilterLine_ | SCLogFGFilterLine |
Structure used to hold the line_no details of a FG filter. More... | |
typedef struct SCLogFGFilterFunc_ | SCLogFGFilterFunc |
structure used to hold the function details of a FG filter More... | |
typedef struct SCLogFGFilterFile_ | SCLogFGFilterFile |
Structure used to hold FG filters. Encapsulates filename details, func details, which inturn encapsulates the line_no details. More... | |
typedef struct SCLogFDFilterThreadList_ | SCLogFDFilterThreadList |
Structure used to hold the thread_list used by FD filters. More... | |
typedef struct SCLogFDFilter_ | SCLogFDFilter |
Structure that holds the FD filters. More... | |
Enumerations | |
enum | { SC_LOG_FILTER_BL = 0, SC_LOG_FILTER_WL = 1, SC_LOG_FILTER_MAX = 2 } |
Enum that holds the different kinds of filters available. More... | |
Functions | |
int | SCLogAddFGFilterBL (const char *, const char *, int) |
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... | |
int | SCLogMatchFGFilterBL (const char *, const char *, int) |
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 | SCLogMatchFGFilterWL (const char *, const char *, int) |
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... | |
void | SCLogReleaseFGFilters (void) |
int | SCLogAddFDFilter (const char *) |
Adds a Function-Dependent(FD) filter. More... | |
int | SCLogPrintFDFilters (void) |
Prints the FG filters(both WL and BL). Used for debugging purposes. More... | |
void | SCLogReleaseFDFilters (void) |
Releases all the FD filters added to the logging module. More... | |
int | SCLogRemoveFDFilter (const char *) |
Removes a Function-Dependent(FD) filter. More... | |
int | SCLogCheckFDFilterEntry (const char *) |
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 *) |
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 | SCLogMatchFDFilter (const char *) |
Checks if there is a match for the incoming log_message with any of the FD filters. More... | |
int | SCLogPrintFGFilters (void) |
Prints the FG filters(both WL and BL). Used for debugging purposes. More... | |
void | SCLogAddToFGFFileList (SCLogFGFilterFile *, const char *, const char *, int, int) |
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 *, SCLogFGFilterFunc *, const char *, int) |
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 *, SCLogFGFilterLine *, int) |
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 *) |
Releases the memory alloted to a FD filter. More... | |
Variables | |
int | sc_log_fg_filters_present |
int | sc_log_fd_filters_present |
Definition in file util-debug-filters.h.
typedef struct SCLogFDFilter_ SCLogFDFilter |
Structure that holds the FD filters.
typedef struct SCLogFDFilterThreadList_ SCLogFDFilterThreadList |
Structure used to hold the thread_list used by FD filters.
typedef struct SCLogFGFilterFile_ SCLogFGFilterFile |
Structure used to hold FG filters. Encapsulates filename details, func details, which inturn encapsulates the line_no details.
typedef struct SCLogFGFilterFunc_ SCLogFGFilterFunc |
structure used to hold the function details of a FG filter
typedef struct SCLogFGFilterLine_ SCLogFGFilterLine |
Structure used to hold the line_no details of a FG filter.
anonymous enum |
Enum that holds the different kinds of filters available.
Enumerator | |
---|---|
SC_LOG_FILTER_BL | |
SC_LOG_FILTER_WL | |
SC_LOG_FILTER_MAX |
Definition at line 33 of file util-debug-filters.h.
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 639 of file util-debug-filters.c.
References sc_log_module_initialized, and SCMutexLock.
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 parameter 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 333 of file util-debug-filters.c.
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 829 of file util-debug-filters.c.
References FatalError, SCLogFGFilterFile_::file, SCLogFGFilterFunc_::func, SCLogFGFilterFile_::func, SCLogFGFilterLine_::line, SCLogFGFilterFunc_::line, SCLogFGFilterFile_::next, sc_log_fg_filters, SCCalloc, 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 887 of file util-debug-filters.c.
References FatalError, SCLogFGFilterFunc_::func, SCLogFGFilterFile_::func, SCLogFGFilterLine_::line, SCLogFGFilterFunc_::line, SCLogFGFilterFunc_::next, SCCalloc, 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 931 of file util-debug-filters.c.
References FatalError, SCLogFGFilterLine_::line, SCLogFGFilterFunc_::line, SCLogFGFilterLine_::next, and SCCalloc.
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 509 of file util-debug-filters.c.
References sc_log_module_initialized, and SCMutexLock.
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 582 of file util-debug-filters.c.
References sc_log_module_initialized, and SCMutexLock.
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 456 of file util-debug-filters.c.
References sc_log_module_initialized, and SCMutexLock.
Referenced by SCLog(), and SCLogErr().
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 312 of file util-debug-filters.c.
Referenced by SCLog(), and SCLogErr().
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 294 of file util-debug-filters.c.
Referenced by SCLog(), and SCLogErr().
int SCLogPrintFDFilters | ( | void | ) |
Prints the FG filters(both WL and BL). Used for debugging purposes.
count | The no of FG filters |
Definition at line 785 of file util-debug-filters.c.
References sc_log_module_initialized, and SCMutexLock.
int SCLogPrintFGFilters | ( | void | ) |
Prints the FG filters(both WL and BL). Used for debugging purposes.
count | The no of FG filters |
Definition at line 388 of file util-debug-filters.c.
References SC_LOG_FILTER_MAX, sc_log_module_initialized, and SCMutexLock.
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 955 of file util-debug-filters.c.
References SCLogFDFilter_::func, and SCFree.
void SCLogReleaseFDFilters | ( | void | ) |
Releases all the FD filters added to the logging module.
Definition at line 698 of file util-debug-filters.c.
References SCMutexLock.
void SCLogReleaseFGFilters | ( | void | ) |
Definition at line 338 of file util-debug-filters.c.
References SC_LOG_FILTER_MAX, and SCMutexLock.
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 725 of file util-debug-filters.c.
References sc_log_module_initialized, and SCMutexLock.
int sc_log_fd_filters_present |
Definition at line 39 of file util-debug-filters.c.
Referenced by SCLog(), and SCLogErr().
int sc_log_fg_filters_present |
Definition at line 36 of file util-debug-filters.c.
Referenced by SCLog(), and SCLogErr().