Sat, 27 Nov 2010 07:56:27 +0000
These new files are missing GPL headers. And fix a couple incorrect
names in there.
|
31180
3f527ea0d2ea
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31070
diff
changeset
|
1 | /** |
|
3f527ea0d2ea
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31070
diff
changeset
|
2 | * @file p2p.h MSN P2P functions |
|
3f527ea0d2ea
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31070
diff
changeset
|
3 | * |
|
3f527ea0d2ea
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31070
diff
changeset
|
4 | * purple |
|
3f527ea0d2ea
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31070
diff
changeset
|
5 | * |
|
3f527ea0d2ea
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31070
diff
changeset
|
6 | * Purple is the legal property of its developers, whose names are too numerous |
|
3f527ea0d2ea
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31070
diff
changeset
|
7 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
3f527ea0d2ea
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31070
diff
changeset
|
8 | * source distribution. |
|
3f527ea0d2ea
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31070
diff
changeset
|
9 | * |
|
3f527ea0d2ea
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31070
diff
changeset
|
10 | * This program is free software; you can redistribute it and/or modify |
|
3f527ea0d2ea
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31070
diff
changeset
|
11 | * it under the terms of the GNU General Public License as published by |
|
3f527ea0d2ea
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31070
diff
changeset
|
12 | * the Free Software Foundation; either version 2 of the License, or |
|
3f527ea0d2ea
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31070
diff
changeset
|
13 | * (at your option) any later version. |
|
3f527ea0d2ea
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31070
diff
changeset
|
14 | * |
|
3f527ea0d2ea
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31070
diff
changeset
|
15 | * This program is distributed in the hope that it will be useful, |
|
3f527ea0d2ea
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31070
diff
changeset
|
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
3f527ea0d2ea
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31070
diff
changeset
|
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
3f527ea0d2ea
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31070
diff
changeset
|
18 | * GNU General Public License for more details. |
|
3f527ea0d2ea
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31070
diff
changeset
|
19 | * |
|
3f527ea0d2ea
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31070
diff
changeset
|
20 | * You should have received a copy of the GNU General Public License |
|
3f527ea0d2ea
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31070
diff
changeset
|
21 | * along with this program; if not, write to the Free Software |
|
3f527ea0d2ea
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31070
diff
changeset
|
22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
3f527ea0d2ea
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31070
diff
changeset
|
23 | */ |
|
3f527ea0d2ea
These new files are missing GPL headers. And fix a couple incorrect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31070
diff
changeset
|
24 | |
|
30967
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
25 | #ifndef MSN_P2P_H |
|
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
26 | #define MSN_P2P_H |
|
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
27 | |
|
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
28 | |
|
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
29 | #pragma pack(push,1) |
|
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
30 | typedef struct { |
|
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
31 | guint32 session_id; |
|
30968
414d71c431a2
Chang member name so it is compatible with MsnSlpHeader struct names.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30967
diff
changeset
|
32 | guint32 id; |
|
31065
6094ffb96a11
Get rid of the offset field in the SlpMessage in favor of the one in the Header.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31050
diff
changeset
|
33 | /** |
|
6094ffb96a11
Get rid of the offset field in the SlpMessage in favor of the one in the Header.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31050
diff
changeset
|
34 | * In a MsnSlpMessage: |
|
6094ffb96a11
Get rid of the offset field in the SlpMessage in favor of the one in the Header.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31050
diff
changeset
|
35 | * For outgoing messages this is the number of bytes from buffer that |
|
6094ffb96a11
Get rid of the offset field in the SlpMessage in favor of the one in the Header.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31050
diff
changeset
|
36 | * have already been sent out. For incoming messages this is the |
|
6094ffb96a11
Get rid of the offset field in the SlpMessage in favor of the one in the Header.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31050
diff
changeset
|
37 | * number of bytes that have been written to buffer. |
|
6094ffb96a11
Get rid of the offset field in the SlpMessage in favor of the one in the Header.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31050
diff
changeset
|
38 | */ |
|
30967
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
39 | guint64 offset; |
|
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
40 | guint64 total_size; |
|
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
41 | guint32 length; |
|
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
42 | guint32 flags; |
|
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
43 | guint32 ack_id; |
|
30968
414d71c431a2
Chang member name so it is compatible with MsnSlpHeader struct names.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30967
diff
changeset
|
44 | guint32 ack_sub_id; |
|
30967
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
45 | guint64 ack_size; |
|
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
46 | /* guint8 body[1]; */ |
|
30971
39a254a27343
Drop Binary from the struct name.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30970
diff
changeset
|
47 | } MsnP2PHeader; |
|
30967
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
48 | #pragma pack(pop) |
|
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
49 | |
|
31041
60e29347974b
Add initial P2Pv2 header definition.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31001
diff
changeset
|
50 | #pragma pack(push,1) |
|
60e29347974b
Add initial P2Pv2 header definition.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31001
diff
changeset
|
51 | typedef struct { |
|
60e29347974b
Add initial P2Pv2 header definition.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31001
diff
changeset
|
52 | guint8 header_len; |
|
60e29347974b
Add initial P2Pv2 header definition.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31001
diff
changeset
|
53 | guint8 opcode; |
|
31050
5d8f53b24b35
Fix some field sizes in P2Pv2 header.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31046
diff
changeset
|
54 | guint16 message_len; |
|
5d8f53b24b35
Fix some field sizes in P2Pv2 header.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31046
diff
changeset
|
55 | guint32 base_id; |
|
31041
60e29347974b
Add initial P2Pv2 header definition.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31001
diff
changeset
|
56 | } MsnP2Pv2Header; |
|
60e29347974b
Add initial P2Pv2 header definition.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31001
diff
changeset
|
57 | #pragma pack(pop) |
|
60e29347974b
Add initial P2Pv2 header definition.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31001
diff
changeset
|
58 | |
|
30970
432037e01d4f
Drop MsnSlpFooter in favor of MsnP2pFooter.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30968
diff
changeset
|
59 | typedef struct |
|
432037e01d4f
Drop MsnSlpFooter in favor of MsnP2pFooter.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30968
diff
changeset
|
60 | { |
|
432037e01d4f
Drop MsnSlpFooter in favor of MsnP2pFooter.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30968
diff
changeset
|
61 | guint32 value; |
|
432037e01d4f
Drop MsnSlpFooter in favor of MsnP2pFooter.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30968
diff
changeset
|
62 | } MsnP2PFooter; |
|
432037e01d4f
Drop MsnSlpFooter in favor of MsnP2pFooter.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30968
diff
changeset
|
63 | |
|
30967
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
64 | typedef enum |
|
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
65 | { |
|
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
66 | P2P_NO_FLAG = 0x0, /**< No flags specified */ |
|
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
67 | P2P_OUT_OF_ORDER = 0x1, /**< Chunk out-of-order */ |
|
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
68 | P2P_ACK = 0x2, /**< Acknowledgement */ |
|
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
69 | P2P_PENDING_INVITE = 0x4, /**< There is a pending invite */ |
|
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
70 | P2P_BINARY_ERROR = 0x8, /**< Error on the binary level */ |
|
31043
34a5263c96a6
Add some more flag definitions to the p2p flags.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31041
diff
changeset
|
71 | P2P_FILE = 0x10, /**< File */ |
|
30967
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
72 | P2P_MSN_OBJ_DATA = 0x20, /**< MsnObject data */ |
|
31043
34a5263c96a6
Add some more flag definitions to the p2p flags.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31041
diff
changeset
|
73 | P2P_CLOSE = 0x40, /**< Close session */ |
|
34a5263c96a6
Add some more flag definitions to the p2p flags.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31041
diff
changeset
|
74 | P2P_TLP_ERROR = 0x80, /**< Error at transport layer protocol */ |
|
34a5263c96a6
Add some more flag definitions to the p2p flags.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31041
diff
changeset
|
75 | P2P_DC_HANDSHAKE = 0x100, /**< Direct Handshake */ |
|
30967
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
76 | P2P_WML2009_COMP = 0x1000000, /**< Compatibility with WLM 2009 */ |
|
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
77 | P2P_FILE_DATA = 0x1000030 /**< File transfer data */ |
|
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
78 | } MsnP2PHeaderFlag; |
|
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
79 | /* Info From: |
|
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
80 | * http://msnpiki.msnfanatic.com/index.php/MSNC:P2Pv1_Headers#Flags |
|
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
81 | * http://trac.kmess.org/changeset/ba04d0c825769d23370511031c47f6be75fe9b86 |
|
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
82 | * #7180 |
|
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
83 | */ |
|
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
84 | |
|
31046
33671e05cf24
Documetn P2P Application ID in a enum and use it instead of 'magic numbers'.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31043
diff
changeset
|
85 | typedef enum |
|
33671e05cf24
Documetn P2P Application ID in a enum and use it instead of 'magic numbers'.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31043
diff
changeset
|
86 | { |
|
33671e05cf24
Documetn P2P Application ID in a enum and use it instead of 'magic numbers'.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31043
diff
changeset
|
87 | P2P_APPID_SESION = 0x0, /**< Negotiating session */ |
|
33671e05cf24
Documetn P2P Application ID in a enum and use it instead of 'magic numbers'.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31043
diff
changeset
|
88 | P2P_APPID_OBJ = 0x1, /**< MsnObject (Display or Emoticon) */ |
|
33671e05cf24
Documetn P2P Application ID in a enum and use it instead of 'magic numbers'.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31043
diff
changeset
|
89 | P2P_APPID_FILE = 0x2, /**< File transfer */ |
|
33671e05cf24
Documetn P2P Application ID in a enum and use it instead of 'magic numbers'.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31043
diff
changeset
|
90 | P2P_APPID_EMOTE = 0xB, /**< CustomEmoticon */ |
|
33671e05cf24
Documetn P2P Application ID in a enum and use it instead of 'magic numbers'.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31043
diff
changeset
|
91 | P2P_APPID_DISPLAY = 0xC /**< Display Image */ |
|
33671e05cf24
Documetn P2P Application ID in a enum and use it instead of 'magic numbers'.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31043
diff
changeset
|
92 | } MsnP2PAppId; |
|
33671e05cf24
Documetn P2P Application ID in a enum and use it instead of 'magic numbers'.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31043
diff
changeset
|
93 | |
|
30971
39a254a27343
Drop Binary from the struct name.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30970
diff
changeset
|
94 | #define P2P_PACKET_HEADER_SIZE sizeof(MsnP2PHeader) |
|
31001
2d0c27d3c371
Add a P2PFooter size define.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30984
diff
changeset
|
95 | #define P2P_PACKET_FOOTER_SIZE sizeof(MsnP2PFooter) |
|
30967
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
96 | |
|
30972
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30971
diff
changeset
|
97 | MsnP2PHeader * |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30971
diff
changeset
|
98 | msn_p2p_header_from_wire(MsnP2PHeader *wire); |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30971
diff
changeset
|
99 | |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30971
diff
changeset
|
100 | MsnP2PHeader * |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30971
diff
changeset
|
101 | msn_p2p_header_to_wire(MsnP2PHeader *header); |
|
30967
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
102 | |
|
30984
2898559aaaa7
Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30976
diff
changeset
|
103 | MsnP2PFooter * |
|
2898559aaaa7
Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30976
diff
changeset
|
104 | msn_p2p_footer_from_wire(MsnP2PFooter *wire); |
|
2898559aaaa7
Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30976
diff
changeset
|
105 | |
|
2898559aaaa7
Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30976
diff
changeset
|
106 | MsnP2PFooter * |
|
2898559aaaa7
Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30976
diff
changeset
|
107 | msn_p2p_footer_to_wire(MsnP2PFooter *footer); |
|
2898559aaaa7
Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30976
diff
changeset
|
108 | |
|
31070
2a60d87864b9
Avoid duplicated code using a util function to check the flags.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31065
diff
changeset
|
109 | gboolean |
|
2a60d87864b9
Avoid duplicated code using a util function to check the flags.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31065
diff
changeset
|
110 | msn_p2p_msg_is_data(const MsnP2PHeaderFlag flags); |
|
2a60d87864b9
Avoid duplicated code using a util function to check the flags.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
31065
diff
changeset
|
111 | |
|
30967
578391ef28a4
Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
112 | #endif /* MSN_P2P_H */ |