suricata
util-debug-filters.h
Go to the documentation of this file.
1 /* Copyright (C) 2007-2010 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 __DEBUG_FILTERS_H__
25 #define __DEBUG_FILTERS_H__
26 
27 #include <pthread.h>
28 
29 /**
30  * \brief Enum that holds the different kinds of filters available
31  */
32 enum {
36 };
37 
38 /**
39  * \brief Structure used to hold the line_no details of a FG filter
40  */
41 typedef struct SCLogFGFilterLine_ {
42  int line;
43 
46 
47 /**
48  * \brief structure used to hold the function details of a FG filter
49  */
50 typedef struct SCLogFGFilterFunc_ {
51  char *func;
53 
56 
57 /**
58  * \brief Structure used to hold FG filters. Encapsulates filename details,
59  * func details, which inturn encapsulates the line_no details
60  */
61 typedef struct SCLogFGFilterFile_ {
62  char *file;
64 
67 
68 /**
69  * \brief Structure used to hold the thread_list used by FD filters
70  */
71 typedef struct SCLogFDFilterThreadList_ {
72  int entered;
73  pthread_t t;
74 // pid_t t;
75 
78 
79 /**
80  * \brief Structure that holds the FD filters
81  */
82 typedef struct SCLogFDFilter_ {
83  char *func;
84 
87 
88 
89 extern int sc_log_fg_filters_present;
90 
91 extern int sc_log_fd_filters_present;
92 
93 
94 int SCLogAddFGFilterWL(const char *, const char *, int);
95 
96 int SCLogAddFGFilterBL(const char *, const char *, int);
97 
98 int SCLogMatchFGFilterBL(const char *, const char *, int);
99 
100 int SCLogMatchFGFilterWL(const char *, const char *, int);
101 
102 void SCLogReleaseFGFilters(void);
103 
104 int SCLogAddFDFilter(const char *);
105 
106 int SCLogPrintFDFilters(void);
107 
108 void SCLogReleaseFDFilters(void);
109 
110 int SCLogRemoveFDFilter(const char *);
111 
112 int SCLogCheckFDFilterEntry(const char *);
113 
114 void SCLogCheckFDFilterExit(const char *);
115 
116 int SCLogMatchFDFilter(const char *);
117 
118 int SCLogPrintFGFilters(void);
119 
121  const char *,
122  const char *, int,
123  int);
124 
127  const char *, int);
128 
131  int);
132 
134 #endif /* __DEBUG_H__ */
SCLogFDFilterThreadList_
Structure used to hold the thread_list used by FD filters.
Definition: util-debug-filters.h:71
SCLogReleaseFGFilters
void SCLogReleaseFGFilters(void)
Definition: util-debug-filters.c:357
sc_log_fd_filters_present
int sc_log_fd_filters_present
Definition: util-debug-filters.c:37
SCLogMatchFGFilterWL
int SCLogMatchFGFilterWL(const char *, const char *, int)
Checks if there is a match for the incoming log_message with any of the FG filters....
Definition: util-debug-filters.c:292
SCLogFDFilter
struct SCLogFDFilter_ SCLogFDFilter
Structure that holds the FD filters.
SCLogReleaseFDFilters
void SCLogReleaseFDFilters(void)
Releases all the FD filters added to the logging module.
Definition: util-debug-filters.c:723
SCLogFDFilterThreadList_::t
pthread_t t
Definition: util-debug-filters.h:73
SCLogAddFDFilter
int SCLogAddFDFilter(const char *)
Adds a Function-Dependent(FD) filter.
Definition: util-debug-filters.c:663
SCLogMatchFGFilterBL
int SCLogMatchFGFilterBL(const char *, const char *, int)
Checks if there is a match for the incoming log_message with any of the FG filters....
Definition: util-debug-filters.c:310
SCLogPrintFGFilters
int SCLogPrintFGFilters(void)
Prints the FG filters(both WL and BL). Used for debugging purposes.
Definition: util-debug-filters.c:409
SCLogFGFilterLine_::line
int line
Definition: util-debug-filters.h:42
SCLogPrintFDFilters
int SCLogPrintFDFilters(void)
Prints the FG filters(both WL and BL). Used for debugging purposes.
Definition: util-debug-filters.c:812
SCLogFGFilterLine_::next
struct SCLogFGFilterLine_ * next
Definition: util-debug-filters.h:44
SCLogCheckFDFilterEntry
int SCLogCheckFDFilterEntry(const char *)
Updates a FD filter, based on whether the function that calls this function, is registered as a FD fi...
Definition: util-debug-filters.c:530
SC_LOG_FILTER_BL
@ SC_LOG_FILTER_BL
Definition: util-debug-filters.h:33
SCLogFGFilterFile_::next
struct SCLogFGFilterFile_ * next
Definition: util-debug-filters.h:65
SCLogFGFilterFunc
struct SCLogFGFilterFunc_ SCLogFGFilterFunc
structure used to hold the function details of a FG filter
SCLogFGFilterLine
struct SCLogFGFilterLine_ SCLogFGFilterLine
Structure used to hold the line_no details of a FG filter.
SCLogFGFilterFile
struct SCLogFGFilterFile_ SCLogFGFilterFile
Structure used to hold FG filters. Encapsulates filename details, func details, which inturn encapsul...
SCLogFGFilterFunc_::line
SCLogFGFilterLine * line
Definition: util-debug-filters.h:52
SCLogFDFilter_::next
struct SCLogFDFilter_ * next
Definition: util-debug-filters.h:85
SCLogFDFilterThreadList
struct SCLogFDFilterThreadList_ SCLogFDFilterThreadList
Structure used to hold the thread_list used by FD filters.
SCLogFDFilterThreadList_::next
struct SCLogFDFilterThreadList_ * next
Definition: util-debug-filters.h:76
SCLogFGFilterLine_
Structure used to hold the line_no details of a FG filter.
Definition: util-debug-filters.h:41
SCLogAddFGFilterWL
int SCLogAddFGFilterWL(const char *, const char *, int)
Adds a Whitelist(WL) fine-grained(FG) filter. A FG filter WL filter allows messages that match this f...
Definition: util-debug-filters.c:331
SCLogReleaseFDFilter
void SCLogReleaseFDFilter(SCLogFDFilter *)
Releases the memory alloted to a FD filter.
Definition: util-debug-filters.c:1000
SCLogFDFilter_
Structure that holds the FD filters.
Definition: util-debug-filters.h:82
sc_log_fg_filters_present
int sc_log_fg_filters_present
Definition: util-debug-filters.c:34
SCLogRemoveFDFilter
int SCLogRemoveFDFilter(const char *)
Removes a Function-Dependent(FD) filter.
Definition: util-debug-filters.c:752
SCLogAddToFGFFuncList
void SCLogAddToFGFFuncList(SCLogFGFilterFile *, SCLogFGFilterFunc *, const char *, int)
Helper function used internally to add a FG filter. This function is called when the file component o...
Definition: util-debug-filters.c:922
SC_LOG_FILTER_WL
@ SC_LOG_FILTER_WL
Definition: util-debug-filters.h:34
SCLogFGFilterFunc_::func
char * func
Definition: util-debug-filters.h:51
SCLogFDFilter_::func
char * func
Definition: util-debug-filters.h:83
SCLogFGFilterFunc_
structure used to hold the function details of a FG filter
Definition: util-debug-filters.h:50
SCLogAddToFGFLineList
void SCLogAddToFGFLineList(SCLogFGFilterFunc *, SCLogFGFilterLine *, int)
Helper function used internally to add a FG filter. This function is called when the file and functio...
Definition: util-debug-filters.c:972
SCLogAddFGFilterBL
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 ...
Definition: util-debug-filters.c:352
SCLogMatchFDFilter
int SCLogMatchFDFilter(const char *)
Checks if there is a match for the incoming log_message with any of the FD filters.
Definition: util-debug-filters.c:477
SCLogCheckFDFilterExit
void SCLogCheckFDFilterExit(const char *)
Updates a FD filter, based on whether the function that calls this function, is registered as a FD fi...
Definition: util-debug-filters.c:604
SCLogFGFilterFile_::func
SCLogFGFilterFunc * func
Definition: util-debug-filters.h:63
SCLogAddToFGFFileList
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 o...
Definition: util-debug-filters.c:856
SCLogFGFilterFile_
Structure used to hold FG filters. Encapsulates filename details, func details, which inturn encapsul...
Definition: util-debug-filters.h:61
SCLogFGFilterFunc_::next
struct SCLogFGFilterFunc_ * next
Definition: util-debug-filters.h:54
SCLogFDFilterThreadList_::entered
int entered
Definition: util-debug-filters.h:72
SC_LOG_FILTER_MAX
@ SC_LOG_FILTER_MAX
Definition: util-debug-filters.h:35
SCLogFGFilterFile_::file
char * file
Definition: util-debug-filters.h:62