//=========================================== // PC-BSD source code // Copyright (c) 2015, PC-BSD Software/iXsystems // Available under the 3-clause BSD license // See the LICENSE file for full details //=========================================== #include "sysadm-network.h" //PLEASE: Keep the functions in the same order as listed in pcbsd-network.h #include "sysadm-general.h" using namespace sysadm; //===================== // NETWORK FUNCTIONS //===================== /*QList Network::listNetworkEntries(){ QList out; netent *entry = getnetent(); while(entry!=0){ //Copy over this data into the output structure NetworkEntry tmp; tmp.name = QString::fromLocal8Bit(entry->n_name); for(int i=0; entry->n_aliases[i] != 0; i++){ tmp.aliases << QString::fromLocal8Bit(entry->n_aliases[i]); } tmp.netnum = entry->n_net; out << tmp; //Now load the next entry entry = getnetent(); } endnetent(); //make sure to close the file since we are finished reading it return out; }*/ //--------------------------------------- QStringList Network::readRcConf(){ static QStringList contents = QStringList(); static QDateTime lastread; if(!lastread.isValid() || contents.isEmpty() || (QFileInfo("/etc/rc.conf").lastModified()> lastread) ){ lastread = QDateTime::currentDateTime(); contents = General::readTextFile("/etc/rc.conf"); } return contents; } //--------------------------------------- NetDevSettings Network::deviceRCSettings(QString dev){ QStringList info = Network::readRcConf().filter(dev); //Setup the default structure/values NetDevSettings set; set.device = dev; set.wifihost = set.useDHCP = set.wifisecurity = false; if(info.isEmpty()){ return set; } //no settings //Now load any info associated with this device for(int i=0; i