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 /
Chapter 11 - Ethernet, Token Ring, and Fiber Distributed Data Interface / Ethernet, Token Ring, and FDDI Reference
Routines / Writing and Reading Ethernet Packets


EWrite

The EWrite function allows you to send data directly to a hardware device driver for a particular network type for transmission across the network.

FUNCTION EWrite (thePBptr: EParamBlkPtr; async: Boolean): OSErr; 
thePBptr
A pointer to a parameter block of type EParamBlock.
async
A Boolean value that specifies whether the function should be executed asynchronously or synchronously. Specify TRUE for asynchronous execution.
-->ioCompletionProcPtrA pointer to completion routine.
<--ioResultOSErrThe result code.
-->ioRefNumIntegerThe driver reference number.
-->csCodeIntegerAlways ENetWrite for this function.
-->ePointerPtrA pointer to write-data structure.

Field Description
ePointer
A pointer to the write-data structure that contains the data that you want to send.
DESCRIPTION
You use the EWrite function to send a data packet over an Ethernet, a token ring, or an FDDI network by communicating directly with the hardware device driver for that network type. You must first prepare a write-data structure that specifies the destination address and the protocol type and contains the data that you want to send. You place a pointer to the write-data structure in the ePointer parameter.

For Ethernet, if you want to send a packet larger than 768 bytes, you must first call
the ESetGeneral function to put the .ENET driver in general-transmission mode.
If the size of the packet you provide is less than 60 bytes, the driver adds pad bytes to
the packet.

TOKEN RING AND FDDI CONSIDERATIONS
You can use this function to send data to a token ring or FDDI driver. Note that the packet size for token ring and FDDI is hardware dependent. However, for Logical Link Control (LLC) type packets, the packet length cannot exceed 1500 bytes.

To use this function for token ring or FDDI, you must set the ioRefNum field to the driver reference number that the OpenSlot or OpenDriver function returns.

You must also provide a pointer to a write-data structure. The first buffer in the write-
data structure must be at least 14 bytes long: the first 6 bytes of that buffer must contain the destination address. Bytes 13 and 14 must contain the packet length, which must not exceed 1500 bytes. The token ring driver fills in bytes 7-12 with the source address.

ASSEMBLY-LANGUAGE INFORMATION
To execute the EWrite function from assembly language, call the _Control trap macro with a value of ENetWrite in the csCode field of the parameter block. To execute the _Control trap asynchronously, include the value ,ASYNC in the operand field.

RESULT CODES
noErr0No error
eLenErr-92Packet too large or first entry of the write-data structure
did not contain the full 14-byte header
excessCollsns-95Hardware error
SEE ALSO
For information on how to use the EWrite function and how to create a write-data structure, see "Using a Write-Data Structure to Transmit Ethernet Data" beginning on page 11-10.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996