- * Compare two RADIUS_PACKET data structures, based on a number
- * of criteria.
- */
-static int request_cmp(const void *one, const void *two)
-{
- int rcode;
- const radclient_t *a = one;
- const radclient_t *b = two;
-
- /*
- * The following code looks unreasonable, but it's
- * the only way to make the comparisons work.
- */
- if (a->request->id < b->request->id) return -1;
- if (a->request->id > b->request->id) return +1;
-
- if (a->request->dst_ipaddr.af < b->request->dst_ipaddr.af) return -1;
- if (a->request->dst_ipaddr.af > b->request->dst_ipaddr.af) return +1;
-
- switch (a->request->dst_ipaddr.af) {
- case AF_INET:
- rcode = memcmp(&a->request->dst_ipaddr.ipaddr.ip4addr,
- &b->request->dst_ipaddr.ipaddr.ip4addr,
- sizeof(a->request->dst_ipaddr.ipaddr.ip4addr));
- break;
- case AF_INET6:
- rcode = memcmp(&a->request->dst_ipaddr.ipaddr.ip6addr,
- &b->request->dst_ipaddr.ipaddr.ip6addr,
- sizeof(a->request->dst_ipaddr.ipaddr.ip6addr));
- break;
- default: /* FIXME: die! */
- return -1;
- break;
- }
- if (rcode != 0) return rcode;
-
- if (a->request->dst_port < b->request->dst_port) return -1;
- if (a->request->dst_port > b->request->dst_port) return +1;
-
- /*
- * Everything's equal. Say so.
- */
- return 0;
-}
-
-/*
- * "Free" a request.