shared/cfgparser.h
e3aaff8e
 /*
81837459
  *  Copyright (C) 2002 - 2005 Tomasz Kojm <tkojm@clamav.net>
e3aaff8e
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, write to the Free Software
48b7b4a7
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  *  MA 02110-1301, USA.
e3aaff8e
  */
 
afb48b28
 #ifndef __CFGPARSER_H
 #define __CFGPARSER_H
e3aaff8e
 
 #define LINE_LENGTH 1024
 
5174f778
 #define OPT_STR 1 /* string argument (space delimited) */
e3aaff8e
 #define OPT_NUM 2 /* numerical argument */
 #define OPT_COMPSIZE 3 /* convert kilobytes (k) and megabytes (m) to bytes */
81837459
 #define OPT_BOOL 4 /* boolean value */
 #define OPT_FULLSTR 5 /* string argument, but get a full line */
5174f778
 #define OPT_QUOTESTR 6 /* string argument, (space delimited unless the argument starts with ' or ".  If the argument starts with a quote character, then the argument data is what appears between the starting quote character and the matching ending quote character.) */
e3aaff8e
 
e628b432
 #define OPT_CLAMD 1
 #define OPT_FRESHCLAM 2
 
e3aaff8e
 struct cfgoption {
     const char *name;
e628b432
     unsigned short argtype;
81837459
     int numarg;
     const char *strarg;
     short multiple;
e628b432
     unsigned short owner;
e3aaff8e
 };
 
 struct cfgstruct {
9e431a95
     char *optname;
     char *strarg;
e3aaff8e
     int numarg;
81837459
     short enabled;
     short multiple;
e3aaff8e
     struct cfgstruct *nextarg;
     struct cfgstruct *next;
 };
 
e628b432
 extern struct cfgoption cfg_options[];
e3aaff8e
 
81837459
 struct cfgstruct *getcfg(const char *cfgfile, int verbose);
1095156a
 const struct cfgstruct *cfgopt(const struct cfgstruct *copt, const char *optname);
9e431a95
 void freecfg(struct cfgstruct *copt);
 
e3aaff8e
 #endif