| 1 | #ifndef SH_EVALRULE_H
 | 
|---|
| 2 | #define SH_EVALRULE_H
 | 
|---|
| 3 | 
 | 
|---|
| 4 | /* Clean up everything.
 | 
|---|
| 5 |  */
 | 
|---|
| 6 | void sh_eval_cleanup();
 | 
|---|
| 7 | 
 | 
|---|
| 8 | /* Define a new reporting queue, str := label:interval:(report|sum):severity
 | 
|---|
| 9 |  */
 | 
|---|
| 10 | int sh_eval_qadd (const char * str);
 | 
|---|
| 11 | 
 | 
|---|
| 12 | /* Add a new rule, str := queue:regex
 | 
|---|
| 13 |  * If there is an open group, add it to its rules.
 | 
|---|
| 14 |  * ..else, add it to the currently open host (open the
 | 
|---|
| 15 |  * default host, if there is no open one)
 | 
|---|
| 16 |  */
 | 
|---|
| 17 | int sh_eval_radd (const char * str);
 | 
|---|
| 18 | 
 | 
|---|
| 19 | /* Open a new host group definition.
 | 
|---|
| 20 |  */
 | 
|---|
| 21 | int sh_eval_hadd (const char * str);
 | 
|---|
| 22 | /*
 | 
|---|
| 23 |  * End the host definition
 | 
|---|
| 24 |  */
 | 
|---|
| 25 | int sh_eval_hend (const char * str);
 | 
|---|
| 26 | 
 | 
|---|
| 27 | 
 | 
|---|
| 28 | /* Open a new group definition. If a host is currently open, 
 | 
|---|
| 29 |  * the new group will automatically be added to that host.
 | 
|---|
| 30 |  */
 | 
|---|
| 31 | int sh_eval_gadd (const char * str);
 | 
|---|
| 32 | /*
 | 
|---|
| 33 |  * End the group definition
 | 
|---|
| 34 |  */
 | 
|---|
| 35 | int sh_eval_gend (const char * str);
 | 
|---|
| 36 | 
 | 
|---|
| 37 | /* Process a single log record
 | 
|---|
| 38 |  */
 | 
|---|
| 39 | int sh_eval_process_msg(struct sh_logrecord * record);
 | 
|---|
| 40 | 
 | 
|---|
| 41 | enum policies {
 | 
|---|
| 42 |   EVAL_REPORT,
 | 
|---|
| 43 |   EVAL_SUM
 | 
|---|
| 44 | };
 | 
|---|
| 45 | 
 | 
|---|
| 46 | struct sh_qeval  /* Queue with definitions */
 | 
|---|
| 47 | {
 | 
|---|
| 48 |   sh_string       * label;
 | 
|---|
| 49 |   enum policies     policy;
 | 
|---|
| 50 |   int               severity;
 | 
|---|
| 51 |   sh_string       * alias;
 | 
|---|
| 52 |   time_t            interval;        /* if EVAL_SUM, interval   */ 
 | 
|---|
| 53 |   struct sh_qeval * next;
 | 
|---|
| 54 | };
 | 
|---|
| 55 | 
 | 
|---|
| 56 | struct sh_qeval * sh_log_find_queue(const char * str);
 | 
|---|
| 57 | 
 | 
|---|
| 58 | int sh_log_lookup_severity(const char * str);
 | 
|---|
| 59 | sh_string * sh_log_lookup_alias(const char * str);
 | 
|---|
| 60 | 
 | 
|---|
| 61 | #endif
 | 
|---|