Main Page | Modules | Data Structures | File List | Data Fields | Related Pages

Helper for parsing config file
[MNT daemon]

Some helper functions for parsing the XML config file with expat. More...

Data Structures

struct  ParsingContext
 Parsing Context. More...


Defines

#define MAX_DEPTH   32
 Maximum nesting depth.

#define CDATA_BUF_SIZE   1024
 Maximum amount of CDATA.

#define MAX_KEY_SIZE   128
 Max length of property key.


Enumerations

enum  { CURELEM_UNKNOWN = -1, CURELEM_MNTD = 0, CURELEM_MOUNTPATH = 1 }
 Possible elements the parser can process. More...


Functions

void mntd_volume_config_parsing_abort (ParsingContext *pc)
 Abort parsing of document.

void mntd_volume_config_start (ParsingContext *pc, const char *el, const char **attr)
 Called by expat when an element begins.

void mntd_volume_config_end (ParsingContext *pc, const char *el)
 Called by expat when an element ends.

void mntd_volume_config_cdata (ParsingContext *pc, const char *s, int len)
 Called when there is CDATA.

int mntd_volume_config_store_base (PVOLUMEMANAGER pvm, const char *base)
 Store base mountpath from config file.

int mntd_volume_config_parse (char *config, PVOLUMEMANAGER pvm)
 Parse the config file.


Detailed Description

Some helper functions for parsing the XML config file with expat.


Enumeration Type Documentation

anonymous enum
 

Possible elements the parser can process.

Enumeration values:
CURELEM_UNKNOWN  Not processing a known tag.
CURELEM_MNTD  Processing the root element.
CURELEM_MOUNTPATH  Processing a mountpath element.

Definition at line 58 of file mntd_volume_config.c.


Function Documentation

void mntd_volume_config_cdata ParsingContext pc,
const char *  s,
int  len
 

Called when there is CDATA.

Parameters:
pc Parsing context
s Pointer to data
len Length of data

Definition at line 250 of file mntd_volume_config.c.

References ParsingContext::aborted, ParsingContext::cdata_buf, ParsingContext::cdata_buf_len, CDATA_BUF_SIZE, and MSG_ERR.

Referenced by mntd_volume_config_parse().

void mntd_volume_config_end ParsingContext pc,
const char *  el
 

Called by expat when an element ends.

Parameters:
pc Parsing context
el Element name

Definition at line 206 of file mntd_volume_config.c.

References ParsingContext::aborted, ParsingContext::cdata_buf, ParsingContext::cdata_buf_len, ParsingContext::curelem, CURELEM_MOUNTPATH, ParsingContext::curelem_stack, ParsingContext::depth, mntd_volume_config_parsing_abort(), mntd_volume_config_store_base(), MSG_DEBUG, MSG_ERR, and ParsingContext::pvm.

Referenced by mntd_volume_config_parse().

int mntd_volume_config_parse char *  config,
PVOLUMEMANAGER  pvm
 

Parse the config file.

Parameters:
config Path of configfile
pvm Pointer to Volume Manager Object
Returns:
0 if successful, -1 otherwise

Definition at line 290 of file mntd_volume_config.c.

References ParsingContext::aborted, ParsingContext::cdata_buf, ParsingContext::cdata_buf_len, ParsingContext::config, ParsingContext::curelem, CURELEM_UNKNOWN, ParsingContext::depth, mntd_file_get_size(), mntd_file_is_file(), mntd_file_read(), mntd_volume_config_cdata(), mntd_volume_config_end(), mntd_volume_config_start(), MSG_EMERG, MSG_INF, ParsingContext::parser, and ParsingContext::pvm.

Referenced by mntd_volume_manager_init().

void mntd_volume_config_parsing_abort ParsingContext pc  ) 
 

Abort parsing of document.

Parameters:
pc Parsing context

Definition at line 117 of file mntd_volume_config.c.

References ParsingContext::aborted, and MSG_ERR.

Referenced by mntd_volume_config_end(), and mntd_volume_config_start().

void mntd_volume_config_start ParsingContext pc,
const char *  el,
const char **  attr
 

Called by expat when an element begins.

Parameters:
pc Parsing context
el Element name
attr Attribute key/value pairs

Definition at line 134 of file mntd_volume_config.c.

References ParsingContext::aborted, ParsingContext::cdata_buf_len, ParsingContext::config, ParsingContext::curelem, CURELEM_MNTD, CURELEM_MOUNTPATH, ParsingContext::curelem_stack, CURELEM_UNKNOWN, ParsingContext::depth, MAX_DEPTH, mntd_volume_config_parsing_abort(), MSG_DEBUG, MSG_ERR, and ParsingContext::parser.

Referenced by mntd_volume_config_parse().

int mntd_volume_config_store_base PVOLUMEMANAGER  pvm,
const char *  base
 

Store base mountpath from config file.

Parameters:
pvm Pointer to Volume Manager Object
base base mountpath
Returns:
0 if successful, -1 otherwise

Definition at line 384 of file mntd_volume_config.c.

Referenced by mntd_volume_config_end().


Generated on Thu May 27 23:27:29 2004 for Mntd by doxygen 1.3.5