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 4 - Zone Information Protocol (ZIP) / ZIP Reference
Routines / Obtaining Zone Information


GetLocalZones

The GetLocalZones function returns a list of all the zone names on the local network--that is, the network that includes the node on which your application is running.

FUNCTION GetLocalZones (thePBptr: XPPParmBlkPtr; 
                        async: Boolean): OSErr;
thePBptr
A pointer to an XPP parameter block.
async
A Boolean that indicates whether the function should be executed asynchronously or synchronously. Specify TRUE for asynchronous execution.
-->ioCompletionProcPtrA pointer to a completion routine.
<--ioResultOSErrThe function result code.
-->csCodeIntegerAlways xCall for this function.
-->xppSubCodeIntegerAlways zipGetLocalZones.
-->xppTimeoutByteThe retry interval in seconds.
-->xppRetryByteThe retry count.
-->zipBuffPtrPtrA pointer to data buffer.
<--zipNumZonesIntegerThe number of names returned.
<--zipLastFlagByteA flag that is nonzero if there are no more names.
-->zipInfoFieldPACKED ARRAYA data buffer for use by ZIP; first word set to 0.

Field Description
xppSubCode
A routine selector. This field is automatically set by the MPW interface to zipGetLocalZones for this function.
xppTimeout
The amount of time, in seconds, that the .ATP driver should wait between attempts to obtain the data. A value of 3 or 4 seconds for the xppTimeout field is usually sufficient.
xppRetry
The number of times the .ATP driver should attempt to obtain the data before returning the request failed (reqFailed) result code. A value of 3 or 4 is usually sufficient.
zipBuffPtr
A pointer to a 578-byte data buffer that you must allocate. ZIP returns the zone names into this buffer as a packed array of
Pascal strings.
zipNumZones
The number of zone names that ZIP placed in the data buffer.
zipLastFlag
A value that indicates if there are more zone names for your network beyond those that ZIP returned in the zipBuffPtr field. The .XPP driver sets this field to 1 if there are no more zone names for your network.
zipInfoField
A 70-byte data buffer that you must allocate for use by ZIP. You must set the first word of this buffer to 0 before you call the GetLocalZones function the first time through the loop, and
you must not change the contents of this field thereafter.
DESCRIPTION
A single extended network can have more than one zone associated with it. Your application can use the GetLocalZones function to retrieve the list of zones for its node's local network. The GetLocalZones function uses ATP to retrieve the zone information. The buffer that you allocate to hold the returned zone names is the size
of a single ATP response. You must call the GetLocalZones function repeatedly until all of the zones for the local network have been returned.

Your application must check the zipLastFlag field to determine if there are more zone names for your network. If the value of this field is 1, there are no more zone names for your local network. If the value of this field is still 0 when the GetLocalZones function completes execution, you must empty the data buffer pointed to by the zipBuffPtr parameter and immediately call the GetLocalZones function again without changing the value in the zipInfoField parameter.

If you receive a GetLocalZones function result of tooManyReqs, wait a minute or so, and then try again; some transactions can take up to 30 seconds to complete.

This function works for extended networks only. If the node that is running your application is on a nonextended network and you want the name of that node's zone, use the GetMyZone function.

SPECIAL CONSIDERATIONS
The memory that you allocate for the parameter block and the two buffers required by the GetLocalZones function belongs to the .XPP driver until the function completes execution. You can reuse the memory or dispose of it after the operation completes.

ASSEMBLY-LANGUAGE INFORMATION
To execute the GetLocalZones function from assembly language, call the _Control trap macro with a value of xCall in the csCode field of the parameter block and a value of zipGetLocalZones in the xppSubCode field of the parameter block. To execute this function from assembly language, you must also specify the .XPP driver reference number.

RESULT CODES
noErr0No error
noBridgeErr-93No router is available
reqFailed-1096Request to contact router failed; retry count exceeded
tooManyReqs-1097Too many concurrent requests
noDataArea-1104Too many outstanding ATP calls
SEE ALSO
For the XPPParamBlock data type, see "The XPP Parameter Block for ZIP" beginning on page 4-10.

To get the correct reference number for the .XPP driver, you can use the Device Manager's OpenDriver function, which returns the driver reference number. For information about the OpenDriver function, see the chapter "Device Manager" in
Inside Macintosh: Devices.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996