diff options
| author | Rodrigo Locatti <reinuseslisp@airmail.cc> | 2020-12-09 03:52:20 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-09 03:52:20 -0300 |
| commit | e94dd7e2c4fc3f7ca2c15c01bdc301be2b8a4c1b (patch) | |
| tree | 4ecd8c67c12e99dd8935487f4044f311b1b8311b /src/core/network/network.h | |
| parent | ce5fcb6bb2c358b0251a2ce87945bda52789a76d (diff) | |
| parent | 0791082b435371837bbecd50575911ce0ba16dc9 (diff) | |
Merge pull request #5142 from comex/xx-poll-events
network, sockets: Replace `POLL_IN`, `POLL_OUT`, etc. constants with an `enum class PollEvents`
Diffstat (limited to 'src/core/network/network.h')
| -rw-r--r-- | src/core/network/network.h | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/core/network/network.h b/src/core/network/network.h index 0622e4593..76b2821f2 100644 --- a/src/core/network/network.h +++ b/src/core/network/network.h @@ -61,19 +61,25 @@ struct SockAddrIn { }; /// Cross-platform poll fd structure + +enum class PollEvents : u16 { + // Using Pascal case because IN is a macro on Windows. + In = 1 << 0, + Pri = 1 << 1, + Out = 1 << 2, + Err = 1 << 3, + Hup = 1 << 4, + Nval = 1 << 5, +}; + +DECLARE_ENUM_FLAG_OPERATORS(PollEvents); + struct PollFD { Socket* socket; - u16 events; - u16 revents; + PollEvents events; + PollEvents revents; }; -constexpr u16 POLL_IN = 1 << 0; -constexpr u16 POLL_PRI = 1 << 1; -constexpr u16 POLL_OUT = 1 << 2; -constexpr u16 POLL_ERR = 1 << 3; -constexpr u16 POLL_HUP = 1 << 4; -constexpr u16 POLL_NVAL = 1 << 5; - class NetworkInstance { public: explicit NetworkInstance(); |
