add ads username and password

This commit is contained in:
zhouhuang 2024-12-24 11:37:05 +08:00
parent 9b6cc13e00
commit 59e136d3b3
4 changed files with 17 additions and 1 deletions

View File

@ -1387,6 +1387,15 @@ BOOLEAN CRYDevice::processRyADSParam(const Json::Value jsonRoot, int pid)
vLog(LOG_ERROR, "inet_pton error(%d,%s).\n", errno, strerror(errno)); vLog(LOG_ERROR, "inet_pton error(%d,%s).\n", errno, strerror(errno));
} }
} }
//ads添加路由的用户名密码
//用户名
if (jsonRoot["adsUser"].isString()) {
config_config.processes[pid].option.ryads.user = atoi(jsonRoot["adsUser"].asCString());
}
//密码
if (jsonRoot["adsPassword"].isString()) {
config_config.processes[pid].option.ryads.password = atoi(jsonRoot["adsPassword"].asCString());
}
return TRUE; return TRUE;
} }

View File

@ -883,6 +883,9 @@ BOOLEAN CHostADSBFProcess::OnPreCreate(int id)
//目标端口 //目标端口
m_remotePort = m_nOptions.net.target_port; m_remotePort = m_nOptions.net.target_port;
m_user = std::string(m_nOptions.user);
m_password = std::string(m_nOptions.password);
m_bHaveFTP = m_nOptions.bHaveFTP; m_bHaveFTP = m_nOptions.bHaveFTP;
calc(); calc();
@ -974,7 +977,7 @@ BOOLEAN CHostADSBFProcess::OnTimer(void)
//先添加一条路由 //先添加一条路由
if (m_bRouteAdded == FALSE) if (m_bRouteAdded == FALSE)
{ {
long ret = AddRemoteRoute(m_remoteIp, AmsNetId(m_localNetId), m_localIp, std::string("isoftstone"), std::string("admin"), std::string("admin")); long ret = AddRemoteRoute(m_remoteIp, AmsNetId(m_localNetId), m_localIp, std::string("isoftstone"), m_user, m_password);
vLog(LOG_DEBUG, "%s add route(%s to %s) return value is: %d\n", m_pidName.c_str(), m_localIp.c_str(), m_remoteIp.c_str(), ret); vLog(LOG_DEBUG, "%s add route(%s to %s) return value is: %d\n", m_pidName.c_str(), m_localIp.c_str(), m_remoteIp.c_str(), ret);
if (ret != 0) return TRUE; if (ret != 0) return TRUE;
} }

View File

@ -43,6 +43,8 @@ private:
std::string m_localNetId; //本机IP地址 std::string m_localNetId; //本机IP地址
std::string m_remoteIp; //PLC设备ip地址 std::string m_remoteIp; //PLC设备ip地址
std::string m_remoteNetId; std::string m_remoteNetId;
std::string m_user;
std::string m_password;
AdsDevice *m_turbine; AdsDevice *m_turbine;
BOOLEAN m_bRouteAdded; //路由是否添加成功 BOOLEAN m_bRouteAdded; //路由是否添加成功

View File

@ -626,6 +626,8 @@ typedef struct
struNetWorkOption net; struNetWorkOption net;
BOOLEAN bHaveFTP; BOOLEAN bHaveFTP;
struFTPOption ftp; struFTPOption ftp;
char user[64];
char password[64];
} struRYADSOption; } struRYADSOption;
typedef struct typedef struct