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.

181 lines
4.8 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. cxinfo.c
  5. Abstract:
  6. TDI Set/Query Information routines.
  7. Author:
  8. Mike Massa (mikemas) February 20, 1997
  9. Revision History:
  10. Who When What
  11. -------- -------- ----------------------------------------------
  12. mikemas 02-20-97 created
  13. Notes:
  14. --*/
  15. #include "precomp.h"
  16. #pragma hdrstop
  17. #include "cxinfo.tmh"
  18. #ifdef ALLOC_PRAGMA
  19. #endif // ALLOC_PRAGMA
  20. #if 0
  21. #define CDP_SERVICE_FLAGS (TDI_SERVICE_CONNECTIONLESS_MODE | \
  22. TDI_SERVICE_BROADCAST_SUPPORTED)
  23. #else // 0
  24. //
  25. // TDI_SERVICE_FORCE_ACCESS_CHECK tells AFD to provide security
  26. // information (via IoCreateFile options) when creating CDP sockets.
  27. //
  28. #define CDP_SERVICE_FLAGS (TDI_SERVICE_CONNECTIONLESS_MODE | \
  29. TDI_SERVICE_FORCE_ACCESS_CHECK)
  30. #endif // 0
  31. NTSTATUS
  32. CxQueryInformation(
  33. IN PIRP Irp,
  34. IN PIO_STACK_LOCATION IrpSp
  35. )
  36. {
  37. NTSTATUS status = STATUS_SUCCESS;
  38. PCN_FSCONTEXT fsContext;
  39. PCX_ADDROBJ addrObj;
  40. CN_IRQL irql;
  41. PTDI_REQUEST_KERNEL_QUERY_INFORMATION queryInformation;
  42. ULONG fileType;
  43. ULONG infoSize;
  44. PVOID infoBuffer;
  45. union {
  46. TDI_PROVIDER_INFO ProviderInfo;
  47. TDI_ADDRESS_INFO AddressInfo;
  48. struct {
  49. TDI_ADDRESS_INFO AddressInfo;
  50. TDI_ADDRESS_CLUSTER ClusterAddress;
  51. } DummyAddressInfo;
  52. } info;
  53. fsContext = (PCN_FSCONTEXT) IrpSp->FileObject->FsContext;
  54. fileType = PtrToUlong(IrpSp->FileObject->FsContext2);
  55. queryInformation = (PTDI_REQUEST_KERNEL_QUERY_INFORMATION)
  56. &(IrpSp->Parameters);
  57. IF_CNDBG(CN_DEBUG_INFO) {
  58. CNPRINT((
  59. "[Clusnet] TDI query info type %u\n",
  60. queryInformation->QueryType
  61. ));
  62. }
  63. switch(queryInformation->QueryType) {
  64. case TDI_QUERY_BROADCAST_ADDRESS:
  65. CnAssert(fileType == TDI_CONTROL_CHANNEL_FILE);
  66. status = STATUS_NOT_IMPLEMENTED;
  67. break;
  68. case TDI_QUERY_PROVIDER_INFO:
  69. CnAssert(fileType == TDI_CONTROL_CHANNEL_FILE);
  70. infoSize = sizeof(info.ProviderInfo);
  71. infoBuffer = &(info.ProviderInfo);
  72. info.ProviderInfo.Version = 0x0100;
  73. info.ProviderInfo.MaxSendSize = 0;
  74. info.ProviderInfo.MaxConnectionUserData = 0;
  75. info.ProviderInfo.MaxDatagramSize =
  76. CDP_MAX_SEND_SIZE(CX_SIGNATURE_LENGTH);
  77. info.ProviderInfo.ServiceFlags = CDP_SERVICE_FLAGS;
  78. info.ProviderInfo.MinimumLookaheadData = 1;
  79. info.ProviderInfo.MaximumLookaheadData = 0xFFFFF;
  80. info.ProviderInfo.NumberOfResources = 0;
  81. info.ProviderInfo.StartTime.QuadPart = 0;
  82. break;
  83. case TDI_QUERY_PROVIDER_STATISTICS:
  84. CnAssert(fileType == TDI_CONTROL_CHANNEL_FILE);
  85. status = STATUS_NOT_IMPLEMENTED;
  86. break;
  87. case TDI_QUERY_ADDRESS_INFO:
  88. if (fileType == TDI_TRANSPORT_ADDRESS_FILE) {
  89. infoSize = FIELD_OFFSET(TDI_ADDRESS_INFO, Address) +
  90. sizeof(TA_CLUSTER_ADDRESS);
  91. infoBuffer = &(info.AddressInfo);
  92. addrObj = (PCX_ADDROBJ) fsContext;
  93. //
  94. // Since no one knows what the activity count means, we'll just set
  95. // it to 1.
  96. //
  97. info.AddressInfo.ActivityCount = 1;
  98. CnAcquireLock(&(addrObj->Lock), &irql);
  99. CxBuildTdiAddress(
  100. &(info.AddressInfo.Address),
  101. CnLocalNodeId,
  102. addrObj->LocalPort,
  103. FALSE
  104. );
  105. CnReleaseLock(&(addrObj->Lock), irql);
  106. }
  107. else {
  108. status = STATUS_INVALID_DEVICE_REQUEST;
  109. }
  110. break;
  111. default:
  112. status = STATUS_INVALID_PARAMETER;
  113. break;
  114. }
  115. if (status == STATUS_SUCCESS) {
  116. PULONG pnBytes = &((ULONG)(Irp->IoStatus.Information));
  117. status = TdiCopyBufferToMdl(
  118. infoBuffer,
  119. 0,
  120. infoSize,
  121. Irp->MdlAddress,
  122. 0,
  123. pnBytes
  124. );
  125. }
  126. IF_CNDBG(CN_DEBUG_INFO) {
  127. CNPRINT((
  128. "[Clusnet] TDI query info returning status %lx, %u bytes\n",
  129. status,
  130. (ULONG)(Irp->IoStatus.Information)
  131. ));
  132. }
  133. return(status);
  134. } // CxQueryInformation