home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 20 NDrivers / 20-NDrivers.zip / NDIS_MAC.ZIP / ndis-mac.txt
Text File  |  1992-06-22  |  198KB  |  5,624 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6. Microsoft/3Com LAN Manager
  7. Network Driver Interface Specification
  8.  
  9.  
  10.  
  11.  
  12.  
  13. Version 2.0.1
  14. Draft Copy
  15.  
  16.  
  17.  
  18.  
  19.  
  20. Published 18 May, 1990
  21.  
  22.  
  23.  
  24.  
  25.  
  26. Copyright 1988, 1989, 1990 3Com Corporation/Microsoft Corporation
  27.  
  28.               NOTICE
  29.  
  30. The information in this document is subject to change.  This
  31. document has been released in its current state to provide the
  32. Networking community with valuable information necessary to begin
  33. work on NDIS compatible products.
  34.  
  35. This specification is intended for use by those developing or
  36. using networking products.  This specification may be copied
  37. freely for that purpose as long as copyright notice is preserved
  38. on all copies of the specification.  No fee or royalty is
  39. required by either 3Com Corporation or Microsoft Corporation to
  40. develop products which use the information contained within this
  41. specification.  Information contained in this specification may
  42. be included in documents, presentations, or products of third
  43. parties; however, authorship must be attributed jointly to 3Com
  44. Corporation and Microsoft Corporation, and appropriate copyright
  45. notices must be placed in any such documents or presentations.
  46. Additional copies of this specification may be obtained from 3Com
  47. Corporation or Microsoft Corporation.
  48.  
  49.  
  50.  
  51.  
  52.  
  53. Table of Contents
  54.  
  55. Chapter 1 - Introduction
  56.  
  57. Definition of Terms 1-1
  58. Scope of this Document   1-2
  59. Changes for this Version 1-2
  60.  
  61. Chapter 2 - Configuration and Binding
  62.  
  63. Configuration and Binding Process  2-1
  64.  
  65. Chapter 3 - Protocol to MAC Interface Description
  66.  
  67. Transmission   3-1
  68. Reception 3-2
  69. Non Host-Buffered Adapter3-2
  70. Host-Buffered Adapter    3-3
  71. Indication Control  3-3
  72. Status Indication   3-4
  73. General Requests    3-4
  74. System Requests3-5
  75. Protocol Manager Primitives   3-5
  76.  
  77. Chapter 4 - Data Structures
  78.  
  79. Module Characteristics   4-1
  80. Common Characteristics   4-1
  81. MAC Service-Specific Characteristics    4-4
  82. MAC Service-Specific Status Table  4-8
  83. MAC Upper Dispatch Table 4-9
  84. Protocol Service-Specific Charateristics Table    4-10
  85. Protocol Lower Dispatch Table 4-10
  86. Characteristics Table for NetBIOS Drivers    4-11
  87. Frame Data Description   4-13
  88. Transmit Buffer Descriptor    4-13
  89. Transfer Data Buffer Descriptor    4-14
  90. Receive Chain Buffer Descriptor    4-14
  91. PROTOCOL.INI   4-15
  92. Configuration Memory Image    4-17
  93. ConfigMemoryImage   4-17
  94. ModuleConfig   4-17
  95. KeywordEntro   4-18
  96. Param4-19
  97. Bindings List  4-20
  98.  
  99. Chapter 5 - Specification of Primitives
  100.  
  101. Direct Primitives   5-3
  102. TransmitChain  5-3
  103. TransmitConfirm5-4
  104. ReceiveLookahead    5-5
  105. TransferData   5-6
  106.  
  107.  
  108.  
  109.  
  110.  
  111. IndicationComplete  5-7
  112. ReceiveChain   5-8
  113. ReceiveRelease 5-9
  114. IndicationOff  5-9
  115. IndicationOn   5-10
  116. General Requests    5-11
  117. Initiate Diagnostics5-11
  118. ReadErrorLog   5-12
  119. SetStationAddress   5-12
  120. OpenAdapter    5-13
  121. CloseAdapter   5-14
  122. ResetMAC  5-14
  123. SetPacketFilter5-15
  124. AddMulticastAddress 5-16
  125. DeleteMulticastAddress   5-17
  126. UpdateStatistics    5-17
  127. ClearStatistics5-18
  128. Interrupt 5-18
  129. SetFunctionalAddress5-19
  130. SetLookahead   5-19
  131. General Request Confirmation  5-21
  132. StatusIndication    5-22
  133. RingStatus5-22
  134. AdapterCheck   5-23
  135. StartReset5-24
  136. EndReset  5-25
  137. Interrupt 5-25
  138. System Requests5-26
  139. InitiateBind   5-26
  140. Bind 5-27
  141. InitiatePrebind (OS/2 only)   5-27
  142. InitiateUnbind 5-28
  143. Unbind    5-29
  144. Protocol Manager Primitives   5-30
  145. GetProtocolManagerInfo   5-30
  146. RegisterModule 5-31
  147. BindAndStart   5-33
  148. GetProtocolManagerLinkage5-34
  149. GetProtocolIniPath  5-35
  150. RegisterProtocolManagerInfo   5-35
  151. InitAndRegister5-36 
  152. UnbindAndStop  5-37
  153. BindStatus5-38
  154. RegisterStatus 5-41
  155.  
  156. Chapter 6 - Protocol Manager
  157.  
  158. Protocol Manager Initialization    6-1
  159. Static Binding Sequence  6-1
  160. OS/2 CallingConvention   6-3
  161. DOS Calling Convention   6-4
  162.  
  163. Chapter 7 - VECTOR and Dynamic Binding  
  164.  
  165.  
  166.  
  167.  
  168.  
  169. Static VECTOR Binding    7-1
  170. Dynamic VECTOR Binding   7-2
  171. Dynamic Binding/Unbinding in the DOS
  172. Environment    7-2
  173. Dynamic Binding/Unbinding in the OS/2
  174. Environment    7-3
  175. VECTOR Demultiplexing    7-4
  176.  
  177. Appendix A:
  178. System Return Codes A-1
  179.  
  180. Appendix B:    
  181. Reference Material  B-1
  182.  
  183. Appendix C:
  184. 802.3 Media Specific Statistics    C-1
  185.  
  186. Appendix D:
  187. 802.5 Media Specific Statistics    D-1
  188.  
  189. Appendix E:
  190. Utilities Provided with the Protocol Manager E-1
  191.  
  192.  
  193.  
  194.  
  195.  
  196. Chapter 1:  Introduction
  197.  
  198. This document describes the LAN Manager network driver
  199. architecture and interfaces that let a DOS or OS/2 system support
  200. one or more network adapters and protocol stacks.  This
  201. architecture provides a standardized way for writing drivers for
  202. network adapters and communications protocols.  It also solves
  203. the problem of how to configure and bind multiple drivers into
  204. the desired set of layered protocol stacks.
  205.  
  206. Drivers written to the interfaces defined here will function
  207. concurrently in a system with other networking and protocol
  208. drivers, and will operate correctly with the LAN Manager software
  209. for DOS and OS/2.
  210.  
  211. Definition of Terms
  212. To simplify the job of supporting multiple adapters and
  213. protocols, the architecture defines four kinds of drivers.
  214.  
  215. o    Media Access Control (MAC) drivers, which provide low-level
  216. access to network   adapters.  The main function of a MAC driver
  217. is to support transmitting andreceiving packets, plus some
  218. basic adapter management functions.  MAC drivers  are device
  219. drivers that are loaded during system initialization and remain  
  220. permanently in memory.  Since they cannot be unloaded, they are
  221. called "static".
  222.  
  223. o    Protocol drivers, which provide higher-level communication
  224. services from data link  to application (depending on the
  225. driver).  An example is a NetBIOS driver thatprovides a
  226. NetBIOS interface at the top and talks to a MAC driver at the
  227. bottom.   Protocol drivers can be device drivers, TSRs, or
  228. transient DOS applications.  Aprotocol driver is called
  229. "static" if it cannot be unloaded.  A protocol driver is called  
  230. "dynamic" if it can be loaded and unloaded on demand.
  231.  
  232. o    MAC-layer entities, which bind to real MAC drivers and
  233. expose a new MAC-like layer interface on top.  Possible
  234. examples are MAC bridges, test tools, or interfacemappings
  235. which change the NDIS interface to meet some environment-specific
  236. administrative requirement.
  237.  
  238. o    The Protocol Manager driver.  This is a special driver that
  239. provides a standardized  way for multiple MAC and protocol
  240. drivers to get configuration information and bind together
  241. into the desired protocol hierarchy.  The Protocol Manager gets
  242. all  configuration information from a central file, PROTOCOL.INI.
  243.  
  244.  
  245.  
  246.  
  247.  
  248. Scope of this Document
  249. This document defines:
  250.  
  251. 1.   Protocol Manager functions and interfaces for configuration
  252. and binding of MAC  and protocol drivers.
  253.  
  254. 2.   The software interface between MAC and protocol drivers.
  255.  
  256. Separate documents will specify the configuration and interface
  257. details for other kinds of protocol drivers, including data link
  258. and transport drivers.
  259.  
  260. Changes for this Version
  261. The major highlights of this version compared to the last (1.0)
  262. are:
  263.  
  264. 1.   Support for dynamic binding/unbinding of protocol modules,
  265. allowing protocols to    be swapped in and out of memory as
  266. needed.  No changes are required of MAC drivers to support
  267. the dynamic bind/unbind features.  In particular NDIS 1.0.1 
  268. conformant MACs will support dynamically binding protocol
  269. modules.
  270.  
  271. 2.   Additional Protocol Manager functions to support dynamic
  272. binding and future  administrative requirements.
  273.  
  274. 3.   Some adjustments to the Reset MAC function to correct some
  275. inconsistencies and keep the logic out of the criticial
  276. paths.
  277.  
  278. 4.   Additional fields were added to certain tables to provide
  279. additional information.  The presence or absence of these
  280. fields can be determined by examining the length  field in each
  281. table.
  282.  
  283. 5.   Some new recommendations and clarifications on such issues
  284. as double-word alignment of data blocks, the use of the
  285. permanent station address, the copying of    DS and entry points,
  286. the use of 80386 32-bit registers, the release of internal  resou
  287. rces before confirmations, the handling of 0 length data blocks,
  288. the  formatting of MAC headers, the use of zero handles, new
  289. transmit error codes for Token Ring to support source-
  290. routing, and various other points that neededadditional
  291. clarifications.
  292.  
  293. 6.   A standard for protocol service-specific characteristics
  294. tables.
  295.  
  296. 7.   The inclusion of additional 802.3 and 802.5 specific
  297. information.
  298.  
  299. 8.   Additional information and caveats to help developers.
  300.  
  301.  
  302.  
  303.  
  304.  
  305.                             Page 1-2
  306.  
  307.  
  308.  
  309.  
  310.  
  311. 9.   The Protocol Manager now has a transient component (in some
  312. configurations)called PROTMAN.EXE.  This is now described
  313. with certain restricitions imposed on Protocol Manager
  314. primitives.
  315.  
  316. 10.  Some new error response codes were defined.
  317.  
  318. 11.  A new appendix, Appendix E, was added to describe some
  319. helpful bind and    configuration management utilities provided
  320. with Protocol Manager.
  321.  
  322. It is not expected that any of these changes will result in
  323. incompatibilities with protocol and MAC drivers written to
  324. previous versions of this specification.  Great care was taken to
  325. avoid creating incompatibilities.  Older network drivers will co-
  326. exist with network drivers written to this specification.
  327. However, to take advantage of new features (such as dynamic
  328. binding), developers may wish to update their protocol drivers to
  329. be NDIS 2.0.1 compliant.
  330.  
  331.  
  332.  
  333.  
  334.  
  335.                             Page 1-3
  336.  
  337.  
  338.  
  339.  
  340.  
  341. Chapter 2:  Configuration and Binding
  342.  
  343.  
  344. A network server or workstation includes at least one Media
  345. Access Control (MAC) and one protocol driver, plus the Protocol
  346. Manager driver.  More complex configurations may have multiple
  347. MAC and protocol drivers.
  348.  
  349. The Protocol Manager is always defined in CONFIG.SYS to load
  350. before any MAC or protocol drivers.  Its job is to read the
  351. configuration information out of the PROTOCOL.INI file and make
  352. this available to MAC and protocol drivers which load later.
  353.  
  354. MAC and protocol drivers use this information to set
  355. initialization parameters and allocate memory appropriately.  For
  356. example, a NetBIOS driver may use the configuration information
  357. provided by the Protocol Manager to determine its maximum number
  358. of names and sessions.
  359.  
  360. As each driver configures and initializes itself, it identifies
  361. itself to the Protocol Manager using a driver-defined "module
  362. name" and "characteristics table".  The module name defines a
  363. kind of logical name for the communication service provided by
  364. the driver.  The characteristics table provides specific
  365. parameters about the service and the set of entry points the
  366. driver uses to communicate with other drivers.  A single driver
  367. may identify itself to the Protocol Manager as multiple logical
  368. modules if, for example, it implements more than one layer of
  369. protocol interface (such as transport and data link).
  370.  
  371. Before two modules can communicate, they must be bound together.
  372. Binding is the process of two modules exchanging characteristics
  373. tables so that they can access each other's entry points.  This
  374. establishes the linkage they need to make requests of one another
  375. and indicate asynchronous request  completion.  Binding is
  376. controlled by the Protocol Manager based on information from
  377. PROTOCOL.INI.  Binding can be either static or dynamic for
  378. protocol drivers.  If a protocol driver is static, then its
  379. binding is static.  If it is dynamic, then its binding is
  380. dynamic.  A dynamic protocol driver can be unbound from its bound
  381. drivers prior to unloading itself from memory.  This unbinding
  382. process is also controlled through the Protocol Manager.
  383.  
  384.  
  385. Configuration and Binding Process
  386. In the typical case of a system with one MAC driver and a NetBIOS
  387. driver, the set of drivers load and initialize as follows:
  388.  
  389. 1. Protocol Manager loads, initializes, and reads PROTOCOL.INI.
  390.  
  391. 2. MAC driver loads.  It calls GetProtocolManagerInfo to get any
  392.    needed configuration information, like its DMA channel.
  393.  
  394.  
  395.  
  396.  
  397.  
  398. 3. MAC driver initializes and calls RegisterModule to identify
  399.    itself as the module named e.g. "ETHERCARD."  This call passes
  400.    ETHERCARD's characteristics table to Protocol Manager.
  401.  
  402. 4. NetBIOS driver loads.  It calls GetProtocolManagerInfo to get
  403.    any needed configuration information, like the maximum number
  404.    of names, sessions, and commands to support.
  405.  
  406. 5. NetBIOS driver initializes and calls RegisterModule to
  407.    identify itself as the module named "NetBIOS".  This call
  408.    passes NetBIOS's characteristics table to Protocol Manager and
  409.    indicates that NetBIOS wants to bind to ETHERCARD.
  410.  
  411. 6. After all device drivers have loaded, Protocol Manager
  412.    determines from the information supplied on previous
  413.    RegisterModule requests that NetBIOS must bind to ETHERCARD.
  414.    Using a defined dispatch address in the characteristics table
  415.    for NetBIOS, Protocol Manager calls NetBIOS and instructs it
  416.    to bind to ETHERCARD.  The call, InitiateBind, includes the
  417.    characteristics table for ETHERCARD.
  418.  
  419. 7. NetBIOS calls ETHERCARD, requesting to Bind.  The modules
  420.    exchange characteristics tables with each other.  They now
  421.    have each other's entry points and are bound.
  422.  
  423. 8. NetBIOS may now call ETHERCARD at its defined entry points for
  424.    transmitting and receiving packets (see next section).
  425.  
  426. If the example NetBIOS driver was dynamically loadable, the
  427. binding to the ETHERCARD MAC would be done through the Protocol
  428. Manager's VECTOR facility (see Chapter 7).  The Vector shields
  429. the static MAC driver from the details of dynamic binding.
  430.  
  431.  
  432.  
  433.  
  434.  
  435.                             Page 2-2
  436.  
  437.  
  438.  
  439.  
  440.  
  441. Chapter 3:  Protocol to MAC Interface Description
  442.  
  443.  
  444. The interface between a protocol and MAC driver provides for the
  445. transmission and reception of network packets, called frames.
  446. The interface includes other functions for controlling and
  447. determining the status of the network adapter controlled by the
  448. MAC.
  449.  
  450. To allow for efficient use of memory and to minimize buffer
  451. copies, frames being transmitted and received are passed between
  452. protocol and MAC using a scatter/gather buffer description
  453. convention.  This passes an array of pointers/lengths called a
  454. frame buffer descriptor.  There are three types of these
  455. descriptors, one for describing frames being transmitted
  456. (TxBufDescr) and two for frames being received (RxBufDescr and
  457. TDBufDescr).
  458.  
  459. Overall, the calls at the protocol/mac interface are grouped into
  460. categories of transmission, reception, indication control, status
  461. indications, and general requests.  An additional category of
  462. function, system requests, is generic to all drivers.
  463.  
  464.  
  465. Transmission
  466. Transmitting data can work either synchronously or
  467. asynchronously, at the option of the MAC.  Protocols must be able
  468. to handle both cases.  Primitives are TransmitChain and
  469. TransmitConfirm.
  470.  
  471. Protocol    MAC
  472.  
  473. Transmit Chain   -CALL-> Call passes TxBufDescr and
  474.             unique handle.  MAC may copy data now
  475.             or later.
  476.  
  477.       <-RETURN-Return indicates if data has been
  478.             copied.  If not, MAC now owns frame
  479.             data blocks and will copy them
  480.             asynchronously.
  481.  
  482. Later on, after data is copied by MAC:
  483.  
  484. TransmitConfirm  <-CALL- Call supplies unique handle
  485.             from Transmit.
  486.  
  487.       -RETURN->Data block ownership returned to
  488.             protocol.
  489.  
  490.  
  491. NOTE:  If the MAC transmits the frame synchronously, it indicates
  492. this on the return from TransmitChain and will not generate a
  493. TransmitConfirm.
  494.  
  495.  
  496.  
  497.  
  498.  
  499. Reception
  500. Receiving data can work in either of two ways, depending on the
  501. MAC.  Protocols must be able to handle both cases.
  502.  
  503. y The MAC generates a ReceiveLookahead indication that points to
  504.   part or all of the received frame in contiguous storage.  This
  505.   is called the "lookahead" data.  The protocol may issue a
  506.   TransferData call back to the MAC if it wants the MAC to copy
  507.   all or part of the received frame to protocol storage.  The
  508.   protocol may, of course, copy the look ahead data itself.  In
  509.   some implementations, this may be the entire frame.
  510.  
  511. y The MAC generates a ReceiveChain indication that points to a
  512.   RxBufDescr that describes the entire frame received.  The
  513.   protocol may copy the data immediately or later.  If later, it
  514.   releases the frame buffer areas back to the MAC via a call to
  515.   ReceiveRelease.
  516.  
  517. Generally, the first approach will be implemented by MAC drivers
  518. for non-host buffered network adapters, while drivers for host
  519. buffered network adapters will implement the second.  Non-host
  520. buffered adapters that use programmed I/O or DMA will generally
  521. provide a small leading portion of the received frame as look
  522. ahead data, whereas those using a single memory mapped buffer
  523. will usually provide the whole frame.
  524.  
  525. In either case, the protocol must validate the received packet
  526. very rapidly (within a few instructions) and to reject it if
  527. necessary.  This is very important to performance in a multi-
  528. protocol environment.
  529.  
  530. The following sections illustrate the non host-buffered adapter
  531. versus host-buffered adapter receive scenarios:
  532.  
  533. Non Host-Buffered Adapter
  534.  
  535. MAC  Protocol
  536.  
  537. ReceiveLookahead -CALL-> Call passes pointer to lookahead
  538.                 data.  Protocol examines this data.
  539.  
  540. If protocol wants the frame and look ahead wasn't the whole
  541. frame, the protocol can ask MAC to transfer the frame:
  542.  
  543. TransferData<-CALL- Passes TDBufDescr indicating where
  544.                 to put the received data.
  545.  
  546.            -RETURN->
  547.  
  548.            <-RETURN-    Upon return from protocol, MAC re-
  549.                 enables the hardware.
  550.  
  551.  
  552.  
  553.  
  554.                             Page 3-2
  555.  
  556.  
  557.  
  558.  
  559.  
  560. IndicationComplete  -CALL->   MAC calls protocol to
  561.                 allow interrupt-time post
  562.                 processing.
  563.  
  564.            <-RETURN-
  565.  
  566.  
  567.  
  568. Host-Buffered Adapter
  569.  
  570. MAC  Protocol
  571.  
  572. ReceiveChain-CALL-> Call passes pointer to RxDataDescr.
  573.  
  574.            <-RETURN-    Return tells if protocol accepts
  575.                 the frame, and if so, whether it
  576.                 copied the data.  If accepted but
  577.                 not copied, ownership of data
  578.                 blocks passes to the protocol which
  579.                 copies the data asynchronously.
  580.  
  581. IndicationComplete  -CALL->   MAC calls protocol to
  582.                 allow interrupt-time post
  583.                 processing.
  584.  
  585.            <-RETURN-
  586.  
  587. Later, if protocol deferred copying the data (this may occur
  588. during IndicationComplete)
  589.  
  590.            <-CALL- ReceiveRelease.  The call supplies
  591.                 the unique handle from
  592.                 ReceiveChain.
  593.  
  594.            -RETURN->    Data block ownership returned to
  595.                 MAC.
  596.  
  597.  
  598. Indication Control
  599. Two primitives let a protocol selectively control when it can be
  600. called with indications from the MAC.  These are IndicationOn and
  601. IndicationOff.
  602.  
  603. Before calling an indication routine, the MAC implicitly disables
  604. indications.  This means, for example, that if another frame
  605. arrives while the protocol is processing the indication for the
  606. previous one, the protocol will not be reentered.  Likewise, if
  607. the protocol issues a TransmitChain for loopback data from within
  608. the ReceiveLookahead indication routine, it will not be reentered
  609. to process the loopback data reception.
  610.  
  611. Protocols can re-enable indications upon returning from
  612. ReceiveLookahead, ReceiveChain or Status indications or by
  613. calling IndicationOn within the IndicationComplete routine.
  614.  
  615.  
  616.  
  617.                             Page 3-3
  618.  
  619.  
  620.  
  621.  
  622.  
  623. Status Indication
  624. Status indications are calls from a MAC to protocol that convey a
  625. change in adapter or network status.
  626.  
  627. A status indication works much like a reception indication.  The
  628. status indication handler is entered with indications disabled
  629. and there is a mechanism which will leave indications disabled.
  630.  
  631. MAC  Protocol
  632.  
  633. Status -CALL-> Call passes status type and
  634.                 information.
  635.  
  636.            <-RETURN-
  637.  
  638.  
  639. IndicationComplete  -CALL->   MAC calls protocol to
  640.                 allow interrupt-time post
  641.                 processing.
  642.  
  643.            <-RETURN-
  644.  
  645.  
  646. General Requests
  647. General requests are calls from a protocol to a MAC, asking it to
  648. do a general function such as open or close the network adapter
  649. or change the station address.
  650.  
  651. General requests work much like a TransmitChain request, except
  652. the primitives are Request and RequestConfirm.
  653.  
  654. Protocol  MAC
  655.  
  656. Request-CALL-> Issue request to MAC with unique
  657.                 handle.
  658.  
  659.            <-RETURN-    Return indicates if request
  660.                 completed.
  661.  
  662. Later, if request completed asynchronously:
  663.  
  664.            <-CALL- RequestConfirm.  The call supplies
  665.                 unique handle from Request.
  666.  
  667.            -RETURN->
  668.  
  669. If the MAC satisfies the request synchronously, it indicates this
  670. on the return from Request and will not generate a
  671. RequestConfirm.
  672.  
  673.  
  674.  
  675.  
  676.  
  677.                             Page 3-4
  678.  
  679.  
  680.  
  681.  
  682.  
  683. System Requests
  684. System requests support module binding and management functions.
  685. They are usually made by the Protocol Manager to a MAC or
  686. protocol module, but can also be made by a protocol to another
  687. protocol or MAC module.
  688.  
  689. System requests work much like general requests except that all
  690. are synchronous and the requests are not module specific.
  691.  
  692. Upper ModuleLower Module
  693.  
  694. System -CALL->   Issue request to lower module.
  695.  
  696.            <-RETURN- Return indicates request
  697.                   completed.
  698.  
  699. Protocol Manager Primitives
  700. Protocol Manager primitives are requests from protocol or MAC
  701.                   modules to the Protocol
  702. Manager for various Protocol Manager services.  These requests
  703.                   are always synchronous.
  704.  
  705. Protocol or MAC Module   Protocol Manager
  706.  
  707. Protocol Manager Primitive  __CALL___>  Issue request to Protocol
  708.                   Manager
  709.  
  710.         <__RETURN__  Return indicates request
  711.                   completed
  712.  
  713.  
  714.  
  715.  
  716.  
  717.                             Page 3-5
  718.  
  719.  
  720.  
  721.  
  722.  
  723. Chapter 4:  Data Structures
  724.  
  725.  
  726. Module Characteristics
  727. Protocol and Media Access Control (MAC) modules are described by
  728. a data structure called a characteristics table.  Each
  729. characteristics table consists of several sections:  a master
  730. section called the common characteristics table and four
  731. subtables.  The common characteristics table contains module-
  732. independent information, including a dispatch address for issuing
  733. system commands like InitiateBind to the module.  The four
  734. module-specific subtables are chained off the common
  735. characteristics table.  These define module-specific parameters
  736. and the entry points used for inter-module communication (such as
  737. the MAC/protocol interface functions).  When two modules bind
  738. together, they exchange pointers to their common characteristics
  739. tables, so that each gets access to the other's descriptive
  740. information and entry points.
  741.  
  742. NOTE: NDIS drivers must copy the Module DS and entry point
  743. addresses (from the Common Characteristics and Upper/Lower
  744. Dispatch Tables) to their local data segment at Bind time.  In
  745. future versions of this specification, this information may be
  746. volatile.  Having this information directly accessible will also
  747. improve performance.  This information must not be copied prior
  748. to the Bind call and must not be used unless the Bind completes
  749. successfully.
  750.  
  751. NOTE:  The information in the characteristics table for a module
  752. is primarily informational, in support of network management and
  753. configuration tools.  Upper modules binding to lower ones will
  754. NOT need to parse this information to adapt their behavior at the
  755. interface.  They will generally just use the information to
  756. validate that they have been bound to the correct type of module.
  757. Most of the other information is provided in the structure to
  758. support information utilities.
  759.  
  760. Some new fields have been added to some of the characteristics
  761. tables for V2.0.1.  The size/length fields at the start of the
  762. tables can be checked to see if the new fields are available in
  763. the table.
  764.  
  765. Common Characteristics
  766. The format of this information is identical for all modules.
  767. Note that all information in this section of the table is static.
  768.  
  769. WORD  Size of common characteristics table (bytes)
  770. BYTE  Major NDIS Version (2 BCD digits - 02 for this version)
  771. BYTE  Minor NDIS Version (2 BCD digits - 00 for this version)
  772. WORD  Reserved
  773. BYTE  Major Module Version (2 BCD digits)
  774. BYTE  Minor Module Version (2 BCD digits)
  775. DWORD Module function flags, a bit mask :
  776.  
  777.  
  778.  
  779.  
  780.  
  781.      0 - Binding at upper boundary supported
  782.      1 - Binding at lower boundary supported
  783.      2 - Dynamically bound (i.e., this module can be
  784. swapped out)
  785.      3-31 - Reserved, must be zero
  786. BYTE[16]  Module name - ASCIIZ format
  787. BYTE Protocol level at upper boundary of module:
  788.      1 - MAC
  789.      2 - Data link
  790.      3 - Network
  791.      4 - Transport
  792.      5 - Session
  793.      -1 - Not specified
  794. BYTE Type of interface at upper boundary of module:
  795.      For MAC's: 1 => MAC
  796.      For Data Links:  To be defined
  797.      For Transports:  To be defined
  798.      For Session: 1 => NCB
  799.      For any level: 0 => private (ISV defined)
  800. BYTE Protocol level at lower boundary of module
  801.       0 - Physical
  802.       1 - MAC
  803.       2 - Data link
  804.       3 - Network
  805.       4 - Transport
  806.       5 - Session
  807.      -1 - Not specified
  808. BYTE Type of interface at lower boundary of module:
  809.      For MAC:1 => MAC
  810.      For Data Link:    To be defined
  811.      For Transport:    To be defined
  812.      For Session: 1 => NCB
  813.      For any level:    0 => private (ISV defined)
  814. WORD Module ID filled in by Protocol Manager on return from
  815.      RegisterModule
  816. WORD Module DS
  817. LPFUN System request dispatch entry point
  818. LPBUF Pointer to service-specific characteristics (NULL if
  819. none)
  820. LPBUF Pointer to service-specific status (NULL if none)
  821. LPBUF Pointer to upper dispatch table (see below; NULL if
  822. none)
  823. LPBUF Pointer to lower dispatch table (see below; NULL if
  824. none)
  825. LPBUF Reserved for future expansion, must be NULL
  826. LPBUF Reserved for future expansion, must be NULL
  827.  
  828. NOTE:    LPSZ Long pointer to an ASCIIZ string
  829.      LPBUF Long pointer to a data buffer
  830.      LPFUN Long pointer to a function
  831.  
  832. In V1.0.1, the 2 bytes after the first WORD were required to be
  833. set to 0.  For compatibility with V1.0.1, an NDIS spec major
  834.  
  835.  
  836.  
  837.  
  838.                             Page 4-2
  839.  
  840.  
  841.  
  842.  
  843.  
  844. version number of 00 is interpreted the same as major version
  845. number 01.
  846.  
  847. The module function flags bit mask must accurately specify the
  848. capabilities of the module.  The Protocol Manager uses these
  849. fields; e.g. the "Dynamically bound" (bit 2) flag when set
  850. indicates that this module is a dynamically loadable and
  851. unloadable module.  Such a module can only be used in the
  852. Protocol Manager dynamic mode.
  853.  
  854. The upper and lower boundary protocol level and interface type
  855. bytes must accurately specify the protocol level and interface
  856. type.  The Protocol Manager uses these fields.  If an interface
  857. does not support NDIS bindings or a protocol level is undefined
  858. at the interface, a value at OxFF must be used.  In this case the
  859. corresponding interface type is undefined.
  860.  
  861. In addition to the above common characteristics table, a given
  862. module will typically have a set of sub-tables that are chained
  863. off the common table:
  864.  
  865. y Service-specific characteristics table:
  866.   This table contains descriptive information and parameters
  867.   about the module.
  868.  
  869. y Service-specific status table:
  870.   This table contains runtime operating status and statistics for
  871.   the module.
  872.  
  873. y Upper dispatch table:
  874.   This table contains dispatch addresses for the upper boundary
  875.   of the module - i.e., the entry points it exports as a service
  876.   provider.
  877.  
  878. y Lower dispatch table:
  879. This table contains dispatch addresses for the lower
  880. boundary of the module - i.e., the entry points it exports
  881. as a service client.
  882.  
  883. NOTE:  Under OS/2 dispatch addresses and data segments are Ring 0
  884. selectors.  This field is usually set at Ring 3 INIT time even
  885. though the selector set must be Ring 0.
  886.  
  887.  
  888.  
  889.  
  890.  
  891.                             Page 4-3
  892.  
  893.  
  894.  
  895.  
  896.  
  897. MAC Service-Specific Characteristics
  898. All MAC's use the following format for this table.  This table
  899. contains volatile information (like the current station address)
  900. which may be updated by the MAC during the course of operation.
  901. Other modules may read this table directly during execution.
  902.  
  903. WORD  Length of MAC service-specific characteristics table
  904. BYTE [16]   Type name of MAC, ASCIIZ format:
  905.      802.3, 802.4, 802.5, 802.6, DIX, DIX+802.3,
  906. APPLETALK,
  907.      ARCNET, FDDI, SDLC, BSC, HDLC, ISDN
  908. WORD  Length of station addresses in bytes
  909. BYTE [16]   Permanent station address
  910. BYTE [16]   Current station address
  911. DWORD Current functional address of adapter (0 if none)
  912. LPBUF Multicast Address List (structure defined below)
  913. DWORD Link speed (bits/sec)
  914. DWORD Service flags, a bit mask:
  915.         0 - broadcast supported
  916.         1 - multicast supported
  917.         2 - functional/group addressing supported
  918.         3 - promiscuous mode supported
  919.         4 - software settable station address
  920.         5 - statistics are always current in service-specific
  921.                 status table
  922.         6 - InitiateDiagnostics supported
  923.         7 - Loopback supported
  924.         8 - Type of receives
  925.                0 - MAC does primarily ReceiveLookahead indications
  926.                1 - MAC does primarily ReceiveChain indications
  927.         9 - IBM Source routing supported
  928.         10 - Reset MAC supported
  929.         11 - Open / Close Adapter supported
  930.         12 - Interrupt Request supported
  931.         13 - Source Routing Bridge supported
  932.         14 - GDT virtual addresses supported
  933.         15 - Multiple TransferDatas permitted during a single
  934.                  indication (V2.0.1 and later)
  935.         16 - Mac normally sets FrameSize = 0 in ReceiveLookahead
  936.                  (V2.0.1 and later)
  937.         17-31 - Reserved, must be 0
  938. WORD Maximum frame size which may be both sent and received
  939. DWORD Total transmission buffer capacity in the driver
  940. (bytes)
  941. WORD Transmission buffer allocation block size (bytes)
  942. DWORD Total reception buffer capacity in the driver (bytes)
  943. WORD Reception buffer allocation block size (bytes)
  944. CHAR[3]   IEEE Vendor code
  945. CHAR Vendor Adapter code
  946. LPSZ Vendor Adapter description
  947. WORD IRQ Interrupt level used by adapter (V2.0.1 and later)
  948. WORD Transmit Queue Depth (V2.0.1 and later)
  949.  
  950.  
  951.  
  952.  
  953.                             Page 4-4
  954.  
  955.  
  956.  
  957.  
  958.  
  959. WORD Maximum number of data blocks in buffer descriptors
  960. supported (V2.0.1   and later)
  961.  
  962. Remaining bytes in table (based on Length) are vendor-specific
  963.  
  964. In interpreting these tables the implementer must always bear in
  965. mind that additional functions may be added to future MAC's and
  966. that the support of functions that the protocol does not need
  967. must not prevent the protocol from accepting a bind for the MAC.
  968.  
  969. The type name describes to the protocol the type of MAC protocol
  970. header that the MAC driver supports.  In general, protocol stacks
  971. must be prepared to support the types "802.3", "802.5", "DIX" and
  972. "DIX+802.3".  If the native media of the MAC is not one of these
  973. types (for example, ARCNET) then it is recommended that the MAC
  974. developer must consider claiming support for one of the above
  975. types and doing a transparent internal mapping between the
  976. private header format of the media and the public header format
  977. being claimed.  Without support for one of the above header
  978. formats, general protocol compatibility cannot be guaranteed.
  979. The list specified above is not exhaustive.  New names may be
  980. added in the future or a vendor may provide special MAC type
  981. names for use with protocols that interoperate with special MACs
  982. provided by that vendor.  In the latter case it is recommended
  983. that a vendor use a MAC type name that does not start with an
  984. alphanumeric character to avoid conflicts with NDIS MAC type
  985. names that might be specified in future versions of this
  986. specification.
  987.  
  988. The normal type name of an ethernet MAC would be "DIX+802.3."
  989. See Appendix B for references on IEEE 802.3 and DIX.
  990.  
  991. In the various parts of this specification, all station and
  992. multicast addresses for a given MAC have the length specified in
  993. the "Length of Station Address" field.
  994.  
  995. The permanent station address must be obtained from the hardware
  996. if at all possible, as it may be used by LAN Manager for security
  997. or administrative purposes.  If a PROTOCOL.INI entry is used to
  998. override the current station address, the permanent station
  999. address must not be affected.  Only if there is no hardware based
  1000. addressing scheme will it be possible to override the permanent
  1001. station address by configuration parameters.  The current station
  1002. address will always reflect the current address as set via
  1003. parameter or by calling Request SetSetationAddress.
  1004.  
  1005. The functional address DWORD represents the functional address
  1006. bit pattern present in the last 4 bytes of an IBM compatible
  1007. functional address.  This excludes the first 2 bytes 0xC0, 0x00.
  1008. The functional address DWORD represents the logical OR of all
  1009. functional addressess currently registered to the adapters.
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.                             Page 4-5
  1016.  
  1017.  
  1018.  
  1019.  
  1020.  
  1021. Multicast Address List is a buffer formatted as follows:
  1022.  
  1023. WORD Maximum number of multicast addresses
  1024. WORD Current number of multicast addresses
  1025. BYTE[16]  Multicast address 1
  1026. BYTE[16]  Multicast address 2
  1027.      . . .
  1028. BYTE[16]  Multicast Address N
  1029.  
  1030. The Multicast Address List is kept packed by the MAC so that the
  1031. current multicast addresses occur first in the list.
  1032.  
  1033. Service flags indicate which optional functions are supported by
  1034. an NDIS driver. If a particular function bit is set, that
  1035. function is supported.  When attempts are made to invoke
  1036. unsupported functions, NDIS MAC drivers must respond properly by
  1037. returning INVALID_FUNCTION (0x0008).
  1038.  
  1039. If loopback is supported in the network adapter hardware, then
  1040. bit 7 of the MAC service flags must be set.
  1041.  
  1042. If loopback is not supported in hardware (bit 7 of the MAC
  1043. service flags is not set), the protocol driver must handle this
  1044. function itself by some loopback delivery of the frame to be
  1045. transmitted.
  1046.  
  1047. The following criteria must be met for loopback:
  1048.  
  1049. 1.   The destination address is the same as the local
  1050. station's current stationaddress or the destination is
  1051. a broadcast, multicast or functional address which
  1052. would have been received by this station if sent by another.
  1053.  
  1054. 2.   The frame must qualify for reception according to the
  1055. current packet filter.
  1056.  
  1057. The loopback mechanism must cause the Receive indication to occur
  1058. at interrupt time (and it must be delayed by IndicationOff)
  1059.  
  1060. If IBM source routing is used (bit 9 is set) it is the protocol
  1061. module's responsibility to encode and interpret appropriate
  1062. source routing information.  This bit merely implies that the
  1063. device is capable of sending packets with the "source routing
  1064. bit" set in the source address so that a protocol may recognize
  1065. such a packet.
  1066.  
  1067. While the ResetMAC function (bit 10) is optional, it is strongly
  1068. recommended that those implementing the NDIS MAC driver support
  1069. this function.  Some protocol drivers may rely on this function
  1070. to recover from hardware error conditions.
  1071.  
  1072. If the service flags indicate that OpenAdapter is supported (bit
  1073. 11 is set), then the protocol driver must ensure that the adapter
  1074. is open.  The open status of an adapter can be determined by
  1075.  
  1076.  
  1077.  
  1078.                             Page 4-6
  1079.  
  1080.  
  1081.  
  1082.  
  1083.  
  1084. examining bit 4 of the MAC status in the MAC service-specific
  1085. status table.  If the adapter is not open, then the protocol must
  1086. issue an OpenAdapter Request (normally during bind-time
  1087. processing).
  1088.  
  1089. If Source Routing Bridge is set (bit 13) then it is implied that
  1090. the MAC is capable of receiving all packets on the network which
  1091. have the source routing bit set.
  1092.  
  1093. If GDT virtual addresses are supported (bit 14 is set) then Ring
  1094. 0 GDT virtual addresses may be used to describe frames.  All
  1095. MAC's must support the use of physical addresses to describe
  1096. frames; however, for some MAC's it is preferable to supply a GDT
  1097. address if one is readily available.  The GDT address must remain
  1098. valid throughout the scope of its use by the MAC.
  1099.  
  1100. If bit 16 of the service flags field is set, then the MAC driver
  1101. does not normally provide the total frame size of received data.
  1102. In this case the MAC normally calls RecieveLookahead with the
  1103. FrameSize parameter equal to 0.  Setting this bit is optional.
  1104. It is left to the MAC implementor to determine how frequently
  1105. returning FrameSize equals 0 constitutes sufficient grounds to
  1106. set this bit.  However, this bit must be reset if the MAC always
  1107. calls ReceiveLookahead with the FrameSize parameter non-zero or
  1108. if a 0 FrameSize parameter is returned only for intermittent
  1109. erroneous packet reception.  For V1.0.1 compatibility, bit 16
  1110. reset gives no indication whether the MAC will return a zero
  1111. FrameSize parameter or not.  Some MAC and higher layer protocols
  1112. do not support "length" fields within their encoding.  Such
  1113. protocols rely on knowing the size of valid frame data received
  1114. at the MAC interface and then deduce the amount of data at their
  1115. layer by stripping off the lower layer protocol headers.  This
  1116. bit warns such protocols that the required received frame size is
  1117. not normally available at the MAC interface and that receive
  1118. frames might not be able to be processed.  Such protocols can
  1119. refuse to bind to such MACs.
  1120.  
  1121. The maximum frame size must reflect the maximum size packet that
  1122. can be both transmitted and received by the MAC client.  This
  1123. size must reflect only the bytes which actually cross the NDIS
  1124. boundary.  For Ethernet, this value is typically 1514, since the
  1125. client does not specify the CRC bytes.  Token Ring values vary
  1126. but do not include the non-data SD, ED and FS bytes or the FCS.
  1127.  
  1128. The network adapter RAM is characterized by four parameters.  The
  1129. first is the number of bytes available for storing packets to be
  1130. transmitted, usually one or two full-size packets in size.  The
  1131. second parameter is the allocation granularity, typically about
  1132. 256 bytes, indicating how much memory would be occupied by a one
  1133. byte packet pending transmission.  The next two parameters are
  1134. the number of bytes available for storing received packets and
  1135. the receive packet granularity.  Often these parameters will be
  1136. affected by PROTOCOL.INI keywords (for example, specifying two
  1137. transmit buffers rather than one), and it is required that these
  1138.  
  1139.  
  1140.  
  1141.                             Page 4-7
  1142.  
  1143.  
  1144.  
  1145.  
  1146.  
  1147. numbers accurately reflect the current adapter configuration.
  1148. Protocol drivers may use these numbers to determine reasonable
  1149. window sizes, and incorrect values may impact performance.
  1150.  
  1151. The intent of the IEEE Vendor and Vendor Adapter Codes is that,
  1152. when used in combination, they uniquely identify this MAC driver
  1153. for this adapter.  The IEEE Vendor Code uniquely defines the
  1154. vendor providing the MAC driver.  The use of the IEEE Vendor Code
  1155. avoids the need for any global registry of Vendor Adapter Codes.
  1156. The IEEE Vendor Code is assigned by the IEEE and becomes the
  1157. first three bytes of a six-byte IEEE 802 address.  The Vendor
  1158. Adapter Code specifies a particular MAC driver provided by the
  1159. Vendor for an adapter.  If the IEEE Vendor Code is assigned to
  1160. the Vendor, the Vendor assigns a unique Vendor Adapter Code to
  1161. each MAC driver provided.  For those without an IEEE Vendor Code,
  1162. a value of 0xFFFFFF is required.  In this case, the Vendor
  1163. Adapter Code is undefined.
  1164.  
  1165. The Vendor Adapter description string is an ASCIIZ string
  1166. containing a description of the adapter that could be used to
  1167. format an error message (for example, "3Com EtherLink II
  1168. Adapter").
  1169.  
  1170. The transmit queue depth specifies the maximum number of
  1171. TransmitChain requests the MAC can buffer internally.  This
  1172. number must be set to one if the TransmitChain implementation in
  1173. the MAC is synchronous.  Each queued TransmitChain request
  1174. requires that the MAC driver copy at least the chain descriptor
  1175. and immediate data, so this parameter is generally configurable
  1176. through a PROTOCOL.INI keyword called MAXTRANSMITS.  The protocol
  1177. driver can use this queue depth to compute the amount of time a
  1178. transmit might be queued up within the MAC.
  1179.  
  1180. The maximum number of data buffer blocks is the maximum number of
  1181. blocks supported in Transmit, TransferData, and ReceiveChain
  1182. buffer desciptors.  For V1.0.1 backward compatibility this must
  1183. be a minimum of 8.  For V1.0.1 compatible MACs for which this
  1184. field is absent, the maximum number assumed is 8.
  1185.  
  1186. The size of the NDIS defined part of the MAC specific
  1187. characteristics table may increase in subsequent versions of the
  1188. specification.  If vendor specific information follows the NDIS
  1189. defined information, a protocol using it must check the NDIS spec
  1190. version number in the Common Characteristics table to determine
  1191. where the NDIS specified information ends and the vendor
  1192. specified information begins.
  1193.  
  1194. MAC Service-Specific Status Table
  1195. The MAC service-specific status and media-specific statistics
  1196. tables provide information about the status of and traffic
  1197. through a MAC.  Since these tables can be updated by the MAC
  1198. driver at interrupt time, a protocol must ensure that these
  1199. tables are read with interrupts disabled.  The MAC must update
  1200.  
  1201.  
  1202.  
  1203.  
  1204.                             Page 4-8
  1205.  
  1206.  
  1207.  
  1208.  
  1209.  
  1210. this table (and the media-specific statistics table if present)
  1211. atomically.
  1212.  
  1213. WORD     Length of status table
  1214. DWORD    Date/time when diagnostics last run (0xFFFFFFFF if not
  1215.      run).  Format is seconds since 12:00 Midnight January
  1216.      1, 1970
  1217. DWORD    MAC status, a 32-bit mask:
  1218.         0-2 - Opcoded as follows:
  1219.      0 - Hardware not installed
  1220.      1 - Hardware failed startup diagnostics
  1221.      2 - Hardware failed due to configuration problem
  1222.      3 - Hardware not operational due to hardware fault
  1223.      4 - Hardware operating marginally due to soft faults
  1224.      5-6 Reserved
  1225.      7 - Hardware fully operational
  1226.         3 - If set, MAC is bound, else not bound
  1227.         4 - If set, MAC is open, else not open (if adapter
  1228.      doesn't support open/close function, set to 1 if
  1229.      hardware is functional)
  1230.         5 - If set, adapter diagnostics are in progress (V2.0.1
  1231.      and later)
  1232.         6-31 - Reserved, must be zero
  1233. WORD Current packet filter, a bit mask:
  1234.         0 - directed and multicast or group and functional
  1235.         1 - broadcast
  1236.         2 - promiscuous
  1237.         3 - all source routing
  1238.         4-15 - Reserved, must be zero
  1239.  
  1240. Statistics for MAC's (0xFFFFFFFF means not kept):
  1241. LPBUF   Pointer to media specific statistics table (may be
  1242.      NULL)
  1243. DWORD   Date/time when last ClearStatistics issued (0xFFFFFFFF
  1244.      if not kept) format is seconds since 12:00 Midnight
  1245.      January 1, 1970
  1246. DWORD   Total frames received
  1247. DWORD   Frames with CRC error
  1248. DWORD   Total bytes received
  1249. DWORD   Frames discarded - no buffer space
  1250. DWORD   Multicast frames received
  1251. DWORD   Broadcast frames received
  1252. DWORD   Frames received with errors
  1253. DWORD   Frames exceeding maximum size
  1254. DWORD   Frames smaller than minimum size
  1255. DWORD   Multicast bytes received
  1256. DWORD   Broadcast bytes received
  1257. DWORD   Frames discarded - hardware error
  1258. DWORD   Total frames transmitted
  1259. DWORD   Total bytes transmitted
  1260. DWORD   Multicast frames transmitted
  1261. DWORD   Broadcast frames transmitted
  1262. DWORD   Broadcast bytes transmitted
  1263. DWORD   Multicast bytes transmitted
  1264.  
  1265.  
  1266.  
  1267.                             Page 4-9
  1268.  
  1269.  
  1270.  
  1271.  
  1272.  
  1273. DWORD  Frames not transmitted - time-out
  1274. DWORD  Frames not transmitted - hardware error
  1275.  
  1276. Remaining bytes (based on Length) in table are vendor specific.
  1277.  
  1278. All statistics counters are 32-bit unsigned integers that wrap to
  1279. zero when the maximum count is reached after which the counters
  1280. will continue to count.  When updating these counters, a frame is
  1281. counted in all the supported counters that apply.  The case of an
  1282. unsupported counter (0xFFFFFFFF) can be distinguished from the
  1283. situation wherby a counter is about the wrap around if the values
  1284. of the counters are checked at bind times.  If the initial value
  1285. of the counter is 0xFFFFFFFF, then the counter is not supported.
  1286. Otherwise the counter is supported and 0xFFFFFFFF at a later time
  1287. means the counter is about to wrap around.
  1288.  
  1289. MAC Upper Dispatch Table
  1290. The number and meaning of dispatch addresses provided here apply
  1291. to the boundary between a MAC and a protocol.  This may differ at
  1292. other protocol boundaries.  Note that each upper/lower module
  1293. binding may have its own unique set of dispatch addresses that is
  1294. set up when the modules exchange characteristics tables.  This
  1295. can be achieved by exchanging copies of the common
  1296. characteristics table, where the copy has the desired pointers to
  1297. the specific dispatch tables for the binding.
  1298.  
  1299. LPBUF  Back pointer to common characteristics table
  1300. LPFUN  Request address
  1301. LPFUN  TransmitChain address
  1302. LPFUN  TransferData address
  1303. LPFUN  ReceiveRelease address
  1304. LPFUN  IndicationOn address
  1305. LPFUN  IndicationOff address
  1306.  
  1307. NOTE: No dispatch address is allowed to be NULL.
  1308.  
  1309. Protocol Service-Specific Characteristic Table
  1310. For compatibility with future versions of this specification, all
  1311. protocols must provide a protocol service-specific
  1312. characteristics table which starts with the following fields:
  1313.  
  1314. WORD Length of protocol service-specific characteristics
  1315. table
  1316. BYTE [16]   Type name of protocol, ASCIIZ format:
  1317. WORD Protocol type code
  1318.  
  1319. This may be followed by protocol-specific information.
  1320.  
  1321. The protocol type name will be used in future versions of this
  1322. specification.  Specific type names for different protocol types
  1323. will be defined later.  Protocol type codes will also be defined
  1324. later.  For the moment these two fields are simple place holders
  1325. and must be set to null string and zero respectively.
  1326.  
  1327.  
  1328.  
  1329.  
  1330.                           Page 4-10
  1331.  
  1332.  
  1333.  
  1334.  
  1335.  
  1336. Protocol Lower Dispatch Table
  1337. The protocol lower dispatch table is specified in the
  1338. characteristics table for the protocol binding to the MAC.  The
  1339. characteristics table for the MAC actually does not supply a
  1340. lower dispatch table (the pointer to it is NULL).
  1341.  
  1342. LPBUF  Back pointer to common characteristics table
  1343. DWORD  Interface flags (used by Vector frame dispatch):
  1344.      0 - Handles non-LLC frames
  1345.      1 - Handles specific-LSAP LLC frames
  1346.      2 - Handles non-specific-LSAP LLC frames
  1347.      3-31 - Reserved must be zero
  1348. LPFUN  RequestConfirm address
  1349. LPFUN  TransmitConfirm address
  1350. LPFUN  ReceiveLookahead indication address
  1351. LPFUN  IndicationComplete address
  1352. LPFUN  ReceiveChain indication address
  1353. LPFUN  Status indication address
  1354.  
  1355.  
  1356. NOTE: No dispatch address is allowed to be NULL.
  1357.  
  1358. Characteristic Tables for NetBIOS Drivers
  1359. NetBIOS drivers written to the existing LAN Manager Ring0 NetBIOS
  1360. specification can be adapted to fit into the Protocol Manager
  1361. structure by defining a common characteristics table for them
  1362. shown below.  Note that such a NetBIOS driver must still respond
  1363. to the existing LAN Manager NetBIOS Linkage binding mechanism;
  1364. these drivers will only use Protocol Manager binding at their
  1365. lower boundary (to the MAC).  A variant kind of NetBIOS module
  1366. will be defined in the future that takes advantage of Protocol
  1367. Manager binding at both boundaries.
  1368.  
  1369. Common characteristics for NetBIOS drivers:
  1370.  
  1371. WORD Size of common characteristics table (bytes)
  1372. BYTE Major NDIS Version (2 BCD digits)
  1373. BYTE Minor NDIS Version (2 BCD digits)
  1374. WORD Reserved
  1375. BYTE Major Module Version (2 BCD digits)
  1376. BYTE Minor Module Version (2 BCD digits)
  1377. DWORD Module function flags, 0x00000002 (binds lower)
  1378. BYTE[16]  NetBIOS Module name
  1379. BYTE Protocol level at upper boundary of module:  5 =
  1380.      Session
  1381. BYTE Type of interface at upper boundary of module:  1 =
  1382.      LANMAN NCB
  1383. BYTE Protocol level at lower boundary of module: 1 = MAC
  1384. BYTE Type of interface at lower boundary of module: 1 = MAC
  1385. WORD NetBIOS Module ID
  1386. WORD NetBIOS Module DS
  1387. LPFUN System request dispatch entry point
  1388. LPBUF Pointer to service-specific characteristics (see below)
  1389. LPBUF Pointer to service-specific status, must be (NULL)
  1390. LPBUF Pointer to upper dispatch table (see below)
  1391.  
  1392.  
  1393.  
  1394.                           Page 4-11
  1395.  
  1396.  
  1397.  
  1398.  
  1399.  
  1400. LPBUF Pointer to lower dispatch table (see below)
  1401. LPBUF Reserved, must be NULL
  1402. LPBUF Reserved, must be NULL
  1403.  
  1404. Upper dispatch table for a NetBIOS module:
  1405.  
  1406. LPBUF Back pointer to common characteristics table
  1407. LPFUN Request address
  1408. LPFUN NetBIOS NCB handler (LANMAN calling conventions)
  1409.  
  1410. Lower dispatch table for a NetBIOS module:
  1411.  
  1412. LPBUF Back pointer to common characteristics table
  1413. DWORD Interface flags (used by Vector frame dispatch):
  1414.      0 - Handles non-LLC frames
  1415.      1 - Handles specific-LSAP LLC frames
  1416.      2 - Handles non-specific-LSAP LLC frames
  1417.      3-31 - Reserved must be zero
  1418. LPFUN RequestConfirm address
  1419. LPFUN TransmitConfirm address
  1420. LPFUN ReceiveLookahead indication address
  1421. LPFUN IndicationComplete address
  1422. LPFUN ReceiveChain indication address
  1423. LPFUN Status indication address
  1424.  
  1425. Service-specific characteristics for a NetBIOS module:
  1426.  
  1427. WORD Length of NetBIOS module service-specific
  1428. characteristics table
  1429. BYTE [16]   Type name of NetBIOS module, ASCIIZ format:
  1430. WORD NetBIOS module type code
  1431.  
  1432. This may be followed by module-specific information.
  1433.  
  1434. The protocol type name will be used in future versions of this
  1435. specification.  Specific type names for different protocol types
  1436. will be defined later.  Protocol type codes will also be defined
  1437. later.  For the moment these two fields are simple place holders
  1438. and must be set to null string and zero respectively.
  1439.  
  1440.  
  1441. Frame Data Description
  1442. The MAC describes frame data with a data structure called a
  1443. buffer descriptor.  The descriptor is composed of pointers and
  1444. lengths which describe a logical frame.  Buffer descriptors are
  1445. ephemeral objects.  A descriptor is valid only during the scope
  1446. of the call that references it as a parameter.  The called
  1447. routine must not modify the descriptor in any way.  If the called
  1448. routine needs to refer to the described data blocks after
  1449. returning from the call, it must save the information contained
  1450. in the descriptor.
  1451.  
  1452. Data blocks described by descriptors are long-lived.  Ownership
  1453. of the data blocks is implicitly passed to the module that is
  1454.  
  1455.  
  1456.  
  1457.                           Page 4-12
  1458.  
  1459.  
  1460.  
  1461.  
  1462.  
  1463. called with the descriptor.  The called module relinquishes
  1464. ownership back to the caller either via setting a return
  1465. argument, or by later issuing a call back to the supplying
  1466. module.  Under OS/2, some pointers may be either GDT virtual
  1467. addresses or physical addresses.  In this case the pointer has an
  1468. associated pointer type opcoded field.  Defined values are 0 for
  1469. physical address and 2 for GDT virtual addresses.  GDT virtual
  1470. addresses may be supplied to the MAC only if bit 14 of the
  1471. service flags in the MAC service specific characteristics table
  1472. is set.  The GDT address must remain valid throughout the scope
  1473. of its use by the MAC.
  1474.  
  1475. Under DOS there is no distinction between physical and virtual
  1476. addresses.  All addresses in this case are segment: offset.  Care
  1477. must be taken to ensure that the segment offset plus data length
  1478. do not exceed the 64K segment boundary.  The pointer type field
  1479. if present is always encoded as a 0.
  1480.  
  1481. For performance reasons,it is recommended that data blocks used
  1482. for transmission and reception be double-word aligned where
  1483. possible.  Both MAC and protocol NDIS drivers may choose to
  1484. perform byte, word or dword memory movement without first
  1485. ensuring proper alignment.  This will result in reduced
  1486. performance in combination with drivers which do not guarantee
  1487. such alignment.
  1488.  
  1489. A buffer descriptor may contain one or more data blocks of length
  1490. zero.  In this case the other fields in the data block (Data Ptr
  1491. and Data Type) may not be valid and must be ignored.
  1492.  
  1493. Transmit Buffer Descriptor
  1494. All transmit data is passed using a far pointer to a transmit
  1495. buffer descriptor, TxBufDescr.  The format of this descriptor is:
  1496.  
  1497. WORD TxImmedLen  ;Byte count of immediate data; max is 64
  1498. LPBUF TxImmedPtr  ;Virtual address of immediate data
  1499. WORD TxDataCount ;Count of remaining data blocks; max is
  1500. configurable
  1501.  
  1502. Followed by TxDataCount instances of:
  1503.  
  1504. BYTE TxPtrType   ;Type of pointer (0=Physical, 2=GDT)
  1505. BYTE TxResByte   ;Reserved Byte (must be 0)
  1506. WORD TxDataLen   ;Length of data block
  1507. LPBUF TxDataPtr   ;Address of data block
  1508.  
  1509. In a TxBufDescr structure, the immediate data described by the
  1510. first two fields is ephemeral and may be referenced only during
  1511. the scope of the call that supplies it.  Such immediate data is
  1512. always transmitted before data described by TxDataLen and
  1513. TxDataPtr pairs.  If the called routine needs to refer to the
  1514. immediate data after returning from the call, it must copy the
  1515. data.  The maximum size of immediate data is 64 bytes.  For
  1516. V2.0.1 MACS or later the maximum TxDataCount is specified in the
  1517.  
  1518.  
  1519.  
  1520.                           Page 4-13
  1521.  
  1522.  
  1523.  
  1524.  
  1525.  
  1526. MAC specific characteristics table.  For V1.0.1 MACs the maximum
  1527. count is 8.
  1528.  
  1529. Transfer Data Buffer Descriptor
  1530. Transfer data can be described by a far pointer to a transfer
  1531. data buffer descriptor, TDBufDescr.  Transfer data buffer
  1532. descriptors have the following format:
  1533.  
  1534. WORD  TDDataCount    ; Count of transfer data
  1535. blocks; max is configurable
  1536.  
  1537. Followed by TDDataCount instances of:
  1538.  
  1539. BYTE TDPtrType   ;Type of pointer (0=Physical, 2=GDT)
  1540. BYTE TDResByte   ;Reserved Byte (must be 0)
  1541. WORD TDDataLen   ;Length of data block
  1542. LPBUF TDDataPtr   ;Address of data block
  1543.  
  1544. For V2.0.1 MACs or later the maximum TDDataCount is specified in
  1545. the MAC specific characteristics table.  For V1.0.1 MACs the
  1546. maximum count is 8.
  1547.  
  1548. Receive Chain Buffer Descriptor
  1549. Receive chain data can be passed by a far pointer to a receive
  1550. chain buffer descriptor, RxBufDescr.  Receive chain buffer
  1551. descriptors have the following format:
  1552.  
  1553. WORD RxDataCount ;Count of receive data blocks; max is
  1554. configurable
  1555.  
  1556. Followed by RxDataCount instances of:
  1557.  
  1558. WORD RxDataLen   ;Length of data block
  1559. LPBUF RxDataPtr   ;Virtual address of data block
  1560.  
  1561. For V2.0.1 MACs or later the maximum receive data block count is
  1562. specified in the MAC specific characteristics table.  For V1.0.1
  1563. MACs the maximum count is 8.
  1564.  
  1565. For received frames that are larger than 256 bytes, the first
  1566. data block of the frame must be at least 256 bytes long.  Frames
  1567. less than or equal to 256 bytes will be passed up with
  1568. RxDataCount equal to 1.
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.                           Page 4-14
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580. PROTOCOL.INI
  1581. The PROTOCOL.INI file stores configuration and binding
  1582. information for all the protocol and MAC modules in the system.
  1583. The file uses the same general format as the LANMAN.INI file.  It
  1584. consists of a series of named sections, where the section name is
  1585. in fact the module name from a module characteristics table.
  1586. Below the bracketed module name is a set of configuration
  1587. settings for the module in name=value format.  For example:
  1588.  
  1589. [MYNetBIOS]
  1590. Drivername = NetBIOS$
  1591. Bindings = ETHERCARD
  1592. MaxNCBs = 16
  1593. MaxSessions = 32
  1594. MaxNames = 16
  1595.  
  1596. The rules for PROTOCOL.INI contents are:
  1597.  
  1598. y Bracketed module name.  Must be the name of a protocol or MAC
  1599.   module, e.g. [MYNetBIOS].  This is the name of the module as
  1600.   defined in that module's characteristics table.  The name must
  1601.   be 15 characters or less (not counting the brackets).  Mixed
  1602.   case may be used but the Protocol Manager will convert it to
  1603.   uppercase when it reads the file into memory.
  1604.  
  1605. y Drivername = <device driver name>.  This parameter is required
  1606.   for all device driver modules.  It defines the name of the OS/2
  1607.   or DOS device driver that the module is contained in.  Note
  1608.   that a single device driver name may be mentioned by several
  1609.   sections of the PROTOCOL.INI file, if the driver contains
  1610.   multiple logical modules.  The Drivername parameter is the
  1611.   recommended method by which a module searches for its module
  1612.   section in the PROTOCOL.INI file to get its configuration
  1613.   parameters.  This allows the module to find all relevant module
  1614.   sections based on a single name intrinisic to the module
  1615.   independent of the particular bracketed module name used in the
  1616.   PROTOCOL.INI file.  This keyword is also required for DOS
  1617.   dynamic modules like TSRs or transient application modules.
  1618.   Although there is no driver name instrinsically assigned to
  1619.   such modules it is required that a unique name be assigned to
  1620.   this keyword for such modules anyway.  In this way the same
  1621.   search mechanism used by device drivers can be used by dynamic
  1622.   DOS modules to find their relevant module sections in
  1623.   PROTOCOL.INI.
  1624.  
  1625. y Bindings = <module name> | <module name>,<module name>, . . .
  1626.   This parameter is optional for protocol modules.  It is not
  1627.   valid for MAC modules.  If present, it is used by the protocol
  1628.   module to determine what MAC modules it will ask to bind to.
  1629.   (In other words, changing this parameter in the PROTOCOL.INI
  1630.   file can reconfigure a protocol to bind to a different MAC.).
  1631.   The Bindings parameter may be omitted if the protocol driver
  1632.   software is preconfigured to bind to a particular MAC, or if
  1633.  
  1634.  
  1635.  
  1636.                           Page 4-15
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.   the system will only contain one MAC and one static protocol
  1643.   module.  In the latter case (only in static mode), the Protocol
  1644.   Manager by default will ask the one static protocol to bind to
  1645.   the one MAC.
  1646.  
  1647. y Other keywords and parameters.  Any other keyword=value
  1648.   statements are module specific.  Keyword names must be 15
  1649.   characters or less.  They may be mixed case but are converted
  1650.   to uppercase when read by the Protocol Manager.  Note that
  1651.   keyword names are unique within the scope of each <module name>
  1652.   section and can appear within the section in any order.
  1653.  
  1654. y Whitespace around the equals sign is not significant, nor is
  1655.   trailing white space on the line.  Except for this leading and
  1656.   trailing white space, all other characters of the value string
  1657.   are taken verbatim.
  1658.  
  1659. y A list of 0 or more parameters can appear to the right of the
  1660.   equals sign.  If there are no parameters the equals sign can be
  1661.   optionally omitted.  A parameter is terminated by a space, tab,
  1662.   comma, or semicolon.  No parameters are interpreted by the
  1663.   Protocol Manager.
  1664.  
  1665. y A parameter can either be up to a 31-bit signed numeric value
  1666.   or a string of any length.
  1667.  
  1668. y A numeric parameter can be expressed either in decimal or
  1669.   hexadecimal format.  All numeric parameters must start with the
  1670.   characters '0' through '9' or by a + or - followed by the '0'
  1671.   to'9' character.  A hexadecimal parameter must start with '0x'
  1672.   or '0X' and use valid hexadecimal digits.  A non-hexadecimal
  1673.   numeric parameter is treated as decimal integer.  A parameter
  1674.   not surrounded by quotes and starting with 0 to 9 or + and -
  1675.   followed by 0 to 9 will be assumed to be a numeric parameter.
  1676.  
  1677. y A string is a parameter which either starts with a non-numeric
  1678.   character or is surrounded with quotes ("....").  The string is
  1679.   preserved in the memory image as it appears in PROTOCOL.INI.
  1680.  
  1681. y A line starting with a semicolon in column 1 is a comment and
  1682.   is ignored.  Blank lines are ignored too.
  1683.  
  1684. y Lines may be as long as required.  Continuation lines are not
  1685.   supported.  Lines end with CR LF.
  1686.  
  1687. y Tabs, formfeeds, and spaces are considered to be white space.
  1688.  
  1689. The Protocol Manager supports an optional section with optional
  1690. keywords defined below:
  1691.  
  1692. [PROTMAN]
  1693. Drivername = PROTMAN$
  1694. Dynamic = YES or NO
  1695. PRIORITY = prot1, prot2, ...
  1696.  
  1697.  
  1698.  
  1699.                           Page 4-16
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705. Bindstatus = YES or NO
  1706.  
  1707. The bracketed module name can be any valid name as long as it is
  1708. unique within this PROTOCOL.INI.  Drivername is required and must
  1709. be assigned PROTMAN$, identifying the section as belonging to the
  1710. Protocol Manager.  None of the entries are case-sensitive.
  1711.  
  1712. The DYNAMIC keyword is optional.  It defaults to NO if not
  1713. present.  If set to NO, the Protocol Manager operates only in the
  1714. static mode and does not support dynamic protocol drivers.  If
  1715. set to YES, the Protocol Manager operates in the dynamic mode and
  1716. supports both static and dynamic binding.
  1717.  
  1718. The PRIORITY keyword is optional.  If absent, then the VECTOR
  1719. uses default demultiplexing priority if multiple protocol drivers
  1720. are bound to the same MAC (see Vector Demultiplexing in Chapter
  1721. 7).  If present, the parameters on the right-hand side are
  1722. presumed to be a list of protocol module names, highest priority
  1723. first.  The VECTOR prioritizes protocol drivers for
  1724. demultiplexing (if necessary) according to their order in the
  1725. list, and packets are offered to the first protocol driver listed
  1726. first.  Protocol drivers not listed are assigned default priority
  1727. AFTER those listed.  It is not necessary that a protocol driver
  1728. ever bind for it to be listed here.
  1729.  
  1730. The BINDSTATUS keyword is optional.  If absent, then the
  1731. BindStatus command is not supported by the Protocol Manager.  If
  1732. set to YES, then BindStatus is supported by the Protocol Manager.
  1733. The default disable condition is a memory optimization feature
  1734. primarily for DOS environments.
  1735.  
  1736. Configuration Memory Image
  1737. When the Protocol Manager initializes, it reads PROTOCOL.INI and
  1738. parses it into a memory image that it makes available to MAC and
  1739. protocol modules via the Get Protocol Manager Info call.  The
  1740. parsed image is formatted to make it easy for run-time modules to
  1741. interpret.  All information contained in PROTOCOL.INI is present
  1742. in the memory image in the same order as in the file.  (Comments
  1743. and white space are of course not present in the image).  Note
  1744. that in static mode the image is only available during device
  1745. driver initialization time.  In dynamic mode the image may
  1746. additionally be created by a utility which then registers it with
  1747. the Protocol Manager.
  1748.  
  1749. The structure definitions defined below do not conform rigorously
  1750. to C language syntax.  They provide a pseudo C-like language to
  1751. define the data structures encoded in the configuration memory
  1752. image.
  1753.  
  1754. ConfigMemoryImage
  1755. The ConfigMemoryImage data structure defines the complete memory
  1756. image for all logical devices read from the PROTOCOL.INI
  1757. configuration file.  It is a doubly linked list of ModuleConfig
  1758.  
  1759.  
  1760.  
  1761.  
  1762.                           Page 4-17
  1763.  
  1764.  
  1765.  
  1766.  
  1767.  
  1768. structures.  Each ModuleConfig structure corresponds to one
  1769. module.  The ConfigMemoryImage structure is defined as follows:
  1770.  
  1771. struct ConfigMemoryImage
  1772. {
  1773. struct Module Config(1) Module(1);
  1774. struct Module Config(2) Module(2);
  1775. . . .
  1776. struct ModuleConfig(N) Module(N);
  1777. };
  1778.  
  1779. where:
  1780.  
  1781. N=the number of modules encountered by the Protocol Manager when
  1782. parsing the configuration file PROTOCOL.INI.
  1783.  
  1784. ModuleConfig
  1785. The ModuleConfig(i) structure defines the memory image for
  1786. configuration parameters corresponding to one (bracketed name)
  1787. module.  For the (i)th module specified in PROTOCOL.INI it is
  1788. defined as follows:
  1789.  
  1790. struct ModuleConfig(i)
  1791. {
  1792. struct ModuleConfig(i+1) far *NextModule;
  1793. struct ModuleConfig(i-1) far *Prev Module;
  1794. unsigned char Module Name [16];
  1795. struct KeywordEntry(1) KeywordEntry(1);
  1796. struct KeywordEntry(2) KeywordEntry(2);
  1797. . . .
  1798. struct KeywordEntry(N) KeywordEntry(N);
  1799. };
  1800.  
  1801. where:
  1802.  
  1803. N = the number of keyword entries encountered in the PROTOCOL.INI
  1804. file for this module.
  1805.  
  1806. NextModule = a FAR pointer to the next module configuration
  1807. structure.  NULL if this is the structure for the last module.
  1808. For OS/2 the selector is a Ring 3 selector.  For DOS the pointer
  1809. is a segment:offset pair.
  1810.  
  1811. PrevModule = a FAR pointer to the previous module configuration
  1812. structure.  NULL if this is the structure for the first module.
  1813. For OS/2 the selector is a Ring 3 selector.  For DOS the pointer
  1814. is a segment:offset pair.
  1815.  
  1816. ModuleName = array containing the characters of the module name
  1817. (given in brackets in the configuration file).  This is an ASCIIZ
  1818. string consisting of a maximum of 15 non-null uppercase
  1819. characters.
  1820.  
  1821. KeywordEntry
  1822.  
  1823.  
  1824.  
  1825.                           Page 4-18
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831. For each keyword line in the configuration file for the module a
  1832. memory image structure is created specifying the keyword and the
  1833. parameter values.  The (j)th keyword encountered in the
  1834. PROTOCOL.INI file for the module is defined as follows:
  1835.  
  1836. struct KeywordEntry(j)
  1837. {
  1838. struct KeywordEntry(j+1) far *NextKeywordEntry;
  1839. struct KeywordEntry(j-1) far *PrevKeywordEntry;
  1840. unsigned char Keyword[16];
  1841. unsigned NumParams;
  1842. struct Param(1) Param(1);
  1843. struct Param(2) Param(2);
  1844. . . .
  1845. struct Param(N) Param(N);
  1846. };
  1847.  
  1848. where:
  1849.  
  1850. N = the number of parameters entered with the keyword.  If N =0
  1851. the parameters are not present.
  1852.  
  1853. NextKeywordEntry = a FAR pointer to the next keyword entry
  1854. structure in the memory image.  NULL if this is the last keyword
  1855. entry.  For OS/2 the selector is a Ring 3 selector.  For DOS the
  1856. pointer is a segment:offset pair.
  1857.  
  1858. PrevKeywordEntry = a FAR pointer to the previous keyword entry
  1859. structure in the memory image.  NULL if this is the first keyword
  1860. entry.  For OS/2 the selector is a Ring 3 selector.  For DOS the
  1861. pointer is a segment:offset pair.
  1862.  
  1863. Keyword = the array containing the characters of the keyword
  1864. found in the configuration file.  This is an ASCIIZ string
  1865. consisting of a maximum of 15 non-null characters.  The case of
  1866. alphabetic characters will be uppercase in the memory image.
  1867.  
  1868. NumParams = the number (N) of parameters entered with the keyword
  1869. each parameter described by a param structure.  The value is 0 if
  1870. no parameters were present.
  1871.  
  1872. Param(k) = the (k)th parameter structure to specify the value of
  1873. one parameter in a list of parameters for a keyword.
  1874. "Param(k+1)" follows Param(k) in sequence within the memory
  1875. image.  Each parameter is delimited by a length field for the
  1876. parameter.  It is assumed that a keyword's fields will be parsed
  1877. sequentially.
  1878.  
  1879. Param
  1880. For the (k)th parameter defined in a parameter list for a
  1881. specific keyword the following structure defines its value and
  1882. attributes:
  1883.  
  1884. struct Param(k)
  1885.  
  1886.  
  1887.  
  1888.                           Page 4-19
  1889.  
  1890.  
  1891.  
  1892.  
  1893.  
  1894. {
  1895. unsigned ParamType;
  1896. unsigned ParamLen;
  1897. union ParamValue
  1898. {
  1899.         long Numeric;
  1900.         unsigned char String[STRINGLEN];
  1901. };
  1902. };
  1903.  
  1904. where:
  1905.  
  1906. STRINGLEN = length of the ASCIIZ parameter string (including the
  1907. terminating NULL) for string parameters.
  1908.  
  1909. ParamType = the type of parameter.  The following types are
  1910. supported:
  1911.       = 0 signed integer supporting up to31 bit values least
  1912. significant byte first.
  1913.       = 1 a string of characters.
  1914.  
  1915. ParamLen =the length of the parameter value.  The length
  1916.       could be one of the following either be 4 for numeric
  1917.       parameters or STRINGLEN for string parameters where
  1918.       STRINGLEN is the length of the string (including the
  1919.       terminating NULL).
  1920.  
  1921. Numeric = a 31-bit signed numeric value.
  1922.  
  1923. String = an ASCIIZ character string.  The case of alphabetic
  1924. characters in the string is preserved from that in PROTOCOL.INI.
  1925.  
  1926. The size of the Param (k) structure is thus ParamLen + 4.
  1927.  
  1928.  
  1929.  
  1930.  
  1931.  
  1932.                           Page 4-20
  1933.  
  1934.  
  1935.  
  1936.  
  1937.  
  1938. BindingsList
  1939. For each module that registers with the Protocol Manager a
  1940. BindingsList structure may be given to the Protocol Manager
  1941. specifying the set of modules that the given module wishes to
  1942. bind to.  The current module will require services from these
  1943. other modules.  This structure is defined as follows:
  1944.  
  1945. struct BindingsList
  1946. {
  1947. unsigned NumBindings;
  1948. struct Module
  1949. {
  1950.         char ModuleName[16];
  1951.  
  1952. } BoundDriver[NUMBINDINGS];
  1953. };   
  1954.  
  1955. where:
  1956.  
  1957. NumBindings = the number (NUMBINDINGS) of modules that the
  1958. specified module wants to be bound to it from below.  In the
  1959. static default binding mode of one static protocol and one MAC, a
  1960. value of 0 in this field means for the protocol that it will bind
  1961. to the MAC.  Otherwise in the non-default binding mode, a value
  1962. of 0 in this field means that the module has no lower bindings.
  1963.  
  1964. ModuleName = an ASCIIZ string specifying the logical name of a
  1965. module which the current module wishes to have bound to it from
  1966. below.  Maximum of 15 non-null characters.  The Protocol Manager
  1967. will convert all alphabetic characters to uppercase.
  1968.  
  1969. BoundDriver = an array of NUMBINDINGS module names specifying the
  1970. list of modules to which the current module wants to be bound.
  1971.  
  1972. The order of the modules in the list is significant in that
  1973. InitiateBind requests will be issued to the protocol module in
  1974. this order.
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.                           Page 4-21
  1981.  
  1982.  
  1983.  
  1984.  
  1985.  
  1986. Chapter 5:  Specification of Primitives
  1987.  
  1988.  
  1989. Implementers should obey the following general guidelines:
  1990.  
  1991. y All primitives specified in this section can be called in
  1992.   protected mode in either interrupt or task context under OS/2.
  1993.   Since any primitive may be called in interrupt context it is
  1994.   illegal to block during the execution of a primitive.
  1995.  
  1996. y All routines must run (as much as possible) with interrupts
  1997.   enabled.  Interrupt handlers must dismiss the interrupt at the
  1998.   8259 as soon as possible.
  1999.  
  2000. y An indication handler will normally be entered with interrupts
  2001.   enabled.  The handler may enable or disable interrupts if it
  2002.   chooses and on return the MAC must assume that the interrupt
  2003.   state may have been changed.
  2004.  
  2005. y Under MS-DOS indication handlers must assume they have only 200
  2006.   bytes of stack space.  If more stack space is needed then the
  2007.   handler must supply a stack.
  2008.  
  2009. y Confirmation and IndicationComplete handlers must be fully re-
  2010.   entrant and are always entered with interrupts enabled.  Under
  2011.   DOS Confirmation and IndicationComplete handlers must assume
  2012.   they are entered on whatever stack the interrupt occurred on.
  2013.  
  2014. y A confirmation handler may be entered with the confirmation for
  2015.   a request before the request has returned.
  2016.  
  2017. y It is recommended that a MAC release the internal resources
  2018.   associated with either TransmitChain or a request before
  2019.   calling the confirmation handler.  This allows the protocol to
  2020.   submit a new TransmitChain or request from the confirmation
  2021.   handler.  Failing to do so may have a significant impact on
  2022.   performance.
  2023.  
  2024. y A protocol must assume whenever it gives control to a MAC that
  2025.   interrupts may be enabled by the MAC unless otherwise
  2026.   explicitly specified.
  2027.  
  2028. y When passing a virtual address to one of these primitives under
  2029.   OS/2 the address must be a Ring 0 GDT address unless otherwise
  2030.   specified.  The interrupt service routine portion of the MAC
  2031.   must handle the fact that this address may not be valid if an
  2032.   interrupt occurs in real mode.
  2033.  
  2034. y All primitives have a set of specific error codes defined.  In
  2035.   general, MAC's and protocols must return these specific codes.
  2036.   However it is acceptable to return GENERAL_FAILURE for any non-
  2037.   recoverable failure.  NDIS developers must be aware that new
  2038.   error codes may be added in the future and must design their
  2039.   code to allow for this.
  2040.  
  2041. y If a particular entry point or function is not supported by an
  2042.   NDIS protocol or MAC driver, the entry point must still be
  2043.   exposed and an error (INVALID_FUNCTION 0x0008) returned if it
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.   is called.  Crashing when an unsupported request is made is
  2050.   unacceptable.
  2051.  
  2052. y Parameters are passed on the stack compatible with Microsoft C
  2053.   FAR Pascal calling conventions.  On entry to any routine the
  2054.   called module must save the caller's DS before setting its DS
  2055.   from the "dataseg" parameter.  At exit the caller's DS must be
  2056.   restored.  Furthermore the called module must follow standard
  2057.   Microsoft C conventions about saving "register variable" SI and
  2058.   DI registers if these are used.  Modules which use the 80386
  2059.   registers EDI, ESI and EBP must preserve these registers also.
  2060.   The direction bit is assumed to be clear on entry and must be
  2061.   clear upon exit.  These conventions apply for calls in both
  2062.   directions across the NDIS MAC interface.
  2063.  
  2064. y Direct calls return in AX a return code specifying the status
  2065.   of function invocation.  Those functions specified as using
  2066.   IOCTLs return this in the status field of the request block.
  2067.  
  2068. y Before calling a module in OS/2 it is the caller's
  2069.   responsibility to ensure that it is currently executing in
  2070.   protected mode.  If it is running in real mode it must do an
  2071.   OS/2 "RealToProt"  DevHlp call before calling the inter-module
  2072.   interface function.  Furthermore in OS/2 the inter-module call
  2073.   can only be made at post CONFIG.SYS INIT time since all
  2074.   selectors are Ring 0 selectors.
  2075.  
  2076. y A MAC starts with packet reception disabled.  A protocol must
  2077.   call SetPacketFilter to enable reception of packets.
  2078.  
  2079. y It is recommended that the number of Request commands which can
  2080.   be simultaneously queued by the MAC be configurable.  The
  2081.   suggested keyword in the configuration file is "MaxRequests."
  2082.   The recommended default  is 6.  The suggested range is 1 to 10.
  2083.  
  2084. y The number of TransmitChain commands which can be
  2085.   simultaneously queued by the MAC must be configurable.  The
  2086.   suggested keyword in the configuration file is "MaxTransmits".
  2087.   The recommended default  is 6.  The suggested range is 1 to 50.
  2088.  
  2089. y On a DIX or 802.3 network, packet buffers received may have
  2090.   been padded to the minimum packet size for short packets.  It
  2091.   is the responsibility of the MAC client to examine the length
  2092.   field if present and strip off the padding.
  2093.  
  2094. y For DIX or 802.3 networks the MAC client can transmit a buffer
  2095.   with packet length smaller than the minimum.  It is the
  2096.   responsibility of the MAC to provide the required padding bytes
  2097.   before transmission on to the wire.  The content of the padding
  2098.   bytes is undefined.
  2099.  
  2100. y Protocol drivers conforming to this specification are expected
  2101.   to format and interpret MAC headers for the MAC driver types
  2102.   supported.  Generally, protocols are expected to support
  2103.   802.3, DIX, and 802.5 MAC headers. It is recommended that  MAC
  2104.   drivers for other media types  consider claiming to be one of
  2105.   the above types and doing a transparent internal mapping
  2106.   between that and its own private MAC header format.  In doing
  2107.   so, the MAC will be able to claim interoperability (assuming
  2108.  
  2109.                           Page 5-23
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.   the appropriate testing is done) with most protocol drivers
  2116.   developed for LAN Manager.
  2117.  
  2118. y In the absence of any such conversion, the MAC header is passed
  2119.   protocol-to-MAC or MAC-to-protocol in exactly the format in
  2120.   which it exists on the medium.  The CRC and non-data fields are
  2121.   not passed across this boundary.  Therefore the Ethernet CRC
  2122.   and the Token Ring SD, FCS, ED and FS fields are not passed and
  2123.   will not be included in the packet length.  The protocol must
  2124.   convert header fields found in the header buffer passed up to
  2125.   whatever format is required to conveniently store them in local
  2126.   memory.  For example multi-byte fields (e.g., 802.3 length) may
  2127.   not be received in the byte order that is normally used by the
  2128.   CPU for storing multi-byte parameters.  For exact format of the
  2129.   MAC header refer to the appropriate standards document (see
  2130.   Appendix B).
  2131.  
  2132. y For performance reasons, it is recommended that PhysToGDT be
  2133.   used whenever possible instead of PhysToVirt.
  2134.  
  2135. y Commonly Used Parameters
  2136.  
  2137. ProtID    The unique module ID of the protocol, assigned at bind
  2138.         time by the Protocol Manager.
  2139.  
  2140. MACIDThe unique module ID of the MAC, assigned at bind time
  2141.         by the Protocol Manager.
  2142.  
  2143. ReqHandle A handle assigned by the protocol to identify this
  2144.         request.  If the request is implemented asynchronously
  2145.         by the MAC driver in question, this handle is returned
  2146.         on the confirmation call used to indicate completion of
  2147.         the request.  A ReqHandle of 0 indicates that the
  2148.         confirmation be unconditionally suppressed.  For
  2149.         example, the request may still be handled
  2150.         asynchronously but there will be no notification of
  2151.         completion.  A ReqHandle of 0 must not change the
  2152.         immediate return code.
  2153.  
  2154. ProtDS    DS value for called protocol module, obtained from the
  2155.         module's dispatch table at bind time.
  2156.  
  2157. MACDSDS value for called MAC module, obtained from the
  2158.         module's dispatch table at bind time.
  2159.  
  2160. Direct Primitives
  2161.  
  2162.  
  2163. TransmitChain
  2164. Purpose:  Initiate transmission of a frame
  2165.  
  2166. PUSH WORD  ProtID    ;Module ID of protocol
  2167. PUSH WORD  ReqHandle ;Unique handle for this request or 0
  2168. PUSH LPBUF TxBufDescr;Pointer to framebufferdescriptor
  2169. PUSH WORD  MACDS;DS of called MAC module
  2170. CALL TransmitChain
  2171.  
  2172. Returns:  0x0000    SUCCESS
  2173.         0x0002    REQUEST_QUEUED
  2174.         0x0006    OUT_OF_RESOURCE
  2175.                           Page 5-24
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.         0x0007    INVALID_PARAMETER
  2182.         0x0008    INVALID_FUNCTION
  2183.         0x000A    HARDWARE_ERROR
  2184.         0x000B    TRANSMIT_ERROR
  2185.         0x000C    NO_SUCH_DESTINATION
  2186.         0x00FF    GENERAL_FAILURE
  2187.  
  2188. TxBufDescrFar pointer to the buffer descriptor for the
  2189. frame.
  2190.  
  2191. Description:
  2192.  
  2193. This call asks the MAC to transmit data.  The MAC may either copy
  2194. the data described by TxBufDescr before returning, or queue the
  2195. request for later (asynchronous) processing.  The MAC indicates
  2196. which option it is taking by setting the appropriate return code.
  2197.  
  2198. In the asynchronous case, ownership of the frame data blocks
  2199. passes to the MAC until the transmission is complete; the
  2200. protocol must not modify these areas until then.  Ownership of
  2201. the data blocks is returned to the protocol when the MAC either
  2202. returns a status code which implies completion of the original
  2203. request or calls its TransmitConfirm entry with the ReqHandle
  2204. from TransmitChain.  If a request handle of zero was used and
  2205. therefore TransmitConfirm will not be called, then ownership must
  2206. not be considered returned until the protocol receives a message
  2207. that implies the transmission has occurred (e.g., receiving an
  2208. ACK to the transmitted message).
  2209.  
  2210. Note that when doing asynchronous transmission, the MAC must
  2211. retain any needed information from TxBufDescr, since the pointer
  2212. to that structure becomes invalid upon returning from
  2213. TransmitChain.  Also, if the TxImmedLen of the descriptor is non-
  2214. zero, the MAC must retain a copy of the immediate data at
  2215. TxImmedPtr, since the immediate data area becomes invalid upon
  2216. returning from TransmitChain.
  2217.  
  2218. The MAC header must fit entirely in the immediate data, if
  2219. present, or in the first non-immediate element described in
  2220. TxBufDescr if there is no immediate data.
  2221.  
  2222. A MAC must be prepared to handle a TransmitChain request at
  2223. anytime, including from within interrupt-time indication
  2224. routines.
  2225.  
  2226. The return code REQUEST_QUEUED will cause a TransmitConfirm to be
  2227. called from the MAC back to the protocol if the ReqHandle on the
  2228. TransmitChain call is not 0.  All other return codes from
  2229. TransmitChain imply that no TransmitConfirm will occur.
  2230.  
  2231. The TRANSMIT_ERROR and NO_SUCH_DESTINATION error codes are
  2232. intended to allow a protocol to recreate the frame status byte on
  2233. a Token Ring network.  Thus, NO_SUCH_DESTINATION implies that the
  2234. address recognized bits were not set (and therefore the frame was
  2235. not copied), while TRANSMIT_ERROR merely means that the frame was
  2236. not copied.  Protocols which make use of Source Routing may need
  2237. the NO_SUCH_DESTINATION error code to be completely conformant.
  2238. Token Ring MAC driver writers must make every attempt to return
  2239. these error codes properly.
  2240.  
  2241.                           Page 5-25
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247. TransmitConfirm
  2248. Purpose:  Imply the completion of transmitting a frame.
  2249.  
  2250. PUSH  WORD ProtID    ;Module ID of Protocol
  2251. PUSH  WORD MACID;Module ID of MAC
  2252. PUSH  WORD ReqHandle ;Unique handle from TransmitChain
  2253. PUSH  WORD Status    ;Status of original TransmitChain
  2254. PUSH  WORD ProtDS    ;DS of called protocol module
  2255. CALL  TransmitConfirm
  2256.  
  2257. Returns:    0x0000    SUCCESS
  2258.         0x0007    INVALID_PARAMETER
  2259.         0x00FF    GENERAL_FAILURE
  2260.  
  2261. Description:
  2262.  
  2263. This routine is called by a MAC to indicate completion of a
  2264. previous TransmitChain.  The purpose of this is to return
  2265. ownership of the transmitted data blocks back to the protocol.
  2266.  
  2267. The ProtID parameter must be the value passed by the protocol on
  2268. the previous TransmitChain to identify the requestor.
  2269.  
  2270. The ReqHandle is the value passed by the protocol on the previous
  2271. TransmitChain which identifies the original request.
  2272.  
  2273. TransmitConfirm does not necessarily imply that the packet has
  2274. been transmitted, though it generally will have been (with the
  2275. exception of some intelligent adapter implementations).  If the
  2276. packet has been transmitted, Status must indicate the final
  2277. transmit status:
  2278.  
  2279.      0X0000  SUCCESS
  2280.      0X000A  HARDWARE_ERROR
  2281.      0X000B  TRANSMIT_ERROR
  2282.      0X000C  NO_SUCH_DESTINATION
  2283.      0X00FF  GENERAL_FAILURE
  2284.  
  2285. See TransmitChain for more details.
  2286.  
  2287. ReceiveLookahead
  2288. Purpose:  Indicate arrival of a received frame and offer
  2289. lookahead data.
  2290.  
  2291. PUSH  WORD     MACID ;Module ID of MAC
  2292. PUSH  WORD     FrameSize  ;Total size of frame (0 if not known)
  2293. PUSH  WORD     BytesAvail ;Bytes of lookahead available in Buffer
  2294. PUSH  LPBUF    Buffer;Virtual address of lookahead data
  2295. PUSH  LPBYTE   Indicate   ;Virtual address of indicate flag
  2296. PUSH  WORD     ProtDS     ;DS of called protocol module
  2297. CALL  ReceiveLookahead
  2298.  
  2299. Returns:  0x0000    SUCCESS
  2300.         0x0003    FRAME_NOT_RECOGNIZED
  2301.         0x0004    FRAME_REJECTED
  2302.         0x0005    FORWARD_FRAME
  2303.         0x0006    OUT_OF_RESOURCE
  2304.         0x0007    INVALID_PARAMETER
  2305.         0x00FF    GENERAL_FAILURE
  2306.  
  2307.                           Page 5-26
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313. FrameSize The total size, in bytes, of the received frame.  A
  2314.         value of 0 indicates that the MAC does not know the
  2315.         total frame size at this time.
  2316.  
  2317. BytesAvailThe number of bytes available in the lookahead
  2318.         buffer.  This is guaranteed to be at least as large as
  2319.         the lookahead size established with the SetLookahead
  2320.         request.  For frames which are smaller than the
  2321.         lookahead size, the lookahead buffer will contain the
  2322.         whole frame.
  2323.  
  2324. Buffer    Virtual address of contiguous lookahead buffer.  The
  2325.         buffer contains the leading BytesAvail octets of the
  2326.         frame.  This buffer is ephemeral; it is addressable to
  2327.         the protocol only during the scope of the Receive call.
  2328.  
  2329. Indicate  Virtual address of indication flag byte.  This byte is
  2330.         set to 0xFF by the MAC prior to this call.  If the
  2331.         protocol clears the byte to zero prior to returning
  2332.         then indications will be left disabled until
  2333.         IndicationOn is called from IndicationComplete.
  2334.  
  2335. Description:
  2336.  
  2337. This routine is called by a MAC to indicate reception of a frame
  2338. and to offer frame lookahead data.  The protocol is expected to
  2339. inspect this information very rapidly to determine if it wants to
  2340. accept the frame or not.  If it wants to accept the frame, it may
  2341. call TransferData to ask the MAC to copy the frame data to a
  2342. specified buffer described by a TDBufDescr.  The protocol can
  2343. indicate that it is rejecting or does not recognize the frame by
  2344. returning an appropriate error code.  Note that the frame not
  2345. recognized error has special significance to the Vector function.
  2346. If the protocol is accepting the frame and if the lookahead
  2347. buffer contains the whole frame, the protocol can simply copy the
  2348. data itself before returning from Receive.  The protocol may
  2349. determine that it has the whole frame if BytesAvail equals
  2350. FrameSize, or if the lookahead information includes a protocol
  2351. header with the frame length, and this matches BytesAvail.
  2352.  
  2353. It is strongly recommended that MACs provide a non-zero FrameSize
  2354. whenever possible.  Some protocols might not be able to process
  2355. frames unless the frame size given by this parameter is known.  A
  2356. MAC can optionally indicate that it does not normally provide a
  2357. non-zero frame size by setting bit 16 of the service flags in the
  2358. MAC specific characteristics table.
  2359.  
  2360. The MAC implicitly disables indications (IndicationOff) before
  2361. calling Receive Lookahead.  The Indicate flag byte instructs the
  2362. MAC on whether to reenable indications or leave them disabled on
  2363. the return. If the protocol chooses to leave indications
  2364. disabled, it can enable them within IndicationComplete by calling
  2365. IndicationOn.
  2366.  
  2367. The protocol must absolutely minimize its processing time within
  2368. the ReceiveLookahead handler.  This is necessary to let certain
  2369. MAC's re-enable the hardware to avoid loss of incoming frames.
  2370. Shortly after returning from ReceiveLookahead, the MAC will call
  2371. the protocol back at its IndicationComplete entry point.  The
  2372. protocol can do any needed post-processing of the received frame
  2373.                           Page 5-27
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379. at that time.  The MAC does not guarantee to provide one
  2380. IndicationComplete call for each indication.  It can choose to
  2381. issue a single IndicationComplete for several indications that
  2382. have occurred.
  2383.  
  2384. TransferData
  2385. Purpose:  Transfer received frame data from the MAC to a
  2386. protocol.
  2387.  
  2388. PUSH  LPWORD   BytesCopied    ;Number of bytes copied
  2389. PUSH  WORD     FrameOffset    ;Starting offset in frame for
  2390.                               ;transfer
  2391. PUSH  LPBUF    TDBufDescr     ;Virtual address of transfer data
  2392.                               ;description
  2393. PUSH  WORD     MACDS          ;DS of called MAC module
  2394. CALL  TransferData
  2395.  
  2396. Returns:    0x0000    SUCCESS
  2397.         0x0007    INVALID_PARAMETER
  2398.         0x0008    INVALID_FUNCTION
  2399.         0x00FF    GENERAL_FAILURE
  2400.  
  2401. BytesCopied Virtual address of buffer for returning number of
  2402.      bytes copied during transfer data operation.
  2403.  
  2404. FrameOffset Starting offset in received frame where data transfer
  2405.      must start.  The value of FrameOffset must be less
  2406.      than or equal to the value of BytesAvail from the
  2407.      corresponding ReceiveLookahead.
  2408.  
  2409. TDBufDescr  Virtual address of transfer descriptor describing
  2410.      where to store the frame data.
  2411.  
  2412. Description:
  2413.  
  2414. A protocol calls this synchronous routine from within its
  2415. ReceiveLookahead handler before return, to ask the MAC to
  2416. transfer data for a received frame to protocol storage.  The
  2417. protocol can specify any starting frame offset and byte count for
  2418. the transfer, so long as these don't exceed the frame's length.
  2419. If bit 15 of the MAC service flags is set, multiple TransferDatas
  2420. may be called during a single ReceiveLookahead indication.  If
  2421. this bit is reset, only one TransferData per ReceiveLookahead
  2422. indication is permitted.  In the latter case subsequent calls
  2423. within the same indication will return an error.
  2424.  
  2425. For MACs with bit 15 of the MAC service flags reset, a protocol
  2426. intending to call TransferData must do so only if it has decided
  2427. to accept the incoming packet.  Since the MAC driver may be
  2428. shared by multiple protocols, a protocol's failure to follow this
  2429. restriction in this case jeopardizes other coexisting protocol
  2430. drivers from receiving these packets.  When a protocol is bound
  2431. to a MAC with  bit 15 set, this restriction does not apply as a
  2432. mandatory requirement.  However, it is still recommended in such
  2433. cases for performance reasons that a protocol call TransferData
  2434. only if it has decided to accept the incoming packet.  A protocol
  2435. module must set the Lookahead size large enough to determine if
  2436. the packet is intended for it by examining ony the Lookahead
  2437. bytes presented by ReceiveLookahead.
  2438.  
  2439.                           Page 5-28
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445. It is recommended that the multiple TransferData feature with bit
  2446. 15 set be implemented in MAC drivers whenever it is reasonable.to
  2447. do so with the adapter hardware.
  2448.  
  2449. IndicationComplete
  2450. Purpose:  Allow protocol to do post-processing on indications.
  2451.  
  2452. PUSH  WORD    MACID    ;Module ID of MAC
  2453. PUSH  WORD    ProtDS    ;DS of called protocol module
  2454. CALL  IndicationComplete
  2455.  
  2456. Returns:  0x0000    SUCCESS
  2457.         0x0007    INVALID_PARAMETER
  2458.         0x00FF    GENERAL_FAILURE
  2459.  
  2460. Description:
  2461.  
  2462. A MAC calls this entry point to enable a protocol to do post-
  2463. processing after an indication.  The MAC will always generate an
  2464. IndicationComplete subsequent to an indication regardless of the
  2465. return code of the indication.  Although still in interrupt
  2466. context and subject to the normal OS/2 guidelines for interrupt
  2467. processing, the protocol is not under the severe time constraints
  2468. of the indication.  The MAC must minimize stack usage before
  2469. calling this routine and, under DOS, must have swapped off of any
  2470. special "interrupt" stack.
  2471.  
  2472. This routine is always entered with interrupts enabled and with
  2473. the network adapter interrupt dismissed from the interrupt
  2474. controller.  Therefore, it may be reentered at the completion of
  2475. another indication.  Also no one-to-one correspondence is
  2476. guaranteed between indications and IndicationComplete.  A MAC may
  2477. generate one IndicationComplete for several indications.  A
  2478. protocol may enforce a one-to-one correspondence by leaving
  2479. indications disabled until the return from IndicationComplete.
  2480.  
  2481. If indications are explicitly disabled by a protocol on return
  2482. from an indication, it is the protocol's responsibility to invoke
  2483. IndicationOn as soon possible during IndicationComplete.
  2484.  
  2485. MAC developers must avoid simply serializing each indication with
  2486. IndicationComplete as this can negatively affect performance.
  2487. The MAC must be designed to allow an indication to occur during
  2488. IndicationComplete processing.  Of course, if this occurs,
  2489. another IndicationComplete call will be necessary.
  2490.  
  2491. ReceiveChain
  2492. Purpose:  Indicate reception of a frame in MAC-managed buffers.
  2493.  
  2494. PUSH  WORD     MACID     ;Module ID of MAC
  2495. PUSH  WORD     FrameSize ;Total size of frame (bytes)
  2496. PUSH  WORD     ReqHandle ;Unique handle for this request
  2497. PUSH  LPBUF    RxBufDescr;Virtual address of receive
  2498.                          ;descriptor
  2499. PUSH  LPBYTE   Indicate  ;Virtual address of indicate flag
  2500. PUSH  WORD     ProtDS    ;DS of called protocol module
  2501. CALL  ReceiveChain
  2502.  
  2503.  
  2504.  
  2505.                           Page 5-29
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511. Returns:  0x0000    SUCCESS
  2512.         0x0001    WAIT_FOR_RELEASE
  2513.         0x0003    FRAME_NOT_RECOGNIZED
  2514.         0x0004    FRAME_REJECTED
  2515.         0x0005    FORWARD_FRAME
  2516.         0x0006    OUT_OF_RESOURCE
  2517.         0x0007    INVALID_PARAMETER
  2518.         0x00FF    GENERAL_FAILURE
  2519.  
  2520. FrameSize   Total size of received frame, in bytes.
  2521.  
  2522. RxBufDescr  Virtual address of receive descriptor describing the
  2523.      received frame.
  2524.  
  2525. Indicate    Virtual address of indication flag byte.  This byte
  2526.      is set to 0xFF by the MAC prior to this call.  If the
  2527.      protocol clears the byte to zero prior to returning
  2528.      then indications will be left disabled until
  2529.      IndicationOn is called from IndicationComplete.
  2530.  
  2531. Description:
  2532.  
  2533. A MAC calls this routine to indicate the reception of a frame in
  2534. MAC-managed storage.  Ownership of this storage is implicitly
  2535. passed to the protocol when this call is made.  At its option,
  2536. the protocol may copy the data right away and indicate this via
  2537. the return code (in which case ownership reverts to the MAC); or
  2538. the protocol may queue the request and copy the frame later, in
  2539. which case it retains ownership of the frame's storage until it
  2540. calls ReceiveRelease.  Since the protocol may queue data received
  2541. in this manner, it is possible that the MAC may run low on
  2542. available frame buffers.  The MAC may elect to call
  2543. ReceiveLookahead instead of ReceiveChain while it is low on frame
  2544. buffers.  This allows the MAC to retain control of its remaining
  2545. buffers until the protocol releases the buffers it is holding.
  2546.  
  2547. Note that for frames longer than 256 bytes, the MAC must
  2548. guarantee that the first data block of the frame is at least 256
  2549. bytes long.  Frames less than or equal to 256 bytes in length
  2550. must be completely specified with a single data block.  This
  2551. allows the protocol to parse packet headers out of the first data
  2552. block and greatly facilitates protocol processing efficiency.
  2553.  
  2554. Like ReceiveLookahead, a protocol's processing within
  2555. ReceiveChain is time critical.  At some point after return from
  2556. ReceiveChain the MAC will generate an IndicationComplete to allow
  2557. post-processing of the indication.
  2558.  
  2559. The MAC implicitly disables indications (IndicationOff) before
  2560. calling ReceiveChain.   The Indicate flag byte instructs the MAC
  2561. on whether to reenable indications or leave then disable on the
  2562. return.  If the protocol chooses to leave indications disabled,
  2563. it can enable them within IndicationComplete by calling
  2564. IndicationOn.
  2565.  
  2566. ReceiveRelease
  2567. Purpose:  Return frame storage to the MAC that owns it.
  2568.  
  2569. PUSH  WORD      ReqHandle ;Unique handle from ReceiveChain
  2570. PUSH  WORD      MACDS      ;DS of called MAC module
  2571.                           Page 5-30
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577. CALL  ReceiveRelease
  2578.  
  2579. Returns:  0x0000    SUCCESS
  2580.         0x0007    INVALID_PARAMETER
  2581.         0x0009    NOT_SUPPORTED
  2582.         0x00FF    GENERAL_FAILURE
  2583.  
  2584. Description:
  2585.  
  2586. A protocol uses this call after it has copied frame data provided
  2587. by a ReceiveChain call.  ReceiveRelease returns ownership of the
  2588. frame data blocks to the MAC.
  2589.  
  2590. IndicationOff
  2591. Purpose:  Disable MAC indications
  2592.  
  2593. PUSH  WORD     MACDS     ;DS of called MAC module
  2594. CALL  IndicationOff
  2595.  
  2596. Returns:  0x0000    SUCCESS
  2597.         0x0008    INVALID_FUNCTION
  2598.         0x00FF    GENERAL_FAILURE
  2599.  
  2600. Description:
  2601.  
  2602. A protocol may use this call to prevent the generation of
  2603. ReceiveLookahead, ReceiveChain and Status indications from the
  2604. MAC.  This is similar in concept to disabling interrupts.  When
  2605. indications are off, a MAC must queue events that would cause it
  2606. to generate indications to the protocol.  A MAC implicitly
  2607. disables indications just before calling the ReceiveLookahead,
  2608. ReceiveChain or Status indication entry point of a protocol.
  2609.  
  2610. The only legal use of IndicationOff is to bracket a call or calls
  2611. to the MAC.  For example, the following sequence is valid:
  2612.  
  2613. IndicationOff
  2614. TransmitChain
  2615. IndicationOn
  2616.  
  2617. In this situation the protocol must not block while indications
  2618. are off and must call IndicationOn as soon as possible.  The
  2619. protocol must ensure that all calls to IndicationOff are paired
  2620. up with a corresponding call to IndicationOn.  If the protocol
  2621. issues an IndicationOff call from a timer tick handler, or from a
  2622. ReceiveLookahead, ReceiveChain or Status indication handler it
  2623. must issue the IndicationOn call before returning.
  2624.  
  2625. Note that IndicationComplete may still occur even though
  2626. indications are disabled.  Disabling indications has no effect on
  2627. a MAC's ability to call IndicationComplete.
  2628.  
  2629. This function always returns with interrupts disabled.  It is the
  2630. responsibility of the caller to re-enable them.
  2631.  
  2632.  
  2633.  
  2634.  
  2635.  
  2636.                           Page 5-31
  2637.  
  2638.  
  2639.  
  2640.  
  2641.  
  2642. IndicationOn
  2643. Purpose:  Enable MAC indications
  2644.  
  2645. Called from protocol to MAC.
  2646.  
  2647. PUSH  WORD     MACDS     ;DS of called MAC module
  2648. CALL IndicationOn
  2649.  
  2650. Returns:  0x0000    SUCCESS
  2651.         0x0008    INVALID_FUNCTION
  2652.         0x00FF    GENERAL_FAILURE
  2653.  
  2654. Description:
  2655.  
  2656. A protocol must use this call to re-enable indications after
  2657. having disabled them.  Note that a MAC may optionally defer the
  2658. actual re-enabling of indications.
  2659.  
  2660. It is possible that IndicationOff and IndicationOn pairs will
  2661. nest.  Therefore the MAC must maintain a reference count to
  2662. enable it to determine when to actually re-enable indications.
  2663. The protocol must not assume that a call to IndicationOn will
  2664. immediately enable indications.
  2665.  
  2666. IndicationOn may be called from an IndicationComplete handler
  2667. after leaving indications disabled on return from an indication
  2668. handler.  IndicationOn may also be used, paired with
  2669. IndicationOff, to bracket a call or calls to the MAC.
  2670.  
  2671. This function always returns with interrupts disabled.  It is the
  2672. responsibility of the caller to re-enable them.  No indications
  2673. will be generated until after the call has returned.
  2674.  
  2675. General Requests
  2676. General requests are commands from a protocol to a MAC directing
  2677. it to do adapter management operations like setting the station
  2678. address, running diagnostics, and changing operating parameters
  2679. or modes.  A MAC may choose to implement any of the Request
  2680. functions synchronously or asynchronously.  A MAC returns the
  2681. REQUEST_QUEUED return code to inform the protocol that a given
  2682. request will be processed asynchronously.  When this is the case,
  2683. the MAC will call back to the protocol's RequestConfirm entry
  2684. point to indicate when processing of the request is complete.  If
  2685. a request handle of zero is used then the RequestConfirm call is
  2686. suppressed.  It is the caller's responsibility to make certain
  2687. that any data referenced by the request remains valid until the
  2688. request is guaranteed to have completed.  If a protocol makes a
  2689. general MAC request when executing its InitiateBind startup
  2690. function and the MAC returns REQUEST_QUEUED, the protocol must
  2691. wait for the correspondingRequestConfirm to be returned before
  2692. exiting from the InitiateBind function.  Any other return code
  2693. from a general request implies that no RequestConfirm will occur.
  2694.  
  2695. All general requests have the following common calling
  2696. convention:
  2697.  
  2698. PUSH  WORD     ProtID    ;Module ID of Protocol or 0
  2699. PUSH  WORD     ReqHandle ;Unique handle for this request or 0
  2700. PUSH  WORD     Param1    ;Request dependent word parameter or 0
  2701. PUSH  DWORD    Param2    ;Request dependent dword parameter or 0
  2702.                           Page 5-32
  2703.  
  2704.  
  2705.  
  2706.  
  2707.  
  2708. PUSH  WORD     Opcode    ;Opcode of request
  2709. PUSH  WORD     MACDS     ;DS of called MAC module
  2710. Call  Request
  2711.  
  2712. InitiateDiagnostics
  2713. Purpose:  Start runtime diagnostics.
  2714.  
  2715. PUSH  WORD     ProtID    ; Module ID of Protocol
  2716. PUSH  WORD     ReqHandle ; Unique handle for this request or 0
  2717. PUSH  WORD     0    ; Pad parameter - must be 0
  2718. PUSH  DWORD    0    ; Pad parameter - must be 0
  2719. PUSH  WORD     1    ; Initiate Diagnostics Request
  2720. PUSH  WORD     MACDS; DS of called MAC module
  2721. Call  Request
  2722.  
  2723. Returns:  0x0000    SUCCESS
  2724.         0x0002    REQUEST_QUEUED
  2725.         0x0006    OUT_OF_RESOURCE
  2726.         0x0007    INVALID_PARAMETER
  2727.         0x0008    INVALID_FUNCTION
  2728.         0x0009    NOT_SUPPORTED
  2729.         0x000A    HARDWARE_ERROR
  2730.         0x00FF    GENERAL_FAILURE
  2731.  
  2732. Description:
  2733.  
  2734. Causes a MAC to run hardware diagnostics and update its status
  2735. information in the MAC-specific status section of the
  2736. characteristics table.  A MAC must return an error if it does not
  2737. support run time diagnostics.  While the diagnostics are in
  2738. progress, the MAC must set the diagnostics in progress bit (bit
  2739. 5) in the MAC status field in the MAC service-specific status
  2740. table.  If HARDWARE_ERROR is returned, the protocol may examine
  2741. the various fields in the service-specific status table for an
  2742. indication as to the cause of the problem.
  2743.  
  2744.  
  2745. ReadErrorLog
  2746. Purpose:  Return error log.
  2747.  
  2748. PUSH  WORD     ProtID    ; Module ID of Protocol
  2749. PUSH  WORD     ReqHandle ; Unique handle for this request or 0
  2750. PUSH  WORD     LogLen    ; Length of log buffer
  2751. PUSH  LPBUF    LogAddr   ; Buffer for returning log
  2752. PUSH  WORD     2    ; Read Error Log Request
  2753. PUSH  WORD     MACDS; DS of called MAC module
  2754. Call  Request
  2755.  
  2756. Returns:  0x0000    SUCCESS
  2757.         0x0002    REQUEST_QUEUED
  2758.         0x0006    OUT_OF_RESOURCE
  2759.         0x0007    INVALID_PARAMETER
  2760.         0x0008    INVALID_FUNCTION
  2761.         0x0009    NOT_SUPPORTED
  2762.         0x00FF    GENERAL_FAILURE
  2763.  
  2764. Description:
  2765.  
  2766. Causes a read error log to be issued to adapter.  This command is
  2767. implemented on the IBM token ring adapter and possibly other
  2768.                           Page 5-33
  2769.  
  2770.  
  2771.  
  2772.  
  2773.  
  2774. adapters.  The format of the information returned is adapter
  2775. specific and not specified here.
  2776.  
  2777. SetStationAddress
  2778. Purpose:  Set the network address of the station.
  2779.  
  2780. PUSH  WORD     ProtID    ; Module ID of Protocol
  2781. PUSH  WORD     ReqHandle ; Unique handle for this request or 0
  2782. PUSH  WORD     0         ; Pad parameter - must be 0
  2783. PUSH  LPBUF    AdaptAddr ; Buffer containing the adapter address
  2784. PUSH  WORD     3         ; SetStationAddress Request
  2785. PUSH  WORD     MACDS     ; DS of called MAC module
  2786. Call  Request
  2787.  
  2788. Returns:  0x0000    SUCCESS
  2789.         0x0002    REQUEST_QUEUED
  2790.         0x0006    OUT_OF_RESOURCE
  2791.         0x0007    INVALID_PARAMETER
  2792.         0x0008    INVALID_FUNCTION
  2793.         0x0009    NOT_SUPPORTED
  2794.         0x00FF    GENERAL_FAILURE
  2795.  
  2796. Description:
  2797.  
  2798. There is only a single station address.  Each time it replaces
  2799. the current station address in the MAC service-specific
  2800. characteristics table and will reconfigure the hardware to
  2801. receive on that address if required.  The station will be
  2802. initially configured with the address specified in the permanent
  2803. station address field of the MAC service-specific characteristics
  2804. table (which this call does not modify).
  2805.  
  2806. The adapter address buffer contains only the bytes of the address
  2807. to be set.  The length of the address must be equal to the length
  2808. specified in the MAC service characteristics table.
  2809.  
  2810. If the hardware does not support a mechanism to modify its
  2811. station address then the current station address buffer is not
  2812. updated and this function returns INVALID_FUNCTION.  In this case
  2813. the MAC continues to use the permanent station address to
  2814. recognize incoming directed packets.
  2815.  
  2816. If a MAC does not support the OpenAdapter and CloseAdapter
  2817. commands (bit 11 of the MAC service flags is reset), then the
  2818. SetStationAddress command can be issued by the protocol at any
  2819. time.  However, if the MAC supports the Open Adapter and
  2820. CloseAdapter commands (bit 11 of the MAC service flags is set),
  2821. then this command is valid only either during system
  2822. initialization time or while the MAC is in a closed state.  The
  2823. protocol driver must issue an Open Adapter call after issuing the
  2824. SetStationAddress call for the SetStationAddress command to take
  2825. effect.
  2826.  
  2827. OpenAdapter
  2828. Purpose:  Issue open request to network adapter.
  2829.  
  2830. PUSH  WORD     ProtID         ; Module ID of Protocol
  2831. PUSH  WORD     ReqHandle      ; Unique handle for this request or 0
  2832. PUSH  WORD     OpenOptions    ; Adapter specific open options
  2833. PUSH  DWORD    0              ; Pad parameter - must be 0
  2834.                           Page 5-34
  2835.  
  2836.  
  2837.  
  2838.  
  2839.  
  2840. PUSH  WORD     4    ; Open Adapter Request
  2841. PUSH  WORD     MACDS; DS of called MAC module
  2842. Call  Request
  2843.  
  2844. Returns:  0x0000    SUCCESS
  2845.         0x0002    REQUEST_QUEUED
  2846.         0x0006    OUT_OF_RESOURCE
  2847.         0x0007    INVALID_PARAMETER
  2848.         0x0008    INVALID_FUNCTION
  2849.         0x0009    NOT_SUPPORTED
  2850.         0x0024    HARDWARE_FAILURE
  2851.         0x00FF    GENERAL_FAILURE
  2852.  
  2853. Description:
  2854.  
  2855. The purpose of the OpenAdapter function is to activate an
  2856. adapter's network connection.  This may involve making an
  2857. electrical connection for some adapters like token ring adapters.
  2858. This also implies that a considerable delay may occur between
  2859. submittal of this request and its confirmation.  If the MAC
  2860. indicates that OpenAdapter is supported (by setting bit 11 of the
  2861. service flags in the MAC service-specific characteristics table),
  2862. then the protocol driver must ensure the adapter is open during
  2863. bind-time processing.  Since OpenAdapter can only be called when
  2864. the adapter is closed, even in a VECTOR configuration, the
  2865. protocol must first check if the adapter is already open by
  2866. examining bit 4 of the MAC status in the MAC service-specific
  2867. status table.
  2868.  
  2869. While an adapter is closed the following functions are guaranteed
  2870. to operate:  SetLookahead, SetPacketFilter, SetStationAddress,
  2871. Interrupt, Indicationoff, IndicationOn.
  2872.  
  2873. Since this function is adapter specific it is expected that any
  2874. necessary parameters are either known a priori by the MAC or can
  2875. be recovered from the PROTOCOL.INI file.  The format of the
  2876. information is highly adapter specific and left up to the
  2877. implementer to define.
  2878.  
  2879. The OpenOptions parameter is adapter specific.  For IBM TokenRing
  2880. and compatible adapters, these are defined in the IBM Token Ring
  2881. Technical Reference Manual.
  2882.  
  2883. CloseAdapter
  2884. Purpose:  Issue close request to network adapter.
  2885.  
  2886. PUSH  WORD     ProtID    ; Module ID of Protocol
  2887. PUSH  WORD     ReqHandle ; Unique handle for this request or 0
  2888. PUSH  WORD     0         ; Pad parameter - must be 0
  2889. PUSH  DWORD    0         ; Pad parameter - must be 0
  2890. PUSH  WORD     5         ; Close Adapter Request
  2891. PUSH  WORD     MACDS     ; DS of called MAC module
  2892. Call  Request
  2893.  
  2894. Returns:  0x0000    SUCCESS
  2895.         0x0002    REQUEST_QUEUED
  2896.         0x0006    OUT_OF_RESOURCE
  2897.         0x0007    INVALID_PARAMETER
  2898.         0x0008    INVALID_FUNCTION
  2899.         0x0009    NOT_SUPPORTED
  2900.                           Page 5-35
  2901.  
  2902.  
  2903.  
  2904.  
  2905.  
  2906.         0x00FF    GENERAL_FAILURE
  2907.  
  2908. Description:
  2909.  
  2910. This function closes an adapter.  This causes it to decouple
  2911. itself from a network so that packets cannot be sent or received.
  2912. CloseAdapter resets the functional or multicast addresses
  2913. currently set.
  2914.  
  2915. Since this function is adapter specific it is expected that any
  2916. necessary parameters are either already known by the MAC or can
  2917. be recovered from the PROTOCOL.INI file.  The format of the
  2918. information is highly adapter specific and left up to the
  2919. implementer to define.
  2920.  
  2921. ResetMAC
  2922. Purpose:  Reset the MAC software and adapter hardware.
  2923.  
  2924. PUSH  WORD     ProtID    ; Module ID of Protocol
  2925. PUSH  WORD     ReqHandle ; Unique handle for this request or 0
  2926. PUSH  WORD     0         ; Pad parameter - must be 0
  2927. PUSH  DWORD    0         ; Pad parameter - must be 0
  2928. PUSH  WORD     6         ; Reset MAC Request
  2929. PUSH  WORD     MACDS     ; DS of called MAC module
  2930. Call  Request
  2931.  
  2932. Returns:  0x0000    SUCCESS
  2933.         0x0002    REQUEST_QUEUED
  2934.         0x0006    OUT_OF_RESOURCE
  2935.         0x0007    INVALID_PARAMETER
  2936.         0x0008    INVALID_FUNCTION
  2937.         0x0009    NOT_SUPPORTED
  2938.         0x000A    HARDWARE_ERROR
  2939.         0x00FF    GENERAL_FAILURE
  2940.  
  2941. Description:
  2942.  
  2943. The function causes the MAC to issue a hardware reset to the
  2944. network adapter.  The MAC may discard without confirmation any
  2945. pending requests and abort operations in progress.  For
  2946. compatibility with some current protocols which do not properly
  2947. handle resets, it is suggested the MAC complete pending requests,
  2948. returning GENERAL_FAILURE on all confirmations which result.  The
  2949. MAC must preserve the current station address, LOOKAHEAD length,
  2950. packet filter, multicast address list, functional address and
  2951. indication on/off state.
  2952.  
  2953. For MAC's that support the OpenAdapter function, the Reset MAC
  2954. command leaves the adapter in the opened state if it was opened
  2955. prior to the reset.  The adapter open parameters that were in
  2956. effect prior to the reset must be the same ones in effect after
  2957. the reset.
  2958.  
  2959. When the reset is initiated, the MAC must generate a StartReset
  2960. status indication back to the protocol.  For some MAC's a
  2961. considerable delay can elapse between the start of the reset and
  2962. its completion.  All MAC's must subsequently issue an EndReset
  2963. indication when the reset is complete.  During the time between
  2964. the StartReset indication and the corresponding EndReset
  2965. indication, the MAC must return INVALID_FUNCTION for any request
  2966.                           Page 5-36
  2967.  
  2968.  
  2969.  
  2970.  
  2971.  
  2972. it receives that it cannot handle while a reset is in progress.
  2973. The EndReset indication notifies the protocol that the MAC can
  2974. handle new requests.  As always, an IndicationComplete follows
  2975. these indications.  MACSs written to V1.0.1. of this spec will
  2976. not issue the End Reset.  They must issue the IndicationComplete
  2977. to signal the end of the reset.
  2978.  
  2979. Note that the completion (i.e. the return from this command or
  2980. the request confirm) of the Reset MAC request itself does not
  2981. signal the start or end of the reset.
  2982.  
  2983. There can be no guarantee that this function will succeed, though
  2984. the NDIS MAC developer must make every attempt.  An error return
  2985. from this call can be considered fatal.
  2986.  
  2987. SetPacketFilter
  2988. Purpose:  Select received packet general filtering parameters.
  2989.  
  2990. PUSH  WORD     ProtID    ; Module ID of Protocol
  2991. PUSH  WORD     ReqHandle ; Unique handle for this request or 0
  2992. PUSH  WORD     FilterMask; Bit mask for packet filter
  2993. PUSH  DWORD    0         ; Pad parameter - must be 0
  2994. PUSH  WORD     7         ; Set Packet Filter Request
  2995. PUSH  WORD     MACDS     ; DS of called MAC module
  2996. Call  Request
  2997.  
  2998. FilterMaskbit
  2999.         0 directed and multicast or group and functional
  3000.         1 broadcast packets
  3001.         2 any packet on LAN (promiscuous)
  3002.         3 any source routing packet on LAN
  3003.         4-15 Reserved, must be zero
  3004.  
  3005. Returns:  0x0000    SUCCESS
  3006.         0x0002    REQUEST_QUEUED
  3007.         0x0006    OUT_OF_RESOURCE
  3008.         0x0007    INVALID_PARAMETER
  3009.         0x0008    INVALID_FUNCTION
  3010.         0x00FF    GENERAL_FAILURE
  3011.  
  3012. Description:
  3013.  
  3014. This command tells the MAC which kinds of received packets must
  3015. generate indications to the protocol invoking this command.  A
  3016. FilterMask of 0 indicates that the MAC must not indicate received
  3017. packets to that protocol.  If a FilterMask bit is set, then this
  3018. indicates that the MAC must indicate that type of packet to the
  3019. protocol.  Except for a 0 FilterMask, a filter bit of 0 does not
  3020. require the MAC to suppress indications for that type of packet.
  3021. For example the FilterMask used by the MAC may or may not
  3022. correspond to the capabilities of the hardware adapter.  For
  3023. example a MAC may be designed to receive multicast frames by
  3024. promiscuously receiving all frames and discarding those that do
  3025. not match the filter.  It is optional for the MAC to support such
  3026. software filtering.  If the MAC can suppress such indications, it
  3027. is strongly recommended that it do so.  However, if the MAC does
  3028. not suppress such indications, then the protocol must be prepared
  3029. to receive these and discard the incoming packet if necessary.
  3030.  
  3031.  
  3032.                           Page 5-37
  3033.  
  3034.  
  3035.  
  3036.  
  3037.  
  3038. If this request returns SUCCESS, then the hardware is enabled to
  3039. receive the types of packets requested and will generate
  3040. Indications to the protocol for those types of packets.
  3041.  
  3042. If the MAC does not support the receiving of packets of the type
  3043. specified, then it will return GENERAL_FAILURE.  In this case the
  3044. FilterMask is left in its previous state.
  3045.  
  3046. AddMulticastAddress
  3047. Purpose:  Allow adapter to respond to a multicast address.
  3048.  
  3049. PUSH  WORD     ProtID    ; Module ID of Protocol
  3050. PUSH  WORD     ReqHandle ; Unique handle for this request or 0
  3051. PUSH  WORD     0         ; Pad parameter - must be 0
  3052. PUSH  LPBUF    MultiAddr ; Buffer containing multicast address
  3053. PUSH  WORD8              ; Add Multicast Address Request
  3054. PUSH  WORD     MACDS     ; DS of called MAC module
  3055. Call  Request
  3056.  
  3057. Returns:  0x0000    SUCCESS
  3058.         0x0002    REQUEST_QUEUED
  3059.         0x0006    OUT_OF_RESOURCE
  3060.         0x0007    INVALID_PARAMETER
  3061.         0x0008    INVALID_FUNCTION
  3062.         0x0009    NOT_SUPPORTED
  3063.         0x00FF    GENERAL_FAILURE
  3064.  
  3065. Description:
  3066.  
  3067. This function allows the addition of multicast addresses.  The
  3068. term multicast address also implies 802.5 group addresses.  This
  3069. function allows the addition of only one address at a time but
  3070. can be repeated to add more multicasts.
  3071.  
  3072. It is the MAC's responsibility to return an error if too many
  3073. multicast addresses have been added (OUT_OF_RESOURCE or
  3074. INVALID_FUNCTION) or if an address of the wrong type has been
  3075. added (INVALID_PARAMETER).
  3076.  
  3077. Multicast addresses are never over written and will return an
  3078. error (INVALID_PARAMETER) if they already exist no matter what
  3079. their type.  They must be explicitly deleted.
  3080.  
  3081. The multicast address buffer contains only the bytes of the
  3082. multicast address to be added.  The length of the multicast
  3083. address must be equal to the length specified in the MAC service
  3084. characteristics table.
  3085.  
  3086. DeleteMulticastAddress
  3087. Purpose:  Forbid adapter to respond to a multicast address.
  3088.  
  3089. PUSH  WORD     ProtID    ; Module ID of Protocol
  3090. PUSH  WORD     ReqHandle ; Unique handle for this request or 0
  3091. PUSH  WORD     0         ; Pad parameter - must be 0
  3092. PUSH  LPBUF    MultiAddr ; Buffer containing multicast address
  3093. PUSH  WORD     9         ; Delete Multicast Address Request
  3094. PUSH  WORD     MACDS     ; DS of called MAC module
  3095. Call  Request
  3096.  
  3097. Returns:  0x0000    SUCCESS
  3098.                           Page 5-38
  3099.  
  3100.  
  3101.  
  3102.  
  3103.  
  3104.         0x0002    REQUEST_QUEUED
  3105.         0x0006    OUT_OF_RESOURCE
  3106.         0x0007    INVALID_PARAMETER
  3107.         0x0008    INVALID_FUNCTION
  3108.         0x0009    NOT_SUPPORTED
  3109.         0x00FF    GENERAL_FAILURE
  3110.  
  3111. Description:
  3112.  
  3113. This function removes a previously added multicast address.  The
  3114. term multicast address also implies 802.5 group addresses.
  3115. INVALID_PARAMETER is returned if the address was not in the
  3116. table.
  3117.  
  3118. The multicast address buffer has the same format as in the
  3119. AddMulticastAddress command.
  3120.  
  3121. UpdateStatistics
  3122. Purpose:  Cause MAC statistics to be updated.
  3123.  
  3124. PUSH  WORD     ProtID    ; Module ID of Protocol
  3125. PUSH  WORD     ReqHandle ; Unique handle for this request or 0
  3126. PUSH  WORD     0         ; Pad parameter - must be 0
  3127. PUSH  DWORD    0         ; Pad parameter - must be 0
  3128. PUSH  WORD     10        ; Update Statistics request
  3129. PUSH  WORD     MACDS     ; DS of called MAC module
  3130. Call  Request
  3131.  
  3132. Returns:  0x0000    SUCCESS
  3133.         0x0002    REQUEST_QUEUED
  3134.         0x0006    OUT_OF_RESOURCE
  3135.         0x0007    INVALID_PARAMETER
  3136.         0x0008    INVALID_FUNCTION
  3137.         0x00FF    GENERAL_FAILURE
  3138.  
  3139. Description:
  3140.  
  3141. Causes the MAC to atomically update the statistics counters in
  3142. its characteristics table.  The requester can read that table
  3143. when this operation completes.  If the statistics table are
  3144. always current this function must return SUCCESS.
  3145.  
  3146. ClearStatistics
  3147. Purpose:  Cause MAC statistics to be cleared.
  3148.  
  3149. PUSH  WORD     ProtID    ; Module ID of Protocol
  3150. PUSH  WORD     ReqHandle ; Unique handle for this request or 0
  3151. PUSH  WORD     0         ; Pad parameter - must be 0
  3152. PUSH  DWORD    0         ; Pad parameter - must be 0
  3153. PUSH  WORD     11        ; Clear Statistics request
  3154. PUSH  WORD     MACDS     ; DS of called MAC module
  3155. Call  Request
  3156.  
  3157. Returns:  0x0000    SUCCESS
  3158.         0x0002    REQUEST_QUEUED
  3159.         0x0006    OUT_OF_RESOURCE
  3160.         0x0007    INVALID_PARAMETER
  3161.         0x0008    INVALID_FUNCTION
  3162.         0x00FF    GENERAL_FAILURE
  3163.  
  3164.                           Page 5-39
  3165.  
  3166.  
  3167.  
  3168.  
  3169.  
  3170. Description:
  3171.  
  3172. Causes the MAC to reset its statistics counters.  This implies
  3173. that all statistics must be reset to zero in an atomic operation.
  3174.  
  3175. Interrupt
  3176. Purpose:  Request asynchronous indication.
  3177.  
  3178. PUSH  WORD     ProtID    ; Module ID of Protocol
  3179. PUSH  WORD     0    ; Pad parameter - must be 0
  3180. PUSH  WORD     0    ; Pad parameter - must be 0
  3181. PUSH  DWORD    0    ; Pad parameter - must be 0
  3182. PUSH  WORD     12   ; InterruptRequest
  3183. PUSH  WORD     MACDS; DS of called MAC module
  3184. Call  Request
  3185.  
  3186. Returns:  0x0000    SUCCESS
  3187.         0x0006    OUT_OF_RESOURCE
  3188.         0x0008    INVALID_FUNCTION
  3189.         0x0009    NOT_SUPPORTED
  3190.         0x00FF    GENERAL_FAILURE
  3191.  
  3192. Description:
  3193.  
  3194. This function requests the MAC to generate an asynchronous
  3195. Interrupt Status indication back to the protocol.  The protocol
  3196. may control the generation of this Interrupt Status indication by
  3197. disabling and later enabling indications.  The MAC may at its
  3198. discretion suppress the generation of this indication if there is
  3199. another indication pending which may be issued in place of the
  3200. Interrupt status indication.  This request is intended to be used
  3201. for MAC's which can generate a hardware interrupt on demand.
  3202. This function must be implemented if at all possible.  Interrupt
  3203. request will substantially improve the performance of some
  3204. protocols (particularly DLC).
  3205.  
  3206. SetFunctionalAddress
  3207. Purpose:  Cause adapter to change its functional address.
  3208.  
  3209. PUSH  WORD     ProtID    ; Module ID of Protocol
  3210. PUSH  WORD     ReqHandle ; Unique handle for this request or 0
  3211. PUSH  WORD     0         ; Pad parameter - must be 0
  3212. PUSH  LPBUF    FunctAddr ; Buffer containing functional address
  3213. PUSH  WORD     13        ; Set Functional Address Request
  3214. PUSH  WORD     MACDS     ; DS of called MAC module
  3215. Call  Request
  3216.  
  3217.  
  3218. Returns:  0x0000    SUCCESS
  3219.         0x0002    REQUEST_QUEUED
  3220.         0x0006    OUT_OF_RESOURCE
  3221.         0x0007    INVALID_PARAMETER
  3222.         0x0008    INVALID_FUNCTION
  3223.         0x0009    NOT_SUPPORTED
  3224.         0x00FF    GENERAL_FAILURE
  3225.  
  3226. Description:
  3227.  
  3228. This sets the IEEE802.5 functional address to the passed
  3229. functional address.  The adapter will use the functional address
  3230.                           Page 5-40
  3231.  
  3232.  
  3233.  
  3234.  
  3235.  
  3236. to discern packets intended for it.  For more information on
  3237. functional addresses see the IEEE 802.5 specification.
  3238.  
  3239. The functional address buffer contains only the bytes of the new
  3240. functional address bit pattern. It represents the logical OR of
  3241. all functional addresses to be registered with the adapter.  The
  3242. length of the functional address buffer is 4 bytes.
  3243.  
  3244. Multiple protocols can set or reset their functional address bit
  3245. if required by each protocol by first reading the current
  3246. functional address DWORD bit pattern from the MAC service
  3247. characteristics table, then ORing in or ANDing out the required
  3248. functional bit and passing the new functional address pattern in
  3249. this command.
  3250.  
  3251.  
  3252. SetLookahead
  3253. Purpose:  Set length of lookahead information for
  3254. ReceiveLookahead.
  3255.  
  3256. PUSH  WORD     ProtID    ; Module ID of Protocol
  3257. PUSH  WORD     ReqHandle ; Unique handle for this request or 0
  3258. PUSH  WORD     Length    ; Minimum length of lookahead info
  3259. PUSH  DWORD    0    ; Pad parameter - must be 0
  3260. PUSH  WORD     14   ; Set Lookahead Request
  3261. PUSH  WORD     MACDS; DS of called MAC module
  3262. Call  Request
  3263.  
  3264. Returns:  0x0000    SUCCESS
  3265.         0x0002    REQUEST_QUEUED
  3266.         0x0007    INVALID_PARAMETER
  3267.         0x00FF    GENERAL_FAILURE
  3268.  
  3269. Description:
  3270.  
  3271. This request sets the minimum length in bytes of lookahead
  3272. information to be returned in a Receive Lookahead indication.
  3273. Until SetLookahead is initially called, a value of 64 bytes is
  3274. assumed for the lookahead length.  When first called,
  3275. SetLookahead sets the lookahead length value equal to the Length
  3276. parameter of the request.  After the first SetLookahead request,
  3277. the lookahead length is changed only if the value of the Length
  3278. parameter is larger than the current lookahead length.  If the
  3279. length parameter value is smaller, the current Lookahead length
  3280. remains unchanged and SUCCESS is returned.  SetLookahead may be
  3281. called at any time and the lookahead length is preserved during a
  3282. reset.  The maximum value for the lookahead length is 256 bytes.
  3283. MAC's which never call Receive Lookahead or always return
  3284. lookahead information of length greater than or equal to 256
  3285. bytes may return SUCCESS without any internal action.  MAC's must
  3286. support 256 bytes of lookahead data if requested.
  3287.  
  3288. General Request Confirmation
  3289. Purpose: Confirm completion of a previous General Request.
  3290.  
  3291. PUSH  WORD     ProtID    ; Module ID of Protocol
  3292. PUSH  WORD     MACID     ; Module ID of MAC
  3293. PUSH  WORD     ReqHandle ; Unique handle of original request
  3294. PUSH  WORD     Status    ; Final status of original request
  3295. PUSH  WORD     Request   ; Original Request opcode
  3296.                           Page 5-41
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302. PUSH  WORD     ProtDS    ; DS of called Protocol module
  3303. Call  RequestConfirm
  3304.  
  3305. Returns:  0x0000    SUCCESS
  3306.         0x0006    OUT_OF_RESOURCE
  3307.         0x0007    INVALID_PARAMETER
  3308.         0X0024    HARDWARE_FAILURE
  3309.         0x00FF    GENERAL_FAILURE
  3310.  
  3311. Description:
  3312.  
  3313. Notify a protocol that an asynchronous MAC control Request has
  3314. completed after previous Request had returned a REQUEST_QUEUED.
  3315. It is possible that a RequestConfirm can be returned to the
  3316. protocol before the protocol's corresponding Request function has
  3317. completed.
  3318.  
  3319. The ProtID parameter must be the value passed by the protocol on
  3320. the previous general request to identify the requestor.
  3321.  
  3322. If a protocol had made a general MAC request when executing its
  3323. InitiateBind startup function and the MAC returned
  3324. REQUEST_QUEUED, the protocol must wait for the corresponding
  3325. RequestConfirm to be returned before exiting from the
  3326. InitiateBind function.
  3327.  
  3328. Status Indication
  3329. Status indications are spontaneous calls from a MAC to a
  3330. protocol, typically at interrupt time.  They inform the protocol
  3331. of changes in MAC status.
  3332.  
  3333. All status indications have the following common calling
  3334. convention:
  3335.  
  3336. PUSH  WORD     MACID     ; Module ID of MAC
  3337. PUSH  WORD     Param1    ; Opcode dependent word parameter or 0
  3338. PUSH  LPBYTE   Indicate  ; Virtual address of indicate flag
  3339. PUSH  WORD     Opcode    ; Opcode of status indication
  3340. PUSH  WORD     ProtDS    ; DS of called Protocol module
  3341. Call  Status
  3342.  
  3343. Indicate is the virtual address of the indication flag byte.
  3344. This byte is set to 0xFF by the MAC prior to this call.  If the
  3345. protocol clears the byte to zero prior to returning then
  3346. indications will be left disabled until IndicationOn is called
  3347. from IndicationComplete.
  3348.  
  3349. RingStatus
  3350. Purpose:  Return a change in ring status.
  3351.  
  3352. PUSH  WORD     MACID     ; Module ID of MAC
  3353. PUSH  WORD     Status    ; New Ring Status
  3354. PUSH  LPBYTE   Indicate  ; Virtual address of indicate flag
  3355. PUSH  WORD     1         ; Ring Status Indication
  3356. PUSH  WORD     ProtDS    ; DS of called protocol module
  3357. Call  Indication
  3358.  
  3359. Returns:  0x0000    SUCCESS
  3360.  
  3361. Description:
  3362.                           Page 5-42
  3363.  
  3364.  
  3365.  
  3366.  
  3367.  
  3368. Called by 802.5-style MAC drivers to indicate a change in ring
  3369. status.  The status codes for 802.5-style drivers are encoded as
  3370. a 16-bit mask, where the bits in the mask are defined as follows:
  3371.  
  3372.      BitMeaning
  3373.  
  3374.      15 Signal Loss
  3375.      14 Hard Error
  3376.      13 Soft Error
  3377.      12 Transmit Beacon
  3378.      11 Lobe Wire Fault
  3379.      10 Auto-Removal Error 1
  3380.         9Reserved
  3381.         8Remove Received
  3382.         7Counter Overflow
  3383.         6Single Station
  3384.         5Ring Recovery
  3385.         4-0   Reserved
  3386.  
  3387. For certain ring status changes, the adapter may already have
  3388. been removed from the ring.  The protocol driver must check
  3389. whether the adapter has been closed (by examining bit 4 fo the
  3390. MAC status field in the MAC service-specific status table).  For
  3391. additional information, consult the IBM Token Ring Technical
  3392. Reference Manual.  If the status condition caused the adapter to
  3393. close, the MAC must return confirmations with non-SUCCESS status
  3394. codes for all pending TransmitChain and general requests.
  3395.  
  3396. AdapterCheck
  3397. Purpose:  Return hardware status.
  3398.  
  3399. PUSH  WORD     MACID     ; Module ID of MAC
  3400. PUSH  WORD     Reason    ; Reason for Adapter Check
  3401. PUSH  LPBYTE   Indicate  ; Virtual address of indicate flag
  3402. PUSH  WORD     2         ; Adapter Check Indication
  3403. PUSH  WORD     ProtDS    ; DS of called protocol module
  3404. Call  Indication
  3405.  
  3406. Returns:  0x0000    SUCCESS
  3407.  
  3408. Description:
  3409.  
  3410. Called to indicate a fatal adapter error.  If this function is
  3411. called the protocol must issue a ResetMAC call (if supported)
  3412. before communications can resume.  Note that a MAC may choose to
  3413. tolerate some number of errors before issuing an AdaperCheck
  3414. indication.  For example, a MAC may want to accept the occasional
  3415. receive DMA overrun, and only issue the AdapterCheck for this
  3416. condition if it occurs excessively.
  3417.  
  3418. For 802.5 MAC's the Reason code is defined as follows (NOT a bit
  3419. mask):
  3420.  
  3421.      0x8000  Adapter Inoperative
  3422.      0x1000  Illegal Opcode
  3423.      0x0800  Local Bus Parity Error
  3424.      0x0400  Parity Error
  3425.      0x0100  Internal Parity Error
  3426.      0x0080  Parity Error, Ring Transmit
  3427.                           Page 5-43
  3428.  
  3429.  
  3430.  
  3431.  
  3432.  
  3433.      0x0040  Parity Error, Ring Receive
  3434.      0x0020  Transmit Overrun
  3435.      0x0010  Receive Overrun
  3436.      0x0008  Unrecognized Interrupt
  3437.      0x0004  Unrecognized Error Interrupt
  3438.      0x0003  Adapter Detected No PC System Service
  3439.      0x0002  Unrecognized Supervisory Request
  3440.      0x0001  Program Request
  3441.  
  3442. All 802.5 values not defined above are reserved.
  3443.  
  3444. The MAC must always return confirmations with non-SUCCESS status
  3445. codes for all pending TransmitChain and general requests.
  3446.  
  3447. For 802.3 MAC's the Reason code is defined as follows (NOT a bit
  3448. mask):
  3449.  
  3450.  
  3451.      0x8000  Adapter Inoperative (Adapter did not respond
  3452.      to command orcould not be found)
  3453.      0x4000  Command Timed Out (Adapter did not complete
  3454.      command within acceptable time interval)
  3455.      0x2000  SQE Test Failure (No heartbeat detected on
  3456.      previoustransmission)
  3457.      0x1000  Excessive Collisions (Transmission failed due
  3458.      to excessive collisions)
  3459.      0x0800  Lost Carrier Sense (Adapter lost carrier
  3460.      during transmission)
  3461.      0x0400  TDR Failure (TDR test detected a short or
  3462.      open on the link)
  3463.      0x0020  Transmit Underrun (DMA underrun occurred on  
  3464.          transmission)
  3465.      0x0010  Receive Overrun (DMA overrun occurred on
  3466.      reception)
  3467.  
  3468. All 802.3 values not defined above are reserved.
  3469.  
  3470. StartReset
  3471. Purpose:  Imply that adapter has started a reset.
  3472.  
  3473. PUSH  WORD     MACID     ; Module ID of MAC
  3474. PUSH  WORD     0         ; Pad parameter must be zero
  3475. PUSH  LPBYTE   Indicate  ; Virtual address of indicate flag
  3476. PUSH  WORD     3         ; Start Reset Indication
  3477. PUSH  WORD     ProtDS    ; DS of called protocol module
  3478. Call  Indication
  3479.  
  3480. Returns:  0x0000    SUCCESS
  3481.  
  3482. Description:
  3483.  
  3484. Called to indicate that the adapter has started a reset.  This
  3485. will generally be due to a call to ResetMAC (perhaps by another
  3486. protocol driver in a VECTOR configuration) but can be
  3487. unsolicited.  The protocol must assume when it gets this
  3488. indication that all requests outstanding to the MAC have been
  3489. discarded without notification.  The end of the reset will be
  3490. signalled by an EndReset indication.  The reset process may take
  3491. a significant amount of time.  While it is in progress, the MAC
  3492. may reject any requests it cannot handle with INVALID_FUNCTION
  3493.                           Page 5-44
  3494.  
  3495.  
  3496.  
  3497.  
  3498.  
  3499. (0x0008).  As with any other indication, StartReset is entered
  3500. with indications implicitly disabled.  To protect itself from
  3501. other indications the protocol may choose to modify the Indicate
  3502. flag to keep indications disabled on return.  This will not
  3503. prevent the EndReset indication from being generated however.
  3504.  
  3505.  
  3506. EndReset
  3507. Purpose:  Imply that adapter has finished a reset.
  3508.  
  3509. PUSH  WORD     MACID     ; Module ID of MAC
  3510. PUSH  WORD     0         ; Pad parameter (must be zero)
  3511. PUSH  LPBYTE   Indicate  ; Virtual address of indicate flag
  3512. PUSH  WORD     5         ; End Reset Indication
  3513. PUSH  WORD     ProtDS    ; DS of called protocol module
  3514. Call  Indication
  3515.  
  3516. Returns:  0x0000    SUCCESS
  3517.         0x0008    INVALID_FUNCTION
  3518.  
  3519. Description:
  3520.  
  3521. Called to indicate that the adapter has finished a reset and
  3522. follows the StartReset indication.  The protocol may return
  3523. INVALID_FUNCTION if it was written to the 1.0.1 version of this
  3524. specification, where it assumes end of reset on
  3525. IndicationComplete.  To ensure compatibility with 1.0.1 protocol
  3526. drivers, the MAC must ensure the IndicationComplete is called
  3527. after EndReset and before any other indications.
  3528.  
  3529. As with any other indication, EndReset is entered with
  3530. indications implicitly disabled.  To protect itself from other
  3531. indications the protocol may choose to modify the Indicate flag
  3532. to keep indications disabled on return.  MAC drivers must be
  3533. prepared for the possibility that both StartReset and EndReset
  3534. allow the protocol to modify this flag.
  3535.  
  3536. Interrupt
  3537. Purpose:  Imply that an interrupt has occurred as the result of a
  3538. interrupt request.
  3539.  
  3540. PUSH  WORD     MACID     ; Module ID of MAC
  3541. PUSH  WORD     0         ; Pad parameter must be 0
  3542. PUSH  LPBYTE   Indicate  ; Virtual address of indicate flag
  3543. PUSH  WORD     4         ; Interrupt indication
  3544. PUSH  WORD     ProtDS    ; DS of called protocol module
  3545. Call  Indication
  3546.  
  3547. Returns:  0x0000    SUCCESS
  3548.  
  3549. Description:
  3550.  
  3551. The MAC calls this function to indicate to a protocol that an
  3552. interrupt requested by an Interrupt request has occurred.  Since
  3553. this indication may be deferred by disabling indications, a
  3554. protocol may use this mechanism to implement a simple scheduling
  3555. scheme to allow it to regain control once outside of a critical
  3556. code region.  The MAC may at its discretion suppress the
  3557. generation of this indication if there is another indication
  3558.  
  3559.                           Page 5-45
  3560.  
  3561.  
  3562.  
  3563.  
  3564.  
  3565. pending which may be issued in place of the Interrupt status
  3566. indication.
  3567.  
  3568.  
  3569. System Requests
  3570. All MAC and protocol modules implement a set of system request
  3571. functions that support module-independent functions such as
  3572. binding.  The caller of these functions is usually the Protocol
  3573. Manager.  The entry point for system requests is defined in the
  3574. common characteristics table for the module.  All system requests
  3575. are implemented synchronously.  Note that all pointers in system
  3576. requests are Ring 0 GDT virtual addresses.
  3577.  
  3578. All system requests have the following common calling convention:
  3579.  
  3580. PUSH DWORD     Param1    ; Request dependent dword parameter or 0
  3581. PUSH DWORD     Param2    ; Request dependent dword parameter or 0
  3582. PUSH WORD      Param3    ; Request dependent word parameter or 0
  3583. PUSH WORD      Opcode    ; Opcode of request
  3584. PUSH WORD      TargetDS  ; DS of called module
  3585. Call  System
  3586.  
  3587. InitiateBind
  3588. Purpose:  Instruct a module to bind to another module.
  3589.  
  3590. PUSH  DWORD    0         ; Pad parameter must be 0
  3591. PUSH  LPBUF    CharTab   ; Characteristics of module to bind
  3592. PUSH  WORD     LastBind  ; Non-zero if last InitiateBind
  3593. PUSH  WORD     1         ; Initiate Bind Request
  3594. PUSH  WORD     ProtDS    ; DS of called Protocol module
  3595. CALL  System
  3596.  
  3597. Returns:  0x0000    SUCCESS
  3598.         0x0008    INVALID_FUNCTION
  3599.         0x0021    INCOMPLETE_BINDING
  3600.         0x0022    DRIVER_NOT_INITIALIZED
  3601.         0x0023    HARDWARE_NOT_FOUND
  3602.         0x0024    HARDWARE_FAILURE
  3603.         0x0025    CONFIGURATION_FAILURE
  3604.         0x0026    INTERRUPT_CONFLICT
  3605.         0x0027    INCOMPATIBLE_MAC
  3606.         0x0028    INITIALIZATION_FAILED
  3607.         0x002A    NETWORK_MAY_NOT_BE_CONNECTED
  3608.         0x002B    INCOMPATIBLE_OS_VERSION
  3609.         0x00FF    GENERAL_FAILURE
  3610.  
  3611. Description:
  3612.  
  3613. This call is issued by the Protocol Manager to an upper protocol
  3614. module.  It passes the address of the characteristics table of
  3615. the lower module that the upper module must issue a Bind call to.
  3616. If the upper module specified a BindingsList including more than
  3617. one lower module, then InitiateBind's will be issued for those
  3618. modules in the order the lower modules are listed in the
  3619. BindingsList structure.  LastBind is used to indicate the last
  3620. Initiate Bind request so the module may perform any final
  3621. initialization prior to returning.  In the static default binding
  3622. case of one static protocol and one MAC, the Protocol Manager
  3623. will issue an InitiateBind passing the characteristics table of
  3624. the MAC even if no bindings list was specified.  In this case
  3625.                           Page 5-46
  3626.  
  3627.  
  3628.  
  3629.  
  3630.  
  3631. LastBind will be non-zero.  In the non-default case if a module
  3632. other than a MAC does not have lower bindings (having a Bindlist
  3633. with a NumBindings count = 0), the Protocol Manager will still
  3634. issue an Initiate Bind to the module to allow final
  3635. initialization.  In this case CharTab will be NULL and LastBind
  3636. will be non-zero.
  3637.  
  3638. If the Bind operation fails then the Initiate Bind operation must
  3639. also fail returning the same return code as the failing Bind
  3640. call.
  3641.  
  3642. If a module returns a non-SUCCESS code on InitiateBind,  in the
  3643. dynamic mode the Protocol Manager will automatically deregister
  3644. that module and remove all reference to it in its bind tables.
  3645. In particular any other module that had registered (via
  3646. RegisterModule) its intention to bind with the failed module will
  3647. get an InitiateBind call with the "CharTab" pointer far NULL and
  3648. "LastBind" non-zero.  A module that has lower bindings and
  3649. receives an InitiateBind with a NULL bind "CharTab" must generate
  3650. a non-SUCCESS return code in order to force the Protocol Manager
  3651. to deregister it.  In DOS it is recommended that a dynamic module
  3652. that failed its bind deinstall itself.  In OS/2 it is recommended
  3653. that the dynamic driver that failed its bind leave its dynamic
  3654. segments unlocked.
  3655.  
  3656. Bind
  3657. Purpose:  Exchange module characteristic table information.
  3658.  
  3659. PUSH  LPBUF    CharTab   ; Pointer to caller's table
  3660. PUSH  LPBUF    TabAddr   ; Address where to return a pointer
  3661.                ; to called module's characteristics
  3662. PUSH  WORD0              ; Pad parameter must be zero
  3663. PUSH  WORD2              ; Bind Request
  3664. PUSH  WORD     TargetDS  ; DS of called module
  3665. CALL  System
  3666.  
  3667. Returns:  0x0000    SUCCESS
  3668.         0x0008    INVALID_FUNCTION
  3669.         0x0022    DRIVER_NOT_INITIALIZED
  3670.         0x0023    HARDWARE_NOT_FOUND
  3671.         0x0024    HARDWARE_FAILURE
  3672.         0x0025    CONFIGURATION_FAILURE
  3673.         0x0026    INTERRUPT_CONFLICT
  3674.         0x0027    INCOMPATIBLE_MAC
  3675.         0x0028    INITIALIZATION_FAILED
  3676.         0x002A    NETWORK_MAY_NOT_BE_CONNECTED
  3677.         0x002B    INCOMPATIBLE_OS_VERSION
  3678.         0x00FF    GENERAL_FAILURE
  3679.  
  3680. Description:
  3681.  
  3682. Used by one module to bind to another.  It exchanges pointers to
  3683. characteristics tables between the two modules.  A MAC will
  3684. accept only one bind and will not accept additional bind
  3685. attempts.
  3686.  
  3687. For compatibility with Remote Initial Program Load, MAC drivers
  3688. must not manipulate the network adapter at INIT time.  The MAC
  3689. driver is free to determine if the network adapter is present,
  3690. but must leave any hardware manipulation to Bind time processing.
  3691.                           Page 5-47
  3692.  
  3693.  
  3694.  
  3695.  
  3696.  
  3697. InitiatePrebind (OS/2 only)
  3698. Purpose:  In OS/2 dynamic bind mode instruct a module to restart
  3699. its prebind initialization.
  3700.  
  3701. PUSH  DWORD    0         ; Pad parameter (must be zero)
  3702. PUSH  LPBUF    0         ; Pad parameter (must be zero)
  3703. PUSH  WORD     0         ; Pad parameter (must be zero
  3704. PUSH  WORD     3         ; Initiate Prebind Request
  3705. PUSH  WORD     ProtDS    ; DS of called protocol module
  3706. CALL  System
  3707.  
  3708. Returns:  0x0000    SUCCESS
  3709.         0x00FF    GENERAL_FAILURE
  3710.  
  3711. Description:
  3712.  
  3713. In the OS/2 dynamic mode, this call is issued by the Protocol
  3714. Manager to a dynamically loadable protocol driver when the
  3715. Protocol Manager InitAndRegister is called.  This function is
  3716. available for the protocol driver to restart its prebind
  3717. initialization when it is dynamically reloaded.
  3718.  
  3719. An OS/2 dynamic protocol driver is assumed to be made up of
  3720. static and transient segments.  When the protocol is not needed,
  3721. the transient segments are unlocked (using the DevHlp Unlock
  3722. command) to allow them to be swapped out.  When the protocol is
  3723. needed again, InitiatePrebind is issued.  During InitiatePrebind,
  3724. the driver needs to Lock down its dynamic segments (using the
  3725. DevHlp Lock command, type 1) to force them back into memory and
  3726. make them addressable again.  The protocol must save the lock
  3727. handle returned by this call for later Unlock'ing.  Also, the
  3728. prebind initialization sequence is initiated in this call and
  3729. consists of re-reading the PROTOCOL.INI memory image,
  3730. configuration initialization, prebind memory allocations, and
  3731. registration with the Protocol Manager.  The protocol module
  3732. typically carries out here the same functions that are performed
  3733. by a static protocol module when a strategy routine INIT command
  3734. is given.
  3735.  
  3736. InitiateUnbind
  3737. Purpose:  Instruct a module to unbind from another module.
  3738.  
  3739. PUSH  DWORD    0         ; Pad parameter (must be zero)
  3740. PUSH  LPBUF    CharTab   ; Char's of module to unbind
  3741. PUSH  WORD     LastUnbind; Non-zero if last Init'Unbind
  3742. PUSH  WORD     4         ; Initiate Unbind Request
  3743. PUSH  WORD     ProtDS    ; DS of called protocol module
  3744. CALL  System
  3745.  
  3746. Returns:  0x0000    SUCCESS
  3747.         0x00FF    GENERAL_FAILURE
  3748.  
  3749. Description:
  3750.  
  3751. This call is issued by the Protocol Manager in dynamic mode to an
  3752. upper protocol module.  It passes the address of the
  3753. characteristics table of the lower module that the upper module
  3754. must issue an Unbind command to (this would be an entry into the
  3755. VECTOR if the lower module is a MAC).  LastUnbind is used to
  3756.                           Page 5-48
  3757.  
  3758.  
  3759.  
  3760.  
  3761.  
  3762. indicate the last InitiateUnbind request, so the module may
  3763. perform any final cleanup before returning.
  3764.  
  3765. If a protocol module does not have lower bindings (having a
  3766. BindingsList with a NumBindings count = 0), InitiateUnbind will
  3767. still be issued with CharTab set to NULL and LastUnbind set to
  3768. non-zero in order to allow the module to terminate.
  3769.  
  3770. Unbind
  3771. Purpose:  An unbind request from an upper protocol module to a
  3772. lower module.
  3773.  
  3774. PUSH  LPBUF    CharTab   ; Caller's characteristics table
  3775. PUSH  DWORD    0         ; Pad parameter (must be zero)
  3776. PUSH  WORD     0         ; Pad parameter (must be zero)
  3777. PUSH  WORD     5         ; Unbind Request
  3778. PUSH  WORD     TargetDS  ; DS of called module
  3779. CALL  System
  3780.  
  3781. Returns:  0x0000    SUCCESS
  3782.         0x0008    INVALID_FUNCTION
  3783.         0x00FF    GENERAL_FAILURE
  3784.  
  3785. Description:
  3786.  
  3787. Used by one protocol module to unbind from another.  The caller's
  3788. characteristics table is passed to permit the called module to
  3789. identify the upper module.  If the Unbind is to a MAC, the VECTOR
  3790. does the Unbind cleanup on behalf of the MAC.  Thus MAC drivers
  3791. themselves do not need to support this call.
  3792.  
  3793.  
  3794. Protocol Manager Primitives
  3795. Since the Protocol Manager primitives may be accessed via an
  3796. IOCTL in OS/2, a request block is defined as follows:
  3797.  
  3798. struct ReqBlock
  3799. {
  3800.    unsigned Opcode; /*Opcode for
  3801. Protocol Manager request */
  3802.    unsigned Status; /*Status at
  3803. completion of request    */
  3804.    char far *Pointer1;   /*First parameter
  3805. Ring 0 GDT pointer  */
  3806.    char far *Pointer2;   /*Second parameter
  3807. Ring 0 GDT pointer  */
  3808.    unsigned Word1;  /*Parameter word    
  3809. */
  3810. };
  3811.  
  3812. Direct calls are made to the Protocol Manager with a pointer to
  3813. the ReqBlock on the stack.  For IOCTL requests, the parameter
  3814. buffer contains a pointer to the ReqBlock.  The direct calling
  3815. sequence is as follows:
  3816.  
  3817. PUSH  LPBUF    ReqBlock  ; Ring 0 GDT Address of ReqBlock
  3818. PUSH  WORD     TargetDS  ; DS of Protocol Manager
  3819. Call  ProtManEntry
  3820.  
  3821.  
  3822.                           Page 5-49
  3823.  
  3824.  
  3825.  
  3826.  
  3827.  
  3828. Note that under OS/2 the direct entry cannot be used at
  3829. CONFIG.SYS initialization time since the driver is still in Ring
  3830. 3 context.
  3831.  
  3832. Note also that if the Protocol Manager is in dynamic mode, these
  3833. primitives can be invoked by other modules after system
  3834. initialization.  Dynamic OS/2 Ring 0 device drivers issuing these
  3835. primitives post INIT time must use the direct entry interface
  3836. since the IOCTL interface is illegal at this time.
  3837.  
  3838. GetProtocolManagerInfo
  3839. Purpose:  Retrieve pointer to configuration image.
  3840.  
  3841. Opcode    - 1
  3842.  
  3843. Status    - On return contains request status
  3844.  
  3845. Pointer1  - On return contains a FAR pointer to structure memory
  3846.         image representing the parsed user configuration file
  3847.         PROTOCOL.INI.  For static OS/2 device drivers, the
  3848.         selector of the pointer returned here is valid only at
  3849.         device INIT time.  For dynamic OS/2 device drivers, the
  3850.         selector returned is always valid and will be a valid
  3851.         LDT selector for the process under which this primitive
  3852.         is called.  For DOS this is a segment:offset pair.
  3853.  
  3854. Pointer2  - Unused
  3855.  
  3856. Word1- On return contains the BCD-encoded major (low byte in
  3857.         memory) and minor (high byte in memory) version of the
  3858.         specification on which this Protocol Manager driver is
  3859.         based.  (2.0 for this specification)
  3860.  
  3861. Returns:  0x0000    SUCCESS   
  3862.         0X0008    INVALID_FUNCTION
  3863.         0x0002F   INFO_NOT_FOUND
  3864.         0x00FF    GENERAL_FAILURE
  3865. Description:
  3866.  
  3867. This request is used by a module to obtain the configuration
  3868. information parsed from the user-defined protocol configuration
  3869. file PROTOCOL.INI.  Modules invoke this function during device
  3870. driver initialization to obtain this information for initializing
  3871. configuration variables and making dynamic memory allocations and
  3872. to determine their inter-module bindings.
  3873.  
  3874. In DOS dynamic mode, INFO_NOT_FOUND is returned if the Protocol
  3875. Manager detects that the structured memory image is not valid.
  3876. This can occur if prior to loading a dynamic module the
  3877. structured configuration memory image was not registered with the
  3878. Protocol Manager via a RegisterProtocolManagerInfo command or if
  3879. the memory image got corrupted between registering it and getting
  3880. it via the current primitive.  The corruption might occur if
  3881. another DOS program is loaded between the memory image
  3882. registrations and the memory image read operation by a dynamic
  3883. protocol invoking the GetProtocolManagerInfo primitive.
  3884.  
  3885. This request is valid in both the static and dynamic modes of
  3886. Protocol Manager operation.  In the static mode, this request is
  3887. only valid prior to binding and starting.  Invoking this
  3888.                           Page 5-50
  3889.  
  3890.  
  3891.  
  3892.  
  3893.  
  3894. primitive in static mode after all modules are bound and started
  3895. will cause INVALID_FUNCTION to be returned by Protocol Manager.
  3896.  
  3897. RegisterModule
  3898. Purpose:  Register a module and its bindings.
  3899.  
  3900. Opcode    - 2
  3901.  
  3902. Status    - On return contains request status
  3903.  
  3904. Pointer1  - Contains a FAR pointer to the module's common
  3905.         characteristics table.  The module must have all
  3906.         information in that table filled in except for the
  3907.         Module ID which is filled in by the Protocol Manager on
  3908.         return.
  3909.  
  3910. Pointer2  -Contains a FAR pointer to a BindingsList structure of
  3911.         the modules to which this module wishes to be bound to.
  3912.         The Protocol Manager will use only the information
  3913.         passed in the BindingsList to determine the relevant
  3914.         module bindings.  This pointer can be FAR NULL to
  3915.         indicate that this module will not currently bind to
  3916.         any module.  This latter option is useful for dynamic
  3917.         OS/2 modules that need to register their module name
  3918.         with the Protocol Manager but do not wish to remain
  3919.         fully resident (and therefore bind) at the current
  3920.         time.  This non-bindable registration permits the
  3921.         dynamic driver to reregister with a BindingsList when
  3922.         it is later reloaded and made operational.
  3923.  
  3924. Word1-Unused
  3925.  
  3926. Returns:  0x0000    SUCCESS
  3927.         0x0008    INVALID_FUNCTION
  3928.         0x002C    ALREADY_REGISTERED
  3929.         0x00FF    GENERAL_FAILURE
  3930.  
  3931. Description:
  3932.  
  3933. This request is used by a driver or dynamically loadable
  3934. executable to identify one of its contained modules to the
  3935. Protocol Manager.  After calling RegisterModule, a static driver
  3936. must  remain installed and respond to system requests.  A dynamic
  3937. OS/2 driver must leave its system entry function code permanently
  3938. locked in memory.  A dynamic DOS module must remain installed and
  3939. respond to system requests until it is unbound and unloaded.
  3940. This registration is accomplished by passing a pointer to the
  3941. module's characteristics table to the Protocol Manager.  The
  3942. driver also passes a bindings list requested by the module.  The
  3943. bindings list contains the one or more module names which the
  3944. module wishes to bind to as a client.  This bindings information
  3945. is later used by the Protocol Manager to determine the necessary
  3946. sequence of InitiateBind commands to issue.  This bindings list
  3947. must persist while the protocol is operational.  In the static
  3948. default bindings case of one static protocol and one MAC, the
  3949. bindings list pointer provided in this request can be NULL
  3950. indicating that a protocol module by default will bind to the
  3951. single underlying MAC.  Otherwise in the non-default bindings
  3952. case, a NULL bindings list pointer provided in this request will
  3953. indicate that this module will not bind to any other module at
  3954.                           Page 5-51
  3955.  
  3956.  
  3957.  
  3958.  
  3959.  
  3960. the current time and is not ready to initialize.  In this latter
  3961. case the Protocol Manager will not call the module's InitiateBind
  3962. system function.  A NULL binding list pointer is particuarly
  3963. useful for dynamic OS/2 drivers that register their module name
  3964. at  INIT time, but are not to remain fully resident at startup
  3965. time.  This is called a non-bindable registration.  A protocol
  3966. module can also pass a non-NULL bindings list with a 0 number of
  3967. bindings count.  In the default bindings case, this is
  3968. interpreted by the Protocol Manager to bind the protocol to the
  3969. single underlying MAC.  In the non-default bindings configuration
  3970. this means that a protocol is registering without any lower
  3971. bindings, but is required to be initialized by an InitiateBind
  3972. call.
  3973.  
  3974. A driver which contains multiple modules can call RegisterModule
  3975. multiple times, once for each module.  The Protocol Manager
  3976. responds to each request by assigning each module a module ID.
  3977. The module ID is returned in the module's characteristics table
  3978. on completion of the RegisterModule request.
  3979.  
  3980. If a module name is currently registered with the Protocol
  3981. Manager, an attempt to register the same module name will fail
  3982. and a status code of ALREADY_REGISTERED  will be returned.  A
  3983. dynamic OS/2 driver is considered currently registered if it had
  3984. previously registered with a non-NULL bindings list indicating a
  3985. requirement to bind and/or start and it had not yet unbound.
  3986. Thus a dynamic OS/2 driver can reregister with the Protocol
  3987. Manager under the same module names if it either had unbound or
  3988. had not previously made a bindable registration.
  3989.  
  3990. This request is valid in both the static and dynamic modes of
  3991. Protocol Manager operation.  In the static mode, this request in
  3992. only valid prior to binding and starting.  Invoking this
  3993. primitive in static mode after all modules are bound and started
  3994. will cause INVALID FUNCTION to be returned by the Protocol
  3995. Manager.  A registration of a dynamic module (bit 2 set of the
  3996. "module function flags" in the Common Characteristics table) in
  3997. static Protocol Manager mode is invalid and will generate
  3998. INVALID_FUNCTION.  It is mandatory that all static DOS and static
  3999. and dynamic OS/2 device drivers invoke this function at least
  4000. once at INIT time.
  4001.  
  4002. BindAndStart
  4003. Purpose:  Initiate the binding process.
  4004.  
  4005. Opcode    - 3
  4006.  
  4007. Status    - On return contains request status
  4008.  
  4009. Pointer1  - Caller's virtual address of FailingModules structure.
  4010.         This structure in the
  4011.      caller's address space is filled  in by the Protocol
  4012.         Manager prior to
  4013.      returning from BindAndStart.  If BindAndStart reports
  4014.         an error, it contains
  4015.      the module names in ASCIIZ format of the upper module
  4016.         and lower
  4017.      module (may be a NULL string) reporting the error.
  4018.         If BindAndStart is
  4019.      successful then both are NULL strings.
  4020.                           Page 5-52
  4021.  
  4022.  
  4023.  
  4024.  
  4025.  
  4026.         struct FailingModules {
  4027.          char UpperModuleName[16];  /* Upper failing module
  4028. */
  4029.          char LowerModuleName{16}; /* Lower failing module
  4030. */
  4031.         };
  4032.  
  4033. Pointer2  - Unused
  4034.  
  4035. Word1- Unused
  4036.  
  4037. Returns:  0x0000    SUCCESS
  4038.         0x0007    INVALID_PARAMETER
  4039.         0x0008    INVALID_FUNCTION
  4040.         0x0020    ALREADY_STARTED
  4041.         0x0021    INCOMPLETE_BINDING
  4042.         0x0022    DRIVER_NOT_INITIALIZED
  4043.         0x0023    HARDWARE_NOT_FOUND
  4044.         0x0024    HARDWARE_FAILURE
  4045.         0x0025    CONFIGURATION_FAILURE
  4046.         0x0026    INTERRUPT_CONFLICT
  4047.         0x0027    INCOMPATIBLE_MAC
  4048.         0x0028    INITIALIZATION_FAILED
  4049.         0x0029    NO_BINDING
  4050.         0x0002D   PATH_NOT_FOUND
  4051.         0x0002E   INSUFFICIENT_MEMORY
  4052.         0x00FF    GENERAL_FAILURE
  4053.  
  4054. Description:
  4055.  
  4056. This is used to trigger the Protocol Manager bind and start
  4057. sequence.  This permits an application program (e.g., executing
  4058. from a DOS batch or OS/2 command file) to trigger the bind
  4059. sequence.  The bind sequence is invoked by the Protocol Manager's
  4060. calling each module's inter-module InitiateBind function.  If an
  4061. InitiateBind fails then BindAndStart will fail with same return
  4062. code as the failing InitiateBind.
  4063.  
  4064. In the static mode of Protocol Manager operation, this request
  4065. can be invoked only once to bind and start all static drivers.
  4066. Successive invocations return INVALID_FUNCTION.
  4067.  
  4068. In the dynamic mode, this command tells the Protocol Manager to
  4069. issue the IntitiateBind primitive to all dynamically loaded
  4070. protocol drivers that have registered since the last InitiateBind
  4071. (or since the beginning of time for the first call).
  4072.  
  4073. In DOS, the caller is required to invoke this primitive via the
  4074. direct entry point rather than the DOS IOCTL method.  The
  4075. Protocol Manager will generate an INVALID_FUNCTION error if this
  4076. function is invoked by an IOCTL.  This will permit the protocol
  4077. modules to make DOS function calls during their bind and start
  4078. sequence initiated by this primitive (when the Protocol Manager
  4079. calls the InitiateBind system entry point of the protocol).  If
  4080. the IOCTL were used, the bind/start sequence would be carried out
  4081. inside of a DOS call and protocols would not be able to make
  4082. further DOS calls within their initialization sequence in order
  4083. to prevent DOS reentrancy.
  4084.  
  4085.                           Page 5-53
  4086.  
  4087.  
  4088.  
  4089.  
  4090.  
  4091. In DOS the Protocol Manager loads PROTMAN.EXE to execute this
  4092. commnad.  The caller must have previously guaranteed that at
  4093. least 20k of memory is available to load PROTMAN.EXE prior to
  4094. invoking the BindAndStart primitive.  In static VECTOR
  4095. configurations (Chapter 7) PROTMAN.EXE will remain resident after
  4096. BindAndStart completes.  In such cases it is strongly recommended
  4097. that the caller free as much memory as possible prior to calling
  4098. BindAndStart so the PROTMAN.EXE will reside in the lowest memory
  4099. possible.  This will prevent large unusable gaps in DOS memory
  4100. when the calling function terminates.
  4101.  
  4102. A utility, NETBIND.EXE, that invokes the BindAndStart primitive
  4103. is provided with the Protocol Manager and is described in
  4104. Appendix E.
  4105.  
  4106. GetProtocolManagerLinkage
  4107. Purpose:  Retrieve Protocol Manager Dispatch and DS Value.
  4108.  
  4109. Opcode    - 4
  4110.  
  4111. Status    - On return contains request status
  4112.  
  4113. Pointer1  - On return contains the Protocol Manager Dispatch
  4114. point.
  4115.  
  4116. Pointer2  - Unused
  4117.  
  4118. Word1- On return contains the Protocol Manager DS.
  4119.  
  4120. Returns:  -    0x0000    SUCCESS
  4121.          0x0008    INVALID_FUNCTION
  4122.          0x00FF    GENERAL_FAILURE
  4123. Description:
  4124.  
  4125. This request is used by a module to obtain the dispatch entry
  4126. point and DS of the Protocol Manager.  Direct calls may then be
  4127. made by DOS & OS/2 Ring 0 drivers and DOS utilities to the
  4128. dispatch entry point.
  4129.  
  4130. All dynamically reloaded OS/2 protocol drivers must issue this
  4131. command to the Protocol Manager at CONFIG.SYS INIT time using the
  4132. IOCTL mechanism and must save the Ring 0 Protocol Manager
  4133. dispatch entry point and DS.  When the driver subsequently re-
  4134. registers with the Protocol Manager on reload at post INIT time,
  4135. it must do so via the direct entry interface using the saved
  4136. entry point and DS (since an IOCTL would be illegal at that
  4137. time).
  4138.  
  4139. Any DOS utility that intends to invoke the BindAndStart or
  4140. UnbindAndStop Protocol Manager primitives must first invoke this
  4141. primitive to get the Protocol Manager's direct entry point.
  4142.  
  4143. This request is valid in both the static and dynamic modes of
  4144. Protocol Manager operation.  In the static mode, this request is
  4145. only valid prior to binding and starting.  Invoking this
  4146. primitive in static mode after all modules are bound and started
  4147. will cause INVALID_FUNCTION to be returned by the Protocol
  4148. Manager.
  4149.  
  4150. GetProtocolIniPath
  4151.                           Page 5-54
  4152.  
  4153.  
  4154.  
  4155.  
  4156.  
  4157. Purpose:  A command to obtain the path to the PROTOCOL.INI file
  4158. read by the
  4159.         Protocol Manager when it initialized.
  4160.  
  4161. Opcode    - 5
  4162.  
  4163. Status    - On return contains request status
  4164.  
  4165. Pointer1  - The virtual FAR pointer to a buffer, which will
  4166. contain the returned
  4167.      PROTOCOL.INI pathname in ASCIIZ format on completion.
  4168.  
  4169. Pointer2  - Unused
  4170.  
  4171. Word1- The length of the provided buffer on input.
  4172.  
  4173. Returns:  -    0x0000    SUCCESS
  4174.          0x0007    INVALID_PARAMETER
  4175.          0x0008    INVALID_FUNCTION
  4176.  
  4177. Description:
  4178.  
  4179. This primitive can be called by an application program or
  4180. dynamically loadable protocol that will read and parse the
  4181. PROTOCOL.INI file to obtain the original location of the
  4182. PROTOCOL.INI file used by the Protocol Manager when it
  4183. initialized.  This permits such a program to use the same file
  4184. read by the Protocol Manager.  The Protocol Manager returns only
  4185. the pathname to the subdirectory containing the PROTOCOL.INI
  4186. file, excluding the string "PROTOCOL.INI", which may be up to 60
  4187. characters in length.  This string will include the drive
  4188. identifier and be fully qualified relative to the root.  The
  4189. buffer must be large enough to hold the returned string.  If not,
  4190. the contents of the buffer are undefined and the
  4191. INVALID_PARAMETER error returned.
  4192.  
  4193. This request is valid in both the static and dynamic modes of
  4194. Protocol Manager operation.  In the static mode, this request is
  4195. only valid prior to binding and starting.  Invoking this
  4196. primitive in static mode after all modules are bound and started
  4197. will cause INVALID_FUNCTION to be returned by the Protocol
  4198. Manager.
  4199.  
  4200. RegisterProtocolManagerInfo
  4201. Purpose:  A command valid only in the dynamic mode to register
  4202. the current startingaddress of the PROTOCOL.INI memory
  4203. image with the Protocol Manager.
  4204.  
  4205. Opcode    - 6
  4206.  
  4207. Status    - On return contains request status
  4208.  
  4209. Pointer1  - The virtual FAR pointer to the structured memory
  4210. image representing theparsed user configuration file,
  4211. PROTOCOL.INI.
  4212.  
  4213. Pointer2  - Unused
  4214.  
  4215. Word1- Length of structured memory image
  4216.  
  4217.                           Page 5-55
  4218.  
  4219.  
  4220.  
  4221.  
  4222.  
  4223. Returns:  -    0x0000    SUCCESS
  4224.          0x0008    INVALID_FUNCTION
  4225.  
  4226. Description:
  4227.  
  4228. In dynamic mode, this command registers with the Protocol Manager
  4229. the address of the PROTOCOL.INI memory image.  It is assumed that
  4230. prior to dynamically loading a protocol module, the PROTOCOL.INI
  4231. file is re-read and re-parsed in some memory image.  The pointer
  4232. to the memory image is given to the Protocol Manager, so that it
  4233. is available for the "GetProtocolManagerInfo" primitive of the
  4234. dynamic initializing module that reads its configuration
  4235. parameters.
  4236.  
  4237. In static mode, this command is illegal and the INVALID_FUNCTION
  4238. error code is returned.
  4239.  
  4240. A utility, READPRO.EXE, that reads and parses the PROTOCOL.INI
  4241. file into a memory image and registers this with the Protocol
  4242. Manager is provided with the Protocol Manager and is described in
  4243. Appendix E.
  4244.  
  4245. InitAndRegister
  4246. Purpose:  An optional dynamic OS/2 command to dynamically restart
  4247. the prebind    initialization of a dynamically reloadable
  4248. protocol driver.
  4249.  
  4250. Opcode    - 7
  4251.  
  4252. Status    - On return contains request status
  4253.  
  4254. Pointer1  - Unused
  4255.  
  4256. Pointer2  - FAR virtual pointer to an ASCIIZ buffer containing
  4257. the name of the  module to be prebind initialized.
  4258.  
  4259. Word1- Unused
  4260.  
  4261. Returns:  -    0x0000    SUCCESS
  4262.          0x0007    INVALID_PARAMETER
  4263.          0x0008    INVALID_FUNCTION
  4264.          0x00FF    GENERAL_FAILURE
  4265.  
  4266. Description:
  4267.  
  4268. In OS/2 dynamic mode, this reactivates the transient portions of
  4269. a protocol driver previously statically loaded at system startup,
  4270. but for which the transient portions of the driver were not
  4271. locked down.  The command causes the Protocol Manager to invoke
  4272. the system entry point of the specified module with the
  4273. function"InitiatePrebind" in order for the driver to restart its
  4274. prebind initialization.  The prebind initialization functions are
  4275. driver specific.  However, it is expected that such functions
  4276. might include
  4277.  
  4278. o    locking down its dynamic segments using the DevHlp Lock
  4279. command (lock type
  4280. 1) and saving the returned lock handle.
  4281.  
  4282. o    getting its PROTOCOL.INI configuration information
  4283.                           Page 5-56
  4284.  
  4285.  
  4286.  
  4287.  
  4288.  
  4289. o    doing its prebind initialization,
  4290.  
  4291. o    and finally, re-registering with the Protocol Manager.
  4292.  
  4293. In static mode, this command is illegal and the INVALID_FUNCITON
  4294. error code is returned.
  4295.  
  4296. UnbindAndStop
  4297. Purpose:  A dynamic binding command to terminate a transient
  4298. previouslydynamically bound protocol module and to
  4299. terminate its bindings.
  4300.  
  4301. Opcode    - 8
  4302.  
  4303. Status    - On return contains request status
  4304.  
  4305. Pointer1  - Failing modules as for the "BindAndStart" command
  4306.  
  4307. Pointer2  - If non-NULL, FAR virtual pointer to an ASCIIZ buffer
  4308. containing the
  4309.      name of the module to be unbound.
  4310.  
  4311.      If NULL, then terminates a set of previously
  4312. dynamically bound protocol modules as defined below.
  4313. Valid only for DOS.
  4314.  
  4315. Word1- Unused
  4316.  
  4317. Returns:  -    0x0000    SUCCESS
  4318.          0x0007    INVALID_PARAMETER
  4319.          0x0008    INVALID_FUNCTION
  4320.          0x0002D   PATH_NOT_FOUND
  4321.          0x0002E   INSUFFICIENT_MEMORY
  4322.  
  4323. Description:
  4324.  
  4325. This is used in the dynamic mode to terminate either a specific
  4326. protocol module or a set of previously dynamically bound protocol
  4327. modules and to terminate their binds.  A "set" is the collection
  4328. of protocol modules previously loaded or reloaded between two
  4329. successive "BindAndStart" calls or between the last
  4330. "BindAndStart" and this call.  Successive "UnbindAndStop"
  4331. commands with NULL Pointer2 arguments terminate protocol sets in
  4332. the reverse order in which they were bound.  The Protocol Manager
  4333. removes reference to the protocols from its VECTOR (for MAC
  4334. unbindings) table and general binding tables.  The Protocol
  4335. Manager issues an "InitiateUnbind" command to each protocol to be
  4336. unbound so that the protocol can issue an "Unbind" command to the
  4337. modules it is bound to.  For MAC unbindings, the "Unbind" is
  4338. issued back to the Protocol Manager VECTOR.  The NULL Pointer2
  4339. option is used in DOS environments for TSR protocol modules in
  4340. which the unbind sequence usually proceeds in reverse order of
  4341. the bind sequence.  The non-NULL Pointer2 option must be used in
  4342. OS/2 environments.  The NULL Pointer2 option is invalid for OS/2.
  4343.  
  4344. In DOS, the caller is required to invoke this primitive via the
  4345. direct entry point method rather than the DOS IOCTL method.  The
  4346. Protocol Manager will generate an INVALID_FUNCTION error if this
  4347. function is invoked by an IOCTL.  This will permit the protocol
  4348.                           Page 5-57
  4349.  
  4350.  
  4351.  
  4352.  
  4353.  
  4354. modules to be terminated to make DOS function calls during their
  4355. unbind/stop sequence initiated by this primitive (when the
  4356. Protocol Manager calls the InitiateUnbind system entry point of
  4357. the protocol).  If the IOCTL were used, the unbind/stop sequence
  4358. would be carrried out inside of a DOS call, and protocols would
  4359. not be able to make further DOS calls within their termination
  4360. sequence in order to prevent DOS reentrancy.
  4361.  
  4362. In DOS the Protocol Manager loads PROTMAN.EXE to execute this
  4363. command.  The caller must have previously guaranteed that at
  4364. least 20K of memory is available to load PROTMAN.EXE prior to
  4365. invoking the UnbindAndStop primitive.
  4366.  
  4367. A utility, UNBIND.EXE, that invokes the UnbindAndStop primitive
  4368. is provided with the Protocol Manager and is described in
  4369. Appendix E.
  4370.  
  4371. In static mode, this command is illegal and the INVALID_FUNCTION
  4372. error code is returned.
  4373.  
  4374. BindStatus
  4375. Purpose:  A command to obtain information from the Protocol
  4376. Manager about the   current set of bound modules.
  4377.  
  4378. Opcode    - 9
  4379.  
  4380. Status    - On return contains request status
  4381.  
  4382. Pointer1  - On input, under OS/2 only, if the caller is in Ring
  4383. 3, this must be a FAR  virtual pointer to a buffer
  4384. where the returned information will be stored.
  4385.         - On input, under DOS or in OS/2, if the caller is in
  4386. Ring 0, this pointer   must be NULL.
  4387.         - On output, Pointer1 points to the root tree.
  4388.  
  4389. Pointer2  - NULL
  4390.  
  4391. Word1- only used in OS/2
  4392.         - Length of buffer (input) and bytes copied (output).
  4393.  
  4394. Returns:  -    0x0000    SUCCESS
  4395.          0x0008    INVALID_FUNCTION
  4396.          0x000D    BUFFER_TOO_SMALL
  4397. Description:
  4398.  
  4399. If enabled by the Protocol Manager's BINDSTATUS=YES parameter in
  4400. PROTOCOL.INI, this command can be called at any time to obtain
  4401. information from the Protocol Manager about the current set of
  4402. bound modules.  If this command is disabled, an attempt to invoke
  4403. this command will return INVALID_FUNCTION.
  4404.  
  4405. The following characteristics tables are returned for the modules
  4406. which qualify:
  4407.  
  4408. Common Characteristics
  4409.  
  4410. Service-Specific Characteristics (including the Multicast
  4411. Address List for MAC
  4412. modules)
  4413.  
  4414.                           Page 5-58
  4415.  
  4416.  
  4417.  
  4418.  
  4419.  
  4420. Service-Specific Status
  4421.  
  4422. Media-Specific Statistics (for MAC modules only)
  4423.  
  4424. The tables are linked together into a bind tree using a new
  4425. structure:
  4426.  
  4427. struct BindNode {
  4428.         struct cctable far *commonptr;
  4429.         struct BindNode far *down;
  4430.         struct BindNode far *right;
  4431. };
  4432.  
  4433. NOTE: There may be additional fields added to BindNodes in the
  4434. future, so do not rely on its exact size.
  4435.  
  4436. A BindNode is linked to its Common Characteristics Table (CCT) by
  4437. the CommonPtr field.  The CCT's are then linked into a bind tree
  4438. using the Right and Down pointers.  Down points to the first
  4439. BindNode bound below this one, and Right points to the next.  At
  4440. the top of the tree (the uppermost level), the Right pointers
  4441. also link together the BindNodes as if they are bound to a
  4442. virtual root BindNode.
  4443.  
  4444.  
  4445.  
  4446.  
  4447.  
  4448.                           Page 5-59
  4449.  
  4450.  
  4451.  
  4452.  
  4453.  
  4454. A simple example might help illustrate this better:
  4455.  
  4456.          Protocol
  4457.         /    
  4458. MAC1 MAC2
  4459.  
  4460. which would be represented by the following bind tree:
  4461.  
  4462. Protocol
  4463.        |
  4464.       V
  4465. MAC1 -----> MAC2
  4466.  
  4467. where the BindNodes have been hidden to keep the diagram simple--
  4468. only their Down and Right pointers are shown.  The remaining Down
  4469. and Right pointers would be NULL.
  4470.  
  4471. One option when making this call is to pass a NULL buffer pointer
  4472. (in Pointer1), in which case the root BindNode pointer will be
  4473. returned in Pointer1.  The Protocol Manager uses BindNodes
  4474. internally to build the bind tree.  The caller can then run the
  4475. current bind tree to obtain information.  This is the only method
  4476. supported under DOS.  Under OS/2, this method will only work for
  4477. Ring 0 drivers.
  4478.  
  4479. Under OS/2, Ring 3 programs must use a second method by providing
  4480. a pointer to a buffer (in Pointer1) of a specified size (in
  4481. Word1) to copy the characteristics tables into.  In this case,
  4482. the Protocol Manager will copy the qualifying tables into the
  4483. buffer provided.  The first entry in the buffer will be the root
  4484. BindNode.  The order of the remaining BindNodes and tables within
  4485. the buffer is undefined.  The BindNodes and their various tables
  4486. are linked together by pointers which will be fixed up by the
  4487. Protocol Manager to use the same selector as the buffer itself
  4488. (i.e., Ring 3 if the buffer is Ring 3).  Specifically, the
  4489. Protocol Manager will fixup the following entries:
  4490.  
  4491. BindNode:
  4492.         CommonPtr
  4493.         Down
  4494.         Right
  4495. Common Characteristics:
  4496.         Pointer to service-specific characteristics
  4497.         Pointer to service-specific status
  4498. Service-Specific Characteristics
  4499.         Pointer to multicast address list (MAC's only)
  4500. Service-Specific Status
  4501.         Pointer to media-specific statistics (MAC's only)
  4502.  
  4503. The remaining pointers (e.g., dispatch tables and entry points)
  4504. will be in an undefined state and must not be relied upon.
  4505.  
  4506. If the buffer was too small, BUFFER_TOO_SMALL will be returned,
  4507. the pointers to tables which were not copied will be NULL, and
  4508. the bytes copied return parameter (Word1) will indicate where the
  4509. information was truncated.
  4510.  
  4511. The information returned is merely a snapshot at a particular
  4512. point of time.  The Protocol Manager will disable interrupts
  4513.                           Page 5-60
  4514.  
  4515.  
  4516.  
  4517.  
  4518.  
  4519. while copying individual status and media-specific statistics
  4520. tables to guarantee their internal integrity.  The caller cannot
  4521. assume that all tables were copied in the same atomic operation
  4522. however.
  4523.  
  4524. In the case of OS/2, if two or more modules are bound to the same
  4525. lower module, the lower module's table is duplicated in the tree.
  4526. Therefore, the Ring 3 caller will have to provide larger amount
  4527. of buffer space for the returned information.
  4528.  
  4529. The number of nodes in the bind tree does not necessarily reflect
  4530. the number of modules bound.
  4531.  
  4532. RegisterStatus
  4533.  
  4534. Purpose:  A command to query whether a specific logical module is
  4535. currently registered with the Protocol Manager.
  4536.  
  4537. Opcode:   - 0x0A
  4538.  
  4539. Status:   - On return contains request status
  4540.  
  4541. Pointer1  - NULL
  4542.  
  4543. Pointer2  - FAR virtual pointer to a 16-byte ASCIIZ module name
  4544.  
  4545. Word1- NULL
  4546.  
  4547. Returns:  - 0x0000  SUCCESS   
  4548.      0x0008  INVALID_FUNCTION
  4549.      0x002C  ALREADY_REGISTERED
  4550. Description:
  4551.  
  4552. This command can be called in either the static or dynamic mode
  4553. to determine whether a specific logical module is currently
  4554. registered with the Protocol Manager.  This can be used by the
  4555. caller to determine whether a specified module has already
  4556. registered with the Protocol Manager to prevent duplicate
  4557. registration.  A SUCCESS status returned means that the specified
  4558. module is not currently registered with the Protocol Manager.  An
  4559. ALREADY_REGISTERED status means that the module is currently
  4560. registered.
  4561.  
  4562. In the static mode, this request is only valid prior to binding
  4563. and starting.  Invoking this primitive in static mode after all
  4564. modules are bound and started will cause INVALID_FUNCTION to be
  4565. returned by the Protocol Manager.
  4566.  
  4567.  
  4568.  
  4569.  
  4570.  
  4571.                           Page 5-61
  4572.  
  4573.  
  4574.  
  4575.  
  4576.  
  4577. Chapter 6:  Protocol Manager
  4578.  
  4579.  
  4580.  
  4581. Protocol Manager Initialization
  4582. The Protocol Manager is loaded and initialized in both the OS/2
  4583. and DOS environment via the operating system CONFIG.SYS INIT
  4584. sequence.  It must be loaded before any protocol or MAC driver is
  4585. loaded.  In DOS, the Protocol Manager will be provided in a file
  4586. called PROTMAN.DOS.  For OS/2, the file is PROTMAN.OS2.  The
  4587. device name for the Protocol Manager is PROTMAN$ under DOS and
  4588. DEVPROTMAN$ under OS/2 (the \DEV format is required by versions
  4589. 1.2 and later of OS/2).
  4590.  
  4591. In DOS to save memory, an additional dynamically loadable
  4592. component of the Protocol Manager called PROTMAN.EXE is provided.
  4593. This file must reside in the same directory as the static device
  4594. driver component, PROTMAN.DOS, itself.  This file is called for
  4595. execution by the Protocol Manager device driver component
  4596. whenever the Protocol Manager primitives BindAndStart and
  4597. UnbindAndStop are to be executed.  In the static VECTOR mode
  4598. (Chapter 7) PROTMAN.EXE will remain resident after BindAndStart
  4599. executes.
  4600.  
  4601. The Protocol Manager reads the PROTOCOL.INI file at  INIT time
  4602. and parses it to create the configuration memory image passed to
  4603. the protocol modules.  The file is located in the LANMAN
  4604. directory of the boot drive or the directory given by the /I:
  4605. parameter on the DEVICE=PROTMAN.xxx line in CONFIG.SYS.  Under
  4606. DOS, this image is relocated to just below the memory ceiling,
  4607. where it must remain untouched until all binding has completed.
  4608. The Protocol Manager computes a checksum of this image and checks
  4609. it at bind time to guarantee that the image has not been modified
  4610. in the interim.  Note that this memory is not  reserved by the
  4611. Protocol Manager.
  4612.  
  4613. If the Protocol Manager CONFIG.SYS initialization is successful
  4614. it is ready to support the initialization of the other drivers.
  4615. However the initialization can be aborted for either of the
  4616. following reasons:
  4617.  
  4618. 1. The Protocol Manager did not have enough memory to hold the
  4619.    PROTOCOL.INI configuration memory image.
  4620.  
  4621. 2. The Protocol Manager encountered a syntax error while parsing
  4622.    the PROTOCOL.INI file.  This could have been an illegal hex or
  4623.    decimal parameter value, an overflow condition (numeric value
  4624.    could not fit into 32 bits) was encountered or a string was
  4625.    encountered with missing end quotes.
  4626.  
  4627. These conditions are flagged as fatal errors to prevent erroneous
  4628. configuration parameters from propagating to the drivers for
  4629. their operation.
  4630.  
  4631.  
  4632.  
  4633.  
  4634.  
  4635. Static Binding Sequence
  4636. The Protocol Manager can be configured to operate either in the
  4637. static binding mode or in the dynamic binding mode.  In the
  4638. static binding mode, only statically loadable device drivers can
  4639. be loaded and bound once at system initialization time.  In the
  4640. dynamic binding mode, dynamically loadable protocol drivers can
  4641. be loaded and dynamically bound and unbound during system
  4642. operation on a demand basis.  Static drivers can also be loaded
  4643. at INIT time in dynamic mode.  The static binding sequence is
  4644. described in this section.  The dynamic binding sequence is
  4645. described in Chapter 7, "VECTOR and Dynamic Binding."
  4646.  
  4647. To determine the binding sequence, the Protocol Manager builds a
  4648. tree representing the bindings for all the modules in the system.
  4649. MAC drivers are at the bottom, and the highest level (for
  4650. example, NetBIOS) protocol layers at the top.  It then binds
  4651. module pairs together from the bottom up.  To do this, it issues
  4652. an InitiateBind to the upper module in the pair, passing it the
  4653. characteristics table of the lower module.  The upper module is
  4654. expected to issue a Bind to the lower module (if it is
  4655. acceptable) and return.  This continues with the next higher up
  4656. module.  If there is a module which is not bound to anything
  4657. else, it receives an InitiateBind with a NULL characteristics
  4658. table pointer.
  4659.  
  4660. To be more formal, the definitions listed below are required:
  4661.  
  4662. y A MAC driver is a protocol module with an upper layer interface
  4663.   level of  one (MAC layer) and a lower layer interface level of
  4664.   zero (physical).  It must support binding at its upper
  4665.   boundary.
  4666.  
  4667. y A MAC-layer entity is a protocol module with both upper and
  4668.   lower layer interface levels of one.  It must support binding
  4669.   at its lower boundary.
  4670.  
  4671. y A standalone protocol module is one which has a lower layer
  4672.   interface level of zero and which does not support binding at
  4673.   its upper boundary.
  4674.  
  4675. The Protocol Manager builds a tree with multiple branches.  Each
  4676. MAC driver is at the base of a branch, with the protocol layers
  4677. bound to it above it.  Standalone modules are also considered
  4678. branches by themselves.  The left-to-right order is defined by
  4679. the order in which the modules register with the Protocol
  4680. Manager.  The Protocol Manager does a pre-order transversal of
  4681. the tree, issuing InitiateBinds to all of the nodes except the
  4682. MAC drivers.
  4683.  
  4684. An important aspect of the binding scheme is that it allows for
  4685. modules to specify that they only do binding from above or below.
  4686.  
  4687.  
  4688.  
  4689.                             Page 6-2
  4690.  
  4691.  
  4692.  
  4693.  
  4694.  
  4695. This is a requirement in cases where a monolithic module exposes
  4696. several interfaces, such as a NetBIOS, TLI, and DLC.  The TLI
  4697. could be presented as a logical module that had an upper
  4698. interface (the TLI) but no lower interface (since it uses a
  4699. private internal interface to its DLC).  Such a module would have
  4700. a characteristics table with the following settings:
  4701.  
  4702. DWORD  Module function flags, a bit mask (hints only):
  4703.     Bit 0 - set (binds at upper boundary)
  4704.     Bit 1 - clear (doesn't bind at lower boundary)
  4705. BYTE Protocol level at upper boundary of module:
  4706.     4 - Transport
  4707. BYTE Type of interface at upper boundary of module:
  4708.     1 => TLI
  4709. BYTE  Protocol level at lower boundary of module
  4710.     -1 - Not specified
  4711. BYTE Type of interface at lower boundary of module:
  4712.         For any level: 0 => private (ISV defined)
  4713. LPBUF  Pointer to upper dispatch table
  4714. LPBUF  Pointer to lower dispatch table (NULL)
  4715.  
  4716. Sequence for non-VECTOR configurations:
  4717.  
  4718. 1. Protocol Manager driver (PROTMAN.OS2 for OS/2 or PROTMAN.DOS
  4719.    for DOS) is loaded during CONFIG.SYS initialization.  The
  4720.    Protocol Manager must be configured ahead of any MAC or
  4721.    protocol drivers in CONFIG.SYS.
  4722.  
  4723. 2. Protocol Manager initializes and reads PROTOCOL.INI to build
  4724.    the configuration memory image.
  4725.  
  4726. 3. MAC and protocol drivers are loaded by the operating system.
  4727.    During its initialization processing, each driver optionally
  4728.    does the following:
  4729.  
  4730.    a.  Open the PROTMAN$ device
  4731.  
  4732.    b.  Invoke the GetProtocolManagerInfo primitive to PROTMAN$ to
  4733.      get a pointer to the configuration memory image.
  4734.  
  4735.    c.  Read configuration parameters from the image and use these
  4736.      to finish initialization and build characteristics tables.
  4737.  
  4738.    d.  Use the RegisterModule function once for each module to be
  4739.      defined to the Protocol Manager.
  4740.  
  4741. 4. CONFIG.SYS processing ends and applications are started.
  4742.  
  4743. 5. An application opens the PROTMAN$ device and issues the
  4744.    BindAndStart IOCTL.  Such an application utility called
  4745.    NETBIND.EXE is provided with the Protocol Manager driver and
  4746.    is defined in Appendix E.
  4747.  
  4748.  
  4749.  
  4750.  
  4751.  
  4752.                             Page 6-3
  4753.  
  4754.  
  4755.  
  4756.  
  4757.  
  4758. 6. The Protocol Manager uses information passed on previous
  4759.    RegisterModule calls to determine the module binding
  4760.    hierarchy.
  4761.  
  4762. 7. Proceeding from bottom to top of the binding hierarchy, the
  4763.    Protocol Manager uses InitiateBind to cause each module to
  4764.    bind to the module below it in the hierarchy.  Each module
  4765.    getting this call responds by issuing a Bind call to the
  4766.    module specified by the Protocol Manager on InitiateBind.
  4767.  
  4768. 8. When all modules have been bound, the Protocol Manager returns
  4769.    from BindAndStart.
  4770.  
  4771. The system is now fully operational.  Vector configurations are
  4772. similar, with the VECTOR being automatically inserted between
  4773. layers one and two, if necessary (on top of the MAC driver as
  4774. well as any MAC-layer entities which are present).
  4775.  
  4776.  
  4777.  
  4778. OS/2 Calling Convention
  4779. All of the Protocol Manager requests are supported by a single
  4780. OS/2 IOCTL function.  The services are demultiplexed via a
  4781. function code specified in the ReqBlock structure.
  4782.  
  4783. This IOCTL has the following IOCTL request packet parameters:
  4784.  
  4785. 1. Block Device Unit Code:  Undefined since the Protocol Manager
  4786.    is a character device.
  4787.  
  4788. 2. Command Code: 16 for Generic IOCTL.
  4789.  
  4790. 3. Status:  If the IOCTL corresponds to one of the Protocol
  4791.    Manager commands then the status field is returned with the
  4792.    ERR bit cleared signifying IOCTL successful completion.
  4793.    However the final status of the command is returned in the
  4794.    "status" field of the ReqBlock buffer as defined below.  Note
  4795.    that if the command is recognized the ERR bit is always
  4796.    cleared regardless of the status returned in "status".
  4797.    However if the command is not recognized an IOCTL status
  4798.    UNKNOWN_COMMAND (3) is returned with the ERR bit set.  Finally
  4799.    all of the commands return with the status "DON" bit set.
  4800.  
  4801. 4. Category code:  0x81 which is the LAN Manager category code.
  4802.  
  4803. 5. Function code:  0x58 for Protocol Manager command type.
  4804.  
  4805. 6. Parameter buffer:  Pointer to ReqBlock structure.
  4806.  
  4807. 7. Data buffer:  Unused and therefore the pointer is NULL.
  4808.  
  4809. By using the GetProtocolManagerLinkage request a module may
  4810. obtain the Protocol Manager dispatch point and DS.  Once a module
  4811. obtains the Protocol Manager's entry point and data segment it
  4812.  
  4813.  
  4814.  
  4815.                             Page 6-4
  4816.  
  4817.  
  4818.  
  4819.  
  4820.  
  4821. passes the a request to the Protocol Manager via the following
  4822. function call:
  4823.  
  4824.    int (far pascal *ProtManEntry)(ReqBlockPtr, DataSeg);
  4825.    struct ReqBlock far *ReqBlockPtr;
  4826.    unsigned DataSeg;
  4827.  
  4828. where:
  4829.  
  4830. ReqBlockPtr = a FAR pointer to the request block
  4831.  
  4832. DataSeg = the Protocol Manager's data segment base.
  4833.  
  4834. The Protocol Manager returns in AX the same return code that is
  4835. returned in the ReqBlock "status".
  4836.  
  4837.  
  4838.  
  4839. DOS Calling Convention
  4840. All of the Protocol Manager requests are supported by a single
  4841. DOS IOCTL function.  The services are demultiplexed via a
  4842. function code specified in the ReqBlock.  This IOCTL should be
  4843. requested via Interrupt 21 with general registers loaded with the
  4844. following contents:
  4845.  
  4846. AH = 44H for IOCTL request
  4847. AL = 02H for device input
  4848. DS:DX = Pointer to ReqBlock structure
  4849. CX = 14 for the size of the ReqBlock structure
  4850. BX = Handle from DOS Open of "PROTMAN$"
  4851.  
  4852. This IOCTL generates the following IOCTL request packet
  4853. parameters:
  4854.  
  4855. 1. Block Device Unit Code: Undefined since the Protocol Manager
  4856.    is a character device.
  4857.  
  4858. 2. Command Code: 3 for IOCTL input.
  4859.  
  4860. 3. Status: If the IOCTL corresponds to one of the Protocol
  4861.    Manager commands then the status field is returned with the
  4862.    ERR bit cleared signifying IOCTL successful completion.
  4863.    However the final status of the command is returned in the
  4864.    "status" field of the ReqBlock buffer as defined below.  Note
  4865.    that if the command is recognized the ERR bit is always
  4866.    cleared regardless of the status returned in "status".
  4867.    However if the command is not recognized an IOCTL status
  4868.    UNKNOWN_COMMAND (3) is returned with the ERR bit set.  Finally
  4869.    all of the commands return with the status "DON" bit set.
  4870.  
  4871. 4. Media Descriptor Byte: Unused
  4872.  
  4873. 5. Transfer Address: Pointer to ReqBlock structure.
  4874.  
  4875.  
  4876.  
  4877.  
  4878.                             Page 6-5
  4879.  
  4880.  
  4881.  
  4882.  
  4883.  
  4884. 6. Byte/Sector Count: 14
  4885.  
  4886. 7. Starting Sector Number: Unused
  4887.  
  4888. By using the GetProtocolManagerLinkage request a module or
  4889. application may obtain the Protocol Manager dispatch point and
  4890. DS.  It then makes a request to the Protocol Manager via the same
  4891. direct calling mechanism as OS/2.
  4892.  
  4893.  
  4894.  
  4895.  
  4896.  
  4897.                             Page 6-6
  4898.  
  4899.  
  4900.  
  4901.  
  4902.  
  4903. Chapter 7:  VECTOR and Dynamic Binding
  4904.  
  4905.  
  4906. In static mode, the VECTOR is a function that is implemented
  4907. within the Protocol Manager that allows more than one protocol
  4908. stack to drive a single MAC.  In this mode, the Protocol Manager
  4909. uses the VECTOR function only if it detects that more than one
  4910. protocol is using the same MAC.  If more that one MAC is attached
  4911. to multiple protocol stacks, then an instantiation of the VECTOR
  4912. is created for each MAC so attached.
  4913.  
  4914. In dynamic mode, the VECTOR function is always present
  4915. unconditionally for protocol/MAC intermodule communications.
  4916. There can be zero, one, or more protocol stacks that bind to a
  4917. MAC, but the VECTOR function is still present.  There can be zero
  4918. protocols if there is only one dynamic protocol stack being used
  4919. in the system and that stack is not currently loaded.  In the
  4920. dynamic mode, the VECTOR shields all static binding MACs from the
  4921. interactions of dynamic binding and unbinding protocol modules.
  4922.  
  4923.  
  4924. Static VECTOR Binding
  4925. The Protocol Manager will modify the normal binding process if it
  4926. detects that multiple protocols have requested the use of the
  4927. same MAC in the PROTOCOL.INI file.
  4928.  
  4929. 1. At INIT time from RegisterModule the Protocol Manager has
  4930.    determined the bind hierarchy and has found some MACs that
  4931.    bind to 2 or more protocols, signaling the insertion of
  4932.    VECTOR.
  4933.  
  4934. 2. To a MAC that will support multiple protocol stacks, the
  4935.    Protocol Manager issues Bind passing a Protocol Manager
  4936.    characteristics table with entry points into the VECTOR
  4937.    module.  The MAC starts itself and returns, passing back to
  4938.    the Protocol Manager a pointer to the MACs characteristic
  4939.    table.
  4940.  
  4941. 3. For a protocol that is part of a multiple protocol stack
  4942.    binding to the single MAC that was issued the previous Bind
  4943.    command, the Protocol Manager issues InitiateBind passing as
  4944.    the bind inter-module entry point, an entry point within the
  4945.    VECTOR module inside of the Protocol Manager.
  4946.  
  4947. 4. The protocol module responds by issuing a Bind request back to
  4948.    the Protocol Manager through its VECTOR entry point.  The
  4949.    protocol module passes its characteristics table to the
  4950.    Protocol Manager VECTOR.  The Protocol Manager returns a
  4951.    characteristics table within the VECTOR which is copied from
  4952.    the associated MAC's characteristics tables, substituting the
  4953.    VECTOR entry points for the real MAC's entry points.
  4954.  
  4955. 5. The protocol starts itself and returns from InitiateBind.
  4956.  
  4957.  
  4958.  
  4959.  
  4960.  
  4961. 6. The Protocol Manager then issues subsequent InitiateBind's to
  4962.    other protocol modules as described above.  If these other
  4963.    protocols are bound to a MAC through the VECTOR, the VECTOR
  4964.    procedure is repeated.  Otherwise the non-VECTOR procedure is
  4965.    used.
  4966.  
  4967. At the conclusion of the binding process the VECTOR is in a
  4968. position to filter calls as appropriate going in either direction
  4969. across the MAC/protocol interface.
  4970.  
  4971.  
  4972. Dynamic VECTOR Binding
  4973. A dynamic protocol module can be loaded and bound after system
  4974. initialization time on a demand basis.  This dynamic loading and
  4975. binding takes place in three phases:
  4976.  
  4977. 1. The PROTOCOL.INI file is re-read.
  4978.  
  4979. 2. The dynamic protocol module does some prebind initialization
  4980.    including getting its PROTOCOL.INI configuration parameters
  4981.    and registering with the Protocol Manager.
  4982.  
  4983. 3. The dynamically loaded protocol module dynamically binds to
  4984.    other modules given in its bind specification.  If these other
  4985.    modules are MAC's, the bind takes place through the Protocol
  4986.    Manager VECTOR facility.
  4987.  
  4988. At some point the dynamic protocol module is no longer required.
  4989. The protocol module unbinds itself, terminates, and unloads
  4990. itself from memory.
  4991.  
  4992. The mechanisms for dynamically binding and unbinding are carried
  4993. out somewhat differently between DOS and OS/2.  The procedures
  4994. are briefly described below.
  4995.  
  4996. Dynamic Binding/Unbinding in the DOS Environment
  4997. 1. In dynamic mode, both static and dynamic protocol modules can
  4998.    be supported.  At startup time, the Protocol Manager performs
  4999.    initialization and binding of static modules as described in
  5000.    section "Static Binding Sequence."  However, in the dynamic
  5001.    mode, the VECTOR function is always inserted.
  5002.  
  5003. 2. At some point after system startup, a dynamic loadable
  5004.    protocol module (that can be a transient application program
  5005.    or a TSR) is demand loaded.  For the dynamic protocol module
  5006.    to have its configuration parameters at initialization, the
  5007.    PROTOCOL.INI file must be re-read.  Either an application
  5008.    program or the protocol module itself reads and parses the
  5009.    PROTOCOL.INI file into the configuration memory image.  It is
  5010.    suggested that the application or protocol module obtain the
  5011.    location of the PROTOCOL.INI file using the "GetProtocolIni"
  5012.    primitive.  A pointer to this memory image is passed to the
  5013.    Protocol Manager via the "RegisterProtocolManagerInfo"
  5014.  
  5015.  
  5016.  
  5017.                             Page 7-2
  5018.  
  5019.  
  5020.  
  5021.  
  5022.  
  5023.    primitive.  This is required since the configuration memory
  5024.    image created by the Protocol Manager at INIT time is not
  5025.    valid at  post INIT time.  An application utility,
  5026.    READPRO.EXE, that reads and parses PROTOCOL.INI is provided
  5027.    with the Protocol Manager and is described in Appendix E.
  5028.  
  5029. 3. After loading, the protocol module initializes.  Minimally,
  5030.    the protocol gets its PROTOCOL.INI configuration information
  5031.    from the Protocol Manager via "GetProtocolManager Info," does
  5032.    its prebind initialization, and registers with the Protocol
  5033.    Manager via "RegisterModule."
  5034.  
  5035. 4. Either an application or the dynamic protocol module itself
  5036.    requests that the Protocol Manager initiate the binding
  5037.    sequence via the "BindAndStart" primitive.  This causes the
  5038.    bind sequence described in steps 3 to 5 of the section "Static
  5039.    VECTOR Binding" to be executed.  After the bind, the dynamic
  5040.    protocol is ready for use.  An application utility,
  5041.    NETBIND.EXE, to initiate the binding sequence is provided with
  5042.    the Protocol Manager and is described in Appendix E.
  5043.  
  5044. 5. During operation, all protocol commands to the MAC go through
  5045.    the VECTOR
  5046.  
  5047. 6. When the dynamic protocol module is ready to terminate, either
  5048.    it or an application program issues the "UnbindAndStop"
  5049.    command to the Protocol Manager.  This causes the Protocol
  5050.    Manager to call the protocol's "InitiateUnbind" system entry
  5051.    point.  In turn,  this allows the protocol to issue "Unbinds"
  5052.    to other modules it was bound to and to do final cleanup
  5053.    before terminating.  On return from the "UnbindAndStop"
  5054.    command, the protocol can be removed from memory.  An
  5055.    application utility, UNBIND.EXE, to initiate the unbinding
  5056.    sequence is provided with the Protocol Manager and is
  5057.    described in Appendix E.
  5058.  
  5059. Dynamic Binding/Unbinding in the OS/2 Environment
  5060. 1. In OS/2, all dynamic protocol modules are multi-segment OS/2
  5061.    device drivers.  A dynamic OS/2 protocol differs from a static
  5062.    one in that the dynamic module has code and/or data segments
  5063.    that may be swapped out of virtual memory when not needed.
  5064.    These extra code and data segments must be specified with IOPL
  5065.    in the module's .DEF file so that they are marked as
  5066.    movable/swappable and not discardable by OS/2.  In a static
  5067.    protocol module all segments are permanently locked in memory.
  5068.    A dynamic protocol module uses the OS/2 DevHlp Lock and Unlock
  5069.    calls (using a lock type of 1) to lock and free its code
  5070.    and/or data segments as needed.  A dynamic protocol module is
  5071.    able to re-register multiple times with the Protocol Manager
  5072.    and to dynamically bind with other configured modules.  When
  5073.    no longer required, the dynamic module can unbind and the
  5074.    dynamic memory segments can be Unlock'ed to free up the
  5075.    memory.  Static OS/2 protocol modules register and bind only
  5076.    at system initialization time.  They do not unbind.
  5077.  
  5078.  
  5079.  
  5080.                             Page 7-3
  5081.  
  5082.  
  5083.  
  5084.  
  5085.  
  5086. 2. Since all OS/2 dynamic protocol modules are OS/2 device
  5087.    drivers they may perform some INIT time initialization.  The
  5088.    protocol must always register at INIT time with the Protocol
  5089.    Manager via "RegisterModule".  A protocol that is not required
  5090.    at system startup must still register with the Protocol
  5091.    Manager at INIT time passing a NULL BindingsList pointer in
  5092.    the "RegisterModule" primitive.  This is called a non-bindable
  5093.    registration.  In this case the protocol need not lock down
  5094.    its extra code and data segments.  It does, however, need to
  5095.    save the selector values for its dynamic code and data
  5096.    segments.  The device driver's device header, strategy
  5097.    routine, and the NDIS system entry routine must reside in the
  5098.    driver's main code and data segments (the first ones in the
  5099.    driver) which are permanently locked down.  A driver required
  5100.    at system startup must pass a non-NULL BindingsList pointer if
  5101.    it has modules it is required to bind to (a bindable
  5102.    registration).  A driver required at system startup must go
  5103.    ahead and DevHlp Lock its other segments at INIT time, making
  5104.    sure to save the lock handle returned by the call.  Also at
  5105.    INIT time, the protocol module must invoke the
  5106.    "GetProtocolManagerLinkage" primitive to get and save the
  5107.    Protocol Manager's Ring 0 direct entry point and DS.
  5108.  
  5109. 3. Assuming that the protocol was not required at system startup
  5110.    time, at some point in time later it needs to be dynamically
  5111.    bound.  At this point the module needs to get its PROTOCOL.INI
  5112.    configuration parameters, lock down its code and data
  5113.    segments, and perform its bindings.  If the configuration
  5114.    parameters are not retained in the base data segment, the
  5115.    protocol must re-read the PROTOCOL.INI file.  This is done in
  5116.    a similar fashion to that described for DOS.  The
  5117.    "InitAndRegister" primitive is the standard facility that lets
  5118.    the Protocol Manager request the protocol to reload its
  5119.    dynamic segments and perform its prebind initialization.  Upon
  5120.    receiving the "InitAndRegister" primitive, the Protocol
  5121.    Manager calls the protocol driver's system entry point with
  5122.    "InitiatePrebind", allowing the protocol to perform its
  5123.    prebind initialization.  The protocol module uses this
  5124.    opportunity to issue DevHlp Lock calls (lock type 1) on it's
  5125.    dynamic segments to bring them back into memory.  The handle
  5126.    returned from the Lock call must be saved for later unlocking.
  5127.    Also at this juncture, the protocol can get its PROTOCOL.INI
  5128.    memory image from the Protocol Manager via the direct entry
  5129.    point "GetProtocolManagerInfo" function.  It may also do other
  5130.    prebind initialization and finally register with the Protocol
  5131.    Manager via the direct entry point "RegisterModule" function.
  5132.    If the protocol module had previously  made a non-bindable
  5133.    registration at system startup, then the current registration
  5134.    affords it the opportunity to specify its bindings to the
  5135.    Protocol Manager.
  5136.  
  5137.  
  5138.  
  5139.  
  5140.  
  5141.                             Page 7-4
  5142.  
  5143.  
  5144.  
  5145.  
  5146.  
  5147. 4. The bind and postbind initialization step is similar to that
  5148.    described for DOS.  Again, any protocol binds to MAC's are
  5149.    performed through the VECTOR.
  5150.  
  5151. 5. During protocol operation, any protocol commands to a MAC go
  5152.    through the VECTOR.
  5153.  
  5154. 6. When the protocol is no longer required, an application or the
  5155.    protocol itself can issue the "UnbindAndStop" command to the
  5156.    Protocol Manager.  The sequence is similar to that described
  5157.    for DOS.  The OS/2 driver, however, issues DevHlp Unlock
  5158.    commands against all of its dynamic segments so that these may
  5159.    be swapped out from memory.  The previously saved Lock handle
  5160.    is required on this call.
  5161.  
  5162.  
  5163. VECTOR Demultiplexing
  5164. The Vector dispatches incoming frames to protocol stacks using
  5165. either a preprogrammed default or user statically defined
  5166. priority polling mechanism.  The default mechanism is based on
  5167. the "Interface Flags" variable in the protocol's lower dispatch
  5168. table.  These flags describe the protocol according to the kinds
  5169. of frames it handles.  Protocols that handle:
  5170.  
  5171. o    Non-LLC frames
  5172. o    LLC frames with specific LSAPs
  5173. o    LLC frames with non-specific LSAPs
  5174.  
  5175. According to default dispatch priority, VECTOR polls protocols in
  5176. that order (and within that order, in the order they registered)
  5177. until it finds one that does not return FRAME_NOT_RECOGNIZED or
  5178. FORWARD_FRAME in the indication.  For specific protocols, this
  5179. default may be overridden by specifying the bracketed name of the
  5180. protocol with the Protocol Manager PROTOCOL.INI keyword PRIORITY.
  5181. Protocols with static priorities specified in this manner are
  5182. polled by the VECTOR before any protocol not  so specified.
  5183. Protocols with static priorities are themselves polled in the
  5184. order in which their bracketed names appear in the PRIORITY
  5185. keyword parameter list.  Of course, a protocol appearing in the
  5186. static list is only polled if it is registered with the Protocol
  5187. Manager and has bound to the MAC offering up the frame.
  5188.  
  5189.  
  5190.  
  5191.  
  5192.  
  5193.                             Page 7-5
  5194.  
  5195.  
  5196.  
  5197.  
  5198.  
  5199. Appendix A:  System Return Codes
  5200. This appendix lists return codes used in this version of the NDIS
  5201. specification.  Note that new error codes may be added in the
  5202. future.  Both protocol and MAC driver developers must design
  5203. their code to allow for this.
  5204.  
  5205. 0x0000 SUCCESS:  The function completed successfully.
  5206.  
  5207. 0x0001 WAIT_FOR_RELEASE:  The ReceiveChain completed successfully
  5208. but the protocol has retained control of the data buffer.
  5209. ReceiveRelease will be called to release the data buffers.
  5210.  
  5211. 0x0002 REQUEST_QUEUED:  The current request has been queued.  If
  5212. the request handle is non-zero the module will call
  5213. TransmitConfirm or RequestConfirm when the request completes.
  5214.  
  5215. 0x0003 FRAME_NOT_RECOGNIZED:  Returned from the protocol when a
  5216. MAC does an Indication and the frame does not make sense to the
  5217. protocol.  This will be interpreted by the VECTOR to mean that
  5218. the next protocol in line ought to be called with the Indication.
  5219.  
  5220. 0x0004 FRAME_REJECTED:  A received frame was recognized but it
  5221. was discarded. The buffer may be immediately re-used.
  5222.  
  5223. 0x0005 FORWARD_FRAME:  A protocol wishes the received frame to be
  5224. offered to other protocols but wishes to receive an
  5225. IndicationComplete.  This will be interpreted by the VECTOR to
  5226. mean that the next protocol in line ought to be called with the
  5227. Indication.
  5228.  
  5229. 0x0006 OUT_OF_RESOURCE:  The module is in a transient out of
  5230. resource condition.  The current request was not completed.
  5231.  
  5232. 0x0007 INVALID_PARAMETER:  One or more parameters was invalid.
  5233.  
  5234. 0x0008 INVALID_FUNCTION:  A command function was requested when
  5235. it was not legal to do so or a invalid request was made.
  5236.  
  5237. 0x0009 NOT_SUPPORTED:  A valid request which is not supported by
  5238. the Module was issued.
  5239.  
  5240. 0x000A HARDWARE_ERROR:  A hardware error occurred during the
  5241. execution of this request.  The request was not completed
  5242. successfully.
  5243.  
  5244. 0x000B TRANSMIT_ERROR:  The packet was not transmitted.  May
  5245. indicate a local resource problem, excessive collisions, or a
  5246. remote resource problem.  On Token Ring networks, this would be
  5247. returned if the destination address was recognized but the
  5248. receiver was out of buffers.  This is a non-fatal error and can
  5249. be taken as a hint that the packet should be retransmitted.
  5250.  
  5251.  
  5252.  
  5253.  
  5254.  
  5255. 0x000C NO_SUCH_DESTINATION:  The destination address was not
  5256. recognized by any adapter on the local ring.  This error is Token
  5257. Ring specific and can be interpreted to mean that source routing
  5258. must be invoked to reach the destination.
  5259.  
  5260. 0x000D BUFFER_TOO_SMALL: The buffer provided was too small for
  5261. the information being returned.  Some commands may still return
  5262. partial information.
  5263.  
  5264. 0x0020 ALREADY_STARTED:  The Protocol Manager has already started
  5265. the network drivers.  This error occurs when BindAndStart is
  5266. called more than once.
  5267.  
  5268. 0x0021 INCOMPLETE_BINDING:  This bind-time error occurs when the
  5269. Protocol cannot complete all of the bindings described in the
  5270. bindings list, most probably due to missing modules.
  5271.  
  5272. 0x0022 DRIVER_NOT_INITIALIZED:  This bind-time error occurs when
  5273. the MAC does not initialize properly during system boot, and a
  5274. subsequent request is made to the MAC.
  5275.  
  5276. 0x0023 HARDWARE_NOT_FOUND:  This bind-time error occurs when the
  5277. network adapter is not found by the MAC.
  5278.  
  5279. 0x0024 HARDWARE_FAILURE:  This bind-time error occurs in the
  5280. following cases: network adapter reset failed, network adapter
  5281. diagnostics failed, network adapter is not responding, network
  5282. adapter is not found by the MAC.
  5283.  
  5284. 0x0025 CONFIGURATION_FAILURE:  This bind-time error occurs when
  5285. the configuration is unacceptable to the network adapter.
  5286.  
  5287. 0x0026 INTERRUPT_CONFLICT:  This bind-time error occurs in OS/2
  5288. only, when an interrupt from some other device in the computer
  5289. conflicts with the network adapter's.
  5290.  
  5291. 0x0027 INCOMPATIBLE_MAC:  This bind-time error occurs when a
  5292. Protocol determines a MAC is not compatible for the binding
  5293. operation.  Thus, binding cannot proceed.
  5294.  
  5295. 0x0028 INITIALIZATION_FAILED:  This bind-time error occurs when a
  5296. Protocol fails its initialization.
  5297.  
  5298. 0x0029 NO_BINDING:  This bind-time error occurs to indicate that
  5299. the binding was not performed.  This error can occur if a
  5300. protocol driver took an error exit during its initialization or
  5301. if a protocol driver has its upper level incorrectly specified as
  5302. a MAC.
  5303.  
  5304. 0x002A NETWORK_MAY_NOT_BE_CONNECTED:  This bind-time error
  5305. indicates that the adapter may not be connected to a network.
  5306. Intended to be suggestive of corrective action by the user.
  5307.  
  5308.  
  5309.  
  5310.  
  5311.  
  5312.                             Page A-2
  5313.  
  5314.  
  5315.  
  5316.  
  5317.  
  5318. 0x002B INCOMPATIBLE_OS_VERSION:  This bind-time error indicates
  5319. that a protocol or MAC driver does not support the version of DOS
  5320. or OS/2 being used.
  5321.  
  5322. 0x002C ALREADY_REGISTERED:  This error is returned by the
  5323. Protocol Manager if an attempt is made to register a module with
  5324. a module name already registered with the Protocol Manager.  It
  5325. is also returned from a "RegisterStatus" primitive to indicate
  5326. that the name is already registered.
  5327.  
  5328. 0x002D PATH_NOT_FOUND:  This error is returned by the DOS
  5329. Protocol Manager if PROTMAN.EXE could not be found when
  5330. attempting to execute a BindAndStart or UnBindAndStop command.
  5331.  
  5332. 0x002E  INSUFFICIENT_MEMORY:  This error is returned by the DOS
  5333. Protocol Manager if PROTMAN.EXE could not be loaded due to
  5334. insufficient DOS memory when attempting to execute a BindAndStart
  5335. or UnbindAndStop command.
  5336.  
  5337. 0x002F INFO_N0T_FOUND:  This error is returned by the DOS
  5338. Protocol Manager in a GetProtocolManagerInfo command if the
  5339. PROTOCOL.INI structured configuration memory image is not present
  5340. or previously invalidated due to being overwritten or corrupted.
  5341.  
  5342. 0x00FF GENERAL_FAILURE:  Unspecified failure during execution of
  5343. the function
  5344.  
  5345. 0xF000 - 0xFFFF:  Reserved for vendor defined error returns.
  5346. These errors are treated as GENERAL_FAILURE.
  5347.  
  5348.  
  5349.  
  5350.  
  5351.  
  5352.                             Page A-3
  5353.  
  5354.  
  5355.  
  5356.  
  5357.  
  5358. Appendix B:  Reference Material
  5359. OS/2 Device Drivers Guide
  5360.  
  5361. DOS Technical Reference
  5362.  
  5363. ANSI/IEEE standard 802.2 - 1985 (ISO/DIS 8802/2) Logical link
  5364. control standard.
  5365.  
  5366. ANSI/IEEE standard 802.5 - 1985 (ISO/DIS 8802/5) Token ring local
  5367. area network standard.
  5368.  
  5369. ANSI/IEEE standard 802.3 - 1985 (ISO/DIS 8802/3) Carrier Sense
  5370. Multiple Access with Collision Detection local area network
  5371. standard.
  5372.  
  5373. The Ethernet. A Local Area Network. Data Link Layer and Physical
  5374. Layer Specifications, V2.0, November 1982.  Also known as the
  5375. "Ethernet Blue Book"
  5376.  
  5377. IBM Token Ring Network PC Adapter Technical Reference (69X7830)
  5378.  
  5379. IBM Token Ring Network Architecture Reference - November 1985
  5380. (6165877)
  5381.  
  5382. Information processing systems - Open Systems Interconnection -
  5383. Basic Reference Model, (ISO 7498) The OSI reference model.
  5384.  
  5385.  
  5386.  
  5387.  
  5388.  
  5389. Appendix C:  802.3 Media Specific Statistics
  5390. The 802.3 media specific statistics structure is defined as
  5391. follows:
  5392.  
  5393. WORD       Length of 802.3 Statistics structure, including this
  5394.             field
  5395. WORD       802.3 Statistics structure version level (1)
  5396. DWORD      Frames with alignment error
  5397. DWORD      Receive error failure mask
  5398. DWORD      Frames with overrun error
  5399. DWORD      Frames transmitted after at least 1 collision
  5400. DWORD      Frames transmitted after deferring
  5401. DWORD      Frames not transmitted - max (16) collisions
  5402. DWORD      Total collision during transmission attempts
  5403. DWORD      Late (out of window) collisions
  5404. DWORD      Frames transmitted after exactly 1 collision
  5405. DWORD      Frames transmitted after multiple collisions
  5406. DWORD      Frames transmitted, CD heartbeat
  5407. DWORD      Jabber errors
  5408. DWORD      Carrier sense lost during transmission
  5409. DWORD      Transmit error failure mask
  5410. DWORD      Number of underruns (V2.0.1 and later)
  5411.  
  5412. The 802.3 failure masks are defined as follows:
  5413.  
  5414. Receive error failure mask:
  5415.   Bit 0 = CRC error
  5416.   Bit 1 = Framing error
  5417.   Bit 2 = Frame size exceeds maximum
  5418.   Bit 3-31 reserved, must be zero
  5419.  
  5420. Transmit error failure mask:
  5421.   Bit 0 = Excessive collisions error
  5422.   Bit 1 = Carrier check failed error (SQE test failed, CD
  5423. heartbeat)
  5424.   Bit 2 = Short circuit error
  5425.   Bit 3 = Open circuit error
  5426.   Bit 4 = Frame too long error
  5427.   Bit 5 = Remote failure to defer error (out of window collision)
  5428.   Bit 6-31 reserved, must be zero
  5429.  
  5430. On initialization the failure masks are 0. A bit is set the first
  5431. time the corresponding error occurs.
  5432.  
  5433. When updating the statistics counters, a frame is counted in all
  5434. the supported counters that apply.
  5435.  
  5436. Examples:
  5437.  
  5438. (a)  A 'Receive frame with a CRC error' is counted in all the the
  5439.    following statistics counters :
  5440.  
  5441.    y  Total Frames received,
  5442.  
  5443.  
  5444.  
  5445.  
  5446.  
  5447.    y  Frames with CRC errors, and
  5448.  
  5449.    y  Frames with error counters.
  5450.  
  5451. (b)  A 'Transmit frame with one collision' is counted in all the
  5452.    following statistics counters :
  5453.  
  5454.    y  Total Frames transmitted,
  5455.  
  5456.    y  Frames transmitted with one or more collision, and
  5457.  
  5458.    y  Frames transmitted with only one collision.
  5459.  
  5460.  
  5461.  
  5462.  
  5463.  
  5464.                             Page C-2
  5465.  
  5466.  
  5467.  
  5468.  
  5469.  
  5470. Appendix D:  802.5 Media Specific Statistics
  5471. The 802.5 media specific statistics structure is defined as
  5472. follows:
  5473.  
  5474. WORD       Length of 802.5 Statistics structure, including this
  5475.         field
  5476. WORD       802.5 Statistics structure version level (1)
  5477. DWORD      FCS or code violations detected in repeated frame
  5478. DWORD      Receive error failure mask
  5479. DWORD      Number of 5 half-bit time transition absences detected
  5480. DWORD      A/C errors
  5481. DWORD      Frames transmitted with abort delimiter
  5482. DWORD      Frames transmitted that failed to return
  5483. DWORD      Frames recognized, no buffer available
  5484. DWORD      Frame copied errors
  5485. DWORD      Number of frequency errors detected
  5486. DWORD      Number of times active monitor regenerated
  5487. DWORD      Reserved
  5488. DWORD      Reserved
  5489. DWORD      Reserved
  5490. DWORD      Transmit error failure mask
  5491. DWORD      Number of underruns
  5492.  
  5493. The 802.5 failure masks are defined as follows:
  5494.  
  5495. Receive error failure mask:
  5496.         Bit 0: Receiver congestion
  5497.         Bit 1: Frame copied error
  5498.         Bit 2-31: Reserved, must be zero
  5499. Transmit error failure mask:
  5500.         Bit 0: Transmit underrun error
  5501.         Bit 1: Line error
  5502.         Bit 2: Abort delimiter transmitted
  5503.         Bit 3: Lost frame error
  5504.         Bit 4: Token error
  5505.         Bit 5-31: Reserved, must be zero
  5506.  
  5507. On initialization the failure masks are 0.  A bit is set the
  5508. first time the corresponding error occurs.
  5509.  
  5510. When updating the statistics counters, a frame is counted in all
  5511. the supported counters that apply.
  5512.  
  5513.  
  5514.  
  5515.  
  5516.  
  5517. Appendix E:  Utilities Provided with the Protocol Manager
  5518. To save system integrators the effort to read and parse the
  5519. PROTOCOL.INI file, to register it with the Protocol Manager, to
  5520. invoke the binding and unbinding Protocol Manager primitives, and
  5521. to report various Protocol Manager error conditions, 3 utilities
  5522. are provided with the Protocol Manager in both the DOS and OS/2
  5523. environments and one utility is provided exclusively for the OS/2
  5524. environment:
  5525.  
  5526. 1.  NETBIND.EXE - Initiates the binding and operational
  5527.           startup of a set of modules previously loaded.
  5528.           It issues to the Protocol Manager the
  5529.           BindAndStart primitive and reports to the console
  5530.           any binding/initialization errors detected by the
  5531.           modules bound.  This utility can be used in
  5532.           either the static or dynamic Protocol Manager
  5533.           modes of operation.  In the static mode it should
  5534.           be invoked after all device driver modules are
  5535.           loaded (e.g. from AUTOEXEC.BAT in DOS or
  5536.           STARTUP.CMD in OS/2).  In the dynamic mode it can
  5537.           be invoked either at system startup time as in
  5538.           static mode or after a set of dynamically
  5539.           loadable modules have been loaded and are ready
  5540.           to be run.  There are no command line parameters
  5541.           associated with this utility.
  5542.  
  5543. 2. UNBIND.EXE -    Initiates the unbinding and termination
  5544.           sequence of a set of dynamically loadable modules
  5545.           previously loaded and bound.  It issues to the
  5546.           Protocol Manager the UnbindAndStop primitive and
  5547.           reports to the console any unbinding/termination
  5548.           errors detected by the modules being unbound.
  5549.           The utility can be used only in the dynamic
  5550.           Protocol Manager mode of operation.  Invocation
  5551.           in the static mode will generate an error.  It
  5552.           should be invoked when it is desired to terminate
  5553.           (and release from memory) a set of dynamically
  5554.           loadable modules that have been previously loaded
  5555.           and bound.  In DOS each invocation will terminate
  5556.           and unbind the last set of modules previously
  5557.           bound via the NETBIND.EXE utility.  Modules can
  5558.           be bound and unbound in groups if required by
  5559.           invoking NETBIND.EXE for each group of modules to
  5560.           be bound together and later invoking UNBIND.EXE.
  5561.           UNBIND.EXE  will unbind the groups only in the
  5562.           reverse order in which the groups were
  5563.           previsoulsy bound.  If protocols are implemented
  5564.           so that they free themsleves from memory at the
  5565.           end of the unbind sequence, then this utility
  5566.           will free up the memory of all such protocols
  5567.           unbound.  This utility has no effect on MAC
  5568.           drivers which are always static device drivers.
  5569.           In OS/2 the utility takes an argument string
  5570.           specifying the name of the module being unbound.
  5571.  
  5572.  
  5573.  
  5574.  
  5575.  
  5576.           In DOS there are no command line parameters
  5577.           associated with this utility.
  5578.  
  5579. 3.  READPRO.EXE -Reads the PROTOCOL.INI file, parses it into
  5580.           a memory image and registers this memory image
  5581.           with the Protocol Manager so that the image is
  5582.           available to dynamically loadable protocols when
  5583.           they request their configuration memory image
  5584.           information.  By invoking the GetProtocolIniPath
  5585.           Protocol Manager primitive, this
  5586. utility assures that the PROTOCOL.INI file is read from the
  5587.           same subdirectory as that used by the Protocol
  5588.           Manager when it had initialized.  The memory
  5589.           image is registered with the Protocol Manager via
  5590.           the RegisterProtocolManagerInfo primitive.  This
  5591.           utility can be used only in the Protocol Manager
  5592.           dynamic mode of operation.  The utility reports
  5593.           any detected error condtions on the console.  It
  5594.           should be invoked prior to the loading of any
  5595.           dynamic modules.  There are no command line
  5596.           parameters associated with this utility.
  5597.  
  5598. 4.  RELOAD.EXE.-   Initiates the prebind initialization of
  5599.           an OS/2 dynamically loadable module.  It issues
  5600.           to the Protocol Manager the InitAndRegister
  5601.           primitive containing the module name that was
  5602.           given as a command line parameter.  The Protocol
  5603.           Manager calls the system entry point of the named
  5604.           module with the InitiatePrebind system function.
  5605.           The modules is required to reinitialize, which
  5606.           may include locking down swappable segments,
  5607.           requesting and parsing the PROTOCOL.INI image,
  5608.           and reregistering with the Protocol Manager in
  5609.           preparation for a subsequent NETBIND.EXE
  5610.           invocation.  This utility reports any detected
  5611.           error to the console.  It applies only to OS/2.
  5612.  
  5613. If the system integrator requires more functionality than that
  5614. provided by these utilities, the integrator can write an
  5615. application utility directly that performs the desired
  5616. functionality and invokes the required Protocol Manager
  5617. primitives described in Chapter 5.  For example if in DOS a more
  5618. flexible unbind facility to unbind in a user specified order is
  5619. required, UNBIND.EXE can be replaced by a user written utility
  5620. that invokes the UnbindAndStop primitive in which Pointer2 points
  5621. to the name of the module to be unbound.
  5622.  
  5623.  
  5624.