Leaked source code of windows server 2003
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.

137 lines
3.8 KiB

  1. /********************************************************************/
  2. /** Microsoft LAN Manager **/
  3. /** Copyright(c) Microsoft Corp., 1990-2000 **/
  4. /********************************************************************/
  5. /* :ts=4 */
  6. //** INFO.H - TDI Query/SetInfo and Action definitons.
  7. //
  8. // This file contains definitions for the file info.c.
  9. //
  10. #include "tcpinfo.h"
  11. #define TL_INSTANCE 0
  12. typedef struct CACHE_ALIGN TCPInternalStats {
  13. ulong ts_inerrs;
  14. ulong ts_insegs;
  15. ulong ts_activeopens;
  16. ulong ts_attemptfails;
  17. ulong ts_currestab;
  18. ulong ts_estabresets;
  19. ulong ts_maxconn;
  20. ulong ts_numconns;
  21. ulong ts_passiveopens;
  22. ulong ts_retranssegs;
  23. ulong ts_rtoalgorithm;
  24. ulong ts_rtomax;
  25. ulong ts_rtomin;
  26. ulong ts_outrsts;
  27. ulong ts_outsegs;
  28. } TCPInternalStats;
  29. extern TCPInternalStats TStats;
  30. typedef struct CACHE_ALIGN TCPInternalPerCpuStats {
  31. ulong tcs_insegs;
  32. ulong tcs_outsegs;
  33. } TCPInternalPerCpuStats;
  34. #define TCPS_MAX_PROCESSOR_BUCKETS 8
  35. extern TCPInternalPerCpuStats TPerCpuStats[TCPS_MAX_PROCESSOR_BUCKETS];
  36. __forceinline
  37. void TCPSIncrementInSegCount(void)
  38. {
  39. #if !MILLEN
  40. const ulong Index = KeGetCurrentProcessorNumber() % TCPS_MAX_PROCESSOR_BUCKETS;
  41. TPerCpuStats[Index].tcs_insegs++;
  42. #else
  43. TStats.ts_insegs++;
  44. #endif
  45. }
  46. __forceinline
  47. void TCPSIncrementOutSegCount(void)
  48. {
  49. #if !MILLEN
  50. const ulong Index = KeGetCurrentProcessorNumber() % TCPS_MAX_PROCESSOR_BUCKETS;
  51. TPerCpuStats[Index].tcs_outsegs++;
  52. #else
  53. TStats.ts_outsegs++;
  54. #endif
  55. }
  56. __inline
  57. void TCPSGetTotalCounts(TCPInternalPerCpuStats* Stats)
  58. {
  59. ulong Index;
  60. const ulong MaxIndex = MIN(KeNumberProcessors, TCPS_MAX_PROCESSOR_BUCKETS);
  61. RtlZeroMemory(Stats, sizeof(TCPInternalPerCpuStats));
  62. for (Index = 0; Index < MaxIndex; Index++) {
  63. Stats->tcs_insegs += TPerCpuStats[Index].tcs_insegs;
  64. Stats->tcs_outsegs += TPerCpuStats[Index].tcs_outsegs;
  65. }
  66. }
  67. typedef struct TCPConnContext {
  68. uint tcc_index;
  69. // sizeof(TCPConnTableEntry) or sizeof(TCPConnTableEntryEx) used as a
  70. // mean of knowing which structure we are returning.
  71. //
  72. uint tcc_infosize;
  73. struct TCB *tcc_tcb;
  74. } TCPConnContext;
  75. C_ASSERT(sizeof(TCPConnContext) <= CONTEXT_SIZE);
  76. #define TCB_STATE_DELTA 1
  77. typedef struct UDPContext {
  78. uint uc_index;
  79. // sizeof(UDPEntry) or sizeof(UDPEntryEx) used as a means of knowing
  80. // which structure we are returning.
  81. //
  82. uint uc_infosize;
  83. struct AddrObj *uc_ao;
  84. } UDPContext;
  85. C_ASSERT(sizeof(UDPContext) <= CONTEXT_SIZE);
  86. extern UDPStats UStats;
  87. extern struct TDIEntityID *EntityList;
  88. extern uint EntityCount;
  89. extern CTELock EntityLock;
  90. extern TDI_STATUS TdiQueryInformation(PTDI_REQUEST Request,
  91. PTDI_REQUEST_KERNEL_QUERY_INFORMATION queryInformation ,
  92. PNDIS_BUFFER Buffer, uint * BufferSize, uint IsConn);
  93. extern TDI_STATUS TdiSetInformation(PTDI_REQUEST Request, uint SetType,
  94. PNDIS_BUFFER Buffer, uint BufferSize, uint IsConn);
  95. extern TDI_STATUS TdiAction(PTDI_REQUEST Request, uint ActionType,
  96. PNDIS_BUFFER Buffer, uint BufferSize);
  97. extern TDI_STATUS TdiQueryInformationEx(PTDI_REQUEST Request,
  98. struct TDIObjectID *ID, PNDIS_BUFFER Buffer, uint *Size, void *Context);
  99. extern TDI_STATUS TdiSetInformationEx(PTDI_REQUEST Request,
  100. struct TDIObjectID *ID, void *Buffer, uint Size);
  101. extern NTSTATUS TcpInitCcb();
  102. extern void TcpUnInitCcb();
  103. extern void TcpInvokeCcb(uint PreviousState, uint CurrentState,
  104. TCPAddrInfo *TcpAddrBytes, uint InterfaceId);