BandTest.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : Bandwidth Tester *
  23. * *
  24. * $Archive:: /Commando/Code/BandTest/BandTest.h $*
  25. * *
  26. * $Author:: Steve_t $*
  27. * *
  28. * $Modtime:: 1/28/02 1:50p $*
  29. * *
  30. * $Revision:: 5 $*
  31. * *
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * *
  35. * *
  36. *---------------------------------------------------------------------------------------------*
  37. * *
  38. * Functions: *
  39. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  40. /*
  41. ** The following ifdef block is the standard way of creating macros which make exporting
  42. ** from a DLL simpler. All files within this DLL are compiled with the BANDTEST_EXPORTS
  43. ** symbol defined on the command line. this symbol should not be defined on any project
  44. ** that uses this DLL. This way any other project whose source files include this file see
  45. ** BANDTEST_API functions as being imported from a DLL, wheras this DLL sees symbols
  46. ** defined with this macro as being exported.
  47. */
  48. #ifdef BANDTEST_EXPORTS
  49. #define BANDTEST_API __declspec(dllexport)
  50. #else
  51. #define BANDTEST_API __declspec(dllimport)
  52. #endif
  53. /*
  54. ** Extended failure codes.
  55. */
  56. enum {
  57. BANDTEST_OK,
  58. BANDTEST_NO_WINSOCK2,
  59. BANDTEST_NO_RAW_SOCKET_PERMISSION,
  60. BANDTEST_NO_RAW_SOCKET_CREATE,
  61. BANDTEST_NO_UDP_SOCKET_BIND,
  62. BANDTEST_NO_TTL_SET,
  63. BANDTEST_NO_PING_RESPONSE,
  64. BANDTEST_NO_FINAL_PING_TIME,
  65. BANDTEST_NO_EXTERNAL_ROUTER,
  66. BANDTEST_NO_IP_DETECT,
  67. BANDTEST_UNKNOWN_ERROR,
  68. BANDTEST_WRONG_API_VERSION,
  69. BANDTEST_BAD_PARAM,
  70. };
  71. typedef struct tBandtestSettingsStruct {
  72. /*
  73. ** Use ICMP packets instead of UDP packets when testing bandwidth.
  74. */
  75. unsigned int AlwaysICMP : 1;
  76. /*
  77. ** Use various values of TTL when testing bandwidth.
  78. */
  79. unsigned int TTLScatter : 1;
  80. /*
  81. ** Max number of packets to send for slow pings.
  82. */
  83. unsigned int FastPingPackets : 7;
  84. /*
  85. ** Max number of packets to send for fast pings.
  86. */
  87. unsigned int SlowPingPackets : 7;
  88. /*
  89. ** Pings over this time in ms use smaller number of packets for bandwidth discovery.
  90. */
  91. unsigned int FastPingThreshold : 5;
  92. /*
  93. ** Tell bandtest.dll to do a ping profile.
  94. */
  95. unsigned int PingProfile : 1;
  96. } BandtestSettingsStruct;
  97. #define BANDTEST_API_VERSION 0x101
  98. BANDTEST_API unsigned long Detect_Bandwidth(unsigned long server_ip, unsigned long my_ip, int retries, int &failure_code, unsigned long &downstream, unsigned long api_version, BandtestSettingsStruct *settings = NULL, char *regpath = NULL);