Mon, 09 Feb 2009 15:49:14 +0000
2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
* Added buddy 'get memo', 'remove memo', 'upload memo' functions
|
13932
4d131bd2b40f
[gaim-migrate @ 16340]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
diff
changeset
|
1 | /** |
|
15087
78879d4adf13
[gaim-migrate @ 17807]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
14672
diff
changeset
|
2 | * @file packet_parse.c |
|
13932
4d131bd2b40f
[gaim-migrate @ 16340]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
diff
changeset
|
3 | * |
| 15884 | 4 | * purple |
|
13932
4d131bd2b40f
[gaim-migrate @ 16340]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
diff
changeset
|
5 | * |
| 15884 | 6 | * Purple is the legal property of its developers, whose names are too numerous |
|
15087
78879d4adf13
[gaim-migrate @ 17807]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
14672
diff
changeset
|
7 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
78879d4adf13
[gaim-migrate @ 17807]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
14672
diff
changeset
|
8 | * source distribution. |
|
13932
4d131bd2b40f
[gaim-migrate @ 16340]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
diff
changeset
|
9 | * |
|
4d131bd2b40f
[gaim-migrate @ 16340]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
diff
changeset
|
10 | * This program is free software; you can redistribute it and/or modify |
|
4d131bd2b40f
[gaim-migrate @ 16340]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
diff
changeset
|
11 | * it under the terms of the GNU General Public License as published by |
|
4d131bd2b40f
[gaim-migrate @ 16340]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
diff
changeset
|
12 | * the Free Software Foundation; either version 2 of the License, or |
|
4d131bd2b40f
[gaim-migrate @ 16340]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
diff
changeset
|
13 | * (at your option) any later version. |
|
4d131bd2b40f
[gaim-migrate @ 16340]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
diff
changeset
|
14 | * |
|
4d131bd2b40f
[gaim-migrate @ 16340]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
diff
changeset
|
15 | * This program is distributed in the hope that it will be useful, |
|
4d131bd2b40f
[gaim-migrate @ 16340]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
diff
changeset
|
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
4d131bd2b40f
[gaim-migrate @ 16340]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
diff
changeset
|
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
4d131bd2b40f
[gaim-migrate @ 16340]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
diff
changeset
|
18 | * GNU General Public License for more details. |
|
4d131bd2b40f
[gaim-migrate @ 16340]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
diff
changeset
|
19 | * |
|
4d131bd2b40f
[gaim-migrate @ 16340]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
diff
changeset
|
20 | * You should have received a copy of the GNU General Public License |
|
4d131bd2b40f
[gaim-migrate @ 16340]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
diff
changeset
|
21 | * along with this program; if not, write to the Free Software |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18213
diff
changeset
|
22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
13932
4d131bd2b40f
[gaim-migrate @ 16340]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
diff
changeset
|
23 | */ |
|
4d131bd2b40f
[gaim-migrate @ 16340]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
diff
changeset
|
24 | |
|
4d131bd2b40f
[gaim-migrate @ 16340]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
diff
changeset
|
25 | #include <string.h> |
|
4d131bd2b40f
[gaim-migrate @ 16340]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
diff
changeset
|
26 | |
|
4d131bd2b40f
[gaim-migrate @ 16340]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
diff
changeset
|
27 | #include "packet_parse.h" |
| 23190 | 28 | #include "debug.h" |
| 29 | ||
| 30 | /*------------------------------------------------PUT------------------------------------------------*/ | |
| 31 | ||
| 32 | /* note: | |
| 33 | * 1, in these functions, 'b' stands for byte, 'w' stands for word, 'dw' stands for double word. | |
| 34 | * 2, we use '*cursor' and 'buf' as two addresses to calculate the length. | |
|
25101
21cff7ac9fd2
Why #if 0\n#define something when you can just #undef it?
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24352
diff
changeset
|
35 | * 3, change 'undef' to 'define' to get more info about the packet parsing. */ |
| 23190 | 36 | |
|
25101
21cff7ac9fd2
Why #if 0\n#define something when you can just #undef it?
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24352
diff
changeset
|
37 | #undef PARSER_DEBUG |
|
13932
4d131bd2b40f
[gaim-migrate @ 16340]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
diff
changeset
|
38 | |
|
24337
09fc304dae73
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24314
diff
changeset
|
39 | /* read one byte from buf, |
|
14083
2b68bb18a66c
[gaim-migrate @ 16618]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
13932
diff
changeset
|
40 | * return the number of bytes read if succeeds, otherwise return -1 */ |
| 23190 | 41 | gint qq_get8(guint8 *b, guint8 *buf) |
| 42 | { | |
| 43 | guint8 b_dest; | |
| 44 | memcpy(&b_dest, buf, sizeof(b_dest)); | |
| 45 | *b = b_dest; | |
| 23192 | 46 | #ifdef PARSER_DEBUG |
|
24314
587e97c2b707
merge of 'd01a6b8ccfad536e692fa159a02583625596c4f5'
Daniel Atallah <datallah@pidgin.im>
parents:
24300
diff
changeset
|
47 | purple_debug_info("QQ", "[DBG][get8] buf %p\n", (void *)buf); |
|
587e97c2b707
merge of 'd01a6b8ccfad536e692fa159a02583625596c4f5'
Daniel Atallah <datallah@pidgin.im>
parents:
24300
diff
changeset
|
48 | purple_debug_info("QQ", "[DBG][get8] b_dest 0x%2x, *b 0x%02x\n", b_dest, *b); |
| 23192 | 49 | #endif |
| 23190 | 50 | return sizeof(b_dest); |
| 51 | } | |
| 52 | ||
|
13932
4d131bd2b40f
[gaim-migrate @ 16340]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
diff
changeset
|
53 | |
|
24337
09fc304dae73
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24314
diff
changeset
|
54 | /* read two bytes as "guint16" from buf, |
|
14083
2b68bb18a66c
[gaim-migrate @ 16618]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
13932
diff
changeset
|
55 | * return the number of bytes read if succeeds, otherwise return -1 */ |
| 23190 | 56 | gint qq_get16(guint16 *w, guint8 *buf) |
| 57 | { | |
| 58 | guint16 w_dest; | |
| 59 | memcpy(&w_dest, buf, sizeof(w_dest)); | |
| 60 | *w = g_ntohs(w_dest); | |
| 23192 | 61 | #ifdef PARSER_DEBUG |
|
24314
587e97c2b707
merge of 'd01a6b8ccfad536e692fa159a02583625596c4f5'
Daniel Atallah <datallah@pidgin.im>
parents:
24300
diff
changeset
|
62 | purple_debug_info("QQ", "[DBG][get16] buf %p\n", (void *)buf); |
|
587e97c2b707
merge of 'd01a6b8ccfad536e692fa159a02583625596c4f5'
Daniel Atallah <datallah@pidgin.im>
parents:
24300
diff
changeset
|
63 | purple_debug_info("QQ", "[DBG][get16] w_dest 0x%04x, *w 0x%04x\n", w_dest, *w); |
| 23192 | 64 | #endif |
| 23190 | 65 | return sizeof(w_dest); |
| 66 | } | |
| 67 | ||
|
24337
09fc304dae73
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24314
diff
changeset
|
68 | /* read four bytes as "guint32" from buf, |
|
14083
2b68bb18a66c
[gaim-migrate @ 16618]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
13932
diff
changeset
|
69 | * return the number of bytes read if succeeds, otherwise return -1 */ |
| 23190 | 70 | gint qq_get32(guint32 *dw, guint8 *buf) |
| 71 | { | |
| 72 | guint32 dw_dest; | |
| 73 | memcpy(&dw_dest, buf, sizeof(dw_dest)); | |
| 74 | *dw = g_ntohl(dw_dest); | |
| 23192 | 75 | #ifdef PARSER_DEBUG |
|
24314
587e97c2b707
merge of 'd01a6b8ccfad536e692fa159a02583625596c4f5'
Daniel Atallah <datallah@pidgin.im>
parents:
24300
diff
changeset
|
76 | purple_debug_info("QQ", "[DBG][get32] buf %p\n", (void *)buf); |
|
587e97c2b707
merge of 'd01a6b8ccfad536e692fa159a02583625596c4f5'
Daniel Atallah <datallah@pidgin.im>
parents:
24300
diff
changeset
|
77 | purple_debug_info("QQ", "[DBG][get32] dw_dest 0x%08x, *dw 0x%08x\n", dw_dest, *dw); |
| 23192 | 78 | #endif |
| 23190 | 79 | return sizeof(dw_dest); |
| 80 | } | |
| 81 | ||
|
23950
a974649cdb89
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23193
diff
changeset
|
82 | gint qq_getIP(struct in_addr *ip, guint8 *buf) |
|
a974649cdb89
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23193
diff
changeset
|
83 | { |
|
a974649cdb89
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23193
diff
changeset
|
84 | memcpy(ip, buf, sizeof(struct in_addr)); |
|
a974649cdb89
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23193
diff
changeset
|
85 | return sizeof(struct in_addr); |
|
a974649cdb89
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23193
diff
changeset
|
86 | } |
| 23190 | 87 | |
|
24337
09fc304dae73
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24314
diff
changeset
|
88 | /* read datalen bytes from buf, |
| 23190 | 89 | * return the number of bytes read if succeeds, otherwise return -1 */ |
| 90 | gint qq_getdata(guint8 *data, gint datalen, guint8 *buf) | |
| 91 | { | |
| 92 | memcpy(data, buf, datalen); | |
| 23192 | 93 | #ifdef PARSER_DEBUG |
|
24314
587e97c2b707
merge of 'd01a6b8ccfad536e692fa159a02583625596c4f5'
Daniel Atallah <datallah@pidgin.im>
parents:
24300
diff
changeset
|
94 | purple_debug_info("QQ", "[DBG][getdata] buf %p\n", (void *)buf); |
| 23192 | 95 | #endif |
| 23190 | 96 | return datalen; |
| 97 | } | |
| 98 | ||
|
13932
4d131bd2b40f
[gaim-migrate @ 16340]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
diff
changeset
|
99 | |
|
18213
a41e5c44f9af
A patch from o_sukhodolsky to fix a compiler warning in the QQ code. I've
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
100 | /* read four bytes as "time_t" from buf, |
|
a41e5c44f9af
A patch from o_sukhodolsky to fix a compiler warning in the QQ code. I've
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
101 | * return the number of bytes read if succeeds, otherwise return -1 |
|
a41e5c44f9af
A patch from o_sukhodolsky to fix a compiler warning in the QQ code. I've
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
102 | * This function is a wrapper around read_packet_dw() to avoid casting. */ |
| 23190 | 103 | gint qq_getime(time_t *t, guint8 *buf) |
| 104 | { | |
| 105 | guint32 dw_dest; | |
| 106 | memcpy(&dw_dest, buf, sizeof(dw_dest)); | |
| 23192 | 107 | #ifdef PARSER_DEBUG |
|
24314
587e97c2b707
merge of 'd01a6b8ccfad536e692fa159a02583625596c4f5'
Daniel Atallah <datallah@pidgin.im>
parents:
24300
diff
changeset
|
108 | purple_debug_info("QQ", "[DBG][getime] buf %p\n", (void *)buf); |
|
587e97c2b707
merge of 'd01a6b8ccfad536e692fa159a02583625596c4f5'
Daniel Atallah <datallah@pidgin.im>
parents:
24300
diff
changeset
|
109 | purple_debug_info("QQ", "[DBG][getime] dw_dest before 0x%08x\n", dw_dest); |
| 23192 | 110 | #endif |
| 23190 | 111 | dw_dest = g_ntohl(dw_dest); |
| 23192 | 112 | #ifdef PARSER_DEBUG |
|
24314
587e97c2b707
merge of 'd01a6b8ccfad536e692fa159a02583625596c4f5'
Daniel Atallah <datallah@pidgin.im>
parents:
24300
diff
changeset
|
113 | purple_debug_info("QQ", "[DBG][getime] dw_dest after 0x%08x\n", dw_dest); |
| 23192 | 114 | #endif |
| 23190 | 115 | memcpy(t, &dw_dest, sizeof(dw_dest)); |
| 116 | return sizeof(dw_dest); | |
|
14083
2b68bb18a66c
[gaim-migrate @ 16618]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
13932
diff
changeset
|
117 | } |
|
13932
4d131bd2b40f
[gaim-migrate @ 16340]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
diff
changeset
|
118 | |
| 23190 | 119 | /*------------------------------------------------PUT------------------------------------------------*/ |
|
14083
2b68bb18a66c
[gaim-migrate @ 16618]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
13932
diff
changeset
|
120 | /* pack one byte into buf |
|
2b68bb18a66c
[gaim-migrate @ 16618]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
13932
diff
changeset
|
121 | * return the number of bytes packed, otherwise return -1 */ |
| 23190 | 122 | gint qq_put8(guint8 *buf, guint8 b) |
| 123 | { | |
| 124 | memcpy(buf, &b, sizeof(b)); | |
| 23192 | 125 | #ifdef PARSER_DEBUG |
|
24314
587e97c2b707
merge of 'd01a6b8ccfad536e692fa159a02583625596c4f5'
Daniel Atallah <datallah@pidgin.im>
parents:
24300
diff
changeset
|
126 | purple_debug_info("QQ", "[DBG][put8] buf %p\n", (void *)buf); |
|
587e97c2b707
merge of 'd01a6b8ccfad536e692fa159a02583625596c4f5'
Daniel Atallah <datallah@pidgin.im>
parents:
24300
diff
changeset
|
127 | purple_debug_info("QQ", "[DBG][put8] b 0x%02x\n", b); |
| 23192 | 128 | #endif |
| 23190 | 129 | return sizeof(b); |
| 130 | } | |
| 131 | ||
|
13932
4d131bd2b40f
[gaim-migrate @ 16340]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
diff
changeset
|
132 | |
|
14083
2b68bb18a66c
[gaim-migrate @ 16618]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
13932
diff
changeset
|
133 | /* pack two bytes as "guint16" into buf |
|
2b68bb18a66c
[gaim-migrate @ 16618]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
13932
diff
changeset
|
134 | * return the number of bytes packed, otherwise return -1 */ |
| 23190 | 135 | gint qq_put16(guint8 *buf, guint16 w) |
| 136 | { | |
| 137 | guint16 w_porter; | |
| 138 | w_porter = g_htons(w); | |
| 23192 | 139 | #ifdef PARSER_DEBUG |
|
24314
587e97c2b707
merge of 'd01a6b8ccfad536e692fa159a02583625596c4f5'
Daniel Atallah <datallah@pidgin.im>
parents:
24300
diff
changeset
|
140 | purple_debug_info("QQ", "[DBG][put16] buf %p\n", (void *)buf); |
|
587e97c2b707
merge of 'd01a6b8ccfad536e692fa159a02583625596c4f5'
Daniel Atallah <datallah@pidgin.im>
parents:
24300
diff
changeset
|
141 | purple_debug_info("QQ", "[DBG][put16] w 0x%04x, w_porter 0x%04x\n", w, w_porter); |
| 23192 | 142 | #endif |
| 23190 | 143 | memcpy(buf, &w_porter, sizeof(w_porter)); |
| 144 | return sizeof(w_porter); | |
| 145 | } | |
| 146 | ||
|
13932
4d131bd2b40f
[gaim-migrate @ 16340]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
diff
changeset
|
147 | |
|
14083
2b68bb18a66c
[gaim-migrate @ 16618]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
13932
diff
changeset
|
148 | /* pack four bytes as "guint32" into buf |
|
2b68bb18a66c
[gaim-migrate @ 16618]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
13932
diff
changeset
|
149 | * return the number of bytes packed, otherwise return -1 */ |
| 23190 | 150 | gint qq_put32(guint8 *buf, guint32 dw) |
| 151 | { | |
|
24352
871c27553af6
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24351
diff
changeset
|
152 | guint32 dw_porter; |
| 23190 | 153 | dw_porter = g_htonl(dw); |
| 23192 | 154 | #ifdef PARSER_DEBUG |
|
24314
587e97c2b707
merge of 'd01a6b8ccfad536e692fa159a02583625596c4f5'
Daniel Atallah <datallah@pidgin.im>
parents:
24300
diff
changeset
|
155 | purple_debug_info("QQ", "[DBG][put32] buf %p\n", (void *)buf); |
|
587e97c2b707
merge of 'd01a6b8ccfad536e692fa159a02583625596c4f5'
Daniel Atallah <datallah@pidgin.im>
parents:
24300
diff
changeset
|
156 | purple_debug_info("QQ", "[DBG][put32] dw 0x%08x, dw_porter 0x%08x\n", dw, dw_porter); |
| 23192 | 157 | #endif |
| 23190 | 158 | memcpy(buf, &dw_porter, sizeof(dw_porter)); |
| 159 | return sizeof(dw_porter); | |
| 160 | } | |
| 161 | ||
|
24346
98c009d1f4e0
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24337
diff
changeset
|
162 | gint qq_putime(guint8 *buf, time_t *t) |
|
98c009d1f4e0
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24337
diff
changeset
|
163 | { |
|
98c009d1f4e0
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24337
diff
changeset
|
164 | guint32 dw, dw_porter; |
|
98c009d1f4e0
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24337
diff
changeset
|
165 | memcpy(&dw, t, sizeof(dw)); |
|
98c009d1f4e0
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24337
diff
changeset
|
166 | dw_porter = g_htonl(dw); |
|
98c009d1f4e0
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24337
diff
changeset
|
167 | #ifdef PARSER_DEBUG |
|
98c009d1f4e0
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24337
diff
changeset
|
168 | purple_debug_info("QQ", "[DBG][put32] buf %p\n", (void *)buf); |
|
98c009d1f4e0
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24337
diff
changeset
|
169 | purple_debug_info("QQ", "[DBG][put32] dw 0x%08x, dw_porter 0x%08x\n", dw, dw_porter); |
|
98c009d1f4e0
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24337
diff
changeset
|
170 | #endif |
|
98c009d1f4e0
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24337
diff
changeset
|
171 | memcpy(buf, &dw_porter, sizeof(dw_porter)); |
|
98c009d1f4e0
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24337
diff
changeset
|
172 | return sizeof(dw_porter); |
|
98c009d1f4e0
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24337
diff
changeset
|
173 | } |
|
98c009d1f4e0
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24337
diff
changeset
|
174 | |
|
23950
a974649cdb89
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23193
diff
changeset
|
175 | gint qq_putIP(guint8* buf, struct in_addr *ip) |
|
a974649cdb89
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23193
diff
changeset
|
176 | { |
|
a974649cdb89
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23193
diff
changeset
|
177 | memcpy(buf, ip, sizeof(struct in_addr)); |
|
a974649cdb89
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23193
diff
changeset
|
178 | return sizeof(struct in_addr); |
|
a974649cdb89
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23193
diff
changeset
|
179 | } |
|
13932
4d131bd2b40f
[gaim-migrate @ 16340]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
diff
changeset
|
180 | |
|
14083
2b68bb18a66c
[gaim-migrate @ 16618]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
13932
diff
changeset
|
181 | /* pack datalen bytes into buf |
|
2b68bb18a66c
[gaim-migrate @ 16618]
Mark Huetsch <markhuetsch@users.sourceforge.net>
parents:
13932
diff
changeset
|
182 | * return the number of bytes packed, otherwise return -1 */ |
| 23192 | 183 | gint qq_putdata(guint8 *buf, const guint8 *data, const int datalen) |
| 23190 | 184 | { |
|
24337
09fc304dae73
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24314
diff
changeset
|
185 | memcpy(buf, data, datalen); |
| 23192 | 186 | #ifdef PARSER_DEBUG |
|
24314
587e97c2b707
merge of 'd01a6b8ccfad536e692fa159a02583625596c4f5'
Daniel Atallah <datallah@pidgin.im>
parents:
24300
diff
changeset
|
187 | purple_debug_info("QQ", "[DBG][putdata] buf %p\n", (void *)buf); |
| 23192 | 188 | #endif |
| 23190 | 189 | return datalen; |
| 190 | } |