libpurple/protocols/msn/p2p.h

Sat, 03 Jul 2010 05:22:58 +0000

author
Jorge Villaseñor <masca@cpw.pidgin.im>
date
Sat, 03 Jul 2010 05:22:58 +0000
branch
soc.2010.msn-tlc
changeset 31041
60e29347974b
parent 31001
2d0c27d3c371
child 31043
34a5263c96a6
permissions
-rw-r--r--

Add initial P2Pv2 header definition.

30967
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
1 #ifndef MSN_P2P_H
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
2 #define MSN_P2P_H
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
3
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
4
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
5 #pragma pack(push,1)
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
6 typedef struct {
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
7 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
8 guint32 id;
30967
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
9 guint64 offset;
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
10 guint64 total_size;
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
11 guint32 length;
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
12 guint32 flags;
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
13 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
14 guint32 ack_sub_id;
30967
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
15 guint64 ack_size;
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
16 /* guint8 body[1]; */
30971
39a254a27343 Drop Binary from the struct name.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30970
diff changeset
17 } MsnP2PHeader;
30967
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
18 #pragma pack(pop)
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
19
31041
60e29347974b Add initial P2Pv2 header definition.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31001
diff changeset
20 #pragma pack(push,1)
60e29347974b Add initial P2Pv2 header definition.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31001
diff changeset
21 typedef struct {
60e29347974b Add initial P2Pv2 header definition.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31001
diff changeset
22 guint8 header_len;
60e29347974b Add initial P2Pv2 header definition.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31001
diff changeset
23 guint8 opcode;
60e29347974b Add initial P2Pv2 header definition.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31001
diff changeset
24 guint32 message_len;
60e29347974b Add initial P2Pv2 header definition.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31001
diff changeset
25 guint64 base_id;
60e29347974b Add initial P2Pv2 header definition.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31001
diff changeset
26 } MsnP2Pv2Header;
60e29347974b Add initial P2Pv2 header definition.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31001
diff changeset
27 #pragma pack(pop)
60e29347974b Add initial P2Pv2 header definition.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 31001
diff changeset
28
30970
432037e01d4f Drop MsnSlpFooter in favor of MsnP2pFooter.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30968
diff changeset
29 typedef struct
432037e01d4f Drop MsnSlpFooter in favor of MsnP2pFooter.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30968
diff changeset
30 {
432037e01d4f Drop MsnSlpFooter in favor of MsnP2pFooter.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30968
diff changeset
31 guint32 value;
432037e01d4f Drop MsnSlpFooter in favor of MsnP2pFooter.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30968
diff changeset
32 } MsnP2PFooter;
432037e01d4f Drop MsnSlpFooter in favor of MsnP2pFooter.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30968
diff changeset
33
30967
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
34 typedef enum
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
35 {
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
36 P2P_NO_FLAG = 0x0, /**< No flags specified */
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
37 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
38 P2P_ACK = 0x2, /**< Acknowledgement */
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
39 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
40 P2P_BINARY_ERROR = 0x8, /**< Error on the binary level */
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
41 P2P_MSN_OBJ_DATA = 0x20, /**< MsnObject data */
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
42 P2P_WML2009_COMP = 0x1000000, /**< Compatibility with WLM 2009 */
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
43 P2P_FILE_DATA = 0x1000030 /**< File transfer data */
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
44 } MsnP2PHeaderFlag;
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
45 /* Info From:
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
46 * 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
47 * http://trac.kmess.org/changeset/ba04d0c825769d23370511031c47f6be75fe9b86
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
48 * #7180
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
49 */
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
50
30971
39a254a27343 Drop Binary from the struct name.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30970
diff changeset
51 #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
52 #define P2P_PACKET_FOOTER_SIZE sizeof(MsnP2PFooter)
30967
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
53
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
54 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
55 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
56
6183fdc2c860 Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30971
diff changeset
57 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
58 msn_p2p_header_to_wire(MsnP2PHeader *header);
30967
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
59
30984
2898559aaaa7 Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30976
diff changeset
60 MsnP2PFooter *
2898559aaaa7 Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30976
diff changeset
61 msn_p2p_footer_from_wire(MsnP2PFooter *wire);
2898559aaaa7 Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30976
diff changeset
62
2898559aaaa7 Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30976
diff changeset
63 MsnP2PFooter *
2898559aaaa7 Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30976
diff changeset
64 msn_p2p_footer_to_wire(MsnP2PFooter *footer);
2898559aaaa7 Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents: 30976
diff changeset
65
30967
578391ef28a4 Actually add the new file.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff changeset
66 #endif /* MSN_P2P_H */

mercurial