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.

116 lines
3.8 KiB

  1. /********************************************************************/
  2. /** Microsoft LAN Manager **/
  3. /** Copyright(c) Microsoft Corp., 1990-1993 **/
  4. /********************************************************************/
  5. /* :ts=4 */
  6. //** TLCOMMON.H - Common transport layer definitions.
  7. //
  8. // This file contains definitions for common transport layer items.
  9. //
  10. #if BACK_FILL
  11. // Max header size for backfilling
  12. #define MAX_BACKFILL_HDR_SIZE 32
  13. #endif
  14. #define PHXSUM(s,d,p,l) (uint)( (uint)*(ushort *)&(s) + \
  15. (uint)*(ushort *)((char *)&(s) + sizeof(ushort)) + \
  16. (uint)*(ushort *)&(d) + \
  17. (uint)*(ushort *)((char *)&(d) + sizeof(ushort)) + \
  18. (uint)((ushort)net_short((p))) + \
  19. (uint)((ushort)net_short((ushort)(l))) )
  20. #define TCP_TA_SIZE (offsetof(TRANSPORT_ADDRESS, Address->Address)+ \
  21. sizeof(TDI_ADDRESS_IP))
  22. extern void PrefetchRcvBuf(IPRcvBuf *Buf);
  23. extern ushort XsumSendChain(uint PHXsum, PNDIS_BUFFER BufChain);
  24. extern ushort XsumRcvBuf(uint PHXsum, IPRcvBuf *BufChain);
  25. extern uint CopyRcvToNdis(IPRcvBuf *RcvBuf, PNDIS_BUFFER DestBuf,
  26. uint Size, uint RcvOffset, uint DestOffset);
  27. extern uint CopyRcvToMdl(IPRcvBuf *RcvBuf, PMDL DestBuf,
  28. uint Size, uint RcvOffset, uint DestOffset);
  29. extern TDI_STATUS UpdateConnInfo(PTDI_CONNECTION_INFORMATION ConnInfo,
  30. IPOptInfo *OptInfo, IPAddr SrcAddress, ushort SrcPort);
  31. extern void* BuildTDIAddress(uchar *Buffer, IPAddr Addr, ushort Port);
  32. extern void* AppendTDIAddress(uchar *Buffer, uchar * NextAddress,
  33. IPAddr Addr, ushort Port);
  34. extern void CopyRcvToBuffer(uchar *DestBuf, IPRcvBuf *SrcRB, uint Size,
  35. uint Offset);
  36. extern PNDIS_BUFFER CopyFlatToNdis(PNDIS_BUFFER DestBuf, uchar *SrcBuf,
  37. uint Size, uint *Offset, uint *BytesCopied);
  38. extern PMDL CopyFlatToMdl(PMDL DestBuf, uchar *SrcBuf,
  39. uint Size, uint *Offset, uint *BytesCopied);
  40. extern void *TLRegisterProtocol(uchar Protocol, void *RcvHandler,
  41. void *XmitHandler, void *StatusHandler,
  42. void *RcvCmpltHandler, void *PnPHandler, void *ElistHandler);
  43. // Differentiate copying to an NDIS_BUFFER and an MDL for Millenniun. On
  44. // NT they are the same thing and inlined to the TDI functions.
  45. #if MILLEN
  46. NTSTATUS
  47. TcpipCopyBufferToNdisBuffer (
  48. IN PVOID SourceBuffer,
  49. IN ULONG SourceOffset,
  50. IN ULONG SourceBytesToCopy,
  51. IN PNDIS_BUFFER DestinationNdisBuffer,
  52. IN ULONG DestinationOffset,
  53. IN PULONG BytesCopied
  54. );
  55. #else // MILLEN
  56. __inline NTSTATUS
  57. TcpipCopyBufferToNdisBuffer (
  58. IN PVOID SourceBuffer,
  59. IN ULONG SourceOffset,
  60. IN ULONG SourceBytesToCopy,
  61. IN PNDIS_BUFFER DestinationNdisBuffer,
  62. IN ULONG DestinationOffset,
  63. IN PULONG BytesCopied
  64. )
  65. {
  66. return TdiCopyBufferToMdl(
  67. SourceBuffer,
  68. SourceOffset,
  69. SourceBytesToCopy,
  70. DestinationNdisBuffer,
  71. DestinationOffset,
  72. BytesCopied);
  73. }
  74. #endif // !MILLEN
  75. /*
  76. * Routine for TCP checksum. This is defined as calls through a function
  77. * pointer which is set to point at the optimal routine for this
  78. * processor implementation
  79. */
  80. typedef
  81. ULONG
  82. (* TCPXSUM_ROUTINE)(
  83. IN ULONG Checksum,
  84. IN PUCHAR Source,
  85. IN ULONG Length
  86. );
  87. ULONG
  88. tcpxsum_xmmi(
  89. IN ULONG Checksum,
  90. IN PUCHAR Source,
  91. IN ULONG Length
  92. );
  93. ULONG
  94. tcpxsum(
  95. IN ULONG Checksum,
  96. IN PUCHAR Source,
  97. IN ULONG Length
  98. );