|
@@ -1731,15 +1731,68 @@ void CAccessAuthFSM::GetNetMsg(SpReqAnsContext<AccessAuthService_GetNetMsg_Req,
|
|
|
ctx->Ans.netStatus = 0; //失败
|
|
|
}
|
|
|
#else
|
|
|
- if (DetectNetworkLegality(tmp))
|
|
|
+ ErrorCodeEnum ec = Error_Succeed;
|
|
|
+ int netType = 0; //默认未知
|
|
|
+
|
|
|
+ CSimpleStringA tmpVendor(""), tmpDevSN(""), tmpDLLVersion("");
|
|
|
+ GetEntityBase()->GetFunction()->GetSysVar("FWBVendor", tmpVendor);
|
|
|
+ GetEntityBase()->GetFunction()->GetSysVar("FWBDevSN", tmpDevSN);
|
|
|
+ GetEntityBase()->GetFunction()->GetSysVar("FWBVersion", tmpDLLVersion);
|
|
|
+
|
|
|
+
|
|
|
+ if (tmpDLLVersion.GetLength() < 2)
|
|
|
+ tmpDLLVersion = "8.1";
|
|
|
+ if (tmpDevSN.GetLength() > 12 && tmpDevSN.IndexOf("FWB") > 2)
|
|
|
{
|
|
|
- ctx->Ans.netStatus = 1; //成功
|
|
|
+ Dbg("This is fwb device.");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- ctx->Ans.netStatus = 0; //失败
|
|
|
+ int i = 0;
|
|
|
+ int sockfd;
|
|
|
+ struct ifconf ifconf;
|
|
|
+ struct ifreq* ifreq;
|
|
|
+ char buf[1024];
|
|
|
+
|
|
|
+ //初始化ifconf
|
|
|
+ ifconf.ifc_len = 1024;
|
|
|
+ ifconf.ifc_buf = buf;
|
|
|
+
|
|
|
+ if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
|
|
|
+ {
|
|
|
+ perror("socket error");
|
|
|
+ exit(1);
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取所有接口信息
|
|
|
+ ioctl(sockfd, SIOCGIFCONF, &ifconf);
|
|
|
+
|
|
|
+ //逐个获取Ip地址
|
|
|
+ int size = ifconf.ifc_len / sizeof(struct ifreq);
|
|
|
+ ifreq = (struct ifreq*)buf;
|
|
|
+ string netName(ifreq->ifr_name);
|
|
|
+
|
|
|
+ if (size == 1 && netName == "lo") //只有逻辑地址 -- 网线被拔出
|
|
|
+ {
|
|
|
+ netType = 0;
|
|
|
+ tmp = "无网络";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ for (i = size; i > 0; i--)
|
|
|
+ {
|
|
|
+ string netName(ifreq->ifr_name); //有其他网卡 -- 有线
|
|
|
+ if (netName != "lo")
|
|
|
+ {
|
|
|
+ netType = 1;
|
|
|
+ tmp = "网络已连接";
|
|
|
+ }
|
|
|
+ ifreq++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ctx->Ans.netStatus = netType;
|
|
|
}
|
|
|
- Dbg("网络信息:%s.", tmp.GetData());
|
|
|
ctx->Ans.netMsg = tmp;
|
|
|
#endif // RVC_OS_WIN
|
|
|
ctx->Answer(Error_Succeed);
|