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