diff options
Diffstat (limited to 'core/util.c')
-rw-r--r-- | core/util.c | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/core/util.c b/core/util.c deleted file mode 100644 index 6f346db1..00000000 --- a/core/util.c +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | /* | ||
2 | * util.c -- Utilities. | ||
3 | * | ||
4 | * This file is donated to the Tox Project. | ||
5 | * Copyright 2013 plutooo | ||
6 | */ | ||
7 | |||
8 | #include <time.h> | ||
9 | #include <stdint.h> | ||
10 | #include <stdbool.h> | ||
11 | |||
12 | #include "DHT.h" | ||
13 | #include "packets.h" | ||
14 | |||
15 | uint64_t now() | ||
16 | { | ||
17 | return time(NULL); | ||
18 | } | ||
19 | |||
20 | uint64_t random_64b() | ||
21 | { | ||
22 | uint64_t r; | ||
23 | |||
24 | // This is probably not random enough? | ||
25 | r = random_int(); | ||
26 | r <<= 32; | ||
27 | r |= random_int(); | ||
28 | |||
29 | return r; | ||
30 | } | ||
31 | |||
32 | bool ipp_eq(IP_Port a, IP_Port b) | ||
33 | { | ||
34 | return (a.ip.i == b.ip.i) && (a.port == b.port); | ||
35 | } | ||
36 | |||
37 | bool id_eq(clientid_t *dest, clientid_t *src) | ||
38 | { | ||
39 | return memcmp(dest, src, sizeof(clientid_t)) == 0; | ||
40 | } | ||
41 | |||
42 | void id_cpy(clientid_t *dest, clientid_t *src) | ||
43 | { | ||
44 | memcpy(dest, src, sizeof(clientid_t)); | ||
45 | } | ||