2015-03-09 17:37:02 +00:00
|
|
|
// Copyright 2015 Dolphin Emulator Project
|
2021-07-05 01:22:19 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2015-03-09 17:37:02 +00:00
|
|
|
//
|
|
|
|
#pragma once
|
|
|
|
|
2023-04-19 16:25:21 +00:00
|
|
|
#include <memory>
|
2015-03-09 17:37:02 +00:00
|
|
|
|
2022-10-09 00:25:28 +00:00
|
|
|
#include <SFML/Network/Packet.hpp>
|
2023-04-19 16:25:21 +00:00
|
|
|
#include <enet/enet.h>
|
2022-10-09 00:25:28 +00:00
|
|
|
|
|
|
|
#include "Common/CommonTypes.h"
|
|
|
|
|
2023-04-11 13:12:01 +00:00
|
|
|
namespace Common::ENet
|
2015-03-09 17:37:02 +00:00
|
|
|
{
|
2023-04-19 16:25:21 +00:00
|
|
|
struct ENetHostDeleter
|
|
|
|
{
|
|
|
|
void operator()(ENetHost* host) const noexcept { enet_host_destroy(host); }
|
|
|
|
};
|
|
|
|
using ENetHostPtr = std::unique_ptr<ENetHost, ENetHostDeleter>;
|
|
|
|
|
2015-03-09 17:37:02 +00:00
|
|
|
void WakeupThread(ENetHost* host);
|
2015-03-14 14:19:18 +00:00
|
|
|
int ENET_CALLBACK InterceptCallback(ENetHost* host, ENetEvent* event);
|
2022-10-09 00:39:38 +00:00
|
|
|
bool SendPacket(ENetPeer* socket, const sf::Packet& packet, u8 channel_id);
|
2023-10-28 15:57:22 +00:00
|
|
|
|
|
|
|
// used for traversal packets and wake-up packets
|
|
|
|
constexpr ENetEventType SKIPPABLE_EVENT = ENetEventType(42);
|
2023-04-11 13:12:01 +00:00
|
|
|
} // namespace Common::ENet
|