xdasd_filter.c File Reference

OpenXDAS filter message buffer parsing and handling. More...

#include <xdas.h>
#include "xdasd_filter.h"
#include "xdasd_parse.h"
#include "xdasd_list.h"
#include "xdasd_log.h"
#include <expat.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>

Go to the source code of this file.

Data Structures

struct  match_tag
 A structure that represents XDAS message field match criteria. More...
struct  action_tag
 A structure that represents XDAS message filter actions. More...
struct  filter_tag
 A structure that represents a complete XDAS filter specification. More...
struct  parser_tag
 A structure that represents an XDAS filter parser. More...

Defines

#define XML_FMT_INT_MOD   "l"
#define FT_SUBMIT   0x00000001
#define FT_IMPORT   0x00000002

Typedefs

typedef struct match_tag Match
 A structure that represents XDAS message field match criteria.
typedef struct action_tag Action
 A structure that represents XDAS message filter actions.
typedef struct filter_tag Filter
 A structure that represents a complete XDAS filter specification.
typedef struct parser_tag Parser
 A structure that represents an XDAS filter parser.

Enumerations

enum  Operator {
  OP_UNKNOWN = -1, OP_EQUAL, OP_NOT_EQUAL, OP_GREATER_THAN,
  OP_LESS_THAN, OP_GT_OR_EQUAL, OP_LT_OR_EQUAL, OP_BIT_TEST,
  OP_SUBSTRING
}
 An enumeration that represents all XDAS filter operators. More...
enum  Attribute {
  AT_UNKNOWN = -1, AT_HDR = 0, AT_HDRLEN, AT_HDRVER,
  AT_HDRTMOFFS, AT_HDRTUINT, AT_HDRTUIND, AT_HDRTMSRC,
  AT_HDRTMZONE, AT_HDREVENT, AT_HDROUTCOME, AT_ORG,
  AT_ORGLOC, AT_ORGADDR, AT_ORGTYPE, AT_ORGAUT,
  AT_ORGNAME, AT_ORGID, AT_INT, AT_INTAUTH,
  AT_INTNAME, AT_INTID, AT_TGT, AT_TGTLOC,
  AT_TGTADDR, AT_TGTTYPE, AT_TGTAUTH, AT_TGTNAME,
  AT_TGTID, AT_SRC, AT_SRCDPTR, AT_EVT,
  AT_EVTINFO, AT_END
}
 An enumeration that represents all XDAS message fields. More...
enum  ActionType { ACT_LOG, ACT_ALARM, ACT_TRIGGER }
 An enumeration that represents all XDAS filter action types. More...
enum  ParserState {
  PS_INIT, PS_FILTER_EXPECTED, PS_MATCH_OR_ACTION_EXPECTED, PS_MATCH_EXPECTED,
  PS_ALLOW_IN_PROGRESS, PS_DENY_IN_PROGRESS, PS_ACTION_EXPECTED, PS_LOG_IN_PROGRESS,
  PS_ALARM_IN_PROGRESS, PS_TRIGGER_IN_PROGRESS, PS_TERMINATE
}
 An enumeration that represents all possible XDAS filter parser states. More...

Functions

static char * strncasestr (const char *haystack, const char *needle, size_t haystacksz)
 Search a portion of a length-string for a substring, case-insensitive.
static char * strcasestr (const char *haystack, const char *needle)
 Search a portion of a string for a substring, case-insensitive.
static int xf_parse_filter_list_version (char *fv, size_t fvsz, const char **attrs)
 Parse a <filter-list> 'version' attribute.
static int xf_parse_filter_status (const char *status)
 Parse a filter 'status' attribute.
static unsigned xf_parse_filter_type (const char *ftype)
 Parse a filter 'type' attribute.
static int xf_process_filter_attrs (Filter *f, const char **attrs)
 Parse filter attributes into Filter fields.
static Filterxf_create_filter (const char **attrs)
 Create and populate a Filter object from a filter element.
static Filterxf_find_filter (const char *name, XDList *fl)
 Locate and return a filter by name, case-sensitive.
static int xf_is_dup_filter (const char *name, XDList *f)
 Log an error if name is already in the filter list.
static Attribute xf_parse_match_attr (const char *avalue)
 Tokenize an allow/deny 'attr' attribute value.
static Operator xf_parse_match_op (const char *avalue)
 Tokenize an allow/deny 'op' attribute value.
static int xf_process_match_attrs (Match *m, const char **attrs)
 Parse allow/deny attributes into Match fields.
static Matchxf_create_match (ParserState state, const char **attrs)
 Create and fill a Match object from an allow/deny element.
static int xf_process_alarm_attrs (Action *a, const char **attrs)
 Parse alarm attributes into Action fields.
static void xf_process_unknown_attrs (const char *el, const char **attrs)
 Parse unknown attributes - log results.
static ActionType xf_map_state_to_action (ParserState state)
 Map a ParserState to an ActionType code.
static int xf_process_action_attrs (ParserState state, Action *a, const char **attrs)
 Parse log, alarm, or trigger attributes into Action fields.
static Actionxf_create_action (ParserState state, const char **attrs)
 Create and fill an Action object.
static int xf_is_valid_filter_attr (unsigned ftype, Attribute attr)
 Indicates if specified match is valid for specified filter type.
static void XMLCALL xf_start_tag (void *data, const char *el, const char **attrs)
 An eXpat "start tag" callback function.
static int xf_gather_text_data (char **tpp, const char *s, int len, int raw)
 Gather text data into specified buffer pointer.
static void XMLCALL xf_elem_data (void *data, const XML_Char *s, int len)
 An eXpat "element data" callback function.
static int xf_replace_script_varnames (char *script, char *limit)
 Replaces variable field names with field numbers.
static int xf_cleanup_trigger_script (Action *a)
 Normalizes an Action's trigger script.
static int xf_is_attr_numeric (Attribute attr)
 Indicate whether a specified attribute is numeric.
static void XMLCALL xf_end_tag (void *data, const char *el)
 An eXpat "end tag" callback function.
static int xf_parse_xml_filter (const char *xmlfile)
 XML filter file parser.
static void xf_free_match (Match *m)
 Free a match object as well as internally allocated memory.
static void xf_free_action (Action *a)
 Free an action object as well as internally allocated memory.
static void xf_free_filter (Filter *f)
 Free a filter object as well as internally allocated memory.
static int xf_is_numeric_field_match (unsigned fld, Operator op, unsigned number)
 Indicates whether a numeric field matches as specified.
static int xf_is_text_field_match (const char *fld, size_t fldsz, Operator op, const char *text)
 Indicates whether a text field matches as specified.
static int xf_filter_matches (Parsed *parsed, XDList *matches)
 Indicates if a set of match criteria matches a specified parsed message.
int xdasd_filter_check (Parsed *parsed, int onlycheck)
 Set all matching actions for the specified parsed message.
int xdasd_filter_process (int *minorp, xdas_buffer req, xdas_buffer *rspp)
 Process an XDAS filter management request.
int xdasd_filter_init (const char *filter_file)
 Initialize filter module.
void xdasd_filter_exit (void)
 Cleanup filter module.

Variables

static char g_filter_version [32]
static XDList g_filters = {0, 0, 0}


Detailed Description

OpenXDAS filter message buffer parsing and handling.

For an example filter file, see the unit test data set at the bottom of this source module.

Author:
John Calcote (jcalcote@novell.com)
Attention:
Please submit patches to http://openxdas.sourceforge.net

Definition in file xdasd_filter.c.


Define Documentation

#define FT_IMPORT   0x00000002

Definition at line 72 of file xdasd_filter.c.

Referenced by xdasd_filter_check(), and xf_parse_filter_type().

#define FT_SUBMIT   0x00000001

#define XML_FMT_INT_MOD   "l"

Definition at line 68 of file xdasd_filter.c.

Referenced by xf_parse_xml_filter().


Typedef Documentation

typedef struct action_tag Action

A structure that represents XDAS message filter actions.

typedef struct filter_tag Filter

A structure that represents a complete XDAS filter specification.

typedef struct match_tag Match

A structure that represents XDAS message field match criteria.

typedef struct parser_tag Parser

A structure that represents an XDAS filter parser.


Enumeration Type Documentation

enum ActionType

An enumeration that represents all XDAS filter action types.

Enumerator:
ACT_LOG 
ACT_ALARM 
ACT_TRIGGER 

Definition at line 136 of file xdasd_filter.c.

enum Attribute

An enumeration that represents all XDAS message fields.

Note:
This enumeraiton is numbered according to the field order in the standardized XDAS record format. This order must be maintained. Note also that some of the values are not used - they are merely placeholders so that the numbering is accurate.
Enumerator:
AT_UNKNOWN 
AT_HDR 
AT_HDRLEN 
AT_HDRVER 
AT_HDRTMOFFS 
AT_HDRTUINT 
AT_HDRTUIND 
AT_HDRTMSRC 
AT_HDRTMZONE 
AT_HDREVENT 
AT_HDROUTCOME 
AT_ORG 
AT_ORGLOC 
AT_ORGADDR 
AT_ORGTYPE 
AT_ORGAUT 
AT_ORGNAME 
AT_ORGID 
AT_INT 
AT_INTAUTH 
AT_INTNAME 
AT_INTID 
AT_TGT 
AT_TGTLOC 
AT_TGTADDR 
AT_TGTTYPE 
AT_TGTAUTH 
AT_TGTNAME 
AT_TGTID 
AT_SRC 
AT_SRCDPTR 
AT_EVT 
AT_EVTINFO 
AT_END 

Definition at line 96 of file xdasd_filter.c.

enum Operator

An enumeration that represents all XDAS filter operators.

Enumerator:
OP_UNKNOWN 
OP_EQUAL 
OP_NOT_EQUAL 
OP_GREATER_THAN 
OP_LESS_THAN 
OP_GT_OR_EQUAL 
OP_LT_OR_EQUAL 
OP_BIT_TEST 
OP_SUBSTRING 

Definition at line 76 of file xdasd_filter.c.

An enumeration that represents all possible XDAS filter parser states.

Enumerator:
PS_INIT 
PS_FILTER_EXPECTED 
PS_MATCH_OR_ACTION_EXPECTED 
PS_MATCH_EXPECTED 
PS_ALLOW_IN_PROGRESS 
PS_DENY_IN_PROGRESS 
PS_ACTION_EXPECTED 
PS_LOG_IN_PROGRESS 
PS_ALARM_IN_PROGRESS 
PS_TRIGGER_IN_PROGRESS 
PS_TERMINATE 

Definition at line 179 of file xdasd_filter.c.


Function Documentation

static char* strcasestr ( const char *  haystack,
const char *  needle 
) [static]

Search a portion of a string for a substring, case-insensitive.

For internal use only.

Definition at line 246 of file xdasd_filter.c.

References strncasestr().

Referenced by xf_parse_filter_type(), and xf_replace_script_varnames().

static char* strncasestr ( const char *  haystack,
const char *  needle,
size_t  haystacksz 
) [static]

Search a portion of a length-string for a substring, case-insensitive.

Parameters:
[in] haystack - the string to be searched.
[in] needle - the substring for which to search.
[in] haystacksz - the maximum number of characters of haystack to be searched.
Returns:
A pointer to the substring located, or zero (null) if needle was not found in the first haystacksz bytes of haystack.

For internal use only.

Definition at line 227 of file xdasd_filter.c.

References int().

Referenced by strcasestr(), and xf_is_text_field_match().

static int xf_cleanup_trigger_script ( Action a  )  [static]

Normalizes an Action's trigger script.

Removes leading and trailing white space, replaces variable reference field names with field numbers.

Parameters:
[in] a - the action object to be cleaned up.
Returns:
Zero on success, -1 on script formatting error.

For internal use only.

Definition at line 894 of file xdasd_filter.c.

References free, action_tag::text, and xf_replace_script_varnames().

Referenced by xf_end_tag().

static Action* xf_create_action ( ParserState  state,
const char **  attrs 
) [static]

Create and fill an Action object.

Parameters:
[in] state - the parser state.
[in] attrs - the attributes to be parsed.
Returns:
An allocated and populated Action object. The caller is responsible allocated resources.

For internal use only.

Definition at line 629 of file xdasd_filter.c.

References action_tag::atype, free, malloc, xdasd_log(), xf_map_state_to_action(), and xf_process_action_attrs().

Referenced by xf_start_tag().

static Filter* xf_create_filter ( const char **  attrs  )  [static]

Create and populate a Filter object from a filter element.

Parameters:
[in] attrs - The attribute names and values to be parsed.
Returns:
An allocated and populated Filter object. The caller is responsible for releasing all associated memory.

For internal use only.

Definition at line 374 of file xdasd_filter.c.

References free, malloc, xdasd_log(), and xf_process_filter_attrs().

Referenced by xf_start_tag().

static Match* xf_create_match ( ParserState  state,
const char **  attrs 
) [static]

Create and fill a Match object from an allow/deny element.

Parameters:
[in] state - the current parser state.
[in] attrs - the list of attribute names and values.
Returns:
An allocated and populated Match object. Caller is responsible for releasing all associated memory.

For internal use only.

Definition at line 526 of file xdasd_filter.c.

References free, match_tag::inverse, malloc, PS_DENY_IN_PROGRESS, xdasd_log(), and xf_process_match_attrs().

Referenced by xf_start_tag().

static void XMLCALL xf_elem_data ( void *  data,
const XML_Char s,
int  len 
) [static]

An eXpat "element data" callback function.

Parameters:
[in] data - Pass-through from original caller - caller defined.
[in] s - Pointer to element data.
[in] len - Length of data in s.

For internal use only.

Definition at line 806 of file xdasd_filter.c.

References parser_tag::a, parser_tag::m, PS_ALLOW_IN_PROGRESS, PS_DENY_IN_PROGRESS, PS_TRIGGER_IN_PROGRESS, parser_tag::state, action_tag::text, match_tag::text, xf_gather_text_data(), XML_FALSE, XML_StopParser(), and parser_tag::xp.

Referenced by xf_parse_xml_filter().

static void XMLCALL xf_end_tag ( void *  data,
const char *  el 
) [static]

static int xf_filter_matches ( Parsed parsed,
XDList matches 
) [static]

Indicates if a set of match criteria matches a specified parsed message.

Parameters:
[in] parsed - The message to be compared.
[in] matches - The list of matches to compare.
Returns:
Four possible values: 1 on explicit include indication, 0 on explicit exclude indication, -1 on no match situation, or -2 on missing field attempt.

For internal use only.

Definition at line 1256 of file xdasd_filter.c.

References match_tag::attribute, match_tag::elem, XDList_tag::head, match_tag::inverse, XDLItem_tag::next, match_tag::number, match_tag::op, parsed_tag::parsed, match_tag::text, xf_is_attr_numeric(), xf_is_numeric_field_match(), and xf_is_text_field_match().

Referenced by xdasd_filter_check().

static Filter* xf_find_filter ( const char *  name,
XDList fl 
) [static]

Locate and return a filter by name, case-sensitive.

For internal use only.

Definition at line 392 of file xdasd_filter.c.

References filter_tag::elem, XDList_tag::head, filter_tag::name, and XDLItem_tag::next.

Referenced by xf_is_dup_filter().

static void xf_free_action ( Action a  )  [static]

Free an action object as well as internally allocated memory.

Parameters:
[in] a - the action to be freed.

For internal use only.

Definition at line 1157 of file xdasd_filter.c.

References free, and action_tag::text.

Referenced by xf_free_filter().

static void xf_free_filter ( Filter f  )  [static]

Free a filter object as well as internally allocated memory.

Parameters:
[in] f - The filter to be freed.

For internal use only.

Definition at line 1169 of file xdasd_filter.c.

References filter_tag::actions, free, XDList_tag::head, filter_tag::matches, filter_tag::name, XDLItem_tag::next, xf_free_action(), and xf_free_match().

Referenced by xdasd_filter_exit().

static void xf_free_match ( Match m  )  [static]

Free a match object as well as internally allocated memory.

Parameters:
[in] m - the match to be freed.

For internal use only.

Definition at line 1145 of file xdasd_filter.c.

References free, and match_tag::text.

Referenced by xf_free_filter().

static int xf_gather_text_data ( char **  tpp,
const char *  s,
int  len,
int  raw 
) [static]

Gather text data into specified buffer pointer.

This routine "grows" the buffer specified in tpp by the number of bytes in s (specified in len), and then appends len bytes from s onto whatever was previously in tpp.

Parameters:
[in,out] tpp - The buffer pointer to be (re)allocated.
[in] s - The text data to be appended.
[in] len - The number of bytes in s.
[in] raw - Boolean flag - leave internal and trailing white space in tact. Trailing white space will be removed later.
Returns:
Zero on success, -1 on allocation failure.

For internal use only.

Definition at line 765 of file xdasd_filter.c.

References free, malloc, and xdasd_log().

Referenced by xf_elem_data().

static int xf_is_attr_numeric ( Attribute  attr  )  [static]

Indicate whether a specified attribute is numeric.

Parameters:
[in] attr - The attribute to be checked.
Returns:
A boolean value: True (1) if attr is numeric, False (0) if not.

For internal use only.

Definition at line 930 of file xdasd_filter.c.

References AT_HDREVENT, AT_HDRLEN, AT_HDROUTCOME, AT_HDRTMOFFS, AT_HDRTUIND, and AT_HDRTUINT.

Referenced by xf_end_tag(), and xf_filter_matches().

static int xf_is_dup_filter ( const char *  name,
XDList f 
) [static]

Log an error if name is already in the filter list.

For internal use only.

Definition at line 404 of file xdasd_filter.c.

References xdasd_log(), and xf_find_filter().

Referenced by xf_start_tag().

static int xf_is_numeric_field_match ( unsigned  fld,
Operator  op,
unsigned  number 
) [static]

Indicates whether a numeric field matches as specified.

Parameters:
[in] fld - The numeric value message field to be compared.
[in] op - The operation to use in the comparison.
[in] number - The value to compare fld against.
Returns:
A boolean value: True (1) if fld matches number according to op, False (0) if not.

For internal use only.

Definition at line 1201 of file xdasd_filter.c.

References OP_BIT_TEST, OP_EQUAL, OP_GREATER_THAN, OP_GT_OR_EQUAL, OP_LESS_THAN, OP_LT_OR_EQUAL, and OP_NOT_EQUAL.

Referenced by xf_filter_matches().

static int xf_is_text_field_match ( const char *  fld,
size_t  fldsz,
Operator  op,
const char *  text 
) [static]

Indicates whether a text field matches as specified.

Parameters:
[in] fld - The text message field to be compared.
[in] fldsz - The size of fld in bytes.
[in] op - The operation to use in the comparison.
[in] text - The text value to compare fld against.
Returns:
A boolean value: True (1) if fld matches text according to op, False (0) if not.

For internal use only.

Definition at line 1229 of file xdasd_filter.c.

References OP_EQUAL, OP_GREATER_THAN, OP_GT_OR_EQUAL, OP_LESS_THAN, OP_LT_OR_EQUAL, OP_NOT_EQUAL, OP_SUBSTRING, and strncasestr().

Referenced by xf_filter_matches().

static int xf_is_valid_filter_attr ( unsigned  ftype,
Attribute  attr 
) [static]

Indicates if specified match is valid for specified filter type.

According to the XDAS specification, only a few attributes are filterable for submitted messages. Many more are filterable for imported events.

Parameters:
[in] ftype - The filter type to check m against.
[in] m - The match to be validated against ftype.
Returns:
A boolean value; True if the match is valid, False if not.

For internal use only.

Definition at line 656 of file xdasd_filter.c.

References AT_HDREVENT, AT_HDROUTCOME, AT_HDRTMZONE, AT_HDRTUINT, AT_HDRVER, AT_INT, AT_INTAUTH, AT_ORG, AT_TGT, AT_TGTID, FT_SUBMIT, and xdasd_log().

Referenced by xf_start_tag().

static ActionType xf_map_state_to_action ( ParserState  state  )  [static]

Map a ParserState to an ActionType code.

Parameters:
[in] state - the parser state to be mapped.
Returns:
An action type code based on state.

For internal use only.

Definition at line 588 of file xdasd_filter.c.

References ACT_ALARM, ACT_LOG, ACT_TRIGGER, PS_ALARM_IN_PROGRESS, PS_LOG_IN_PROGRESS, and PS_TRIGGER_IN_PROGRESS.

Referenced by xf_create_action().

static int xf_parse_filter_list_version ( char *  fv,
size_t  fvsz,
const char **  attrs 
) [static]

Parse a <filter-list> 'version' attribute.

Parameters:
[out] fv - the version list output buffer.
[in] fvsz - the amount of available space in fv.
[in] attrs - the attribute list to be parsed.
Returns:
Zero on success, -1 on missing filter version attribute, or on incorrect version attribute value - this filter parser currently supports only version 'OX1'.

For internal use only.

Definition at line 261 of file xdasd_filter.c.

References xdasd_log().

Referenced by xf_start_tag().

static int xf_parse_filter_status ( const char *  status  )  [static]

Parse a filter 'status' attribute.

Parameters:
[in] status - The string status value to be parsed.
Returns:
Boolean: One if filter status is on, zero if off.

For internal use only.

Definition at line 298 of file xdasd_filter.c.

Referenced by xf_process_filter_attrs().

static unsigned xf_parse_filter_type ( const char *  ftype  )  [static]

Parse a filter 'type' attribute.

Parameters:
[in] ftype - the filter type attribute string to be parsed.
Returns:
A filter type bit mask.

For internal use only.

Definition at line 313 of file xdasd_filter.c.

References FT_IMPORT, FT_SUBMIT, and strcasestr().

Referenced by xf_process_filter_attrs().

static Attribute xf_parse_match_attr ( const char *  avalue  )  [static]

Tokenize an allow/deny 'attr' attribute value.

Parameters:
[in] avalue - The attribute value to be tokenized.
Returns:
The Attribute token matching avalue, or AT_UNKNOWN if avalue doesn't represent a known XDAS attribute.

For internal use only.

Definition at line 423 of file xdasd_filter.c.

References AT_EVTINFO, AT_HDREVENT, AT_HDRLEN, AT_HDROUTCOME, AT_HDRTMOFFS, AT_HDRTMSRC, AT_HDRTMZONE, AT_HDRTUIND, AT_HDRTUINT, AT_HDRVER, AT_INTAUTH, AT_INTID, AT_INTNAME, AT_ORGADDR, AT_ORGAUT, AT_ORGID, AT_ORGLOC, AT_ORGNAME, AT_ORGTYPE, AT_SRCDPTR, AT_TGTADDR, AT_TGTAUTH, AT_TGTID, AT_TGTLOC, AT_TGTNAME, AT_TGTTYPE, and AT_UNKNOWN.

Referenced by xf_process_match_attrs(), and xf_replace_script_varnames().

static Operator xf_parse_match_op ( const char *  avalue  )  [static]

Tokenize an allow/deny 'op' attribute value.

Parameters:
[in] avalue - The attribute value to be tokenized.
Returns:
The Operator token matching avalue, or OP_UNKNOWN if avalue doesn't represent a known XDAS operator.

For internal use only.

Definition at line 459 of file xdasd_filter.c.

References OP_BIT_TEST, OP_EQUAL, OP_GREATER_THAN, OP_GT_OR_EQUAL, OP_LESS_THAN, OP_LT_OR_EQUAL, OP_NOT_EQUAL, OP_SUBSTRING, and OP_UNKNOWN.

Referenced by xf_process_match_attrs().

static int xf_parse_xml_filter ( const char *  xmlfile  )  [static]

XML filter file parser.

Parameters:
[in] xmlfile - The name of an XML filter file to be parsed.
Returns:
Zero on success, -1 on parse or allocation failure.

For internal use only.

Definition at line 1069 of file xdasd_filter.c.

References parser_tag::filters, parser_tag::fversion, g_filter_version, PS_INIT, parser_tag::state, xdasd_filter_exit(), xdasd_log(), xf_elem_data(), xf_end_tag(), xf_start_tag(), XML_ErrorString(), XML_FMT_INT_MOD, XML_GetErrorCode(), XML_Parse(), XML_ParserCreate(), XML_ParserFree(), XML_SetCharacterDataHandler(), XML_SetElementHandler(), XML_SetUserData(), XML_STATUS_ERROR, and parser_tag::xp.

Referenced by xdasd_filter_init().

static int xf_process_action_attrs ( ParserState  state,
Action a,
const char **  attrs 
) [static]

Parse log, alarm, or trigger attributes into Action fields.

Parameters:
[in] state - the parser state.
[in] a - the action object to be populated.
[in] attrs - The attributes to be parsed.
Returns:
Zero on success, or -1 on allocation or parse failure.

For internal use only.

Definition at line 609 of file xdasd_filter.c.

References PS_ALARM_IN_PROGRESS, PS_LOG_IN_PROGRESS, xf_process_alarm_attrs(), and xf_process_unknown_attrs().

Referenced by xf_create_action().

static int xf_process_alarm_attrs ( Action a,
const char **  attrs 
) [static]

Parse alarm attributes into Action fields.

Parameters:
[in] a - the Action object to be populated.
[in] attrs - the attributes to be parsed.
Returns:
Zero on success, or -1 on parse failure.

For internal use only.

Definition at line 551 of file xdasd_filter.c.

References action_tag::severity, and xdasd_log().

Referenced by xf_process_action_attrs().

static int xf_process_filter_attrs ( Filter f,
const char **  attrs 
) [static]

Parse filter attributes into Filter fields.

Parameters:
[in] f - The Filter into which attributes should be parsed.
[in] attrs - The attribute names and values to be parsed.
Returns:
Zero on success, or -1 on parse or allocation failure.

For internal use only.

Definition at line 332 of file xdasd_filter.c.

References free, FT_SUBMIT, filter_tag::ftype, filter_tag::name, filter_tag::status, strdup(), xdasd_log(), xf_parse_filter_status(), and xf_parse_filter_type().

Referenced by xf_create_filter().

static int xf_process_match_attrs ( Match m,
const char **  attrs 
) [static]

Parse allow/deny attributes into Match fields.

Parameters:
[in] m - The Match object to populate.
[in] attrs - The list of attribute names and values.
Returns:
Zero on success, -1 on parse error.

For internal use only.

Definition at line 486 of file xdasd_filter.c.

References AT_UNKNOWN, match_tag::attribute, match_tag::op, OP_UNKNOWN, xdasd_log(), xf_parse_match_attr(), and xf_parse_match_op().

Referenced by xf_create_match().

static void xf_process_unknown_attrs ( const char *  el,
const char **  attrs 
) [static]

Parse unknown attributes - log results.

Parameters:
[in] el - The element currently being parsed.
[in] attrs - The unknown attributes to be processed.

For internal use only.

Definition at line 572 of file xdasd_filter.c.

References xdasd_log().

Referenced by xf_process_action_attrs().

static int xf_replace_script_varnames ( char *  script,
char *  limit 
) [static]

Replaces variable field names with field numbers.

Replaces field names (as defined by filter field names) with decimal numeric field numbers (zero-based).

Parameters:
[in] script - the script text to be compressed.
[in] limit - the limit of the script - points to one past buffer.
Returns:
Zero on success, -1 on script variable formatting error.

For internal use only.

Definition at line 837 of file xdasd_filter.c.

References AT_UNKNOWN, attr, strcasestr(), xdasd_log(), and xf_parse_match_attr().

Referenced by xf_cleanup_trigger_script().

static void XMLCALL xf_start_tag ( void *  data,
const char *  el,
const char **  attrs 
) [static]


Variable Documentation

char g_filter_version[32] [static]

Definition at line 208 of file xdasd_filter.c.

Referenced by xf_parse_xml_filter().

XDList g_filters = {0, 0, 0} [static]

Definition at line 209 of file xdasd_filter.c.


Generated on Thu Aug 20 22:33:07 2009 for OpenXDAS by  doxygen 1.5.6