Chooser with ATalk
Volume Number: 2
Issue Number: 7
Column Tag: C Workshop
How the Chooser Works with AppleTalk
By Bob Denny, Alisa Systems, Editorial Board
Introduction
The 3.0 and later releases of the Macintosh system software (the “System”
resource file) contain a new desk accessory called the “Chooser.” It replaces the old
“Choose Printer” and provides a way to select devices in general, not just printers
(note that the Chooser will not operate with earlier System versions). The Chooser is
used to select remote devices of all sorts including printers and file servers, as well as
“ports” for local devices such as the serial Imagewriter.
This article covers the operation of the Chooser (and its companion, the Namer),
and describes how to add support for user-supplied devices to the Chooser. It also
describes the zone concept, an important new addition to the AppleTalk architecture.
The next release of the Chooser will support zone selection for remote (AppleTalk)
device lists. Finally, the “name” string at the bottom of the Chooser window is
described.
The Chooser
Figure 1 shows the window display of the Chooser that was released with System
3.0. Apple is currently finishing development of a new Chooser which will have a
different appearance and will support AppleTalk zone selection, as discussed later.
The icons along the left edge correspond to the device files that the Chooser finds
on the boot volume. When it is first brought up, the Chooser searches the “blessed”
(System) folder HFS devices, or the entire disk on MFS devices, for these device files.
For each one it finds, it opens the file, reads the icon and flags word, then closes it.
When this process completes, the Chooser opens the device file for the current printer.
The list box shows the list of choices that are appropriate for the type of device
that is selected. For the serial Imagewriter, the icons corresponding to the two
possible connection ports (printer & modem) are displayed. For the LaserWriter and
AppleTalk Imagewriter, the names of the available printers are listed. Note that you
can name a LaserWriter anything you want (well, almost), and you must have a unique
name for each LaserWriter on your net. If you have 5 LaserWriters, you'll see their 5
names in the list box.
The contents and action of the list box is handled by the List Manager, a new
package supplied in Systems 3.0 and later. For more information on the List manager,
see the updates to Inside Macintosh furnished with the “December, 1985” (really
March, 1986) Software Supplement. You should also refer to Schuster, Mike (1986),
“Palette Selection via List Manager,” Mac Tutor, Vol.2, No. 5, May, 1986.
The cells of the list are filled in either by default procedures contained within
the Chooser, or via an external fillList procedure provided with the device resources.
For serial printers, the Chooser handles the display of the port icons in the list window.
For AppleTalk devices, a default procedure is provided that issues periodic name
lookups on the net for the specified device type and fills in the names found (more on
this in the next section). If the device supports a fillList procedure, then it is called
by the Chooser to fill in the list cells.
Finally, note that the Chooser is a modeless dialog. This means that the Chooser
may be active while the user does other things.
AppleTalk Names and Zones
AppleTalk supports internetworking, the interconnection of networks.
Depending on the application mix, a single AppleTalk net can comfortably support a
cluster of from 4 to, say, 20 nodes. Large organizations can connect their work-group
clusters by means of bridges to form an internet.
On AppleTalk, entities (such as LaserWriters) are located by using the Name
Binding Protocol (NBP). Every entity on the net has a name which consists of three
fields, the object, type and zone. The object is the actual “name” of the thing, the type
puts the thing into a category, and the zone defines the set of networks in which the
name is known. The first two fields are “possessed” by the object, the zone name is
implicitly set by it's location in the internet, as we'll see.
NBP locates objects of a given type in the internet by broadcasting a request for
the names and addresses of all objects of that type. The replies come streaming in from
all over the internet, through the bridges, and into the requesting node. Normally a
series of requests is issued to reduce the vulnerability to lost replies.
On a large internet, this process can become unwieldy. Suppose you had a
world-class internet with nets located in cities on several continents. You bring up the
Chooser to select one of your local LaserWriters, and after a minute or so, there are
600 LaserWriters in the list! Gad! Imagine the blast of traffic that such a lookup
would generate. And who cares about the LaserWriters in Frankfurt, anyway?
The solution to this mess is to divide the internet into name zones. A zone is
defined as a set of nets within which names are unique. Name lookups are restricted to
the nets in a single zone. The intent is for organizations to partition the internet into
zones corresponding to the geographic layout of their facilities, or by department, or
something like that.
Note that zone partitioning relates only to name lookups. Every node on the
internet is addressed by net/node/socket at all times. Zones partition the internet into
areas in which names are known (and must be unique). There may be LaserWriters
named “Gutenberg” in each zone, but not more than one in a given zone.
Zone Selection
End nodes can find out what zone they are in and the names of all zones in the
internet from a local bridge. When the new Chooser is started on a node which is
connected to an internet (at least one bridge on its local net), it asks for its zone name,
then displays it. It then asks the bridge for a list of zones in the internet. If there is
more than one name in the list, the new Chooser will display a list of zones. From this
list, the user can select the zone in which subsequent name searches will be made. If
there are no bridges connected to the local net, the new Chooser will hide zone items
from the user.
The Namer
The Chooser has a companion application called the Namer. Its dialog is shown in
Figure 2. This program is used to change the names of AppleTalk devices (such as
LaserWriters). It operates in a manner similar to the Chooser, except that once a
particular device is selected, a dialog appears requesting the new name for that device.
The user types in the new name, then the Namer attempts to rename it. The device file
discussed in the next section contains resources that are used by both the Chooser and
the Namer.
Fig. 2 The Namer Utility
The Device File
Each device which uses the chooser is represented by a device file in the System
Folder the current startup volume. The file's Finder “type” (fdType) serves as a
rough classification for the device type, as shown in Table 1: (See top of next page.)
Table 1 - Device File Types
fdType Device Type
PRES Serial printer, such as Imagewriter
PRER Remote printer (any non-serial printer)
SDEV Serial non-printer device (not supported by current Chooser)
RDEV Remote non-printer device
The device file has a BNDL resource and associated ICN# & FREF resources which
serve to give the device its icon as seen in the Chooser window (as well as in the Finder,
as usual). It also contains resources that are used by the Chooser to manage the device
properly. They include those shown in Table 2:
Table 2 - Device File Resources
Type ID Use
STR -4096 If AppleTalk device, its “type” name as known on the net via
NBP.
STR -4095 Singular form of device name as used in alerts and dialogs.
STR -4094 Plural form of device name as used in alerts and dialogs.
STR -4091 The string for the Chooser to put at the top of its list window.
STR# -4093 If AppleTalk PAP device (Printer Acc-
-4092 ess Protocol, e.g., LaserWriter), the data to send in order to
rename the device.
GNRL -4096 If AppleTalk device, NBP retry interval and count values for
lookup.
PACK -4096 Code used by non-serial devices for handling messages from the