home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GRIPS 2: Government Rast…rocessing Software & Data
/
GRIPS_2.cdr
/
dos
/
ncsa_tel
/
contribu
/
byu_tel2.hqx
/
tcpip
/
fastnet.c
< prev
next >
Wrap
Text File
|
1988-07-15
|
3KB
|
126 lines
#ifndef lint
static char *SCCSid = "%W% (NCSA) %G%";
#endif
/*
* fastnet.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 *
* *
* *
****************************************************************************
*
* FastNet init and shutdown (and utility) procs.
*
* Called by:
* ether.c
* mactools.c
* macutil.c
*/
#include "stdio.h"
#include "protocol.h"
#include "data.h"
#include "BoxLayer.h"
extern char nodeAddress[];
FNdlayersend(ptr,size) /*MAC: replaced */
DLAYER *ptr;
unsigned size;
{
if (size<60) size=60;
DoBoxDataSend( ptr, size);
return(0);
}
/**********************************************************************/
/* FNdemux - FastNet Version of DEMUX routine
*
* returns the number of packets demuxed
*/
FNdemux(all)
int all;
{
unsigned getcode;
int nmuxed,sizered;
typedef struct peek {
unsigned char dest[DADDLEN],
me[DADDLEN];
unsigned type;
} Dpeek;
Dpeek *firstlook;
nmuxed = 0;
do { /* while all flag is on */
if (DoBoxDataRequest(bufinfo.buforg)) { /*MAC*/
nmuxed++;
firstlook = bufinfo.buforg; /*MAC where packet is */
getcode = firstlook->type; /* where does it belong? */
switch (getcode) { /* what to do with it? */
case EARP:
case ERARP:
arpinterpret(firstlook->dest); /* handle [R]ARP packet */
break;
case EIP:
ipinterpret(firstlook->dest); /* handle IP packet */
break;
default:
break;
}
}
else
all = 0;
} while (all); /* should we look for more to deal with? */
return(nmuxed); /* no packets anymore */
}
FNopen()
{
DataLinkData lanceData;
char buffer[1500];
int i;
getFNaddress(&lanceData.physicalAddress[0]);
/* Initialize address globals (DEC and EtherNet forms) */
lanceData.promiscuousEnable=0;
/* movmem(nodeAddress, &lanceData.physicalAddress[0],6); */
lanceData.protocolCount=3;
lanceData.protocolType[0]=0x0800; /*IP */
lanceData.protocolType[1]=0x0806; /*ARP */
lanceData.protocolType[2]=0x8035; /*RARP*/
lanceData.multicastCount=0;
lanceData.broadcastEnable=1;
DoBoxCommand(&lanceData,sizeof(DataLinkData));
getFNaddress( nnmyaddr);
return(0);
}
getFNaddress( p)
char *p;
{
DoBoxAddrRequest( p);
}
FNclose()
{
}