diff libpurple/protocols/msn/p2p.h @ 31044:7b771e6f1142

Change SLP P2P functions to use the new buffer access functions instead of mapping to a struct. I don't mind this since it's limited to just one pair of functions. This means that we don't need to use any packing there. Refs #12856.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Fri, 17 Dec 2010 07:49:47 +0000
parents 52616e4f2299
children b55b3d34846c 135868ec0aa9
line wrap: on
line diff
--- a/libpurple/protocols/msn/p2p.h	Fri Dec 17 07:12:21 2010 +0000
+++ b/libpurple/protocols/msn/p2p.h	Fri Dec 17 07:49:47 2010 +0000
@@ -25,8 +25,6 @@
 #ifndef MSN_P2P_H
 #define MSN_P2P_H
 
-
-#pragma pack(push,1)
 typedef struct {
 	guint32 session_id;
 	guint32 id;
@@ -45,21 +43,23 @@
 	guint64 ack_size;
 /*	guint8  body[1]; */
 } MsnP2PHeader;
-#pragma pack(pop)
+#define P2P_PACKET_HEADER_SIZE (6 * 4 + 3 * 8)
 
-#pragma pack(push,1)
+/* Used for DCs to store nonces */
+#define P2P_HEADER_ACK_ID_OFFSET (2*4 + 2*8 + 2*4)
+
 typedef struct {
 	guint8  header_len;
 	guint8  opcode;
 	guint16 message_len;
 	guint32 base_id;
 } MsnP2Pv2Header;
-#pragma pack(pop)
 
 typedef struct
 {
 	guint32 value;
 } MsnP2PFooter;
+#define P2P_PACKET_FOOTER_SIZE (1 * 4)
 
 typedef enum
 {
@@ -91,19 +91,16 @@
 	P2P_APPID_DISPLAY   = 0xC         /**< Display Image */
 } MsnP2PAppId;
 
-#define P2P_PACKET_HEADER_SIZE sizeof(MsnP2PHeader)
-#define P2P_PACKET_FOOTER_SIZE sizeof(MsnP2PFooter)
+MsnP2PHeader *
+msn_p2p_header_from_wire(const char *wire);
 
-MsnP2PHeader *
-msn_p2p_header_from_wire(MsnP2PHeader *wire);
-
-MsnP2PHeader *
+char *
 msn_p2p_header_to_wire(MsnP2PHeader *header);
 
 MsnP2PFooter *
-msn_p2p_footer_from_wire(MsnP2PFooter *wire);
+msn_p2p_footer_from_wire(const char *wire);
 
-MsnP2PFooter *
+char *
 msn_p2p_footer_to_wire(MsnP2PFooter *footer);
 
 gboolean