diff options
author | bunnei <bunneidev@gmail.com> | 2022-10-01 23:53:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-01 23:53:36 +0200 |
commit | 2a752bbd646aefaedd5b2aa334710a48bb6fe907 (patch) | |
tree | 4513e36fa60db1ec1cdcef500088194030e61c83 /src/network/room_member.h | |
parent | Merge pull request #9009 from yuzu-emu/bunnei-move-deploy-linux.sh (diff) | |
parent | Address some review comments (diff) | |
download | yuzu-2a752bbd646aefaedd5b2aa334710a48bb6fe907.tar yuzu-2a752bbd646aefaedd5b2aa334710a48bb6fe907.tar.gz yuzu-2a752bbd646aefaedd5b2aa334710a48bb6fe907.tar.bz2 yuzu-2a752bbd646aefaedd5b2aa334710a48bb6fe907.tar.lz yuzu-2a752bbd646aefaedd5b2aa334710a48bb6fe907.tar.xz yuzu-2a752bbd646aefaedd5b2aa334710a48bb6fe907.tar.zst yuzu-2a752bbd646aefaedd5b2aa334710a48bb6fe907.zip |
Diffstat (limited to 'src/network/room_member.h')
-rw-r--r-- | src/network/room_member.h | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/network/room_member.h b/src/network/room_member.h index f578f7f6a..0d6417294 100644 --- a/src/network/room_member.h +++ b/src/network/room_member.h @@ -17,7 +17,24 @@ namespace Network { using AnnounceMultiplayerRoom::GameInfo; using AnnounceMultiplayerRoom::RoomInformation; -/// Information about the received WiFi packets. +enum class LDNPacketType : u8 { + Scan, + ScanResp, + Connect, + SyncNetwork, + Disconnect, + DestroyNetwork, +}; + +struct LDNPacket { + LDNPacketType type; + IPv4Address local_ip; + IPv4Address remote_ip; + bool broadcast; + std::vector<u8> data; +}; + +/// Information about the received proxy packets. struct ProxyPacket { SockAddrIn local_endpoint; SockAddrIn remote_endpoint; @@ -152,6 +169,12 @@ public: void SendProxyPacket(const ProxyPacket& packet); /** + * Sends an LDN packet to the room. + * @param packet The WiFi packet to send. + */ + void SendLdnPacket(const LDNPacket& packet); + + /** * Sends a chat message to the room. * @param message The contents of the message. */ @@ -205,6 +228,16 @@ public: std::function<void(const ProxyPacket&)> callback); /** + * Binds a function to an event that will be triggered every time an LDNPacket is received. + * The function wil be called everytime the event is triggered. + * The callback function must not bind or unbind a function. Doing so will cause a deadlock + * @param callback The function to call + * @return A handle used for removing the function from the registered list + */ + CallbackHandle<LDNPacket> BindOnLdnPacketReceived( + std::function<void(const LDNPacket&)> callback); + + /** * Binds a function to an event that will be triggered every time the RoomInformation changes. * The function wil be called every time the event is triggered. * The callback function must not bind or unbind a function. Doing so will cause a deadlock |