ucspi-ssl
0.99e
TLS encryption for IPv6 communication
ucspi-ssl-0.99e
src
dns_sortip.c
Go to the documentation of this file.
1
#include "
byte.h
"
2
#include "
dns.h
"
3
4
/* XXX: sort servers by configurable notion of closeness? */
5
/* XXX: pay attention to competence of each server? */
6
7
void
dns_sortip
(
char
*s,
unsigned
int
n)
8
{
9
unsigned
int
i;
10
char
tmp[4];
11
12
n >>= 2;
13
while
(n > 1) {
14
i =
dns_random
(n);
15
--n;
16
byte_copy
(tmp,4,s + (i << 2));
17
byte_copy
(s + (i << 2),4,s + (n << 2));
18
byte_copy
(s + (n << 2),4,tmp);
19
}
20
}
byte_copy
void byte_copy(void *, unsigned int, const void *)
dns_sortip
void dns_sortip(char *s, unsigned int n)
Definition:
dns_sortip.c:7
byte.h
dns_random
unsigned int dns_random(unsigned int)
Definition:
dns_random.c:52
dns.h
Generated on Wed Jul 11 2018 22:50:46 for ucspi-ssl by
1.8.13