Commit 4d129353 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Implement hash_id.

parent 9abe7c66
......@@ -58,6 +58,16 @@ struct buffered_update buffered_updates[MAX_BUFFERED_UPDATES];
struct network *update_net = NULL;
int updates = 0;
unsigned short
hash_id(const unsigned char *id)
{
int i;
unsigned short hash = 0;
for(i = 0; i < 8; i++)
hash ^= (id[2 * i] << 8) | id[2 * i + 1];
return hash;
}
void
parse_packet(const unsigned char *from, struct network *net,
const unsigned char *packet, int len)
......
......@@ -35,6 +35,7 @@ extern int split_horizon;
extern struct timeval update_flush_time;
extern const unsigned char packet_header[8];
unsigned short hash_id(const unsigned char *id) ATTRIBUTE ((pure));
void parse_packet(const unsigned char *from, struct network *net,
const unsigned char *packet, int len);
void flushbuf(struct network *net);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment