FirewallWait.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /******************************************************************************
  19. *
  20. * FILE
  21. * $Archive: /Commando/Code/Commando/FirewallWait.h $
  22. *
  23. * DESCRIPTION
  24. * Firewall negotiation wait condition.
  25. *
  26. * PROGRAMMER
  27. * $Author: Denzil_l $
  28. *
  29. * VERSION INFO
  30. * $Revision: 6 $
  31. * $Modtime: 8/28/01 3:22p $
  32. *
  33. ******************************************************************************/
  34. #ifndef __FIREWALLWAIT_H__
  35. #define __FIREWALLWAIT_H__
  36. #include <WWOnline\WaitCondition.h>
  37. #include <windows.h>
  38. namespace WWOnline
  39. {
  40. class Session;
  41. }
  42. /*
  43. ** Wait code for firewall/NAT detection.
  44. **
  45. **
  46. **
  47. */
  48. class FirewallDetectWait :
  49. public SingleWait
  50. {
  51. public:
  52. static RefPtr<FirewallDetectWait> Create(void);
  53. void WaitBeginning(void);
  54. WaitResult GetResult(void);
  55. protected:
  56. FirewallDetectWait();
  57. virtual ~FirewallDetectWait();
  58. FirewallDetectWait(const FirewallDetectWait&);
  59. const FirewallDetectWait& operator=(const FirewallDetectWait&);
  60. RefPtr<WWOnline::Session> mWOLSession;
  61. unsigned int mPingsRemaining;
  62. HANDLE mEvent;
  63. };
  64. /*
  65. ** Wait class for clients when trying to open up a firewall for a server connection.
  66. **
  67. */
  68. class FirewallConnectWait :
  69. public SingleWait
  70. {
  71. public:
  72. static RefPtr<FirewallConnectWait> Create(void);
  73. void WaitBeginning(void);
  74. WaitResult GetResult(void);
  75. virtual void EndWait(WaitResult, const wchar_t* endText);
  76. protected:
  77. FirewallConnectWait();
  78. virtual ~FirewallConnectWait();
  79. FirewallConnectWait(const FirewallConnectWait&);
  80. const FirewallConnectWait& operator=(const FirewallConnectWait&);
  81. RefPtr<WWOnline::Session> mWOLSession;
  82. unsigned int mPingsRemaining;
  83. HANDLE mEvent;
  84. HANDLE mCancelEvent;
  85. /*
  86. ** Did the port negotiation succeed?
  87. */
  88. int mSuccessFlag;
  89. /*
  90. ** How many players in the queue ahead of us?
  91. */
  92. unsigned int mQueueCount;
  93. unsigned int mLastQueueCount;
  94. unsigned long mStartTime;
  95. };
  96. #endif // __FIREWALLWAIT_H__