Digi NS9215 manual Pointer to hash table

Models: NS9215

1 517
Download 517 pages 25.29 Kb
Page 336
Image 336

E T H E R N E T C O M M U N I C A T I O N M O D U L E

Sample hash table code

/*

*Function: void set_hash_bit (BYTE *table, int bit)

*Description:

*

*This routine sets the appropriate bit in the hash table.

*Parameters:

*

 

 

*

table

pointer to hash table

*

bit

position of bit to set

*

 

 

*Return Values:

*none

*/

static void set_hash_bit (BYTE *table, int bit)

{

int byte_index, bit_index;

byte-index = bit >> 3; bit_index = bit & 7;

table [byte_index] = (1 << bit_index);

}

/*

*Function: int calculate_hash_bit (BYTE *mca)

*Description:

*This routine calculates which bit in the CRC hash table needs

*to be set for the MERCURY to recognize incoming packets with

*the MCA passed to us.

*

*Parameters:

*

mca

pointer to multi-cast address

336Hardware Reference NS9215

Page 336
Image 336
Digi NS9215 manual Pointer to hash table