soc.2010.msn-tlc: 4d653ce9: Move parsing of the p2p header to p2p to...
masca at cpw.pidgin.im
masca at cpw.pidgin.im
Fri Jun 4 21:35:42 EDT 2010
-----------------------------------------------------------------
Revision: 4d653ce95329041f869f74f3904d6bb8916551a5
Ancestor: 586b6cf0962bb00bafabd83bc6872b07f8236e50
Author: masca at cpw.pidgin.im
Date: 2010-06-03T22:55:52
Branch: im.pidgin.soc.2010.msn-tlc
URL: http://d.pidgin.im/viewmtn/revision/info/4d653ce95329041f869f74f3904d6bb8916551a5
Added files:
libpurple/protocols/msn/p2p.c
Modified files:
libpurple/protocols/msn/p2p.h
ChangeLog:
Move parsing of the p2p header to p2p to avoid duplicated code.
-------------- next part --------------
============================================================
--- libpurple/protocols/msn/p2p.c 324243cc642672bad5aad04302450e93e429d010
+++ libpurple/protocols/msn/p2p.c 324243cc642672bad5aad04302450e93e429d010
@@ -0,0 +1,41 @@
+#include "p2p->h"
+
+MsnP2PHeader *
+msn_p2p_header_from_wire(MsnP2PHeader *wire)
+{
+ MsnP2PHeader *header;
+
+ header = g_new(MsnP2PHeader, 1);
+
+ header->session_id = GUINT32_FROM_LE(wire->session_id);
+ header->id = GUINT32_FROM_LE(wire->id);
+ header->offset = GUINT64_FROM_LE(wire->offset);
+ header->total_size = GUINT64_FROM_LE(wire->total_size);
+ header->length = GUINT32_FROM_LE(wire->length);
+ header->flags = GUINT32_FROM_LE(wire->flags);
+ header->ack_id = GUINT32_FROM_LE(wire->ack_id);
+ header->ack_sub_id = GUINT32_FROM_LE(wire->ack_sub_id);
+ header->ack_size = GUINT64_FROM_LE(wire->ack_size);
+
+ return header;
+}
+
+MsnP2PHeader *
+msn_p2p_header_to_wire(MsnP2PHeader *header)
+{
+ MsnP2PHeader *wire;
+
+ g_new(MsnP2PHeader, 1);
+
+ wire->session_id = GUINT32_TO_LE(header->session_id);
+ wire->id = GUINT32_TO_LE(header->id);
+ wire->offset = GUINT64_TO_LE(header->offset);
+ wire->total_size = GUINT64_TO_LE(header->total_size);
+ wire->length = GUINT32_TO_LE(header->length);
+ wire->flags = GUINT32_TO_LE(header->flags);
+ wire->ack_id = GUINT32_TO_LE(header->ack_id);
+ wire->ack_sub_id = GUINT32_TO_LE(header->ack_sub_id);
+ wire->ack_size = GUINT64_TO_LE(header->ack_size);
+
+}
+
============================================================
--- libpurple/protocols/msn/p2p.h b6db22ce1132964133d8db7228d0f6eee6fa9a74
+++ libpurple/protocols/msn/p2p.h eddd89e84bf65437d14eca6233a669a2bc15da93
@@ -42,5 +42,10 @@ typedef enum
#define P2P_PACKET_HEADER_SIZE sizeof(MsnP2PHeader)
+MsnP2PHeader *
+msn_p2p_header_from_wire(MsnP2PHeader *wire);
+MsnP2PHeader *
+msn_p2p_header_to_wire(MsnP2PHeader *header);
+
#endif /* MSN_P2P_H */
More information about the Commits
mailing list