annotate libpurple/protocols/msn/p2p.c @ 30771:198d5bf82e09

Oops, forgot to save before commiting.
author masca@cpw.pidgin.im
date Fri, 04 Jun 2010 00:20:00 +0000
parents f66e289bebc6
children 3ccddae82532
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30771
198d5bf82e09 Oops, forgot to save before commiting.
masca@cpw.pidgin.im
parents: 30768
diff changeset
1 #include "internal.h"
198d5bf82e09 Oops, forgot to save before commiting.
masca@cpw.pidgin.im
parents: 30768
diff changeset
2
198d5bf82e09 Oops, forgot to save before commiting.
masca@cpw.pidgin.im
parents: 30768
diff changeset
3 #include "p2p.h"
30768
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
4
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
5 MsnP2PHeader *
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
6 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:
diff changeset
7 {
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
8 MsnP2PHeader *header;
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
9
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
10 header = g_new(MsnP2PHeader, 1);
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
11
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
12 header->session_id = GUINT32_FROM_LE(wire->session_id);
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
13 header->id = GUINT32_FROM_LE(wire->id);
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
14 header->offset = GUINT64_FROM_LE(wire->offset);
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
15 header->total_size = GUINT64_FROM_LE(wire->total_size);
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
16 header->length = GUINT32_FROM_LE(wire->length);
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
17 header->flags = GUINT32_FROM_LE(wire->flags);
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
18 header->ack_id = GUINT32_FROM_LE(wire->ack_id);
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
19 header->ack_sub_id = GUINT32_FROM_LE(wire->ack_sub_id);
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
20 header->ack_size = GUINT64_FROM_LE(wire->ack_size);
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
21
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
22 return header;
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
23 }
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
24
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
25 MsnP2PHeader *
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
26 msn_p2p_header_to_wire(MsnP2PHeader *header)
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
27 {
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
28 MsnP2PHeader *wire;
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
29
30771
198d5bf82e09 Oops, forgot to save before commiting.
masca@cpw.pidgin.im
parents: 30768
diff changeset
30 wire = g_new(MsnP2PHeader, 1);
30768
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
31
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
32 wire->session_id = GUINT32_TO_LE(header->session_id);
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
33 wire->id = GUINT32_TO_LE(header->id);
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
34 wire->offset = GUINT64_TO_LE(header->offset);
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
35 wire->total_size = GUINT64_TO_LE(header->total_size);
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
36 wire->length = GUINT32_TO_LE(header->length);
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
37 wire->flags = GUINT32_TO_LE(header->flags);
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
38 wire->ack_id = GUINT32_TO_LE(header->ack_id);
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
39 wire->ack_sub_id = GUINT32_TO_LE(header->ack_sub_id);
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
40 wire->ack_size = GUINT64_TO_LE(header->ack_size);
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
41
30771
198d5bf82e09 Oops, forgot to save before commiting.
masca@cpw.pidgin.im
parents: 30768
diff changeset
42 return wire;
198d5bf82e09 Oops, forgot to save before commiting.
masca@cpw.pidgin.im
parents: 30768
diff changeset
43
30768
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
44 }
f66e289bebc6 Move parsing of the p2p header to p2p to avoid duplicated code.
masca@cpw.pidgin.im
parents:
diff changeset
45