diff --git a/src/binary/main.cpp b/src/binary/main.cpp index f23f3b7..d2dde81 100644 --- a/src/binary/main.cpp +++ b/src/binary/main.cpp @@ -6,6 +6,7 @@ int main( int argc, char ** argv ) { //Run a simple test of all the sysadm backend functions + qDebug() << "**** Test Network Devices ****"; QStringList devs = sysadm::NetDevice::listNetDevices(); qDebug() <<"Devices:" << devs; for(int i=0; i entries = sysadm::Network::listNetworkEntries(); + for(int i=0; i Network::listNetworkEntries(){ +/*QList Network::listNetworkEntries(){ QList out; netent *entry = getnetent(); while(entry!=0){ @@ -29,7 +29,7 @@ QList Network::listNetworkEntries(){ } endnetent(); //make sure to close the file since we are finished reading it return out; -} +}*/ //--------------------------------------- QStringList Network::readRcConf(){ @@ -45,44 +45,48 @@ QStringList Network::readRcConf(){ //--------------------------------------- NetDevSettings Network::deviceRCSettings(QString dev){ QStringList info = Network::readRcConf().filter(dev); + //Setup the default structure/values NetDevSettings set; - if(info.isEmpty()){ return set; } //no settings set.device = dev; - set.wifihost = false; + 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 wlan device) - //Wifi - QString wifiCountry, wifiSSID, wifiBSSID, wifichannel; + //Wifi settings + QString wifiCountry, wifiSSID, wifiBSSID, wifiChannel; bool wifihost; - //General - QString etherMac; - //NOTE: All the "static" variables are only used for rc.conf settings - // For the current IP/IPv6 information use the "NetDevice" class below + bool wifisecurity; //always recommended for wifi settings - otherwise can't connect to secure access points + //Addressing + bool useDHCP; QString staticIPv4, staticNetmask, staticIPv6; //assumes DHCP if none are set QString staticGateway; }; @@ -72,22 +72,23 @@ public: //General data structure for wifi access points (local or available) struct NetWifi{ NetCrypt encryption; + QString BSSID, SSID; }; //The general-purpose class that any user/app can utilitize class Network{ public: - static QList listNetworkEntries(); + //static QList listNetworkEntries(); static QStringList readRcConf(); //use this when reading /etc/rc.conf for network stuff - prevents opening the file repeatedly static NetDevSettings deviceRCSettings(QString dev); //settings in rc.conf (bootup) - static NetDevSettings deviceIfconfigSettings(QString dev); //settings currently running + //static NetDevSettings deviceIfconfigSettings(QString dev); //settings currently running }; //The class that requires overarching root permissions (usually for changes to system) class NetworkRoot{ public: - static bool saveNetworkEntry(NetworkEntry); //**Not implemented yet** + //static bool saveNetworkEntry(NetworkEntry); //**Not implemented yet** static bool saveRCSettings(NetDevSettings); //rc.conf settings (bootup) static bool setIfconfigSettings(NetDevSettings); //ifconfig settings (temporary session) };