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 With Open Transport / Part 2 - Open Transport Reference
Chapter 26 - Ports Reference / Functions
Registering New Ports /


OTCreatePortRef

Creates a port reference that describes a unique port.

C INTERFACE
OTPortRef OTCreatePortRef(UInt8 busType, 
                                          UInt16 devType,
                                          UInt16 slot, 
                                     
C++ INTERFACE
None. C++ applications use the C interface to this function.

PARAMETERS
busType
The type of bus to which the hardware port is connected; for example, a NuBus or PCI bus. See "The Port Reference" for possible values for this parameter.
devType
The type of hardware device connected to the port, such as LocalTalk or Ethernet. See "The Port Reference" for possible values for this parameter.
slot
The number of the physical slot containing the device.
other
The port's multiport identifier--that is, a numeric value that distinguishes between ports when more than one hardware port is connected to a given slot.
function result
A 32-bit port reference value.
DISCUSSION
The OTCreatePortRef function creates a port reference structure, which is a 32-bit value that describes a port: its device and bus type, its physical slot number, and, where applicable, its multiport identifier. Once you have created a port reference, you can use the OTFindPortByRef function to find a specific port with that particular set of characteristics.

To create a port reference, you use the OTCreatePortRef function. You must know all the port's hardware characteristics: its device and bus type, its slot number, and its multiport identifier (if it has one). You cannot use wildcards to fill in any element you don't know, although you can use a device type of 0 to allow matches on every kind of device type.To create a port reference for a pseudodevice, use 0 as the value for the bus type, slot number, and multiport identifier, and use the constant kOTPseudoDevice for the device type.

Open Transport has predefined variants of the OTCreatePortRef function for the most commonly used hardware devices, such as the NuBus, PCI, and PCCard devices. Three variants are listed here:

#define OTCreateNuBusPortRef(devType, slot, other)\
      OTCreatePortRef(kOTNuBus, devType, slot, other)

#define OTCreatePCIPortRef(devType, slot, other)\ OTCreatePortRef(kOTPCIBus, devType, slot, other)

#define OTCreatePCCard PortRef(devType, slot, other)\ OTCreatePortRef(kOTPCCardBus, devType, slot, other)

Once you have identified the port structure you want, you can access the information in its port reference, by using the OTGetDeviceTypeFromPortRef function, the OTGetBusTypeFromPortRef function, and the OTGetSlotFromPortRef function.

SPECIAL CONSIDERATIONS
In Open Transport port references the slot numbers are physical slot numbers; that is, they are the slot numbers returned by the Slot Manager and not the slots seen in various network configuration applications. Physical slot numbers depend on the type of card installed. For example, NuBus cards number their slots 9-13, which appear in the AppleTalk or TCP control panels as slots 1-5.

SEE ALSO
"Obtaining Port Information".


Previous Book Contents Book Index Next

© Apple Computer, Inc.
15 JAN 1998