Thu, 21 Dec 2000 18:54:16 +0000
[gaim-migrate @ 1358]
Makes the icq plugin compile on FreeBSD. Other platforms as well?
| 1152 | 1 | /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
| 2 | #ifndef _TCP_LINK_H_ | |
| 3 | #define _TCP_LINK_H_ | |
| 4 | ||
| 5 | #ifdef HAVE_CONFIG_H | |
| 6 | #include <config.h> | |
| 7 | #endif | |
| 8 | ||
| 9 | #ifdef _WIN32 | |
| 10 | #include <winsock.h> | |
| 11 | #else | |
| 1348 | 12 | #include <sys/types.h> |
| 13 | #include <sys/socket.h> | |
| 1152 | 14 | #include <netinet/in.h> |
| 15 | #endif | |
| 16 | ||
| 17 | #include <time.h> | |
| 18 | ||
| 19 | #include "icq.h" | |
| 20 | #include "icqpacket.h" | |
| 21 | #include "list.h" | |
| 22 | ||
| 23 | /* link mode bitfield values */ | |
| 24 | #define TCP_LINK_MODE_RAW 1 | |
| 25 | #define TCP_LINK_MODE_HELLOWAIT 2 | |
| 26 | #define TCP_LINK_MODE_LISTEN 4 | |
| 27 | #define TCP_LINK_MODE_CONNECTING 8 | |
| 28 | #define TCP_LINK_SOCKS_CONNECTING 16 | |
| 29 | #define TCP_LINK_SOCKS_AUTHORIZATION 32 | |
| 30 | #define TCP_LINK_SOCKS_AUTHSTATUS 64 | |
| 31 | #define TCP_LINK_SOCKS_NOAUTHSTATUS 128 | |
| 32 | #define TCP_LINK_SOCKS_CROSSCONNECT 256 | |
| 33 | #define TCP_LINK_SOCKS_CONNSTATUS 512 | |
| 34 | ||
| 35 | /* link types */ | |
| 36 | #define TCP_LINK_MESSAGE 1 | |
| 37 | #define TCP_LINK_CHAT 2 | |
| 38 | #define TCP_LINK_FILE 3 | |
| 39 | ||
| 40 | #define icq_TCPLinkBufferSize 4096 | |
| 41 | #define TCP_LINK_CONNECT_TIMEOUT 30 | |
| 42 | ||
| 43 | typedef struct icq_TCPLink_s | |
| 44 | { | |
| 45 | /* icq_TCPLink ICQLINK, type, mode, and session */ | |
| 46 | ICQLINK *icqlink; | |
| 47 | int type; | |
| 48 | int mode; | |
| 49 | int proxy_status; | |
| 50 | void *session; | |
| 51 | ||
| 52 | /* socket parameters */ | |
| 53 | int socket; | |
| 54 | struct sockaddr_in socket_address; | |
| 55 | struct sockaddr_in remote_address; | |
| 56 | ||
| 57 | /* data buffer for receive calls */ | |
| 58 | char buffer[icq_TCPLinkBufferSize]; | |
| 59 | int buffer_count; | |
| 60 | ||
| 61 | /* packet queues */ | |
| 62 | list *received_queue; | |
| 63 | list *send_queue; | |
| 64 | ||
| 65 | /* icq specific data, initialized by hello packet */ | |
| 66 | unsigned long id; | |
| 67 | unsigned long remote_version; | |
| 68 | unsigned long remote_uin; | |
| 69 | char flags; | |
| 70 | ||
| 71 | /* connect timer */ | |
| 72 | time_t connect_time; | |
| 73 | ||
| 74 | } icq_TCPLink; | |
| 75 | ||
| 76 | icq_TCPLink *icq_TCPLinkNew(ICQLINK *link); | |
| 77 | void icq_TCPLinkDelete(void *p); | |
| 78 | void icq_TCPLinkClose(icq_TCPLink *p); | |
| 79 | void icq_TCPLinkNodeDelete(list_node *p); | |
| 80 | ||
| 81 | int icq_TCPLinkConnect(icq_TCPLink *plink, DWORD uin, int port); | |
| 82 | icq_TCPLink *icq_TCPLinkAccept(icq_TCPLink *plink); | |
| 83 | int icq_TCPLinkListen(icq_TCPLink *plink); | |
| 84 | ||
| 85 | int icq_TCPLinkOnDataReceived(icq_TCPLink *plink); | |
| 86 | void icq_TCPLinkOnPacketReceived(icq_TCPLink *plink, icq_Packet *p); | |
| 87 | void icq_TCPLinkOnConnect(icq_TCPLink *plink); | |
| 88 | ||
| 89 | unsigned long icq_TCPLinkSendSeq(icq_TCPLink *plink, icq_Packet *p, | |
| 90 | unsigned long sequence); | |
| 91 | void icq_TCPLinkSend(icq_TCPLink *plink, icq_Packet *p); | |
| 92 | ||
| 93 | void icq_TCPLinkProcessReceived(icq_TCPLink *plink); | |
| 94 | ||
| 95 | icq_TCPLink *icq_FindTCPLink(ICQLINK *link, unsigned long uin, int type); | |
| 96 | ||
| 97 | void icq_ChatRusConv_n(const char to[4], char *t_in, int t_len); | |
| 98 | ||
| 99 | #endif /* _TCP_LINK_H_ */ |