Lines Matching defs:strIp

36 bool DhcpFunction::Ip4StrConToInt(const std::string& strIp, uint32_t& uIp, bool bHost)
38 if (strIp.empty()) {
39 DHCP_LOGE("Ip4StrConToInt error, strIp is empty()!");
44 int nRet = inet_pton(AF_INET, strIp.c_str(), &addr4);
46 DHCP_LOGE("Ip4StrConToInt strIp:%{private}s failed, nRet:%{public}d!", strIp.c_str(), nRet);
48 DHCP_LOGE("Ip4StrConToInt strIp:%{private}s not in presentation format!", strIp.c_str());
50 DHCP_LOGE("Ip4StrConToInt strIp:%{private}s inet_pton not contain a valid address!", strIp.c_str());
74 std::string strIp = "";
78 strIp = bufIp4;
79 DHCP_LOGI("Ip4IntConvertToStr uIp:%{private}u -> strIp:%{private}s.", uIp, strIp.c_str());
82 return strIp;
85 bool DhcpFunction::Ip6StrConToChar(const std::string& strIp, uint8_t chIp[], size_t uSize)
87 if (strIp.empty()) {
88 DHCP_LOGE("Ip6StrConToChar param error, strIp is empty()!");
96 int nRet = inet_pton(AF_INET6, strIp.c_str(), &addr6);
98 DHCP_LOGE("Ip6StrConToChar inet_pton strIp:%{private}s failed, nRet:%{public}d!", strIp.c_str(), nRet);
100 DHCP_LOGE("Ip6StrConToChar strIp:%{private}s not in presentation format!", strIp.c_str());
102 DHCP_LOGE("Ip6StrConToChar strIp:%{private}s inet_pton not contain a valid address!", strIp.c_str());
121 std::string strIp = "";
130 strIp = bufIp6;
131 DHCP_LOGI("Ip6CharConToStr chIp -> strIp:%{private}s.", strIp.c_str());
134 return strIp;
137 bool DhcpFunction::CheckIpStr(const std::string& strIp)
139 if (strIp.empty()) {
140 DHCP_LOGE("CheckIpStr param error, strIp is empty()!");
146 std::string::size_type idx = strIp.find(IP4_SEPARATOR);
150 idx = strIp.find(IP6_SEPARATOR);
155 DHCP_LOGE("CheckIpStr strIp:%{private}s error, bIp4:%{public}d,bIp6:%{public}d!", strIp.c_str(), bIp4, bIp6);
161 if (!Ip4StrConToInt(strIp, uIp)) {
162 DHCP_LOGE("CheckIpStr Ip4StrConToInt failed, strIp:%{private}s.", strIp.c_str());
167 if (!Ip6StrConToChar(strIp, addr6, sizeof(struct in6_addr))) {
168 DHCP_LOGE("CheckIpStr Ip6StrConToChar failed, strIp:%{private}s.", strIp.c_str());
176 int DhcpFunction::GetLocalIp(const std::string strInf, std::string& strIp, std::string& strMask)
209 strIp = bufIp4;
278 std::string strIp, strMask;
279 if (GetLocalIp(strInf, strIp, strMask) != DHCP_OPT_SUCCESS) {
285 if (!Ip4StrConToInt(strIp, uIp, false) || !Ip4StrConToInt(strMask, uMask, false) ||
292 DHCP_LOGE("Check %{public}s %{private}s %{public}s failed", strInf.c_str(), strIp.c_str(), strBegin.c_str());
296 DHCP_LOGE("Check end %{public}s %{private}s %{public}s failed", strInf.c_str(), strIp.c_str(), strEnd.c_str());