Tue, 22 Jun 2010 22:44:28 +0000
Destroy Parts when the SlpMessage is destroyed.
|
30975
da9bd715cc7a
Oops, forgot to save before commiting.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30972
diff
changeset
|
1 | #include "internal.h" |
|
da9bd715cc7a
Oops, forgot to save before commiting.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30972
diff
changeset
|
2 | |
|
da9bd715cc7a
Oops, forgot to save before commiting.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30972
diff
changeset
|
3 | #include "p2p.h" |
|
30972
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
4 | |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
5 | MsnP2PHeader * |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
6 | msn_p2p_header_from_wire(MsnP2PHeader *wire) |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
7 | { |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
8 | MsnP2PHeader *header; |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
9 | |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
10 | header = g_new(MsnP2PHeader, 1); |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
11 | |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
12 | header->session_id = GUINT32_FROM_LE(wire->session_id); |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
13 | header->id = GUINT32_FROM_LE(wire->id); |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
14 | header->offset = GUINT64_FROM_LE(wire->offset); |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
15 | header->total_size = GUINT64_FROM_LE(wire->total_size); |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
16 | header->length = GUINT32_FROM_LE(wire->length); |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
17 | header->flags = GUINT32_FROM_LE(wire->flags); |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
18 | header->ack_id = GUINT32_FROM_LE(wire->ack_id); |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
19 | header->ack_sub_id = GUINT32_FROM_LE(wire->ack_sub_id); |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
20 | header->ack_size = GUINT64_FROM_LE(wire->ack_size); |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
21 | |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
22 | return header; |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
23 | } |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
24 | |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
25 | MsnP2PHeader * |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
26 | msn_p2p_header_to_wire(MsnP2PHeader *header) |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
27 | { |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
28 | MsnP2PHeader *wire; |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
29 | |
|
30975
da9bd715cc7a
Oops, forgot to save before commiting.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30972
diff
changeset
|
30 | wire = g_new(MsnP2PHeader, 1); |
|
30972
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
31 | |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
32 | wire->session_id = GUINT32_TO_LE(header->session_id); |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
33 | wire->id = GUINT32_TO_LE(header->id); |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
34 | wire->offset = GUINT64_TO_LE(header->offset); |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
35 | wire->total_size = GUINT64_TO_LE(header->total_size); |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
36 | wire->length = GUINT32_TO_LE(header->length); |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
37 | wire->flags = GUINT32_TO_LE(header->flags); |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
38 | wire->ack_id = GUINT32_TO_LE(header->ack_id); |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
39 | wire->ack_sub_id = GUINT32_TO_LE(header->ack_sub_id); |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
40 | wire->ack_size = GUINT64_TO_LE(header->ack_size); |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
41 | |
|
30975
da9bd715cc7a
Oops, forgot to save before commiting.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30972
diff
changeset
|
42 | return wire; |
|
da9bd715cc7a
Oops, forgot to save before commiting.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30972
diff
changeset
|
43 | |
|
30972
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
44 | } |
|
6183fdc2c860
Move parsing of the p2p header to p2p to avoid duplicated code.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
diff
changeset
|
45 | |
|
30984
2898559aaaa7
Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30975
diff
changeset
|
46 | MsnP2PFooter * |
|
2898559aaaa7
Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30975
diff
changeset
|
47 | msn_p2p_footer_from_wire(MsnP2PFooter *wire) |
|
2898559aaaa7
Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30975
diff
changeset
|
48 | { |
|
2898559aaaa7
Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30975
diff
changeset
|
49 | MsnP2PFooter *footer; |
|
2898559aaaa7
Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30975
diff
changeset
|
50 | |
|
2898559aaaa7
Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30975
diff
changeset
|
51 | footer = g_new(MsnP2PFooter, 1); |
|
2898559aaaa7
Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30975
diff
changeset
|
52 | |
|
2898559aaaa7
Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30975
diff
changeset
|
53 | footer->value = GUINT32_FROM_BE(wire->value); |
|
2898559aaaa7
Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30975
diff
changeset
|
54 | |
|
2898559aaaa7
Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30975
diff
changeset
|
55 | return footer; |
|
2898559aaaa7
Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30975
diff
changeset
|
56 | } |
|
2898559aaaa7
Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30975
diff
changeset
|
57 | |
|
2898559aaaa7
Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30975
diff
changeset
|
58 | MsnP2PFooter * |
|
2898559aaaa7
Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30975
diff
changeset
|
59 | msn_p2p_footer_to_wire(MsnP2PFooter *footer) |
|
2898559aaaa7
Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30975
diff
changeset
|
60 | { |
|
2898559aaaa7
Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30975
diff
changeset
|
61 | MsnP2PFooter *wire; |
|
2898559aaaa7
Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30975
diff
changeset
|
62 | |
|
2898559aaaa7
Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30975
diff
changeset
|
63 | wire = g_new(MsnP2PFooter, 1); |
|
2898559aaaa7
Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30975
diff
changeset
|
64 | |
|
2898559aaaa7
Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30975
diff
changeset
|
65 | wire->value = GUINT32_TO_BE(footer->value); |
|
2898559aaaa7
Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30975
diff
changeset
|
66 | |
|
2898559aaaa7
Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30975
diff
changeset
|
67 | return wire; |
|
2898559aaaa7
Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30975
diff
changeset
|
68 | } |
|
2898559aaaa7
Add P2PFooter helper functions.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30975
diff
changeset
|
69 |