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.

207 lines
5.7 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. ipxwan.h
  5. Abstract:
  6. This module contains the definitions of the internal control structures
  7. used by the ipxwan protocol module
  8. Author:
  9. Stefan Solomon 02/06/1996
  10. Revision History:
  11. --*/
  12. #ifndef _IPXWAN_
  13. #define _IPXWAN_
  14. // adapter control block
  15. typedef struct _ACB {
  16. ULONG AdapterIndex;
  17. CRITICAL_SECTION AdapterLock;
  18. LIST_ENTRY Linkage; // linkage in the adapter HT
  19. ULONG ConnectionId; // identifies the connection. Used to reference
  20. // the coresponding IPXCP control block
  21. ULONG RefCount; // nr of work items keeping a reference to me
  22. BOOL Discarded;
  23. BOOL SlaveTimerStarted;
  24. // IPXWAN States
  25. ULONG OperState; // UP/DOWN
  26. ULONG AcbLevel; // IPXWAN Negotiation State (Level), see below
  27. ULONG AcbRole; // Master or Slave, see below
  28. // IPXWAN Retransmission
  29. ULONG ReXmitCount;
  30. UCHAR ReXmitSeqNo;
  31. ULONG TReqTimeStamp; // time when the timer request has been sent
  32. // IPXWAN Database
  33. ULONG InterfaceType; // identifies who is this interface, see below
  34. UCHAR InternalNetNumber[4];
  35. UCHAR WNodeId[4]; // node id sent in timer request
  36. BOOL IsExtendedNodeId; // tells if we send this option
  37. UCHAR ExtendedWNodeId[4];
  38. ULONG SupportedRoutingTypes; // supported routing types flags
  39. USHORT LinkDelay;
  40. // IPXWAN Negotiated Values
  41. ULONG RoutingType;
  42. UCHAR Network[4];
  43. UCHAR LocalNode[6];
  44. UCHAR RemoteNode[6];
  45. // allocated wan net number
  46. ULONG AllocatedNetworkIndex;
  47. } ACB, *PACB;
  48. // ACB States
  49. #define ACB_TIMER_LEVEL 0
  50. #define ACB_INFO_LEVEL 1
  51. #define ACB_CONFIGURED_LEVEL 2
  52. // ACB Roles
  53. #define ACB_UNKNOWN_ROLE 0
  54. #define ACB_MASTER_ROLE 1
  55. #define ACB_SLAVE_ROLE 2
  56. // Interface Type:
  57. //
  58. // InterfaceType Local Remote
  59. //---------------------------------------------------------------
  60. // IF_TYPE_WAN_ROUTER Router Router
  61. // IF_TYPE_WAN_WORKSTATION Router Wksta
  62. // IF_TYPE_PERSONAL_WAN_ROUTER Router Pers.Router
  63. // IF_TYPE_ROUTER_WORKSTATION_DIALOUT Wksta Router
  64. // IF_TYPE_STANDALONE_WKSTA_DIALOUT Wksta Router
  65. // Routing Types Flags
  66. #define NUMBERED_RIP_FLAG 0x00000001
  67. #define ON_DEMAND_ROUTING_FLAG 0x00000002
  68. #define WORKSTATION_FLAG 0x00000004
  69. #define UNNUMBERED_RIP_FLAG 0x00000008
  70. #define IS_NUMBERED_RIP(rt) (rt) & NUMBERED_RIP_FLAG
  71. #define IS_ON_DEMAND_ROUTING(rt) (rt) & ON_DEMAND_ROUTING_FLAG
  72. #define IS_WORKSTATION(rt) (rt) & WORKSTATION_FLAG
  73. #define IS_UNNUMBERED_RIP(rt) (rt) & UNNUMBERED_RIP_FLAG
  74. #define SET_NUMBERED_RIP(rt) (rt) |= NUMBERED_RIP_FLAG
  75. #define SET_ON_DEMAND_ROUTING(rt) (rt) |= ON_DEMAND_ROUTING_FLAG
  76. #define SET_WORKSTATION(rt) (rt) |= WORKSTATION_FLAG
  77. #define SET_UNNUMBERED_RIP(rt) (rt) |= UNNUMBERED_RIP_FLAG
  78. // work item
  79. typedef enum _WORK_ITEM_TYPE {
  80. RECEIVE_PACKET_TYPE,
  81. SEND_PACKET_TYPE,
  82. WITIMER_TYPE
  83. } WORK_ITEM_TYPE, *PWORK_ITEM_TYPE;
  84. typedef struct _WORK_ITEM {
  85. LIST_ENTRY Linkage; // timer queue or worker queue
  86. WORK_ITEM_TYPE Type; // work item type
  87. DWORD DueTime; // used by the timer
  88. PACB acbp; // pointer to the referenced adapter control block
  89. // work item state and rexmit fields
  90. BOOL ReXmitPacket; // true for re-xmit packets
  91. ULONG WiState; // states of work item, see below
  92. // io & packet data
  93. ULONG AdapterIndex;
  94. DWORD IoCompletionStatus;
  95. OVERLAPPED Overlapped;
  96. ADDRESS_RESERVED AddressReserved;
  97. UCHAR Packet[1];
  98. } WORK_ITEM, *PWORK_ITEM;
  99. // work item states
  100. #define WI_INIT 0
  101. #define WI_SEND_COMPLETED 1
  102. #define WI_WAITING_TIMEOUT 2
  103. #define WI_TIMEOUT_COMPLETED 3
  104. // IPXWAN Worker Thread waitable objects definitions
  105. #define ADAPTER_NOTIFICATION_EVENT 0
  106. #define WORKERS_QUEUE_EVENT 1
  107. #define TIMER_HANDLE 2
  108. #define MAX_EVENTS 2
  109. #define MAX_WAITABLE_OBJECTS 3
  110. #define ACQUIRE_DATABASE_LOCK EnterCriticalSection(&DbaseCritSec)
  111. #define RELEASE_DATABASE_LOCK LeaveCriticalSection(&DbaseCritSec)
  112. #define ACQUIRE_QUEUES_LOCK EnterCriticalSection(&QueuesCritSec)
  113. #define RELEASE_QUEUES_LOCK LeaveCriticalSection(&QueuesCritSec)
  114. #define ACQUIRE_ADAPTER_LOCK(acbp) EnterCriticalSection(&(acbp)->AdapterLock)
  115. #define RELEASE_ADAPTER_LOCK(acbp) LeaveCriticalSection(&(acbp)->AdapterLock)
  116. // macro to assess if time1 is later then time2 when both are ulong with wrap around
  117. #define IsLater(time1, time2) (((time1) - (time2)) < MAXULONG/2)
  118. extern LIST_ENTRY TimerQueue;
  119. extern HANDLE IpxWanSocketHandle;
  120. extern HANDLE hWaitableObject[];
  121. extern CRITICAL_SECTION DbaseCritSec;
  122. extern CRITICAL_SECTION QueuesCritSec;
  123. extern LIST_ENTRY WorkersQueue;
  124. extern ULONG EnableUnnumberedWanLinks;
  125. #define REXMIT_TIMEOUT 20000 // 20 sec rexmit timeout
  126. #define MAX_REXMIT_COUNT 16
  127. #define SLAVE_TIMEOUT 60000 // 1 minute slave timeout
  128. extern DWORD (WINAPI *IpxcpGetWanNetNumber)(IN OUT PUCHAR Network,
  129. IN OUT PULONG AllocatedNetworkIndexp,
  130. IN ULONG InterfaceType);
  131. extern VOID (WINAPI *IpxcpReleaseWanNetNumber)(ULONG AllocatedNetworkIndex);
  132. extern DWORD (WINAPI *IpxcpConfigDone)(ULONG ConnectionId,
  133. PUCHAR Network,
  134. PUCHAR LocalNode,
  135. PUCHAR RemoteNode,
  136. BOOL Success);
  137. extern VOID (WINAPI *IpxcpGetInternalNetNumber)(PUCHAR Network);
  138. extern ULONG (WINAPI *IpxcpGetInterfaceType)(ULONG ConnectionId);
  139. extern DWORD (WINAPI *IpxcpGetRemoteNode)(ULONG ConnectionId,
  140. PUCHAR RemoteNode);
  141. extern BOOL (WINAPI *IpxcpIsRoute)(PUCHAR Network);
  142. #endif