forked from suyu/suyu
0791082b43
Actually, two enum classes, since for some reason there are two separate yet identical `PollFD` types used in the codebase. I get that one is ABI-compatible with the Switch while the other is an abstract type used for the host, but why not use `WSAPOLLFD` directly for the latter? Anyway, why make this change? Because on Apple platforms, `POLL_IN`, `POLL_OUT`, etc. (with an underscore) are defined as macros in <sys/signal.h>. (This is inherited from FreeBSD.) So defining a variable with the same name causes a compile error. I could just rename the variables, but while I was at it I thought I might as well switch to an enum for stronger typing. Also, change the type used for values copied directly to/from the `events` and `revents` fields of the host *native* `pollfd`/`WSASPOLLFD`, from `u32` to `short`, as `short` is the correct canonical type on both Unix and Windows.
48 lines
1.5 KiB
C++
48 lines
1.5 KiB
C++
// Copyright 2020 yuzu emulator team
|
|
// Licensed under GPLv2 or any later version
|
|
// Refer to the license.txt file included.
|
|
|
|
#pragma once
|
|
|
|
#include <utility>
|
|
|
|
#include "common/common_types.h"
|
|
#include "core/hle/service/sockets/sockets.h"
|
|
#include "core/network/network.h"
|
|
|
|
namespace Service::Sockets {
|
|
|
|
/// Translate abstract errno to guest errno
|
|
Errno Translate(Network::Errno value);
|
|
|
|
/// Translate abstract return value errno pair to guest return value errno pair
|
|
std::pair<s32, Errno> Translate(std::pair<s32, Network::Errno> value);
|
|
|
|
/// Translate guest domain to abstract domain
|
|
Network::Domain Translate(Domain domain);
|
|
|
|
/// Translate abstract domain to guest domain
|
|
Domain Translate(Network::Domain domain);
|
|
|
|
/// Translate guest type to abstract type
|
|
Network::Type Translate(Type type);
|
|
|
|
/// Translate guest protocol to abstract protocol
|
|
Network::Protocol Translate(Type type, Protocol protocol);
|
|
|
|
/// Translate abstract poll event flags to guest poll event flags
|
|
Network::PollEvents TranslatePollEventsToHost(PollEvents flags);
|
|
|
|
/// Translate guest poll event flags to abstract poll event flags
|
|
PollEvents TranslatePollEventsToGuest(Network::PollEvents flags);
|
|
|
|
/// Translate guest socket address structure to abstract socket address structure
|
|
Network::SockAddrIn Translate(SockAddrIn value);
|
|
|
|
/// Translate abstract socket address structure to guest socket address structure
|
|
SockAddrIn Translate(Network::SockAddrIn value);
|
|
|
|
/// Translate guest shutdown mode to abstract shutdown mode
|
|
Network::ShutdownHow Translate(ShutdownHow how);
|
|
|
|
} // namespace Service::Sockets
|