Windows NT 4.0 source code leak
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.

164 lines
6.3 KiB

4 years ago
  1. /*++
  2. Copyright (c) 1990 Microsoft Corporation
  3. Module Name:
  4. nettrans.h
  5. Abstract:
  6. This module contains definitions used while exchanging SMB's over the
  7. network
  8. Author:
  9. Larry Osterman (LarryO) 16-Jul-1990
  10. Revision History:
  11. 16-Jul-1990 LarryO
  12. Created
  13. --*/
  14. #ifndef _NETTRANS
  15. #define _NETTRANS
  16. struct _MPX_ENTRY;
  17. typedef
  18. NTSTATUS
  19. (*PNETTRANCEIVE_CALLBACK)(
  20. IN PSMB_HEADER Smb,
  21. IN PULONG SmbLength,
  22. IN struct _MPX_ENTRY *MpxTable,
  23. IN PVOID Context,
  24. IN PSERVERLISTENTRY Server,
  25. IN BOOLEAN ErrorIndicator,
  26. IN NTSTATUS NetworkErrorCode OPTIONAL,
  27. IN OUT PIRP *Irp OPTIONAL,
  28. IN ULONG ReceiveFlags
  29. );
  30. #define STANDARD_CALLBACK_HEADER(CallbackRoutineName) \
  31. NTSTATUS \
  32. CallbackRoutineName ( \
  33. IN PSMB_HEADER Smb, \
  34. IN PULONG SmbLength, \
  35. IN struct _MPX_ENTRY *MpxEntry, \
  36. IN PVOID Ctx, \
  37. IN PSERVERLISTENTRY Server, \
  38. IN BOOLEAN ErrorIndicator, \
  39. IN NTSTATUS NetworkErrorCode OPTIONAL, \
  40. IN OUT PIRP *Irp, \
  41. IN ULONG ReceiveFlags \
  42. )
  43. //
  44. // The ERROR_TYPE structure defines the status of a NetTranceive
  45. // request. It can be in one of three states:
  46. //
  47. // NoError - The request has not yet encountered an error.
  48. // NetError - There was a network error (TDI).
  49. // SMBError - The incoming SMB indicated an error.
  50. // ReceiveIrpProcessing - Error processing is postponed.
  51. //
  52. typedef enum _Error_Type {
  53. NoError, // Request was successful
  54. NetError, // Network failure in the request
  55. SMBError, // The incoming SMB indicated an error
  56. ReceiveIrpProcessing // Error processing is postponed
  57. } ERROR_TYPE;
  58. //
  59. // The TRANCEIVE_HEADER structure provides common header information
  60. // for SMB exchanges.
  61. //
  62. typedef struct _TranceiveHeader {
  63. ULONG Type; // Type of context structure.
  64. KEVENT KernelEvent; // Event to wait on for completion
  65. NTSTATUS ErrorCode; // Error if ErrorType != NoError.
  66. ERROR_TYPE ErrorType; // Type of error to wait
  67. ULONG TransferSize; // Used to calculate timeout length.
  68. struct _MPX_ENTRY *MpxTableEntry; // Mpx table entry used for I/O
  69. } TRANCEIVE_HEADER, *PTRANCEIVE_HEADER;
  70. //
  71. // The redirector keeps an array of outstanding requests to the remote
  72. // server. For historical reasons, this table is called an MPX_TABLE
  73. // (or Multiplex Table). Entries in the table are MPX Table Entries,
  74. // and this structure defines those entries.
  75. //
  76. // When a network request is initiated, an MPX table entry is allocated
  77. // and the information needed to track the request is filled in. When
  78. // the response from the remote server arrives, the redirector looks in
  79. // the MPX table entry indicated in the SMB (in the smb_mid field).
  80. //
  81. //
  82. typedef struct _MPX_ENTRY {
  83. ULONG Signature; // Type of structure.
  84. USHORT Mid; // MPX Id of outgoing request.
  85. USHORT Tid;
  86. USHORT Uid; // Save the TID and UID for cancel.
  87. USHORT Pid; // Low 8 bits of the PID for cancel.
  88. ULONG Flags; // Flags describing the request.
  89. ULONG StartTime; // Time to start timeout
  90. ULONG TimeoutTime; // Time to timeout the request.
  91. ULONG TransferSize; // Used to calculate timeout length
  92. ULONG ReferenceCount; // Used to synchronize with cancel
  93. PIRP SendIrp; // I/O request packet for Send.
  94. PIRP ReceiveIrp; // I/O request packet for Receive.
  95. PIRP OriginatingIrp; // I/O request packet for user request.
  96. PIRP SendIrpToFree; // IRP to be freed at end of tranceive.
  97. KEVENT SendCompleteEvent; // Send completion event.
  98. PFILE_OBJECT FileObject; // Used to cancel MTE's for a file.
  99. ERESOURCE_THREAD RequestorsThread; // Thread that initiated I/O.
  100. PSERVERLISTENTRY SLE; // ServerList Entry for request.
  101. PTRANCEIVE_HEADER RequestContext; // Context information about request.
  102. PNETTRANCEIVE_CALLBACK Callback;
  103. } MPX_ENTRY, *PMPX_ENTRY;
  104. typedef struct _MPX_TABLE {
  105. PMPX_ENTRY Entry; // Actual entry.
  106. USHORT Mid; // Mpx ID for entry
  107. } MPX_TABLE, *PMPX_TABLE;
  108. #define MPX_ENTRY_ALLOCATED 0x00000001 // MPX table entry is allocated.
  109. #define MPX_ENTRY_SENDIRPGIVEN 0x00000002 // Send IRP was provided to request
  110. #define MPX_ENTRY_SENDCOMPLETE 0x00000004 // Send completed.
  111. #define MPX_ENTRY_OPLOCK 0x00000008 // This is the oplock MPX entry.
  112. #define MPX_ENTRY_LONGTERM 0x00000010 // This is a longterm request.
  113. #define MPX_ENTRY_ABANDONED 0x00000020 // This has been abandoned.
  114. #define MPX_ENTRY_RECEIVE_GIVEN 0x00000040 // Receive provided to requestor
  115. #define MPX_ENTRY_RECEIVE_COMPLETE 0x00000080 // Receive was completed.
  116. #define MPX_ENTRY_CANCEL_RECEIVE 0x00000100 // Receive needs to be canceled
  117. #define MPX_ENTRY_CANCEL_SEND 0x00000200 // Send needs to be canceled.
  118. #define MPX_ENTRY_CANNOT_CANCEL 0x00000400 // Send cannot be canceled.
  119. #define NT_NORMAL 0x00000000 // This is an "ordinary" exchange.
  120. #define NT_DONTSCROUNGE 0x00000001 // Don't scrounge SMB on send.
  121. #define NT_NOCONNECTLIST 0x00000002 // The connection is invalid.
  122. #define NT_NORESPONSE 0x00000004 // There is no response for this request (T2)
  123. #define NT_NOKNOWSEAS 0x00000008 // This app doesn't knows EAs.
  124. #define NT_NOKNOWSLONGNAMES 0x00000010 // This app doesn't knows Long Names
  125. #define NT_NOSENDRESPONSE 0x00000020 // This is a one-way SMB send.
  126. #define NT_DFSFILE 0x00000040 // This SMB contains a Dfs pathname
  127. #define NT_CANNOTCANCEL 0x08000000 // This request cannot be canceled.
  128. #define NT_PREFER_LONGTERM 0x10000000 // This should be a longterm request if possible.
  129. #define NT_RECONNECTING 0x20000000 // This is the initiation of a connection.
  130. #define NT_LONGTERM 0x40000000 // This is a long term operation.
  131. #define NT_NORECONNECT 0x80000000 // Don't reconnect on this connect
  132. #endif