third_party/virtualbox/src/VBox/Devices/Network/DevE1000.cpp
/**
 * Matches the packet addresses against Receive Address table. Looks for
 * exact matches only.
 *
 * @returns true if address matches.
 * @param   pThis          Pointer to the state structure.
 * @param   pvBuf           The ethernet packet.
 * @param   cb              Number of bytes available in the packet.
 * @thread  EMT
 */
Matches the packet addresses against Receive Address table. Looks for
exact matches only.

@returns true if address matches.
@param   pThis          Pointer to the state structure.
@param   pvBuf           The ethernet packet.
@param   cb              Number of bytes available in the packet.
@thread  EMT
Matches the packet addresses against Receive Address table . Looks for exact matches only . @returns true if address matches . @param pThis Pointer to the state structure . @param pvBuf The ethernet packet . @param cb Number of bytes available in the packet . @thread EMT
static bool e1kPerfectMatch(PE1KSTATE pThis, const void *pvBuf)
{
    for (unsigned i = 0; i < RT_ELEMENTS(pThis->aRecAddr.array); i++)
    {
        E1KRAELEM* ra = pThis->aRecAddr.array + i;
        if (ra->ctl & RA_CTL_AV)
        {
            Assert((ra->ctl & RA_CTL_AS) < 2);
            if (memcmp((char*)pvBuf + sizeof(ra->addr)*(ra->ctl & RA_CTL_AS),
                ra->addr, sizeof(ra->addr)) == 0)
                return true;
        }
    }
    return false;
}
static bool e1kPerfectMatch ( PE1KSTATE pThis , const void * pvBuf ) { for ( unsigned i = 0 ; i < RT_ELEMENTS ( pThis -> aRecAddr . array ) ; i ++ ) { E1KRAELEM * ra = pThis -> aRecAddr . array + i ; if ( ra -> ctl & RA_CTL_AV ) { Assert ( ( ra -> ctl & RA_CTL_AS ) < 2 ) ; if ( memcmp ( ( char * ) pvBuf + sizeof ( ra -> addr ) * ( ra -> ctl & RA_CTL_AS ) , ra -> addr , sizeof ( ra -> addr ) ) == 0 ) return true ; } } return false ; }
Matches the packet addresses against Receive Address table.
Matches the packet addresses against Receive Address table .
/* Valid address? */ //unsigned char *pAddr = (unsigned char*)pvBuf + sizeof(ra->addr)*(ra->ctl & RA_CTL_AS); //E1kLog3(("%s Matching %02x:%02x:%02x:%02x:%02x:%02x against %02x:%02x:%02x:%02x:%02x:%02x...\n", //         pThis->szPrf, pAddr[0], pAddr[1], pAddr[2], pAddr[3], pAddr[4], pAddr[5], //         ra->addr[0], ra->addr[1], ra->addr[2], ra->addr[3], ra->addr[4], ra->addr[5])); /*
             * Address Select:
             * 00b = Destination address
             * 01b = Source address
             * 10b = Reserved
             * 11b = Reserved
             * Since ethernet header is (DA, SA, len) we can use address
             * select as index.
             */