comparison src/protocols/icq/tcplink.h @ 2086:424a40f12a6c

[gaim-migrate @ 2096] moving protocols from plugins/ to src/protocols. making it so that you can select which protocols are compiled statically. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Tue, 31 Jul 2001 01:00:39 +0000
parents
children 5e7ffea3f76a
comparison
equal deleted inserted replaced
2085:7ebb4322f89b 2086:424a40f12a6c
1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
3 /*
4 * $Id: tcplink.h 2096 2001-07-31 01:00:39Z warmenhoven $
5 *
6 * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
7 * Bill Soudan <soudan@kde.org>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 *
23 */
24
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
35 #include <sys/socket.h>
36 #include <netinet/in.h>
37 #endif
38
39 #include "icq.h"
40 #include "icqpacket.h"
41 #include "timeout.h"
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
63 struct icq_TCPLink_s {
64
65 /* icq_TCPLink ICQLINK, type, mode, and session */
66 icq_Link *icqlink;
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 */
82 icq_List *received_queue;
83 icq_List *send_queue;
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
91 /* timeout for connect operation */
92 icq_Timeout *connect_timeout;
93
94 };
95
96 icq_TCPLink *icq_TCPLinkNew(icq_Link *icqlink);
97 void icq_TCPLinkDelete(void *p);
98 void icq_TCPLinkClose(icq_TCPLink *p);
99 void icq_TCPLinkNodeDelete(icq_ListNode *p);
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
105 void icq_TCPLinkOnDataReceived(icq_TCPLink *plink);
106 void icq_TCPLinkOnPacketReceived(icq_TCPLink *plink, icq_Packet *p);
107 void icq_TCPLinkOnConnect(icq_TCPLink *plink);
108 void icq_TCPLinkOnConnectTimeout(icq_TCPLink *plink);
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
116 icq_TCPLink *icq_FindTCPLink(icq_Link *icqlink, unsigned long uin, int type);
117
118 void icq_ChatRusConv_n(const char to[4], char *t_in, int t_len);
119
120 #endif /* _TCP_LINK_H_ */