annotate libpurple/protocols/msn/p2p.h @ 31315:23be655cc688

propagate from branch 'im.pidgin.cpw.qulogic.msnp16' (head a27b68b2e6653e6b96aa0279bd649181c89b20ed) to branch 'im.pidgin.soc.2010.msn-tlc' (head 20ad1c813e2b512df4a065dda88f3cfa732463a3)
author masca@cpw.pidgin.im
date Wed, 15 Sep 2010 17:34:21 +0000
parents 5964f65c17ed
children 72e6fa6caecc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
31201
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
1 #ifndef MSN_P2P_H
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
2 #define MSN_P2P_H
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
3
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
4
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
5 #pragma pack(push,1)
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
6 typedef struct {
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
7 guint32 session_id;
31202
d4869cd86680 Chang member name so it is compatible with MsnSlpHeader struct names.
masca@cpw.pidgin.im
parents: 31201
diff changeset
8 guint32 id;
31301
16ab805406d1 Get rid of the offset field in the SlpMessage in favor of the one in the Header.
masca@cpw.pidgin.im
parents: 31286
diff changeset
9 /**
16ab805406d1 Get rid of the offset field in the SlpMessage in favor of the one in the Header.
masca@cpw.pidgin.im
parents: 31286
diff changeset
10 * In a MsnSlpMessage:
16ab805406d1 Get rid of the offset field in the SlpMessage in favor of the one in the Header.
masca@cpw.pidgin.im
parents: 31286
diff changeset
11 * For outgoing messages this is the number of bytes from buffer that
16ab805406d1 Get rid of the offset field in the SlpMessage in favor of the one in the Header.
masca@cpw.pidgin.im
parents: 31286
diff changeset
12 * have already been sent out. For incoming messages this is the
16ab805406d1 Get rid of the offset field in the SlpMessage in favor of the one in the Header.
masca@cpw.pidgin.im
parents: 31286
diff changeset
13 * number of bytes that have been written to buffer.
16ab805406d1 Get rid of the offset field in the SlpMessage in favor of the one in the Header.
masca@cpw.pidgin.im
parents: 31286
diff changeset
14 */
31201
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
15 guint64 offset;
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
16 guint64 total_size;
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
17 guint32 length;
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
18 guint32 flags;
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
19 guint32 ack_id;
31202
d4869cd86680 Chang member name so it is compatible with MsnSlpHeader struct names.
masca@cpw.pidgin.im
parents: 31201
diff changeset
20 guint32 ack_sub_id;
31201
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
21 guint64 ack_size;
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
22 /* guint8 body[1]; */
31205
e5e712cf9f7e Drop Binary from the struct name.
masca@cpw.pidgin.im
parents: 31204
diff changeset
23 } MsnP2PHeader;
31201
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
24 #pragma pack(pop)
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
25
31277
7315ec8b71c7 Add initial P2Pv2 header definition.
masca@cpw.pidgin.im
parents: 31237
diff changeset
26 #pragma pack(push,1)
7315ec8b71c7 Add initial P2Pv2 header definition.
masca@cpw.pidgin.im
parents: 31237
diff changeset
27 typedef struct {
7315ec8b71c7 Add initial P2Pv2 header definition.
masca@cpw.pidgin.im
parents: 31237
diff changeset
28 guint8 header_len;
7315ec8b71c7 Add initial P2Pv2 header definition.
masca@cpw.pidgin.im
parents: 31237
diff changeset
29 guint8 opcode;
31286
544221aadf6e Fix some field sizes in P2Pv2 header.
masca@cpw.pidgin.im
parents: 31282
diff changeset
30 guint16 message_len;
544221aadf6e Fix some field sizes in P2Pv2 header.
masca@cpw.pidgin.im
parents: 31282
diff changeset
31 guint32 base_id;
31277
7315ec8b71c7 Add initial P2Pv2 header definition.
masca@cpw.pidgin.im
parents: 31237
diff changeset
32 } MsnP2Pv2Header;
7315ec8b71c7 Add initial P2Pv2 header definition.
masca@cpw.pidgin.im
parents: 31237
diff changeset
33 #pragma pack(pop)
7315ec8b71c7 Add initial P2Pv2 header definition.
masca@cpw.pidgin.im
parents: 31237
diff changeset
34
31204
c2e911eeffc9 Drop MsnSlpFooter in favor of MsnP2pFooter.
masca@cpw.pidgin.im
parents: 31202
diff changeset
35 typedef struct
c2e911eeffc9 Drop MsnSlpFooter in favor of MsnP2pFooter.
masca@cpw.pidgin.im
parents: 31202
diff changeset
36 {
c2e911eeffc9 Drop MsnSlpFooter in favor of MsnP2pFooter.
masca@cpw.pidgin.im
parents: 31202
diff changeset
37 guint32 value;
c2e911eeffc9 Drop MsnSlpFooter in favor of MsnP2pFooter.
masca@cpw.pidgin.im
parents: 31202
diff changeset
38 } MsnP2PFooter;
c2e911eeffc9 Drop MsnSlpFooter in favor of MsnP2pFooter.
masca@cpw.pidgin.im
parents: 31202
diff changeset
39
31201
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
40 typedef enum
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
41 {
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
42 P2P_NO_FLAG = 0x0, /**< No flags specified */
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
43 P2P_OUT_OF_ORDER = 0x1, /**< Chunk out-of-order */
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
44 P2P_ACK = 0x2, /**< Acknowledgement */
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
45 P2P_PENDING_INVITE = 0x4, /**< There is a pending invite */
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
46 P2P_BINARY_ERROR = 0x8, /**< Error on the binary level */
31279
01dea46bbb42 Add some more flag definitions to the p2p flags.
masca@cpw.pidgin.im
parents: 31277
diff changeset
47 P2P_FILE = 0x10, /**< File */
31201
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
48 P2P_MSN_OBJ_DATA = 0x20, /**< MsnObject data */
31279
01dea46bbb42 Add some more flag definitions to the p2p flags.
masca@cpw.pidgin.im
parents: 31277
diff changeset
49 P2P_CLOSE = 0x40, /**< Close session */
01dea46bbb42 Add some more flag definitions to the p2p flags.
masca@cpw.pidgin.im
parents: 31277
diff changeset
50 P2P_TLP_ERROR = 0x80, /**< Error at transport layer protocol */
01dea46bbb42 Add some more flag definitions to the p2p flags.
masca@cpw.pidgin.im
parents: 31277
diff changeset
51 P2P_DC_HANDSHAKE = 0x100, /**< Direct Handshake */
31201
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
52 P2P_WML2009_COMP = 0x1000000, /**< Compatibility with WLM 2009 */
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
53 P2P_FILE_DATA = 0x1000030 /**< File transfer data */
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
54 } MsnP2PHeaderFlag;
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
55 /* Info From:
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
56 * http://msnpiki.msnfanatic.com/index.php/MSNC:P2Pv1_Headers#Flags
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
57 * http://trac.kmess.org/changeset/ba04d0c825769d23370511031c47f6be75fe9b86
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
58 * #7180
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
59 */
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
60
31282
7b1b7a4e0bb4 Documetn P2P Application ID in a enum and use it instead of 'magic numbers'.
masca@cpw.pidgin.im
parents: 31279
diff changeset
61 typedef enum
7b1b7a4e0bb4 Documetn P2P Application ID in a enum and use it instead of 'magic numbers'.
masca@cpw.pidgin.im
parents: 31279
diff changeset
62 {
7b1b7a4e0bb4 Documetn P2P Application ID in a enum and use it instead of 'magic numbers'.
masca@cpw.pidgin.im
parents: 31279
diff changeset
63 P2P_APPID_SESION = 0x0, /**< Negotiating session */
7b1b7a4e0bb4 Documetn P2P Application ID in a enum and use it instead of 'magic numbers'.
masca@cpw.pidgin.im
parents: 31279
diff changeset
64 P2P_APPID_OBJ = 0x1, /**< MsnObject (Display or Emoticon) */
7b1b7a4e0bb4 Documetn P2P Application ID in a enum and use it instead of 'magic numbers'.
masca@cpw.pidgin.im
parents: 31279
diff changeset
65 P2P_APPID_FILE = 0x2, /**< File transfer */
7b1b7a4e0bb4 Documetn P2P Application ID in a enum and use it instead of 'magic numbers'.
masca@cpw.pidgin.im
parents: 31279
diff changeset
66 P2P_APPID_EMOTE = 0xB, /**< CustomEmoticon */
7b1b7a4e0bb4 Documetn P2P Application ID in a enum and use it instead of 'magic numbers'.
masca@cpw.pidgin.im
parents: 31279
diff changeset
67 P2P_APPID_DISPLAY = 0xC /**< Display Image */
7b1b7a4e0bb4 Documetn P2P Application ID in a enum and use it instead of 'magic numbers'.
masca@cpw.pidgin.im
parents: 31279
diff changeset
68 } MsnP2PAppId;
7b1b7a4e0bb4 Documetn P2P Application ID in a enum and use it instead of 'magic numbers'.
masca@cpw.pidgin.im
parents: 31279
diff changeset
69
31205
e5e712cf9f7e Drop Binary from the struct name.
masca@cpw.pidgin.im
parents: 31204
diff changeset
70 #define P2P_PACKET_HEADER_SIZE sizeof(MsnP2PHeader)
31237
cce127730270 Add a P2PFooter size define.
masca@cpw.pidgin.im
parents: 31220
diff changeset
71 #define P2P_PACKET_FOOTER_SIZE sizeof(MsnP2PFooter)
31201
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
72
31206
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents: 31205
diff changeset
73 MsnP2PHeader *
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents: 31205
diff changeset
74 msn_p2p_header_from_wire(MsnP2PHeader *wire);
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents: 31205
diff changeset
75
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents: 31205
diff changeset
76 MsnP2PHeader *
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents: 31205
diff changeset
77 msn_p2p_header_to_wire(MsnP2PHeader *header);
31201
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
78
31220
3ccddae82532 Add P2PFooter helper functions.
masca@cpw.pidgin.im
parents: 31210
diff changeset
79 MsnP2PFooter *
3ccddae82532 Add P2PFooter helper functions.
masca@cpw.pidgin.im
parents: 31210
diff changeset
80 msn_p2p_footer_from_wire(MsnP2PFooter *wire);
3ccddae82532 Add P2PFooter helper functions.
masca@cpw.pidgin.im
parents: 31210
diff changeset
81
3ccddae82532 Add P2PFooter helper functions.
masca@cpw.pidgin.im
parents: 31210
diff changeset
82 MsnP2PFooter *
3ccddae82532 Add P2PFooter helper functions.
masca@cpw.pidgin.im
parents: 31210
diff changeset
83 msn_p2p_footer_to_wire(MsnP2PFooter *footer);
3ccddae82532 Add P2PFooter helper functions.
masca@cpw.pidgin.im
parents: 31210
diff changeset
84
31306
5964f65c17ed Avoid duplicated code using a util function to check the flags.
masca@cpw.pidgin.im
parents: 31301
diff changeset
85 gboolean
5964f65c17ed Avoid duplicated code using a util function to check the flags.
masca@cpw.pidgin.im
parents: 31301
diff changeset
86 msn_p2p_msg_is_data(const MsnP2PHeaderFlag flags);
5964f65c17ed Avoid duplicated code using a util function to check the flags.
masca@cpw.pidgin.im
parents: 31301
diff changeset
87
31201
83eb90d18a96 Actually add the new file.
masca@cpw.pidgin.im
parents:
diff changeset
88 #endif /* MSN_P2P_H */