Mercurial > pidgin
annotate plugins/icq/tcplink.h @ 2065:391440022697
[gaim-migrate @ 2075]
minor one-time leak
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Tue, 03 Jul 2001 19:08:48 +0000 |
parents | 7b3f1eb1ef7d |
children |
rev | line source |
---|---|
1152 | 1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
1912
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1498
diff
changeset
|
2 |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1498
diff
changeset
|
3 /* |
1977
7b3f1eb1ef7d
[gaim-migrate @ 1987]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1912
diff
changeset
|
4 * $Id: tcplink.h 1987 2001-06-09 14:46:51Z warmenhoven $ |
7b3f1eb1ef7d
[gaim-migrate @ 1987]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1912
diff
changeset
|
5 * |
1912
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1498
diff
changeset
|
6 * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1498
diff
changeset
|
7 * Bill Soudan <soudan@kde.org> |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1498
diff
changeset
|
8 * |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1498
diff
changeset
|
9 * This program is free software; you can redistribute it and/or modify |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1498
diff
changeset
|
10 * it under the terms of the GNU General Public License as published by |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1498
diff
changeset
|
11 * the Free Software Foundation; either version 2 of the License, or |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1498
diff
changeset
|
12 * (at your option) any later version. |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1498
diff
changeset
|
13 * |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1498
diff
changeset
|
14 * This program is distributed in the hope that it will be useful, |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1498
diff
changeset
|
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1498
diff
changeset
|
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1498
diff
changeset
|
17 * GNU General Public License for more details. |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1498
diff
changeset
|
18 * |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1498
diff
changeset
|
19 * You should have received a copy of the GNU General Public License |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1498
diff
changeset
|
20 * along with this program; if not, write to the Free Software |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1498
diff
changeset
|
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1498
diff
changeset
|
22 * |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1498
diff
changeset
|
23 */ |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1498
diff
changeset
|
24 |
1152 | 25 #ifndef _TCP_LINK_H_ |
26 #define _TCP_LINK_H_ | |
27 | |
28 #ifdef HAVE_CONFIG_H | |
29 #include <config.h> | |
30 #endif | |
31 | |
32 #ifdef _WIN32 | |
33 #include <winsock.h> | |
34 #else | |
1348 | 35 #include <sys/socket.h> |
1152 | 36 #include <netinet/in.h> |
37 #endif | |
38 | |
39 #include "icq.h" | |
40 #include "icqpacket.h" | |
1498
0ef6603d986e
[gaim-migrate @ 1508]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1432
diff
changeset
|
41 #include "timeout.h" |
1152 | 42 |
43 /* link mode bitfield values */ | |
44 #define TCP_LINK_MODE_RAW 1 | |
45 #define TCP_LINK_MODE_HELLOWAIT 2 | |
46 #define TCP_LINK_MODE_LISTEN 4 | |
47 #define TCP_LINK_MODE_CONNECTING 8 | |
48 #define TCP_LINK_SOCKS_CONNECTING 16 | |
49 #define TCP_LINK_SOCKS_AUTHORIZATION 32 | |
50 #define TCP_LINK_SOCKS_AUTHSTATUS 64 | |
51 #define TCP_LINK_SOCKS_NOAUTHSTATUS 128 | |
52 #define TCP_LINK_SOCKS_CROSSCONNECT 256 | |
53 #define TCP_LINK_SOCKS_CONNSTATUS 512 | |
54 | |
55 /* link types */ | |
56 #define TCP_LINK_MESSAGE 1 | |
57 #define TCP_LINK_CHAT 2 | |
58 #define TCP_LINK_FILE 3 | |
59 | |
60 #define icq_TCPLinkBufferSize 4096 | |
61 #define TCP_LINK_CONNECT_TIMEOUT 30 | |
62 | |
1432
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1348
diff
changeset
|
63 struct icq_TCPLink_s { |
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1348
diff
changeset
|
64 |
1152 | 65 /* icq_TCPLink ICQLINK, type, mode, and session */ |
1912
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1498
diff
changeset
|
66 icq_Link *icqlink; |
1152 | 67 int type; |
68 int mode; | |
69 int proxy_status; | |
70 void *session; | |
71 | |
72 /* socket parameters */ | |
73 int socket; | |
74 struct sockaddr_in socket_address; | |
75 struct sockaddr_in remote_address; | |
76 | |
77 /* data buffer for receive calls */ | |
78 char buffer[icq_TCPLinkBufferSize]; | |
79 int buffer_count; | |
80 | |
81 /* packet queues */ | |
1912
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1498
diff
changeset
|
82 icq_List *received_queue; |
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1498
diff
changeset
|
83 icq_List *send_queue; |
1152 | 84 |
85 /* icq specific data, initialized by hello packet */ | |
86 unsigned long id; | |
87 unsigned long remote_version; | |
88 unsigned long remote_uin; | |
89 char flags; | |
90 | |
1498
0ef6603d986e
[gaim-migrate @ 1508]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1432
diff
changeset
|
91 /* timeout for connect operation */ |
0ef6603d986e
[gaim-migrate @ 1508]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1432
diff
changeset
|
92 icq_Timeout *connect_timeout; |
1152 | 93 |
1432
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1348
diff
changeset
|
94 }; |
1152 | 95 |
1912
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1498
diff
changeset
|
96 icq_TCPLink *icq_TCPLinkNew(icq_Link *icqlink); |
1152 | 97 void icq_TCPLinkDelete(void *p); |
98 void icq_TCPLinkClose(icq_TCPLink *p); | |
1912
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1498
diff
changeset
|
99 void icq_TCPLinkNodeDelete(icq_ListNode *p); |
1152 | 100 |
101 int icq_TCPLinkConnect(icq_TCPLink *plink, DWORD uin, int port); | |
102 icq_TCPLink *icq_TCPLinkAccept(icq_TCPLink *plink); | |
103 int icq_TCPLinkListen(icq_TCPLink *plink); | |
104 | |
1432
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1348
diff
changeset
|
105 void icq_TCPLinkOnDataReceived(icq_TCPLink *plink); |
1152 | 106 void icq_TCPLinkOnPacketReceived(icq_TCPLink *plink, icq_Packet *p); |
107 void icq_TCPLinkOnConnect(icq_TCPLink *plink); | |
1498
0ef6603d986e
[gaim-migrate @ 1508]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1432
diff
changeset
|
108 void icq_TCPLinkOnConnectTimeout(icq_TCPLink *plink); |
1152 | 109 |
110 unsigned long icq_TCPLinkSendSeq(icq_TCPLink *plink, icq_Packet *p, | |
111 unsigned long sequence); | |
112 void icq_TCPLinkSend(icq_TCPLink *plink, icq_Packet *p); | |
113 | |
114 void icq_TCPLinkProcessReceived(icq_TCPLink *plink); | |
115 | |
1912
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1498
diff
changeset
|
116 icq_TCPLink *icq_FindTCPLink(icq_Link *icqlink, unsigned long uin, int type); |
1152 | 117 |
118 void icq_ChatRusConv_n(const char to[4], char *t_in, int t_len); | |
119 | |
120 #endif /* _TCP_LINK_H_ */ |