调整及增加接口记录IP信息

This commit is contained in:
zhangyuanyuan1 2023-02-08 17:03:21 +08:00
parent 7010120c2d
commit 864bcd06a3
3 changed files with 18 additions and 15 deletions

View File

@ -69,7 +69,7 @@ int KyConnectSetting::setIpConfigType(KyIpAddressType ipType, KyIpConfigType ipC
return 0;
}
void KyConnectSetting::ipv4AddressConstruct(QString &ipv4Address, QString &ipv4NetMask, QString &ipv4GateWay, QStringList &ipv4Dns)
void KyConnectSetting::ipv4AddressConstruct(QString &ipv4Address, QString &ipv4NetMask, QString &ipv4GateWay)
{
qDebug()<<"ipv4 address"<<ipv4Address << ipv4NetMask << ipv4GateWay;
NetworkManager::IpAddress nmIpv4Address;
@ -79,15 +79,9 @@ void KyConnectSetting::ipv4AddressConstruct(QString &ipv4Address, QString &ipv4N
m_ipv4Address.clear();
m_ipv4Address << nmIpv4Address;
m_ipv4Dns.clear();
for (int index = 0; index < ipv4Dns.size(); ++index) {
qDebug()<<"dns"<<ipv4Dns[index];
m_ipv4Dns << QHostAddress(ipv4Dns[index]);
}
return ;
}
void KyConnectSetting::ipv6AddressConstruct(QString &ipv6Address, QString &ipv6NetMask, QString &ipv6GateWay, QStringList &ipv6Dns)
void KyConnectSetting::ipv6AddressConstruct(QString &ipv6Address, QString &ipv6NetMask, QString &ipv6GateWay)
{
NetworkManager::IpAddress nmIpv6Address;
nmIpv6Address.setIp(QHostAddress(ipv6Address));
@ -96,11 +90,6 @@ void KyConnectSetting::ipv6AddressConstruct(QString &ipv6Address, QString &ipv6N
m_ipv6Address.clear();
m_ipv6Address << nmIpv6Address;
m_ipv6Dns.clear();
for (int index = 0; index < ipv6Dns.size(); index++) {
m_ipv6Dns << QHostAddress(ipv6Dns[index]);
}
return ;
}
@ -131,3 +120,13 @@ void KyConnectSetting::dumpInfo()
qDebug()<<"ipv6 dns" << m_ipv6Dns.at(index).toString();
}
}
void KyConnectSetting::ipv4DnsConstruct(QList<QHostAddress> &ipv4DnsList)
{
m_ipv4Dns = ipv4DnsList;
}
void KyConnectSetting::ipv6DnsConstruct(QList<QHostAddress> &ipv6DnsList)
{
m_ipv6Dns = ipv6DnsList;
}

View File

@ -50,8 +50,10 @@ public:
void setIfaceName(QString &ifaceName);
void setConnectName(QString &connectName);
int setIpConfigType(KyIpAddressType ipType, KyIpConfigType configType);
void ipv4AddressConstruct(QString &ipv4Address, QString &ipv4NetMask, QString &ipv4GateWay, QStringList &ipv4Dns);
void ipv6AddressConstruct(QString &ipv6Address, QString &ipv6NetMask, QString &ipv6GateWay, QStringList &ipv6Dns);
void ipv4AddressConstruct(QString &ipv4Address, QString &ipv4NetMask, QString &ipv4GateWay);
void ipv6AddressConstruct(QString &ipv6Address, QString &ipv6NetMask, QString &ipv6GateWay);
void ipv4DnsConstruct(QList<QHostAddress> &ipv4DnsList);
void ipv6DnsConstruct(QList<QHostAddress> &ipv6DnsList);
void dumpInfo();
public:

View File

@ -19,6 +19,7 @@ void KyNetResource::getIpv4ConnectSetting(
{
if (NetworkManager::Ipv4Setting::Automatic == ipv4Setting->method()) {
connectSetting.m_ipv4ConfigIpType = CONFIG_IP_DHCP;
connectSetting.m_ipv4Dns = ipv4Setting->dns();
return;
}
@ -35,6 +36,7 @@ void KyNetResource::getIpv6ConnectSetting(
if (NetworkManager::Ipv6Setting::Automatic == ipv6Setting->method()) {
connectSetting.m_ipv6ConfigIpType = CONFIG_IP_DHCP;
connectSetting.m_ipv6Dns = ipv6Setting->dns();
return;
}