|
|
@ -89,43 +89,43 @@ Network::Protocol Translate(Type type, Protocol protocol) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
u16 TranslatePollEventsToHost(u32 flags) {
|
|
|
|
Network::PollEvents TranslatePollEventsToHost(PollEvents flags) {
|
|
|
|
u32 result = 0;
|
|
|
|
Network::PollEvents result{};
|
|
|
|
const auto translate = [&result, &flags](u32 from, u32 to) {
|
|
|
|
const auto translate = [&result, &flags](PollEvents from, Network::PollEvents to) {
|
|
|
|
if ((flags & from) != 0) {
|
|
|
|
if (True(flags & from)) {
|
|
|
|
flags &= ~from;
|
|
|
|
flags &= ~from;
|
|
|
|
result |= to;
|
|
|
|
result |= to;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
translate(POLL_IN, Network::POLL_IN);
|
|
|
|
translate(PollEvents::In, Network::PollEvents::In);
|
|
|
|
translate(POLL_PRI, Network::POLL_PRI);
|
|
|
|
translate(PollEvents::Pri, Network::PollEvents::Pri);
|
|
|
|
translate(POLL_OUT, Network::POLL_OUT);
|
|
|
|
translate(PollEvents::Out, Network::PollEvents::Out);
|
|
|
|
translate(POLL_ERR, Network::POLL_ERR);
|
|
|
|
translate(PollEvents::Err, Network::PollEvents::Err);
|
|
|
|
translate(POLL_HUP, Network::POLL_HUP);
|
|
|
|
translate(PollEvents::Hup, Network::PollEvents::Hup);
|
|
|
|
translate(POLL_NVAL, Network::POLL_NVAL);
|
|
|
|
translate(PollEvents::Nval, Network::PollEvents::Nval);
|
|
|
|
|
|
|
|
|
|
|
|
UNIMPLEMENTED_IF_MSG(flags != 0, "Unimplemented flags={}", flags);
|
|
|
|
UNIMPLEMENTED_IF_MSG((u16)flags != 0, "Unimplemented flags={}", (u16)flags);
|
|
|
|
return static_cast<u16>(result);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
u16 TranslatePollEventsToGuest(u32 flags) {
|
|
|
|
PollEvents TranslatePollEventsToGuest(Network::PollEvents flags) {
|
|
|
|
u32 result = 0;
|
|
|
|
PollEvents result{};
|
|
|
|
const auto translate = [&result, &flags](u32 from, u32 to) {
|
|
|
|
const auto translate = [&result, &flags](Network::PollEvents from, PollEvents to) {
|
|
|
|
if ((flags & from) != 0) {
|
|
|
|
if (True(flags & from)) {
|
|
|
|
flags &= ~from;
|
|
|
|
flags &= ~from;
|
|
|
|
result |= to;
|
|
|
|
result |= to;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
translate(Network::POLL_IN, POLL_IN);
|
|
|
|
translate(Network::PollEvents::In, PollEvents::In);
|
|
|
|
translate(Network::POLL_PRI, POLL_PRI);
|
|
|
|
translate(Network::PollEvents::Pri, PollEvents::Pri);
|
|
|
|
translate(Network::POLL_OUT, POLL_OUT);
|
|
|
|
translate(Network::PollEvents::Out, PollEvents::Out);
|
|
|
|
translate(Network::POLL_ERR, POLL_ERR);
|
|
|
|
translate(Network::PollEvents::Err, PollEvents::Err);
|
|
|
|
translate(Network::POLL_HUP, POLL_HUP);
|
|
|
|
translate(Network::PollEvents::Hup, PollEvents::Hup);
|
|
|
|
translate(Network::POLL_NVAL, POLL_NVAL);
|
|
|
|
translate(Network::PollEvents::Nval, PollEvents::Nval);
|
|
|
|
|
|
|
|
|
|
|
|
UNIMPLEMENTED_IF_MSG(flags != 0, "Unimplemented flags={}", flags);
|
|
|
|
UNIMPLEMENTED_IF_MSG((u16)flags != 0, "Unimplemented flags={}", (u16)flags);
|
|
|
|
return static_cast<u16>(result);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Network::SockAddrIn Translate(SockAddrIn value) {
|
|
|
|
Network::SockAddrIn Translate(SockAddrIn value) {
|
|
|
|