aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/network.h
blob: cc4bd76ea31040fdfd43ab393a53feb5bfd45b33 (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
#pragma once

#include "netaddr.h"

#include <util/generic/array_ref.h>
#include <util/generic/ptr.h>
#include <util/network/socket.h>

#include <utility>

namespace NBus {
    namespace NPrivate {
        void SetSockOptTcpCork(SOCKET s, bool value);

        [[nodiscard]] ssize_t SocketSend(SOCKET s, TArrayRef<const char> data);

        [[nodiscard]] ssize_t SocketRecv(SOCKET s, TArrayRef<char> buffer);

    }

    struct TBindResult {
        TSimpleSharedPtr<TSocketHolder> Socket;
        TNetAddr Addr;
    };

    std::pair<unsigned, TVector<TBindResult>> BindOnPort(int port, bool reusePort);

}