home *** CD-ROM | disk | FTP | other *** search
- #ifndef lint
- static char *SCCSid = "%W% (NCSA) %G%";
- #endif
- /*
- * atalk.c
- * by Gaige B. Paulsen
- ****************************************************************************
- * *
- * Uses : *
- * TCP/IP kernel for NCSA Telnet *
- * by Tim Krauskopf *
- * with Macintosh code by Gaige B. Paulsen *
- * *
- * National Center for Supercomputing Applications *
- * 152 Computing Applications Building *
- * 605 E. Springfield Ave. *
- * Champaign, IL 61820 *
- * *
- * *
- ****************************************************************************
- *
- * Appletalk init and shutdown (and utility) procs.
- *
- * Called by:
- * dlayer.c
- * mactools.c
- * macutil.c
- */
-
- #include <stdio.h>
-
- #include <AppleTalk.h>
- #include <Dialogs.h>
- #include <Devices.h>
-
- #include "protocol.h"
- #include "configrec.h"
- #include "data.h"
- #include "croft.h"
-
- #include "mpw.h"
- #include "event.h" /* BYU 2.4.15 */
- #include "maclook.h"
- #include "menu.h"
-
- typedef struct {
- char node[26];
- char net[2];
- } ABusVarStruct, *ABusVarPtr, **ABusVarPtrPtr;
-
- extern Listen();
- extern char *KIPnameptr;
- extern int EtherNet; /* BYU 2.4.15 */
-
- void getATaddress
- (
- int *hi,
- int *low,
- int *node
- )
- {
- ABusVarPtr ABusVars;
- ABusVarPtrPtr ABusPtrPtr = (ABusVarPtrPtr) 0x2d8L;
-
- ABusVars = *ABusPtrPtr;
- *hi = ABusVars->net[0];
- *low = ABusVars->net[1];
- *node = ABusVars->node[0];
-
- }
-
- int atopen
- (
- void
- )
- {
- short err;
- short socket=72, refnum; /* BYU 2.4.15 MPW */
- ABusVarPtr ABusVars;
- ABusVarPtrPtr ABusPtrPtr = (ABusVarPtrPtr) 0x2d8L;
- char buffr[100];
- DialogPtr dtemp;
- MPPParamBlock pb;
-
- err = 0;
-
- #ifndef MPW
- err = opendriver("\P.MPP",&refnum);
- #else
- err = OpenDriver("\P.MPP",&refnum);
- #endif MPW
-
- if (err == 0)
- {
- pb.DDPlistener = (Ptr) Listen;
- pb.DDPsocket = socket;
- err=POpenSkt(&pb, FALSE);
- }
- if (err != 0)
- {
- sprintf(buffr,"Failed Appletalk initialization (%d)\015",err); /* BYU 2.4.18 - changed \n to \015 */
- putln(buffr);
- #ifndef MPW
- if (err == -91)
- paramtext(0L, 0L, 0L, "\PCouldn't install Listener");
- else if (err == -97 || err == -98)
- paramtext(0L, 0L, 0L,
- "\PYou forgot to turn on AppleTalk in the Chooser");
- else if (err == -192)
- paramtext(0L, 0L, 0L, "\PCouldn╒t find ╘atpl╒ resource");
- else
- paramtext(0L, 0L, 0L, "\PUnknown Error");
- #else
- if (err == -91)
- paramtext(0L, 0L, 0L, "Couldn't install Listener");
- else if (err == -97 || err == -98)
- paramtext(0L, 0L, 0L,
- "You forgot to turn on AppleTalk in the Chooser");
- else if (err == -192)
- paramtext(0L, 0L, 0L, "Couldn╒t find ╘atpl╒ resource");
- else
- paramtext(0L, 0L, 0L, "Unknown Error");
- #endif MPW
- dtemp = GetNewDialog(302, (Ptr) 0L, (WindowPtr) -1L);
- #if 1 /* BYU 2.4.15 */
- DrawDialog(dtemp); /* BYU 2.4.15 */
- WaitSeconds(5); /* BYU 2.4.15 */
- EtherNet = -100; /* BYU 2.4.15 */
- #else /* BYU 2.4.15 */
- ModalDialog(0L,&item);
- #endif /* BYU 2.4.15 */
- DisposDialog(dtemp);
- /* quit(); /* BYU 2.4.15 */
- }
-
- ABusVars = *ABusPtrPtr;
- nnmyaddr[0] = ABusVars->net[0];
- nnmyaddr[1] = ABusVars->net[1];
- nnmyaddr[2] = ABusVars->node[0];
- nnmyaddr[3] = 72;
-
- sprintf(buffr,"Net : %d, Node : %d",*((unsigned short *)(&(ABusVars->net[0]))),(int)(ABusVars->node[0]));
- putln(buffr);
- return(0);
- }
-
- int atclose
- (
- void
- )
- {
- MPPParamBlock pb;
-
- pb.DDPsocket=72;
- PCloseSkt(&pb, FALSE);
-
- if (KIPnameptr)
- KIPunregister();
-
- return(0);
- }
-