Copy over the new sysadm library/binary from the pcbsd/pcbsd repo into it's own repo.

This commit is contained in:
Ken Moore
2015-12-08 15:23:18 -05:00
parent 538ba5cc1d
commit 74249cefb2
10 changed files with 812 additions and 0 deletions

19
src/binary/binary.pro Normal file
View File

@@ -0,0 +1,19 @@
TEMPLATE = app
LANGUAGE = C++
CONFIG += qt warn_on release
QT = core
SOURCES += main.cpp
LIBS = -L../library -L/usr/lib -L/usr/local/lib -lsysadm
INCLUDEPATH += ../library /usr/include /usr/local/include
TARGET=sysadm
target.path=/usr/local/bin
INSTALLS += target
QMAKE_LIBDIR = /usr/local/lib/qt5 /usr/local/lib

33
src/binary/main.cpp Normal file
View File

@@ -0,0 +1,33 @@
#include <QCoreApplication>
#include <QDebug>
#include <sysadm-network.h>
int main( int argc, char ** argv )
{
//Run a simple test of all the sysadm backend functions
QStringList devs = sysadm::NetDevice::listNetDevices();
qDebug() <<"Devices:" << devs;
for(int i=0; i<devs.length(); i++){
sysadm::NetDevice D(devs[i]);
qDebug() << "Check Device:" << D.device();
qDebug() << " - name:" << D.devName();
qDebug() << " - number:" << D.devNum();
qDebug() << " - IPv4:" << D.ipAsString();
qDebug() << " - IPv6:" << D.ipv6AsString();
qDebug() << " - netmask:" << D.netmaskAsString();
qDebug() << " - description:" << D.desc();
qDebug() << " - MAC:" << D.macAsString();
//qDebug() << " - Media Type:" << D.mediaTypeAsString();
qDebug() << " - Media Status:" << D.mediaStatusAsString();
bool iswifi = D.isWireless();
qDebug() << " - Is Wireless:" << iswifi;
if(iswifi){
qDebug() << " -- Wifi Parent:" << D.getWifiParent();
}
qDebug() << " - Is Active:" << D.isUp();
qDebug() << " - Packets Rx:" << D.packetsRx() << "Errors:" << D.errorsRx();
qDebug() << " - Packets Tx:" << D.packetsTx() << "Errors:" << D.errorsTx();
}
return 0;
}