|
@@ -33,14 +33,6 @@ void NetInterfaces::componentComplete()
|
|
|
|
|
|
void NetInterfaces::reset(void)
|
|
void NetInterfaces::reset(void)
|
|
{
|
|
{
|
|
-/* for(auto it = m_itfList.begin(); it != m_itfList.end(); it++)
|
|
|
|
- {
|
|
|
|
- Interface *pi = *it;
|
|
|
|
- delete pi;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- m_itfList.clear();*/
|
|
|
|
-
|
|
|
|
Interface *pItf;
|
|
Interface *pItf;
|
|
|
|
|
|
for(int i = 0; i < m_interfaces.count(); i++)
|
|
for(int i = 0; i < m_interfaces.count(); i++)
|
|
@@ -65,7 +57,6 @@ bool NetInterfaces::initialize(void)
|
|
{
|
|
{
|
|
ITF_IFACE_BLOCK &ibl = *it;
|
|
ITF_IFACE_BLOCK &ibl = *it;
|
|
m_interfaces.append(new Interface(ibl, static_cast<const Emitter&>(*this), this));
|
|
m_interfaces.append(new Interface(ibl, static_cast<const Emitter&>(*this), this));
|
|
-// m_itfList.push_back(new Interface(ibl, static_cast<const Emitter&>(*this), this));
|
|
|
|
}
|
|
}
|
|
|
|
|
|
emit interfaces_Changed();
|
|
emit interfaces_Changed();
|
|
@@ -104,11 +95,9 @@ QVariantList NetInterfaces::getInterface(const QString &itfName)
|
|
|
|
|
|
if(m_eni.ibl.size() > 0)
|
|
if(m_eni.ibl.size() > 0)
|
|
{
|
|
{
|
|
-// for(auto it = m_itfList.begin(); it != m_itfList.end(); it++)
|
|
|
|
for(int i = 0; i < m_interfaces.count(); i++)
|
|
for(int i = 0; i < m_interfaces.count(); i++)
|
|
{
|
|
{
|
|
Interface *pi = m_interfaces.at(i);
|
|
Interface *pi = m_interfaces.at(i);
|
|
-// Interface *pi = *it;
|
|
|
|
const ITF_IFACE_BLOCK &ibl = pi->getIface();
|
|
const ITF_IFACE_BLOCK &ibl = pi->getIface();
|
|
|
|
|
|
if( itfName == ibl.cfgName.c_str() &&
|
|
if( itfName == ibl.cfgName.c_str() &&
|
|
@@ -135,8 +124,6 @@ QVariant NetInterfaces::newInterface(QString name, int af, int method, QString c
|
|
|
|
|
|
m_interfaces.append(pi);
|
|
m_interfaces.append(pi);
|
|
emit interfaces_Changed();
|
|
emit interfaces_Changed();
|
|
-
|
|
|
|
-// m_itfList.push_back(pi);
|
|
|
|
return QVariant::fromValue(pi);
|
|
return QVariant::fromValue(pi);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -232,7 +219,6 @@ Interface::Interface(ITF_IFACE_BLOCK &ifb, const Emitter &errHandler, QObject *p
|
|
m_bcastAddr(ifb.inet4s.bcast, errHandler, this),
|
|
m_bcastAddr(ifb.inet4s.bcast, errHandler, this),
|
|
m_ptpAddr(ifb.inet4s.pointopoint, errHandler, this),
|
|
m_ptpAddr(ifb.inet4s.pointopoint, errHandler, this),
|
|
m_errHandler(errHandler)
|
|
m_errHandler(errHandler)
|
|
- /*, m_dnsSvr(ifb.inet4s.namesvr)*/
|
|
|
|
{
|
|
{
|
|
setObjectName("Interface");
|
|
setObjectName("Interface");
|
|
for(size_t i = 0; i < _countof(m_ifb.inet4s.namesvr); i++)
|
|
for(size_t i = 0; i < _countof(m_ifb.inet4s.namesvr); i++)
|
|
@@ -296,10 +282,6 @@ int Interface::itfMethod(void) const
|
|
IPv4Address* Interface::ipAddress(void)
|
|
IPv4Address* Interface::ipAddress(void)
|
|
{
|
|
{
|
|
return &m_ipAddr;
|
|
return &m_ipAddr;
|
|
-// if(m_ifb.proto == IFP_Inet && m_ifb.method == IFM_Static)
|
|
|
|
-// return inet_ntoa(m_ifb.inet4s.addr);
|
|
|
|
-// else
|
|
|
|
-// return "";
|
|
|
|
}
|
|
}
|
|
|
|
|
|
IPv4Address* Interface::netMask(void)
|
|
IPv4Address* Interface::netMask(void)
|
|
@@ -322,33 +304,11 @@ IPv4Address* Interface::ptpAddress(void)
|
|
return &m_ptpAddr;
|
|
return &m_ptpAddr;
|
|
}
|
|
}
|
|
|
|
|
|
-#if 0
|
|
|
|
-QStringList Interface::dnsServers(void) const
|
|
|
|
-{
|
|
|
|
- return m_dnsList;
|
|
|
|
-}
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
QQmlListProperty<IPv4Address> Interface::dnsServer(void)
|
|
QQmlListProperty<IPv4Address> Interface::dnsServer(void)
|
|
{
|
|
{
|
|
return QQmlListProperty<IPv4Address>(this, m_dnsList);
|
|
return QQmlListProperty<IPv4Address>(this, m_dnsList);
|
|
}
|
|
}
|
|
|
|
|
|
-/*QString Interface::dns1(void) const
|
|
|
|
-{
|
|
|
|
- return inet_ntoa(m_ifb.inet4s.namesvr[0]);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-QString Interface::dns2(void) const
|
|
|
|
-{
|
|
|
|
- return inet_ntoa(m_ifb.inet4s.namesvr[1]);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-QString Interface::dns3(void) const
|
|
|
|
-{
|
|
|
|
- return inet_ntoa(m_ifb.inet4s.namesvr[2]);
|
|
|
|
-}*/
|
|
|
|
-
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
IPv4Address::IPv4Address(struct in_addr &addr, const Emitter &errHandler, QObject *pParent) : QObject(pParent), m_addr(addr), m_errHandler(errHandler)
|
|
IPv4Address::IPv4Address(struct in_addr &addr, const Emitter &errHandler, QObject *pParent) : QObject(pParent), m_addr(addr), m_errHandler(errHandler)
|
|
@@ -478,15 +438,3 @@ void IPv4Address::set_b3(int b)
|
|
emit b3_Changed(b);
|
|
emit b3_Changed(b);
|
|
emit address_Changed(address());
|
|
emit address_Changed(address());
|
|
}
|
|
}
|
|
-
|
|
|
|
-/////////////////////////////////////////////////////////////////////////////
|
|
|
|
-
|
|
|
|
-#if 0
|
|
|
|
-Nameservers::Nameservers(struct in_addr (&namesvr)[3], QObject *pParent) : QObject(pParent), m_dnsSvr(namesvr)
|
|
|
|
-{
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-Nameservers::~Nameservers(void)
|
|
|
|
-{
|
|
|
|
-}
|
|
|
|
-#endif
|
|
|