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 12 - Multinode Architecture


Summary of Multinode Architecture

The multinode architecture MPP parameter block data structure and symbolic constants for routines and result codes are not defined in the MPW interface files. (The write-data structure and the address block record are defined in the MPW interface files for use with other protocols, but you can use them for multinode also.)

You must declare the MPP parameter block for multinode in your application. If you want to use the symbolic constants for the routines and result codes, you need to declare them also.

You use the Device Manager's PBControl function to call the RemoveNode and NetWrite routines from the Pascal and C languages. You must issue the AddNode routine as an immediate synchronous control call from the Pascal and C languages. You must define a function as part of your application. (See Listing 12-1 on page 12-8 for an example of how to do this in Pascal.) From assembly language, you can directly make an immed _Control trap macro call.

Pascal Summary

Constants

(Declare the following constants in your application.)

CONST
   {csCodes}
   netWrite    = 261;               {send packet through multinode}
   addNode     = 262;               {request a multinode}
   removeNode  = 263;               {remove multinode}

Data Types

The Write-Data Structure

TYPE  WDSElement = 
   RECORD
      entryLength:   Integer;
      entryPtr:      Ptr;
   END;

The Address Block Record

TYPE AddrBlock = 
   PACKED RECORD
      aNet:          Integer;    {network number for multinode}
      aNode:         Byte;       {multinode ID}
      aSocket:       Byte;       {socket number; always 0}
   END;

The Multinode Parameter Block

(Declare this data type in your application.)

TYPEMNParmType = (AddNodeParm,RemoveNodeParm);
TYPE MNParamBlock = 
   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;          {call command code}
         filler1:       Byte;          {reserved}
         checkSumFlag:  Byte;          {perform checksum on datagram}
         wdsPointer:    Ptr;           {pointer to write-data structure}
         filler2:       Integer;       {reserved}
         CASE MNParmType OF
            AddNodeParm:
            (reqNodeAddr:  AddrBlock;     {preferred address requested}
             actNodeAddr:  AddrBlock;     {actual node address returned}
             recvRoutine:  ProcPtr;       {pointer to packet receive routine}
             reqCableLo:   Integer;       {preferred network range for the }
             reqCableHi:   Integer;       { node being acquired}
             reserved:     PACKED ARRAY[1..70] OF Byte);
            RemoveNodeParm:
            (nodeAddr:     AddrBlock);    {node address to be deleted}
END;
MNParmBlkPtr = ^MNParamBlock;

C Summary

Constants

(Declare the following constants in your application.)

/*csCodes*/
enum {
   netWrite       = 261,               /*send packet through multinode*/
   addNode        = 262,               /*request a multinode*/
   removeNode     = 263                /*remove multinode*/
};

Data Types

The Write-Data Structure

struct   WDSElement { 
   short    entryLength;
   Ptr      entryPtr;
} WDSElement;

The Address Block Record

struct AddrBlock { 
      short             aNet;          /*network number for multinode*/
      unsigned char     aNode;         /*multinode ID*/
      unsigned char     aSocket;       /*socket number; always 0*/
};

typedef struct AddrBlock AddrBlock;

The MPP Parameter Block for Multinode

(Declare this data type in your application.)

typedef struct {
   MPPATPHeader
      char              filler1;       /*reserved*/
      unsigned char     checkSumFlag;  /*perform checksum on datagram*/
      Ptr               wdsPointer;    /*pointer to write-data structure*/
      char              filler2[2];    /*reserved*/
      union {
         AddrBlock      reqNodeAddr;   /*preferred address requested*/
         AddrBlock      nodeAddr;      /*node address to be deleted*/
               } MNaddrs;
      AddrBlock      actNodeAddr;      /*actual node address acquired*/
      Ptr            recvRoutine;      /*address of packet receive routine*/
      short          reqCableLo;       /*preferred network range for the */
      short          reqCableHi;       /* node being acquired*/
      char           reserved[70];
} MNParamBlock;
typedef MNParamBlock*MNParmBlkPtr;

Assembly-Language Summary

MPP Parameter Block Common Fields for Multinode Routines
0qLinklongreserved
4qTypewordreserved
6ioTrapwordreserved
8ioCmdAddrlongreserved
12ioCompletionlongaddress of completion routine
16ioResultwordresult code
18ioNamePtrlongreserved
22ioVRefNumwordreserved
24ioRefNumworddriver reference number

AddNode
26csCodewordroutine selector; always 262 for this routine
36reqNodeAddrlongrequested multinode address
40actNodeAddrlongactual multinode address assigned
44recvRoutinelongaddress of the application's receive routine
48reqCableLowordbeginning of requested network number range
for the multinode
50reqCableHi wordend of the requested network number range for the multinode
52reservedarray70 reserved bytes required by the .MPP driver
Parameter Variant

(Note that to execute the AddNode routine from assembly language, you call the _Control trap macro and issue the routine request as an immediate call.)

RemoveNode
26csCodewordroutine selector; always 263 for this routine
36nodeAddrlongactual multinode address assigned
Parameter Variant

NetWrite
26csCodewordroutine selector; always 261 for this routine
29checkSumFlagbytea flag indicating whether the checksum should be calculated or the existing checksum left unmodified
30wdsPointerlonga pointer to the write-data structure for this routine
Parameter Variant

Result Codes
noErr0No error
paramErr-50Bad parameter value
ddpLenErr-92Datagram is too long
noBridgeErr-93No router found
excessCollsns-95Excessive collisions on write
tryAddNodeAgainErr-1021The .MPP driver was not able to add node; try again
mnNotSupported-1022Multinode is not supported by the current AppleTalk connection file of type 'adev'
noMoreMultiNodes-1023No node address is available on the network


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996