rajiv@ur-valhalla.UUCP (Rajiv Arora) (11/25/86)
Hi all. I have a question for those of you who have used the Appletalk Manager calls from Aztec 'C'. I'm trying to use the AB Link Access Protocol in my application and can't for the life of me get the function LAPOpenProtocol () to work. I was wondering if any of you had had the same problem and knew of a fix. Shown below is the code illustrating the problem: #include <stdio.h> #include <appletalk.h> #include <syserr.h> main () { OSErr errcode; pascal OSErr MPPopen (); pascal OSErr LAPOpenProtocol (); ABByte myLAPType; /* ABByte is typedefed as "unsigned char" and Ptr as Ptr myprotoptr; "char *" in appletalk.h */ if ((errcode = MPPOpen ()) != noErr) { printf ("error opening MPP\n"); printf ("errorcode = %d\n"); } else { myLAPType = 53; /* arbitrary protocol number */ myprotoptr = NULL; if ((errcode = LAPOpenProtocol (myLAPType, myprotoptr)) != noErr) { printf ("error opening protocol\n"); printf ("errorcode = %d\n); } } } The problem is that LAPOpenProtocol always returns with errorcode -94, which indicates that either myLAPType (= 53) is out of range, already present in the protocol handler table, or that the protocol table is full. Since the table can have upto 4 entries, and only two are used by DDP (i.e. LAP types 1 and 2), the last should not be the case. The other two possibilities also seem unlikely. Any suggestions/comments/help would be greatly appreciated. Rajiv Arora -- UUCP: {seismo,cmc12,columbia,cornell,harvard, ll-xn,nike,topaz}!rochester!ur-valhalla!rajiv ARPA: ur-valhalla!rajiv@rochester.arpa
rajiv@ur-valhalla.UUCP (Rajiv Arora) (11/26/86)
In article <864@ur-valhalla.UUCP> I write: > >Hi all. > >I have a question for those of you who have used the Appletalk Manager >calls from Aztec 'C'. I'm trying to use the AB Link Access Protocol in >my application and can't for the life of me get the function >LAPOpenProtocol () to work. I was wondering if any of you had had the >same problem and knew of a fix. Shown below is the code illustrating >the problem: > > [Buggy Program] Here is the corrected code (sorry 'bout that): #include <stdio.h> #include <appletalk.h> #include <syserr.h> main () { OSErr errcode; pascal OSErr MPPopen (); pascal OSErr LAPOpenProtocol (); ABByte myLAPType; /* ABByte is typedefed as "unsigned char" and Ptr as "char *" in appletalk.h */ Ptr myprotoptr; if ((errcode = MPPOpen ()) != noErr) { printf ("error opening MPP\n"); printf ("errorcode = %d\n", errcode); } else { myLAPType = 53; /* arbitrary protocol number */ myprotoptr = NULL; if ((errcode = LAPOpenProtocol (myLAPType, myprotoptr)) != noErr) { printf ("error opening protocol\n"); printf ("errorcode = %d\n", errcode); } } } The problem is that LAPOpenProtocol always returns with errorcode -94, which indicates that either myLAPType (= 53) is out of range, already present in the protocol handler table, or that the protocol table is full. Since the table can have upto 4 entries, and only two are used by DDP (i.e. LAP types 1 and 2), the last should not be the case. The other two possibilities also seem unlikely. Any suggestions/comments/help would be greatly appreciated. Rajiv Arora -- UUCP: {seismo,cmc12,columbia,cornell,harvard, ll-xn,nike,topaz}!rochester!ur-valhalla!rajiv ARPA: ur-valhalla!rajiv@rochester.arpa