mirror of
https://github.com/outbackdingo/sysadm.git
synced 2026-01-27 10:20:26 +00:00
Copy over the new sysadm library/binary from the pcbsd/pcbsd repo into it's own repo.
This commit is contained in:
19
src/binary/binary.pro
Normal file
19
src/binary/binary.pro
Normal 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
33
src/binary/main.cpp
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user