summaryrefslogtreecommitdiff
path: root/protocols/Telegram/src/t_network.h
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2016-03-29 11:06:00 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2016-03-29 11:06:00 +0000
commit91fa723b31fd3cd885d7f3dec8bc9d7e01d3bd41 (patch)
tree150264d0eac649c24635083c722c6a501b7b9a31 /protocols/Telegram/src/t_network.h
parentea09b59973bebba2690c35dd8c252e4fc39a3d2e (diff)
Telegram: netlib network pt. 2
git-svn-id: http://svn.miranda-ng.org/main/trunk@16561 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Telegram/src/t_network.h')
-rw-r--r--protocols/Telegram/src/t_network.h47
1 files changed, 40 insertions, 7 deletions
diff --git a/protocols/Telegram/src/t_network.h b/protocols/Telegram/src/t_network.h
index eaf90ed31d..3859f562e4 100644
--- a/protocols/Telegram/src/t_network.h
+++ b/protocols/Telegram/src/t_network.h
@@ -1,15 +1,48 @@
-struct connection
+enum conn_state {
+ conn_none,
+ conn_connecting,
+ conn_ready,
+ conn_failed,
+ conn_stopped
+};
+
+struct connection : public MZeroedObject
{
- char *ip;
- int port;
- int flags;
+ char *ip;
+ int port;
+ int flags;
enum conn_state state;
- struct mtproto_methods *methods;
- struct tgl_state *TLS;
- struct tgl_session *session;
+ struct mtproto_methods *methods;
+ struct tgl_state *TLS;
+ struct tgl_session *session;
struct tgl_dc *dc;
void *extra;
double last_receive_time;
HANDLE hNetlibConn;
HANDLE ping_timer;
+ HANDLE in_fail_timer;
+
+ struct connection_buffer *in_head;
+ struct connection_buffer *in_tail;
+ struct connection_buffer *out_head;
+ struct connection_buffer *out_tail;
+
+ int in_bytes;
+ int out_bytes;
+ int packet_num;
+ int out_packet_num;
+
+
+ HANDLE ping_ev, fail_ev, write_ev, read_ev;
+
+ time_t last_connect_time;
+
+};
+
+struct connection_buffer {
+ unsigned char *start;
+ unsigned char *end;
+ unsigned char *rptr;
+ unsigned char *wptr;
+ struct connection_buffer *next;
}; \ No newline at end of file