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.

143 lines
3.5 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. atkind.h
  5. Abstract:
  6. Author:
  7. Nikhil Kamkolkar (nikhilk@microsoft.com)
  8. Revision History:
  9. 22 Oct 1993 Initial Version
  10. Notes: Tab stop: 4
  11. --*/
  12. #ifndef _ATKIND_
  13. #define _ATKIND_
  14. // Different subtypes for ATP indication type.
  15. #define ATP_ALLOC_BUF 0
  16. #define ATP_USER_BUF 1
  17. #define ATP_USER_BUFX 2 // Do not indicate the packet to Atp with this.
  18. ATALK_ERROR
  19. AtalkIndAtpPkt(
  20. IN PPORT_DESCRIPTOR pPortDesc,
  21. IN PBYTE pLookahead,
  22. IN USHORT PktLen,
  23. IN OUT PUINT pXferOffset,
  24. IN PBYTE pLinkHdr,
  25. IN BOOLEAN ShortDdpHdr,
  26. OUT PBYTE SubType,
  27. OUT PBYTE * ppPacket,
  28. OUT PNDIS_PACKET * pNdisPkt);
  29. ATALK_ERROR
  30. AtalkIndAtpCacheSocket(
  31. IN struct _ATP_ADDROBJ * pAtpAddr,
  32. IN PPORT_DESCRIPTOR pPortDesc);
  33. VOID
  34. AtalkIndAtpUnCacheSocket(
  35. IN struct _ATP_ADDROBJ * pAtpAddr);
  36. // VOID
  37. // AtalkIndAtpSetupNdisBuffer(
  38. // IN OUT PATP_REQ pAtpReq,
  39. // IN ULONG MaxSinglePktSize);
  40. //
  41. #define AtalkIndAtpSetupNdisBuffer(pAtpReq, MaxSinglePktSize) \
  42. { \
  43. NDIS_STATUS ndisStatus; \
  44. PNDIS_BUFFER ndisBuffer; \
  45. USHORT seqNum = 0; \
  46. USHORT startOffset = 0; \
  47. SHORT BufLen = (SHORT)pAtpReq->req_RespBufLen;\
  48. \
  49. RtlZeroMemory(pAtpReq->req_NdisBuf, \
  50. sizeof(PVOID) * ATP_MAX_RESP_PKTS); \
  51. \
  52. while (BufLen > 0) \
  53. { \
  54. NdisCopyBuffer(&ndisStatus, \
  55. &ndisBuffer, \
  56. AtalkNdisBufferPoolHandle, \
  57. (PVOID)pAtpReq->req_RespBuf, \
  58. startOffset, \
  59. (UINT)MIN(BufLen, \
  60. (SHORT)MaxSinglePktSize)); \
  61. \
  62. if (ndisStatus != NDIS_STATUS_SUCCESS) \
  63. break; \
  64. \
  65. pAtpReq->req_NdisBuf[seqNum++] = ndisBuffer; \
  66. startOffset += (USHORT)MaxSinglePktSize; \
  67. BufLen -= (SHORT)MaxSinglePktSize; \
  68. } \
  69. }
  70. // VOID
  71. // AtalkIndAtpReleaseNdisBuffer(
  72. // IN OUT PATP_REQ pAtpReq);
  73. //
  74. #define AtalkIndAtpReleaseNdisBuffer(pAtpReq) \
  75. { \
  76. LONG _i; \
  77. \
  78. for (_i = 0; _i < ATP_MAX_RESP_PKTS; _i++) \
  79. { \
  80. if ((pAtpReq)->req_NdisBuf[_i] != NULL) \
  81. NdisFreeBuffer((pAtpReq)->req_NdisBuf[_i]); \
  82. } \
  83. }
  84. // ATALK_ERROR
  85. // AtalkIndAtpCacheLkUpSocket(
  86. // IN PATALK_ADDR pDestAddr,
  87. // OUT struct _ATP_ADDROBJ ** ppAtpAddr,
  88. // OUT ATALK_ERROR * pError);
  89. //
  90. #define AtalkIndAtpCacheLkUpSocket(pDestAddr, ppAtpAddr, pError) \
  91. { \
  92. USHORT i; \
  93. struct ATALK_CACHED_SKT *pCachedSkt; \
  94. \
  95. *(pError) = ATALK_FAILURE; \
  96. \
  97. if (((pDestAddr)->ata_Network == AtalkSktCache.ac_Network) && \
  98. ((pDestAddr)->ata_Node == AtalkSktCache.ac_Node)) \
  99. { \
  100. ACQUIRE_SPIN_LOCK_DPC(&AtalkSktCacheLock); \
  101. \
  102. for (i = 0, pCachedSkt = &AtalkSktCache.ac_Cache[0]; \
  103. i < ATALK_CACHE_SKTMAX; \
  104. i++, pCachedSkt++) \
  105. { \
  106. if ((pCachedSkt->Type == (ATALK_CACHE_INUSE | ATALK_CACHE_ATPSKT)) && \
  107. (pCachedSkt->Socket == (pDestAddr)->ata_Socket))\
  108. { \
  109. AtalkAtpAddrReferenceDpc(pCachedSkt->u.pAtpAddr,\
  110. pError); \
  111. \
  112. if (ATALK_SUCCESS(*pError)) \
  113. { \
  114. *(ppAtpAddr) = pCachedSkt->u.pAtpAddr; \
  115. } \
  116. break; \
  117. } \
  118. } \
  119. \
  120. RELEASE_SPIN_LOCK_DPC(&AtalkSktCacheLock); \
  121. } \
  122. }
  123. #endif
  124.