Annotation of xinu/sys/arpfind.c, revision 1.1.1.1

1.1       root        1: /* arpfind.c - arpfind */
                      2: 
                      3: #include <conf.h>
                      4: #include <kernel.h>
                      5: #include <proc.h>
                      6: #include <network.h>
                      7: 
                      8: /*------------------------------------------------------------------------
                      9:  *  arpfind  -  find or insert entry in ARP cache and return its index
                     10:  *------------------------------------------------------------------------
                     11:  */
                     12: arpfind(faddr)
                     13: IPaddr faddr;
                     14: {
                     15:        int     i;
                     16:        int     arindex;
                     17:        struct  arpent  *atabptr;
                     18: 
                     19:        for (arindex=0; arindex<Arp.atabsiz; arindex++) {
                     20:                atabptr = &Arp.arptab[arindex];
                     21:                if (blkequ(atabptr->arp_Iad, faddr, IPLEN)
                     22:                        && atabptr->arp_state != AR_FREE)
                     23:                        return(arindex);
                     24:        }
                     25:        if (Arp.atabsiz < AR_TAB) {
                     26:                Arp.atabsiz++;
                     27:        }
                     28:        arindex = Arp.atabnxt++;
                     29:        if (Arp.atabnxt >= AR_TAB)
                     30:                Arp.atabnxt = 0;
                     31:        atabptr = &Arp.arptab[arindex];
                     32:        atabptr->arp_state = AR_ALLOC;
                     33:        blkcopy(atabptr->arp_Iad, faddr, IPLEN);
                     34:        for(i=0 ; i<EPADLEN ; i++)
                     35:                atabptr->arp_Ead[i] = '\0';
                     36:        atabptr->arp_dev = -1;
                     37:        return(arindex);
                     38: }

unix.superglobalmegacorp.com

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