diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 17:39:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 17:39:49 +0000 |
commit | a0aa2307322cd47bbf416810ac0292925e03be87 (patch) | |
tree | 37076262a026c4b48c8a0e84f44ff9187556ca35 /src/source-pcap-file-directory-helper.h | |
parent | Initial commit. (diff) | |
download | suricata-a0aa2307322cd47bbf416810ac0292925e03be87.tar.xz suricata-a0aa2307322cd47bbf416810ac0292925e03be87.zip |
Adding upstream version 1:7.0.3.upstream/1%7.0.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/source-pcap-file-directory-helper.h')
-rw-r--r-- | src/source-pcap-file-directory-helper.h | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/src/source-pcap-file-directory-helper.h b/src/source-pcap-file-directory-helper.h new file mode 100644 index 0000000..6e32c04 --- /dev/null +++ b/src/source-pcap-file-directory-helper.h @@ -0,0 +1,86 @@ +/* Copyright (C) 2007-2010 Open Information Security Foundation + * + * You can copy, redistribute or modify this Program under the terms of + * the GNU General Public License version 2 as published by the Free + * Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * version 2 along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +/** + * \file + * + * \author Danny Browning <danny.browning@protectwise.com> + */ + +#include "suricata-common.h" +#include "source-pcap-file-helper.h" +#include "queue.h" + +#ifndef __SOURCE_PCAP_FILE_DIRECTORY_HELPER_H__ +#define __SOURCE_PCAP_FILE_DIRECTORY_HELPER_H__ + +typedef struct PendingFile_ +{ + char *filename; + struct timespec modified_time; + TAILQ_ENTRY(PendingFile_) next; +} PendingFile; +/** + * Data specific to a directory of pcap files + */ +typedef struct PcapFileDirectoryVars_ +{ + char *filename; + DIR *directory; + PcapFileFileVars *current_file; + bool should_loop; + bool should_recurse; + uint8_t cur_dir_depth; + time_t delay; + time_t poll_interval; + + TAILQ_HEAD(PendingFiles, PendingFile_) directory_content; + + PcapFileSharedVars *shared; +} PcapFileDirectoryVars; + +/** + * Cleanup resources associated with a PendingFile object + * @param pending Object to be cleaned up + */ +void CleanupPendingFile(PendingFile *pending); + +/** + * Cleanup resources associated with a PcapFileDirectoryVars object + * @param ptv Object to be cleaned up + */ +void CleanupPcapFileDirectoryVars(PcapFileDirectoryVars *ptv); + +/** + * Determine if a given string represents a file or directory. If a directory, + * populate the directory object. + * @param filename String to check + * @param directory Directory point to populate if directory + * @return TM_ECODE_OK if string or directory + */ +TmEcode PcapDetermineDirectoryOrFile(char *filename, DIR **directory); + +/** + * Dispatch a directory for processing, where information for processing the + * directory is contained in a PcapFileDirectoryVars object + * @param ptv PcapFileDirectoryVars object containing information for processing + * the directory + * @return + */ +TmEcode PcapDirectoryDispatch(PcapFileDirectoryVars *ptv); + +#endif /* __SOURCE_PCAP_FILE_DIRECTORY_HELPER_H__ */ |