OSDN Git Service

modified comments
[opengatem/opengatem.git] / mdsrc / getparam.c
index 0c77331..415001a 100644 (file)
@@ -2,6 +2,9 @@
 OpengateM - a MAC address authentication system
  module for getting parameters from conf file
 
+configuration file has XML form which is parsed by ezxml liblary.
+functions relating Extraset and authserver are not used in daemon program.
+
 Copyright (C) 2006 Opengate Project Team
 Written by Yoshiaki Watanabe
 
@@ -28,7 +31,7 @@ Programmed by Yoshiaki WATANABE
 #include "opengatemd.h"
 #include "../ezxml/ezxml.h"
 
-#define CONFIG_VERSION "0.6.0"
+#define CONFIG_VERSION "0.6.0"  /* should match to the value in conf file */
 #define SEPARATOR "/"
 
 int debug=0;
@@ -55,7 +58,7 @@ char* getProgramName(void){
 
 /**************************************************/
 /* Prepare Conf file to use                       */
-/* this is called before syslog setup             */
+/* this should be called before syslog setup      */
 /**************************************************/
 int openConfFile(void)
 {
@@ -75,12 +78,11 @@ int openConfFile(void)
     return -1;
   }
 
-  /* to check error, convert to xml */
+  /* try to convert to xml */
   s=ezxml_toxml(xmlRoot);  free(s);
   
   /* if failed, show error message */
   errMsg=(char *)ezxml_error(xmlRoot);
-
   if(*errMsg!='\0'){
     /* as the syslog is not prepared, error is send to web*/
     strlcpy(buff, "<H3>Error: Opengate configuration file ",BUFFMAXLN);
@@ -90,7 +92,6 @@ int openConfFile(void)
     strlcat(buff, errMsg, BUFFMAXLN);
     strlcat(buff, "<HR>", BUFFMAXLN);
     PutMessageToClient(buff);
-
     return -1;
   }
 
@@ -103,7 +104,6 @@ int openConfFile(void)
     strlcat(buff, CONFIGFILE, BUFFMAXLN);
     strlcat(buff, ".sample.",BUFFMAXLN);
     PutMessageToClient(buff);
-
     return -1;
   }
 
@@ -116,7 +116,6 @@ int openConfFile(void)
     strlcat(buff, CONFIGFILE,BUFFMAXLN);
     strlcat(buff, ". Call the administrator.</H3><BR>",BUFFMAXLN);
     PutMessageToClient(buff);
-
     return -1;
   }
 
@@ -221,7 +220,7 @@ int regExMatch(const char *inStr, const char *regEx)
 /**************************************************/
 /*  get a value for name from Conf file           */
 /*  the name[aa/bb/cc] means the path             */
-/*  if ID is set, extraSet value is overlayed */
+/*  if name is set in extraSet, the value is used */
 /**************************************************/
 char *getConfValue(char *name)
 {
@@ -256,7 +255,7 @@ char *getConfValue(char *name)
     err_msg("ERR at %s#%d: cannot get %s from conf file",__FILE__,__LINE__,name);
   }
 
-  /* get value in extra set matched to ID */
+  /* get value in extra set matched to name */
   /* if name is matched in first level, reset all child setting */
   /* in this section, many parameters are not set */
   if(!isNull(pValueExtra=getConfValueExtra(name))){
@@ -273,7 +272,7 @@ char *getConfValue(char *name)
 }
 
 /************************************************/
-/* get the value in extra set matched to ID     */
+/* get the value in extra set matched to name   */
 /************************************************/
 char *getConfValueExtra(char *name)
 {
@@ -355,6 +354,7 @@ char *getConfAuthServer(char *name)
 
 /**********************************/
 /* select next authserver setting */
+/* (move poiner to next server)   */
 /**********************************/
 int selectNextAuthServer(void){
 
@@ -390,15 +390,16 @@ int selectNextAuthServer(void){
   }
 }
 
-/**********************************************
-reset pointer for auth server list
-**********************************************/
+/*********************************************/
+/* reset pointer for auth server list        */
+/*********************************************/
 void resetAuthServerPointer(void){
   xmlAuthServer=NULL;
 }
 
 /***********************************************/
 /* Convart the syslog facility id to raw value */
+/*  in string form (only from local0 to local7)*/
 /***********************************************/
 char *convertToFacilityRaw(char *pValue)
 {
@@ -421,8 +422,7 @@ char *convertToFacilityRaw(char *pValue)
 }
 
 /**************************************************/
-/*  get the first value as previous call           */
-/*  (next node of the lowest level of tree)       */  
+/*  get the first value for the name              */
 /**************************************************/
 char *getFirstConfValue(char* name)
 {
@@ -437,8 +437,8 @@ char *getFirstConfValue(char* name)
 }
 
 /**************************************************/
-/*  get the next value as previous call           */
-/*  (next node of the lowest level of tree)       */  
+/*  get the next value                            */
+/*  need to call after getFirstConfValue()        */
 /**************************************************/
 char *getNextConfValue(void)
 {