5#include "CoreMinimal.h"
6#include "OnlineSubsystemTypes.h"
7#include "OnlineDelegateMacros.h"
8#include "Misc/ConfigCacheIni.h"
9#if ENGINE_MAJOR_VERSION >= 5
10#include "Online/LANBeacon.h"
13#define PIXOVR_BEACON_PACKET_VERSION (uint8)10
14#define PIXOVR_BEACON_PACKET_HEADER_SIZE 16
15#define PIXOVR_SERVER_QUERY1 (uint8)'S'
16#define PIXOVR_SERVER_QUERY2 (uint8)'Q'
17#define PIXOVR_SERVER_RESPONSE1 (uint8)'S'
18#define PIXOVR_SERVER_RESPONSE2 (uint8)'R'
21class FNboSerializeToBuffer;
57 bool IsListenSocketValid()
const;
66 bool Init(int32 Port);
75 bool InitHost(int32 Port);
86 bool InitClient(int32 IP, int32 Port, int32 ListenPort);
97 int32 ReceivePacket(uint8* PacketData, int32 BufferSize);
105 bool BroadcastPacket(uint8* Packet, int32 Length);
113 bool BroadcastPacketFromSocket(uint8* Packet, int32 Length);
118#define PIXOVR_ANNOUNCE_PORT 14001
119#define PIXOVR_UNIQUE_ID 9999
120#define PIXOVR_QUERY_TIMEOUT 5
121#define PIXOVR_PLATFORMMASK 0xffffffff
138 bool IsValidLanQueryPacket(
const uint8* Packet, uint32 Length, uint64& ClientNonce);
148 bool IsValidLanResponsePacket(
const uint8* Packet, uint32 Length);
190 LanBeaconState(ELanBeaconState::NotUsingLanBeacon),
192 LanQueryTimeLeft(0.0f)
194 if (!GConfig->GetInt(TEXT(
"LANSession"), TEXT(
"LanAnnouncePort"), LanAnnouncePort, GEngineIni))
198 if (!GConfig->GetInt(TEXT(
"LANSession"), TEXT(
"LanGameUniqueId"), LanGameUniqueId, GEngineIni))
231 void StopLANSession();
233 void Tick(
float DeltaTime);
236 void CreateHostResponsePacket(FNboSerializeToBuffer& Packet, uint64 ClientNonce);
237 void CreateClientQueryPacket(FNboSerializeToBuffer& Packet, uint64 ClientNonce);
245 bool BroadcastPacket(uint8* Packet, int32 Length);
253 bool BroadcastPacketFromSocket(uint8* Packet, int32 Length);
257 return LanBeaconState;
#define PIXOVR_QUERY_TIMEOUT
#define PIXOVR_PLATFORMMASK
DECLARE_MULTICAST_DELEGATE_ThreeParams(FOnValidQueryPacket, uint8 *, int32, uint64)
FOnValidResponsePacket::FDelegate FOnValidResponsePacketDelegate
FOnPortChanged::FDelegate FOnPortChangedDelegate
#define PIXOVR_ANNOUNCE_PORT
DECLARE_MULTICAST_DELEGATE_TwoParams(FOnValidResponsePacket, uint8 *, int32)
DECLARE_MULTICAST_DELEGATE_OneParam(FOnPortChanged, int32)
FOnSearchingTimeout::FDelegate FOnSearchingTimeoutDelegate
FOnValidQueryPacket::FDelegate FOnValidQueryPacketDelegate
DECLARE_MULTICAST_DELEGATE(FOnSearchingTimeout)
TSharedRef< class FInternetAddr > SockAddr
TSharedPtr< class FInternetAddr > BroadcastAddr
class FSocket * ListenSocket
TSharedPtr< class FInternetAddr > ListenAddr
DEFINE_ONLINE_DELEGATE_ONE_PARAM(OnPortChanged, int32)
ELanBeaconState::Type LanBeaconState
ELanBeaconState::Type GetBeaconState() const
DEFINE_ONLINE_DELEGATE_THREE_PARAM(OnValidQueryPacket, uint8 *, int32, uint64)
DEFINE_ONLINE_DELEGATE_TWO_PARAM(OnValidResponsePacket, uint8 *, int32)
class FPVROBeacon * LanBeacon
DEFINE_ONLINE_DELEGATE(OnSearchingTimeout)
int32 LanPacketPlatformMask