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