Important: The information in this document is obsolete and should not be used for new development.
EAttachPH
TheEAttachPH
function attaches a protocol handler to the .ENET driver to receive packets of a particular protocol type. You can provide and attach your own protocol handler or use the default protocol handler provided by Apple.
FUNCTION EAttachPH (thePBptr: EParamBlkPtr; async: Boolean): OSErr;
thePBptr
- A pointer to a parameter block of type
EParamBlock
.async
- A Boolean value that specifies whether the function is to be
executed asynchronously or synchronously. SpecifyTRUE
for asynchronous execution.
--> ioCompletion ProcPtr A pointer to completion routine. <-- ioResult OSErr The result code. --> ioRefNum Integer The driver reference number. --> csCode Integer Always ENetAttachPH
for this function.--> eProtType Integer The Ethernet protocol type. --> ePointer Ptr A pointer to protocol handler.
Field Description
eProtType
- The protocol type for which you are attaching a protocol handler. To attach a protocol handler for Ethernet Phase 1 packets, specify 0 as the value of this field. (Ethernet Phase 1 packets are IEEE 802.3 protocol packets.)
ePointer
- A pointer to your protocol handler application. To use the default protocol handler that Apple provides, set this field value to
NIL
.DESCRIPTION
TheEAttachPH
function serves two purposes: you can use it to attach to the .ENET driver your own protocol handler for a specific protocol type, or you can use it to specify that the .ENET driver should call the default protocol handler for your protocol type. If you attach your own protocol handler, the .ENET driver calls that protocol handler each time it receives a packet with the protocol type you specified. If you specify that the .ENET driver should use the default protocol handler, then you use theERead
command to read packets with that protocol type. In practice, you should call theEAttachPH
function very early, during your program initialization sequence, if possible.You specify the protocol type in the
eProtType
parameter and provide a pointer to the protocol handler in theePointer
parameter. If you specifyNIL
for theePointer
parameter, then the .ENET driver uses the default protocol handler for that protocol type.SPECIAL CONSIDERATIONS
Instead of using theEAttachPH
function to install a protocol handler for an Ethernet Phase 2 packet, you should use the LAP Manager'sL802Attach
routine. In the case of an 802.3 protocol packet, the .ENET driver passes the packet to the LAP Manager 802.2 protocol handler. If the packet has the protocol type you specified with theL802Attac
h routine, the LAP Manager passes the packet on to your protocol handler. For information about theL802Attach
routine, see the chapter "Link-Access Protocol (LAP) Manager" in this book.TOKEN RING AND FDDI CONSIDERATIONS
This function is available for token ring and FDDI also. However, Apple Computer, Inc. recommends that you use the LAP Manager'sL802Attach
routine instead to attach your protocol handlers for token ring and FDDI. For information about theL802Attach
routine, see the chapter "Link-Access Protocol (LAP) Manager" in this book.Note that if you use this function for token ring or FDDI, you exclude other processes, such as AppleTalk, from attaching their protocol handlers to the driver at the same time. If you use the LAP Manager interface, other applications can also attach their protocol handlers and use the driver concurrently.
If you use this function for token ring, you can only install a protocol handler for protocol type 0. To use this function for either token ring or FDDI, you must set the
ioRefNum
field to the driver reference number that theOpenSlot
or theOpenDriver
function returns.Apple does not provide a default protocol handler for token ring or FDDI.
ASSEMBLY-LANGUAGE INFORMATION
To execute theEAttachPH
function from assembly language, call the_Control
trap macro with a value ofENetAttachPH
in thecsCode
field of the parameter block.
To execute the_Control
trap asynchronously, include the value,ASYNC
in the operand field.RESULT CODES
noErr 0 No error LAPProtErr -94 Protocol handler is already attached or node's protocol
table is fullSEE ALSO
For more information on how to use theEAttachPH
function, see "Using the Default Ethernet Protocol Handler to Read Data" beginning on page 11-13.For information on the IEEE 802.2 and 802.3 protocols, see the chapter "Link-Access Protocol (LAP) Manager" in this book.