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 SURICATA_DEBUG_FILTERS_H
25 #define SURICATA_DEBUG_FILTERS_H
26 
27 // pthread_t
28 #include "threads.h"
29 
30 /**
31  * \brief Enum that holds the different kinds of filters available
32  */
33 enum {
37 };
38 
39 /**
40  * \brief Structure used to hold the line_no details of a FG filter
41  */
42 typedef struct SCLogFGFilterLine_ {
43  int line;
44 
47 
48 /**
49  * \brief structure used to hold the function details of a FG filter
50  */
51 typedef struct SCLogFGFilterFunc_ {
52  char *func;
54 
57 
58 /**
59  * \brief Structure used to hold FG filters. Encapsulates filename details,
60  * func details, which inturn encapsulates the line_no details
61  */
62 typedef struct SCLogFGFilterFile_ {
63  char *file;
65 
68 
69 /**
70  * \brief Structure used to hold the thread_list used by FD filters
71  */
72 typedef struct SCLogFDFilterThreadList_ {
73  int entered;
74  pthread_t t;
75 // pid_t t;
76 
79 
80 /**
81  * \brief Structure that holds the FD filters
82  */
83 typedef struct SCLogFDFilter_ {
84  char *func;
85 
88 
89 
90 extern int sc_log_fg_filters_present;
91 
92 extern int sc_log_fd_filters_present;
93 
94 int SCLogAddFGFilterBL(const char *, const char *, int);
95 
96 int SCLogMatchFGFilterBL(const char *, const char *, int);
97 
98 int SCLogMatchFGFilterWL(const char *, const char *, int);
99 
100 void SCLogReleaseFGFilters(void);
101 
102 int SCLogAddFDFilter(const char *);
103 
104 int SCLogPrintFDFilters(void);
105 
106 void SCLogReleaseFDFilters(void);
107 
108 int SCLogRemoveFDFilter(const char *);
109 
110 int SCLogCheckFDFilterEntry(const char *);
111 
112 void SCLogCheckFDFilterExit(const char *);
113 
114 int SCLogMatchFDFilter(const char *);
115 
116 int SCLogPrintFGFilters(void);
117 
119  const char *,
120  const char *, int,
121  int);
122 
125  const char *, int);
126 
129  int);
130 
132 #endif /* SURICATA_DEBUG_FILTERS_H */
SCLogFDFilterThreadList_
Structure used to hold the thread_list used by FD filters.
Definition: util-debug-filters.h:72
SCLogReleaseFGFilters
void SCLogReleaseFGFilters(void)
Definition: util-debug-filters.c:338
sc_log_fd_filters_present
int sc_log_fd_filters_present
Definition: util-debug-filters.c:39
SC_LOG_FILTER_BL
@ SC_LOG_FILTER_BL
Definition: util-debug-filters.h:34
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:294
SCLogFDFilter
struct SCLogFDFilter_ SCLogFDFilter
Structure that holds the FD filters.
threads.h
SCLogReleaseFDFilters
void SCLogReleaseFDFilters(void)
Releases all the FD filters added to the logging module.
Definition: util-debug-filters.c:702
SCLogFDFilterThreadList_::t
pthread_t t
Definition: util-debug-filters.h:74
SCLogAddFDFilter
int SCLogAddFDFilter(const char *)
Adds a Function-Dependent(FD) filter.
Definition: util-debug-filters.c:643
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:312
SCLogPrintFGFilters
int SCLogPrintFGFilters(void)
Prints the FG filters(both WL and BL). Used for debugging purposes.
Definition: util-debug-filters.c:390
SCLogFGFilterLine_::line
int line
Definition: util-debug-filters.h:43
SCLogPrintFDFilters
int SCLogPrintFDFilters(void)
Prints the FG filters(both WL and BL). Used for debugging purposes.
Definition: util-debug-filters.c:791
SCLogFGFilterLine_::next
struct SCLogFGFilterLine_ * next
Definition: util-debug-filters.h:45
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:511
SCLogFGFilterFile_::next
struct SCLogFGFilterFile_ * next
Definition: util-debug-filters.h:66
SCLogFGFilterFunc
struct SCLogFGFilterFunc_ SCLogFGFilterFunc
structure used to hold the function details of a FG filter
SC_LOG_FILTER_MAX
@ SC_LOG_FILTER_MAX
Definition: util-debug-filters.h:36
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:53
SCLogFDFilter_::next
struct SCLogFDFilter_ * next
Definition: util-debug-filters.h:86
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:77
SCLogFGFilterLine_
Structure used to hold the line_no details of a FG filter.
Definition: util-debug-filters.h:42
SCLogReleaseFDFilter
void SCLogReleaseFDFilter(SCLogFDFilter *)
Releases the memory alloted to a FD filter.
Definition: util-debug-filters.c:967
SCLogFDFilter_
Structure that holds the FD filters.
Definition: util-debug-filters.h:83
sc_log_fg_filters_present
int sc_log_fg_filters_present
Definition: util-debug-filters.c:36
SCLogRemoveFDFilter
int SCLogRemoveFDFilter(const char *)
Removes a Function-Dependent(FD) filter.
Definition: util-debug-filters.c:731
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:895
SCLogFGFilterFunc_::func
char * func
Definition: util-debug-filters.h:52
SC_LOG_FILTER_WL
@ SC_LOG_FILTER_WL
Definition: util-debug-filters.h:35
SCLogFDFilter_::func
char * func
Definition: util-debug-filters.h:84
SCLogFGFilterFunc_
structure used to hold the function details of a FG filter
Definition: util-debug-filters.h:51
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:941
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:333
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:458
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:584
SCLogFGFilterFile_::func
SCLogFGFilterFunc * func
Definition: util-debug-filters.h:64
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:835
SCLogFGFilterFile_
Structure used to hold FG filters. Encapsulates filename details, func details, which inturn encapsul...
Definition: util-debug-filters.h:62
SCLogFGFilterFunc_::next
struct SCLogFGFilterFunc_ * next
Definition: util-debug-filters.h:55
SCLogFDFilterThreadList_::entered
int entered
Definition: util-debug-filters.h:73
SCLogFGFilterFile_::file
char * file
Definition: util-debug-filters.h:63