1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
/*
* Copyright (c) 2017 Balabit
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation, or (at your option) any later version.
*
* 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
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* As an additional exemption you are allowed to compile & link against the
* OpenSSL libraries as published by the OpenSSL project. See the file
* COPYING for details.
*
*/
#ifndef MODULES_AFFILE_FILE_READER_H_
#define MODULES_AFFILE_FILE_READER_H_
#include "driver.h"
#include "logreader.h"
#include "file-opener.h"
typedef struct _FileReaderOptions
{
gint follow_freq;
gint multi_line_timeout;
gboolean restore_state;
LogReaderOptions reader_options;
gboolean exit_on_eof;
} FileReaderOptions;
typedef struct _FileReader FileReader;
struct _FileReader
{
LogPipe super;
LogSrcDriver *owner;
GString *filename;
FileReaderOptions *options;
FileOpener *opener;
LogReader *reader;
const gchar *persist_name;
const gchar *persist_name_prefix;
void (*on_file_moved)(FileReader *);
};
static inline LogProtoFileReaderOptions *
file_reader_options_get_log_proto_options(FileReaderOptions *options)
{
return (LogProtoFileReaderOptions *) &options->reader_options.proto_options;
}
FileReader *file_reader_new(const gchar *filename, FileReaderOptions *options, FileOpener *opener, LogSrcDriver *owner,
GlobalConfig *cfg);
void file_reader_init_instance(FileReader *self, const gchar *filename, FileReaderOptions *options, FileOpener *opener,
LogSrcDriver *owner, GlobalConfig *cfg, const gchar *persist_name_prefix);
gboolean file_reader_init_method(LogPipe *s);
gboolean file_reader_deinit_method(LogPipe *s);
void file_reader_free_method(LogPipe *s);
void file_reader_queue_method(LogPipe *s, LogMessage *msg, const LogPathOptions *path_options);
gint file_reader_notify_method(LogPipe *s, gint notify_code, gpointer user_data);
void file_reader_remove_persist_state(FileReader *self);
void file_reader_stop_follow_file(FileReader *self);
void file_reader_cue_buffer_flush(FileReader *self);
void file_reader_options_set_follow_freq(FileReaderOptions *options, gint follow_freq);
void file_reader_options_set_multi_line_timeout(FileReaderOptions *options, gint multi_line_timeout);
void file_reader_options_defaults(FileReaderOptions *options);
gboolean file_reader_options_init(FileReaderOptions *options, GlobalConfig *cfg, const gchar *group);
void file_reader_options_deinit(FileReaderOptions *options);
#endif /* MODULES_AFFILE_FILE_READER_H_ */
|