config.c File Reference

#include "nsd.h"

Defines

#define ISSLASH(c)   ((c) == '/' || (c) == '\\')

Functions

void NsInitConfig (void)
char * Ns_ConfigGetValue (char *section, char *key)
char * Ns_ConfigGetValueExact (char *section, char *key)
int Ns_ConfigGetInt (char *section, char *key, int *valuePtr)
int Ns_ConfigGetInt64 (char *section, char *key, INT64 *valuePtr)
int Ns_ConfigGetBool (char *section, char *key, int *valuePtr)
char * Ns_ConfigGetPath (char *server, char *module,...)
Ns_Set ** Ns_ConfigGetSections (void)
Ns_Set * Ns_ConfigGetSection (char *section)
void Ns_GetVersion (int *majorV, int *minorV, int *patchLevelV, int *type)
char * NsConfigRead (char *file)
void NsConfigEval (char *config, int argc, char **argv, int optind)

Define Documentation

#define ISSLASH (  )     ((c) == '/' || (c) == '\\')


Function Documentation

int Ns_ConfigGetBool ( char *  section,
char *  key,
int *  valuePtr 
)

----------------------------------------------------------------------

Ns_ConfigGetBool --

Get a boolean config value. There are many ways to represent a boolean value.

Results: NS_TRUE/NS_FALSE

Side effects: The boolean value is returned by reference

----------------------------------------------------------------------

int Ns_ConfigGetInt ( char *  section,
char *  key,
int *  valuePtr 
)

----------------------------------------------------------------------

Ns_ConfigGetInt --

Fetch integer config values

Results: S_TRUE if it found an integer value; otherwise, it returns NS_FALSE and sets the value to 0

Side effects: The integer value is returned by reference

----------------------------------------------------------------------

int Ns_ConfigGetInt64 ( char *  section,
char *  key,
INT64 *  valuePtr 
)

----------------------------------------------------------------------

Ns_ConfigGetInt64 --

Like Ns_ConfigGetInt, but with INT64 data instead of system-native int types.

Results: See Ns_ConfigGetInt

Side effects: See Ns_ConfigGetInt

----------------------------------------------------------------------

char* Ns_ConfigGetPath ( char *  server,
char *  module,
  ... 
)

----------------------------------------------------------------------

Ns_ConfigGetPath --

Get the full name of a config file section if it exists.

Results: A pointer to an ASCIIZ string of the full path name, or NULL if that path is not in the config file.

Side effects: None.

----------------------------------------------------------------------

Ns_Set* Ns_ConfigGetSection ( char *  section  ) 

----------------------------------------------------------------------

Ns_ConfigGetSection --

Return the Ns_Set of a config section called section.

Results: An Ns_Set, containing the section's parameters

Side effects: None.

----------------------------------------------------------------------

Ns_Set** Ns_ConfigGetSections ( void   ) 

----------------------------------------------------------------------

Ns_ConfigGetSections --

Return a malloc'ed, NULL-terminated array of sets, each corresponding to a config section

Results: An array of sets

Side effects: The result is malloc'ed memory

----------------------------------------------------------------------

char* Ns_ConfigGetValue ( char *  section,
char *  key 
)

----------------------------------------------------------------------

Ns_ConfigGetValue --

Return a config file value for a given key

Results: ASCIIZ ptr to a value

Side effects: None.

----------------------------------------------------------------------

char* Ns_ConfigGetValueExact ( char *  section,
char *  key 
)

----------------------------------------------------------------------

Ns_ConfigGetValueExact --

Case-sensitive version of Ns_ConfigGetValue

Results: See Ns_ConfigGetValue

Side effects: None.

----------------------------------------------------------------------

void Ns_GetVersion ( int *  majorV,
int *  minorV,
int *  patchLevelV,
int *  type 
)

----------------------------------------------------------------------

Ns_GetVersion

Get the major, minor, and patchlevel version numbers and the release type. A patch is a release type NS_FINAL_RELEASE with a patchLevel > 0.

Results: None.

Side effects: None.

----------------------------------------------------------------------

void NsConfigEval ( char *  config,
int  argc,
char **  argv,
int  optind 
)

----------------------------------------------------------------------

NsConfigEval --

Eval config script in a startup Tcl interp.

Results: None.

Side Effects: Various variables in the configInterp will be set as well as the sundry configuration hashes

---------------------------------------------------------------------

Create an interp with a few config-related commands.

char* NsConfigRead ( char *  file  ) 

----------------------------------------------------------------------

NsConfigRead --

Read a config file at startup.

Results: Pointer to the config buffer of an ns_malloc'ed string.

Side Effects: Server aborts if file cannot be read for any reason.

---------------------------------------------------------------------

void NsInitConfig ( void   ) 

----------------------------------------------------------------------

NsInitConfig --

Initialize the config interface.

Results: None.

Side effects: None.

----------------------------------------------------------------------


Generated on Tue Sep 4 19:58:55 2007 by  doxygen 1.5.1