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.

187 lines
4.8 KiB

  1. /*++
  2. Copyright (c) 1995-1999 Microsoft Corporation
  3. Module Name:
  4. Abstract:
  5. Router interface with IPX stack (to be replaced by WinSock 2.0)
  6. Author:
  7. Vadim Eydelman
  8. Revision History:
  9. --*/
  10. #ifndef _IPX_ADAPTER_
  11. #define _IPX_ADAPTER_
  12. #if _MSC_VER > 1000
  13. #pragma once
  14. #endif
  15. typedef struct _ADDRESS_RESERVED {
  16. UCHAR Reserved[28];
  17. } ADDRESS_RESERVED, *PADDRESS_RESERVED;
  18. /*++
  19. C r e a t e S o c k e t P o r t
  20. Routine Description:
  21. Creates port to communicate over IPX socket with direct access to NIC
  22. Arguments:
  23. Socket - IPX socket number to use (network byte order)
  24. Return Value:
  25. Handle to communication port that provides NIC oriented interface
  26. to IPX stack. Returns INVALID_HANDLE_VALUE if port can not be opened
  27. --*/
  28. HANDLE WINAPI
  29. CreateSocketPort (
  30. IN USHORT Socket
  31. );
  32. /*++
  33. D e l e t e S o c k e t P o r t
  34. Routine Description:
  35. Cancel all the outstandng requests and dispose of all the resources
  36. allocated for communication port
  37. Arguments:
  38. Handle - Handle to communication port to be disposed of
  39. Return Value:
  40. NO_ERROR - success
  41. Windows error code - operation failed
  42. --*/
  43. DWORD WINAPI
  44. DeleteSocketPort (
  45. IN HANDLE Handle
  46. );
  47. /*++
  48. I p x R e c v P a c k e t
  49. Routine Description:
  50. Enqueue request to receive IPX packet.
  51. Arguments:
  52. Handle - Handle to socket port to use
  53. IpxPacket - buffer for ipx packet (complete with header)
  54. IpxPacketLength - length of the buffer
  55. pReserved - buffer to exchange NIC information with IPX stack
  56. (current implementation requires that memory allocated
  57. for this buffer is immediately followed by the
  58. IpxPacket buffer)
  59. lpOverlapped - structure to be used for async IO, fields are set
  60. as follows:
  61. Internal - Reserved, must be 0
  62. InternalHigh - Reserved, must be 0
  63. Offset - Reserved, must be 0
  64. OffsetHigh - Reserved, must be 0
  65. hEvent - event to be signalled when IO
  66. completes or NULL if CompletionRoutine
  67. is to be called
  68. CompletionRoutine - to be called when IO operation is completes
  69. Return Value:
  70. NO_ERROR - if lpOverlapped->hEvent!=NULL, then receive has
  71. successfully completed (do not need to wait on event,
  72. however it will be signalled anyway), otherwise,
  73. receive operation has started and completion routine will
  74. be called when done (possibly it has been called even
  75. before this routine returned)
  76. ERROR_IO_PENDING - only returned if lpOverlapped->hEvent!=NULL and
  77. receive could not be completed immediately, event will
  78. be signalled when operation is done:
  79. call GetOverlapedResult to retrieve result of
  80. the operation
  81. other (windows error code) - operation could not be started
  82. (completion routine won't be called/event won't be
  83. signalled)
  84. --*/
  85. DWORD WINAPI
  86. IpxRecvPacket (
  87. IN HANDLE Handle,
  88. OUT PUCHAR IpxPacket,
  89. IN ULONG IpxPacketLength,
  90. OUT PADDRESS_RESERVED lpReserved,
  91. IN LPOVERLAPPED lpOverlapped,
  92. IN LPOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine
  93. );
  94. /* Use this to retrieve NIC index once IO completes */
  95. #define GetNicIdx(pReserved) ((ULONG)*((USHORT *)(pReserved+2)))
  96. /*++
  97. I p x S e n d P a c k e t
  98. Routine Description:
  99. Enqueue request to send IPX packet.
  100. Arguments:
  101. Handle - Handle to socket port to use
  102. AdapterIdx - NIC index on which to send
  103. IpxPacket - IPX packet complete with header
  104. IpxPacketLength - length of the packet
  105. pReserved - buffer to exchange NIC info with IPX stack
  106. lpOverlapped - structure to be used for async IO, fields are set
  107. as follows:
  108. Internal - Reserved, must be 0
  109. InternalHigh - Reserved, must be 0
  110. Offset - Reserved, must be 0
  111. OffsetHigh - Reserved, must be 0
  112. hEvent - event to be signalled when IO
  113. completes or NULL if CompletionRoutine
  114. is to be called
  115. CompletionRoutine - to be called when IO operation is completes
  116. Return Value:
  117. NO_ERROR - if lpOverlapped->hEvent!=NULL, then send has
  118. successfully completed (do not need to wait on event,
  119. however it will be signalled anyway), otherwise,
  120. send operation has started and completion routine will
  121. be called when done (possibly it has been called even
  122. before this routine returned)
  123. ERROR_IO_PENDING - only returned if lpOverlapped->hEvent!=NULL and
  124. send could not be completed immediately, event will
  125. be signalled when operation is done:
  126. call GetOverlapedResult to retrieve result of
  127. the operation
  128. other (windows error code) - operation could not be started
  129. (completion routine won't be called/event won't be
  130. signalled)
  131. --*/
  132. DWORD WINAPI
  133. IpxSendPacket (
  134. IN HANDLE Handle,
  135. IN ULONG AdapterIdx,
  136. IN PUCHAR IpxPacket,
  137. IN ULONG IpxPacketLength,
  138. IN PADDRESS_RESERVED lpReserved,
  139. IN LPOVERLAPPED lpOverlapped,
  140. IN LPOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine
  141. );
  142. #endif // _IPX_ADAPTER_