summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--toxcore/DHT.c24
-rw-r--r--toxcore/DHT.h6
-rw-r--r--toxcore/onion.c2
3 files changed, 0 insertions, 32 deletions
diff --git a/toxcore/DHT.c b/toxcore/DHT.c
index eb1e1a5e..a4b97fb8 100644
--- a/toxcore/DHT.c
+++ b/toxcore/DHT.c
@@ -256,30 +256,6 @@ int handle_request(const uint8_t *self_public_key, const uint8_t *self_secret_ke
256 return len1; 256 return len1;
257} 257}
258 258
259void to_net_family(IP *ip)
260{
261 if (ip->family == TOX_AF_INET) {
262 ip->family = TOX_AF_INET;
263 } else if (ip->family == TOX_AF_INET6) {
264 ip->family = TOX_AF_INET6;
265 }
266}
267
268int to_host_family(IP *ip)
269{
270 if (ip->family == TOX_AF_INET) {
271 ip->family = TOX_AF_INET;
272 return 0;
273 }
274
275 if (ip->family == TOX_AF_INET6) {
276 ip->family = TOX_AF_INET6;
277 return 0;
278 }
279
280 return -1;
281}
282
283#define PACKED_NODE_SIZE_IP4 (1 + SIZE_IP4 + sizeof(uint16_t) + CRYPTO_PUBLIC_KEY_SIZE) 259#define PACKED_NODE_SIZE_IP4 (1 + SIZE_IP4 + sizeof(uint16_t) + CRYPTO_PUBLIC_KEY_SIZE)
284#define PACKED_NODE_SIZE_IP6 (1 + SIZE_IP6 + sizeof(uint16_t) + CRYPTO_PUBLIC_KEY_SIZE) 260#define PACKED_NODE_SIZE_IP6 (1 + SIZE_IP6 + sizeof(uint16_t) + CRYPTO_PUBLIC_KEY_SIZE)
285 261
diff --git a/toxcore/DHT.h b/toxcore/DHT.h
index edba0ad4..510b3c5c 100644
--- a/toxcore/DHT.h
+++ b/toxcore/DHT.h
@@ -89,12 +89,6 @@ int create_request(const uint8_t *send_public_key, const uint8_t *send_secret_ke
89int handle_request(const uint8_t *self_public_key, const uint8_t *self_secret_key, uint8_t *public_key, uint8_t *data, 89int handle_request(const uint8_t *self_public_key, const uint8_t *self_secret_key, uint8_t *public_key, uint8_t *data,
90 uint8_t *request_id, const uint8_t *packet, uint16_t length); 90 uint8_t *request_id, const uint8_t *packet, uint16_t length);
91 91
92/* Functions to transfer ips safely across wire. */
93void to_net_family(IP *ip);
94
95/* return 0 on success, -1 on failure. */
96int to_host_family(IP *ip);
97
98typedef struct { 92typedef struct {
99 IP_Port ip_port; 93 IP_Port ip_port;
100 uint64_t timestamp; 94 uint64_t timestamp;
diff --git a/toxcore/onion.c b/toxcore/onion.c
index 805770fa..fbaf7205 100644
--- a/toxcore/onion.c
+++ b/toxcore/onion.c
@@ -51,8 +51,6 @@ static void change_symmetric_key(Onion *onion)
51/* packing and unpacking functions */ 51/* packing and unpacking functions */
52static void ip_pack(uint8_t *data, IP source) 52static void ip_pack(uint8_t *data, IP source)
53{ 53{
54 to_net_family(&source);
55
56 data[0] = source.family; 54 data[0] = source.family;
57 55
58 if (source.family == TOX_AF_INET || source.family == TOX_TCP_INET) { 56 if (source.family == TOX_AF_INET || source.family == TOX_TCP_INET) {