File:  [XINU] / xinu / sys / netin.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:39:02 2018 UTC (8 years, 3 months ago) by root
Branches: xinu, MAIN
CVS tags: xinu-19870308, HEAD
Xinu for VAX

/* netin.c */

#include <conf.h>
#include <kernel.h>
#include <proc.h>
#include <network.h>

/*------------------------------------------------------------------------
 *  netin - initialize net, start output side, and become input daemon
 *------------------------------------------------------------------------
 */
PROCESS	netin(userpid)
int	userpid;			/* user process to resume	*/
{
	register struct	epacket	*packet;
	struct	epacket	*getbuf();
	int	icmpp;

	arpinit();
	netinit();
	icmpp = pcreate(NETFQ);
	resume(create(NETOUT, NETOSTK, NETIPRI-1, NETONAM,
			2, userpid,icmpp));

	for (packet = getbuf(Net.netpool) ; TRUE ;) {
		Net.npacket++;
		if ( read(ETHER,packet,sizeof(*packet)) == SYSERR ) {
			Net.ndrop++;
			continue;
		}
		switch (net2hs(packet->ep_hdr.e_ptype)&LOW16) {

		    case EP_ARP:
			arp_in(packet, ETHER);
			packet = getbuf(Net.netpool);
			break;

		    case EP_RARP:
			rarp_in(packet, ETHER);
			packet = getbuf(Net.netpool);
			break;

		    case EP_IP:
			ip_in(packet, icmpp, NETFQ);
			packet = getbuf(Net.netpool);
			break;

		    default: /* just drop packet */
			Net.ndrop++;
		}
	}
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.