suricata
source-pcap-file-directory-helper.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 Danny Browning <danny.browning@protectwise.com>
22  */
23 
24 #include "suricata-common.h"
26 #include "queue.h"
27 
28 #ifndef SURICATA_SOURCE_PCAP_FILE_DIRECTORY_HELPER_H
29 #define SURICATA_SOURCE_PCAP_FILE_DIRECTORY_HELPER_H
30 
31 typedef struct PendingFile_
32 {
33  char *filename;
34  struct timespec modified_time;
37 /**
38  * Data specific to a directory of pcap files
39  */
40 typedef struct PcapFileDirectoryVars_
41 {
42  char *filename;
43  DIR *directory;
47  uint8_t cur_dir_depth;
48  time_t delay;
49  time_t poll_interval;
50 
51  TAILQ_HEAD(PendingFiles, PendingFile_) directory_content;
52 
55 
56 /**
57  * Cleanup resources associated with a PendingFile object
58  * @param pending Object to be cleaned up
59  */
60 void CleanupPendingFile(PendingFile *pending);
61 
62 /**
63  * Cleanup resources associated with a PcapFileDirectoryVars object
64  * @param ptv Object to be cleaned up
65  */
67 
68 /**
69  * Determine if a given string represents a file or directory. If a directory,
70  * populate the directory object.
71  * @param filename String to check
72  * @param directory Directory point to populate if directory
73  * @return TM_ECODE_OK if string or directory
74  */
75 TmEcode PcapDetermineDirectoryOrFile(char *filename, DIR **directory);
76 
77 /**
78  * Dispatch a directory for processing, where information for processing the
79  * directory is contained in a PcapFileDirectoryVars object
80  * @param ptv PcapFileDirectoryVars object containing information for processing
81  * the directory
82  * @return
83  */
85 
86 #endif /* SURICATA_SOURCE_PCAP_FILE_DIRECTORY_HELPER_H */
PcapFileDirectoryVars
struct PcapFileDirectoryVars_ PcapFileDirectoryVars
PcapFileSharedVars_
Definition: source-pcap-file-helper.h:42
CleanupPendingFile
void CleanupPendingFile(PendingFile *pending)
Definition: source-pcap-file-directory-helper.c:100
next
struct HtpBodyChunk_ * next
Definition: app-layer-htp.h:0
PcapDetermineDirectoryOrFile
TmEcode PcapDetermineDirectoryOrFile(char *filename, DIR **directory)
Definition: source-pcap-file-directory-helper.c:174
PcapFileDirectoryVars_::poll_interval
time_t poll_interval
Definition: source-pcap-file-directory-helper.h:49
PendingFile_::modified_time
struct timespec modified_time
Definition: source-pcap-file-directory-helper.h:34
PcapFileDirectoryVars_
Definition: source-pcap-file-directory-helper.h:41
PcapFileDirectoryVars_::TAILQ_HEAD
TAILQ_HEAD(PendingFiles, PendingFile_) directory_content
PcapFileDirectoryVars_::should_recurse
bool should_recurse
Definition: source-pcap-file-directory-helper.h:46
source-pcap-file-helper.h
PcapFileFileVars_
Definition: source-pcap-file-helper.h:70
TmEcode
TmEcode
Definition: tm-threads-common.h:79
queue.h
PcapFileDirectoryVars_::directory
DIR * directory
Definition: source-pcap-file-directory-helper.h:43
suricata-common.h
PcapFileDirectoryVars_::current_file
PcapFileFileVars * current_file
Definition: source-pcap-file-directory-helper.h:44
CleanupPcapFileDirectoryVars
void CleanupPcapFileDirectoryVars(PcapFileDirectoryVars *ptv)
Definition: source-pcap-file-directory-helper.c:109
PcapDirectoryDispatch
TmEcode PcapDirectoryDispatch(PcapFileDirectoryVars *ptv)
Definition: source-pcap-file-directory-helper.c:480
PcapFileDirectoryVars_::cur_dir_depth
uint8_t cur_dir_depth
Definition: source-pcap-file-directory-helper.h:47
PendingFile_::TAILQ_ENTRY
TAILQ_ENTRY(PendingFile_) next
PcapFileDirectoryVars_::delay
time_t delay
Definition: source-pcap-file-directory-helper.h:48
PendingFile_
Definition: source-pcap-file-directory-helper.h:32
PcapFileDirectoryVars_::shared
PcapFileSharedVars * shared
Definition: source-pcap-file-directory-helper.h:53
PcapFileDirectoryVars_::should_loop
bool should_loop
Definition: source-pcap-file-directory-helper.h:45
PcapFileDirectoryVars_::filename
char * filename
Definition: source-pcap-file-directory-helper.h:42
PendingFile
struct PendingFile_ PendingFile
PendingFile_::filename
char * filename
Definition: source-pcap-file-directory-helper.h:33