Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

118 lines
2.2 KiB

  1. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  2. // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  3. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  4. // PARTICULAR PURPOSE.
  5. //
  6. // Copyright (C) Microsoft Corporation, 1993 - 1999 All Rights Reserved.
  7. //
  8. // MODULE: socksrv.h
  9. //
  10. // PURPOSE: Definitions and prototypes for socksrv.c
  11. //
  12. #include <windows.h>
  13. #include <tchar.h>
  14. #include <stdio.h>
  15. #include <stdlib.h>
  16. #include <string.h>
  17. #include <stdarg.h>
  18. #include <winsock.h>
  19. #include <wsipx.h>
  20. #include <commdef.h>
  21. #define MAXIMUM_NUMBER_OF_CLIENTS 64
  22. #define MAXIMUM_NUMBER_OF_WORKERS 32
  23. #define FILE_SIZE ((1024*1024*8)-CLIENT_OUTBOUND_BUFFER_MAX)
  24. #define SIXTY_FOUR_K (64*1024)
  25. #define SIXTEEN_K (16*1024)
  26. DWORD InitialBuffer[SIXTY_FOUR_K/sizeof(DWORD)];
  27. #define NUMBER_OF_WRITES ((FILE_SIZE+CLIENT_OUTBOUND_BUFFER_MAX)/SIXTY_FOUR_K)
  28. #define CLIENT_CONNECTED 0x00000001
  29. #define CLIENT_DONE 0x00000002
  30. typedef struct _PER_CLIENT_DATA {
  31. SOCKET Socket;
  32. OVERLAPPED Overlapped;
  33. CLIENT_IO_BUFFER IoBuffer;
  34. CHAR OutboundBuffer[CLIENT_OUTBOUND_BUFFER_MAX];
  35. DWORD Flags;
  36. HANDLE hEvent;
  37. } PER_CLIENT_DATA, *PPER_CLIENT_DATA;
  38. typedef struct _PER_THREAD_DATA {
  39. DWORD TotalTransactions;
  40. DWORD TotalBytesTransferred;
  41. } PER_THREAD_DATA, *PPER_THREAD_DATA;
  42. PER_THREAD_DATA ThreadData[MAXIMUM_NUMBER_OF_WORKERS];
  43. PER_CLIENT_DATA ClientData[MAXIMUM_NUMBER_OF_CLIENTS];
  44. BOOL fVerbose;
  45. BOOL fTcp;
  46. DWORD dwNumberOfClients;
  47. DWORD dwNumberOfWorkers;
  48. DWORD dwConcurrency;
  49. DWORD dwWorkIndex;
  50. SYSTEM_INFO SystemInfo;
  51. HANDLE CompletionPort;
  52. DWORD dwActiveClientCount;
  53. HANDLE hBenchmarkComplete;
  54. HANDLE hBenchmarkStart;
  55. DWORD StartTime;
  56. DWORD EndTime;
  57. HANDLE hFile;
  58. DWORD
  59. WINAPI
  60. Random (
  61. DWORD nMaxValue
  62. );
  63. VOID
  64. WINAPI
  65. ShowUsage(
  66. VOID
  67. );
  68. VOID
  69. WINAPI
  70. ParseSwitch(
  71. CHAR chSwitch,
  72. int *pArgc,
  73. char **pArgv[]
  74. );
  75. BOOL
  76. WINAPI
  77. CreateNetConnections(
  78. VOID
  79. );
  80. BOOL
  81. WINAPI
  82. CreateWorkers(
  83. VOID
  84. );
  85. DWORD
  86. WINAPI
  87. WorkerThread(
  88. LPVOID WorkContext
  89. );
  90. VOID
  91. WINAPI
  92. CompleteBenchmark(
  93. VOID
  94. );
  95. VOID
  96. WINAPI
  97. SortTheBuffer(
  98. LPDWORD Destination,
  99. LPDWORD Source,
  100. int DwordCount
  101. );