Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages   Examples  

config.c File Reference

Implements the internally-used and public API configuration functions for libmacs. Unless you're interested in macs internals, you're probably looking for libmacs.h. More...

#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <expat.h>
#include "libmacs.h"
#include "common.h"

Defines

#define DIE_PARSING   { free(ctx->cf); ctx->cf=NULL; return; }

Functions

_macs_cfgs_macs_cf_descend (_macs_ctx *ctx, const char *key, _macs_cfgs *parent)
void _macs_free_cfgs (_macs_cfgs **cfgs)
const char * macs_get_cf (macs_session *sess)
 Find the configuration file.

char * macs_get_config (macs_session *sess, const char *key,...)
 Fetch a configuration value.

char ** macs_get_configs (macs_session *sess, int *nodes, const char *key,...)
 Fetch several configuration values.

char ** macs_get_methods (macs_session *sess, int svc)
 Fetch a list of available methods.

void _macs_xml_elt_start (void *ctxp, const XML_Char *name, const XML_Char **atts)
void _macs_xml_elt_end (void *ctxp, const XML_Char *name)
void _macs_xml_char (void *ctxp, const XML_Char *s, int len)
int _macs_parse_cf (macs_session *sess)

Variables

const char _macs_config_c_id [] = "$Id: config.c,v 1.29 2003/08/06 11:46:22 blake Exp $"


Detailed Description

Implements the internally-used and public API configuration functions for libmacs. Unless you're interested in macs internals, you're probably looking for libmacs.h.

Id
config.c,v 1.29 2003/08/06 11:46:22 blake Exp

Define Documentation

#define DIE_PARSING   { free(ctx->cf); ctx->cf=NULL; return; }
 

Signals death in cf parse by free()ing ctx->cf, setting to NULL


Function Documentation

_macs_cfgs * _macs_cf_descend _macs_ctx   ctx,
const char *    key,
_macs_cfgs   parent
 

Find a child node with the certain name, or "default"

Parameters:
ctx A _macs_ctx object from macs_init()
key The name of the child node to search for.
parent The _macs_cfgs node to search in.
Returns:
The child node, or NULL if not found.

void _macs_xml_elt_start void *    ctxp,
const XML_Char *    name,
const XML_Char **    atts
 

Handler for start (and empty) tags during XML parsing of cf. free()s ctx->cf and sets to NULL on error. Sets ctx->parsing to a new cfgs item (or an existing one if we hit multiple tags with attribute 'array' set)

Parameters:
ctxp A void-cast pointer to the _macs_ctx being initted
name The name of the tag
atts An NULL-term'd array of name/value pairs of this tag's attributes

void _macs_xml_elt_end void *    ctxp,
const XML_Char *    name
 

Handler for end (and empty) tags during XML parsing of cf. Simply sets the current cfgs up one level.

Parameters:
ctxp A void-cast pointer to the _macs_ctx being initted
name The name of the tag (w/o namespace)

void _macs_xml_char void *    ctxp,
const XML_Char *    s,
int    len
 

Handler for text during XML parsing of cf.

Parameters:
ctxp A void-cast pointer to the _macs_ctx being initted
s non-NULL-terminated string
len Length of s

int _macs_parse_cf macs_session   sess
 

Parse the config file and set up the cfgs in the given ctx.

Parameters:
ctx The context to configure. ctx->cf needs to be initted.
Returns:
0 on failure, 1 on success


Variable Documentation

const char _macs_config_c_id[] = "$Id: config.c,v 1.29 2003/08/06 11:46:22 blake Exp $"
 

For use by ident


Generated on Fri Aug 8 09:53:44 2003 for MACS Client C API by doxygen1.3-rc3