aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/actors/interconnect/interconnect_address.h
blob: e9e0faec8146f182400006cabb8b6152a1e3acbb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#pragma once

#include <util/system/defaults.h>
#include <util/network/init.h>
#include <util/network/address.h>
#include <util/generic/string.h>

namespace NInterconnect {
    class TAddress {
        union {
            sockaddr Generic;
            sockaddr_in Ipv4;
            sockaddr_in6 Ipv6;
        } Addr;

    public:
        TAddress();
        TAddress(const char* addr, ui16 port);
        TAddress(const TString& addr, ui16 port);
        TAddress(NAddr::IRemoteAddr& addr);
        int GetFamily() const;
        socklen_t Size() const;
        ::sockaddr* SockAddr();
        const ::sockaddr* SockAddr() const;
        ui16 GetPort() const;
        TString GetAddress() const;
        TString ToString() const;
    };
}