Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Networking /
Chapter 11 - Ethernet, Token Ring, and Fiber Distributed Data Interface / Using Ethernet, Token Ring, and FDDI Drivers


Using the Token Ring Driver

You can write an application implementing a protocol other than AppleTalk that reads data from and writes it to the token ring driver defined by Apple.

To write data to the token ring driver and to perform other functions such as adding a functional address for the token ring hardware, you use the Ethernet functions described earlier, with the modifications noted later in this section. To read 802.2 packets from the token ring driver, you need to attach your protocol handler to the LAP Manager.

The Apple token ring driver implementation supports only the IEEE 802.2 Type 1 protocol and allows for the attachment of only one protocol handler that reads
802.2 packets that contain an SAP value of $AA.

Although it is possible to attach your own protocol handler at the hardware device driver level, Apple recommends that you not do this because it excludes AppleTalk from using the token ring driver. So that more than one protocol can receive packets from the token ring driver concurrently, Apple recommends that you attach your protocol handler to the LAP Manager. The LAP Manager attaches its own protocol handler to the token ring driver, and when it receives a packet for your protocol, the LAP Manager calls your protocol handler. When it receives a packet for another protocol, such as AppleTalk, the LAP Manager calls that application's protocol handler.

For a description of how to attach and detach your protocol handler for token ring, see the chapter "Link-Access Protocol (LAP) Manager" included in this book and the discussion of token ring and FDDI in "About Ethernet, Token Ring, and FDDI Support" beginning on page 11-3 in this chapter. The chapter "Link-Access Protocol (LAP) Manager" also gives more information on the SAP field value for 802.2 Type 1 packets.

Applying Ethernet Functions

The Apple token ring driver implements many but not all of the functions that the Apple Ethernet driver implements.

For those Ethernet functions that do apply to token ring, you use the function for token ring in the same way that you do for Ethernet: you pass parameters in a parameter block and you use the Ethernet control code in the csCode field to call the function. The only difference is that instead of specifying the Ethernet driver reference number in the parameter block's ioRefNum field, you specify the token ring driver reference number. Here are the Ethernet functions that apply to token ring:

Here are the Ethernet functions that do not apply to token ring:

There are some other differences between Ethernet and token ring:

Note
Although you can use the EAttachPH function to attach a protocol handler to the token ring driver and the EDetachPH function to
remove one, Apple recommends that you not use these functions. Instead, you should use the LAP Manager's L802Attach and L802Detach routines.

Sending and Receiving Data

The tasks involved in sending data to and receiving it from a token ring driver are similar to those that you use for Ethernet. The primary difference is that you use the LAP Manager to attach your protocol handler. Any vendor implementing a token ring driver to run on a Macintosh computer must follow rules that direct them to return packet information in the same manner as does the Ethernet driver for 802.2 packets. From the perspective of an application that uses the token ring driver, this means that when the LAP Manager calls your protocol handler, you can expect the token ring hardware addresses that you reference from register A3 to follow the same format that is used for Ethernet addresses, regardless of how the token ring address might appear at the hardware level.

Here are the steps that you follow to send data to and receive it from a token ring driver:

  1. Locate the token ring cards that are installed in the system. Use the Slot Manager to identify installed token ring cards. Use the SGetTypeSRsrc function described in the Slot Manager chapter of Inside Macintosh: Devices to determine which NuBus slots contain token ring cards. To find token ring cards, use the value catNetwork (0x4) in the spCategory field and the value typeTokenRing (0x2) in the spCType field. You should provide a user interface that allows the user to select a specific token ring card in the case that more than one is present.
  2. Use the OpenSlot function to open the token ring driver. Set the ioNamePtr field to .TOKN. If you did not locate any NuBus token ring cards in step 1, you should also attempt to open the .TOKN0 driver in case non-NuBus token ring hardware is attached to the system. Use the Device Manager's OpenDriver function to open the .TOKN0 driver. (For information on the OpenSlot and OpenDriver functions, see the chapter "Device Manager" in Inside Macintosh: Devices.)

    Note that this section refers to the .TOKN driver shell, which facilitates multi-
    vendor support, as the .TOKN driver. Opening the .TOKN driver shell, which
    loads and opens the card's driver, is effectively the same as directly opening the
    token ring driver.

  3. If your application requires a functional address, use the EAddMulti function to register one. Functional addresses are the token ring equivalent of Ethernet and FDDI multicast addresses. (For information on functional addresses, see Inside AppleTalk, second edition. For a description of multicast addresses, see "About Multicast Addressing" on page 11-7.)
  4. Use the LAP Manager's L802Attach routine to install your protocol handler. (See the chapter "Link-Access Protocol [LAP] Manager" in this book for more information.)
  5. Use the EWrite function to send packets to the token ring driver for transmission across the network. To use the EWrite function, you provide a pointer to a write-data structure. The first buffer in the write-data structure must be at least 14 bytes long: the first 6 bytes of that buffer must contain the destination address. Bytes 13 and 14 must contain the packet length, which must not exceed 1500 bytes. The token ring driver fills in bytes 7-12 with the source address. (For more information on the write-data structure, see "Using a Write-Data Structure to Transmit Ethernet Data" on page 11-10.)
  6. When you are finished using the token ring driver, use the LAP Manager's L802Detach routine to remove your protocol handler.
  7. When you are finished using a functional address, use the EDelMulti function to remove it.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996