blob: 932f2880dc6381a383a1cdb396a97977320c8424 (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#pragma once
#include "udp_address.h"
#include "block_chain.h"
#include "net_request.h"
#include <util/generic/guid.h>
#include <util/system/hp_timer.h>
namespace NNetliba {
struct TIBConnectInfo {
TGUID SocketId;
ui64 Subnet, Interface;
int LID;
int QPN;
};
struct TRCQueuePairHandshake {
int QPN, PSN;
};
using TIBMsgHandle = i64;
struct TIBSendResult {
TIBMsgHandle Handle;
bool Success;
TIBSendResult()
: Handle(0)
, Success(false)
{
}
TIBSendResult(TIBMsgHandle handle, bool success)
: Handle(handle)
, Success(success)
{
}
};
struct IIBPeer: public TThrRefBase {
enum EState {
CONNECTING,
OK,
FAILED,
};
virtual EState GetState() = 0;
};
struct IIBClientServer: public TThrRefBase {
virtual TRequest* GetRequest() = 0;
virtual TIBMsgHandle Send(TPtrArg<IIBPeer> peer, TRopeDataPacket* data, const TGUID& packetGuid) = 0;
virtual bool GetSendResult(TIBSendResult* res) = 0;
virtual bool Step(NHPTimer::STime tCurrent) = 0;
virtual IIBPeer* ConnectPeer(const TIBConnectInfo& info, const TUdpAddress& peerAddr, const TUdpAddress& myAddr) = 0;
virtual const TIBConnectInfo& GetConnectInfo() = 0;
};
IIBClientServer* CreateIBClientServer();
}
|