Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cwjcc!tut.cis.ohio-state.edu!ucbvax!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: comp.sys.mac.programmer Subject: Re: AppleTalk ZIP Protocol Message-ID: <6616@hoptoad.uucp> Date: 24 Feb 89 15:52:57 GMT References: <4516@hubcap.UUCP> Reply-To: tim@hoptoad.UUCP (Tim Maroney) Organization: Eclectic Software, San Francisco Lines: 88 In article <4516@hubcap.UUCP> mikeoro@hubcap.UUCP (Michael K O'Rourke) writes: > >Is there anyone out there that has used the ZIP protocol in AppleTalk to >transfer packets between networks? I use NBP but it doesn't give me the names >of other networks/zones. So, from my understanding I have to use ZIP to get >other zone names and then use NBP to look for users in those zones. NBP names have a zones field; if you put a wildcard in this field, then the bridges will take care of sending your request to all zones and returning all answers from those zones to you. The chances are that you don't have to use ZIP directly at all. If you do, though, here is some example code showing how to get the list of zones from your Mac's current bridge. char zones[256]; /* storage for zone list */ ATPparam atp; /* zone information lookup */ ATPbds bds; /* zone information reply */ ZIPpkt request, reply; /* ZIP packets for ATP */ AddrBlock zipBridge; /* where to send ZIP request */ /* get the bridge address */ zipBridge.aNet = 0; zipBridge.aSocket = 6; zipBridge.aNode = ATbridge(); /* send the get zone list request */ request.command = 8; request.netcount = 0; request.data = 1; BlockMove(&request, &atp.userData, 4); atp.csCode = sendRequest; atp.flags = sendChk; atp.address = zipBridge; atp.reqLength = 0; atp.reqPointer = 0; atp.bdsPointer = &bds; atp.numOfBuffs = 1; atp.timeOutVal = 1; atp.arg.request.retryCount = 3; bds.size = 256; bds.buffer = zones; atp.ioRefNum = atpRefNum; PBControl(&atp, false); if (atp.ioResult) return false; BlockMove(&bds.user, &reply, 4); if (reply.data <= 0) return false; if (reply.data > 8) reply.data = 8; "zones" now contains a list of concatenated zone names in pascal string format. Here are a couple of utility routines bearing on this: /* Appletalk globals */ typedef struct { byte sysLAPAddr; byte RHA[24]; byte sysABridge; word sysNetNum; word vSCCEnable; /* atpVars */ } ABusVarStruct; #define ABusVars (*(ABusVarStruct **)0x2d8) void ATaddress(myNode,myNet) word *myNode,*myNet; { *myNode = ABusVars->sysLAPAddr; *myNet = ABusVars->sysNetNum; } ATbridge() { return ABusVars->sysABridge; } and ZIPpkt is defined as typedef struct { unsigned char command; unsigned char netcount; unsigned short data; } ZIPpkt; -- Tim Maroney, Consultant, Eclectic Software, sun!hoptoad!tim "Prisons are built with stones of Law, Brothels with bricks of Religion." - Blake, "The Marriage of Heaven and Hell"