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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
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
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
25 #ifndef _TCP_LINK_H_
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
26 #define _TCP_LINK_H_
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
27
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
28 #ifdef HAVE_CONFIG_H
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
29 #include <config.h>
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
30 #endif
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
31
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
32 #ifdef _WIN32
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
33 #include <winsock.h>
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
34 #else
1348
6b7555cba359 [gaim-migrate @ 1358]
Rob Flynn <gaim@robflynn.com>
parents: 1152
diff changeset
35 #include <sys/socket.h>
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
36 #include <netinet/in.h>
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
37 #endif
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
38
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
39 #include "icq.h"
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
40 #include "icqpacket.h"
1498
0ef6603d986e [gaim-migrate @ 1508]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1432
diff changeset
41 #include "timeout.h"
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
42
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
43 /* link mode bitfield values */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
44 #define TCP_LINK_MODE_RAW 1
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
45 #define TCP_LINK_MODE_HELLOWAIT 2
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
46 #define TCP_LINK_MODE_LISTEN 4
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
47 #define TCP_LINK_MODE_CONNECTING 8
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
48 #define TCP_LINK_SOCKS_CONNECTING 16
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
49 #define TCP_LINK_SOCKS_AUTHORIZATION 32
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
50 #define TCP_LINK_SOCKS_AUTHSTATUS 64
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
51 #define TCP_LINK_SOCKS_NOAUTHSTATUS 128
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
52 #define TCP_LINK_SOCKS_CROSSCONNECT 256
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
53 #define TCP_LINK_SOCKS_CONNSTATUS 512
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
54
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
55 /* link types */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
56 #define TCP_LINK_MESSAGE 1
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
57 #define TCP_LINK_CHAT 2
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
58 #define TCP_LINK_FILE 3
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
59
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
60 #define icq_TCPLinkBufferSize 4096
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
61 #define TCP_LINK_CONNECT_TIMEOUT 30
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
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
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
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
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
67 int type;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
68 int mode;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
69 int proxy_status;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
70 void *session;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
71
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
72 /* socket parameters */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
73 int socket;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
74 struct sockaddr_in socket_address;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
75 struct sockaddr_in remote_address;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
76
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
77 /* data buffer for receive calls */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
78 char buffer[icq_TCPLinkBufferSize];
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
79 int buffer_count;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
80
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
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
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
84
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
85 /* icq specific data, initialized by hello packet */
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
86 unsigned long id;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
87 unsigned long remote_version;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
88 unsigned long remote_uin;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
89 char flags;
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
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
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
93
1432
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1348
diff changeset
94 };
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
95
1912
8ed70631ed15 [gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1498
diff changeset
96 icq_TCPLink *icq_TCPLinkNew(icq_Link *icqlink);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
97 void icq_TCPLinkDelete(void *p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
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
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
100
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
101 int icq_TCPLinkConnect(icq_TCPLink *plink, DWORD uin, int port);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
102 icq_TCPLink *icq_TCPLinkAccept(icq_TCPLink *plink);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
103 int icq_TCPLinkListen(icq_TCPLink *plink);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
104
1432
4c510ca3563f [gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1348
diff changeset
105 void icq_TCPLinkOnDataReceived(icq_TCPLink *plink);
1152
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
106 void icq_TCPLinkOnPacketReceived(icq_TCPLink *plink, icq_Packet *p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
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
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
109
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
110 unsigned long icq_TCPLinkSendSeq(icq_TCPLink *plink, icq_Packet *p,
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
111 unsigned long sequence);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
112 void icq_TCPLinkSend(icq_TCPLink *plink, icq_Packet *p);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
113
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
114 void icq_TCPLinkProcessReceived(icq_TCPLink *plink);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
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
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
117
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
118 void icq_ChatRusConv_n(const char to[4], char *t_in, int t_len);
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
119
201ec77f3a60 [gaim-migrate @ 1162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
120 #endif /* _TCP_LINK_H_ */