|
|
1.1 ! root 1: /* netout.c - netout */ ! 2: ! 3: #include <conf.h> ! 4: #include <kernel.h> ! 5: #include <network.h> ! 6: #define MNAMLEN 24 /* maximum size of this machine's name */ ! 7: ! 8: /*------------------------------------------------------------------------ ! 9: * netout - start network by finding address and forward IP packets ! 10: *------------------------------------------------------------------------ ! 11: */ ! 12: PROCESS netout(userpid, icmpp) ! 13: int userpid; ! 14: int icmpp; ! 15: { ! 16: struct epacket *packet; ! 17: struct ip *ipptr; ! 18: long tim; ! 19: int len; ! 20: char nam[MNAMLEN]; ! 21: IPaddr addr; ! 22: ! 23: getaddr(addr); ! 24: gettime(&tim); ! 25: getname(nam); ! 26: resume(userpid); ! 27: while (TRUE) { ! 28: packet = (struct epacket *) preceive(icmpp); ! 29: ipptr = (struct ip *) packet->ep_data; ! 30: blkcopy (addr, ipptr->i_dest, IPLEN); ! 31: len = net2hs(ipptr->i_paclen) - IPHLEN; ! 32: ipsend(addr, packet, len); ! 33: } ! 34: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.