mikeoro@hubcap.UUCP (Michael K O'Rourke) (02/23/89)
First, I'd like to thank you for reading this and thank those that have responded to my other questions. You guys are great! Now down to the meat and potatoes. 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. Michael O'Rourke
bob@accuvax.nwu.edu (Bob Hablutzel) (02/24/89)
You know, I had written an answer about this, telling where to look in the documentation and some of the things I learned beating against this problem, bemoaning the fact that there were no examples of this from Apple, when I realized that there _was_ an example from Apple. The eleventh sample app from MACDTS does just this, and I've forwarded it. Thanks for the code, Apple. Bob Hablutzel Wildwood Software BOB@NUACC.ACNS.NWU.EDU
tim@hoptoad.uucp (Tim Maroney) (02/24/89)
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"
matthews@eleazar.dartmouth.edu (Jim Matthews) (02/25/89)
In article <6616@hoptoad.uucp> tim@hoptoad.UUCP (Tim Maroney) writes: > >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 only NBP wildcard for zone names is *, which matches the *current* zone. Thank goodness there's no "all zones" wildcard -- such an internet-wide broadcast would melt down nets like ours (82 AppleTalk zones and counting). The only way to look for an entity in all zones is to use ZIP to get a list of zones (the code was included in Tim's message) and do one NBP lookup for each zone. So it's hard, as it should be. Jim Matthews Dartmouth Software Development
lsr@Apple.com (Larry Rosenstein) (02/25/89)
In article <6616@hoptoad.uucp> tim@hoptoad.uucp (Tim Maroney) writes: > 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 Not true according to Inside AppleTalk & Inside Mac. They both say that wildcards are allowed only on the object and type fields. You can put an asterisk in the zone field to signify the current zone, but you can't use a wildcard to mean all zones. The code that you gave works, provided all the zones fit into 1 response packet, which is definitely not true here (we have over 50 zones). I also don't know why you pin reply.data to a maximum of 8; that should be the number of zones returned. Larry Rosenstein, Apple Computer, Inc. Internet: lsr@Apple.com UUCP: {nsc, sun}!apple!lsr AppleLink: Rosenstein1
jmunkki@kampi.hut.fi (Juri Munkki) (02/25/89)
In article <781@internal.Apple.COM> lsr@Apple.com (Larry Rosenstein) writes: >The code that you gave works, provided all the zones fit into 1 response >packet, which is definitely not true here (we have over 50 zones). I also >don't know why you pin reply.data to a maximum of 8; that should be the >number of zones returned. Would someone kindly post code that works in every possible situation? I might want to use this sometime, when I have the energy to write the distributed mandelbrot calculator that I have been planning. _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ | Juri Munkki jmunkki@hut.fi jmunkki@fingate.bitnet I Want Ne | | Helsinki University of Technology Computing Centre My Own XT | ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^
tim@hoptoad.uucp (Tim Maroney) (02/26/89)
In article <6616@hoptoad.uucp> tim@hoptoad.uucp (Tim Maroney) writes: > 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 In article <781@internal.Apple.COM> lsr@Apple.com (Larry Rosenstein) writes: >Not true according to Inside AppleTalk & Inside Mac. They both say that >wildcards are allowed only on the object and type fields. You can put an >asterisk in the zone field to signify the current zone, but you can't use >a wildcard to mean all zones. Quite right; thanks for the correction. It's been too many months since I did any network programming.... >The code that you gave works, provided all the zones fit into 1 response >packet, which is definitely not true here (we have over 50 zones). I also >don't know why you pin reply.data to a maximum of 8; that should be the >number of zones returned. The code was from a server which was meant to serve at most eight zones. If you have fifty zones, then you would need seven (background) servers. I thought I'd stripped out all the dependencies on that environment, but I guess I missed one. -- Tim Maroney, Consultant, Eclectic Software, sun!hoptoad!tim "I slept with Faith, and found a corpse in my arms on awaking; I drank and danced all night with Doubt, and found her a virgin in the morning." -- Aleister Crowley, THE BOOK OF LIES
lsr@Apple.COM (Larry Rosenstein) (03/01/89)
[Note to Michael O'Rourke: I've tried mailing directly to you several times, but each time the mail is returned because the host 'hubcap' is unknown.] 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. Your assumption is correct. You use the call GetBridgeAddr to find the address of a bridge. Then you send an ATP request to the bridge to find out the list of zones. The ZIP socket is 6. There are 2 relevant ZIP requests: GetZoneList and GetMyZone. Requests are specified entirely within the ATP user bytes. For GetZoneList, the high-order byte is 8, the next byte is 0, and the low order 2 bytes is the index into the list you want. For GetMyZone the user bytes should be $07000000. The response packet will contain a list of zone names packed together as Pascak strings. The ATP user bytes will tell you how many zones are in the packet (low order 2 bytes). For a GetZoneList request, the high order byte will be non-zero if this packet contains the last zone in the list. So you simply make a request to retrieve zone number 1, and get back a bunch of zones. If the last flag is 0 then add the old index (1) to the number of returned zones and make a new request to start at this zone number. If the last flag is non-zero then you got the last zone. Larry Rosenstein, Object Specialist Apple Computer, Inc. 20525 Mariani Ave, MS 46-B Cupertino, CA 95014 AppleLink:Rosenstein1 domain:lsr@Apple.COM UUCP:{sun,voder,nsc,decwrl}!apple!lsr
rmh@apple.com (Rick Holzgrafe) (03/01/89)
One gotcha about getting all zone names that no-one's mentioned: the response packets will be full-size ATP packets, up to the last one which is only as large as it needs to be. I had several hours of frustration because I'd assumed that if I specified a smaller-than-maximum buffer size to ATP, I'd get my responses in suitably-sized packets. Not so: my small buffers did not overflow but the rest of each packet was simply lost. So use a buffer of 578 bytes, the size of a maximum ATP response. ========================================================================== Rick Holzgrafe | {sun,voder,nsc,mtxinu,dual}!apple!rmh Software Engineer | AppleLink HOLZGRAFE1 rmh@apple.com Apple Computer, Inc. | "All opinions expressed are mine, and do 20525 Mariani Ave. MS: 27-O | not necessarily represent those of my Cupertino, CA 95014 | employer, Apple Computer Inc."