… | |
… | |
192 | u32 oseqno; |
192 | u32 oseqno; |
193 | sliding_window iseqno; |
193 | sliding_window iseqno; |
194 | |
194 | |
195 | u8 protocol; |
195 | u8 protocol; |
196 | u8 features; |
196 | u8 features; |
197 | bool is_direct; // current connection (si) is direct? |
|
|
198 | |
197 | |
199 | pkt_queue data_queue, vpn_queue; |
198 | pkt_queue data_queue, vpn_queue; |
200 | |
199 | |
201 | crypto_ctx *octx, *ictx; |
200 | crypto_ctx *octx, *ictx; |
202 | iv_gen oiv; // generator for random byte prefix |
201 | iv_gen oiv; // generator for random byte prefix |
203 | |
202 | |
204 | void generate_auth_data (); |
203 | void generate_auth_data (); |
205 | |
204 | |
206 | ev_tstamp auth_expire; // when the snd_* and *_ecdh values expire |
205 | ev_tstamp auth_expire; // when the snd_* and *_ecdh values expire |
|
|
206 | ev_tstamp hmac_error; // time of first hmac error in a series |
207 | |
207 | |
208 | // send auth data - used for octx |
208 | // send auth data - used for octx |
209 | auth_data snd_auth; |
209 | auth_data snd_auth; |
210 | ecdh_key snd_ecdh_a; // the secret ecdh key we used for our request |
210 | ecdh_key snd_ecdh_a; // the secret ecdh key we used for our request |
211 | ecdh_key snd_ecdh_b; // the public ecdh key we received in the response |
211 | ecdh_key snd_ecdh_b; // the public ecdh key we received in the response |
… | |
… | |
227 | void reset_si (); |
227 | void reset_si (); |
228 | const sockinfo &forward_si (const sockinfo &si) const; |
228 | const sockinfo &forward_si (const sockinfo &si) const; |
229 | |
229 | |
230 | void shutdown (); |
230 | void shutdown (); |
231 | void connection_established (const sockinfo &rsi); |
231 | void connection_established (const sockinfo &rsi); |
232 | void reset_connection (); |
232 | void reset_connection (const char *reason); |
233 | |
233 | |
234 | void establish_connection_cb (ev::timer &w, int revents); ev::timer establish_connection; |
234 | void establish_connection_cb (ev::timer &w, int revents); ev::timer establish_connection; |
235 | void rekey_cb (ev::timer &w, int revents); ev::timer rekey; // next rekying (actually current reset + reestablishing) |
235 | void rekey_cb (ev::timer &w, int revents); ev::timer rekey; // next rekeying (actually current reset + reestablishing) |
236 | void keepalive_cb (ev::timer &w, int revents); ev::timer keepalive; // next keepalive probe |
236 | void keepalive_cb (ev::timer &w, int revents); ev::timer keepalive; // next keepalive probe |
237 | |
237 | |
238 | void send_connect_request (int id); |
238 | void send_connect_request (int id); |
239 | void send_auth_request (const sockinfo &si, bool initiate); |
239 | void send_auth_request (const sockinfo &si, bool initiate); |
240 | void send_auth_response (const sockinfo &si); |
240 | void send_auth_response (const sockinfo &si); |