Projects/1. Router/router.c
int comp_rtable_entry(const void *a, const void *b) {
	struct route_table_entry x = *((struct route_table_entry*) a);
	struct route_table_entry y = *((struct route_table_entry*) b);
	if(ntohl(x.prefix) == ntohl(y.prefix)) {
		return ntohl(x.mask) > ntohl(y.mask);
	}
	return ntohl(x.prefix) > ntohl(y.prefix);
}
/* Compares 2 routing table entries based on prefix and mask */
Compares 2 routing table entries based on prefix and mask
Compares 2 routing table entries based on prefix and mask
int comp_rtable_entry(const void *a, const void *b) {
	struct route_table_entry x = *((struct route_table_entry*) a);
	struct route_table_entry y = *((struct route_table_entry*) b);
	if(ntohl(x.prefix) == ntohl(y.prefix)) {
		return ntohl(x.mask) > ntohl(y.mask);
	}
	return ntohl(x.prefix) > ntohl(y.prefix);
}
int comp_rtable_entry ( const void * a , const void * b ) { struct route_table_entry x = * ( ( struct route_table_entry * ) a ) ; struct route_table_entry y = * ( ( struct route_table_entry * ) b ) ; if ( ntohl ( x . prefix ) == ntohl ( y . prefix ) ) { return ntohl ( x . mask ) > ntohl ( y . mask ) ; } return ntohl ( x . prefix ) > ntohl ( y . prefix ) ; }
Compares 2 routing table entries based on prefix and mask
Compares 2 routing table entries based on prefix and mask