home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Internet 2000 May / MICD_2000_05.iso / CBuilder5 / INSTALL / DATA1.CAB / Program_Built_Files / Include / adptif.h < prev    next >
C/C++ Source or Header  |  2000-02-01  |  5KB  |  190 lines

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