Custom 802.2 Handlers
EtherTalk packets. You cannot replace or override the permanent
routines. You call these routines from assembly language by placing a routine
selector in the D0 register and executing a JSR instruction to an offset 2 bytes
contained in the global variable LAPMgrPtr (0x0B18).
Before you call these routines, you must be sure to place the reference
type specification in the A1 register. Before you call the L802Attach routine,
you must also place a pointer to your protocol handler in the A0 register. Both
routines return a nonzero value in the D0 register if there is an error.
The code example shows how to call a LAP Manager L802.2 routine from assembly language.
#define LAPMgrPtr 0xB18 // Entry point for LAP Manager
#define LAPMgrCall 2 // Offset to LAP Manager routines
void CallLAPMgr (Ptr PHndlrPtr, Ptr PSpecPtr, long rSel, long refNum); void CallLAPMgr (Ptr PHndlrPtr, Ptr PSpecPtr, long rSel, long refNum) {
asm {
move.l rSel, d0 ;place routine selector in d0
move.l refNum, d0 ;place driver reference number
;in d2
move.l PHndlrPtr,a0 ;put pointer to protocol handler
;in a0 (L802Attach only)
move.l PSpecPtr,a1 ;put pointer to protocol specification
;in a1
move.l #LAPMgrPtr,aN ;put pointer to LAP Mgr in aN
jsr LAPMgrCall(aN) ;jump to start of LAP Mgr
; routines
}
}
L802Attach
for a specific IEEE 802.2 protocol type.
On entry D0: 21
D2: reference number of .ENET driver
A0: pointer to your protocol handler
A1: pointer to protocol specification
On exit D0: nonzero if error
Before calling this routine, you must put the value 21 in the D0 register and
You must put a pointer to your protocol handler in the A0 register and a
pointer to the protocol-type specification for this protocol handler in the A1
register. The protocol-type specification consists of one or more protocol-type
protocol-type fields in the 802.2 data packet header to determine to which
protocol handler (if any) to deliver the packet. The first type field in your
protocol specification is the 1-byte DSAP. If the DSAP type field is equal to
0x0AA, then the protocol-type specification must contain a second type field,
the 5-byte SNAP type. If the SNAP type field is 0x000000080F3, indicating
the AppleTalk Address Resolution Protocol (AARP), then the protocol-type
specification must contain a third type field, the 4-byte AARP protocol type.
Terminate the list of protocol-type fields with a byte of zeros.
The following protocol-type specification, for example, is for the permanent
LAP Manager protocol handler for an 802.3 packet containing AppleTalk LAP Manager. The first byte, 0x001, is the length byte for the first protocol-type field (the DSAP type field), 0x0AA. The third byte, 0x005, is
the length byte for the next protocol-type field, the SNAP. The final byte
(0x000) terminates the type specification.
01 AA 05 08 00 07 80 9B 00
The following protocol-type specification is for the permanent
LAP Manager protocol handler for an 802.3 packet to be delivered to the EtherTalk AARP handler. Notice that the SNAP field is followed by an additional
type field, the AARP protocol type.
01 AA 05 00 00 00 80 F3 04 00 01 80 9B 00
Note: The DSAP value of 0x0AA is reserved for use with protocol-type
specifications that include a SNAP field. The SNAP value of 0x008 00 07 80
9B is reserved for AppleTalk data. The SNAP value of 0x000 00 00 80 F3 is
reserved for AARP data. The AARP protocol type value of 0x000 01 80 9B
is reserved for EtherTalk AARP packets.
See the ANSI/IEEE standard 802.2 for more information about 802.2
protocols, and see Inside AppleTalk, second edition, for more information about
AARP.
L802Detach
handler for a specific IEEE 802.2 protocol type.
On entry D0: 22
D2: reference number of .ENET driver
A1: pointer to protocol specification
On exit D0: nonzero if error
Before calling this routine, you must be sure to put the value 22 in the D0
routine.
You must put a pointer to the protocol-type specification for this protocol
handler in the A1 register. You must specify exactly the same protocol type as
you specified for the L802Attach routine when you attached the protocol
handler.