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 2 - AppleTalk Utilities


Summary of AppleTalk Utilities

Pascal Summary

Constants

CONST
   setSelfSend          =  256;        {allow intranode delivery, csCode}
   GetATalkInfo         =  258;        {get AppleTalk information, csCode}

Data Types

MPP Parameter Block for PSetSelfSend and PGetAppleTalkInfo

TYPE MPPParmType =   (...SetSelfSendParm,
                         GetAppleTalkInfoParm...);
TYPE MPPParamBlock = 
   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 MPPParmType OF
      SetSelfSendParm:
         (newSelfFlag:     Byte;          {self-send toggle flag}
         oldSelfFlag:      Byte);         {previous self-send state}
      GetAppleTalkInfoParm: 
         (version:         Integer;       {requested info version}
         varsPtr:          Ptr;           {pointer to MPP variables}
         DCEPtr:           Ptr;           {pointer to MPP DCE}
         portID:           Integer;       {port number [0..7]}
         configuration:    LongInt;       {32-bit configuration word}
         selfSend:         Integer;       {nonzero if self-send enabled}
         netLo:            Integer;       {low value of network range}
         netHi:            Integer;       {high value of network range}
         ourAddr:          LongInt;       {our 24-bit AppleTalk address}
         routerAddr:       LongInt;       {24-bit address of last router}
         numOfPHs:         Integer;       {maximum number of protocol }
                                          { handlers}
         numOfSkts:        Integer;       {maximum number of static sockets}
         numNBPEs:         Integer;       {maximum concurrent NBP requests}
         ntQueue:          Ptr;           {pointer to registered name queue}
         LAlength:         Integer;       {length in bytes of data-link addr}
         linkAddr:         Ptr;           {data-link address returned}
         zoneName:         Ptr);          {zone name returned}
END;
MPPPBPtr =  ^MPPParamBlock;

Routines

Obtaining Information About the .MPP Driver and the Current Network Environment

FUNCTION PGetAppleTalkInfo(thePBptr: MPPPBPtr; async: Boolean): OSErr;

Enabling Intranode Delivery of DDP Packets

FUNCTION PSetSelfSend(thePBptr: MPPPBPtr; async: Boolean): OSErr;

Getting the Addresses of Your Node and Local Internet Router

FUNCTION GetNodeAddress(VAR myNode: Integer; VAR myNet: Integer): OSErr;
FUNCTION GetBridgeAddress: Integer;

Opening and Closing Drivers

FUNCTION MPPOpen: OSErr;
FUNCTION MPPClose: OSErr;
FUNCTION IsMPPOpen: Boolean;
FUNCTION IsATPOpen:Boolean;
FUNCTION OpenXPP(VAR xppRefnum: Integer): OSErr;

C Summary

Constants

/*csCodes/
enum {
   setSelfSend       =     256,     /*intranode packet delivery*/
   GetATalkInfo      =     258      /*get AppleTalk information*/
};

Data Types

MPP Parameter Block for PSetSelfSend and PGetAppleTalkInfo

union ParamBlockRec {
   MPPparms       MPP;           /*general MPP parms*/
};

typedef MPPParamBlock *MPPPBPtr;
#define MPPATPHeader \
   QElem          *qLink;        /*reserved*/\
   short          qType;         /*reserved*/\
   short          ioTrap;        /*reserved*/\
   Ptr            ioCmdAddr;     /*reserved*/\
   ProcPtr        ioCompletion;  /*completion routine*/\
   OSErr          ioResult;      /*result code*/\
   long           userData;      /*reserved*/\
   short          reqTID;        /*reserved*/\
   short          ioRefNum;      /*driver reference number*/\
   short          csCode;        /*call command code*/

typedef struct {
   MPPATPHeader
   char     newSelfFlag;         /*self-send toggle flag*/
   char     oldSelfFlag;         /*previous self-send state*/
}SetSelfparms;

typedef struct {
   MPPATPHeader               
   short    version;          /*requested info version*/
   Ptr      varsPtr;          /*pointer to well-known MPP vars*/
   Ptr      DCEPtr;           /*pointer to MPP DCE*/
   short    portID;           /*port number [0..7]*/
   long     configuration;    /*32-bit configuration word*/
   short    selfSend;         /*nonzero if self-send enabled*/
   short    netLo;            /*low value of network range*/
   short    netHi;            /*high value of network range*/
   long     ourAdd;           /*our 24-bit AppleTalk address*/
   long     routerAddr;       /*24-bit address of last router*/
   short    numOfPHs;         /*maximum number of protocol handlers*/
   short    numOfSkts;        /*maximum number of static sockets*/
   short    numNBPEs;         /*maximum number of concurrent NBP requests*/
   Ptr      nTQueue;          /*pointer to registered name queue*/
   short    LAlength;         /*length in bytes of data-link addr*/
   Ptr      linkAddr;         /*data-link address returned*/
   Ptr      zoneName;         /*zone name returned*/
}GetAppleTalkInfoParm;
typedef union {
   MPPparms                   MPP;           /*general MPP parms*/
   SetSelfparms               SETSELF;
   GetAppleTalkInfoParm       GAIINFO;
}MPPParamBlock;
typedef MPPParamBlock *MPPPBPtr;

Routines

Obtaining Information About the .MPP Driver and the Current Network Environment

pascal OSErr PGetAppleTalkInfo
(MPPPBPtr thePBptr,Boolean async); 

Enabling Intranode Delivery of DDP Packets

pascal OSErr PSetSelfSend(MPPPBPtr thePBptr,Boolean async); 

Getting the Addresses of Your Node and Local Internet Router

pascal OSErr GetNodeAddress
(short *myNode,short *myNet); 
pascal short GetBridgeAddress
(void); 

Opening and Closing Drivers

pascal OSErr MPPOpen(void); 
pascal OSErr MPPClose(void); 
pascal Boolean IsMPPOpen(void); 
pascal Boolean IsATPOpen(void);
pascal OSErr OpenXPP(short *xppRefnum); 

Assembly-Language Summary

Constants

Unit Number for the .MPP driver

mppUnitNum     EQU      9         ;MPP unit number
mppRefNum      EQU      -10       ;MPP driver reference number

Command Codes

setSelfSend    EQU      256       ;set to allow writes to self, control call
GetATalkInfo   EQU      258       ;get AppleTalk information, control call

Zone and Router Bits

BadZoneHintBit EQU      7         ;1, if zone hint was found invalid when the
                                  ; .MPP driver was opened
RouterBit      EQU      30        ;1, if this is a router port

MPP Queue Element Standard Structure

;arguments passed in the CSParam area
newSelfFlag    EQU      $1C       ;offset, new value for self-send flag
oldSelfFlag    EQU      $1D       ;old value of self-send flag

GetAppleTalkInfo

GAIVersion     EQU      1        ;highest version for GAI params

Data Structures

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

GetAppleTalkInfo Parameter Variant
16ioResultwordresult code
26csCodewordcommand code; always GetAppleTalkInfo
28versionwordversion of function
30varsPtrlongpointer to the .MPP driver variables
34DCEPtrlongpointer to DCE for the .MPP driver
38portIDwordport number
40configurationlongconfiguration flags
44selfSendwordnonzero if self-send is enabled
46netLowordlow value of network range
48netHiwordhigh value of network range
50ourAddrlonglocal 24-bit AppleTalk address
54routerAddrlong24-bit address of router
58numOfPHswordmaximum number of protocol handlers
60numOfSktswordmaximum number of static sockets
62numNBPEswordmaximum number of concurrent NBP requests
64ntQueuelongpointer to registered names table
68LAlengthwordlength in bytes of data-link address (extended networks only)
70linkAddrlongpointer to data-link address buffer (extended networks only)
74zoneNamelongpointer to zone name buffer

PSetSelfSend
26csCodewordalways setSelfSend
28newSelfFlagbyteflag that turns intranode delivery on or off
29oldSelfFlagbyteflag that reports the previous state of intranode delivery, whether it was on or off
Parameter Variant

Result Codes
noErr0No error
paramErr-50Version number is too high
portInUse-97Driver open error code indicating that the port is in use
portNotCf-98Driver open error code indicating that the parameter RAM is not configured for this connection
noMPPErr-3102The .MPP driver is not installed


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996