////////////////////////////////////////////////////////////////////// // IP traffic analyzer - configuration file // Written by Jonathan A. Foster // Started May 14th, 2021 // Copyright JF Possibilities, Inc. All rights reserved. ////////////////////////////////////////////////////////////////////// #include #include #include #include "config.h" #include "strutil.h" ////////////////////////////////////////////////////////////////////// // INIusList ////////////////////////////////////////////////////////////////////// void INIusList::add(const std::string &in) { std::string s=trim(in); if(s!="" && s[0]!='#') MiniINIlines::add(s); } ////////////////////////////////////////////////////////////////////// // INIconnList ////////////////////////////////////////////////////////////////////// void INIconnList::add(const std::string &in) { int i; if(in=="" || in[0]=='#') return; // remarks // TODO: we don't want to keep create+destroy-ing these? TSV tsv(in); if(tsv.count!=7) throw // TODO: really need a line number! std::runtime_error("INIconnList::add: Incorrect column count in config file line"); if(tsv.count>6) { i = vals.size(); vals.resize(i+1); tsv >> vals[i]; } } // NOP right now, since I don't intend to be writing the config file. std::ostream &INIconnList::save(std::ostream &out) const { throw std::runtime_error("INIconnList::save: not implented."); } ////////////////////////////////////////////////////////////////////// // Config ////////////////////////////////////////////////////////////////////// Config::Config() { groups["us" ] = &us; groups["ignores"] = &ignores; }