Important: The information in this document is obsolete and should not be used for new development.
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
- set up a names table entry for your entity and register your entity's name and address pair with NBP for other entities to access
- look up an address based on a name
- confirm a name and address that you already have
- remove your entity's name and address from the NBP names directory
- cancel a pending NBP request
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 ofPRegisterName, PLookupName
andPConfirmName
requests concurrently. The maximum number of concurrent requests
is machine dependent. You can use thePGetAppleTalkInfo
function to determine
the maximum number of concurrent NBP requests supported by the .MPP driver
on the node running your application. For information about thePGetAppleTalkInfo
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
orNewPtrSys
function. If you useNewHandle
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