Mercurial > pidgin
annotate libpurple/protocols/msn/p2p.h @ 31581:a406398412ee
I've always wondered why the SB layer was parsing the P2P stuff, when
it never really needed to do it. We have a P2P-specific handler for
receival that should do it instead. And for sending, it's already
serialized before getting to this layer, so that part is redundant.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Mon, 09 May 2011 22:17:03 +0000 |
parents | 9a23c70bdb7a |
children | cf702c6ab9e7 |
rev | line source |
---|---|
30969
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30868
diff
changeset
|
1 /** |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30868
diff
changeset
|
2 * @file p2p.h MSN P2P functions |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30868
diff
changeset
|
3 * |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30868
diff
changeset
|
4 * purple |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30868
diff
changeset
|
5 * |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30868
diff
changeset
|
6 * Purple is the legal property of its developers, whose names are too numerous |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30868
diff
changeset
|
7 * to list here. Please refer to the COPYRIGHT file distributed with this |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30868
diff
changeset
|
8 * source distribution. |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30868
diff
changeset
|
9 * |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30868
diff
changeset
|
10 * This program is free software; you can redistribute it and/or modify |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30868
diff
changeset
|
11 * it under the terms of the GNU General Public License as published by |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30868
diff
changeset
|
12 * the Free Software Foundation; either version 2 of the License, or |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30868
diff
changeset
|
13 * (at your option) any later version. |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30868
diff
changeset
|
14 * |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30868
diff
changeset
|
15 * This program is distributed in the hope that it will be useful, |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30868
diff
changeset
|
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30868
diff
changeset
|
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30868
diff
changeset
|
18 * GNU General Public License for more details. |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30868
diff
changeset
|
19 * |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30868
diff
changeset
|
20 * You should have received a copy of the GNU General Public License |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30868
diff
changeset
|
21 * along with this program; if not, write to the Free Software |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30868
diff
changeset
|
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30868
diff
changeset
|
23 */ |
72e6fa6caecc
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30868
diff
changeset
|
24 |
30763 | 25 #ifndef MSN_P2P_H |
26 #define MSN_P2P_H | |
27 | |
28 typedef struct { | |
29 guint32 session_id; | |
30764
d4869cd86680
Chang member name so it is compatible with MsnSlpHeader struct names.
masca@cpw.pidgin.im
parents:
30763
diff
changeset
|
30 guint32 id; |
30863
16ab805406d1
Get rid of the offset field in the SlpMessage in favor of the one in the Header.
masca@cpw.pidgin.im
parents:
30848
diff
changeset
|
31 /** |
16ab805406d1
Get rid of the offset field in the SlpMessage in favor of the one in the Header.
masca@cpw.pidgin.im
parents:
30848
diff
changeset
|
32 * In a MsnSlpMessage: |
16ab805406d1
Get rid of the offset field in the SlpMessage in favor of the one in the Header.
masca@cpw.pidgin.im
parents:
30848
diff
changeset
|
33 * For outgoing messages this is the number of bytes from buffer that |
16ab805406d1
Get rid of the offset field in the SlpMessage in favor of the one in the Header.
masca@cpw.pidgin.im
parents:
30848
diff
changeset
|
34 * have already been sent out. For incoming messages this is the |
16ab805406d1
Get rid of the offset field in the SlpMessage in favor of the one in the Header.
masca@cpw.pidgin.im
parents:
30848
diff
changeset
|
35 * number of bytes that have been written to buffer. |
16ab805406d1
Get rid of the offset field in the SlpMessage in favor of the one in the Header.
masca@cpw.pidgin.im
parents:
30848
diff
changeset
|
36 */ |
30763 | 37 guint64 offset; |
38 guint64 total_size; | |
39 guint32 length; | |
40 guint32 flags; | |
41 guint32 ack_id; | |
30764
d4869cd86680
Chang member name so it is compatible with MsnSlpHeader struct names.
masca@cpw.pidgin.im
parents:
30763
diff
changeset
|
42 guint32 ack_sub_id; |
30763 | 43 guint64 ack_size; |
44 /* guint8 body[1]; */ | |
30767 | 45 } MsnP2PHeader; |
31044
7b771e6f1142
Change SLP P2P functions to use the new buffer access functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31033
diff
changeset
|
46 #define P2P_PACKET_HEADER_SIZE (6 * 4 + 3 * 8) |
30763 | 47 |
30839 | 48 typedef struct { |
49 guint8 header_len; | |
50 guint8 opcode; | |
30848
544221aadf6e
Fix some field sizes in P2Pv2 header.
masca@cpw.pidgin.im
parents:
30844
diff
changeset
|
51 guint16 message_len; |
544221aadf6e
Fix some field sizes in P2Pv2 header.
masca@cpw.pidgin.im
parents:
30844
diff
changeset
|
52 guint32 base_id; |
31322
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31319
diff
changeset
|
53 GSList *header_tlv; |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31319
diff
changeset
|
54 guint8 data_header_len; |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31319
diff
changeset
|
55 guint8 data_tf; |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31319
diff
changeset
|
56 guint16 package_number; |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31319
diff
changeset
|
57 guint32 session_id; |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31319
diff
changeset
|
58 GSList *data_tlv; |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31319
diff
changeset
|
59 /* guint8 body[1]; */ |
30839 | 60 } MsnP2Pv2Header; |
61 | |
31555 | 62 typedef struct { |
31558
ce968e115c95
propagate from branch 'im.pidgin.cpw.masca.p2p' (head 33ca865dacb9e5bcf763d06f6a42cbaca337cc64)
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
63 guint16 protocol_version; |
ce968e115c95
propagate from branch 'im.pidgin.cpw.masca.p2p' (head 33ca865dacb9e5bcf763d06f6a42cbaca337cc64)
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
64 guint16 implementation_id; |
ce968e115c95
propagate from branch 'im.pidgin.cpw.masca.p2p' (head 33ca865dacb9e5bcf763d06f6a42cbaca337cc64)
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
65 guint16 version; |
ce968e115c95
propagate from branch 'im.pidgin.cpw.masca.p2p' (head 33ca865dacb9e5bcf763d06f6a42cbaca337cc64)
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
66 guint16 reserved; |
ce968e115c95
propagate from branch 'im.pidgin.cpw.masca.p2p' (head 33ca865dacb9e5bcf763d06f6a42cbaca337cc64)
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
67 guint32 caps; |
31565
23f2c4dfc93d
Rename things a little.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31558
diff
changeset
|
68 } P2PPeerInfo; |
31557 | 69 |
31552 | 70 typedef enum |
71 { | |
31558
ce968e115c95
propagate from branch 'im.pidgin.cpw.masca.p2p' (head 33ca865dacb9e5bcf763d06f6a42cbaca337cc64)
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
72 TF_FIRST = 0x01, /**< The first package. */ |
ce968e115c95
propagate from branch 'im.pidgin.cpw.masca.p2p' (head 33ca865dacb9e5bcf763d06f6a42cbaca337cc64)
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
73 TF_MSNOBJ = 0x04, /**< Payload contains binary data for MsnObject. */ |
ce968e115c95
propagate from branch 'im.pidgin.cpw.masca.p2p' (head 33ca865dacb9e5bcf763d06f6a42cbaca337cc64)
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
74 TF_FILE = 0x06 /**< Payload contains binary data. */ |
31552 | 75 } TF; |
76 | |
77 typedef enum | |
78 { | |
31565
23f2c4dfc93d
Rename things a little.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31558
diff
changeset
|
79 P2P_TLV_TYPE_PEER_INFO = 0x01, /**< Client peer info */ |
23f2c4dfc93d
Rename things a little.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31558
diff
changeset
|
80 P2P_TLV_TYPE_ACK = 0x02, /**< ACK */ |
23f2c4dfc93d
Rename things a little.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31558
diff
changeset
|
81 P2P_TLV_TYPE_NAK = 0x03 /**< NAK */ |
23f2c4dfc93d
Rename things a little.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31558
diff
changeset
|
82 } P2PTLVType; |
31552 | 83 |
84 typedef enum | |
85 { | |
31565
23f2c4dfc93d
Rename things a little.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31558
diff
changeset
|
86 P2P_TLV_LEN_PEER_INFO = 12, |
23f2c4dfc93d
Rename things a little.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31558
diff
changeset
|
87 P2P_TLV_LEN_ACK = 4, |
23f2c4dfc93d
Rename things a little.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31558
diff
changeset
|
88 P2P_TLV_LEN_NAK = 4 |
23f2c4dfc93d
Rename things a little.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31558
diff
changeset
|
89 } P2PTLVLength; |
31552 | 90 |
31557 | 91 typedef enum |
92 { | |
31565
23f2c4dfc93d
Rename things a little.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31558
diff
changeset
|
93 P2P_PI_PVER = 0x0200, |
23f2c4dfc93d
Rename things a little.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31558
diff
changeset
|
94 P2P_PI_IMP_ID = 0, |
23f2c4dfc93d
Rename things a little.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31558
diff
changeset
|
95 P2P_PI_VER = 0x0e00, |
23f2c4dfc93d
Rename things a little.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31558
diff
changeset
|
96 P2P_PI_RES = 0, |
23f2c4dfc93d
Rename things a little.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31558
diff
changeset
|
97 P2P_PI_CAPS = 0x0000010f |
23f2c4dfc93d
Rename things a little.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31558
diff
changeset
|
98 } P2PPeerInfoVal; |
31557 | 99 |
31552 | 100 #define DLP_REMAINING 0x01; /**< Indicates the remaining data to transfer.*/ |
101 #define DLP_REMAINING_LEN 8 | |
102 | |
30766
c2e911eeffc9
Drop MsnSlpFooter in favor of MsnP2pFooter.
masca@cpw.pidgin.im
parents:
30764
diff
changeset
|
103 typedef struct |
c2e911eeffc9
Drop MsnSlpFooter in favor of MsnP2pFooter.
masca@cpw.pidgin.im
parents:
30764
diff
changeset
|
104 { |
c2e911eeffc9
Drop MsnSlpFooter in favor of MsnP2pFooter.
masca@cpw.pidgin.im
parents:
30764
diff
changeset
|
105 guint32 value; |
c2e911eeffc9
Drop MsnSlpFooter in favor of MsnP2pFooter.
masca@cpw.pidgin.im
parents:
30764
diff
changeset
|
106 } MsnP2PFooter; |
31044
7b771e6f1142
Change SLP P2P functions to use the new buffer access functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31033
diff
changeset
|
107 #define P2P_PACKET_FOOTER_SIZE (1 * 4) |
30766
c2e911eeffc9
Drop MsnSlpFooter in favor of MsnP2pFooter.
masca@cpw.pidgin.im
parents:
30764
diff
changeset
|
108 |
31268
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
109 typedef enum |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
110 { |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
111 MSN_P2P_VERSION_ONE = 0, |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
112 MSN_P2P_VERSION_TWO = 1, |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
113 } MsnP2PVersion; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
114 |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
115 typedef struct { |
31268
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
116 MsnP2PVersion version; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
117 union { |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
118 MsnP2PHeader v1; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
119 MsnP2Pv2Header v2; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
120 } header; |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
121 MsnP2PFooter footer; |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
122 } MsnP2PInfo; |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
123 |
30763 | 124 typedef enum |
125 { | |
126 P2P_NO_FLAG = 0x0, /**< No flags specified */ | |
127 P2P_OUT_OF_ORDER = 0x1, /**< Chunk out-of-order */ | |
128 P2P_ACK = 0x2, /**< Acknowledgement */ | |
129 P2P_PENDING_INVITE = 0x4, /**< There is a pending invite */ | |
130 P2P_BINARY_ERROR = 0x8, /**< Error on the binary level */ | |
30841
01dea46bbb42
Add some more flag definitions to the p2p flags.
masca@cpw.pidgin.im
parents:
30839
diff
changeset
|
131 P2P_FILE = 0x10, /**< File */ |
30763 | 132 P2P_MSN_OBJ_DATA = 0x20, /**< MsnObject data */ |
30841
01dea46bbb42
Add some more flag definitions to the p2p flags.
masca@cpw.pidgin.im
parents:
30839
diff
changeset
|
133 P2P_CLOSE = 0x40, /**< Close session */ |
01dea46bbb42
Add some more flag definitions to the p2p flags.
masca@cpw.pidgin.im
parents:
30839
diff
changeset
|
134 P2P_TLP_ERROR = 0x80, /**< Error at transport layer protocol */ |
01dea46bbb42
Add some more flag definitions to the p2p flags.
masca@cpw.pidgin.im
parents:
30839
diff
changeset
|
135 P2P_DC_HANDSHAKE = 0x100, /**< Direct Handshake */ |
30974
f26e961e1274
Fix the name of this flag.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30969
diff
changeset
|
136 P2P_WLM2009_COMP = 0x1000000, /**< Compatibility with WLM 2009 */ |
30763 | 137 P2P_FILE_DATA = 0x1000030 /**< File transfer data */ |
138 } MsnP2PHeaderFlag; | |
139 /* Info From: | |
140 * http://msnpiki.msnfanatic.com/index.php/MSNC:P2Pv1_Headers#Flags | |
141 * http://trac.kmess.org/changeset/ba04d0c825769d23370511031c47f6be75fe9b86 | |
142 * #7180 | |
143 */ | |
144 | |
30844
7b1b7a4e0bb4
Documetn P2P Application ID in a enum and use it instead of 'magic numbers'.
masca@cpw.pidgin.im
parents:
30841
diff
changeset
|
145 typedef enum |
7b1b7a4e0bb4
Documetn P2P Application ID in a enum and use it instead of 'magic numbers'.
masca@cpw.pidgin.im
parents:
30841
diff
changeset
|
146 { |
31033 | 147 P2P_APPID_SESSION = 0x0, /**< Negotiating session */ |
30844
7b1b7a4e0bb4
Documetn P2P Application ID in a enum and use it instead of 'magic numbers'.
masca@cpw.pidgin.im
parents:
30841
diff
changeset
|
148 P2P_APPID_OBJ = 0x1, /**< MsnObject (Display or Emoticon) */ |
7b1b7a4e0bb4
Documetn P2P Application ID in a enum and use it instead of 'magic numbers'.
masca@cpw.pidgin.im
parents:
30841
diff
changeset
|
149 P2P_APPID_FILE = 0x2, /**< File transfer */ |
7b1b7a4e0bb4
Documetn P2P Application ID in a enum and use it instead of 'magic numbers'.
masca@cpw.pidgin.im
parents:
30841
diff
changeset
|
150 P2P_APPID_EMOTE = 0xB, /**< CustomEmoticon */ |
7b1b7a4e0bb4
Documetn P2P Application ID in a enum and use it instead of 'magic numbers'.
masca@cpw.pidgin.im
parents:
30841
diff
changeset
|
151 P2P_APPID_DISPLAY = 0xC /**< Display Image */ |
7b1b7a4e0bb4
Documetn P2P Application ID in a enum and use it instead of 'magic numbers'.
masca@cpw.pidgin.im
parents:
30841
diff
changeset
|
152 } MsnP2PAppId; |
7b1b7a4e0bb4
Documetn P2P Application ID in a enum and use it instead of 'magic numbers'.
masca@cpw.pidgin.im
parents:
30841
diff
changeset
|
153 |
31322
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31319
diff
changeset
|
154 typedef enum |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31319
diff
changeset
|
155 { |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31319
diff
changeset
|
156 P2P_OPCODE_NONE = 0x00, |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31319
diff
changeset
|
157 P2P_OPCODE_SYN = 0x01, |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31319
diff
changeset
|
158 P2P_OPCODE_RAK = 0x02 |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31319
diff
changeset
|
159 } MsnP2Pv2OpCode; |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31319
diff
changeset
|
160 |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
161 MsnP2PInfo * |
31268
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
162 msn_p2p_info_new(MsnP2PVersion version); |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
163 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
164 MsnP2PInfo * |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
165 msn_p2p_info_dup(MsnP2PInfo *info); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
166 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
167 void |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
168 msn_p2p_info_free(MsnP2PInfo *info); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
169 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
170 size_t |
31319
8cf9270acf4c
Add a maximum length when parsing the P2P wire data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31268
diff
changeset
|
171 msn_p2p_header_from_wire(MsnP2PInfo *info, const char *wire, size_t max_len); |
30763 | 172 |
31044
7b771e6f1142
Change SLP P2P functions to use the new buffer access functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31033
diff
changeset
|
173 char * |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
174 msn_p2p_header_to_wire(MsnP2PInfo *info, size_t *len); |
30763 | 175 |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
176 size_t |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
177 msn_p2p_footer_from_wire(MsnP2PInfo *info, const char *wire); |
30782 | 178 |
31044
7b771e6f1142
Change SLP P2P functions to use the new buffer access functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31033
diff
changeset
|
179 char * |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
180 msn_p2p_footer_to_wire(MsnP2PInfo *info, size_t *len); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
181 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
182 void |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
183 msn_p2p_info_to_string(MsnP2PInfo *info, GString *str); |
30782 | 184 |
30868
5964f65c17ed
Avoid duplicated code using a util function to check the flags.
masca@cpw.pidgin.im
parents:
30863
diff
changeset
|
185 gboolean |
31569
eb1bbaae3427
Try to hide msn_p2p_info_get_flags as much as possible, since it may
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31568
diff
changeset
|
186 msn_p2p_msg_is_data(const MsnP2PInfo *info); |
30868
5964f65c17ed
Avoid duplicated code using a util function to check the flags.
masca@cpw.pidgin.im
parents:
30863
diff
changeset
|
187 |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
188 gboolean |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
189 msn_p2p_info_is_valid(MsnP2PInfo *info); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
190 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
191 gboolean |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
192 msn_p2p_info_is_final(MsnP2PInfo *info); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
193 |
31567
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31565
diff
changeset
|
194 void |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31565
diff
changeset
|
195 msn_p2p_info_create_ack(MsnP2PInfo *old_info, MsnP2PInfo *new_info); |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31565
diff
changeset
|
196 |
31568
50ca9e64186b
Only send acks on p2pv2 when required.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31567
diff
changeset
|
197 gboolean |
50ca9e64186b
Only send acks on p2pv2 when required.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31567
diff
changeset
|
198 msn_p2p_info_require_ack(MsnP2PInfo *info); |
50ca9e64186b
Only send acks on p2pv2 when required.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31567
diff
changeset
|
199 |
31569
eb1bbaae3427
Try to hide msn_p2p_info_get_flags as much as possible, since it may
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31568
diff
changeset
|
200 gboolean |
eb1bbaae3427
Try to hide msn_p2p_info_get_flags as much as possible, since it may
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31568
diff
changeset
|
201 msn_p2p_info_is_ack(MsnP2PInfo *info); |
eb1bbaae3427
Try to hide msn_p2p_info_get_flags as much as possible, since it may
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31568
diff
changeset
|
202 |
eb1bbaae3427
Try to hide msn_p2p_info_get_flags as much as possible, since it may
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31568
diff
changeset
|
203 void |
eb1bbaae3427
Try to hide msn_p2p_info_get_flags as much as possible, since it may
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31568
diff
changeset
|
204 msn_p2p_info_init_first(MsnP2PInfo *new_info, MsnP2PInfo *old_info); |
eb1bbaae3427
Try to hide msn_p2p_info_get_flags as much as possible, since it may
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31568
diff
changeset
|
205 |
31577
9a23c70bdb7a
Get the P2P version based on the user. Still hard-coded as v1 though.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31569
diff
changeset
|
206 MsnP2PVersion |
9a23c70bdb7a
Get the P2P version based on the user. Still hard-coded as v1 though.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31569
diff
changeset
|
207 msn_p2p_get_user_support(const char *passport); |
9a23c70bdb7a
Get the P2P version based on the user. Still hard-coded as v1 though.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31569
diff
changeset
|
208 |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
209 guint32 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
210 msn_p2p_info_get_session_id(MsnP2PInfo *info); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
211 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
212 guint32 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
213 msn_p2p_info_get_id(MsnP2PInfo *info); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
214 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
215 guint64 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
216 msn_p2p_info_get_offset(MsnP2PInfo *info); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
217 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
218 guint64 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
219 msn_p2p_info_get_total_size(MsnP2PInfo *info); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
220 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
221 guint32 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
222 msn_p2p_info_get_length(MsnP2PInfo *info); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
223 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
224 guint32 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
225 msn_p2p_info_get_flags(MsnP2PInfo *info); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
226 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
227 guint32 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
228 msn_p2p_info_get_ack_id(MsnP2PInfo *info); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
229 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
230 guint32 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
231 msn_p2p_info_get_ack_sub_id(MsnP2PInfo *info); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
232 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
233 guint64 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
234 msn_p2p_info_get_ack_size(MsnP2PInfo *info); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
235 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
236 guint32 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
237 msn_p2p_info_get_app_id(MsnP2PInfo *info); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
238 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
239 void |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
240 msn_p2p_info_set_session_id(MsnP2PInfo *info, guint32 session_id); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
241 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
242 void |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
243 msn_p2p_info_set_id(MsnP2PInfo *info, guint32 id); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
244 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
245 void |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
246 msn_p2p_info_set_offset(MsnP2PInfo *info, guint64 offset); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
247 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
248 void |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
249 msn_p2p_info_set_total_size(MsnP2PInfo *info, guint64 total_size); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
250 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
251 void |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
252 msn_p2p_info_set_length(MsnP2PInfo *info, guint32 length); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
253 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
254 void |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
255 msn_p2p_info_set_flags(MsnP2PInfo *info, guint32 flags); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
256 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
257 void |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
258 msn_p2p_info_set_ack_id(MsnP2PInfo *info, guint32 ack_id); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
259 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
260 void |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
261 msn_p2p_info_set_ack_sub_id(MsnP2PInfo *info, guint32 ack_sub_id); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
262 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
263 void |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
264 msn_p2p_info_set_ack_size(MsnP2PInfo *info, guint64 ack_size); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
265 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
266 void |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
267 msn_p2p_info_set_app_id(MsnP2PInfo *info, guint32 app_id); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31088
diff
changeset
|
268 |
30763 | 269 #endif /* MSN_P2P_H */ |