00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __AWHANDLER_EXECP__
00023 #define __AWHANDLER_EXECP__
00024
00025 #include <stdio.h>
00026
00027 #include "monitor.h"
00028 #include "wire.h"
00029
00030 #include "regexmatch.h"
00031
00033
00034
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00214 typedef struct {
00215
00216 aw_event_sig_t
00217 complete;
00218
00219 } aw_execphandler_events_t;
00220
00224 typedef struct {
00225
00226 aw_event_sig_t
00227 match,
00228 nomatch;
00229
00230 } aw_execphandler_revents_t;
00231
00235 typedef struct {
00236
00237
00238
00239 u_int32_t
00240 *match_markers;
00241
00242 } aw_execphandler_state_t;
00243
00247 typedef struct {
00248
00249 aw_execphandler_revents_t
00250 revents;
00251
00252
00253 const byte_t
00254 *regex;
00255
00256
00257 const byte_t
00258 *subst;
00259
00260 } aw_execphandler_regex_t;
00261
00265 typedef struct {
00266
00267 aw_execphandler_revents_t
00268 revents;
00269
00270
00271 regex_t
00272 pattern;
00273
00274
00275 byte_t
00276 *subst;
00277
00278 } aw_execphandler_watcher_t;
00279
00280
00284 typedef struct {
00285
00286 aw_handler_t
00287 handler_header;
00288
00289 aw_execphandler_state_t
00290 state;
00291
00292
00293 aw_timestamp_t
00294 timeout;
00295
00296 u_int32_t
00297 max_line_len;
00298
00299 byte_t
00300 *line;
00301
00302 byte_t
00303 *input;
00304
00305
00306 byte_t
00307 *cmd;
00308
00309 aw_execphandler_events_t
00310 events;
00311
00312 u_int32_t
00313 nwatchers;
00314
00315 aw_execphandler_watcher_t
00316 *watchers;
00317
00318 } aw_execphandler_t;
00319
00335 aw_execphandler_t *aw_create_execphandler(const byte_t *cmd,
00336 const byte_t *input,
00337 u_int32_t max_line_len,
00338 u_int32_t timeout,
00339 const aw_execphandler_events_t *events,
00340 u_int32_t nregexs,
00341 const aw_execphandler_regex_t *regexs,
00342 int32_t (*regevent)(aw_handler_t *h, aw_address_t *eventid, u_int32_t index),
00343 int32_t (*regmaskevent)(aw_handler_t *h, aw_address_t *eventid, u_int32_t index),
00344 const aw_alarm_sched_t *sched,
00345 aw_logger_t *aware_logger);
00346
00347
00352 void aw_free_execphandler(aw_execphandler_t *h);
00353
00354
00355
00359 aw_handler_t *aw_wire_execphandler(aw_wire_mkhandler_args_t *args);
00360
00361
00362
00363 #endif
00364