comparison libpurple/protocols/msn/p2p.c @ 31206:f66e289bebc6

Move parsing of the p2p header to p2p to avoid duplicated code.
author masca@cpw.pidgin.im
date Thu, 03 Jun 2010 22:55:52 +0000
parents
children 198d5bf82e09
comparison
equal deleted inserted replaced
31205:e5e712cf9f7e 31206:f66e289bebc6
1 #include "p2p->h"
2
3 MsnP2PHeader *
4 msn_p2p_header_from_wire(MsnP2PHeader *wire)
5 {
6 MsnP2PHeader *header;
7
8 header = g_new(MsnP2PHeader, 1);
9
10 header->session_id = GUINT32_FROM_LE(wire->session_id);
11 header->id = GUINT32_FROM_LE(wire->id);
12 header->offset = GUINT64_FROM_LE(wire->offset);
13 header->total_size = GUINT64_FROM_LE(wire->total_size);
14 header->length = GUINT32_FROM_LE(wire->length);
15 header->flags = GUINT32_FROM_LE(wire->flags);
16 header->ack_id = GUINT32_FROM_LE(wire->ack_id);
17 header->ack_sub_id = GUINT32_FROM_LE(wire->ack_sub_id);
18 header->ack_size = GUINT64_FROM_LE(wire->ack_size);
19
20 return header;
21 }
22
23 MsnP2PHeader *
24 msn_p2p_header_to_wire(MsnP2PHeader *header)
25 {
26 MsnP2PHeader *wire;
27
28 g_new(MsnP2PHeader, 1);
29
30 wire->session_id = GUINT32_TO_LE(header->session_id);
31 wire->id = GUINT32_TO_LE(header->id);
32 wire->offset = GUINT64_TO_LE(header->offset);
33 wire->total_size = GUINT64_TO_LE(header->total_size);
34 wire->length = GUINT32_TO_LE(header->length);
35 wire->flags = GUINT32_TO_LE(header->flags);
36 wire->ack_id = GUINT32_TO_LE(header->ack_id);
37 wire->ack_sub_id = GUINT32_TO_LE(header->ack_sub_id);
38 wire->ack_size = GUINT64_TO_LE(header->ack_size);
39
40 }
41