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