gateway@a.darpa.mil (08/18/89)
The following message was not delivered because of the following error: -0900-Not a valid user ----------------------- Original Message ----------------------- >From {tjh+atalk.errors@andrew.cmu.edu} Thu Aug 17 17:39:18 1989 Received: from ANDREW.CMU.EDU by a.darpa.mil (5.61/5.61) id AA27036; Thu, 17 Aug 89 17:38:29 -0500 Received: by andrew.cmu.edu (5.54/3.15) id <AA06967>; Thu, 17 Aug 89 16:55:37 EDT Received: via switchmail for info-appletalk+@andrew.cmu.edu; Thu, 17 Aug 89 16:55:35 -0400 (EDT) Received: from po3.andrew.cmu.edu via qmail ID </afs/andrew.cmu.edu/service/mailqs/q006/QF.oYumLqm00UkT8Ln04H>; Thu, 17 Aug 89 16:54:17 -0400 (EDT) Received: from ucbvax.Berkeley.EDU by po3.andrew.cmu.edu (5.54/3.15) id <AA06087> for info-appletalk; Thu, 17 Aug 89 16:53:59 EDT Received: by ucbvax.Berkeley.EDU (5.61/1.37) id AA13864; Thu, 17 Aug 89 13:51:32 -0700 Received: from USENET by ucbvax.Berkeley.EDU with netnews for info-appletalk@andrew.cmu.edu (info-appletalk@andrew.cmu.edu) (contact usenet@ucbvax.Berkeley.EDU if you have questions) Date: 17 Aug 89 20:45:20 GMT From: {mailrus!cwjcc!alpha.ces.cwru.edu!edvax@tut.cis.ohio-state.edu} (Edward Reznichenko) Organization: CWRU Dept of Computer Engineering and Science Subject: Beginner in Appletalk (looking for servers) Message-Id: <482@cwjcc.CWRU.Edu> Sender: {info-appletalk-request@andrew.cmu.edu} To: info-appletalk@andrew.cmu.edu [This is being posted for a friend. I have no knowledge of appletalk] [reply to edvax@alpha.ces.cwru.edu and I'll forward it] This is a first try at a appletalk program to find servers on a net It is crude at best, and entirely nonfunctional. I need your help in finding out why this won't work. it was compiled using lightspeed C. Any and all advice would be appreciated. #include <stdio.h> #include <nAppleTalk.h> #include <MacTypes.h> #include <DeviceMgr.h> #include <MemoryMgr.h> #include <pascal.h> #include <string.h> #define NIL 0L MPPParamBlock *myMPPParamBlockPtr; short *myMPPRefnum; short *myXPPRefnum; EntityName *myEntityNamePtr; char *myRetBufPtr; Boolean async; OSErr errorCode; main() { InitMacintosh(); InitOurVariables(); AllocateThePointers(); OpenOurDrivers(); SetupOurEntity(); SetupMPP(); LookUpNames(); PrintResult(); } /* Concievably, this opens the drivers and checks and configures the */ /* ports. This is lifted directly from a Mac tech note. */ OpenOurDrivers() { errorCode = OpenDriver("\p.MPP", myMPPRefnum); printf("OpenDriver Result "); printf("%d\n",errorCode); printf("MPPOpen Refnum "); printf("%d\n",*myMPPRefnum); errorCode = OpenDriver("\p.XPP", myXPPRefnum); printf("OpenDriver Result "); printf("%d\n",errorCode); printf("XPPOpen Refnum "); printf("%d\n",*myXPPRefnum); } /* This is from the Mac Programmers Primer, I do it here for */ /* consistency */ InitMacintosh() { MaxApplZone(); InitGraf(&thePort); InitFonts(); FlushEvents(everyEvent, 0); InitWindows(); InitMenus(); TEInit(); InitDialogs(NIL); InitCursor(); } /* This configures the MPP data structure for the Preferred */ /* Appletalk Call, The references in Inside Mac are kind of vague */ SetupMPP() { myMPPParamBlockPtr->MPP.NBP.NBP1.NBP2.maxToGet = 100; myMPPParamBlockPtr->MPP.NBP.interval = 8; myMPPParamBlockPtr->MPP.NBP.entityPtr = (Ptr)myEntityNamePtr; myMPPParamBlockPtr->MPP.NBP.count = 3; myMPPParamBlockPtr->MPP.NBP.NBP1.NBP2.retBuffPtr = myRetBufPtr; myMPPParamBlockPtr->MPP.NBP.NBP1.NBP2.retBuffSize = 1000; myMPPParamBlockPtr->MPP.NBP.NBP1.NBP2.numGotten = 0; myMPPParamBlockPtr->MPP.DDP.listener = NIL; myMPPParamBlockPtr->ioCompletion = NIL; myMPPParamBlockPtr->MPP.LAP.LAP1.handler = NIL; myMPPParamBlockPtr->MPP.LAP.LAP1.wdsPointer = NIL; } InitOurVariables() { myMPPRefnum = NIL; myXPPRefnum = NIL; myMPPParamBlockPtr = NIL; myEntityNamePtr = NIL; myRetBufPtr = NIL; async = FALSE; } /* I used NewPtr to allocate */ /* a non relocatable block of memory */ AllocateThePointers() { myMPPParamBlockPtr = (MPPParamBlock *)NewPtr(sizeof(MPPParamBlock)); myEntityNamePtr = (EntityName *)NewPtr(sizeof(EntityName)); myRetBufPtr = (char *)NewPtr(1000); } /* this is the preffered command to set up the entity I am searching for */ /* the '\p' may or may not be necessary ... tune in later */ SetupOurEntity() { NBPSetEntity(myEntityNamePtr,"\p=","\p=","\p*"); } /* this one should put the entities matching the search pattern in */ /* myEntityNamePtr into the buffer pointed to by MyRetBufPtr */ /* it doesn't work, I always get an empty buffer and zero matches */ LookUpNames() { errorCode = PLookupName(myMPPParamBlockPtr,async); printf("PLookupName Result "); printf("%d\n",errorCode); } /* Here is where I find out I have failed in my task */ PrintResult() { printf("ioRefNum test "); printf("%d\n",myMPPParamBlockPtr->ioRefNum); printf("Matches Gotten "); printf("%d\n",myMPPParamBlockPtr->MPP.NBP.NBP1.NBP2.numGotten); printf("Result Buffer "); PtoCstr(myRetBufPtr); printf("%s\n",myRetBufPtr); } ---------------------------------------------- Time travel is so dangerous it makes H-bombs seem like perfectly safe gifts for children and imbeciles.