Mercurial > pidgin
annotate libpurple/protocols/msn/p2p.c @ 32255:f044a5bdb3c6
I guess I shouldn't copy/paste code while running out the door.
author | Kevin Stange <kevin@simguy.net> |
---|---|
date | Sun, 02 Oct 2011 02:37:56 +0000 |
parents | f5fbcdd07d48 |
children |
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.c 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 |
30771
198d5bf82e09
Oops, forgot to save before commiting.
masca@cpw.pidgin.im
parents:
30768
diff
changeset
|
25 #include "internal.h" |
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
|
26 #include "debug.h" |
30771
198d5bf82e09
Oops, forgot to save before commiting.
masca@cpw.pidgin.im
parents:
30768
diff
changeset
|
27 |
198d5bf82e09
Oops, forgot to save before commiting.
masca@cpw.pidgin.im
parents:
30768
diff
changeset
|
28 #include "p2p.h" |
31322
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
29 #include "tlv.h" |
31044
7b771e6f1142
Change SLP P2P functions to use the new buffer access functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30974
diff
changeset
|
30 #include "msnutils.h" |
30768
f66e289bebc6
Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff
changeset
|
31 |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
32 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
|
33 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:
31086
diff
changeset
|
34 { |
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
|
35 MsnP2PInfo *info = g_new0(MsnP2PInfo, 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
|
36 info->version = 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
|
37 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
38 switch (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
|
39 case MSN_P2P_VERSION_ONE: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
40 case MSN_P2P_VERSION_TWO: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
41 /* Nothing to do */ |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
42 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
43 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
44 default: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
45 purple_debug_error("msn", "Invalid P2P Info version: %d\n", 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
|
46 g_free(info); |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
47 info = NULL; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
48 } |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
49 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
50 return info; |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
51 } |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
52 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
53 MsnP2PInfo * |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
54 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:
31086
diff
changeset
|
55 { |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
56 MsnP2PInfo *new_info = g_new0(MsnP2PInfo, 1); |
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
|
57 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
58 new_info->version = info->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
|
59 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
60 switch (info->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
|
61 case MSN_P2P_VERSION_ONE: |
31322
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
62 *new_info = *info; |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
63 break; |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
64 |
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
|
65 case MSN_P2P_VERSION_TWO: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
66 *new_info = *info; |
31322
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
67 new_info->header.v2.header_tlv = msn_tlvlist_copy(info->header.v2.header_tlv); |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
68 new_info->header.v2.data_tlv = msn_tlvlist_copy(info->header.v2.data_tlv); |
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
|
69 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
70 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
71 default: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
72 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->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
|
73 g_free(new_info); |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
74 new_info = NULL; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
75 } |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
76 |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
77 return new_info; |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
78 } |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
79 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
80 void |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
81 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:
31086
diff
changeset
|
82 { |
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
|
83 switch (info->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
|
84 case MSN_P2P_VERSION_ONE: |
31322
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
85 /* Nothing to do! */ |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
86 break; |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
87 |
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
|
88 case MSN_P2P_VERSION_TWO: |
31322
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
89 msn_tlvlist_free(info->header.v2.header_tlv); |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
90 msn_tlvlist_free(info->header.v2.data_tlv); |
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
|
91 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
92 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
93 default: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
94 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->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
|
95 } |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
96 |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
97 g_free(info); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
98 } |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
99 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
100 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
|
101 msn_p2p_header_from_wire(MsnP2PInfo *info, const char *wire, size_t max_len) |
30768
f66e289bebc6
Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff
changeset
|
102 { |
31320
eeca86db288b
Oops, I forgot to move the size check to the new location.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31319
diff
changeset
|
103 size_t len = 0; |
30768
f66e289bebc6
Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff
changeset
|
104 |
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
|
105 switch (info->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
|
106 case MSN_P2P_VERSION_ONE: { |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
107 MsnP2PHeader *header = &info->header.v1; |
30768
f66e289bebc6
Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff
changeset
|
108 |
31320
eeca86db288b
Oops, I forgot to move the size check to the new location.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31319
diff
changeset
|
109 if (max_len < P2P_PACKET_HEADER_SIZE) { |
eeca86db288b
Oops, I forgot to move the size check to the new location.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31319
diff
changeset
|
110 /* Invalid packet length */ |
eeca86db288b
Oops, I forgot to move the size check to the new location.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31319
diff
changeset
|
111 len = 0; |
eeca86db288b
Oops, I forgot to move the size check to the new location.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31319
diff
changeset
|
112 break; |
eeca86db288b
Oops, I forgot to move the size check to the new location.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31319
diff
changeset
|
113 } |
eeca86db288b
Oops, I forgot to move the size check to the new location.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31319
diff
changeset
|
114 |
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
|
115 header->session_id = msn_pop32le(wire); |
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 header->id = msn_pop32le(wire); |
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 header->offset = msn_pop64le(wire); |
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 header->total_size = msn_pop64le(wire); |
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 header->length = msn_pop32le(wire); |
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->flags = msn_pop32le(wire); |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
121 header->ack_id = msn_pop32le(wire); |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
122 header->ack_sub_id = msn_pop32le(wire); |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
123 header->ack_size = msn_pop64le(wire); |
30768
f66e289bebc6
Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff
changeset
|
124 |
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
|
125 len = P2P_PACKET_HEADER_SIZE; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
126 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
127 } |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
128 |
31322
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
129 case MSN_P2P_VERSION_TWO: { |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
130 MsnP2Pv2Header *header = &info->header.v2; |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
131 |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
132 header->header_len = msn_pop8(wire); |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
133 header->opcode = msn_pop8(wire); |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
134 header->message_len = msn_pop16be(wire); |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
135 header->base_id = msn_pop32be(wire); |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
136 if (header->header_len + header->message_len + P2P_PACKET_FOOTER_SIZE > max_len) { |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
137 /* Invalid header and data length */ |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
138 len = 0; |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
139 break; |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
140 } |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
141 |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
142 if (header->header_len > 8) { |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
143 header->header_tlv = msn_tlvlist_read(wire, header->header_len - 8); |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
144 wire += header->header_len - 8; |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
145 } |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
146 |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
147 if (header->message_len > 0) { |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
148 /* Parse Data packet */ |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
149 |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
150 header->data_header_len = msn_pop8(wire); |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
151 if (header->data_header_len > header->message_len) { |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
152 /* Invalid data header length */ |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
153 len = 0; |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
154 break; |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
155 } |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
156 header->data_tf = msn_pop8(wire); |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
157 header->package_number = msn_pop16be(wire); |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
158 header->session_id = msn_pop32be(wire); |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
159 |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
160 if (header->data_header_len > 8) { |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
161 header->data_tlv = msn_tlvlist_read(wire, header->data_header_len - 8); |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
162 wire += header->data_header_len - 8; |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
163 } |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
164 } |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
165 |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
166 len = header->header_len + header->message_len; |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
167 |
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
|
168 break; |
31322
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
169 } |
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
|
170 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
171 default: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
172 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->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
|
173 } |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
174 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
175 return len; |
30768
f66e289bebc6
Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff
changeset
|
176 } |
f66e289bebc6
Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff
changeset
|
177 |
31044
7b771e6f1142
Change SLP P2P functions to use the new buffer access functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30974
diff
changeset
|
178 char * |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
179 msn_p2p_header_to_wire(MsnP2PInfo *info, size_t *len) |
30768
f66e289bebc6
Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff
changeset
|
180 { |
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
|
181 char *wire = NULL; |
31044
7b771e6f1142
Change SLP P2P functions to use the new buffer access functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30974
diff
changeset
|
182 char *tmp; |
31086
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31044
diff
changeset
|
183 |
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
|
184 switch (info->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
|
185 case MSN_P2P_VERSION_ONE: { |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
186 MsnP2PHeader *header = &info->header.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
|
187 tmp = wire = g_new(char, P2P_PACKET_HEADER_SIZE); |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
188 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
189 msn_push32le(tmp, header->session_id); |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
190 msn_push32le(tmp, header->id); |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
191 msn_push64le(tmp, header->offset); |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
192 msn_push64le(tmp, header->total_size); |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
193 msn_push32le(tmp, header->length); |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
194 msn_push32le(tmp, header->flags); |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
195 msn_push32le(tmp, header->ack_id); |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
196 msn_push32le(tmp, header->ack_sub_id); |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
197 msn_push64le(tmp, header->ack_size); |
30768
f66e289bebc6
Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff
changeset
|
198 |
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
|
199 if (len) |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
200 *len = P2P_PACKET_HEADER_SIZE; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
201 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
202 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
203 } |
30768
f66e289bebc6
Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff
changeset
|
204 |
31322
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
205 case MSN_P2P_VERSION_TWO: { |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
206 MsnP2Pv2Header *header = &info->header.v2; |
31549
506b77a27a53
This should fix TLV in from and out of the wire.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31322
diff
changeset
|
207 char *header_wire = NULL; |
506b77a27a53
This should fix TLV in from and out of the wire.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31322
diff
changeset
|
208 char *data_header_wire = NULL; |
31322
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
209 |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
210 if (header->header_tlv != NULL) |
31549
506b77a27a53
This should fix TLV in from and out of the wire.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31322
diff
changeset
|
211 header_wire = msn_tlvlist_write(header->header_tlv, (size_t *)&header->header_len); |
31322
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
212 else |
31549
506b77a27a53
This should fix TLV in from and out of the wire.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31322
diff
changeset
|
213 header->header_len = 0; |
31322
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
214 |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
215 if (header->data_tlv != NULL) |
31549
506b77a27a53
This should fix TLV in from and out of the wire.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31322
diff
changeset
|
216 data_header_wire = msn_tlvlist_write(header->data_tlv, (size_t *)&header->data_header_len); |
31322
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
217 else |
31549
506b77a27a53
This should fix TLV in from and out of the wire.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31322
diff
changeset
|
218 header->data_header_len = 0; |
31322
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
219 |
31549
506b77a27a53
This should fix TLV in from and out of the wire.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31322
diff
changeset
|
220 tmp = wire = g_new(char, 16 + header->header_len + header->data_header_len); |
31322
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
221 |
31549
506b77a27a53
This should fix TLV in from and out of the wire.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31322
diff
changeset
|
222 msn_push8(tmp, header->header_len + 8); |
31322
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
223 msn_push8(tmp, header->opcode); |
31549
506b77a27a53
This should fix TLV in from and out of the wire.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31322
diff
changeset
|
224 msn_push16be(tmp, header->data_header_len + 8 + header->message_len); |
31322
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
225 msn_push32be(tmp, header->base_id); |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
226 |
31549
506b77a27a53
This should fix TLV in from and out of the wire.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31322
diff
changeset
|
227 if (header_wire != NULL) { |
506b77a27a53
This should fix TLV in from and out of the wire.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31322
diff
changeset
|
228 memcpy(tmp, header_wire, header->header_len); |
506b77a27a53
This should fix TLV in from and out of the wire.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31322
diff
changeset
|
229 tmp += header->header_len; |
31322
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
230 } |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
231 |
31549
506b77a27a53
This should fix TLV in from and out of the wire.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31322
diff
changeset
|
232 msn_push8(tmp, header->data_header_len + 8); |
31322
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
233 msn_push8(tmp, header->data_tf); |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
234 msn_push16be(tmp, header->package_number); |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
235 msn_push32be(tmp, header->session_id); |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
236 |
31549
506b77a27a53
This should fix TLV in from and out of the wire.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31322
diff
changeset
|
237 if (data_header_wire != NULL) { |
506b77a27a53
This should fix TLV in from and out of the wire.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31322
diff
changeset
|
238 memcpy(tmp, data_header_wire, header->data_header_len); |
506b77a27a53
This should fix TLV in from and out of the wire.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31322
diff
changeset
|
239 tmp += header->data_header_len; |
31322
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
240 } |
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
241 |
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
|
242 if (len) |
31549
506b77a27a53
This should fix TLV in from and out of the wire.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31322
diff
changeset
|
243 *len = header->header_len + header->data_header_len + 16; |
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
|
244 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
245 break; |
31322
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31320
diff
changeset
|
246 } |
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
|
247 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
248 default: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
249 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->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
|
250 } |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
251 |
30771
198d5bf82e09
Oops, forgot to save before commiting.
masca@cpw.pidgin.im
parents:
30768
diff
changeset
|
252 return wire; |
30768
f66e289bebc6
Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff
changeset
|
253 } |
f66e289bebc6
Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff
changeset
|
254 |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
255 size_t |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
256 msn_p2p_footer_from_wire(MsnP2PInfo *info, const char *wire) |
30782 | 257 { |
258 MsnP2PFooter *footer; | |
259 | |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
260 footer = &info->footer; |
30782 | 261 |
31044
7b771e6f1142
Change SLP P2P functions to use the new buffer access functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30974
diff
changeset
|
262 footer->value = msn_pop32be(wire); |
30782 | 263 |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
264 return P2P_PACKET_FOOTER_SIZE; |
30782 | 265 } |
266 | |
31044
7b771e6f1142
Change SLP P2P functions to use the new buffer access functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30974
diff
changeset
|
267 char * |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
268 msn_p2p_footer_to_wire(MsnP2PInfo *info, size_t *len) |
30782 | 269 { |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
270 MsnP2PFooter *footer; |
31044
7b771e6f1142
Change SLP P2P functions to use the new buffer access functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30974
diff
changeset
|
271 char *wire; |
7b771e6f1142
Change SLP P2P functions to use the new buffer access functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30974
diff
changeset
|
272 char *tmp; |
30782 | 273 |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
274 footer = &info->footer; |
31044
7b771e6f1142
Change SLP P2P functions to use the new buffer access functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30974
diff
changeset
|
275 tmp = wire = g_new(char, P2P_PACKET_FOOTER_SIZE); |
30782 | 276 |
31044
7b771e6f1142
Change SLP P2P functions to use the new buffer access functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30974
diff
changeset
|
277 msn_push32be(tmp, footer->value); |
30782 | 278 |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
279 if (len) |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
280 *len = P2P_PACKET_FOOTER_SIZE; |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
281 |
30782 | 282 return wire; |
283 } | |
284 | |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
285 void |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
286 msn_p2p_info_to_string(MsnP2PInfo *info, GString *str) |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
287 { |
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
|
288 switch (info->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
|
289 case MSN_P2P_VERSION_ONE: { |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
290 MsnP2PHeader *header = &info->header.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
|
291 g_string_append_printf(str, "Session ID: %u\r\n", header->session_id); |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
292 g_string_append_printf(str, "ID: %u\r\n", header->id); |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
293 g_string_append_printf(str, "Offset: %" G_GUINT64_FORMAT "\r\n", header->offset); |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
294 g_string_append_printf(str, "Total size: %" G_GUINT64_FORMAT "\r\n", header->total_size); |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
295 g_string_append_printf(str, "Length: %u\r\n", header->length); |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
296 g_string_append_printf(str, "Flags: 0x%x\r\n", header->flags); |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
297 g_string_append_printf(str, "ACK ID: %u\r\n", header->ack_id); |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
298 g_string_append_printf(str, "SUB ID: %u\r\n", header->ack_sub_id); |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
299 g_string_append_printf(str, "ACK Size: %" G_GUINT64_FORMAT "\r\n", header->ack_size); |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
300 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
301 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
302 } |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
303 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
304 case MSN_P2P_VERSION_TWO: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
305 /* Nothing to do! */ |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
306 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
307 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
308 default: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
309 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->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
|
310 } |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
311 |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
312 g_string_append_printf(str, "Footer: 0x%08X\r\n", info->footer.value); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
313 } |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
314 |
30868
5964f65c17ed
Avoid duplicated code using a util function to check the flags.
masca@cpw.pidgin.im
parents:
30782
diff
changeset
|
315 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
|
316 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:
30782
diff
changeset
|
317 { |
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
|
318 gboolean data = FALSE; |
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
|
319 |
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
|
320 switch (info->version) { |
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
|
321 case MSN_P2P_VERSION_ONE: { |
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
|
322 guint32 flags = info->header.v1.flags; |
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
|
323 data = (flags == P2P_MSN_OBJ_DATA || |
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
|
324 flags == (P2P_WLM2009_COMP | P2P_MSN_OBJ_DATA) || |
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
|
325 flags == P2P_FILE_DATA); |
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
|
326 break; |
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
|
327 } |
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
|
328 |
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
|
329 case MSN_P2P_VERSION_TWO: |
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
|
330 data = info->header.v2.message_len > 0; |
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
|
331 break; |
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
|
332 |
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
|
333 default: |
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
|
334 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->version); |
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
|
335 } |
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
|
336 |
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
|
337 return data; |
30868
5964f65c17ed
Avoid duplicated code using a util function to check the flags.
masca@cpw.pidgin.im
parents:
30782
diff
changeset
|
338 } |
31044
7b771e6f1142
Change SLP P2P functions to use the new buffer access functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30974
diff
changeset
|
339 |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
340 gboolean |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
341 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:
31086
diff
changeset
|
342 { |
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
|
343 gboolean valid = FALSE; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
344 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
345 switch (info->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
|
346 case MSN_P2P_VERSION_ONE: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
347 valid = info->header.v1.total_size >= info->header.v1.length; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
348 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
349 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
350 case MSN_P2P_VERSION_TWO: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
351 /* Nothing to do! */ |
31585
1e657ff2eacb
Hide some offset occurrences and define a couple of abstractions in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31584
diff
changeset
|
352 valid = TRUE; |
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
|
353 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
354 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
355 default: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
356 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->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
|
357 } |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
358 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
359 return valid; |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
360 } |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
361 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
362 gboolean |
31585
1e657ff2eacb
Hide some offset occurrences and define a couple of abstractions in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31584
diff
changeset
|
363 msn_p2p_info_is_first(MsnP2PInfo *info) |
1e657ff2eacb
Hide some offset occurrences and define a couple of abstractions in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31584
diff
changeset
|
364 { |
1e657ff2eacb
Hide some offset occurrences and define a couple of abstractions in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31584
diff
changeset
|
365 gboolean first = FALSE; |
1e657ff2eacb
Hide some offset occurrences and define a couple of abstractions in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31584
diff
changeset
|
366 |
1e657ff2eacb
Hide some offset occurrences and define a couple of abstractions in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31584
diff
changeset
|
367 switch (info->version) { |
1e657ff2eacb
Hide some offset occurrences and define a couple of abstractions in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31584
diff
changeset
|
368 case MSN_P2P_VERSION_ONE: |
1e657ff2eacb
Hide some offset occurrences and define a couple of abstractions in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31584
diff
changeset
|
369 first = info->header.v1.offset == 0; |
1e657ff2eacb
Hide some offset occurrences and define a couple of abstractions in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31584
diff
changeset
|
370 break; |
1e657ff2eacb
Hide some offset occurrences and define a couple of abstractions in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31584
diff
changeset
|
371 |
1e657ff2eacb
Hide some offset occurrences and define a couple of abstractions in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31584
diff
changeset
|
372 case MSN_P2P_VERSION_TWO: |
1e657ff2eacb
Hide some offset occurrences and define a couple of abstractions in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31584
diff
changeset
|
373 /* Nothing to do! */ |
1e657ff2eacb
Hide some offset occurrences and define a couple of abstractions in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31584
diff
changeset
|
374 first = info->header.v2.data_tf & TF_FIRST; |
1e657ff2eacb
Hide some offset occurrences and define a couple of abstractions in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31584
diff
changeset
|
375 break; |
1e657ff2eacb
Hide some offset occurrences and define a couple of abstractions in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31584
diff
changeset
|
376 |
1e657ff2eacb
Hide some offset occurrences and define a couple of abstractions in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31584
diff
changeset
|
377 default: |
1e657ff2eacb
Hide some offset occurrences and define a couple of abstractions in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31584
diff
changeset
|
378 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->version); |
1e657ff2eacb
Hide some offset occurrences and define a couple of abstractions in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31584
diff
changeset
|
379 } |
1e657ff2eacb
Hide some offset occurrences and define a couple of abstractions in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31584
diff
changeset
|
380 |
1e657ff2eacb
Hide some offset occurrences and define a couple of abstractions in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31584
diff
changeset
|
381 return first; |
1e657ff2eacb
Hide some offset occurrences and define a couple of abstractions in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31584
diff
changeset
|
382 } |
1e657ff2eacb
Hide some offset occurrences and define a couple of abstractions in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31584
diff
changeset
|
383 |
1e657ff2eacb
Hide some offset occurrences and define a couple of abstractions in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31584
diff
changeset
|
384 gboolean |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
385 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:
31086
diff
changeset
|
386 { |
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
|
387 gboolean final = FALSE; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
388 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
389 switch (info->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
|
390 case MSN_P2P_VERSION_ONE: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
391 final = info->header.v1.offset + info->header.v1.length >= info->header.v1.total_size; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
392 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
393 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
394 case MSN_P2P_VERSION_TWO: |
31586
f5fbcdd07d48
Rename this enums a little better. And I don't think we need these
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31585
diff
changeset
|
395 final = msn_tlv_gettlv(info->header.v2.data_tlv, P2P_DATA_TLV_REMAINING, 1) == NULL; |
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
|
396 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
397 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
398 default: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
399 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->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
|
400 } |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
401 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
402 return final; |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
403 } |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
404 |
31567
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
405 void |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
406 msn_p2p_info_create_ack(MsnP2PInfo *old_info, MsnP2PInfo *new_info) |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
407 { |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
408 switch (old_info->version) { |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
409 case MSN_P2P_VERSION_ONE: { |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
410 MsnP2PHeader *old = &old_info->header.v1; |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
411 MsnP2PHeader *new = &new_info->header.v1; |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
412 |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
413 new->session_id = old->session_id; |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
414 new->flags = P2P_ACK; |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
415 new->ack_id = old->id; |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
416 new->ack_sub_id = old->ack_id; |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
417 new->ack_size = old->total_size; |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
418 break; |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
419 } |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
420 |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
421 case MSN_P2P_VERSION_TWO: { |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
422 MsnP2Pv2Header *old = &old_info->header.v2; |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
423 MsnP2Pv2Header *new = &new_info->header.v2; |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
424 |
31586
f5fbcdd07d48
Rename this enums a little better. And I don't think we need these
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31585
diff
changeset
|
425 msn_tlvlist_add_32(&new->header_tlv, P2P_HEADER_TLV_TYPE_ACK, old->base_id + old->message_len); |
31567
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
426 new->opcode = P2P_OPCODE_NONE; |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
427 |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
428 if (old->message_len > 0) { |
31586
f5fbcdd07d48
Rename this enums a little better. And I don't think we need these
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31585
diff
changeset
|
429 if (!msn_tlv_gettlv(old->header_tlv, P2P_HEADER_TLV_TYPE_ACK, 1)) { |
31567
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
430 if (old->opcode & P2P_OPCODE_SYN) { |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
431 msn_tlv_t *ack_tlv; |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
432 new->opcode |= P2P_OPCODE_RAK; |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
433 |
31586
f5fbcdd07d48
Rename this enums a little better. And I don't think we need these
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31585
diff
changeset
|
434 ack_tlv = msn_tlv_gettlv(old->header_tlv, P2P_HEADER_TLV_TYPE_PEER_INFO, 1); |
31567
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
435 if (ack_tlv) { |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
436 msn_tlvlist_add_tlv(&new->header_tlv, ack_tlv); |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
437 new->opcode |= P2P_OPCODE_SYN; |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
438 } |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
439 } |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
440 } |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
441 } |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
442 break; |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
443 } |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
444 |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
445 default: |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
446 purple_debug_error("msn", "Invalid P2P Info version: %d\n", old_info->version); |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
447 } |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
448 } |
968103d932d6
Add P2Pv2 ack'ing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31551
diff
changeset
|
449 |
31568
50ca9e64186b
Only send acks on p2pv2 when required.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31567
diff
changeset
|
450 gboolean |
50ca9e64186b
Only send acks on p2pv2 when required.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31567
diff
changeset
|
451 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
|
452 { |
50ca9e64186b
Only send acks on p2pv2 when required.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31567
diff
changeset
|
453 gboolean ret = FALSE; |
50ca9e64186b
Only send acks on p2pv2 when required.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31567
diff
changeset
|
454 |
50ca9e64186b
Only send acks on p2pv2 when required.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31567
diff
changeset
|
455 switch (info->version) { |
50ca9e64186b
Only send acks on p2pv2 when required.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31567
diff
changeset
|
456 case MSN_P2P_VERSION_ONE: { |
50ca9e64186b
Only send acks on p2pv2 when required.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31567
diff
changeset
|
457 guint32 flags = msn_p2p_info_get_flags(info); |
50ca9e64186b
Only send acks on p2pv2 when required.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31567
diff
changeset
|
458 |
50ca9e64186b
Only send acks on p2pv2 when required.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31567
diff
changeset
|
459 ret = flags == P2P_NO_FLAG || flags == P2P_WLM2009_COMP || |
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
|
460 msn_p2p_msg_is_data(info); |
31568
50ca9e64186b
Only send acks on p2pv2 when required.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31567
diff
changeset
|
461 break; |
50ca9e64186b
Only send acks on p2pv2 when required.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31567
diff
changeset
|
462 } |
50ca9e64186b
Only send acks on p2pv2 when required.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31567
diff
changeset
|
463 |
50ca9e64186b
Only send acks on p2pv2 when required.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31567
diff
changeset
|
464 case MSN_P2P_VERSION_TWO: |
50ca9e64186b
Only send acks on p2pv2 when required.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31567
diff
changeset
|
465 ret = (info->header.v2.opcode & P2P_OPCODE_RAK) > 0; |
50ca9e64186b
Only send acks on p2pv2 when required.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31567
diff
changeset
|
466 break; |
50ca9e64186b
Only send acks on p2pv2 when required.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31567
diff
changeset
|
467 |
50ca9e64186b
Only send acks on p2pv2 when required.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31567
diff
changeset
|
468 default: |
50ca9e64186b
Only send acks on p2pv2 when required.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31567
diff
changeset
|
469 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->version); |
50ca9e64186b
Only send acks on p2pv2 when required.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31567
diff
changeset
|
470 } |
50ca9e64186b
Only send acks on p2pv2 when required.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31567
diff
changeset
|
471 |
50ca9e64186b
Only send acks on p2pv2 when required.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31567
diff
changeset
|
472 return ret; |
50ca9e64186b
Only send acks on p2pv2 when required.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31567
diff
changeset
|
473 } |
50ca9e64186b
Only send acks on p2pv2 when required.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31567
diff
changeset
|
474 |
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
|
475 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
|
476 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
|
477 { |
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
|
478 gboolean ret = FALSE; |
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
|
479 |
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
|
480 switch (info->version) { |
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
|
481 case MSN_P2P_VERSION_ONE: { |
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
|
482 ret = msn_p2p_info_get_flags(info) == P2P_ACK; |
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
|
483 break; |
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
|
484 } |
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
|
485 |
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
|
486 case MSN_P2P_VERSION_TWO: |
31586
f5fbcdd07d48
Rename this enums a little better. And I don't think we need these
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31585
diff
changeset
|
487 ret = msn_tlv_gettlv(info->header.v2.header_tlv, P2P_HEADER_TLV_TYPE_ACK, 1) != NULL; |
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
|
488 break; |
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
|
489 |
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
|
490 default: |
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
|
491 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->version); |
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
|
492 } |
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
|
493 |
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
|
494 return ret; |
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
|
495 } |
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
|
496 |
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
|
497 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
|
498 msn_p2p_info_init_first(MsnP2PInfo *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
|
499 { |
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
|
500 switch (info->version) { |
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
|
501 case MSN_P2P_VERSION_ONE: |
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
|
502 info->header.v1.session_id = old_info->header.v1.session_id; |
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
|
503 info->header.v1.flags = old_info->header.v1.flags; |
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
|
504 break; |
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
|
505 |
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
|
506 case MSN_P2P_VERSION_TWO: |
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
|
507 info->header.v2.data_tf = TF_FIRST; |
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
|
508 break; |
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
|
509 |
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
|
510 default: |
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
|
511 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->version); |
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
|
512 } |
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
|
513 } |
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
|
514 |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
515 guint32 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
516 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:
31086
diff
changeset
|
517 { |
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
|
518 guint32 session_id = 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
|
519 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
520 switch (info->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
|
521 case MSN_P2P_VERSION_ONE: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
522 session_id = info->header.v1.session_id; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
523 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
524 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
525 case MSN_P2P_VERSION_TWO: |
31551
f518effe7395
I think this is the way to map to P2Pv2, but I don't have Internet
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31549
diff
changeset
|
526 session_id = info->header.v2.session_id; |
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
|
527 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
528 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
529 default: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
530 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->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
|
531 } |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
532 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
533 return session_id; |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
534 } |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
535 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
536 guint32 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
537 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:
31086
diff
changeset
|
538 { |
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
|
539 guint32 id = 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
|
540 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
541 switch (info->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
|
542 case MSN_P2P_VERSION_ONE: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
543 id = info->header.v1.id; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
544 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
545 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
546 case MSN_P2P_VERSION_TWO: |
31551
f518effe7395
I think this is the way to map to P2Pv2, but I don't have Internet
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31549
diff
changeset
|
547 id = info->header.v2.base_id; |
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
|
548 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
549 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
550 default: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
551 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->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
|
552 } |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
553 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
554 return id; |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
555 } |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
556 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
557 guint64 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
558 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:
31086
diff
changeset
|
559 { |
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
|
560 guint64 offset = 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
|
561 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
562 switch (info->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
|
563 case MSN_P2P_VERSION_ONE: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
564 offset = info->header.v1.offset; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
565 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
566 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
567 case MSN_P2P_VERSION_TWO: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
568 /* Nothing to do! */ |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
569 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
570 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
571 default: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
572 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->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
|
573 } |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
574 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
575 return offset; |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
576 } |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
577 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
578 guint64 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
579 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:
31086
diff
changeset
|
580 { |
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
|
581 guint64 total_size = 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
|
582 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
583 switch (info->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
|
584 case MSN_P2P_VERSION_ONE: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
585 total_size = info->header.v1.total_size; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
586 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
587 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
588 case MSN_P2P_VERSION_TWO: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
589 /* Nothing to do! */ |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
590 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
591 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
592 default: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
593 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->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
|
594 } |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
595 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
596 return total_size; |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
597 } |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
598 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
599 guint32 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
600 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:
31086
diff
changeset
|
601 { |
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
|
602 guint32 length = 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
|
603 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
604 switch (info->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
|
605 case MSN_P2P_VERSION_ONE: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
606 length = info->header.v1.length; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
607 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
608 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
609 case MSN_P2P_VERSION_TWO: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
610 /* Nothing to do! */ |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
611 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
612 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
613 default: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
614 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->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
|
615 } |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
616 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
617 return length; |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
618 } |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
619 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
620 guint32 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
621 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:
31086
diff
changeset
|
622 { |
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
|
623 guint32 flags = 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
|
624 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
625 switch (info->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
|
626 case MSN_P2P_VERSION_ONE: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
627 flags = info->header.v1.flags; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
628 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
629 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
630 case MSN_P2P_VERSION_TWO: |
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
|
631 flags = info->header.v2.data_tf; |
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
|
632 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
633 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
634 default: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
635 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->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
|
636 } |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
637 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
638 return flags; |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
639 } |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
640 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
641 guint32 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
642 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:
31086
diff
changeset
|
643 { |
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
|
644 guint32 ack_id = 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
|
645 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
646 switch (info->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
|
647 case MSN_P2P_VERSION_ONE: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
648 ack_id = info->header.v1.ack_id; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
649 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
650 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
651 case MSN_P2P_VERSION_TWO: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
652 /* Nothing to do! */ |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
653 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
654 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
655 default: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
656 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->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
|
657 } |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
658 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
659 return ack_id; |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
660 } |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
661 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
662 guint32 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
663 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:
31086
diff
changeset
|
664 { |
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
|
665 guint32 ack_sub_id = 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
|
666 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
667 switch (info->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
|
668 case MSN_P2P_VERSION_ONE: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
669 ack_sub_id = info->header.v1.ack_sub_id; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
670 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
671 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
672 case MSN_P2P_VERSION_TWO: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
673 /* Nothing to do! */ |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
674 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
675 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
676 default: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
677 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->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
|
678 } |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
679 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
680 return ack_sub_id; |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
681 } |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
682 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
683 guint64 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
684 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:
31086
diff
changeset
|
685 { |
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
|
686 guint64 ack_size = 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
|
687 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
688 switch (info->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
|
689 case MSN_P2P_VERSION_ONE: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
690 ack_size = info->header.v1.ack_size; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
691 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
692 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
693 case MSN_P2P_VERSION_TWO: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
694 /* Nothing to do! */ |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
695 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
696 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
697 default: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
698 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->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
|
699 } |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
700 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
701 return ack_size; |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
702 } |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
703 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
704 guint32 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
705 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:
31086
diff
changeset
|
706 { |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
707 return info->footer.value; |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
708 } |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
709 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
710 void |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
711 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:
31086
diff
changeset
|
712 { |
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
|
713 switch (info->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
|
714 case MSN_P2P_VERSION_ONE: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
715 info->header.v1.session_id = session_id; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
716 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
717 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
718 case MSN_P2P_VERSION_TWO: |
31551
f518effe7395
I think this is the way to map to P2Pv2, but I don't have Internet
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31549
diff
changeset
|
719 info->header.v2.session_id = session_id; |
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
|
720 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
721 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
722 default: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
723 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->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
|
724 } |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
725 |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
726 } |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
727 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
728 void |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
729 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:
31086
diff
changeset
|
730 { |
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
|
731 switch (info->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
|
732 case MSN_P2P_VERSION_ONE: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
733 info->header.v1.id = id; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
734 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
735 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
736 case MSN_P2P_VERSION_TWO: |
31551
f518effe7395
I think this is the way to map to P2Pv2, but I don't have Internet
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31549
diff
changeset
|
737 info->header.v2.base_id = id; |
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
|
738 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
739 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
740 default: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
741 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->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
|
742 } |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
743 |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
744 } |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
745 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
746 void |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
747 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:
31086
diff
changeset
|
748 { |
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
|
749 switch (info->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
|
750 case MSN_P2P_VERSION_ONE: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
751 info->header.v1.offset = offset; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
752 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
753 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
754 case MSN_P2P_VERSION_TWO: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
755 /* Nothing to do! */ |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
756 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
757 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
758 default: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
759 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->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
|
760 } |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
761 } |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
762 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
763 void |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
764 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:
31086
diff
changeset
|
765 { |
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
|
766 switch (info->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
|
767 case MSN_P2P_VERSION_ONE: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
768 info->header.v1.total_size = total_size; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
769 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
770 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
771 case MSN_P2P_VERSION_TWO: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
772 /* Nothing to do! */ |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
773 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
774 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
775 default: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
776 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->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
|
777 } |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
778 } |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
779 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
780 void |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
781 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:
31086
diff
changeset
|
782 { |
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
|
783 switch (info->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
|
784 case MSN_P2P_VERSION_ONE: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
785 info->header.v1.length = length; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
786 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
787 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
788 case MSN_P2P_VERSION_TWO: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
789 /* Nothing to do! */ |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
790 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
791 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
792 default: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
793 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->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
|
794 } |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
795 } |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
796 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
797 void |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
798 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:
31086
diff
changeset
|
799 { |
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
|
800 switch (info->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
|
801 case MSN_P2P_VERSION_ONE: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
802 info->header.v1.flags = flags; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
803 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
804 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
805 case MSN_P2P_VERSION_TWO: |
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
|
806 info->header.v2.data_tf = flags; |
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
|
807 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
808 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
809 default: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
810 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->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
|
811 } |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
812 } |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
813 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
814 void |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
815 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:
31086
diff
changeset
|
816 { |
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
|
817 switch (info->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
|
818 case MSN_P2P_VERSION_ONE: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
819 info->header.v1.ack_id = ack_id; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
820 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
821 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
822 case MSN_P2P_VERSION_TWO: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
823 /* Nothing to do! */ |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
824 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
825 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
826 default: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
827 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->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
|
828 } |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
829 } |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
830 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
831 void |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
832 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:
31086
diff
changeset
|
833 { |
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
|
834 switch (info->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
|
835 case MSN_P2P_VERSION_ONE: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
836 info->header.v1.ack_sub_id = ack_sub_id; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
837 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
838 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
839 case MSN_P2P_VERSION_TWO: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
840 /* Nothing to do! */ |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
841 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
842 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
843 default: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
844 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->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
|
845 } |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
846 } |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
847 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
848 void |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
849 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:
31086
diff
changeset
|
850 { |
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
|
851 switch (info->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
|
852 case MSN_P2P_VERSION_ONE: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
853 info->header.v1.ack_size = ack_size; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
854 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
855 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
856 case MSN_P2P_VERSION_TWO: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
857 /* Nothing to do! */ |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
858 break; |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
859 |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
860 default: |
9562a7baa9e4
Add P2Pv2 header information to the P2P info struct. Of course, all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
861 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->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
|
862 } |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
863 } |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
864 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
865 void |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
866 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:
31086
diff
changeset
|
867 { |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
868 info->footer.value = app_id; |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
869 } |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31086
diff
changeset
|
870 |