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.

176 lines
4.4 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. #define CDP_SERVICE_FLAGS (TDI_SERVICE_CONNECTIONLESS_MODE)
  25. #endif // 0
  26. NTSTATUS
  27. CxQueryInformation(
  28. IN PIRP Irp,
  29. IN PIO_STACK_LOCATION IrpSp
  30. )
  31. {
  32. NTSTATUS status = STATUS_SUCCESS;
  33. PCN_FSCONTEXT fsContext;
  34. PCX_ADDROBJ addrObj;
  35. CN_IRQL irql;
  36. PTDI_REQUEST_KERNEL_QUERY_INFORMATION queryInformation;
  37. ULONG fileType;
  38. ULONG infoSize;
  39. PVOID infoBuffer;
  40. union {
  41. TDI_PROVIDER_INFO ProviderInfo;
  42. TDI_ADDRESS_INFO AddressInfo;
  43. struct {
  44. TDI_ADDRESS_INFO AddressInfo;
  45. TDI_ADDRESS_CLUSTER ClusterAddress;
  46. } DummyAddressInfo;
  47. } info;
  48. fsContext = (PCN_FSCONTEXT) IrpSp->FileObject->FsContext;
  49. fileType = PtrToUlong(IrpSp->FileObject->FsContext2);
  50. queryInformation = (PTDI_REQUEST_KERNEL_QUERY_INFORMATION)
  51. &(IrpSp->Parameters);
  52. IF_CNDBG(CN_DEBUG_INFO) {
  53. CNPRINT((
  54. "[Clusnet] TDI query info type %u\n",
  55. queryInformation->QueryType
  56. ));
  57. }
  58. switch(queryInformation->QueryType) {
  59. case TDI_QUERY_BROADCAST_ADDRESS:
  60. CnAssert(fileType == TDI_CONTROL_CHANNEL_FILE);
  61. status = STATUS_NOT_IMPLEMENTED;
  62. break;
  63. case TDI_QUERY_PROVIDER_INFO:
  64. CnAssert(fileType == TDI_CONTROL_CHANNEL_FILE);
  65. infoSize = sizeof(info.ProviderInfo);
  66. infoBuffer = &(info.ProviderInfo);
  67. info.ProviderInfo.Version = 0x0100;
  68. info.ProviderInfo.MaxSendSize = 0;
  69. info.ProviderInfo.MaxConnectionUserData = 0;
  70. info.ProviderInfo.MaxDatagramSize =
  71. CDP_MAX_SEND_SIZE(CX_SIGNATURE_LENGTH);
  72. info.ProviderInfo.ServiceFlags = CDP_SERVICE_FLAGS;
  73. info.ProviderInfo.MinimumLookaheadData = 1;
  74. info.ProviderInfo.MaximumLookaheadData = 0xFFFFF;
  75. info.ProviderInfo.NumberOfResources = 0;
  76. info.ProviderInfo.StartTime.QuadPart = 0;
  77. break;
  78. case TDI_QUERY_PROVIDER_STATISTICS:
  79. CnAssert(fileType == TDI_CONTROL_CHANNEL_FILE);
  80. status = STATUS_NOT_IMPLEMENTED;
  81. break;
  82. case TDI_QUERY_ADDRESS_INFO:
  83. if (fileType == TDI_TRANSPORT_ADDRESS_FILE) {
  84. infoSize = FIELD_OFFSET(TDI_ADDRESS_INFO, Address) +
  85. sizeof(TA_CLUSTER_ADDRESS);
  86. infoBuffer = &(info.AddressInfo);
  87. addrObj = (PCX_ADDROBJ) fsContext;
  88. //
  89. // Since no one knows what the activity count means, we'll just set
  90. // it to 1.
  91. //
  92. info.AddressInfo.ActivityCount = 1;
  93. CnAcquireLock(&(addrObj->Lock), &irql);
  94. CxBuildTdiAddress(
  95. &(info.AddressInfo.Address),
  96. CnLocalNodeId,
  97. addrObj->LocalPort,
  98. FALSE
  99. );
  100. CnReleaseLock(&(addrObj->Lock), irql);
  101. }
  102. else {
  103. status = STATUS_INVALID_DEVICE_REQUEST;
  104. }
  105. break;
  106. default:
  107. status = STATUS_INVALID_PARAMETER;
  108. break;
  109. }
  110. if (status == STATUS_SUCCESS) {
  111. PULONG pnBytes = &((ULONG)(Irp->IoStatus.Information));
  112. status = TdiCopyBufferToMdl(
  113. infoBuffer,
  114. 0,
  115. infoSize,
  116. Irp->MdlAddress,
  117. 0,
  118. pnBytes
  119. );
  120. }
  121. IF_CNDBG(CN_DEBUG_INFO) {
  122. CNPRINT((
  123. "[Clusnet] TDI query info returning status %lx, %u bytes\n",
  124. status,
  125. (ULONG)(Irp->IoStatus.Information)
  126. ));
  127. }
  128. return(status);
  129. } // CxQueryInformation