diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-01-13 18:59:58 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-01-14 19:12:28 +0000 |
commit | eda6470f0edb1bf21ee039894604e1742fdbc7e3 (patch) | |
tree | 896c6ac8ffd1eed818bc8c692d644c03874eac3f /toxcore/friend_connection.c | |
parent | c28d362dd238aefdafe16711dc3645e73b113c21 (diff) |
Make Friend_Connections a module-private type.
Diffstat (limited to 'toxcore/friend_connection.c')
-rw-r--r-- | toxcore/friend_connection.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/toxcore/friend_connection.c b/toxcore/friend_connection.c index 3f9d79c1..41fef426 100644 --- a/toxcore/friend_connection.c +++ b/toxcore/friend_connection.c | |||
@@ -31,6 +31,63 @@ | |||
31 | 31 | ||
32 | #define PORTS_PER_DISCOVERY 10 | 32 | #define PORTS_PER_DISCOVERY 10 |
33 | 33 | ||
34 | typedef struct { | ||
35 | uint8_t status; | ||
36 | |||
37 | uint8_t real_public_key[CRYPTO_PUBLIC_KEY_SIZE]; | ||
38 | uint8_t dht_temp_pk[CRYPTO_PUBLIC_KEY_SIZE]; | ||
39 | uint16_t dht_lock; | ||
40 | IP_Port dht_ip_port; | ||
41 | uint64_t dht_pk_lastrecv, dht_ip_port_lastrecv; | ||
42 | |||
43 | int onion_friendnum; | ||
44 | int crypt_connection_id; | ||
45 | |||
46 | uint64_t ping_lastrecv, ping_lastsent; | ||
47 | uint64_t share_relays_lastsent; | ||
48 | |||
49 | struct { | ||
50 | int (*status_callback)(void *object, int id, uint8_t status, void *userdata); | ||
51 | int (*data_callback)(void *object, int id, const uint8_t *data, uint16_t length, void *userdata); | ||
52 | int (*lossy_data_callback)(void *object, int id, const uint8_t *data, uint16_t length, void *userdata); | ||
53 | |||
54 | void *callback_object; | ||
55 | int callback_id; | ||
56 | } callbacks[MAX_FRIEND_CONNECTION_CALLBACKS]; | ||
57 | |||
58 | uint16_t lock_count; | ||
59 | |||
60 | Node_format tcp_relays[FRIEND_MAX_STORED_TCP_RELAYS]; | ||
61 | uint16_t tcp_relay_counter; | ||
62 | |||
63 | bool hosting_tcp_relay; | ||
64 | } Friend_Conn; | ||
65 | |||
66 | |||
67 | struct Friend_Connections { | ||
68 | Net_Crypto *net_crypto; | ||
69 | DHT *dht; | ||
70 | Onion_Client *onion_c; | ||
71 | |||
72 | Friend_Conn *conns; | ||
73 | uint32_t num_cons; | ||
74 | |||
75 | int (*fr_request_callback)(void *object, const uint8_t *source_pubkey, const uint8_t *data, uint16_t len, | ||
76 | void *userdata); | ||
77 | void *fr_request_object; | ||
78 | |||
79 | uint64_t last_LANdiscovery; | ||
80 | uint16_t next_LANport; | ||
81 | |||
82 | bool local_discovery_enabled; | ||
83 | }; | ||
84 | |||
85 | Net_Crypto *friendconn_net_crypto(const Friend_Connections *fr_c) | ||
86 | { | ||
87 | return fr_c->net_crypto; | ||
88 | } | ||
89 | |||
90 | |||
34 | /* return 1 if the friendcon_id is not valid. | 91 | /* return 1 if the friendcon_id is not valid. |
35 | * return 0 if the friendcon_id is valid. | 92 | * return 0 if the friendcon_id is valid. |
36 | */ | 93 | */ |