aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/socket_addr.h
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:15 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:15 +0300
commit72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch)
treeda2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /library/cpp/messagebus/socket_addr.h
parent778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff)
downloadydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/messagebus/socket_addr.h')
-rw-r--r--library/cpp/messagebus/socket_addr.h168
1 files changed, 84 insertions, 84 deletions
diff --git a/library/cpp/messagebus/socket_addr.h b/library/cpp/messagebus/socket_addr.h
index 959eafe689..e66735c458 100644
--- a/library/cpp/messagebus/socket_addr.h
+++ b/library/cpp/messagebus/socket_addr.h
@@ -13,90 +13,90 @@ namespace NBus {
class TNetAddr;
}
-namespace NBus {
- namespace NPrivate {
- enum EAddrFamily {
- ADDR_UNSPEC = AF_UNSPEC,
- ADDR_IPV4 = AF_INET,
- ADDR_IPV6 = AF_INET6,
- };
-
- class TBusIpAddr {
- private:
- EAddrFamily Af;
-
- union {
- in_addr In4;
- in6_addr In6;
- };
-
- public:
- TBusIpAddr() {
- Clear();
- }
-
- EAddrFamily GetAddrFamily() const {
- return Af;
- }
-
- void Clear() {
- Zero(*this);
- }
-
- in_addr GetInAddr() const {
- Y_ASSERT(Af == ADDR_IPV4);
- return In4;
- }
-
- void SetInAddr(const in_addr& in4) {
- Clear();
- Af = ADDR_IPV4;
- In4 = in4;
- }
-
- in6_addr GetIn6Addr() const {
- Y_ASSERT(Af == ADDR_IPV6);
- return In6;
- }
-
- void SetIn6Addr(const in6_addr& in6) {
- Clear();
- Af = ADDR_IPV6;
- In6 = in6;
- }
-
- bool operator==(const TBusIpAddr& that) const {
- return memcmp(this, &that, sizeof(that)) == 0;
- }
- };
-
- class TBusSocketAddr {
- public:
- TBusIpAddr IpAddr;
- ui16 Port;
-
- //Only makes sense for IPv6 link-local addresses
- ui32 IPv6ScopeID;
-
- TBusSocketAddr()
- : Port(0)
- , IPv6ScopeID(0)
- {
- }
-
- TBusSocketAddr(const NAddr::IRemoteAddr*);
- TBusSocketAddr(const TNetAddr&);
- TBusSocketAddr(TStringBuf host, unsigned port);
-
- TNetAddr ToNetAddr() const;
-
- bool operator==(const TBusSocketAddr& that) const {
- return IpAddr == that.IpAddr && Port == that.Port;
- }
- };
-
- }
-}
+namespace NBus {
+ namespace NPrivate {
+ enum EAddrFamily {
+ ADDR_UNSPEC = AF_UNSPEC,
+ ADDR_IPV4 = AF_INET,
+ ADDR_IPV6 = AF_INET6,
+ };
+
+ class TBusIpAddr {
+ private:
+ EAddrFamily Af;
+
+ union {
+ in_addr In4;
+ in6_addr In6;
+ };
+
+ public:
+ TBusIpAddr() {
+ Clear();
+ }
+
+ EAddrFamily GetAddrFamily() const {
+ return Af;
+ }
+
+ void Clear() {
+ Zero(*this);
+ }
+
+ in_addr GetInAddr() const {
+ Y_ASSERT(Af == ADDR_IPV4);
+ return In4;
+ }
+
+ void SetInAddr(const in_addr& in4) {
+ Clear();
+ Af = ADDR_IPV4;
+ In4 = in4;
+ }
+
+ in6_addr GetIn6Addr() const {
+ Y_ASSERT(Af == ADDR_IPV6);
+ return In6;
+ }
+
+ void SetIn6Addr(const in6_addr& in6) {
+ Clear();
+ Af = ADDR_IPV6;
+ In6 = in6;
+ }
+
+ bool operator==(const TBusIpAddr& that) const {
+ return memcmp(this, &that, sizeof(that)) == 0;
+ }
+ };
+
+ class TBusSocketAddr {
+ public:
+ TBusIpAddr IpAddr;
+ ui16 Port;
+
+ //Only makes sense for IPv6 link-local addresses
+ ui32 IPv6ScopeID;
+
+ TBusSocketAddr()
+ : Port(0)
+ , IPv6ScopeID(0)
+ {
+ }
+
+ TBusSocketAddr(const NAddr::IRemoteAddr*);
+ TBusSocketAddr(const TNetAddr&);
+ TBusSocketAddr(TStringBuf host, unsigned port);
+
+ TNetAddr ToNetAddr() const;
+
+ bool operator==(const TBusSocketAddr& that) const {
+ return IpAddr == that.IpAddr && Port == that.Port;
+ }
+ };
+
+ }
+}
template <>
struct THash<NBus::NPrivate::TBusIpAddr> {