ENet.h 710 B

12345678910111213141516171819202122232425262728
  1. // Copyright 2015 Dolphin Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. //
  4. #pragma once
  5. #include <memory>
  6. #include <SFML/Network/Packet.hpp>
  7. #include <enet/enet.h>
  8. #include "Common/CommonTypes.h"
  9. namespace Common::ENet
  10. {
  11. struct ENetHostDeleter
  12. {
  13. void operator()(ENetHost* host) const noexcept { enet_host_destroy(host); }
  14. };
  15. using ENetHostPtr = std::unique_ptr<ENetHost, ENetHostDeleter>;
  16. void WakeupThread(ENetHost* host);
  17. int ENET_CALLBACK InterceptCallback(ENetHost* host, ENetEvent* event);
  18. bool SendPacket(ENetPeer* socket, const sf::Packet& packet, u8 channel_id);
  19. // used for traversal packets and wake-up packets
  20. constexpr int SKIPPABLE_EVENT = 42;
  21. } // namespace Common::ENet