Mercurial > pidgin
annotate libpurple/protocols/msn/directconn.h @ 31558:ce968e115c95
propagate from branch 'im.pidgin.cpw.masca.p2p' (head 33ca865dacb9e5bcf763d06f6a42cbaca337cc64)
to branch 'im.pidgin.pidgin' (head 92f47f4e8b0cbb107fd97e1ab814d1cedbf109ad)
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Fri, 06 May 2011 06:25:14 +0000 |
parents | b55b3d34846c |
children |
rev | line source |
---|---|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2 * @file directconn.h MSN direct connection functions |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * |
15822 | 4 * purple |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
5 * |
15822 | 6 * Purple is the legal property of its developers, whose names are too numerous |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * to list here. Please refer to the COPYRIGHT file distributed with this |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 * source distribution. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * This program is free software; you can redistribute it and/or modify |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * it under the terms of the GNU General Public License as published by |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * the Free Software Foundation; either version 2 of the License, or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * This program is distributed in the hope that it will be useful, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 * GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
20 * You should have received a copy of the GNU General Public License |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 * along with this program; if not, write to the Free Software |
19681
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
15822
diff
changeset
|
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 */ |
28983
462cb893521b
Minor header file cleanup. Mostly I wanted to move some enums above some #includes
Mark Doliner <mark@kingant.net>
parents:
20514
diff
changeset
|
24 #ifndef MSN_DIRECTCONN_H |
462cb893521b
Minor header file cleanup. Mostly I wanted to move some enums above some #includes
Mark Doliner <mark@kingant.net>
parents:
20514
diff
changeset
|
25 #define MSN_DIRECTCONN_H |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
26 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
27 typedef struct _MsnDirectConn MsnDirectConn; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
29 #include "network.h" |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
30 #include "proxy.h" |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
31 #include "circbuffer.h" |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
32 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 #include "slp.h" |
28983
462cb893521b
Minor header file cleanup. Mostly I wanted to move some enums above some #includes
Mark Doliner <mark@kingant.net>
parents:
20514
diff
changeset
|
34 #include "slplink.h" |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
35 #include "slpmsg.h" |
30797
efe9b0338606
Add a function that enqueue a Part instead of a Message since directconn does not sends messages.
masca@cpw.pidgin.im
parents:
30794
diff
changeset
|
36 #include "slpmsg_part.h" |
30774 | 37 #include "p2p.h" |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
38 |
30794 | 39 #define MSN_DCCONN_MAX_SIZE 1352 |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
40 |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
41 typedef enum |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
42 { |
30015
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
43 DC_STATE_CLOSED, /*< No socket opened yet */ |
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
44 DC_STATE_FOO, /*< Waiting for FOO message */ |
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
45 DC_STATE_HANDSHAKE, /*< Waiting for handshake message */ |
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
46 DC_STATE_HANDSHAKE_REPLY, /*< Waiting for handshake reply message */ |
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
47 DC_STATE_ESTABLISHED /*< Handshake complete */ |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
48 } MsnDirectConnState; |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
49 |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
50 typedef enum |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
51 { |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
52 DC_PROCESS_OK = 0, |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
53 DC_PROCESS_ERROR, |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
54 DC_PROCESS_FALLBACK, |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
55 DC_PROCESS_CLOSE |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
56 |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
57 } MsnDirectConnProcessResult; |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
58 |
30039
a97d60c15e25
Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30037
diff
changeset
|
59 typedef enum |
a97d60c15e25
Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30037
diff
changeset
|
60 { |
30047
6936ffd13cb9
Make msn_dc_fallback_to_p2p non-static, and remove some old code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30039
diff
changeset
|
61 DC_NONCE_UNKNOWN, /**< Invalid scheme */ |
30039
a97d60c15e25
Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30037
diff
changeset
|
62 DC_NONCE_PLAIN, /**< No hashing */ |
a97d60c15e25
Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30037
diff
changeset
|
63 DC_NONCE_SHA1 /**< First 16 bytes of SHA1 of nonce */ |
a97d60c15e25
Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30037
diff
changeset
|
64 |
a97d60c15e25
Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30037
diff
changeset
|
65 } MsnDirectConnNonceType; |
a97d60c15e25
Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30037
diff
changeset
|
66 |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
67 typedef struct _MsnDirectConnPacket MsnDirectConnPacket; |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
68 |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
69 struct _MsnDirectConnPacket { |
30015
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
70 guint32 length; |
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
71 guchar *data; |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
72 |
30015
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
73 void (*sent_cb)(struct _MsnDirectConnPacket*); |
30804 | 74 MsnSlpMessagePart *part; |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
75 }; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
76 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
77 struct _MsnDirectConn |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
78 { |
30015
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
79 MsnDirectConnState state; /**< Direct connection status */ |
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
80 MsnSlpLink *slplink; /**< The slplink using this direct connection */ |
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
81 MsnSlpCall *slpcall; /**< The slpcall which initiated the direct connection */ |
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
82 char *msg_body; /**< The body of message sent by send_connection_info_msg_cb */ |
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
83 MsnSlpMessage *prev_ack; /**< The saved SLP ACK message */ |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
84 |
30039
a97d60c15e25
Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30037
diff
changeset
|
85 MsnDirectConnNonceType nonce_type; /**< The type of nonce hashing */ |
a97d60c15e25
Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30037
diff
changeset
|
86 guchar nonce[16]; /**< The nonce used for handshake */ |
a97d60c15e25
Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30037
diff
changeset
|
87 gchar nonce_hash[37]; /**< The hash of nonce */ |
a97d60c15e25
Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30037
diff
changeset
|
88 gchar remote_nonce[37]; /**< The remote side's nonce */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
89 |
30015
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
90 PurpleNetworkListenData *listen_data; /**< The pending socket creation request */ |
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
91 PurpleProxyConnectData *connect_data; /**< The pending connection attempt */ |
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
92 int listenfd; /**< The socket we're listening for incoming connections */ |
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
93 guint listenfd_handle; /**< The timeout handle for incoming connection */ |
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
94 guint connect_timeout_handle; /**< The timeout handle for outgoing connection */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
95 |
30015
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
96 int fd; /**< The direct connection socket */ |
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
97 guint recv_handle; /**< The incoming data callback handle */ |
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
98 guint send_handle; /**< The outgoing data callback handle */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
99 |
30015
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
100 gchar *in_buffer; /**< The receive buffer */ |
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
101 int in_size; /**< The receive buffer size */ |
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
102 int in_pos; /**< The first free position in receive buffer */ |
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
103 GQueue *out_queue; /**< The outgoing packet queue */ |
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
104 int msg_pos; /**< The position of next byte to be sent in the actual packet */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
105 |
30015
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
106 /** The callback used for sending information to the peer about the opened socket */ |
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
107 void (*send_connection_info_msg_cb)(MsnDirectConn *); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
108 |
30015
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
109 gchar *ext_ip; /**< Our external IP address */ |
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
110 int ext_port; /**< Our external port */ |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
111 |
30015
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
112 guint timeout_handle; |
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
113 gboolean progress; |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
114 |
30080
3dac28d77320
C comments only.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30079
diff
changeset
|
115 /*int num_calls;*/ /**< The number of slpcalls using this direct connection */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
116 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
117 |
30079
1aa1e1e1876d
Make it more explicit that incoming and outgoing timeouts are different.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30047
diff
changeset
|
118 /* Outgoing attempt */ |
1aa1e1e1876d
Make it more explicit that incoming and outgoing timeouts are different.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30047
diff
changeset
|
119 #define DC_OUTGOING_TIMEOUT (5) |
1aa1e1e1876d
Make it more explicit that incoming and outgoing timeouts are different.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30047
diff
changeset
|
120 /* Time for internal + external connection attempts */ |
1aa1e1e1876d
Make it more explicit that incoming and outgoing timeouts are different.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30047
diff
changeset
|
121 #define DC_INCOMING_TIMEOUT (DC_OUTGOING_TIMEOUT * 3) |
1aa1e1e1876d
Make it more explicit that incoming and outgoing timeouts are different.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30047
diff
changeset
|
122 /* Timeout for lack of activity */ |
1aa1e1e1876d
Make it more explicit that incoming and outgoing timeouts are different.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30047
diff
changeset
|
123 #define DC_TIMEOUT (60) |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
124 |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
125 /* |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
126 * Queues an MSN message to be sent via direct connection. |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
127 */ |
30797
efe9b0338606
Add a function that enqueue a Part instead of a Message since directconn does not sends messages.
masca@cpw.pidgin.im
parents:
30794
diff
changeset
|
128 void |
efe9b0338606
Add a function that enqueue a Part instead of a Message since directconn does not sends messages.
masca@cpw.pidgin.im
parents:
30794
diff
changeset
|
129 msn_dc_enqueue_part(MsnDirectConn *dc, MsnSlpMessagePart *part); |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
130 |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
131 /* |
30015
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
132 * Creates, initializes, and returns a new MsnDirectConn structure. |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
133 */ |
30015
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
134 MsnDirectConn * |
30339 | 135 msn_dc_new(MsnSlpCall *slpcall); |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
136 |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
137 /* |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
138 * Destroys an MsnDirectConn structure. Frees every buffer allocated earlier |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
139 * restores saved callbacks, etc. |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
140 */ |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
141 void |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
142 msn_dc_destroy(MsnDirectConn *dc); |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
143 |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
144 /* |
30047
6936ffd13cb9
Make msn_dc_fallback_to_p2p non-static, and remove some old code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30039
diff
changeset
|
145 * Fallback to switchboard connection. Used when neither side is able to |
6936ffd13cb9
Make msn_dc_fallback_to_p2p non-static, and remove some old code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30039
diff
changeset
|
146 * create a listening socket. |
6936ffd13cb9
Make msn_dc_fallback_to_p2p non-static, and remove some old code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30039
diff
changeset
|
147 */ |
6936ffd13cb9
Make msn_dc_fallback_to_p2p non-static, and remove some old code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30039
diff
changeset
|
148 void |
30101
7f564cf26ea3
I think it's more accurate to say that a DC is a P2P transfer, so if that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30080
diff
changeset
|
149 msn_dc_fallback_to_sb(MsnDirectConn *dc); |
30047
6936ffd13cb9
Make msn_dc_fallback_to_p2p non-static, and remove some old code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30039
diff
changeset
|
150 |
6936ffd13cb9
Make msn_dc_fallback_to_p2p non-static, and remove some old code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30039
diff
changeset
|
151 /* |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
152 * Increases the slpcall counter in DC. The direct connection remains open |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
153 * until all slpcalls using it are destroyed. |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
154 */ |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
155 void |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
156 msn_dc_ref(MsnDirectConn *dc); |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
157 |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
158 /* |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
159 * Decrease the slpcall counter in DC. The direct connection remains open |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
160 * until all slpcalls using it are destroyed. |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
161 */ |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
162 void |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
163 msn_dc_unref(MsnDirectConn *dc); |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
164 |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
165 /* |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
166 * Sends a direct connect INVITE message on the associated slplink |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
167 * with the corresponding connection type and information. |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
168 */ |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
169 void |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
170 msn_dc_send_invite(MsnDirectConn *dc); |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
171 |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
172 /* |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
173 * Sends a direct connect OK message as a response to an INVITE received earliaer |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
174 * on the corresponding slplink. |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
175 */ |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
176 void |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
177 msn_dc_send_ok(MsnDirectConn *dc); |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
178 |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
179 /* |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
180 * This callback will be called when we're successfully connected to |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
181 * the remote host. |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
182 */ |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
183 void |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
184 msn_dc_connected_to_peer_cb(gpointer data, gint fd, const gchar *error_msg); |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
185 |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
186 /* |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
187 * This callback will be called when we're unable to connect to |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
188 * the remote host in DC_CONNECT_TIMEOUT seconds. |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
189 */ |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
190 gboolean |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
191 msn_dc_outgoing_connection_timeout_cb(gpointer data); |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
192 |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
193 /* |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
194 * This callback will be called when the listening socket is successfully |
30015
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
195 * created and its parameters (IP/port) are available. |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
196 */ |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
197 void |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
28983
diff
changeset
|
198 msn_dc_listen_socket_created_cb(int listenfd, gpointer data); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
199 |
28983
462cb893521b
Minor header file cleanup. Mostly I wanted to move some enums above some #includes
Mark Doliner <mark@kingant.net>
parents:
20514
diff
changeset
|
200 #endif /* MSN_DIRECTCONN_H */ |