vnstat  2.9
About: vnStat is a console-based network traffic monitor (using the /proc filesystem).
  Fossies Dox: vnstat-2.9.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

cfg.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  cfgsetting
 

Typedefs

typedef enum ConfigType ConfigType
 

Enumerations

enum  ConfigType { CT_All = 0 , CT_CLI , CT_Daemon , CT_Image }
 

Functions

int loadcfg (const char *cfgfile, const ConfigType type)
 
void validatebool (const char *cfgname, int32_t *cfgptr, const int32_t defaultvalue)
 
void validateint (const char *cfgname, int32_t *cfgptr, const int32_t defaultvalue, const int32_t minvalue, const int32_t maxvalue)
 
void validatecfg (const ConfigType type)
 
void defaultcfg (void)
 
int opencfgfile (const char *cfgfile, FILE **fd)
 
int extractcfgvalue (char *value, const unsigned int valuelen, const char *cfgline, const unsigned int cfglen)
 
int setcfgvalue (const struct cfgsetting *cset, const char *value, const char *cfgline)
 
void configlocale (void)
 

Typedef Documentation

◆ ConfigType

typedef enum ConfigType ConfigType

Enumeration Type Documentation

◆ ConfigType

enum ConfigType
Enumerator
CT_All 
CT_CLI 
CT_Daemon 
CT_Image 

Definition at line 12 of file cfg.h.

Function Documentation

◆ configlocale()

void configlocale ( void  )

Definition at line 549 of file cfg.c.

References cfg, CFG::locale, and CFG::utflocale.

Referenced by main().

◆ defaultcfg()

void defaultcfg ( void  )

Definition at line 341 of file cfg.c.

References ALWAYSADD, CFG::alwaysadd, BARSHOWSRATE, CFG::barshowsrate, BVAR, CFG::bvar, BWDETECT, BWDETECTINTERVAL, CFG::bwdetection, CFG::bwdetectioninterval, CBACKGROUND, CFG::cbg, CEDGE, CFG::cedge, cfg, CHEADER, CFG::cheader, CHEADERDATE, CFG::cheaderdate, CHEADERTITLE, CFG::cheadertitle, CLINE, CFG::cline, CLINEL, CFG::clinel, CREATEDIRS, CFG::createdirs, CRX, CFG::crx, CRXD, CFG::crxd, CTEXT, CFG::ctext, CTX, CFG::ctx, CTXD, CFG::ctxd, CFG::daemongroup, CFG::daemonuser, DAILYDAYS, CFG::dailydays, DATABASEDIR, DATABASELOCALTIMEMODIFIER, CFG::dbdir, DBSYNCHRONOUS, CFG::dbsynchronous, CFG::dbtzmodifier, DEFAULTDECIMALS, CFG::defaultdecimals, DEFIFACE, DEFMAXBW, DEFQMODE, DEFSAMPTIME, DFORMAT, CFG::dformat, ESTIMATEBARVISIBLE, CFG::estimatebarvisible, ESTIMATESTYLE, CFG::estimatestyle, CFG::experimental, FIVEGHEIGHT, CFG::fivegheight, FIVEGRESULTCOUNT, CFG::fivegresultcount, FIVEMINUTEHOURS, CFG::fiveminutehours, HFORMAT, CFG::hformat, HOURLYDAYS, CFG::hourlydays, HOURLYDECIMALS, CFG::hourlydecimals, HOURLYGMODE, CFG::hourlygmode, HOURLYRATE, CFG::hourlyrate, HOURLYSTYLE, CFG::hourlystyle, CFG::iface, ifacebw, IFACEMATCHMETHOD, CFG::ifacematchmethod, IMAGESCALE, CFG::imagescale, IS64BIT, CFG::is64bit, LARGEFONTS, CFG::largefonts, LINESPACEADJUST, CFG::linespaceadjust, LISTDAYS, CFG::listdays, LISTFIVEMINS, CFG::listfivemins, LISTHOURS, CFG::listhours, LISTJSONXML, CFG::listjsonxml, LISTMONTHS, CFG::listmonths, LISTTOP, CFG::listtop, LISTYEARS, CFG::listyears, LOCALE, CFG::locale, LOGFILE, CFG::logfile, CFG::maxbw, MFORMAT, CFG::mformat, MONTHLYMONTHS, CFG::monthlymonths, MONTHROTATE, CFG::monthrotate, MONTHROTATEYEARS, CFG::monthrotateyears, OFFSAVEINTERVAL, CFG::offsaveinterval, OSTYLE, CFG::ostyle, PIDFILE, CFG::pidfile, POLLINTERVAL, CFG::pollinterval, CFG::qmode, RATEUNIT, CFG::rateunit, RATEUNITMODE, CFG::rateunitmode, RESCANONSAVE, CFG::rescanonsave, RXCHAR, CFG::rxchar, RXHOURCHAR, CFG::rxhourchar, CFG::sampletime, SAVEINTERVAL, CFG::saveinterval, SAVESTATUS, CFG::savestatus, CFG::spacecheck, strncpy_nt(), SUMMARYGRAPH, CFG::summarygraph, SUMMARYRATE, CFG::summaryrate, TFORMAT, CFG::tformat, CFG::timestampprints, TIMESYNCWAIT, CFG::timesyncwait, TOPDAYENTRIES, CFG::topdayentries, TRAFFICLESSENTRIES, CFG::trafficlessentries, TRANSBG, CFG::transbg, TXCHAR, CFG::txchar, TXHOURCHAR, CFG::txhourchar, UNITMODE, CFG::unitmode, UPDATEFILEOWNER, CFG::updatefileowner, UPDATEINTERVAL, CFG::updateinterval, USELOGGING, CFG::uselogging, USESPACECHECK, USEUTC, CFG::useutc, UTFLOCALE, CFG::utflocale, WALDB, CFG::waldb, YEARLYYEARS, and CFG::yearlyyears.

Referenced by loadcfg().

◆ extractcfgvalue()

int extractcfgvalue ( char *  value,
const unsigned int  valuelen,
const char *  cfgline,
const unsigned int  cfglen 
)

Definition at line 498 of file cfg.c.

Referenced by loadcfg().

◆ loadcfg()

int loadcfg ( const char *  cfgfile,
const ConfigType  type 
)

Definition at line 4 of file cfg.c.

References CFG::alwaysadd, CFG::barshowsrate, CFG::bvar, CFG::bwdetection, CFG::bwdetectioninterval, CFG::cbg, CFG::cedge, cfg, CFG::cheader, CFG::cheaderdate, CFG::cheadertitle, CFG::cline, CFG::clinel, CFG::createdirs, CFG::crx, CFG::crxd, CFG::ctext, CFG::ctx, CFG::ctxd, CFG::daemongroup, CFG::daemonuser, CFG::dailydays, CFG::dbdir, CFG::dbsynchronous, debug, defaultcfg(), CFG::defaultdecimals, CFG::dformat, CFG::estimatebarvisible, CFG::estimatestyle, CFG::experimental, extractcfgvalue(), CFG::fivegheight, CFG::fivegresultcount, CFG::fiveminutehours, cfgsetting::found, CFG::hformat, CFG::hourlydays, CFG::hourlydecimals, CFG::hourlygmode, CFG::hourlyrate, CFG::hourlystyle, CFG::iface, CFG::ifacematchmethod, CFG::imagescale, CFG::is64bit, CFG::largefonts, CFG::linespaceadjust, CFG::listdays, CFG::listfivemins, CFG::listhours, CFG::listmonths, CFG::listtop, CFG::listyears, CFG::locale, CFG::logfile, CFG::maxbw, CFG::mformat, CFG::monthlymonths, CFG::monthrotate, CFG::monthrotateyears, cfgsetting::name, CFG::offsaveinterval, opencfgfile(), CFG::ostyle, CFG::pidfile, CFG::pollinterval, CFG::qmode, CFG::rateunit, CFG::rateunitmode, CFG::rescanonsave, CFG::rxchar, CFG::rxhourchar, CFG::sampletime, CFG::saveinterval, CFG::savestatus, setcfgvalue(), CFG::spacecheck, CFG::summarygraph, CFG::summaryrate, CFG::tformat, CFG::timesyncwait, CFG::topdayentries, CFG::trafficlessentries, CFG::transbg, CFG::txchar, CFG::txhourchar, CFG::unitmode, CFG::updatefileowner, CFG::updateinterval, CFG::uselogging, CFG::useutc, validatecfg(), CFG::waldb, and CFG::yearlyyears.

Referenced by handleintsignals(), and main().

◆ opencfgfile()

int opencfgfile ( const char *  cfgfile,
FILE **  fd 
)

Definition at line 443 of file cfg.c.

References cfg, CFG::cfgfile, debug, errorstring, printe(), PT_Error, and strncpy_nt().

Referenced by ibwloadcfg(), and loadcfg().

◆ setcfgvalue()

int setcfgvalue ( const struct cfgsetting cset,
const char *  value,
const char *  cfgline 
)

Definition at line 532 of file cfg.c.

References debug, cfgsetting::locc, cfgsetting::loci, cfgsetting::name, cfgsetting::namelen, and strncpy_nt().

Referenced by loadcfg().

◆ validatebool()

void validatebool ( const char *  cfgname,
int32_t *  cfgptr,
const int32_t  defaultvalue 
)

Definition at line 162 of file cfg.c.

References validateint().

Referenced by validatecfg().

◆ validatecfg()

void validatecfg ( const ConfigType  type)

Definition at line 184 of file cfg.c.

References ALWAYSADD, CFG::alwaysadd, BARSHOWSRATE, CFG::barshowsrate, BVAR, CFG::bvar, BWDETECT, BWDETECTINTERVAL, CFG::bwdetection, CFG::bwdetectioninterval, BWMAX, cfg, CREATEDIRS, CFG::createdirs, CT_All, CT_Daemon, CT_Image, DAILYDAYS, CFG::dailydays, DATABASEDIR, DATABASELOCALTIMEMODIFIER, CFG::dbdir, DBSYNCHRONOUS, CFG::dbsynchronous, CFG::dbtzmodifier, debug, DEFAULTDECIMALS, CFG::defaultdecimals, DEFMAXBW, DEFSAMPTIME, errorstring, ESTIMATEBARVISIBLE, CFG::estimatebarvisible, ESTIMATESTYLE, CFG::estimatestyle, CFG::experimental, FIVEGHEIGHT, CFG::fivegheight, FIVEGMINHEIGHT, FIVEGMINRESULTCOUNT, FIVEGRESULTCOUNT, CFG::fivegresultcount, FIVEMINUTEHOURS, CFG::fiveminutehours, HOURLYDAYS, CFG::hourlydays, HOURLYDECIMALS, CFG::hourlydecimals, HOURLYGMODE, CFG::hourlygmode, HOURLYRATE, CFG::hourlyrate, HOURLYSTYLE, CFG::hourlystyle, IFACEMATCHMETHOD, CFG::ifacematchmethod, IMAGESCALE, CFG::imagescale, IS64BIT, CFG::is64bit, LARGEFONTS, CFG::largefonts, LINESPACEADJUST, CFG::linespaceadjust, LISTDAYS, CFG::listdays, LISTFIVEMINS, CFG::listfivemins, LISTHOURS, CFG::listhours, LISTMONTHS, CFG::listmonths, LISTTOP, CFG::listtop, LISTYEARS, CFG::listyears, LOGFILE, CFG::logfile, MAX32, CFG::maxbw, MONTHLYMONTHS, CFG::monthlymonths, MONTHROTATE, CFG::monthrotate, MONTHROTATEYEARS, CFG::monthrotateyears, OFFSAVEINTERVAL, CFG::offsaveinterval, OSTYLE, CFG::ostyle, PIDFILE, CFG::pidfile, POLLINTERVAL, CFG::pollinterval, printe(), PT_Config, RATEUNITMODE, CFG::rateunitmode, RESCANONSAVE, CFG::rescanonsave, CFG::sampletime, SAVEINTERVAL, CFG::saveinterval, SAVESTATUS, CFG::savestatus, CFG::spacecheck, strncpy_nt(), SUMMARYGRAPH, CFG::summarygraph, SUMMARYRATE, CFG::summaryrate, TIMESYNCWAIT, CFG::timesyncwait, TOPDAYENTRIES, CFG::topdayentries, TRAFFICLESSENTRIES, CFG::trafficlessentries, TRANSBG, CFG::transbg, UNITMODE, CFG::unitmode, UPDATEFILEOWNER, CFG::updatefileowner, UPDATEINTERVAL, CFG::updateinterval, USELOGGING, CFG::uselogging, USESPACECHECK, USEUTC, CFG::useutc, validatebool(), validateint(), WALDB, CFG::waldb, YEARLYYEARS, and CFG::yearlyyears.

Referenced by loadcfg().

◆ validateint()

void validateint ( const char *  cfgname,
int32_t *  cfgptr,
const int32_t  defaultvalue,
const int32_t  minvalue,
const int32_t  maxvalue 
)

Definition at line 167 of file cfg.c.

References errorstring, printe(), and PT_Config.

Referenced by validatebool(), and validatecfg().