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


Summary of Ethernet, Token Ring, and FDDI

Pascal Summary

Constants

CONST
{.ENET, .TOKN, and .FDDI driver values}
   catNetwork              = 4;           {spCategory for Ethernet NB card}
   typeEtherNet            = 1;           {spCType for Ethernet NB card}
   typeTokenRing           = 2;           {spCType for token ring NB card}
   typeFDDI                = 11;          {spCType for FDDI NB card}
{.ENET driver routine selectors}
   ENetSetGeneral          = 253;         {set to general transmission mode}
   ENetGetInfo             = 252;         {get info}
   ENetRdCancel            = 251;         {cancel read}
   ENetRead                = 250;         {read}
   ENetWrite               = 249;         {write}
   ENetDetachPH            = 248;         {detach protocol handler}
   ENetAttachPH            = 247;         {attach protocol handler}
   ENetAddMulti            = 246;         {add a multicast address}
   ENetDelMulti            = 245;         {delete a multicast address}

Data Structures

TYPE EParamBlock = 
      PACKED RECORD
         qLink:         QElemPtr;         {reserved}
         qType:         Integer;          {reserved}
         ioTrap:        Integer;          {reserved}
         ioCmdAddr:     Ptr;              {reserved}
         ioCompletion:  ProcPtr;          {completion routine}
         ioResult:      OSErr;            {result code}
         ioNamePtr:     StringPtr;        {reserved}
         ioVRefNum:     Integer;          {reserved}
         ioRefNum:      Integer;          {driver reference number}
         csCode:        Integer;          {primary command code}
      CASE Integer OF
         ENetWrite, ENetAttachPH, ENetDetachPH, ENetRead, ENetRdCancel,
            ENetGetInfo, ENetSetGeneral:
            (
            eProtType:     Integer;       {Ethernet protocol type}
            ePointer:      Ptr;           {pointer; use depends on }
                                          { function}
            eBuffSize:     Integer;       {buffer size}
            eDataSize:     Integer;       {number of bytes read}
            );
         ENetAddMulti,ENetDelMulti:
            (
            eMultiAddr:    ARRAY[0..5] OF Char; {multicast address}
            )
         END;

EParamBlkPtr = ^EParamBlock;

Routines

Attaching and Detaching an Ethernet Protocol Handler

FUNCTION EAttachPH(thePBptr: EParamBlkPtr; async: Boolean): OSErr;
FUNCTION EDetachPH(thePBptr: EParamBlkPtr; async: Boolean): OSErr;

Writing and Reading Ethernet Packets

FUNCTION EWrite(thePBptr: EParamBlkPtr; async: Boolean): OSErr;
FUNCTION ERead(thePBptr: EParamBlkPtr; async: Boolean):OSErr;
FUNCTION ERdCancel (thePBptr: EParamBlkPtr; async: Boolean): OSErr;

Obtaining Information About the Ethernet Driver and Switching Its Mode

FUNCTION EGetInfo(thePBptr: EParamBlkPtr; async: Boolean): OSErr;
FUNCTION ESetGeneral(thePBptr: EParamBlkPtr; async: Boolean): OSErr;

Adding and Removing Ethernet Multicast Addresses

FUNCTION EAddMulti(thePBptr: EParamBlkPtr; async: Boolean): OSErr;
FUNCTION EDelMulti(thePBptr: EParamBlkPtr; async: Boolean): OSErr;

C Summary

Constants

enum {
   ENetSetGeneral    = 253,         /*set "general" mode*/
   ENetGetInfo       = 252,         /*get info*/
   ENetRdCancel      = 251,         /*cancel read*/
   ENetRead          = 250,         /*read*/
   ENetWrite         = 249,         /*write*/
   ENetDetachPH      = 248,         /*detach protocol handler*/
   ENetAttachPH      = 247,         /*attach protocol handler*/
   ENetAddMulti      = 246,         /*add a multicast address*/
   ENetDelMulti      = 245,         /*delete a multicast address*/
};

Data Types

#define EParamHeader \
   QElem       *qLink;              /*reserved*/\
   short       qType;               /*reserved*/\
   short       ioTrap;              /*reserved*/\
   Ptr         ioCmdAddr;           /*reserved*/\
   ProcPtr     ioCompletion;        /*completion routine*/\
   OSErr       ioResult;            /*result code*/\
   StringPtr   ioNamePtr;           /*reserved*/\
   short       ioVRefNum;           /*reserved*/\
   short       ioRefNum;            /*driver reference number*/\
   short       csCode;              /*call command code*/

struct EParamMisc1 {
   EParamHeader                     /*general EParams*/
   short       eProtType;           /*Ethernet protocol type*/
   Ptr         ePointer;
   short       eBuffSize;           /*buffer size*/
   short       eDataSize;           /*number of bytes read*/
};
Note
The C interface file contains the following structure type definition, which is incorrect. A corrected version follows it.
typedef struct EParamMisc1 EParamMisc1;

struct EParamMisc2 {
   EParamMisc1 EParms1;
   char  eMultiAddr[6];             /*multicast address*/
};
Note
The following structure type definition is a correction to the
preceding structure that may exist in the interface file. You should declare the following struct in your application instead of relying
on the interface file.
typedef struct {
      EParamHeader
      char eMultiAddr[5];           /*multicast address*/
}EParamMisc2;
typedef struct EParamMisc2 EParamMisc2;
union EParamBlock {
   EParamMisc1 EParms1;
   EParamMisc2 EParms2;
};
typedef union EParamBlock EParamBlock;
typedef EParamBlock *EParamBlkPtr;

Routines

Attaching and Detaching an Ethernet Protocol Handler

pascal OSErr EAttachPH(EParamBlkPtr thePBptr, Boolean async);
pascal OSErr EDetachPH(EParamBlkPtr thePBptr, Boolean async); 

Writing and Reading Ethernet Packets

pascal OSErr EWrite(EParamBlkPtr thePBptr, Boolean async);
pascal OSErr ERead(EParamBlkPtr thePBptr, Boolean async);
pascal OSErr ERdCancel(EParamBlkPtr thePBptr, Boolean async); 

Obtaining Information About the Ethernet Driver and Switching Its Mode

pascal OSErr EGetInfo(EParamBlkPtr thePBptr, Boolean async);
pascal OSErr ESetGeneral(EParamBlkPtr thePBptr, Boolean async);

Adding and Removing Ethernet Multicast Addresses

pascal OSErr EAddMulti(EParamBlkPtr thePBptr, Boolean async);
pascal OSErr EDelMulti(EParamBlkPtr thePBptr, Boolean async); 

Assembly-Language Summary

Constants

ENetSetGeneral    EQU     253       ;set to general transmission mode
ENetGetInfo       EQU     252       ;get info
ENetRdCancel      EQU     251       ;cancel read
ENetRead          EQU     250       ;read
ENetWrite         EQU     249       ;write
ENetDetachPH      EQU     248       ;detach protocol handler
ENetAttachPH      EQU     247       ;attach protocol handler
ENetAddMulti      EQU     246       ;add a multicast address
ENetDelMulti      EQU     245       ;delete a multicast address

Data Structures

EParamBlock Parameter Block
16ioResultwordresult code
26csCodewordroutine selected
28eMultiAddr6 bytesmulticast address
28eProtTypewordEthernet protocol type
30ePointerlongpointer
34eBuffSizewordsize of buffer
36eDataSizewordnumber of bytes read

Result Codes
noErr0No error
eMultiErr-91Address not found
eLenErr-92Packet too large or first entry of the write-data structure did not contain the full 14-byte header
LAPProtErr-94No protocol handler is attached
excessCollsns-95Hardware error
memFullErr-108Insufficient memory in heap
cbNotFound-1102ERead not active
reqAborted-1105ERdCancel or EDetachPH function called
buf2SmallErr-3101Packet too large for buffer; partial data returned


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996