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.

113 lines
3.6 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 CopyRcvToBuffer(uchar *DestBuf, IPRcvBuf *SrcRB, uint Size,
  33. uint Offset);
  34. extern PNDIS_BUFFER CopyFlatToNdis(PNDIS_BUFFER DestBuf, uchar *SrcBuf,
  35. uint Size, uint *Offset, uint *BytesCopied);
  36. extern PMDL CopyFlatToMdl(PMDL DestBuf, uchar *SrcBuf,
  37. uint Size, uint *Offset, uint *BytesCopied);
  38. extern void *TLRegisterProtocol(uchar Protocol, void *RcvHandler,
  39. void *XmitHandler, void *StatusHandler,
  40. void *RcvCmpltHandler, void *PnPHandler, void *ElistHandler);
  41. // Differentiate copying to an NDIS_BUFFER and an MDL for Millenniun. On
  42. // NT they are the same thing and inlined to the TDI functions.
  43. #if MILLEN
  44. NTSTATUS
  45. TcpipCopyBufferToNdisBuffer (
  46. IN PVOID SourceBuffer,
  47. IN ULONG SourceOffset,
  48. IN ULONG SourceBytesToCopy,
  49. IN PNDIS_BUFFER DestinationNdisBuffer,
  50. IN ULONG DestinationOffset,
  51. IN PULONG BytesCopied
  52. );
  53. #else // MILLEN
  54. __inline NTSTATUS
  55. TcpipCopyBufferToNdisBuffer (
  56. IN PVOID SourceBuffer,
  57. IN ULONG SourceOffset,
  58. IN ULONG SourceBytesToCopy,
  59. IN PNDIS_BUFFER DestinationNdisBuffer,
  60. IN ULONG DestinationOffset,
  61. IN PULONG BytesCopied
  62. )
  63. {
  64. return TdiCopyBufferToMdl(
  65. SourceBuffer,
  66. SourceOffset,
  67. SourceBytesToCopy,
  68. DestinationNdisBuffer,
  69. DestinationOffset,
  70. BytesCopied);
  71. }
  72. #endif // !MILLEN
  73. /*
  74. * Routine for TCP checksum. This is defined as calls through a function
  75. * pointer which is set to point at the optimal routine for this
  76. * processor implementation
  77. */
  78. typedef
  79. ULONG
  80. (* TCPXSUM_ROUTINE)(
  81. IN ULONG Checksum,
  82. IN PUCHAR Source,
  83. IN ULONG Length
  84. );
  85. ULONG
  86. tcpxsum_xmmi(
  87. IN ULONG Checksum,
  88. IN PUCHAR Source,
  89. IN ULONG Length
  90. );
  91. ULONG
  92. tcpxsum(
  93. IN ULONG Checksum,
  94. IN PUCHAR Source,
  95. IN ULONG Length
  96. );