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 3 - Name-Binding Protocol (NBP)


Using NBP

This section describes how you can use NBP to

The .MPP driver implements the NBP protocol. Your application should check to ensure that the .MPP driver is already loaded on the system running your application before it attempts to call NBP. If the driver is not already open, your application should open it by calling the Device Manager's OpenDriver function. The following example shows how to open the .MPP driver.

BEGIN 
   myErr := OpenDriver('.MPP', mppRefNum);   {open .MPP driver}
   IF myErr <> noErr THEN DoErr(myErr);      {check and handle }
                                             { error}
For more information on determining if the .MPP driver is open and opening the AppleTalk drivers, see the chapter "AppleTalk Utilities" in this book.

Your application can have multiple concurrent active NBP requests. For example,
your application can perform a number of PRegisterName, PLookupName and PConfirmName requests concurrently. The maximum number of concurrent requests
is machine dependent. You can use the PGetAppleTalkInfo function to determine
the maximum number of concurrent NBP requests supported by the .MPP driver
on the node running your application. For information about the PGetAppleTalkInfo function, see the chapter "AppleTalk Utilities" in this book.

All of the NBP functions use parameter blocks to hold input and output values. Whether you execute a function synchronously or asynchronously, you must not alter the contents of the parameter block until after the NBP function that uses it completes the operation. In effect, the parameter block belongs to the NBP function until the function completes execution. (For a discussion of synchronous and asynchronous execution, see the chapter "Introduction to AppleTalk" in this book.) When the operation completes, you can either reuse the memory allocated for the parameter block or release it.

In addition to the parameter block used for the function, the memory that you allocate for any records and buffers whose pointers you pass to NBP through a parameter block field must also be nonrelocatable until the function completes execution. When the operation completes, you can reuse these data structures or release the memory that you allocated for them.

To allocate nonrelocatable memory, you can use the Memory Manager's NewPtr or NewPtrSys function. If you use NewHandle instead, you need to lock the memory. For more information about these functions, see Inside Macintosh: Memory.


Subtopics
Registering Your Entity With NBP
Handling Names Table Entry Requests

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996