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 __SOURCE_PCAP_FILE_DIRECTORY_HELPER_H__
29 #define __SOURCE_PCAP_FILE_DIRECTORY_HELPER_H__
30 
31 typedef struct PendingFile_
32 {
33  char *filename;
34  struct timespec modified_time;
36 } PendingFile;
37 /**
38  * Data specific to a directory of pcap files
39  */
40 typedef struct PcapFileDirectoryVars_
41 {
42  char *filename;
43  DIR *directory;
46  time_t delay;
47  time_t poll_interval;
48 
49  TAILQ_HEAD(PendingFiles, PendingFile_) directory_content;
50 
53 
54 /**
55  * Cleanup resources associated with a PendingFile object
56  * @param pending Object to be cleaned up
57  */
58 void CleanupPendingFile(PendingFile *pending);
59 
60 /**
61  * Cleanup resources associated with a PcapFileDirectoryVars object
62  * @param ptv Object to be cleaned up
63  */
65 
66 /**
67  * Determine if a given string represents a file or directory. If a directory,
68  * populate the directory object.
69  * @param filename String to check
70  * @param directory Directory point to populate if directory
71  * @return TM_ECODE_OK if string or directory
72  */
73 TmEcode PcapDetermineDirectoryOrFile(char *filename, DIR **directory);
74 
75 /**
76  * Dispatch a directory for processing, where information for processing the
77  * directory is contained in a PcapFileDirectoryVars object
78  * @param ptv PcapFileDirectoryVars object containing information for processing
79  * the directory
80  * @return
81  */
83 
84 #endif /* __SOURCE_PCAP_FILE_DIRECTORY_HELPER_H__ */
struct HtpBodyChunk_ * next
#define TAILQ_HEAD(name, type)
Definition: queue.h:321
TAILQ_ENTRY(PendingFile_) next
TmEcode PcapDirectoryDispatch(PcapFileDirectoryVars *ptv)
void CleanupPcapFileDirectoryVars(PcapFileDirectoryVars *ptv)
void CleanupPendingFile(PendingFile *pending)
TmEcode PcapDetermineDirectoryOrFile(char *filename, DIR **directory)