config.c File Reference

Reads XML configuration files. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <libxml/xmlreader.h>
#include <rfb/rfb.h>
#include "veronica.h"
#include "xmlutil.h"
#include "config.h"

Include dependency graph for config.c:


Defines

#define CONFIG_DEFAULT_FILE   "/etc/veronica_conf.xml"
#define CONFIG_DEFAULT_REFRESH   200
#define CONFIG_DEFAULT_KEY_DELAY   65
#define CONFIG_DEFAULT_PORT   5900
#define CONFIG_DEFAULT_SHOW_CURSOR   0
#define CONFIG_DEFAULT_MOUSE_CONTROL   1
#define CONFIG_DEFAULT_SCREEN_NAME   "Veronica"
#define CONFIG_ATTR_REFRESH   "refresh"
#define CONFIG_ATTR_KEY_REPEAT_DELAY   "key_repeat_delay"
#define CONFIG_ATTR_AUTH_FILE   "auth_file"
#define CONFIG_ATTR_THEME_DIR   "theme_dir"
#define CONFIG_ATTR_SHOW_CURSOR   "show_cursor"
#define CONFIG_ATTR_MOUSE_CONTROL   "mouse_control"
#define CONFIG_ATTR_VNC_PORT   "vnc_port"
#define CONFIG_ATTR_HTTP_PORT   "http_port"
#define CONFIG_ATTR_SCREEN_NAME   "name"
#define CONFIG_ELEM_COMMON   "common"
#define CONFIG_ELEM_SERVER   "screen"
#define CONFIG_MIN_PORT   0
#define CONFIG_MAX_PORT   65535

Functions

static char * config_get_screen_name ()
static int config_xml_process_common (xmlTextReaderPtr reader, struct config *config)
static int config_xml_process_screen (xmlTextReaderPtr reader, struct config *config)
static int config_xml_process_node (xmlTextReaderPtr reader, struct config *config)
static int config_set_defaults (struct config *config)
static int config_check (struct config *config)
struct configconfig_load (char *config_file)
void config_cleanup (struct config *config)

Detailed Description

Fills a config structure with configuration data.
Example configuration file:
 <config>
     <common 
          refresh="200"
          key_repeat_delay="65"
          auth_file="/etc/veronica.auth"
     />
     <screen
          theme_dir="/opt/veronica/themes/black_coverart"
          show_cursor="1"
          vnc_port="5900"
          http_port="5800"
          name="default"
     />
     <screen
          theme_dir="/opt/veronica/themes/pda_240_300"
          show_cursor="0"
          mouse_control="0"
          vnc_port="5901"
          name="pda"
     />
 </config>

Define Documentation

#define CONFIG_DEFAULT_FILE   "/etc/veronica_conf.xml"

Default configuration file.

#define CONFIG_DEFAULT_REFRESH   200

Default display refresh time (milliseconds).

#define CONFIG_DEFAULT_KEY_DELAY   65

Default delay between key presses in key repeat mode (milliseconds).

#define CONFIG_DEFAULT_PORT   5900

Default VNC port.

#define CONFIG_DEFAULT_SHOW_CURSOR   0

Default setting for displaying a mouse cursor on server side.


1 = show mouse cursor, 0 = no mouse cursor

#define CONFIG_DEFAULT_MOUSE_CONTROL   1

Default setting for mouse control within display area.


1 = mouse control, 0 = no mouse control

#define CONFIG_DEFAULT_SCREEN_NAME   "Veronica"

Default screen name.

#define CONFIG_ATTR_REFRESH   "refresh"

XML attribute for display refresh time.

#define CONFIG_ATTR_KEY_REPEAT_DELAY   "key_repeat_delay"

XML attribute for key repeat delay.

#define CONFIG_ATTR_AUTH_FILE   "auth_file"

XML attribute for authentication file.

#define CONFIG_ATTR_THEME_DIR   "theme_dir"

XML attribute for theme directroy.

#define CONFIG_ATTR_SHOW_CURSOR   "show_cursor"

XML attribute for displaying a mouse cursor on server side.

#define CONFIG_ATTR_MOUSE_CONTROL   "mouse_control"

XML attribute for mouse control within display area.

#define CONFIG_ATTR_VNC_PORT   "vnc_port"

XML attribute for vnc port (Remote Framebuffer Protocol).

#define CONFIG_ATTR_HTTP_PORT   "http_port"

XML attribute for http port (Java viewer applet).

#define CONFIG_ATTR_SCREEN_NAME   "name"

XML attribute for VNC screen name (displayed in the title bar).

#define CONFIG_ELEM_COMMON   "common"

XML element for the 'common' part of a configuration file.

#define CONFIG_ELEM_SERVER   "screen"

XML element for the 'screen' parts of a configuration file.

#define CONFIG_MIN_PORT   0

Minimum port number of listener port.

#define CONFIG_MAX_PORT   65535

Maximum port number of listener port.


Function Documentation

static char* config_get_screen_name (  )  [static]

Provides the default name for a VNC screen (displayed in the title bar of VNC viewers.

)

Returns:
the default screen name

static int config_xml_process_common ( xmlTextReaderPtr  reader,
struct config config 
) [static]

Processes the common node in a configuration XML document.

Parameters:
reader the XML reader
config configuration data
Returns:
0 on success or -1 if an error occured

static int config_xml_process_screen ( xmlTextReaderPtr  reader,
struct config config 
) [static]

Processes a screen node in a configuration XML document.

Parameters:
reader the XML reader
config configuration data
Returns:
0 on success or -1 if an error occured

static int config_xml_process_node ( xmlTextReaderPtr  reader,
struct config config 
) [static]

Processes a node in a configuration XML document.

Parameters:
reader the XML reader
config configuration data
Returns:
0 on success or -1 if an error occured

static int config_set_defaults ( struct config config  )  [static]

Sets the default configuration values.

Parameters:
config configuration data
Returns:
0 on success or -1 if an error occured

static int config_check ( struct config config  )  [static]

Checks correctness of the configuration data.

Parameters:
config configuration data
Returns:
0 on success or -1 if an error occured

struct config* config_load ( char *  config_file  )  [read]

Parses the data of an XML configuration file.

Parameters:
config_file configuration file path
Returns:
a pointer to a config structure or NULL if an error occured

void config_cleanup ( struct config config  ) 

Configuration cleanup.

Frees allocated memory.

Parameters:
config configuration data


Generated on Mon Mar 29 01:39:26 2010 for Veronica by  doxygen 1.5.8