LAPRead
LAPRead Receive a frame from another node
#include <AppleTalk.h> AppleTalk Manager
OSErr LAPRead( abRecord, async);
ATLAPRecHandle abRecord; handle to an ATLAPRec
Boolean async; 0=await completion; 1=immediate return
returns Error Code; 0=no error
LAPRead is part of the AppleTalk alternate interface. There is no preferred
call that is an equivalent to this routine. Instead, if you want to read ALAP
frames using the preferred interface, you must call PAttachPH to add your
protocol handler to the node's protocol handler table. The ALAP module will
examine every incoming frame and call your protocol handler for each frame
received with the correct ALAP protocol. When your program no longer wants
to receive frames with a particular ALAP protocol type value, it can call
DetachPH to remove the corresponding protocol handler from the protocol
handler table. This is the recommended way to read ALAP frames.
LAPRead receives a frame from another node
abRecord is a handle to an ATLAPRec structure. The relevant fields are as
follows:
Out-InName Type SizevOffset Description
¨ abOpcode ABCallType 1 0 Always tLAPRead
¨ abResult short 2 2 Result code
Æ abUserReference long 4 4 For your use
¨ lapAddress.dstNodeID char 1 0 Destination node ID
¨lapAddress.srcNodeID char 1 1 Source node ID
ÆlapAddress.lapProtType ABByte 2 2 ALAP protocol type
Æ lapReqCount short 2 Buffer size in bytes
¨ lapActCount short 2 No. of frame data bytes received
Æ lapDataPtr Ptr 4 16 Pointer to buffer
async is a Boolean value. Use FALSE for normal ( synchronous) operation
or TRUE to enqueue the request and resume control immediately. See
Async I/O.
Returns: an operating system Error Code. It will be one of:
noErr (0) No error
buf2SmallErr (-3101) Frame too large for buffer
readQErr (-3105) Invalid protocol type or protocol type not found in
table.

Notes: LAPReqCount and lapDataPtr specify the size and location of the buffer that
will receive the frame data. If the buffer is not large enough to hold all of the
incoming frame data, the extra bytes will be discarded and buf2SmallErr
will be returned. The number of bytes actually received is returned in
lapActCount. Only frames with ALAP protocol type equal to
lapAddress.lapProtType will be received. The node IDs of the frame's source
and destination nodes are returned in lapAddress.srcNodeID and
lapAddress.dstNodeID. You can determine whether the packet was broadcast
to you by examining the value of lapAddress.dstNodeID--if the packet was
broadcast it's equal to 255, otherwise it's equal to your node ID.
You should issue LAPRead calls only for ALAP protocol types that were
opened (via LAPOpenProtocol ) to use the default protocol handler.
Warning: If you close a protocol type for which there are still LAPRead
calls pending, the calls will be canceled but the memory
occupied by their ATLAPRec will not be released. For this
reason, before closing a protocol type, call LAPRdCancel to
cancel any LAPRead calls associated with that protocol.