Преглед на файлове

QML-Plugin entfernt und nach libgfaqt verlagert.

Rind преди 4 години
родител
ревизия
a76dd311b0

+ 54 - 0
config.txt

@@ -0,0 +1,54 @@
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+// Folgende Dateien/Verzeicnisse/symbolische Links werden nur einmal konfiguriert und danach nicht mehr
+// verändert (und sollten bei Auslieferung des Gerätes bereits vorhanden sein):
+
+/etc/wpa_supplicant.conf -> wandert nach /etc/wpa_supplicant/wpa_supplicant.conf
+
+/etc/wpa_supplicant (wpa_supplicant.tar.gz)
+	action_wpa.sh
+	functions.sh
+	ifupdown.sh
+	wpa_supplicant.conf (siehe unten)
+
+/etc/udev/rules.d (rules.d.tar.gz)
+	80-wifi.rules -> geändertes Skript! (unabhängig von VENDOR- und PRODUCT-Id - bindet an net-SUBSYSTEM und KERNEL-Name)
+	70-persistent-net.rules -> wird momentan nicht benötigt, kann aber verwendet werden um spezielle Interface-Namen zu vergeben, bzw. um einen Interface-Namen an eine bestimmte MAC-Adresse zu binden
+
+/etc/netplug
+	netplugd.conf -> Entfernen/Auskommentieren von "wlan*" (netplugd.conf.tar.gz)
+
+network.tar.gz:
+/etc/network/if-down.d
+	symlink wpasupplicant -> /etc/wpa_supplicant/ifupdown.sh
+/etc/network/if-post-down.d
+	symlink wpasupplicant -> /etc/wpa_supplicant/ifupdown.sh
+/etc/network/if-pre-up.d
+	symlink wpasupplicant -> /etc/wpa_supplicant/ifupdown.sh
+	wait_iface
+/etc/network/if-up.d
+	symlink wpasupplicant -> /etc/wpa_supplicant/ifupdown.sh
+
+/etc/network
+	symlink run -> /run/network
+	interfaces (siehe unten)
+
+/etc/init.d/M99_wlan_usb -> falls vorhanden löschen
+/etc/init.d/S99_wlan_usb -> falls vorhanden löschen
+
+/usr/sbin
+	wpa_action (wpa_action.tar.gz)
+
+/sbin
+	symlink wpa_action -> /usr/sbin/wpa_action
+	symlink wpa_cli -> /usr/sbin/wpa_cli
+	symlink wpa_passphrase -> /usr/sbin/wpa_passphrase
+	symlink wpa_supplicant -> /usr/sbin/wpa_supplicant
+
+
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+// Wird bei Interface/WLAN-Konfiguration bearbeitet:
+
+/etc/network/interfaces
+/etc/wpa_supplicant/wpa_supplicant.conf

+ 0 - 28
libnetinterfaces/debug.h

@@ -1,28 +0,0 @@
-// debug.h :
-//
-
-#if !defined(AGD_DEBUG_H__39391BF3_0394_4846_BFCB_028512359FF5__INCLUDED_)
-#define AGD_DEBUG_H__39391BF3_0394_4846_BFCB_028512359FF5__INCLUDED_
-
-#include <assert.h>
-#include <stdio.h>
-
-/////////////////////////////////////////////////////////////////////////////
-// debug.h - Declarations:
-
-#ifdef _DEBUG
-#define TRACE(...)					printf(__VA_ARGS__), fflush(stdout)
-#define ETRACE(...)					fprintf(stderr, __VA_ARGS__), fflush(stderr)
-#define ASSERT						assert
-#else	//	_DEBUG
-#define TRACE(...)					(void)0
-#define ETRACE(...)					(void)0
-#define ASSERT(e)					(void)0
-#endif	//	_DEBUG
-
-#ifndef UNUSED
-#define UNUSED(p)					(void)p
-#endif	//	UNUSED
-
-/////////////////////////////////////////////////////////////////////////////
-#endif	//	!defined(AGD_DEBUG_H__39391BF3_0394_4846_BFCB_028512359FF5__INCLUDED_)

+ 0 - 61
libnetinterfaces/libnetinterfaces.pro

@@ -1,61 +0,0 @@
-TEMPLATE = lib
-TARGET = netinterfaces
-QT += qml
-CONFIG += qt plugin c++11
-
-PDUMP="/home/wrk/Qt5.7.0/5.7/gcc_64/bin/qmlplugindump"
-VERSION=1.0
-PDUMPFILE=net.qmltypes
-IMPORTPATH="/home/wrk/Qt5.7.0/5.7/gcc_64/qml"
-URI = gfa.plugins.qml.net
-
-QMAKE_LIBDIR += $$[QT_SYSROOT]/usr/lib/gfa
-QMAKE_RPATHLINKDIR += $$[QT_SYSROOT]/usr/lib/gfa
-QMAKE_RPATHDIR += /usr/lib/gfa
-QMAKE_DEL_DIR = rmdir --ignore-fail-on-non-empty
-
-CONFIG(debug, debug|release) {
-    QMAKE_CXXFLAGS -= -Os
-    QMAKE_CFLAGS -= -Os
-    QMAKE_CXXFLAGS += -D_DEBUG
-    QMAKE_CFLAGS += -D_DEBUG
-    QMAKE_LIBS += -lgfanetd -lgfaipc
-}
-
-CONFIG(release, debug|release) {
-    QMAKE_LIBS += -lgfanet -lgfaipc
-}
-
-SOURCES += \
-    netinterfaces.cpp \
-    netinterfaces_plugin.cpp
-
-HEADERS += \
-    netinterfaces.h \
-    netinterfaces_plugin.h
-
-copy_qmldir.target = $$OUT_PWD/qmldir
-copy_qmldir.depends = $$_PRO_FILE_PWD_/qmldir
-copy_qmldir.commands = $(COPY_FILE) \"$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)\"
-QMAKE_EXTRA_TARGETS += copy_qmldir
-PRE_TARGETDEPS += $$copy_qmldir.target
-
-installPath = $$[QT_INSTALL_QML]/$$replace(URI, \\., /)
-USER_GROUP = $$system(stat -c "%U:%G" $$[QT_INSTALL_QML])
-
-qmldir.path = $$installPath
-qmldir.extra += -$(INSTALL_FILE) qmldir $$installPath
-qmldir.uninstall += -$(DEL_FILE) $$installPath/qmldir
-
-pdump.path = $$installPath
-linux-g++ {
-	pdump.extra += "$$PDUMP" -v "$$URI" "$$VERSION" "$$IMPORTPATH" > "$$installPath/$$PDUMPFILE"
-}
-pdump.extra += $$escape_expand(\\n\\t)chown -R $$USER_GROUP $$installPath
-
-linux-g++ {
-	pdump.uninstall += -$(DEL_FILE) $$installPath/$$PDUMPFILE
-}
-
-target.path = $$installPath
-INSTALLS += target qmldir pdump

+ 0 - 973
libnetinterfaces/netinterfaces.cpp

@@ -1,973 +0,0 @@
-#include <signal.h>
-#include "netinterfaces.h"
-#include "debug.h"
-
-#ifndef _countof
-#define _countof(a)					(sizeof(a) / sizeof(*a))
-#endif	//	_countof
-
-#define _IS_VALID_BYTE_VALUE(b)		(((b) >= 0) && ((b) <= 255))
-
-
-template<typename T>
-static bool _IsPowerOf2(T x)
-{
-	return x && !(x & (x - 1));
-}
-
-template<typename T>
-static unsigned int _BitCount(T n)
-{
-	unsigned int count = 0;
-	while(n)
-	{
-		count++;
-		n &= (n - 1);
-	}
-	return count;
-}
-
-template<typename T>
-static int _BitNumber(T n)
-{
-	if(!n || !_IsPowerOf2(n))
-		return -1;
-	int count = 0;
-	while(n)
-	{
-		count++;
-		n >>= 1;
-	}
-	return count - 1;
-}
-
-static int _Mask2Prefix(const struct in_addr &in)
-{
-	return _BitCount(in.s_addr);
-}
-
-static in_addr_t _Prefix2Mask(int prefix)
-{
-	return htonl(~((1 << (32 - prefix)) - 1));
-}
-
-static bool _IsValidNetmask(const struct in_addr &in)
-{
-	return _IsPowerOf2(~ntohl(in.s_addr) + 1);
-}
-
-/////////////////////////////////////////////////////////////////////////////
-
-#define _FLAG_TO_ENUM(f)		(_BitNumber(f))
-#define _ENUM_TO_FLAG(e)		(0x00000001 << e)
-
-/////////////////////////////////////////////////////////////////////////////
-
-NetInterfaces::NetInterfaces(QObject *pParent) :	QObject(pParent),
-													m_itfFilterAF(Interface::AF_Unknown),
-													m_itfFilterMethod(Interface::IM_Unknown),
-													m_bIfUpDownInProgress(false),
-													m_ifUpDownPid(-1)
-{
-	setObjectName("NetInterfaces");
-	m_mutex.Create(true);
-	m_itfFilterName.clear();
-}
-
-NetInterfaces::~NetInterfaces(void)
-{
-	reset();
-	m_mutex.Release();
-}
-
-void NetInterfaces::classBegin()
-{
-	if(!initialize())
-	{
-		reportError("NetInterfaces::initialize failed!");
-	}
-}
-
-void NetInterfaces::componentComplete()
-{
-}
-
-void NetInterfaces::reset(void)
-{
-	Interface *pItf;
-
-    for(int i = 0; i < m_interfaces.count(); i++)
-    {
-        if((pItf = m_interfaces.at(i)))
-        	delete pItf;
-    }
-    m_interfaces.clear();
-	emit interfacesChanged();
-	emit filteredInterfacesChanged();
-	m_eni._reset();
-}
-
-bool NetInterfaces::initialize(void)
-{
-	bool bRet;
-	reset();
-
-    if((bRet = ::ParseEtcNetworkInterfaces(m_eni)))
-	{
-		for(auto it = m_eni.ibl.begin(); it != m_eni.ibl.end(); it++)
-		{
-			ITF_IFACE_BLOCK &ibl = *it;
-			m_interfaces.append(new Interface(ibl, static_cast<NotificationSink&>(*this), this));
-		}
-
-		emit interfacesChanged();
-		emit filteredInterfacesChanged();
-	}
-
-	return bRet;
-}
-
-bool NetInterfaces::save(void)
-{
-	return ::WriteEtcNetworkInterfaces(m_eni, NULL);
-}
-
-bool NetInterfaces::saveAs(const QString &path)
-{
-	if(!path.length())
-		return false;
-	std::string p = path.toStdString();
-	const char *pszPath = p.c_str();
-	return ::WriteEtcNetworkInterfaces(m_eni, pszPath);
-}
-
-void NetInterfaces::reportError(const char *pszFormatStr, ...)
-{
-	va_list args;
-	va_start(args, pszFormatStr);
-	QString qs = QString::vasprintf(pszFormatStr, args);
-	va_end (args);
-	m_mutex.Lock();
-    emit error(qs);
-	m_mutex.Unlock();
-}
-
-void NetInterfaces::filterPropertyChanged(void) const
-{
-	emit filteredInterfacesChanged();
-}
-
-void NetInterfaces::selConfigChanged(Interface* pi, unsigned int cfgOld, unsigned int cfgNew)
-{
-	unsigned long id	= pi->getID();
-	unsigned int diff	= cfgOld ^ cfgNew;
-	unsigned int add	= cfgNew & diff;
-	unsigned int rem	= cfgOld & diff;
-
-	for(int mask = Interface::SC_Auto; mask < Interface::SC_Invalid; mask <<= 1)
-	{
-		if(add & mask)
-			::AddInterfaceToCfgGroup(m_eni, id, (CfgGroup)_FLAG_TO_ENUM(mask));
-
-		if(rem & mask)
-			::RemoveInterfaceFromCfgGroup(m_eni, id, (CfgGroup)_FLAG_TO_ENUM(mask));
-	}
-}
-
-Interface* NetInterfaces::newInterface(QString name, int af, int method)
-{
-	if(name.isNull() || name.isEmpty())
-	{
-		reportError("Invalid or empty interface name!");
-		return NULL;
-	}
-
-	if(!_IsPowerOf2(af) || (af <= Interface::AF_Unknown) || (af >= Interface::AF_Invalid))
-	{
-		reportError("Invalid address family: %d!", af);
-		return NULL;
-	}
-
-	if(!_IsPowerOf2(method) || (method <= Interface::IM_Unknown) || (method >= Interface::IM_Invalid))
-	{
-		reportError("Invalid method: %d!", method);
-		return NULL;
-	}
-
-	m_eni.ibl.emplace_back();
-	ITF_IFACE_BLOCK &rib = m_eni.ibl.back();
-    rib.cfgName = name.toStdString();
-	rib.proto = (IfaceProtos)_FLAG_TO_ENUM(af);
-	rib.method = (IfaceMethods)_FLAG_TO_ENUM(method);
-	Interface *pi = new Interface(rib, static_cast<NotificationSink&>(*this), this);
-	m_interfaces.append(pi);
-	emit interfacesChanged();
-	emit filteredInterfacesChanged();
-	return pi;
-}
-
-void NetInterfaces::removeInterface(Interface *pi)
-{
-	if(!pi)
-	{
-		reportError("NetInterfaces::removeInterface: An attempt was made to remove an invalid interface!");
-		return;
-	}
-
-	m_mutex.Lock();
-	if(GetIfUpDownInProgress())
-	{
-		m_mutex.Unlock();
-		reportError("NetInterfaces::removeInterface: Interface start/stop in progress! Please try again later!");
-		return;
-	}
-	m_mutex.Unlock();
-
-    unsigned long id	= pi->getID();
-    int selCfg			= pi->getSelCfg();
-
-    for(int i = 0; i < m_interfaces.count(); i++)
-	{
-        Interface *pil = m_interfaces.at(i);
-
-        if(pil->getID() == id)
-        {
-        	m_interfaces.removeAt(i);
-			emit interfacesChanged();
-			emit filteredInterfacesChanged();
-			delete pil;
-
-			for(int mask = Interface::SC_Auto; mask < Interface::SC_Invalid; mask <<= 1)
-			{
-				if(selCfg & mask)
-					::RemoveInterfaceFromCfgGroup(m_eni, id, (CfgGroup)_FLAG_TO_ENUM(mask));
-			}
-
-			::RemoveInterfaceBlock(m_eni, id);
-			break;
-        }
-    }
-}
-
-bool NetInterfaces::SetInterlockedIfUpDownInProgress(void)
-{
-	m_mutex.Lock();
-	if(m_bIfUpDownInProgress)
-	{
-		m_mutex.Unlock();
-		return false;
-	}
-	m_bIfUpDownInProgress = true;
-	m_mutex.Unlock();
-	return true;
-}
-
-void NetInterfaces::onIfUpDown(const char *pszMsg, void *pCtx)
-{
-	if(pCtx)
-	{
-		NetInterfaces *pThis = static_cast<NetInterfaces*>(pCtx);
-		pThis->m_mutex.Lock();
-		emit pThis->ifUpDown(pszMsg);
-		pThis->m_mutex.Unlock();
-	}
-}
-
-void NetInterfaces::onIfUpCompleted(int nExitCode, void *pCtx)
-{
-	if(pCtx)
-	{
-		LPIF_UPDOWN_CONTEXT piudc = static_cast<LPIF_UPDOWN_CONTEXT>(pCtx);
-		piudc->pThis->m_mutex.Lock();
-		emit piudc->pThis->ifUpDownCompleted(piudc->ctx, nExitCode);
-		piudc->pThis->SetIfUpDownInProgress(false);
-		piudc->pThis->SetIfUpDownPid(-1);
-		piudc->pThis->m_mutex.Unlock();
-		delete piudc;
-	}
-}
-
-void NetInterfaces::onIfDownCompleted(int nExitCode, void *pCtx)
-{
-	if(pCtx)
-	{
-		LPIF_UPDOWN_CONTEXT piudc = static_cast<LPIF_UPDOWN_CONTEXT>(pCtx);
-		piudc->pThis->m_mutex.Lock();
-		emit piudc->pThis->ifUpDownCompleted(piudc->ctx, nExitCode);
-		piudc->pThis->SetIfUpDownInProgress(false);
-		piudc->pThis->SetIfUpDownPid(-1);
-		piudc->pThis->m_mutex.Unlock();
-		delete piudc;
-	}
-}
-
-void NetInterfaces::onIfRestartCompleted(int nExitCode, void *pCtx)
-{
-	if(pCtx)
-	{
-		LPIF_UPDOWN_CONTEXT piudc = static_cast<LPIF_UPDOWN_CONTEXT>(pCtx);
-
-		if(piudc->ctx == UDC_Stop && !nExitCode) // ifdown succeeded
-		{
-			int nRet;
-			piudc->ctx = UDC_Start;
-
-			if((nRet = ::IfUpAsync(piudc->pi->getName(), piudc->pThis->m_ifUpDownPid, &NetInterfaces::onIfRestartCompleted, static_cast<void*>(piudc), &NetInterfaces::onIfUpDown, static_cast<void*>(piudc->pThis))))
-			{
-				piudc->pThis->m_mutex.Lock();
-				piudc->pThis->reportError("NetInterfaces::onIfRestartCompleted: IfUpAsync failed with code: %d", nRet);
-				emit piudc->pThis->ifUpDownCompleted(UDC_Restart, nRet);
-				piudc->pThis->SetIfUpDownPid(-1);
-				piudc->pThis->SetIfUpDownInProgress(false);
-				piudc->pThis->m_mutex.Unlock();
-				delete piudc;
-			}
-
-			return;
-		}
-
-		piudc->pThis->m_mutex.Lock();
-		emit piudc->pThis->ifUpDownCompleted(UDC_Restart, nExitCode);
-		piudc->pThis->SetIfUpDownPid(-1);
-		piudc->pThis->SetIfUpDownInProgress(false);
-		piudc->pThis->m_mutex.Unlock();
-		delete piudc;
-	}
-}
-
-bool NetInterfaces::startInterface(Interface *pi)
-{
-	if(!pi)
-	{
-		reportError("NetInterfaces::stopInterface: Invalid interface!");
-		return false;
-	}
-
-	int nRet;
-
-	if(!SetInterlockedIfUpDownInProgress())
-	{
-		reportError("NetInterfaces::startInterface: IfUp/Down already in progress!");
-		return false;
-	}
-
-	LPIF_UPDOWN_CONTEXT piudc = new IF_UPDOWN_CONTEXT;
-	piudc->pThis		= this;
-	piudc->pi			= pi;
-	piudc->ctx			= UDC_Start;
-
-	if((nRet = ::IfUpAsync(pi->getName(), m_ifUpDownPid, &NetInterfaces::onIfUpCompleted, static_cast<void*>(piudc), &NetInterfaces::onIfUpDown, static_cast<void*>(this))))
-	{
-		m_mutex.Lock();
-		reportError("NetInterfaces::startInterface: IfUpAsync failed with code: %d", nRet);
-		emit ifUpDownCompleted(UDC_Start, -3);
-		SetIfUpDownInProgress(false);
-		SetIfUpDownPid(-1);
-		m_mutex.Unlock();
-		delete piudc;
-		return false;
-	}
-
-	return true;
-}
-
-bool NetInterfaces::stopInterface(Interface *pi)
-{
-	if(!pi)
-	{
-		reportError("NetInterfaces::stopInterface: Invalid interface!");
-		return false;
-	}
-
-	int nRet;
-
-	if(!SetInterlockedIfUpDownInProgress())
-	{
-		reportError("NetInterfaces::stopInterface: IfUp/Down already in progress!");
-		return false;
-	}
-
-	LPIF_UPDOWN_CONTEXT piudc = new IF_UPDOWN_CONTEXT;
-	piudc->pThis		= this;
-	piudc->pi			= pi;
-	piudc->ctx			= UDC_Stop;
-
-	if((nRet = ::IfDownAsync(pi->getName(), m_ifUpDownPid, &NetInterfaces::onIfDownCompleted, static_cast<void*>(piudc), &NetInterfaces::onIfUpDown, static_cast<void*>(this))))
-	{
-		m_mutex.Lock();
-		reportError("NetInterfaces::stopInterface: IfDownAsync failed with code: %d", nRet);
-		emit ifUpDownCompleted(UDC_Stop, -3);
-		SetIfUpDownInProgress(false);
-		SetIfUpDownPid(-1);
-		m_mutex.Unlock();
-		delete piudc;
-		return false;
-	}
-
-	return true;
-}
-
-bool NetInterfaces::restartInterface(Interface *pi)
-{
-	if(!pi)
-	{
-		reportError("NetInterfaces::restartInterface: Invalid interface!");
-		return false;
-	}
-
-	int nRet;
-
-	if(!SetInterlockedIfUpDownInProgress())
-	{
-		reportError("NetInterfaces::restartInterface: IfUp/Down already in progress!");
-		return false;
-	}
-
-	LPIF_UPDOWN_CONTEXT piudc = new IF_UPDOWN_CONTEXT;
-	piudc->pThis		= this;
-	piudc->pi			= pi;
-	piudc->ctx			= UDC_Stop;
-
-	if((nRet = ::IfDownAsync(pi->getName(), m_ifUpDownPid, &NetInterfaces::onIfRestartCompleted, static_cast<void*>(piudc), &NetInterfaces::onIfUpDown, static_cast<void*>(this))))
-	{
-		m_mutex.Lock();
-		reportError("NetInterfaces::restartInterface: IfDownAsync failed with code: %d", nRet);
-		emit ifUpDownCompleted(UDC_Restart, -3);
-		SetIfUpDownInProgress(false);
-		SetIfUpDownPid(-1);
-		m_mutex.Unlock();
-		delete piudc;
-		return false;
-	}
-
-	return true;
-}
-
-bool NetInterfaces::cancelStartStopInterface(void)
-{
-	m_mutex.Lock();
-	pid_t pid = GetIfUpDownPid();
-	bool bCancel = GetIfUpDownInProgress() && (pid != -1);
-	if(bCancel)
-	{
-//		bCancel = !kill(-pid, SIGKILL);
-		bCancel = !system("killall -SIGTERM ifup");
-	}
-	m_mutex.Unlock();
-	return bCancel;
-}
-
-QQmlListProperty<Interface> NetInterfaces::interfaces(void)
-{
-	return QQmlListProperty<Interface>(this, m_interfaces);
-}
-
-QQmlListProperty<Interface> NetInterfaces::filteredInterfaces(void)
-{
-	m_filteredInterfaces.clear();
-
-    for(int i = 0; i < m_interfaces.count(); i++)
-	{
-        Interface *pi = m_interfaces.at(i);
-		const ITF_IFACE_BLOCK &ibl = pi->getIface();
-
-		if(	(m_itfFilterName.isNull() || m_itfFilterName.isEmpty() || (m_itfFilterName == ibl.cfgName.c_str())) &&
-			(_ENUM_TO_FLAG(ibl.proto) & m_itfFilterAF) &&
-			(_ENUM_TO_FLAG(ibl.method) & m_itfFilterMethod))
-		{
-			m_filteredInterfaces.append(pi);
-		}
-	}
-
-	return QQmlListProperty<Interface>(this, m_filteredInterfaces);
-}
-
-const QString& NetInterfaces::itfFilterName(void) const
-{
-	return m_itfFilterName;
-}
-
-void NetInterfaces::setItfFilterName(const QString &val)
-{
-	if(val != m_itfFilterName)
-	{
-		m_itfFilterName = val;
-		emit itfFilterNameChanged(m_itfFilterName);
-		emit filteredInterfacesChanged();
-	}
-
-}
-
-int NetInterfaces::itfFilterAF(void) const
-{
-	return m_itfFilterAF;
-}
-
-void NetInterfaces::setItfFilterAF(int af)
-{
-
-
-	if(af < Interface::AF_Unknown || af >= Interface::AF_Invalid)
-	{
-		reportError("Invalid address family filter: %d!", af);
-		return;
-	}
-
-	if(m_itfFilterAF != af)
-	{
-		m_itfFilterAF = af;
-		emit itfFilterAFChanged(af);
-		emit filteredInterfacesChanged();
-	}
-}
-
-int NetInterfaces::itfFilterMethod(void) const
-{
-	return m_itfFilterMethod;
-}
-
-void NetInterfaces::setItfFilterMethod(int method)
-{
-	if(method < Interface::IM_Unknown || method >= Interface::IM_Invalid)
-	{
-		reportError("Invalid method filter: %d!", method);
-		return;
-	}
-
-	if(m_itfFilterMethod != method)
-	{
-		m_itfFilterMethod = method;
-		emit itfFilterMethodChanged(method);
-		emit filteredInterfacesChanged();
-	}
-}
-
-int NetInterfaces::getInterfaceSelConfig(Interface &ri)
-{
-	int mask = 0;
-
-	::EnumInterfaceCfgGroups(m_eni, ri.getID(),
-		[] (CfgGroup cg, void *pCtx) -> void
-		{
-			if(cg > CG_Unknown)
-			{
-				int *m = (int*)pCtx;
-				*m |= _ENUM_TO_FLAG(cg);
-			}
-		}, &mask);
-
-	return mask;
-}
-
-bool NetInterfaces::ifUpDownInProgress(void) const
-{
-	return m_bIfUpDownInProgress;
-}
-
-/////////////////////////////////////////////////////////////////////////////
-
-Interface::Interface(ITF_IFACE_BLOCK &ifb, NotificationSink &notifyer, QObject *pParent) : 	QObject(pParent),
-																							m_ifb(ifb),
-																							m_inet(ifb, notifyer, this),
-																							m_rNotifyer(notifyer),
-																							m_selCfg(notifyer.getInterfaceSelConfig(*this))
-{
-	setObjectName("Interface");
-}
-
-Interface::~Interface(void)
-{
-}
-
-QString Interface::name(void) const
-{
-	return QString::fromStdString(m_ifb.cfgName);
-}
-
-QString Interface::afName(void) const
-{
-	return ::GetIfaceProtoStr(m_ifb.proto);
-}
-
-int Interface::af(void) const
-{
-	return (int)_ENUM_TO_FLAG(m_ifb.proto);
-}
-
-void Interface::setAf(int af)
-{
-	if(!_IsPowerOf2(af) || (af < Interface::AF_Unknown) || (af >= Interface::AF_Invalid))
-	{
-		m_rNotifyer.reportError("Invalid address family: %d!", af);
-		return;
-	}
-
-	IfaceProtos proto = (IfaceProtos)_FLAG_TO_ENUM(af);
-
-	if(m_ifb.proto != proto)
-	{
-		m_ifb.proto = proto;
-		emit afChanged(af);
-		emit afNameChanged();
-		m_rNotifyer.filterPropertyChanged();
-	}
-}
-
-QString Interface::methodName(void) const
-{
-	return ::GetIfaceMethodStr(m_ifb.method);
-}
-
-int Interface::method(void) const
-{
-	return (int)_ENUM_TO_FLAG(m_ifb.method);
-}
-
-void Interface::setMethod(int method)
-{
-	if(!_IsPowerOf2(method) || (method < Interface::IM_Unknown) || (method >= Interface::IM_Invalid))
-	{
-		m_rNotifyer.reportError("Invalid interface method: %d!", method);
-		return;
-	}
-
-	IfaceMethods meth = (IfaceMethods)_FLAG_TO_ENUM(method);
-
-	if(m_ifb.method != meth)
-	{
-		m_ifb.method = meth;
-		emit methodChanged(meth);
-		emit methodNameChanged();
-		m_rNotifyer.filterPropertyChanged();
-	}
-}
-
-int Interface::selCfg(void) const
-{
-	return m_selCfg;
-}
-
-void Interface::setSelCfg(int cfg)
-{
-	if(cfg < SC_None || cfg >= SC_Invalid)
-	{
-		m_rNotifyer.reportError("Invalid start/selection configuration: 0x%X!", cfg);
-		return;
-	}
-
-	if(m_selCfg != cfg)
-	{
-		m_rNotifyer.selConfigChanged(this, m_selCfg, cfg);
-		m_selCfg = cfg;
-		emit selCfgChanged(cfg);
-	}
-
-}
-
-Inet* Interface::inet(void)
-{
-	return &m_inet;
-}
-
-/////////////////////////////////////////////////////////////////////////////
-
-Inet::Inet(ITF_IFACE_BLOCK &ifb, NotificationSink &notifyer, QObject *pParent) :	QObject(pParent),
-																					m_static(ifb.inet4s, notifyer, this),
-																					m_dhcp(ifb.inet4d, notifyer, this),
-																					m_rNotifyer(notifyer)
-{
-	setObjectName("Inet");
-}
-
-Inet::~Inet(void)
-{
-}
-
-Static* Inet::stat(void)
-{
-	return &m_static;
-}
-
-Dhcp* Inet::dhcp(void)
-{
-	return &m_dhcp;
-}
-
-/////////////////////////////////////////////////////////////////////////////
-
-Static::Static(IFACE_INET_STATIC &itfs, NotificationSink &notifyer, QObject *pParent) :	QObject(pParent),
-																						m_itfs(itfs),
-																						m_rNotifyer(notifyer),
-																						m_ipAddr(itfs.addr, notifyer, this),
-																						m_netmask(itfs.netmask, notifyer, this, _IsValidNetmask),
-																						m_gateway(itfs.gate, notifyer, this),
-																						m_bcastAddr(itfs.bcast, notifyer, this),
-																						m_ptpAddr(itfs.pointopoint, notifyer, this)
-{
-	setObjectName("Static");
-	for(size_t i = 0; i < _countof(m_itfs.namesvr); i++)
-	{
-		IPv4Address *addr = new IPv4Address(m_itfs.namesvr[i], notifyer, this);
-		m_dnsList.append(addr);
-	}
-
-	QObject::connect(&m_netmask, SIGNAL(addressChanged(const QString&)), this, SLOT(netmaskChanged(const QString&)));
-}
-
-Static::~Static(void)
-{
-	IPv4Address *addr;
-
-    for(int i = 0; i < m_dnsList.count(); i++)
-    {
-        if((addr = m_dnsList.at(i)))
-        	delete addr;
-    }
-}
-
-IPv4Address* Static::ipAddress(void)
-{
-	return &m_ipAddr;
-}
-
-IPv4Address* Static::netMask(void)
-{
-	return &m_netmask;
-}
-
-IPv4Address* Static::gateway(void)
-{
-	return &m_gateway;
-}
-
-IPv4Address* Static::bcastAddress(void)
-{
-	return &m_bcastAddr;
-}
-
-IPv4Address* Static::ptpAddress(void)
-{
-	return &m_ptpAddr;
-}
-
-QQmlListProperty<IPv4Address> Static::dnsServer(void)
-{
-	return QQmlListProperty<IPv4Address>(this, m_dnsList);
-}
-
-int Static::metric(void) const
-{
-	return m_itfs.metric;
-}
-
-void Static::setMetric(int metric)
-{
-	if(m_itfs.metric != metric)
-	{
-		m_itfs.metric = metric;
-		emit metricChanged(metric);
-	}
-}
-
-int Static::mtu(void) const
-{
-	return m_itfs.mtu;
-}
-
-void Static::setMtu(int mtu)
-{
-	if(m_itfs.mtu != mtu)
-	{
-		m_itfs.mtu = mtu;
-		emit mtuChanged(mtu);
-	}
-}
-
-int Static::netPrefix(void) const
-{
-	return m_itfs.netprefix;
-}
-
-void Static::setNetPrefix(int netprefix)
-{
-	if(netprefix < 0 || netprefix > 32)
-	{
-		m_rNotifyer.reportError("Invalid net prefix: %d!", netprefix);
-		return;
-	}
-
-	if(m_itfs.netprefix != (unsigned int)netprefix)
-	{
-		struct in_addr in;
-		in.s_addr = _Prefix2Mask(netprefix);
-        m_netmask.setProperty("address", QVariant(inet_ntoa(in)));
-	}
-}
-
-void Static::netmaskChanged(const QString &mask)
-{
-	struct in_addr in;
-	std::string sa = mask.toStdString();
-
-	if(	inet_aton(sa.c_str(), &in) &&
-		_IsValidNetmask(in))
-	{
-		m_itfs.netprefix = _Mask2Prefix(in);
-		emit netPrefixChanged(m_itfs.netprefix);
-	}
-	else
-	{
-		m_rNotifyer.reportError("Invalid net mask: %s!", sa.c_str());
-        m_netmask.setProperty("address", QVariant("255.255.255.0"));
-	}
-}
-
-/////////////////////////////////////////////////////////////////////////////
-
-Dhcp::Dhcp(IFACE_INET_DHCP &itfd, NotificationSink &notifyer, QObject *pParent) : QObject(pParent), m_itfd(itfd), m_rNotifyer(notifyer)
-{
-	setObjectName("Dhcp");
-}
-
-Dhcp::~Dhcp(void)
-{
-}
-
-/////////////////////////////////////////////////////////////////////////////
-
-IPv4Address::IPv4Address(struct in_addr &addr, NotificationSink &notifyer, QObject *pParent, PFN_ADDRESS_VALIDATOR pfnAddrValidator) :	QObject(pParent),
-																																		m_addr(addr),
-																																		m_pfnAddrValidator(pfnAddrValidator),
-																																		m_rNotifyer(notifyer)
-{
-	setObjectName("IPv4Address");
-}
-
-IPv4Address::~IPv4Address(void)
-{
-}
-
-QString IPv4Address::address(void) const
-{
-	return inet_ntoa(m_addr);
-}
-
-int IPv4Address::b0(void) const
-{
-	unsigned char *pb = (unsigned char*)&m_addr.s_addr;
-	return (int)pb[0];
-}
-
-int IPv4Address::b1(void) const
-{
-	unsigned char *pb = (unsigned char*)&m_addr.s_addr;
-	return (int)pb[1];
-}
-
-int IPv4Address::b2(void) const
-{
-	unsigned char *pb = (unsigned char*)&m_addr.s_addr;
-	return (int)pb[2];
-}
-
-int IPv4Address::b3(void) const
-{
-	unsigned char *pb = (unsigned char*)&m_addr.s_addr;
-	return (int)pb[3];
-}
-
-void IPv4Address::setAddress(const QString &addr)
-{
-	struct in_addr newAddr, oldAddr;
-	std::string sa = addr.toStdString();
-
-	if(!inet_aton(sa.c_str(), &newAddr))
-	{
-		m_rNotifyer.reportError("Invalid IP address: '%s'!", sa.c_str());
-		return;
-	}
-
-	if(m_pfnAddrValidator && !(*m_pfnAddrValidator)(newAddr))
-	{
-		m_rNotifyer.reportError("Invalid address: '%s'!", sa.c_str());
-		return;
-	}
-
-	if(m_addr.s_addr != newAddr.s_addr)
-	{
-		oldAddr.s_addr = m_addr.s_addr;
-		m_addr.s_addr  = newAddr.s_addr;
-
-		unsigned char *pb1 = (unsigned char*)&oldAddr.s_addr;
-		unsigned char *pb2 = (unsigned char*)&newAddr.s_addr;
-		if(pb1[0] != pb2[0])
-			emit b0Changed(pb2[0]);
-		if(pb1[1] != pb2[1])
-			emit b1Changed(pb2[1]);
-		if(pb1[2] != pb2[2])
-			emit b2Changed(pb2[2]);
-		if(pb1[3] != pb2[3])
-			emit b3Changed(pb2[3]);
-		emit addressChanged(address());
-	}
-}
-
-void IPv4Address::setB0(int b)
-{
-	unsigned char *pb = (unsigned char*)&m_addr.s_addr;
-	if(!_IS_VALID_BYTE_VALUE(b))
-	{
-		m_rNotifyer.reportError("Invalid IP address byte 0: '%d'!", b);
-		return;
-	}
-	if(b == (int)pb[0])
-		return;
-	pb[0] = (unsigned char)b;
-	emit b0Changed(b);
-	emit addressChanged(address());
-}
-
-void IPv4Address::setB1(int b)
-{
-	unsigned char *pb = (unsigned char*)&m_addr.s_addr;
-	if(!_IS_VALID_BYTE_VALUE(b))
-	{
-		m_rNotifyer.reportError("Invalid IP address byte 1: '%d'!", b);
-		return;
-	}
-	if(b == (int)pb[1])
-		return;
-	pb[1] = (unsigned char)b;
-	emit b1Changed(b);
-	emit addressChanged(address());
-}
-
-void IPv4Address::setB2(int b)
-{
-	unsigned char *pb = (unsigned char*)&m_addr.s_addr;
-	if(!_IS_VALID_BYTE_VALUE(b))
-	{
-		m_rNotifyer.reportError("Invalid IP address byte 2: '%d'!", b);
-		return;
-	}
-	if(b == (int)pb[2])
-		return;
-	pb[2] = (unsigned char)b;
-	emit b2Changed(b);
-	emit addressChanged(address());
-}
-
-void IPv4Address::setB3(int b)
-{
-	unsigned char *pb = (unsigned char*)&m_addr.s_addr;
-	if(!_IS_VALID_BYTE_VALUE(b))
-	{
-		m_rNotifyer.reportError("Invalid IP address byte 3: '%d'!", b);
-		return;
-	}
-	if(b == (int)pb[3])
-		return;
-	pb[3] = (unsigned char)b;
-	emit b3Changed(b);
-	emit addressChanged(address());
-}

+ 0 - 367
libnetinterfaces/netinterfaces.h

@@ -1,367 +0,0 @@
-// netinterfaces.h :
-//
-
-#if !defined(AGD_NETINTERFACES_H__54DE87BE_1F3C_4914_A062_9CCFCB496122__INCLUDED_)
-#define AGD_NETINTERFACES_H__54DE87BE_1F3C_4914_A062_9CCFCB496122__INCLUDED_
-
-#include <vector>
-#include <QObject>
-#include <QList>
-#include <QQmlListProperty>
-#include <qqmlparserstatus.h>
-#include <gfa/mutex.h>
-#include <gfa/gfanet.h>
-
-/////////////////////////////////////////////////////////////////////////////
-// netinterfaces.h - Declarations:
-
-class Interface;
-
-class NotificationSink
-{
-public:
-	virtual void reportError(const char *pszFormatStr, ...)									= 0;
-	virtual void filterPropertyChanged(void) const											= 0;
-	virtual void selConfigChanged(Interface* pi, unsigned int cfgOld, unsigned int cfgNew)	= 0;
-	virtual int getInterfaceSelConfig(Interface &ri)										= 0;
-};
-
-/////////////////////////////////////////////////////////////////////////////
-
-typedef bool (*PFN_ADDRESS_VALIDATOR)(const struct in_addr &addr);
-
-class IPv4Address : public QObject
-{
-    Q_OBJECT
-    Q_PROPERTY(QString address READ address WRITE setAddress NOTIFY addressChanged)
-    Q_PROPERTY(int b0 READ b0 WRITE setB0 NOTIFY b0Changed)
-    Q_PROPERTY(int b1 READ b1 WRITE setB1 NOTIFY b1Changed)
-    Q_PROPERTY(int b2 READ b2 WRITE setB2 NOTIFY b2Changed)
-    Q_PROPERTY(int b3 READ b3 WRITE setB3 NOTIFY b3Changed)
-
-
-public:
-    explicit IPv4Address(struct in_addr &addr, NotificationSink &notifyer, QObject *pParent = 0, PFN_ADDRESS_VALIDATOR pfnAddrValidator = NULL);
-    virtual ~IPv4Address(void);
-
-private:
-    QString address(void) const;
-    int b0(void) const;
-    int b1(void) const;
-    int b2(void) const;
-    int b3(void) const;
-    
-    void setAddress(const QString &addr);
-    void setB0(int b);
-    void setB1(int b);
-    void setB2(int b);
-    void setB3(int b);
-
-signals:
-	void addressChanged(const QString&);
-	void b0Changed(int);
-	void b1Changed(int);
-	void b2Changed(int);
-	void b3Changed(int);
-
-private:
-	struct in_addr &m_addr;
-	PFN_ADDRESS_VALIDATOR m_pfnAddrValidator;
-	NotificationSink &m_rNotifyer;
-};
-
-/////////////////////////////////////////////////////////////////////////////
-
-class Static : public QObject
-{
-    Q_OBJECT
-    Q_PROPERTY(IPv4Address* ipAddress READ ipAddress CONSTANT)
-    Q_PROPERTY(IPv4Address* netMask READ netMask CONSTANT)
-    Q_PROPERTY(IPv4Address* gateway READ gateway CONSTANT)
-    Q_PROPERTY(IPv4Address* bcastAddress READ bcastAddress CONSTANT)
-    Q_PROPERTY(IPv4Address* ptpAddress READ ptpAddress CONSTANT)
-    Q_PROPERTY(QQmlListProperty<IPv4Address> dnsServer READ dnsServer CONSTANT)
-    Q_PROPERTY(int metric READ metric WRITE setMetric NOTIFY metricChanged)
-    Q_PROPERTY(int mtu READ mtu WRITE setMtu NOTIFY mtuChanged)
-    Q_PROPERTY(int netPrefix READ netPrefix WRITE setNetPrefix NOTIFY netPrefixChanged)
-
-public:
-    explicit Static(IFACE_INET_STATIC &itfs, NotificationSink &notifyer, QObject *pParent = 0);
-    virtual ~Static(void);
-
-private:
-    IPv4Address* ipAddress(void);
-    IPv4Address* netMask(void);
-    IPv4Address* gateway(void);
-    IPv4Address* bcastAddress(void);
-    IPv4Address* ptpAddress(void);
-    QQmlListProperty<IPv4Address> dnsServer(void);
-    int metric(void) const;
-    void setMetric(int metric);
-    int mtu(void) const;
-    void setMtu(int mtu);
-    int netPrefix(void) const;
-    void setNetPrefix(int netprefix);
-
-private slots:
-    void netmaskChanged(const QString&);
-
-signals:
-	void metricChanged(int metric);
-	void mtuChanged(int mtu);
-	void netPrefixChanged(unsigned int netprefix);
-
-private:
-	IFACE_INET_STATIC &m_itfs;
-	NotificationSink &m_rNotifyer;
-	IPv4Address m_ipAddr;
-	IPv4Address m_netmask;
-	IPv4Address m_gateway;
-	IPv4Address m_bcastAddr;
-	IPv4Address m_ptpAddr;
-	QList<IPv4Address*> m_dnsList;
-};
-
-/////////////////////////////////////////////////////////////////////////////
-
-class Dhcp : public QObject
-{
-    Q_OBJECT
-
-public:
-    explicit Dhcp(IFACE_INET_DHCP &itfd, NotificationSink &notifyer, QObject *pParent = 0);
-    virtual ~Dhcp(void);
-
-private:
-	IFACE_INET_DHCP &m_itfd;
-	NotificationSink &m_rNotifyer;
-};
-
-/////////////////////////////////////////////////////////////////////////////
-
-class Inet : public QObject
-{
-    Q_OBJECT
-    Q_PROPERTY(Static* stat READ stat CONSTANT)
-    Q_PROPERTY(Dhcp* dhcp READ dhcp CONSTANT)
-
-public:
-    explicit Inet(ITF_IFACE_BLOCK &ifb, NotificationSink &notifyer, QObject *pParent = 0);
-    virtual ~Inet(void);
-
-private:
-    Static* stat(void);
-    Dhcp* dhcp(void);
-
-private:
-    Static m_static;
-    Dhcp m_dhcp;
-	NotificationSink &m_rNotifyer;
-};
-
-/////////////////////////////////////////////////////////////////////////////
-
-class Interface : public QObject
-{
-    Q_OBJECT
-    Q_PROPERTY(QString name READ name CONSTANT)
-    Q_PROPERTY(QString afName READ afName NOTIFY afNameChanged)
-    Q_PROPERTY(int af READ af WRITE setAf NOTIFY afChanged)
-    Q_PROPERTY(QString methodName READ methodName NOTIFY methodNameChanged)
-    Q_PROPERTY(int method READ method WRITE setMethod NOTIFY methodChanged)
-    Q_PROPERTY(int selCfg READ selCfg WRITE setSelCfg NOTIFY selCfgChanged)
-    Q_PROPERTY(Inet* inet READ inet CONSTANT)
-
-public:
-    explicit Interface(ITF_IFACE_BLOCK &ifb, NotificationSink &notifyer, QObject *pParent = 0);
-    virtual ~Interface(void);
-
-    inline const ITF_IFACE_BLOCK & getIface(void) const {
-    	return m_ifb;}
-
-    inline ITF_IFACE_BLOCK & getIface(void){
-    	return m_ifb;}
-    
-    inline unsigned long getID(void) const {
-    	return m_ifb.id;}
-    
-    inline int getSelCfg(void) const {
-	    return m_selCfg;}
-    
-    inline const char * getName(void) const {
-	    return m_ifb.cfgName.c_str();}
-
-	enum AddressFamily
-	{
-		AF_Unknown	= 0,
-		AF_Inet		= 0x0001,
-		AF_Inet6	= 0x0002,
-		AF_Ipx		= 0x0004,
-		AF_Can		= 0x0008,
-		AF_Invalid	= 0x0010
-	};
-	Q_ENUMS(AddressFamily)
-
-	enum ItfMethod
-	{
-		IM_Unknown	= 0,
-		IM_Static	= 0x0001,
-		IM_Dhcp		= 0x0002,
-		IM_Manual	= 0x0004,
-		IM_BootP	= 0x0008,
-		IM_Tunnel	= 0x0010,
-		IM_Ppp		= 0x0020,
-		IM_WvDial	= 0x0040,
-		IM_IpV4ll	= 0x0080,
-		IM_Loopback	= 0x0100,
-		IM_Auto		= 0x0200,
-		IM_Invalid	= 0x0400
-	};
-	Q_ENUMS(ItfMethod)
-
-	enum SelConfig
-	{
-		SC_None			= 0,
-		SC_Auto			= 0x0001,
-		SC_AllowAuto	= 0x0002,
-		SC_AllowHotplug	= 0x0004,
-		SC_NoAutoDown	= 0x0008,
-		SC_NoScripts	= 0x0010,
-		SC_Invalid		= 0x0020
-	};
-	Q_ENUMS(SelConfig)
-
-private:
-    QString name(void) const;
-    QString afName(void) const;
-    int af(void) const;
-    void setAf(int af);
-    QString methodName(void) const;
-    int method(void) const;
-    void setMethod(int method);
-    int selCfg(void) const;
-    void setSelCfg(int cfg);
-    Inet* inet(void);
-
-signals:
-	void afNameChanged(void);
-	void afChanged(int af);
-	void methodNameChanged(void);
-	void methodChanged(int method);
-	void selCfgChanged(int cfg);
-
-private:
-	ITF_IFACE_BLOCK &m_ifb;
-	Inet m_inet;
-	NotificationSink &m_rNotifyer;
-	int m_selCfg;
-};
-
-/////////////////////////////////////////////////////////////////////////////
-
-class NetInterfaces;
-
-typedef struct _IF_UPDOWN_CONTEXT
-{
-	NetInterfaces *pThis;
-	Interface *pi;
-	int ctx;
-}IF_UPDOWN_CONTEXT, *LPIF_UPDOWN_CONTEXT;
-typedef const IF_UPDOWN_CONTEXT *LPCIF_UPDOWN_CONTEXT;
-
-class NetInterfaces : public QObject, public QQmlParserStatus, public NotificationSink
-{
-    Q_OBJECT
-    Q_INTERFACES(QQmlParserStatus)
-    Q_PROPERTY(QQmlListProperty<Interface> interfaces READ interfaces NOTIFY interfacesChanged)
-    Q_PROPERTY(QQmlListProperty<Interface> filteredInterfaces READ filteredInterfaces NOTIFY filteredInterfacesChanged)
-    Q_PROPERTY(QString itfFilterName READ itfFilterName WRITE setItfFilterName NOTIFY itfFilterNameChanged)
-    Q_PROPERTY(int itfFilterAF READ itfFilterAF WRITE setItfFilterAF NOTIFY itfFilterAFChanged)
-    Q_PROPERTY(int itfFilterMethod READ itfFilterMethod WRITE setItfFilterMethod NOTIFY itfFilterMethodChanged)
-    Q_PROPERTY(bool ifUpDownInProgress READ ifUpDownInProgress CONSTANT)
-
-public:
-    explicit NetInterfaces(QObject *pParent = 0);
-    virtual ~NetInterfaces(void);
-
-	enum IfUpDownCtx
-	{
-		UDC_Start,
-		UDC_Stop,
-		UDC_Restart
-	};
-	Q_ENUMS(IfUpDownCtx)
-
-public:
-	Q_INVOKABLE void reset(void);
-	Q_INVOKABLE bool initialize(void);
-	Q_INVOKABLE bool save(void);
-	Q_INVOKABLE bool saveAs(const QString &path);
-	Q_INVOKABLE Interface* newInterface(QString name, int af, int method);
-	Q_INVOKABLE void removeInterface(Interface *pi);
-	Q_INVOKABLE bool startInterface(Interface *pi);
-	Q_INVOKABLE bool stopInterface(Interface *pi);
-	Q_INVOKABLE bool restartInterface(Interface *pi);
-	Q_INVOKABLE bool cancelStartStopInterface(void);
-
-	virtual void classBegin();
-	virtual void componentComplete();
-	virtual void reportError(const char *pszFormatStr, ...);
-	virtual void filterPropertyChanged(void) const;
-	virtual void selConfigChanged(Interface* pi, unsigned int cfgOld, unsigned int cfgNew);
-	virtual int getInterfaceSelConfig(Interface &ri);
-	
-	inline pid_t GetIfUpDownPid(void) const {
-		return m_ifUpDownPid;}
-	
-	inline void SetIfUpDownPid(pid_t pid){
-		m_ifUpDownPid = pid;}
-	    
-	inline bool GetIfUpDownInProgress(void) const {
-		return m_bIfUpDownInProgress;}
-	    
-	inline void SetIfUpDownInProgress(bool bVal){
-		m_bIfUpDownInProgress = bVal;}
-	
-	bool SetInterlockedIfUpDownInProgress(void);
-
-signals:
-	void interfacesChanged(void) const;
-	void filteredInterfacesChanged(void) const;
-	void itfFilterNameChanged(const QString &val) const;
-	void itfFilterAFChanged(int af) const;
-	void itfFilterMethodChanged(int method) const;
-	void error(QString msg) const;
-	void ifUpDown(QString msg) const;
-	void ifUpDownCompleted(int ctx, int code) const;
-
-private:
-	QQmlListProperty<Interface> interfaces(void);
-	QQmlListProperty<Interface> filteredInterfaces(void);
-	const QString& itfFilterName(void) const;
-	void setItfFilterName(const QString &val);
-	int itfFilterAF(void) const;
-	void setItfFilterAF(int nval);
-	int itfFilterMethod(void) const;
-	void setItfFilterMethod(int method);
-	bool ifUpDownInProgress(void) const;
-
-    static void onIfUpDown(const char *pszMsg, void *pCtx);
-    static void onIfUpCompleted(int nExitCode, void *pCtx);
-    static void onIfDownCompleted(int nExitCode, void *pCtx);
-    static void onIfRestartCompleted(int nExitCode, void *pCtx);
-
-private:
-	ETC_NETWORK_INTERFACES m_eni;
-	QList<Interface*> m_interfaces;
-	QList<Interface*> m_filteredInterfaces;
-	QString m_itfFilterName;
-	int m_itfFilterAF;
-	int m_itfFilterMethod;
-	bool m_bIfUpDownInProgress;
-	pid_t m_ifUpDownPid;
-	CLocalMutex m_mutex;
-};
-
-/////////////////////////////////////////////////////////////////////////////
-#endif	//	!defined(AGD_NETINTERFACES_H__54DE87BE_1F3C_4914_A062_9CCFCB496122__INCLUDED_)

+ 0 - 14
libnetinterfaces/netinterfaces_plugin.cpp

@@ -1,14 +0,0 @@
-#include "netinterfaces_plugin.h"
-#include "netinterfaces.h"
-#include <qqml.h>
-
-void NetInterfacesPlugin::registerTypes(const char *uri)
-{
-    // gfa.plugins.qml.net
-    qmlRegisterType<NetInterfaces>(uri, 1, 0, "NetInterfaces");
-    qmlRegisterUncreatableType<Interface>(uri, 1, 0, "Interface", "return type only");
-    qmlRegisterUncreatableType<Inet>(uri, 1, 0, "Inet", "return type only");
-    qmlRegisterUncreatableType<Static>(uri, 1, 0, "Static", "return type only");
-    qmlRegisterUncreatableType<Dhcp>(uri, 1, 0, "Dhcp", "return type only");
-    qmlRegisterUncreatableType<IPv4Address>(uri, 1, 0, "IPv4Address", "return type only");
-}

+ 0 - 22
libnetinterfaces/netinterfaces_plugin.h

@@ -1,22 +0,0 @@
-// netinterfaces_plugin.h :
-//
-
-#if !defined(AGD_NETINTERFACES_PLUGIN_H__1F6C7511_8182_473A_8CCE_E196D6E20F69__INCLUDED_)
-#define AGD_NETINTERFACES_PLUGIN_H__1F6C7511_8182_473A_8CCE_E196D6E20F69__INCLUDED_
-
-#include <QQmlExtensionPlugin>
-
-/////////////////////////////////////////////////////////////////////////////
-// netinterfaces_plugin.h - Declarations:
-
-class NetInterfacesPlugin : public QQmlExtensionPlugin
-{
-    Q_OBJECT
-    Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
-
-public:
-    void registerTypes(const char *uri);
-};
-
-/////////////////////////////////////////////////////////////////////////////
-#endif	//	!defined(AGD_NETINTERFACES_PLUGIN_H__1F6C7511_8182_473A_8CCE_E196D6E20F69__INCLUDED_)

+ 0 - 4
libnetinterfaces/qmldir

@@ -1,4 +0,0 @@
-module gfa.plugins.qml.net
-plugin netinterfaces
-classname NetInterfaces
-typeinfo net.qmltypes

+ 1 - 1
src/inet4d.h

@@ -33,7 +33,7 @@ typedef struct _IFACE_INET_DHCP
 	int leasehours;			// Preferred lease time in hours
 	int leasetime;			// Preferred lease time in seconds
 	int metric;
-	std::string hostname;	// Hostname to be requested
+	std::string hostname;	// Requested Hostname
 	std::string vendor;		// Vendor class identifier (dhcpcd)
 	std::string client;		// Client identifier (dhcpcd)
 	std::string hwaddr;

+ 3 - 3
src/interfaces.cpp

@@ -178,7 +178,7 @@ IfaceHdrType ParseIfaceHeader(const std::vector<std::string> &v, ITF_IFACE_BLOCK
 			if(!v[i].compare("inherits"))
 			{
 				nInheritIdx = i;
-				ib.inheritedFrom = v[i + 1];
+				ib.inherits = v[i + 1];
 				break;
 			}
 		}
@@ -574,7 +574,7 @@ bool WriteEtcNetworkInterfaces(const ETC_NETWORK_INTERFACES &eni, const char *ps
 				line = 0;
 				const ITF_IFACE_BLOCK &ib = *iti;
 
-				if(!ib.inheritedFrom.empty())
+				if(!ib.inherits.empty())
 				{
 					fprintf(pf, "iface %s", ib.cfgName.c_str());
 					if(ib.proto != IFP_Unknown)
@@ -587,7 +587,7 @@ bool WriteEtcNetworkInterfaces(const ETC_NETWORK_INTERFACES &eni, const char *ps
 						fputc(' ', pf);
 						fputs(GetIfaceMethodStr(ib.method), pf);
 					}
-					fprintf(pf, " inherits %s\n", ib.inheritedFrom.c_str());
+					fprintf(pf, " inherits %s\n", ib.inherits.c_str());
 
 				}
 				else

+ 14 - 2
src/interfaces.h

@@ -151,7 +151,7 @@ typedef struct _ITF_IFACE_BLOCK
 		cfgName.clear();
 		proto = IFP_Unknown;
 		method = IFM_Unknown;
-		inheritedFrom.clear();
+		inherits.clear();
 		desc.clear();
 		cmds.clear();
 		unparsed.clear();
@@ -164,7 +164,7 @@ typedef struct _ITF_IFACE_BLOCK
 	std::string cfgName;
 	IfaceProtos proto;
 	IfaceMethods method;
-	std::string inheritedFrom;
+	std::string inherits;
 	std::string desc;
 	std::vector<IFACE_COMMAND> cmds;
 	std::vector<std::string> unparsed;
@@ -196,6 +196,10 @@ typedef struct _ITF_MAPPING_BLOCK
 	{
 		unparsed.clear();
 	}
+/*	void _copy(struct _ITF_MAPPING_BLOCK &target)
+	{
+		target.unparsed.assign(unparsed.begin(), unparsed.end());
+	}*/
 	std::vector<std::string> unparsed;
 }ITF_MAPPING_BLOCK, *LPITF_MAPPING_BLOCK;
 typedef const ITF_MAPPING_BLOCK *LPCITF_MAPPING_BLOCK;
@@ -216,6 +220,14 @@ typedef struct _ETC_NETWORK_INTERFACES
 		inc.clear();
 		unparsed.clear();
 	}
+/*	void _copy(struct _ETC_NETWORK_INTERFACES &target)
+	{
+		mbl._copy(target.mbl);
+		cgl._copy(target.cgl);
+		ibl._copy(target.ibl);
+		inc._copy(target.inc);
+		target.unparsed.assign(unparsed.begin(), unparsed.end());
+	}*/
 	ITF_MAPPING_BLOCK_LIST	mbl;
 	ITF_CONFIG_GROUP_LIST	cgl;
 	ITF_IFACE_BLOCK_LIST	ibl;