diff options
author | akhropov <akhropov@yandex-team.ru> | 2022-02-10 16:46:32 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:32 +0300 |
commit | 00afc96e9c0298054b7386fa7fb9e3cc3d67b974 (patch) | |
tree | cb7a9f4a92c0d4cc5a86eeed49ad71e810953c1f /util/network/ip.h | |
parent | 83a8efcf3af051e3dd59c00d1d5dafc96412ec1e (diff) | |
download | ydb-00afc96e9c0298054b7386fa7fb9e3cc3d67b974.tar.gz |
Restoring authorship annotation for <akhropov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/network/ip.h')
-rw-r--r-- | util/network/ip.h | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/util/network/ip.h b/util/network/ip.h index dc7c2d24a0..7fd0b63ae1 100644 --- a/util/network/ip.h +++ b/util/network/ip.h @@ -14,28 +14,28 @@ using TIpHost = ui32; /// Port number in host format using TIpPort = ui16; -/* +/* * ipStr is in 'ddd.ddd.ddd.ddd' format * returns IPv4 address in inet format */ -static inline TIpHost IpFromString(const char* ipStr) { - in_addr ia; +static inline TIpHost IpFromString(const char* ipStr) { + in_addr ia; - if (inet_aton(ipStr, &ia) == 0) { + if (inet_aton(ipStr, &ia) == 0) { ythrow TSystemError() << "Failed to convert (" << ipStr << ") to ip address"; - } - - return (ui32)ia.s_addr; -} + } + return (ui32)ia.s_addr; +} + static inline char* IpToString(TIpHost ip, char* buf, size_t len) { if (!inet_ntop(AF_INET, (void*)&ip, buf, (socklen_t)len)) { ythrow TSystemError() << "Failed to get ip address string"; - } - + } + return buf; -} - +} + static inline TString IpToString(TIpHost ip) { char buf[INET_ADDRSTRLEN]; |