QoSSession.h 820 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Copyright 2017 Dolphin Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include <enet/enet.h>
  5. #include <utility>
  6. namespace Common
  7. {
  8. class QoSSession
  9. {
  10. public:
  11. // 1 0 1 1 1 0 0 0
  12. // DSCP ECN
  13. static constexpr int ef_tos = 0b10111000;
  14. QoSSession() = default;
  15. QoSSession(ENetPeer* peer, int tos_val = ef_tos);
  16. ~QoSSession();
  17. QoSSession& operator=(const QoSSession&) = delete;
  18. QoSSession(const QoSSession&) = delete;
  19. QoSSession& operator=(QoSSession&& session);
  20. QoSSession(QoSSession&& session) { *this = std::move(session); }
  21. bool Successful() const { return m_success; }
  22. private:
  23. #if defined(_WIN32)
  24. void* m_qos_handle = nullptr;
  25. unsigned long m_qos_flow_id = 0;
  26. ENetPeer* m_peer = nullptr;
  27. #endif
  28. bool m_success = false;
  29. };
  30. } // namespace Common