Leaked source code of windows server 2003
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.

1360 lines
45 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. atmarp.h
  5. Abstract:
  6. Structure definitions and function templates for the ATM ARP module.
  7. Author:
  8. Revision History:
  9. Who When What
  10. -------- -------- ----
  11. arvindm 05-17-96 created
  12. Notes:
  13. --*/
  14. #ifndef __ATMARP_H_INCLUDED
  15. #define __ATMARP_H_INCLUDED
  16. #include <ipexport.h>
  17. #include "aaqos.h"
  18. typedef IPAddr IP_ADDRESS, *PIP_ADDRESS;
  19. typedef IPMask IP_MASK, *PIP_MASK;
  20. #define IP_LOCAL_BCST 0xFFFFFFFF // The local broadcast IP address
  21. #define IP_CLASSD_MIN 0xE0 // Min class D address (NETWORK byte order)
  22. #define IP_CLASSD_MASK 0xFFFFFF0F // Mask representing the entire class D
  23. // range (NETWORK byte order).
  24. // (0xE0|0xFFFFFF0F) = 0xFFFFFFEF =
  25. // 239.255.255.255 in network byte order.
  26. //
  27. // IP address list entry. Used to prepare a list of local IP addresses.
  28. //
  29. typedef struct _IP_ADDRESS_ENTRY
  30. {
  31. struct _IP_ADDRESS_ENTRY * pNext; // Next in list
  32. IP_ADDRESS IPAddress; // The Address
  33. IP_MASK IPMask; // Mask for the above.
  34. BOOLEAN IsRegistered; // Registered with ARP Server?
  35. BOOLEAN IsFirstRegistration; // Is this the first time
  36. // this is being regd?
  37. } IP_ADDRESS_ENTRY, *PIP_ADDRESS_ENTRY;
  38. //
  39. // Proxy IP address list entry. Used to prepare a list of IP addresses for
  40. // which we act as an ARP proxy.
  41. //
  42. typedef struct _PROXY_ARP_ENTRY
  43. {
  44. struct _PROXY_ARP_ENTRY * pNext; // Next in list
  45. IP_ADDRESS IPAddress; // The Address
  46. IP_MASK IPMask;
  47. } PROXY_ARP_ENTRY, *PPROXY_ARP_ENTRY;
  48. //
  49. // Forward references
  50. //
  51. struct _ATMARP_VC ;
  52. struct _ATMARP_IP_ENTRY ;
  53. struct _ATMARP_ATM_ENTRY ;
  54. #ifdef IPMCAST
  55. struct _ATMARP_IPMC_JOIN_ENTRY ;
  56. struct _ATMARP_IPMC_ATM_ENTRY ;
  57. struct _ATMARP_IPMC_ATM_INFO ;
  58. #endif // IPMCAST
  59. struct _ATMARP_INTERFACE ;
  60. struct _ATMARP_ADAPTER ;
  61. #ifdef ATMARP_WMI
  62. struct _ATMARP_IF_WMI_INFO ;
  63. #endif
  64. //
  65. // Server address list entry. Used to prepare a list of ARP/MARS servers
  66. // that we try to connect to.
  67. //
  68. typedef struct _ATMARP_SERVER_ENTRY
  69. {
  70. struct _ATMARP_SERVER_ENTRY * pNext; // Next in list
  71. ATM_ADDRESS ATMAddress; // Address of the server
  72. ATM_ADDRESS ATMSubaddress; // Used only if ATMAddress is E.164
  73. struct _ATMARP_ATM_ENTRY * pAtmEntry; // Info about this ATM destination
  74. ULONG Flags; // State information (see below)
  75. } ATMARP_SERVER_ENTRY, *PATMARP_SERVER_ENTRY;
  76. #define NULL_PATMARP_SERVER_ENTRY ((PATMARP_SERVER_ENTRY)NULL)
  77. //
  78. // Server list.
  79. //
  80. typedef struct _ATMARP_SERVER_LIST
  81. {
  82. PATMARP_SERVER_ENTRY pList; // List of servers
  83. ULONG ListSize; // Size of above list
  84. } ATMARP_SERVER_LIST, *PATMARP_SERVER_LIST;
  85. #define NULL_PATMARP_SERVER_LIST ((PATMARP_SERVER_LIST)NULL)
  86. //
  87. // ------------------------ Timer Management ------------------------
  88. //
  89. struct _ATMARP_TIMER ;
  90. struct _ATMARP_TIMER_LIST ;
  91. //
  92. // Timeout Handler prototype
  93. //
  94. typedef
  95. VOID
  96. (*ATMARP_TIMEOUT_HANDLER)(
  97. IN struct _ATMARP_TIMER * pTimer,
  98. IN PVOID Context
  99. );
  100. //
  101. // An ATMARP_TIMER structure is used to keep track of each timer
  102. // in the ATMARP module.
  103. //
  104. typedef struct _ATMARP_TIMER
  105. {
  106. struct _ATMARP_TIMER * pNextTimer;
  107. struct _ATMARP_TIMER * pPrevTimer;
  108. struct _ATMARP_TIMER * pNextExpiredTimer; // Used to chain expired timers
  109. struct _ATMARP_TIMER_LIST * pTimerList; // NULL iff this timer is inactive
  110. ULONG Duration; // In seconds
  111. ULONG LastRefreshTime;
  112. ATMARP_TIMEOUT_HANDLER TimeoutHandler;
  113. PVOID Context; // To be passed to timeout handler
  114. ULONG State;
  115. } ATMARP_TIMER, *PATMARP_TIMER;
  116. //
  117. // NULL pointer to ATMARP Timer
  118. //
  119. #define NULL_PATMARP_TIMER ((PATMARP_TIMER)NULL)
  120. #define ATMARP_TIMER_STATE_IDLE 'ELDI'
  121. #define ATMARP_TIMER_STATE_RUNNING ' NUR'
  122. #define ATMARP_TIMER_STATE_EXPIRING 'GPXE'
  123. #define ATMARP_TIMER_STATE_EXPIRED 'DPXE'
  124. //
  125. // Control structure for a timer wheel. This contains all information
  126. // about the class of timers that it implements.
  127. //
  128. typedef struct _ATMARP_TIMER_LIST
  129. {
  130. #if DBG
  131. ULONG atl_sig;
  132. #endif // DBG
  133. PATMARP_TIMER pTimers; // List of timers
  134. ULONG TimerListSize; // Length of above
  135. ULONG CurrentTick; // Index into above
  136. ULONG TimerCount; // Number of running timers
  137. ULONG MaxTimer; // Max timeout value for this
  138. NDIS_TIMER NdisTimer; // System support
  139. UINT TimerPeriod; // Interval between ticks
  140. PVOID ListContext; // Used as a back pointer to the
  141. // Interface structure
  142. } ATMARP_TIMER_LIST, *PATMARP_TIMER_LIST;
  143. #if DBG
  144. #define atl_signature 'ATL '
  145. #endif // DBG
  146. //
  147. // Timer Classes
  148. //
  149. typedef enum
  150. {
  151. AAT_CLASS_SHORT_DURATION,
  152. AAT_CLASS_LONG_DURATION,
  153. AAT_CLASS_MAX
  154. } ATMARP_TIMER_CLASS;
  155. //
  156. // ----------------------- ATM Address Entry -----------------------------
  157. //
  158. // All information about an ATM destination, and VCs to it. This is used
  159. // for both Unicast destinations (a single ATM endstation) and for Multicast
  160. // destinations (multiple ATM endstations).
  161. //
  162. // Unicast:
  163. // -------
  164. // There could be more than one VC going to this ATM destination, because
  165. // of use of different QoS on each. In the case of unicast destinations,
  166. // one or more ARP Table Entries (see below) could point to this entry,
  167. // because more than one IP address could map to this ATM address.
  168. //
  169. // Multicast:
  170. // ---------
  171. // For simplicity, we restrict the number of ARP Table Entries pointing to
  172. // this entry to atmost 1 in the multicast case. Also, this entry would be
  173. // linked to a single VC, of type SVC-PMP-Outgoing.
  174. //
  175. // Reference Count: we add One to the RefCount for each of the following:
  176. // - Each VC on its VcList
  177. // - Each ARP IP Entry that points to it
  178. // - Each Packet queued on its packet list
  179. // - For the duration another structure (e.g. ARP Server Entry) points to it
  180. //
  181. typedef enum
  182. {
  183. AE_REFTYPE_TMP,
  184. AE_REFTYPE_MCAE,
  185. AE_REFTYPE_IE,
  186. AE_REFTYPE_VC,
  187. AE_REFTYPE_IF,
  188. AE_REFTYPE_COUNT // Must be last
  189. } AE_REFTYPE;
  190. typedef struct _ATMARP_ATM_ENTRY
  191. {
  192. #if DBG
  193. ULONG aae_sig; // Signature for debugging
  194. #endif
  195. struct _ATMARP_ATM_ENTRY * pNext; // Next Entry on this Interface
  196. ULONG RefCount; // References to this struct
  197. ULONG Flags; // State and Type information
  198. ATMARP_LOCK Lock;
  199. struct _ATMARP_INTERFACE * pInterface; // Back pointer
  200. struct _ATMARP_VC * pVcList; // List of VCs to this ATM address
  201. struct _ATMARP_VC * pBestEffortVc; // One of the Best Effort VCs here
  202. struct _ATMARP_IP_ENTRY * pIpEntryList; // List of IP entries that
  203. // point to this entry
  204. //
  205. // The following two are used in the case of a unicast destination
  206. //
  207. ATM_ADDRESS ATMAddress; // "ATM Number" in the RFC
  208. ATM_ADDRESS ATMSubaddress; // Used only if ATMAddress is E.164
  209. #ifdef IPMCAST
  210. //
  211. // If this is a multicast destination, the following points to additional
  212. // information.
  213. //
  214. struct _ATMARP_IPMC_ATM_INFO * pMcAtmInfo; // Additional info for multicast
  215. #endif // IPMCAST
  216. #if DBG
  217. UCHAR Refs[AE_REFTYPE_COUNT];
  218. #endif //DBG
  219. } ATMARP_ATM_ENTRY, *PATMARP_ATM_ENTRY;
  220. #if DBG
  221. // ATM Address Entry
  222. #define aae_signature 'AAAE'
  223. #endif
  224. //
  225. // NULL pointer to ATMARP ATM Entry
  226. //
  227. #define NULL_PATMARP_ATM_ENTRY ((PATMARP_ATM_ENTRY)NULL)
  228. //
  229. // Definitions for Flags in ATMARP ATM ENTRY
  230. //
  231. #define AA_ATM_ENTRY_STATE_MASK 0x00000003
  232. #define AA_ATM_ENTRY_IDLE 0x00000000 // Just created
  233. #define AA_ATM_ENTRY_ACTIVE 0x00000001 // Installed into the database
  234. #define AA_ATM_ENTRY_CLOSING 0x00000002
  235. #define AA_ATM_ENTRY_TYPE_MASK 0x00000010
  236. #define AA_ATM_ENTRY_TYPE_UCAST 0x00000000 // Unicast
  237. #define AA_ATM_ENTRY_TYPE_NUCAST 0x00000010 // Non-unicast
  238. #ifdef IPMCAST
  239. //
  240. // ---------------------- ATM-PMP Info for an ATM Entry ---------------------
  241. //
  242. // This contains additional information specific to a multi-point ATM destination,
  243. // and is attached to an ATM Entry.
  244. //
  245. typedef struct _ATMARP_IPMC_ATM_INFO
  246. {
  247. ULONG Flags; // State info
  248. struct _ATMARP_IPMC_ATM_ENTRY * pMcAtmEntryList;// List of ATM endstations (multicast)
  249. struct _ATMARP_IPMC_ATM_ENTRY * pMcAtmMigrateList;// List being migrated to
  250. ULONG NumOfEntries; // Size of above list
  251. ULONG ActiveLeaves; // <= NumOfMcEntries
  252. ULONG TransientLeaves;// < NumOfMcEntries
  253. } ATMARP_IPMC_ATM_INFO, *PATMARP_IPMC_ATM_INFO;
  254. #define NULL_PATMARP_IPMC_ATM_INFO ((PATMARP_IPMC_ATM_INFO)NULL)
  255. #define AA_IPMC_AI_CONN_STATE_MASK 0x0000000f
  256. #define AA_IPMC_AI_CONN_NONE 0x00000000 // No connection/VC exists
  257. #define AA_IPMC_AI_CONN_WACK_MAKE_CALL 0x00000001 // Outgoing call in progress
  258. #define AA_IPMC_AI_CONN_ACTIVE 0x00000002 // Outgoing PMP call established
  259. #define AA_IPMC_AI_CONN_TEMP_FAILURE 0x00000004 // Transient failure seen on MakeCall
  260. #define AA_IPMC_AI_CONN_UPDATE_MASK 0x000000f0
  261. #define AA_IPMC_AI_NO_UPDATE 0x00000000 // No connection update pending
  262. #define AA_IPMC_AI_WANT_UPDATE 0x00000010 // Connection needs update
  263. #define AA_IPMC_AI_BEING_UPDATED 0x00000020 // Connection is being updated
  264. //
  265. //
  266. // ---------------------- ATM Entry for a Multicast leaf --------------------
  267. //
  268. // This contains information about a single element in the list of ATM endstations
  269. // that a Class D IP Address resolves to. This participates as a leaf in the PMP
  270. // connection we set up for packets sent to this multicast group.
  271. //
  272. typedef struct _ATMARP_IPMC_ATM_ENTRY
  273. {
  274. #if DBG
  275. ULONG ame_sig; // Signature for debugging
  276. #endif // DBG
  277. struct _ATMARP_IPMC_ATM_ENTRY * pNextMcAtmEntry;// Next member of multicast group
  278. ULONG Flags; // State and other info
  279. NDIS_HANDLE NdisPartyHandle;// NDIS handle for this leaf
  280. struct _ATMARP_ATM_ENTRY * pAtmEntry; // Back pointer
  281. ATM_ADDRESS ATMAddress; // "ATM Number" in the RFC
  282. ATM_ADDRESS ATMSubaddress; // Used only if ATMAddress is E.164
  283. ATMARP_TIMER Timer; // Used to retry connecting
  284. } ATMARP_IPMC_ATM_ENTRY, *PATMARP_IPMC_ATM_ENTRY;
  285. #if DBG
  286. #define ame_signature 'AAME'
  287. #endif // DBG
  288. //
  289. // NULL pointer to a Multicast ATM Entry
  290. //
  291. #define NULL_PATMARP_IPMC_ATM_ENTRY ((PATMARP_IPMC_ATM_ENTRY)NULL)
  292. //
  293. // Definitions for Flags in Multicast ATM Entry
  294. //
  295. #define AA_IPMC_AE_GEN_STATE_MASK 0x0000000f
  296. #define AA_IPMC_AE_VALID 0x00000000 // This leaf is valid
  297. #define AA_IPMC_AE_INVALID 0x00000001 // Will be trimmed unless revalidated
  298. #define AA_IPMC_AE_TERMINATING 0x00000002 // This leaf being terminated
  299. #define AA_IPMC_AE_CONN_STATE_MASK 0x00000ff0
  300. #define AA_IPMC_AE_CONN_DISCONNECTED 0x00000000
  301. #define AA_IPMC_AE_CONN_WACK_ADD_PARTY 0x00000010 // Waiting for AddParty to complete
  302. #define AA_IPMC_AE_CONN_ACTIVE 0x00000020 // Active leaf of PMP connection
  303. #define AA_IPMC_AE_CONN_WACK_DROP_PARTY 0x00000040 // Waiting for DropParty to complete
  304. #define AA_IPMC_AE_CONN_TEMP_FAILURE 0x00000080 // AddParty failed, will try later
  305. #define AA_IPMC_AE_CONN_RCV_DROP_PARTY 0x00000100 // Incoming Drop Party seen
  306. //
  307. // ----------------- ATMARP IP Multicast Join Entry -----------------
  308. //
  309. // One of these structures is maintained for each Class D IP address
  310. // that has been "AddAddress"ed by the IP layer, i.e., each multicast
  311. // group that we have Joined. This can be considered as the "receive
  312. // side" data structure for a Class D IP address. We have different
  313. // structures for the transmit and receive sides of a Multicast group
  314. // because this host can participate exclusively on one or the other,
  315. // and the information needed is very different. Transmit side
  316. // information is maintained in an ATMARP_IP_ENTRY and associated
  317. // structures.
  318. //
  319. typedef struct _ATMARP_IPMC_JOIN_ENTRY
  320. {
  321. #if DBG
  322. ULONG aamj_sig;
  323. #endif // DBG
  324. struct _ATMARP_IPMC_JOIN_ENTRY *pNextJoinEntry; // Next IP Address Joined on this IF
  325. ULONG Flags; // State info (see below)
  326. ULONG RefCount;
  327. ULONG JoinRefCount; // # of AddAddress - # of DelAddress
  328. struct _ATMARP_INTERFACE * pInterface; // Back pointer
  329. IP_ADDRESS IPAddress; // Class D IP address we've joined
  330. IP_MASK Mask; // Defines range of this join entry.
  331. ATMARP_TIMER Timer; // Waiting for Join/Leave completion
  332. ULONG RetriesLeft; // For Joining/Leaving
  333. #if DBG
  334. ULONG LastIncrRef; // For debugging
  335. ULONG LastDecrRef;
  336. #endif
  337. } ATMARP_IPMC_JOIN_ENTRY, *PATMARP_IPMC_JOIN_ENTRY;
  338. #if DBG
  339. #define aamj_signature 'AAMJ'
  340. #endif // DBG
  341. //
  342. // NULL pointer to IPMC Join Entry
  343. //
  344. #define NULL_PATMARP_IPMC_JOIN_ENTRY ((PATMARP_IPMC_JOIN_ENTRY)NULL)
  345. //
  346. // Definitions for Flags in a Join Entry
  347. //
  348. #define AA_IPMC_JE_STATE_MASK 0x000000FF
  349. #define AA_IPMC_JE_STATE_UNUSED 0x00000000
  350. #define AA_IPMC_JE_STATE_PENDING 0x00000001 // Waiting for a CMI to be assigned to us
  351. #define AA_IPMC_JE_STATE_JOINING 0x00000002 // Have sent MARS_JOIN
  352. #define AA_IPMC_JE_STATE_JOINED 0x00000004 // Seen copy of MARS_JOIN (== ack)
  353. #define AA_IPMC_JE_STATE_LEAVING 0x00000008 // Have sent MARS_LEAVE
  354. #endif // IPMCAST
  355. //
  356. // ---------------------------- ARP Table (IP) Entry ------------------------
  357. //
  358. // Contains information about one remote IP address.
  359. //
  360. // There is atmost one ARP Table entry for a given IP address.
  361. //
  362. // The IP Entry participates in two lists:
  363. // (1) A list of all entries that hash to the same bucket in the ARP Table
  364. // (2) A list of all entries that resolve to the same ATM Address -- this
  365. // is only if the IP address is unicast.
  366. //
  367. // A pointer to this structure is also used as our context value in the
  368. // Route Cache Entry prepared by the higher layer protocol(s).
  369. //
  370. // Reference Count: We add one to its ref count for each of the following:
  371. // - Each Route Cache entry that points to this entry
  372. // - For the duration an active timer exists on this Entry
  373. // - For the duration the entry belongs to the list of IP entries linked
  374. // to an ATM Entry.
  375. //
  376. typedef enum
  377. {
  378. IE_REFTYPE_TMP,
  379. IE_REFTYPE_RCE,
  380. IE_REFTYPE_TIMER,
  381. IE_REFTYPE_AE,
  382. IE_REFTYPE_TABLE,
  383. IE_REFTYPE_COUNT // Must be last
  384. } IE_REFTYPE;
  385. typedef struct _ATMARP_IP_ENTRY
  386. {
  387. #if DBG
  388. ULONG aip_sig; // Signature for debugging
  389. #endif
  390. IP_ADDRESS IPAddress; // IP Address
  391. struct _ATMARP_IP_ENTRY * pNextEntry; // Next in hash list
  392. struct _ATMARP_IP_ENTRY * pNextToAtm; // List of entries pointing to
  393. // the same ATM Entry
  394. ULONG Flags; // State and Type information
  395. ULONG RefCount; // References to this struct
  396. ATMARP_LOCK Lock;
  397. struct _ATMARP_INTERFACE * pInterface; // Back pointer
  398. PATMARP_ATM_ENTRY pAtmEntry; // Pointer to all ATM info
  399. #ifdef IPMCAST
  400. struct _ATMARP_IP_ENTRY * pNextMcEntry; // Next "higher" Multicast IP Entry
  401. USHORT NextMultiSeq; // Sequence Number expected
  402. // in the next MULTI
  403. USHORT Filler;
  404. #endif // IPMCAST
  405. ATMARP_TIMER Timer; // Timers are: (all exclusive)
  406. // - Aging timer
  407. // - Waiting for ARP reply
  408. // - Waiting for InARP reply
  409. // - Delay after NAK
  410. // - Waiting for MARS MULTI
  411. // - Delay before marking for reval
  412. ULONG RetriesLeft;
  413. PNDIS_PACKET PacketList; // List of packets waiting to be sent
  414. RouteCacheEntry * pRCEList; // List of Route Cache Entries
  415. // associated with this entry.
  416. #ifdef CUBDD
  417. SINGLE_LIST_ENTRY PendingIrpList; // List of IRP's waiting for
  418. // this IP address to be resolved.
  419. #endif // CUBDD
  420. #if DBG
  421. UCHAR Refs[IE_REFTYPE_COUNT];
  422. #endif // DBG
  423. } ATMARP_IP_ENTRY, *PATMARP_IP_ENTRY;
  424. #if DBG
  425. // ATM ARP IP Entry
  426. #define aip_signature 'AAIP'
  427. #endif
  428. //
  429. // NULL pointer to ATMARP IP Entry
  430. //
  431. #define NULL_PATMARP_IP_ENTRY ((PATMARP_IP_ENTRY)NULL)
  432. //
  433. // Definitions for Flags in ATMARP IP ENTRY
  434. //
  435. // A pre-condition for sending data to a destination governed by a
  436. // table entry is: (Flags & AA_IP_ENTRY_STATE_MASK) == AA_IP_ENTRY_RESOLVED
  437. //
  438. #define AA_IP_ENTRY_STATE_MASK 0x0000000f
  439. #define AA_IP_ENTRY_IDLE 0x00000000 // Just created/ ok to del
  440. #define AA_IP_ENTRY_IDLE2 0x00000001 // In arp table but unused.
  441. #define AA_IP_ENTRY_ARPING 0x00000002 // Waiting for ARP reply
  442. #define AA_IP_ENTRY_INARPING 0x00000003 // Waiting for InARP reply
  443. #define AA_IP_ENTRY_RESOLVED 0x00000004 // Resolved IP -> ATM Address
  444. #define AA_IP_ENTRY_COMM_ERROR 0x00000005 // Seen abnormal close on attached VC
  445. #define AA_IP_ENTRY_ABORTING 0x00000006 // Abort in progress
  446. #define AA_IP_ENTRY_AGED_OUT 0x00000007 // Has aged out
  447. #define AA_IP_ENTRY_SEEN_NAK 0x00000008 // NAK delay timer started
  448. #ifdef IPMCAST
  449. #define AA_IP_ENTRY_MC_VALIDATE_MASK 0x00000600
  450. #define AA_IP_ENTRY_MC_NO_REVALIDATION 0x00000000 // No revalidation in progress/needed
  451. #define AA_IP_ENTRY_MC_REVALIDATE 0x00000200 // Marked as needing Revalidation
  452. #define AA_IP_ENTRY_MC_REVALIDATING 0x00000400 // Revalidation in progress
  453. #define AA_IP_ENTRY_MC_RESOLVE_MASK 0x00003800
  454. #define AA_IP_ENTRY_MC_IDLE 0x00000000
  455. #define AA_IP_ENTRY_MC_AWAIT_MULTI 0x00000800 // Awaiting more MARS_MULTI replies
  456. #define AA_IP_ENTRY_MC_DISCARDING_MULTI 0x00001000 // Discard mode because of error
  457. #define AA_IP_ENTRY_MC_RESOLVED 0x00002000 // All MARS_MULTIs received
  458. #define AA_IP_ENTRY_ADDR_TYPE_MASK 0x00004000
  459. #define AA_IP_ENTRY_ADDR_TYPE_UCAST 0x00000000 // Unicast
  460. #define AA_IP_ENTRY_ADDR_TYPE_NUCAST 0x00004000 // Non-unicast (e.g. Class D)
  461. #endif // IPMCAST
  462. #define AA_IP_ENTRY_TYPE_MASK 0x20000000
  463. #define AA_IP_ENTRY_IS_STATIC 0x20000000 // Static entry (no aging on this)
  464. #define ATMARP_TABLE_SIZE 127
  465. //
  466. // --------------------- ATMARP Virtual Circuit (VC) ---------------------
  467. //
  468. // One of these is used for each call terminated at the IP/ATM client.
  469. // Creation and deletion of this structure is linked to NdisCoCreateVc and
  470. // NdisCoDeleteVc.
  471. //
  472. // An ATMARP_VC structure becomes linked to an ATMARP_ATM_ENTRY when (and only
  473. // when) we determine the ATM address(es) of the remote ATM endstation.
  474. // For outgoing calls, we would have determined this before making the call,
  475. // and for incoming calls, we learn this either through the Calling Address
  476. // (for SVCs) or via InATMARP (for PVCs). "Incoming" PVCs are kept in the
  477. // "Unresolved VC" list in the Interface structure, until the ATM address
  478. // of the other end is resolved.
  479. //
  480. // The FilterSpec and FlowSpec hooks are for support of multiple VCs of
  481. // varying QoS between (possibly the same pair of) IP stations. Only IP
  482. // packets that match the FilterSpec will be transmitted on this VC.
  483. //
  484. // Reference Count: we add One to the RefCount for each of the following:
  485. // - For the duration this VC is linked to an ATM entry (or Unresolved VC list)
  486. // - For the duration this VC is an NDIS VC (not DeleteVc'ed)
  487. // - For the duration a call exists (in progress/active) on this VC
  488. // - For the duration an active timer exists on this VC
  489. //
  490. typedef struct _ATMARP_VC
  491. {
  492. #if DBG
  493. ULONG avc_sig;
  494. #endif
  495. struct _ATMARP_VC * pNextVc; // Next VC in list
  496. ULONG RefCount; // References to this struct
  497. ULONG Flags; // State and Type information
  498. ULONG OutstandingSends;// Sent packets awaiting completion
  499. ATMARP_LOCK Lock;
  500. NDIS_HANDLE NdisVcHandle; // For NDIS calls
  501. struct _ATMARP_INTERFACE * pInterface; // Back pointer to ARP Interface
  502. PATMARP_ATM_ENTRY pAtmEntry; // Back pointer to ATM Entry
  503. PNDIS_PACKET PacketList; // List of packets waiting to be sent
  504. ATMARP_TIMER Timer; // VC Timers are (exclusive):
  505. // - Waiting for InARP reply
  506. // - Aging
  507. ULONG RetriesLeft; // In case the timer runs out
  508. #ifdef GPC
  509. PVOID FlowHandle; // Points to Flow Info struct
  510. #endif // GPC
  511. ATMARP_FILTER_SPEC FilterSpec; // Filter Spec (Protocol, port)
  512. ATMARP_FLOW_SPEC FlowSpec; // Flow Spec (QoS etc) for this conn
  513. } ATMARP_VC, *PATMARP_VC;
  514. #if DBG
  515. // ATM ARP VC
  516. #define avc_signature 'AAVC'
  517. #endif
  518. //
  519. // NULL pointer to ATMARP VC
  520. //
  521. #define NULL_PATMARP_VC ((PATMARP_VC)NULL)
  522. //
  523. // Definitions for ATMARP VC flags. The following information is kept
  524. // here:
  525. // - Is this VC an SVC or PVC
  526. // - Is this created (owned) by the ATMARP module or the Call Manager
  527. // - Call State: Incoming in progress, Outgoing in progress, Active,
  528. // Close in progress, or Idle
  529. //
  530. // Bits 0 and 1 for "Type"
  531. #define AA_VC_TYPE_MASK 0x00000003
  532. #define AA_VC_TYPE_UNUSED 0x00000000
  533. #define AA_VC_TYPE_SVC 0x00000001
  534. #define AA_VC_TYPE_PVC 0x00000002
  535. // Bits 2 and 3 for "Owner"
  536. #define AA_VC_OWNER_MASK 0x0000000C
  537. #define AA_VC_OWNER_IS_UNKNOWN 0x00000000
  538. #define AA_VC_OWNER_IS_ATMARP 0x00000004 // NdisClCreateVc done
  539. #define AA_VC_OWNER_IS_CALLMGR 0x00000008 // CreateVcHandler done
  540. // Bits 4, 5, 6, 7 for Call State
  541. #define AA_VC_CALL_STATE_MASK 0x000000F0
  542. #define AA_VC_CALL_STATE_IDLE 0x00000000
  543. #define AA_VC_CALL_STATE_INCOMING_IN_PROGRESS 0x00000010 // Wait for CallConnected
  544. #define AA_VC_CALL_STATE_OUTGOING_IN_PROGRESS 0x00000020 // Wait for MakeCallCmpl
  545. #define AA_VC_CALL_STATE_ACTIVE 0x00000040
  546. #define AA_VC_CALL_STATE_CLOSE_IN_PROGRESS 0x00000080 // Wait for CloseCallCmpl
  547. // Bit 8 for Aging
  548. #define AA_VC_AGING_MASK 0x00000100
  549. #define AA_VC_NOT_AGED_OUT 0x00000000
  550. #define AA_VC_AGED_OUT 0x00000100
  551. // Bit 9 to indicate whether an abnormal Close has happened
  552. #define AA_VC_CLOSE_TYPE_MASK 0x00000200
  553. #define AA_VC_CLOSE_NORMAL 0x00000000
  554. #define AA_VC_CLOSE_ABNORMAL 0x00000200
  555. // Bits 10 and 11 to indicate any ARP operation in progress
  556. #define AA_VC_ARP_STATE_MASK 0x00000C00
  557. #define AA_VC_ARP_STATE_IDLE 0x00000000
  558. #define AA_VC_INARP_IN_PROGRESS 0x00000400
  559. // Bits 12 and 13 to indicate whether we are closing this VC, or if we need to
  560. #define AA_VC_CLOSE_STATE_MASK 0x00003000
  561. #define AA_VC_CLOSE_STATE_CLOSING 0x00001000
  562. // Bit 14 to indicate VC Connection type (point to point or point to
  563. // multi-point)
  564. #define AA_VC_CONN_TYPE_MASK 0x00004000
  565. #define AA_VC_CONN_TYPE_P2P 0x00000000 // Point to Point
  566. #define AA_VC_CONN_TYPE_PMP 0x00004000 // Point to Multipoint
  567. // Bit 15 to indicate if this VC has been unlinked from a GPC QOS CFINFO
  568. #define AA_VC_GPC_MASK 0x00008000
  569. #define AA_VC_GPC_IS_UNLINKED_FROM_FLOW 0x00008000
  570. //
  571. // ---- ATMARP Buffer Tracker ----
  572. //
  573. // Keeps track of allocation information for a pool of buffers. A list
  574. // of these structures is used to maintain info about a dynamically
  575. // growable pool of buffers (e.g. for ARP header buffers)
  576. //
  577. typedef struct _ATMARP_BUFFER_TRACKER
  578. {
  579. struct _ATMARP_BUFFER_TRACKER * pNext; // in a list of trackers
  580. NDIS_HANDLE NdisHandle; // for Buffer Pool
  581. PUCHAR pPoolStart; // start of memory chunk allocated
  582. // from the system
  583. } ATMARP_BUFFER_TRACKER, *PATMARP_BUFFER_TRACKER;
  584. //
  585. // NULL pointer to ATMARP Buffer tracker structure
  586. //
  587. #define NULL_PATMARP_BUFFER_TRACKER ((PATMARP_BUFFER_TRACKER)NULL)
  588. //
  589. // ---- ATMARP Header Pool -----
  590. //
  591. // Keeps track of allocation information for a pool of Header buffers.
  592. // Header buffers are used to tack on LLC/SNAP headers to transmitted
  593. // IP packets. Each Header pool contains a number of fixed-size buffers.
  594. // We use one header pool for IP Unicast headers, and one for IP Multicast
  595. // headers.
  596. //
  597. typedef struct _ATMARP_HEADER_POOL
  598. {
  599. SLIST_HEADER HeaderBufList; // Free list of header buffers
  600. ULONG HeaderBufSize; // Size of each header buffer
  601. ULONG MaxHeaderBufs; // Max header buffers we can allocate
  602. ULONG CurHeaderBufs; // Current header buffers allocated
  603. PATMARP_BUFFER_TRACKER pHeaderTrkList; // Info about allocated header buffers
  604. } ATMARP_HEADER_POOL, *PATMARP_HEADER_POOL;
  605. #define NULL_PATMARP_HEADER_POOL ((PATMARP_HEADER_POOL)NULL)
  606. //
  607. // Packet header types.
  608. //
  609. // IMPORTANT: Keep _MAX and _NONE at the end of this list!
  610. //
  611. typedef enum
  612. {
  613. AA_HEADER_TYPE_UNICAST,
  614. AA_HEADER_TYPE_NUNICAST,
  615. AA_HEADER_TYPE_MAX,
  616. AA_HEADER_TYPE_NONE
  617. } AA_HEADER_TYPE;
  618. //
  619. // ------------------------ ATMARP SAP --------------------------------
  620. //
  621. // Each of these structures maintains information about a SAP attached
  622. // to an LIS. Normally the ATMARP client would register just one SAP
  623. // with the Call manager, with BLLI fields set so that all IP/ATM calls
  624. // are directed to this client. However, we may support services (e.g.
  625. // DHCP) over IP/ATM that are assigned well-known ATM addresses, i.e.
  626. // addresses other than the one registered with the switch. These form
  627. // additional SAPs we register with the Call Manager. In addition to
  628. // registering these addresses as SAPs, we also request the Call Manager
  629. // to register them via ILMI with the switch, so that the network
  630. // directs calls to these addresses to us.
  631. //
  632. typedef struct _ATMARP_SAP
  633. {
  634. #if DBG
  635. ULONG aas_sig;
  636. #endif
  637. struct _ATMARP_SAP * pNextSap; // in list of SAPs
  638. struct _ATMARP_INTERFACE * pInterface; // back pointer
  639. NDIS_HANDLE NdisSapHandle;
  640. ULONG Flags; // state information
  641. PCO_SAP pInfo; // SAP characteristics.
  642. } ATMARP_SAP, *PATMARP_SAP;
  643. #if DBG
  644. #define aas_signature 'AAS '
  645. #endif // DBG
  646. //
  647. // NULL pointer to ATMARP SAP
  648. //
  649. #define NULL_PATMARP_SAP ((PATMARP_SAP)NULL)
  650. //
  651. // Definitions for Flags in ATMARP SAP
  652. //
  653. //
  654. // Bits 0 to 3 contain the SAP-registration state.
  655. //
  656. #define AA_SAP_REG_STATE_MASK 0x0000000f
  657. #define AA_SAP_REG_STATE_IDLE 0x00000000
  658. #define AA_SAP_REG_STATE_REGISTERING 0x00000001 // Sent RegisterSap
  659. #define AA_SAP_REG_STATE_REGISTERED 0x00000002 // RegisterSap completed
  660. #define AA_SAP_REG_STATE_DEREGISTERING 0x00000004 // Sent DeregisterSap
  661. //
  662. // Bits 4 to 7 contain the ILMI-registration state.
  663. //
  664. #define AA_SAP_ILMI_STATE_MASK 0x000000f0
  665. #define AA_SAP_ILMI_STATE_IDLE 0x00000000
  666. #define AA_SAP_ILMI_STATE_ADDING 0x00000010 // Sent ADD_ADDRESS
  667. #define AA_SAP_ILMI_STATE_ADDED 0x00000020 // ADD_ADDRESS completed
  668. #define AA_SAP_ILMI_STATE_DELETING 0x00000040 // Sent DELETE_ADDRESS
  669. //
  670. // Bit 8 tells us whether this Address should be "ADDED" to the Call Manager,
  671. // i.e. ILMI-registered with the switch.
  672. //
  673. #define AA_SAP_ADDRTYPE_MASK 0x00000100
  674. #define AA_SAP_ADDRTYPE_BUILT_IN 0x00000000
  675. #define AA_SAP_ADDRTYPE_NEED_ADD 0x00000100
  676. //
  677. // ------------------------ ATMARP Interface ------------------------
  678. //
  679. // One of these structures is maintained for each LIS that this system is
  680. // a member of.
  681. //
  682. // The Interface structure has the following sections:
  683. //
  684. // Adapter - Information pertaining to the ATM miniport to which
  685. // this LIS is bound
  686. // Buffer Mgmt - NDIS Packet pool, NDIS Buffer pool, and two types of
  687. // buffers: Header buffers (LLC/SNAP) and Protocol buffers
  688. // (for ARP/InARP packets)
  689. // IP - Information related to the IP layer (context, IP addr lists)
  690. // Client - Information relating to IP/ATM client operation
  691. //
  692. // Reference Count: we add One to the interface RefCount for each of:
  693. // - Adapter reference (between NdisOpenAdapter and NdisCloseAdapter-Complete)
  694. // - Call Manager reference (between OpenAf and CloseAf-Complete)
  695. // - Each new ATMARP Table entry in the ARP Table
  696. // - An active Interface timer
  697. //
  698. typedef struct _ATMARP_INTERFACE
  699. {
  700. #if DBG
  701. ULONG aai_sig; // Signature
  702. #endif
  703. struct _ATMARP_INTERFACE * pNextInterface; // in list of ATMARP interfaces
  704. ATMARP_LOCK InterfaceLock; // Mutex for Interface structure
  705. ATMARP_BLOCK Block; // For blocking calling thread
  706. ULONG RefCount; // References to this interface
  707. ULONG AdminState; // Desired state of this interface
  708. ULONG State; // (Actual) State of this interface
  709. enum
  710. {
  711. RECONFIG_NOT_IN_PROGRESS,
  712. RECONFIG_SHUTDOWN_PENDING,
  713. RECONFIG_RESTART_QUEUED,
  714. RECONFIG_RESTART_PENDING
  715. } ReconfigState;
  716. PNET_PNP_EVENT pReconfigEvent; // Our own PnP event pending
  717. // completion.
  718. ULONG Flags; // Misc state information
  719. ULONG LastChangeTime; // Time of last state change
  720. ULONG MTU; // Max Transmision Unit (bytes)
  721. ULONG Speed; // That we report to IP
  722. //
  723. // ----- Adapter related ----
  724. // More than one ATMARP interface could be associated with
  725. // a single adapter.
  726. //
  727. #if DBG
  728. ULONG aaim_sig; // Signature to help debugging
  729. #endif
  730. struct _ATMARP_ADAPTER * pAdapter; // Pointer to Adapter info
  731. NDIS_HANDLE NdisAdapterHandle; // to Adapter
  732. NDIS_HANDLE NdisAfHandle; // AF handle to Call Manager
  733. NDIS_HANDLE NdisSapHandle; // SAP handle to Call Manager
  734. PCO_SAP pSap; // SAP info for this interface
  735. ULONG SapSelector; // SEL byte for this interface's SAP
  736. ATMARP_SAP SapList; // Each SAP registered with CallMgr
  737. ULONG NumberOfSaps; // Size of above list (> 1)
  738. //
  739. // ----- Buffer Management: Header buffers and Protocol buffers ----
  740. //
  741. NDIS_SPIN_LOCK BufferLock; // Mutex for buffers
  742. #if 1
  743. ATMARP_HEADER_POOL HeaderPool[AA_HEADER_TYPE_MAX];
  744. #else
  745. SLIST_HEADER HeaderBufList; // Free list of header buffers
  746. ULONG HeaderBufSize; // Size of each header buffer
  747. ULONG MaxHeaderBufs; // Max header buffers we can allocate
  748. ULONG CurHeaderBufs; // Current header buffers allocated
  749. PATMARP_BUFFER_TRACKER pHeaderTrkList; // Info about allocated header buffers
  750. #endif // 1 ( IPMCAST )
  751. NDIS_HANDLE ProtocolPacketPool; // Handle for Packet pool
  752. NDIS_HANDLE ProtocolBufferPool; // Handle for Buffer pool
  753. PUCHAR ProtocolBufList; // Free list of protocol buffers (for
  754. // ARP packets)
  755. PUCHAR ProtocolBufTracker; // Start of chunk of memory used for
  756. // the above.
  757. ULONG ProtocolBufSize; // Size of each protocol buffer
  758. ULONG MaxProtocolBufs; // Number of protocol buffers
  759. //
  760. // ----- IP/ARP interface related ----
  761. //
  762. #if DBG
  763. ULONG aaia_sig; // Signature to help debugging
  764. #endif
  765. PVOID IPContext; // Use in calls to IP
  766. IP_ADDRESS_ENTRY LocalIPAddress; // List of local IP addresses. There
  767. // should be atleast one.
  768. ULONG NumOfIPAddresses; // Size of above list.
  769. PPROXY_ARP_ENTRY pProxyList; // List of proxy addresses
  770. IP_ADDRESS BroadcastAddress; // IP Broadcast address for this IF
  771. IP_ADDRESS BroadcastMask; // Broadcast Mask for this interface
  772. IPRcvRtn IPRcvHandler; // Indicate Receive
  773. IPTxCmpltRtn IPTxCmpltHandler; // Transmit Complete
  774. IPStatusRtn IPStatusHandler;
  775. IPTDCmpltRtn IPTDCmpltHandler; // Transfer Data Complete
  776. IPRcvCmpltRtn IPRcvCmpltHandler; // Receive Complete
  777. #ifdef _PNP_POWER_
  778. IPRcvPktRtn IPRcvPktHandler; // Indicate Receive Packet
  779. IP_PNP IPPnPEventHandler;
  780. #endif // _PNP_POWER_
  781. UINT ATInstance; // Instance # for this AT Entity
  782. UINT IFInstance; // Instance # for this IF Entity
  783. NDIS_STRING IPConfigString; // Config info for IP for this LIS
  784. #ifdef PROMIS
  785. NDIS_OID EnabledIPFilters; // Set of enabled oids --
  786. // set/cleared using
  787. // AtmArpIfSetNdisRequest.
  788. #endif // PROMIS
  789. //
  790. // ----- IP/ATM operation related ----
  791. //
  792. #if DBG
  793. ULONG aait_sig; // Signature to help debugging
  794. #endif
  795. PATMARP_IP_ENTRY * pArpTable; // The ARP table
  796. ULONG NumOfArpEntries; // Entries in the above
  797. ATMARP_LOCK ArpTableLock; // Mutex for ARP Table
  798. BOOLEAN ArpTableUp; // Status for arp table.
  799. ATMARP_SERVER_LIST ArpServerList; // List of ARP servers
  800. PATMARP_SERVER_ENTRY pCurrentServer; // ARP server in use
  801. PATMARP_VC pUnresolvedVcs; // VCs whose ATM addrs aren't resolved
  802. PATMARP_ATM_ENTRY pAtmEntryList; // List of all ATM Entries
  803. ATMARP_LOCK AtmEntryListLock; // Mutex for above list
  804. BOOLEAN AtmEntryListUp; // Status of atm entry list.
  805. ULONG PVCOnly; // Only PVCs on this interface
  806. ULONG AtmInterfaceUp; // The ATM interface is considered
  807. // "up" after ILMI addr regn is over
  808. ATM_ADDRESS LocalAtmAddress; // Our ATM (HW) Address
  809. ATMARP_TIMER Timer; // Interface timers are: (exclusive)
  810. // - Server Connect Interval
  811. // - Server Registration
  812. // - Server Refresh
  813. ULONG RetriesLeft; // For above timer
  814. //
  815. // All timeout values are stored in terms of seconds.
  816. //
  817. ULONG ServerConnectInterval; // 3 to 60 seconds
  818. ULONG ServerRegistrationTimeout; // 1 to 60 seconds
  819. ULONG AddressResolutionTimeout; // 1 to 60 seconds
  820. ULONG ARPEntryAgingTimeout; // 1 to 15 minutes
  821. ULONG VCAgingTimeout; // 1 to 15 minutes
  822. ULONG InARPWaitTimeout; // 1 to 60 seconds
  823. ULONG ServerRefreshTimeout; // 1 to 15 minutes
  824. ULONG MinWaitAfterNak; // 1 to 60 seconds
  825. ULONG MaxRegistrationAttempts; // 0 means infinity
  826. ULONG MaxResolutionAttempts; // 0 means infinity
  827. ATMARP_TIMER_LIST TimerList[AAT_CLASS_MAX];
  828. ATMARP_LOCK TimerLock; // Mutex for timer structures
  829. #ifdef IPMCAST
  830. //
  831. // ---- IP Multicast over ATM stuff ----
  832. //
  833. #if DBG
  834. ULONG aaic_sig; // Signature for debugging
  835. #endif // DBG
  836. ULONG IpMcState; // State of IP Multicast/ATM
  837. ULONG HostSeqNumber; // Latest # seen on ClusterControlVc
  838. USHORT ClusterMemberId; // ID Assigned to us by MARS
  839. PATMARP_IPMC_JOIN_ENTRY pJoinList; // List of MC groups we have Joined
  840. PATMARP_IP_ENTRY pMcSendList; // Sorted list of MC groups we send to
  841. ATMARP_SERVER_LIST MARSList; // List of MARS (servers)
  842. PATMARP_SERVER_ENTRY pCurrentMARS; // MARS in use
  843. ATMARP_TIMER McTimer; // Interface timers for Multicast:
  844. // - MARS Connect Interval
  845. // - MARS Registration
  846. // - MARS Refresh
  847. ULONG McRetriesLeft; // For above timer
  848. //
  849. // All timeout values are stored in terms of seconds.
  850. //
  851. ULONG MARSConnectInterval;
  852. ULONG MARSRegistrationTimeout;
  853. ULONG MARSKeepAliveTimeout;
  854. ULONG JoinTimeout;
  855. ULONG LeaveTimeout;
  856. ULONG MulticastEntryAgingTimeout;
  857. ULONG MaxDelayBetweenMULTIs;
  858. ULONG MinRevalidationDelay;
  859. ULONG MaxRevalidationDelay;
  860. ULONG MinPartyRetryDelay;
  861. ULONG MaxPartyRetryDelay;
  862. ULONG MaxJoinOrLeaveAttempts;
  863. #endif // IPMCAST
  864. //
  865. // ---- QoS stuff ----
  866. //
  867. PAA_GET_PACKET_SPEC_FUNC pGetPacketSpecFunc; // Routine to extract packet specs
  868. PAA_FILTER_SPEC_MATCH_FUNC pFilterMatchFunc; // Routine to match filter specs
  869. PAA_FLOW_SPEC_MATCH_FUNC pFlowMatchFunc; // Routine to match flow specs
  870. ATMARP_FLOW_SPEC DefaultFlowSpec; // The default flow specs for all
  871. // (best effort) calls on this IF
  872. ATMARP_FILTER_SPEC DefaultFilterSpec; // The default filter specs for all
  873. // (best effort) packets
  874. PATMARP_FLOW_INFO pFlowInfoList; // List of configured flows
  875. #ifdef DHCP_OVER_ATM
  876. BOOLEAN DhcpEnabled;
  877. ATM_ADDRESS DhcpServerAddress;
  878. PATMARP_ATM_ENTRY pDhcpServerAtmEntry;
  879. #endif // DHCP_OVER_ATM
  880. //
  881. // ---- MIB objects: counters, descriptions etc ---
  882. //
  883. #if DBG
  884. ULONG aaio_sig; // Signature to help debugging
  885. #endif
  886. ULONG IFIndex; // Interface number
  887. ULONG InOctets; // Input octets
  888. ULONG InUnicastPkts; // Input Unicast packets
  889. ULONG InNonUnicastPkts; // Input Non-unicast packets
  890. ULONG OutOctets; // Output octets
  891. ULONG OutUnicastPkts; // Output Unicast packets
  892. ULONG OutNonUnicastPkts; // Output Non-unicast packets
  893. ULONG InDiscards;
  894. ULONG InErrors;
  895. ULONG UnknownProtos;
  896. ULONG OutDiscards;
  897. ULONG OutErrors;
  898. //
  899. // ---- WMI Information ---
  900. //
  901. #if ATMARP_WMI
  902. #if DBG
  903. ULONG aaiw_sig; // Signature to help debugging
  904. #endif
  905. struct _ATMARP_IF_WMI_INFO *pIfWmiInfo;
  906. ATMARP_LOCK WmiLock;
  907. #endif
  908. } ATMARP_INTERFACE, *PATMARP_INTERFACE;
  909. #if DBG
  910. // ATM ARP Interface:
  911. #define aai_signature 'AAIF'
  912. // Sections within the ATM ARP Interface:
  913. #define aaim_signature 'AAIM'
  914. #define aaia_signature 'AAIA'
  915. #define aait_signature 'AAIT'
  916. #define aaio_signature 'AAIO'
  917. #define aaic_signature 'AAIC'
  918. #define aaiw_signature 'AAIW'
  919. #endif
  920. //
  921. // NULL Pointer to ATMARP Interface
  922. //
  923. #define NULL_PATMARP_INTERFACE ((PATMARP_INTERFACE)NULL)
  924. //
  925. // Definitions for Interface Flags: the following information is kept
  926. // here:
  927. // - ARP Server registration state
  928. // - MARS registration state
  929. //
  930. #define AA_IF_SERVER_STATE_MASK ((ULONG)0x00000003)
  931. #define AA_IF_SERVER_NO_CONTACT ((ULONG)0x00000000)
  932. #define AA_IF_SERVER_REGISTERING ((ULONG)0x00000001)
  933. #define AA_IF_SERVER_REGISTERED ((ULONG)0x00000002)
  934. #ifdef IPMCAST
  935. #define AAMC_IF_STATE_MASK ((ULONG)0x00000F00)
  936. #define AAMC_IF_STATE_NOT_REGISTERED ((ULONG)0x00000000)
  937. #define AAMC_IF_STATE_REGISTERING ((ULONG)0x00000100)
  938. #define AAMC_IF_STATE_REGISTERED ((ULONG)0x00000200)
  939. #define AAMC_IF_STATE_DELAY_B4_REGISTERING ((ULONG)0x00000400)
  940. #define AAMC_IF_MARS_FAILURE_MASK ((ULONG)0x0000F000)
  941. #define AAMC_IF_MARS_FAILURE_NONE ((ULONG)0x00000000)
  942. #define AAMC_IF_MARS_FAILURE_FIRST_RESP ((ULONG)0x00001000)
  943. #define AAMC_IF_MARS_FAILURE_SECOND_RESP ((ULONG)0x00002000)
  944. #endif // IPMCAST
  945. //
  946. // ---- ATMARP Adapter Information ----
  947. //
  948. // One of these structures is used to maintain information about
  949. // each adapter to which the ATMARP module is bound. One or more
  950. // ATMARP Interface structures point to this structure, and the
  951. // reference count reflects that.
  952. //
  953. typedef struct _ATMARP_ADAPTER
  954. {
  955. #if DBG
  956. ULONG aaa_sig; // signature for debugging
  957. #endif
  958. struct _ATMARP_ADAPTER * pNextAdapter; // Next adapter on this system
  959. PATMARP_INTERFACE pInterfaceList; // List of ATMARP IF's on this adapter
  960. ULONG InterfaceCount; // Size of above list
  961. NDIS_HANDLE NdisAdapterHandle; // From NdisOpenAdapter
  962. NDIS_HANDLE BindContext; // BindContext to our Bind handler
  963. NDIS_HANDLE SystemSpecific1; // SystemSpecific1 to our Bind handler
  964. NDIS_HANDLE SystemSpecific2; // SystemSpecific2 to our Bind handler
  965. NDIS_STRING IPConfigString; // Points to multi-sz, one string
  966. // per logical interface (LIS)
  967. NDIS_HANDLE UnbindContext; // Passed to our Unbind handler
  968. NDIS_MEDIUM Medium; // Should be NdisMediumAtm
  969. ULONG Flags; // State information
  970. NDIS_CO_LINK_SPEED LineRate; // Supported by adapter
  971. ULONG MaxPacketSize; // Supported by adapter
  972. UCHAR MacAddress[AA_ATM_ESI_LEN];
  973. // Address burnt into adapter
  974. ULONG DescrLength; // Length of descriptor string, below
  975. PUCHAR pDescrString;
  976. NDIS_STRING DeviceName; // Passed to BindAdapter handler
  977. NDIS_STRING ConfigString; // Used for per-adapter registry
  978. ATMARP_BLOCK Block; // For blocking calling thread
  979. ATMARP_BLOCK UnbindBlock; // For blocking UnbindAdapter
  980. #if ATMOFFLOAD
  981. //
  982. // Task Offload Information
  983. //
  984. struct
  985. {
  986. ULONG Flags; // Enabled tasks
  987. UINT MaxOffLoadSize; // Maximum send size supported
  988. UINT MinSegmentCount; // Minimum segments required
  989. // to do large sends.
  990. } Offload;
  991. #endif // ATMOFFLOAD
  992. } ATMARP_ADAPTER, *PATMARP_ADAPTER;
  993. #if DBG
  994. #define aaa_signature 'AAAD'
  995. #endif
  996. //
  997. // NULL Pointer to ATMARP Adapter
  998. //
  999. #define NULL_PATMARP_ADAPTER ((PATMARP_ADAPTER)NULL)
  1000. //
  1001. // Definitions for Adapter Flags: the following information is kept
  1002. // here:
  1003. // - Are we unbinding now?
  1004. // - Are we processing an AF register notify?
  1005. // - Have we initiated NdisCloseAdapter?
  1006. //
  1007. #define AA_ADAPTER_FLAGS_UNBINDING 0x00000001
  1008. #define AA_ADAPTER_FLAGS_PROCESSING_AF 0x00000002
  1009. #define AA_ADAPTER_FLAGS_AF_NOTIFIED 0x00000004
  1010. #define AA_ADAPTER_FLAGS_CLOSING 0x00000008
  1011. //
  1012. // ---- ATMARP Global Information ----
  1013. //
  1014. // One of these structures is maintained for the entire system.
  1015. //
  1016. typedef struct _ATMARP_GLOBALS
  1017. {
  1018. #if DBG
  1019. ULONG aag_sig; // signature
  1020. #endif
  1021. ATMARP_LOCK Lock; // mutex
  1022. NDIS_HANDLE ProtocolHandle; // returned by NdisRegisterProtocol
  1023. PVOID pDriverObject; // handle to Driver Object for ATMARP
  1024. PVOID pDeviceObject; // handle to Device Object for ATMARP
  1025. PATMARP_ADAPTER pAdapterList; // list of all adapters bound to us
  1026. ULONG AdapterCount; // size of above list
  1027. BOOLEAN bUnloading;
  1028. #ifdef NEWARP
  1029. HANDLE ARPRegisterHandle; // From IPRegisterARP
  1030. IP_ADD_INTERFACE pIPAddInterfaceRtn; // call into IP to add an interface
  1031. IP_DEL_INTERFACE pIPDelInterfaceRtn; // call into IP to delete an interface
  1032. IP_BIND_COMPLETE pIPBindCompleteRtn; // call into IP to inform of bind cmpl
  1033. #if P2MP
  1034. IP_ADD_LINK pIPAddLinkRtn;
  1035. IP_DELETE_LINK pIpDeleteLinkRtn;
  1036. #endif // P2MP
  1037. #else
  1038. IPAddInterfacePtr pIPAddInterfaceRtn; // call into IP to add an interface
  1039. IPDelInterfacePtr pIPDelInterfaceRtn; // call into IP to delete an interface
  1040. #endif // NEWARP
  1041. ATMARP_BLOCK Block; // For blocking calling thread
  1042. #ifdef GPC
  1043. #if DBG
  1044. ULONG aaq_sig; // additional signature
  1045. #endif
  1046. PATMARP_FLOW_INFO pFlowInfoList; // List of configured flows
  1047. GPC_HANDLE GpcClientHandle; // From GpcRegisterClient()
  1048. BOOLEAN bGpcInitialized; // Did we register successfully?
  1049. GPC_EXPORTED_CALLS GpcCalls; // All GPC API entry points
  1050. #endif // GPC
  1051. } ATMARP_GLOBALS, *PATMARP_GLOBALS;
  1052. #if DBG
  1053. // ATM ARP Global info
  1054. #define aag_signature 'AAGL'
  1055. #define aaq_signature 'AAGQ'
  1056. #endif
  1057. //
  1058. // NULL pointer to ATMARP Globals structure
  1059. //
  1060. #define NULL_PATMARP_GLOBALS ((PATMARP_GLOBALS)NULL)
  1061. //
  1062. // ATMARP module's context info in IP's Route Cache Entry
  1063. //
  1064. typedef struct _ATMARP_RCE_CONTEXT
  1065. {
  1066. RouteCacheEntry * pNextRCE; // Next to same IP destination
  1067. ATMARP_IP_ENTRY * pIpEntry; // Info about this IP destination
  1068. } ATMARP_RCE_CONTEXT, *PATMARP_RCE_CONTEXT;
  1069. //
  1070. // A NULL pointer to RCE context info
  1071. //
  1072. #define NULL_PATMARP_RCE_CONTEXT ((PATMARP_RCE_CONTEXT)NULL)
  1073. #ifndef AA_MAX
  1074. // Private macro
  1075. #define AA_MAX(_a, _b) ((_a) > (_b) ? (_a) : (_b))
  1076. #endif
  1077. //
  1078. // Physical address as reported to IP is the ESI part plus SEL byte.
  1079. //
  1080. #define AA_ATM_PHYSADDR_LEN (AA_ATM_ESI_LEN+1)
  1081. //
  1082. // Defaults for ATM adapter parameters
  1083. //
  1084. #define AA_DEF_ATM_LINE_RATE (ATM_USER_DATA_RATE_SONET_155*100/8)
  1085. #define AA_DEF_ATM_MAX_PACKET_SIZE (9188+8) // Bytes
  1086. // Max and min (for ip/atm) permissible max-packet size.
  1087. //
  1088. #define AA_MAX_ATM_MAX_PACKET_SIZE 65535 // With AAL5
  1089. #define AA_MIN_ATM_MAX_PACKET_SIZE AA_DEF_ATM_MAX_PACKET_SIZE
  1090. //
  1091. // Defaults for configurable parameters
  1092. //
  1093. #define AA_DEF_MAX_HEADER_BUFFERS 3000
  1094. #define AA_DEF_HDRBUF_GROW_SIZE 50
  1095. #define AA_DEF_MAX_PROTOCOL_BUFFERS 100
  1096. #define AA_MAX_1577_CONTROL_PACKET_SIZE \
  1097. (AA_ARP_PKT_HEADER_LENGTH + \
  1098. (4 * ATM_ADDRESS_LENGTH) + \
  1099. (2 * sizeof(IP_ADDRESS)))
  1100. #ifdef IPMCAST
  1101. #define AA_MAX_2022_CONTROL_PACKET_SIZE \
  1102. AA_MAX(sizeof(AA_MARS_JOIN_LEAVE_HEADER), sizeof(AA_MARS_REQ_NAK_HEADER)) + \
  1103. (2 * ATM_ADDRESS_LENGTH) + \
  1104. (2 * sizeof(IP_ADDRESS))
  1105. #else
  1106. #define AA_MAX_2022_CONTROL_PACKET_SIZE 0
  1107. #endif
  1108. #define AA_DEF_PROTOCOL_BUFFER_SIZE \
  1109. AA_MAX(AA_MAX_1577_CONTROL_PACKET_SIZE, AA_MAX_2022_CONTROL_PACKET_SIZE)
  1110. #define AA_DEF_PVC_ONLY_VALUE ((ULONG)FALSE)
  1111. #define AA_DEF_SELECTOR_VALUE 0x00
  1112. #define AA_DEF_SERVER_CONNECT_INTERVAL 5 // Seconds
  1113. #define AA_DEF_SERVER_REGISTRATION_TIMEOUT 3 // Seconds
  1114. #define AA_DEF_ADDRESS_RESOLUTION_TIMEOUT 3 // Seconds
  1115. #define AA_DEF_ARP_ENTRY_AGING_TIMEOUT 900 // Seconds (15 mins)
  1116. #define AA_DEF_VC_AGING_TIMEOUT 60 // Seconds (1 min)
  1117. #define AA_DEF_INARP_WAIT_TIMEOUT 5 // Seconds
  1118. #define AA_DEF_SERVER_REFRESH_INTERVAL 900 // Seconds (15 mins)
  1119. #define AA_DEF_MIN_WAIT_AFTER_NAK 10 // Seconds
  1120. #define AA_DEF_MAX_REGISTRATION_ATTEMPTS 5
  1121. #define AA_DEF_MAX_RESOLUTION_ATTEMPTS 4
  1122. #define AA_DEF_FLOWSPEC_SERVICETYPE SERVICETYPE_BESTEFFORT
  1123. #define AA_DEF_FLOWSPEC_ENCAPSULATION ENCAPSULATION_TYPE_LLCSNAP
  1124. #ifdef IPMCAST
  1125. #define AA_DEF_MARS_KEEPALIVE_TIMEOUT 240 // Seconds (4 mins)
  1126. #define AA_DEF_MARS_JOIN_TIMEOUT 10 // Seconds
  1127. #define AA_DEF_MARS_LEAVE_TIMEOUT 10 // Seconds
  1128. #define AA_DEF_MULTI_TIMEOUT 10 // Seconds
  1129. #define AA_DEF_MCAST_IP_ENTRY_AGING_TIMEOUT 1200 // Seconds (20 mins)
  1130. #define AA_DEF_MIN_MCAST_REVALIDATION_DELAY 1 // Seconds
  1131. #define AA_DEF_MAX_MCAST_REVALIDATION_DELAY 10 // Seconds
  1132. #define AA_DEF_MIN_MCAST_PARTY_RETRY_DELAY 5 // Seconds
  1133. #define AA_DEF_MAX_MCAST_PARTY_RETRY_DELAY 10 // Seconds
  1134. #define AA_DEF_MAX_JOIN_LEAVE_ATTEMPTS 5
  1135. #endif // IPMCAST
  1136. //
  1137. // Structure passed in as context in a QueryInfo for the ARP Table
  1138. //
  1139. typedef struct IPNMEContext {
  1140. UINT inc_index;
  1141. PATMARP_IP_ENTRY inc_entry;
  1142. } IPNMEContext;
  1143. #endif // __ATMARP_H_INCLUDED