MCPcopy Create free account
hub / github.com/catboost/catboost / IpFromString

Function IpFromString

util/network/ip.h:21–29  ·  view source on GitHub ↗

* ipStr is in 'ddd.ddd.ddd.ddd' format * returns IPv4 address in inet format */

Source from the content-addressed store, hash-verified

19 * returns IPv4 address in inet format
20 */
21static inline TIpHost IpFromString(const char* ipStr) {
22 in_addr ia;
23
24 if (inet_aton(ipStr, &ia) == 0) {
25 ythrow TSystemError() << "Failed to convert (" << ipStr << ") to ip address";
26 }
27
28 return (ui32)ia.s_addr;
29}
30
31static inline char* IpToString(TIpHost ip, char* buf, size_t len) {
32 if (!inet_ntop(AF_INET, (void*)&ip, buf, (socklen_t)len)) {

Callers 9

TestIpFromStringMethod · 0.85
TestIpFromString2Method · 0.85
TestIpFromString3Method · 0.85
TestIpFromString4Method · 0.85
TestIpFromString5Method · 0.85
SetMethod · 0.85
TSockAddrInetMethod · 0.85
Y_UNIT_TESTFunction · 0.85
Ip4Or6FromStringFunction · 0.85

Calls 1

inet_atonFunction · 0.85

Tested by 5

TestIpFromStringMethod · 0.68
TestIpFromString2Method · 0.68
TestIpFromString3Method · 0.68
TestIpFromString4Method · 0.68
TestIpFromString5Method · 0.68