00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __AWHANDLER_FILESTAT__
00023 #define __AWHANDLER_FILESTAT__
00024
00025 #include <regex.h>
00026
00027 #include "monitor.h"
00028 #include "wire.h"
00029
00031
00032
00122
00123
00124
00125
00126
00127
00128
00129
00130
00134 typedef struct {
00135
00136 aw_event_sig_t
00137 file_exists,
00138 file_notexists,
00139 file_created,
00140 file_deleted,
00141 file_size,
00142 file_size_change,
00143 file_size_nochange,
00144 file_mtime,
00145 file_mtime_change;
00146
00147 } aw_filestathandler_events_t;
00148
00149
00153 typedef struct {
00154
00155 int32_t
00156 fd;
00157
00158 struct stat
00159 last_stat;
00160
00161 } aw_filestathandler_state_t;
00162
00163
00167 typedef struct {
00168
00169 aw_handler_t
00170 handler_header;
00171
00172 aw_filestathandler_events_t
00173 events;
00174
00175
00176 const byte_t
00177 *filename;
00178
00179
00180 int32_t
00181 dont_log_file_not_found;
00182
00183
00184 int32_t
00185 firsthandler;
00186
00187 aw_filestathandler_state_t
00188 state;
00189
00190 } aw_filestathandler_t ;
00191
00203 aw_filestathandler_t *aw_create_filestathandler(const aw_filestathandler_events_t *events,
00204 const char *filename,
00205 int32_t dont_log_file_not_found,
00206 int32_t (*regevent)(aw_handler_t *h, aw_address_t *eventid, u_int32_t index),
00207 int32_t (*regmaskevent)(aw_handler_t *h, aw_address_t *eventid, u_int32_t index),
00208 const aw_alarm_sched_t *sched,
00209 aw_logger_t *logger
00210 );
00211
00216 void aw_free_filestathandler(aw_filestathandler_t *p);
00217
00221 aw_handler_t *aw_wire_filestathandler(aw_wire_mkhandler_args_t *args);
00222
00223
00224
00225 #endif