aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/coreconn.cpp
blob: d9411bb5db3d537fdb08beda401aacdf26c820bf (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
30
#include "coreconn.h"

#include "remote_connection.h"

#include <util/datetime/base.h>
#include <util/generic/yexception.h>
#include <util/network/socket.h>
#include <util/string/util.h>
#include <util/system/thread.h>

namespace NBus {
    TBusInstant Now() {
        return millisec();
    }

    EIpVersion MakeIpVersion(bool allowIpv4, bool allowIpv6) {
        if (allowIpv4) {
            if (allowIpv6) {
                return EIP_VERSION_ANY;
            } else {
                return EIP_VERSION_4;
            }
        } else if (allowIpv6) {
            return EIP_VERSION_6;
        }

        ythrow yexception() << "Neither of IPv4/IPv6 is allowed.";
    }

}