| |
1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
| |
2 /* |
| |
3 $Id: stdpackets.c 1162 2000-11-28 02:22:42Z warmenhoven $ |
| |
4 $Log$ |
| |
5 Revision 1.1 2000/11/28 02:22:42 warmenhoven |
| |
6 icq. whoop de doo |
| |
7 |
| |
8 Revision 1.10 2000/06/15 01:51:23 bills |
| |
9 added creation functions for cancel and refuse operations |
| |
10 |
| |
11 Revision 1.9 2000/05/04 15:50:38 bills |
| |
12 warning cleanups |
| |
13 |
| |
14 Revision 1.8 2000/04/10 18:11:45 denis |
| |
15 ANSI cleanups. |
| |
16 |
| |
17 Revision 1.7 2000/04/06 16:38:04 denis |
| |
18 icq_*Send*Seq() functions with specified sequence number were added. |
| |
19 |
| |
20 Revision 1.6 2000/02/07 02:35:13 bills |
| |
21 slightly modified chat packets |
| |
22 |
| |
23 Revision 1.5 2000/01/20 19:59:15 bills |
| |
24 first implementation of sending file requests |
| |
25 |
| |
26 Revision 1.4 1999/09/29 20:12:32 bills |
| |
27 tcp_link*->icq_TCPLink* |
| |
28 |
| |
29 Revision 1.3 1999/09/29 17:07:48 denis |
| |
30 Host/network byteorder cleanups. |
| |
31 |
| |
32 Revision 1.2 1999/07/16 15:45:20 denis |
| |
33 Cleaned up. |
| |
34 |
| |
35 Revision 1.1 1999/07/16 12:13:11 denis |
| |
36 UDP packets support added. |
| |
37 tcppackets.[ch] files renamed to stdpackets.[ch] |
| |
38 |
| |
39 Revision 1.9 1999/07/12 15:13:39 cproch |
| |
40 - added definition of ICQLINK to hold session-specific global variabled |
| |
41 applications which have more than one connection are now possible |
| |
42 - changed nearly every function defintion to support ICQLINK parameter |
| |
43 |
| |
44 Revision 1.8 1999/05/03 21:41:28 bills |
| |
45 initial file xfer support added- untested |
| |
46 |
| |
47 Revision 1.7 1999/04/17 19:39:09 bills |
| |
48 added new functions to create chat packets. removed unnecessary code. |
| |
49 added new function to create URL ack packet. |
| |
50 |
| |
51 Revision 1.6 1999/04/14 15:08:39 denis |
| |
52 Cleanups for "strict" compiling (-ansi -pedantic) |
| |
53 |
| |
54 */ |
| |
55 |
| |
56 #include <stdlib.h> |
| |
57 |
| |
58 #include "icqtypes.h" |
| |
59 #include "icq.h" |
| |
60 #include "icqlib.h" |
| |
61 #include "tcp.h" |
| |
62 #include "stdpackets.h" |
| |
63 |
| |
64 icq_Packet *icq_TCPCreateInitPacket(icq_TCPLink *plink) |
| |
65 { |
| |
66 icq_Packet *p=icq_PacketNew(); |
| |
67 |
| |
68 if(p) |
| |
69 { |
| |
70 int type=plink->type; |
| |
71 |
| |
72 icq_PacketAppend8(p, 0xFF); |
| |
73 icq_PacketAppend32(p, ICQ_TCP_VER); |
| |
74 if(type==TCP_LINK_MESSAGE) |
| |
75 icq_PacketAppend32n(p, htons(plink->icqlink->icq_TCPSrvPort)); |
| |
76 else |
| |
77 icq_PacketAppend32(p, 0x00000000); |
| |
78 icq_PacketAppend32(p, plink->icqlink->icq_Uin); |
| |
79 icq_PacketAppend32n(p, htonl(plink->icqlink->icq_OurIP)); |
| |
80 icq_PacketAppend32n(p, htonl(plink->icqlink->icq_OurIP)); |
| |
81 icq_PacketAppend8(p, 0x04); |
| |
82 if(type==TCP_LINK_FILE || type==TCP_LINK_CHAT) |
| |
83 icq_PacketAppend32(p, ntohs(plink->socket_address.sin_port)); |
| |
84 else |
| |
85 icq_PacketAppend32(p, 0x00000000); |
| |
86 |
| |
87 } |
| |
88 |
| |
89 return p; |
| |
90 } |
| |
91 |
| |
92 icq_Packet *icq_TCPCreateStdPacket(icq_TCPLink *plink, WORD icq_TCPCommand, |
| |
93 WORD type, const unsigned char *msg, WORD status, |
| |
94 WORD msg_command) |
| |
95 { |
| |
96 icq_Packet *p=icq_PacketNew(); |
| |
97 |
| |
98 if(p) |
| |
99 { |
| |
100 icq_PacketAppend32(p, plink->icqlink->icq_Uin); |
| |
101 icq_PacketAppend16(p, ICQ_TCP_VER); |
| |
102 icq_PacketAppend16(p, icq_TCPCommand); |
| |
103 icq_PacketAppend16(p, 0x0000); |
| |
104 icq_PacketAppend32(p, plink->icqlink->icq_Uin); |
| |
105 |
| |
106 icq_PacketAppend16(p, type); |
| |
107 icq_PacketAppendString(p, (char*)msg); |
| |
108 |
| |
109 /* FIXME: this should be the address the server returns to us, |
| |
110 * link->icq_OurIp */ |
| |
111 icq_PacketAppend32(p, plink->socket_address.sin_addr.s_addr); |
| |
112 icq_PacketAppend32(p, plink->socket_address.sin_addr.s_addr); |
| |
113 icq_PacketAppend32(p, ntohs(plink->socket_address.sin_port)); |
| |
114 icq_PacketAppend8(p, 0x04); |
| |
115 icq_PacketAppend16(p, status); |
| |
116 icq_PacketAppend16(p, msg_command); |
| |
117 } |
| |
118 |
| |
119 return p; |
| |
120 } |
| |
121 |
| |
122 icq_Packet *icq_TCPCreateMessagePacket(icq_TCPLink *plink, const unsigned char *message) |
| |
123 { |
| |
124 icq_Packet *p=icq_TCPCreateStdPacket( |
| |
125 plink, |
| |
126 ICQ_TCP_MESSAGE, |
| |
127 ICQ_TCP_MSG_MSG, |
| |
128 message, |
| |
129 0, /* status */ |
| |
130 ICQ_TCP_MSG_REAL); |
| |
131 |
| |
132 return p; |
| |
133 } |
| |
134 |
| |
135 icq_Packet *icq_TCPCreateURLPacket(icq_TCPLink *plink, const char *message, |
| |
136 const char *url) |
| |
137 { |
| |
138 icq_Packet *p; |
| |
139 unsigned char *str=(unsigned char*)malloc(strlen(message)+strlen(url)+2); |
| |
140 |
| |
141 strcpy((char*)str, message); |
| |
142 *(str+strlen(message))=0xFE; |
| |
143 strcpy((char*)(str+strlen(message)+1), url); |
| |
144 |
| |
145 p=icq_TCPCreateStdPacket( |
| |
146 plink, |
| |
147 ICQ_TCP_MESSAGE, |
| |
148 ICQ_TCP_MSG_URL, |
| |
149 str, |
| |
150 0, /* status */ |
| |
151 ICQ_TCP_MSG_REAL); |
| |
152 |
| |
153 free(str); |
| |
154 |
| |
155 return p; |
| |
156 } |
| |
157 |
| |
158 icq_Packet *icq_TCPCreateChatReqPacket(icq_TCPLink *plink, const unsigned char *message) |
| |
159 { |
| |
160 icq_Packet *p=icq_TCPCreateStdPacket( |
| |
161 plink, |
| |
162 ICQ_TCP_MESSAGE, |
| |
163 ICQ_TCP_MSG_CHAT, |
| |
164 message, |
| |
165 0, /* status */ |
| |
166 ICQ_TCP_MSG_REAL); |
| |
167 |
| |
168 icq_PacketAppendString(p, 0); |
| |
169 |
| |
170 icq_PacketAppend16(p, 0x0000); |
| |
171 icq_PacketAppend16(p, 0x0000); |
| |
172 icq_PacketAppend32(p, 0x00000000); |
| |
173 |
| |
174 return p; |
| |
175 } |
| |
176 |
| |
177 icq_Packet *icq_TCPCreateChatReqAck(icq_TCPLink *plink, WORD port) |
| |
178 { |
| |
179 icq_Packet *p=icq_TCPCreateStdPacket( |
| |
180 plink, |
| |
181 ICQ_TCP_ACK, |
| |
182 ICQ_TCP_MSG_CHAT, |
| |
183 0, |
| |
184 0, /* status */ |
| |
185 ICQ_TCP_MSG_ACK); |
| |
186 |
| |
187 icq_PacketAppendString(p, 0); |
| |
188 |
| |
189 icq_PacketAppend16(p, htons(port)); |
| |
190 icq_PacketAppend16(p, 0x0000); |
| |
191 icq_PacketAppend32(p, port); |
| |
192 |
| |
193 return p; |
| |
194 } |
| |
195 |
| |
196 icq_Packet *icq_TCPCreateChatReqRefuse(icq_TCPLink *plink, WORD port, |
| |
197 const char *reason) |
| |
198 { |
| |
199 icq_Packet *p=icq_TCPCreateStdPacket( |
| |
200 plink, |
| |
201 ICQ_TCP_ACK, |
| |
202 ICQ_TCP_MSG_CHAT, |
| |
203 reason, |
| |
204 ICQ_TCP_STATUS_REFUSE, |
| |
205 ICQ_TCP_MSG_ACK); |
| |
206 |
| |
207 icq_PacketAppendString(p, 0); |
| |
208 |
| |
209 icq_PacketAppend16(p, htons(port)); |
| |
210 icq_PacketAppend16(p, 0x0000); |
| |
211 icq_PacketAppend32(p, port); |
| |
212 |
| |
213 return p; |
| |
214 } |
| |
215 |
| |
216 icq_Packet *icq_TCPCreateChatReqCancel(icq_TCPLink *plink, WORD port) |
| |
217 { |
| |
218 icq_Packet *p=icq_TCPCreateStdPacket( |
| |
219 plink, |
| |
220 ICQ_TCP_CANCEL, |
| |
221 ICQ_TCP_MSG_CHAT, |
| |
222 0, |
| |
223 0, /* status */ |
| |
224 ICQ_TCP_MSG_ACK); |
| |
225 |
| |
226 icq_PacketAppendString(p, 0); |
| |
227 |
| |
228 icq_PacketAppend16(p, htons(port)); |
| |
229 icq_PacketAppend16(p, 0x0000); |
| |
230 icq_PacketAppend32(p, port); |
| |
231 |
| |
232 return p; |
| |
233 } |
| |
234 |
| |
235 icq_Packet *icq_TCPCreateFileReqAck(icq_TCPLink *plink, WORD port) |
| |
236 { |
| |
237 icq_Packet *p=icq_TCPCreateStdPacket( |
| |
238 plink, |
| |
239 ICQ_TCP_ACK, |
| |
240 ICQ_TCP_MSG_FILE, |
| |
241 0, |
| |
242 0, /* status */ |
| |
243 ICQ_TCP_MSG_ACK); |
| |
244 |
| |
245 icq_PacketAppend16(p, htons(port)); |
| |
246 icq_PacketAppend16(p, 0x0000); |
| |
247 icq_PacketAppendString(p, 0); |
| |
248 icq_PacketAppend32(p, 0x00000000); |
| |
249 icq_PacketAppend32(p, port); |
| |
250 |
| |
251 return p; |
| |
252 } |
| |
253 |
| |
254 icq_Packet *icq_TCPCreateFileReqRefuse(icq_TCPLink *plink, WORD port, |
| |
255 const char *reason) |
| |
256 { |
| |
257 icq_Packet *p=icq_TCPCreateStdPacket( |
| |
258 plink, |
| |
259 ICQ_TCP_ACK, |
| |
260 ICQ_TCP_MSG_FILE, |
| |
261 reason, |
| |
262 ICQ_TCP_STATUS_REFUSE, |
| |
263 ICQ_TCP_MSG_ACK); |
| |
264 |
| |
265 icq_PacketAppend16(p, htons(port)); |
| |
266 icq_PacketAppend16(p, 0x0000); |
| |
267 icq_PacketAppendString(p, 0); |
| |
268 icq_PacketAppend32(p, 0x00000000); |
| |
269 icq_PacketAppend32(p, port); |
| |
270 |
| |
271 return p; |
| |
272 } |
| |
273 |
| |
274 icq_Packet *icq_TCPCreateFileReqCancel(icq_TCPLink *plink, WORD port) |
| |
275 { |
| |
276 icq_Packet *p=icq_TCPCreateStdPacket( |
| |
277 plink, |
| |
278 ICQ_TCP_CANCEL, |
| |
279 ICQ_TCP_MSG_FILE, |
| |
280 0, |
| |
281 0, /* status */ |
| |
282 ICQ_TCP_MSG_ACK); |
| |
283 |
| |
284 icq_PacketAppend16(p, htons(port)); |
| |
285 icq_PacketAppend16(p, 0x0000); |
| |
286 icq_PacketAppendString(p, 0); |
| |
287 icq_PacketAppend32(p, 0x00000000); |
| |
288 icq_PacketAppend32(p, port); |
| |
289 |
| |
290 return p; |
| |
291 } |
| |
292 |
| |
293 icq_Packet *icq_TCPCreateChatInfoPacket(icq_TCPLink *plink, const char *name, |
| |
294 DWORD foreground, DWORD background) |
| |
295 { |
| |
296 icq_Packet *p=icq_PacketNew(); |
| |
297 |
| |
298 icq_PacketAppend32(p, 0x00000065); |
| |
299 icq_PacketAppend32(p, 0xfffffffa); |
| |
300 icq_PacketAppend32(p, plink->icqlink->icq_Uin); |
| |
301 icq_PacketAppendString(p, name); |
| |
302 icq_PacketAppend16(p, plink->socket_address.sin_port); |
| |
303 icq_PacketAppend32(p, foreground); |
| |
304 icq_PacketAppend32(p, background); |
| |
305 icq_PacketAppend8(p, 0x00); |
| |
306 |
| |
307 return p; |
| |
308 |
| |
309 } |
| |
310 |
| |
311 icq_Packet *icq_TCPCreateChatInfo2Packet(icq_TCPLink *plink, const char *name, |
| |
312 DWORD foreground, DWORD background) |
| |
313 { |
| |
314 icq_Packet *p=icq_PacketNew(); |
| |
315 |
| |
316 icq_PacketAppend32(p, 0x00000064); |
| |
317 icq_PacketAppend32(p, plink->icqlink->icq_Uin); |
| |
318 icq_PacketAppendString(p, name); |
| |
319 icq_PacketAppend32(p, foreground); |
| |
320 icq_PacketAppend32(p, background); |
| |
321 |
| |
322 icq_PacketAppend32(p, 0x00070004); |
| |
323 icq_PacketAppend32(p, 0x00000000); |
| |
324 icq_PacketAppend32n(p, htonl(plink->icqlink->icq_OurIP)); |
| |
325 icq_PacketAppend32n(p, htonl(plink->icqlink->icq_OurIP)); |
| |
326 icq_PacketAppend8(p, 0x04); |
| |
327 icq_PacketAppend16(p, 0x0000); |
| |
328 icq_PacketAppend32(p, 0x000a); |
| |
329 icq_PacketAppend32(p, 0x0000); |
| |
330 icq_PacketAppendString(p, "Courier New"); |
| |
331 icq_PacketAppend8(p, 204); |
| |
332 icq_PacketAppend8(p, 49); |
| |
333 icq_PacketAppend8(p, 0x00); |
| |
334 |
| |
335 return p; |
| |
336 } |
| |
337 |
| |
338 icq_Packet *icq_TCPCreateChatFontInfoPacket(icq_TCPLink *plink) |
| |
339 { |
| |
340 icq_Packet *p=icq_PacketNew(); |
| |
341 |
| |
342 icq_PacketAppend32(p, 0x00070004); |
| |
343 icq_PacketAppend32(p, 0x00000000); |
| |
344 icq_PacketAppend32n(p, htonl(plink->icqlink->icq_OurIP)); |
| |
345 icq_PacketAppend32n(p, htonl(plink->icqlink->icq_OurIP)); |
| |
346 icq_PacketAppend8(p, 0x04); |
| |
347 icq_PacketAppend16(p, ntohs(plink->socket_address.sin_port)); /* Zero ? */ |
| |
348 icq_PacketAppend32(p, 0x000a); |
| |
349 icq_PacketAppend32(p, 0x0000); |
| |
350 icq_PacketAppendString(p, "Courier New"); |
| |
351 icq_PacketAppend8(p, 204); |
| |
352 icq_PacketAppend8(p, 49); |
| |
353 icq_PacketAppend8(p, 0x00); |
| |
354 |
| |
355 return p; |
| |
356 } |
| |
357 |
| |
358 |
| |
359 icq_Packet *icq_TCPCreateFileReqPacket(icq_TCPLink *plink, |
| |
360 const char *message, const char *filename, unsigned long size) |
| |
361 { |
| |
362 icq_Packet *p=icq_TCPCreateStdPacket( |
| |
363 plink, |
| |
364 ICQ_TCP_MESSAGE, |
| |
365 ICQ_TCP_MSG_FILE, |
| |
366 (const unsigned char*)message, |
| |
367 0, /* status */ |
| |
368 ICQ_TCP_MSG_REAL); |
| |
369 |
| |
370 icq_PacketAppend16(p, 0x0000); |
| |
371 icq_PacketAppend16(p, 0x0000); |
| |
372 |
| |
373 icq_PacketAppendString(p, filename); |
| |
374 |
| |
375 icq_PacketAppend32(p, size); |
| |
376 icq_PacketAppend32(p, 0x00000000); |
| |
377 |
| |
378 return p; |
| |
379 } |
| |
380 |
| |
381 void icq_TCPAppendSequence(ICQLINK *link, icq_Packet *p) |
| |
382 { |
| |
383 p->id=link->icq_TCPSequence--; |
| |
384 icq_PacketEnd(p); |
| |
385 icq_PacketAppend32(p, p->id); |
| |
386 } |
| |
387 |
| |
388 void icq_TCPAppendSequenceN(ICQLINK *link, icq_Packet *p, DWORD seq) |
| |
389 { |
| |
390 (void)link; |
| |
391 p->id=seq; |
| |
392 icq_PacketEnd(p); |
| |
393 icq_PacketAppend32(p, p->id); |
| |
394 } |
| |
395 |
| |
396 icq_Packet *icq_TCPCreateMessageAck(icq_TCPLink *plink, const unsigned char *message) |
| |
397 { |
| |
398 icq_Packet *p=icq_TCPCreateStdPacket( |
| |
399 plink, |
| |
400 ICQ_TCP_ACK, |
| |
401 ICQ_TCP_MSG_MSG, |
| |
402 message, |
| |
403 0, /* status */ |
| |
404 ICQ_TCP_MSG_ACK); |
| |
405 |
| |
406 return p; |
| |
407 } |
| |
408 |
| |
409 icq_Packet *icq_TCPCreateURLAck(icq_TCPLink *plink, const unsigned char *message) |
| |
410 { |
| |
411 icq_Packet *p=icq_TCPCreateStdPacket( |
| |
412 plink, |
| |
413 ICQ_TCP_ACK, |
| |
414 ICQ_TCP_MSG_URL, |
| |
415 message, |
| |
416 0, /* status */ |
| |
417 ICQ_TCP_MSG_ACK); |
| |
418 |
| |
419 return p; |
| |
420 } |
| |
421 |
| |
422 |
| |
423 icq_Packet *icq_TCPCreateFile00Packet(DWORD num_files, DWORD total_bytes, |
| |
424 DWORD speed, const char *name) |
| |
425 { |
| |
426 icq_Packet *p=icq_PacketNew(); |
| |
427 |
| |
428 if(p) |
| |
429 { |
| |
430 icq_PacketAppend8(p, 0x00); |
| |
431 icq_PacketAppend32(p, 0x00000000); |
| |
432 icq_PacketAppend32(p, num_files); |
| |
433 icq_PacketAppend32(p, total_bytes); |
| |
434 icq_PacketAppend32(p, speed); |
| |
435 icq_PacketAppendString(p, name); |
| |
436 } |
| |
437 |
| |
438 return p; |
| |
439 } |
| |
440 |
| |
441 icq_Packet *icq_TCPCreateFile01Packet(DWORD speed, const char *name) |
| |
442 { |
| |
443 icq_Packet *p=icq_PacketNew(); |
| |
444 |
| |
445 if(p) |
| |
446 { |
| |
447 icq_PacketAppend8(p, 0x01); |
| |
448 icq_PacketAppend32(p, speed); |
| |
449 icq_PacketAppendString(p, name); |
| |
450 } |
| |
451 |
| |
452 return p; |
| |
453 } |
| |
454 |
| |
455 icq_Packet *icq_TCPCreateFile02Packet(const char *filename, DWORD filesize, |
| |
456 DWORD speed) |
| |
457 { |
| |
458 icq_Packet *p=icq_PacketNew(); |
| |
459 |
| |
460 if(p) |
| |
461 { |
| |
462 icq_PacketAppend8(p, 0x02); |
| |
463 icq_PacketAppend8(p, 0x00); |
| |
464 icq_PacketAppendString(p, filename); |
| |
465 icq_PacketAppendString(p, 0); |
| |
466 icq_PacketAppend32(p, filesize); |
| |
467 icq_PacketAppend32(p, 0x00000000); |
| |
468 icq_PacketAppend32(p, speed); |
| |
469 } |
| |
470 |
| |
471 return p; |
| |
472 } |
| |
473 |
| |
474 icq_Packet *icq_TCPCreateFile03Packet(DWORD filesize, DWORD speed) |
| |
475 { |
| |
476 icq_Packet *p=icq_PacketNew(); |
| |
477 |
| |
478 if(p) |
| |
479 { |
| |
480 icq_PacketAppend8(p, 0x03); |
| |
481 icq_PacketAppend32(p, filesize); |
| |
482 icq_PacketAppend32(p, 0x00000000); |
| |
483 icq_PacketAppend32(p, speed); |
| |
484 } |
| |
485 |
| |
486 return p; |
| |
487 } |
| |
488 |
| |
489 icq_Packet *icq_TCPCreateFile04Packet(DWORD filenum) |
| |
490 { |
| |
491 icq_Packet *p=icq_PacketNew(); |
| |
492 |
| |
493 if(p) |
| |
494 { |
| |
495 icq_PacketAppend8(p, 0x04); |
| |
496 icq_PacketAppend32(p, filenum); |
| |
497 } |
| |
498 |
| |
499 return p; |
| |
500 } |
| |
501 |
| |
502 icq_Packet *icq_TCPCreateFile05Packet(DWORD speed) |
| |
503 { |
| |
504 icq_Packet *p=icq_PacketNew(); |
| |
505 |
| |
506 if(p) |
| |
507 { |
| |
508 icq_PacketAppend8(p, 0x05); |
| |
509 icq_PacketAppend32(p, speed); |
| |
510 } |
| |
511 |
| |
512 return p; |
| |
513 } |
| |
514 |
| |
515 icq_Packet *icq_TCPCreateFile06Packet(int length, void *data) |
| |
516 { |
| |
517 icq_Packet *p=icq_PacketNew(); |
| |
518 |
| |
519 if(p) |
| |
520 { |
| |
521 icq_PacketAppend8(p, 0x06); |
| |
522 icq_PacketAppend(p, data, length); |
| |
523 } |
| |
524 |
| |
525 return p; |
| |
526 } |
| |
527 |
| |
528 icq_Packet *icq_UDPCreateStdPacket(ICQLINK *link, WORD cmd) |
| |
529 { |
| |
530 icq_Packet *p = icq_PacketNew(); |
| |
531 |
| |
532 /* if(!link->icq_UDPSession) |
| |
533 link->icq_UDPSession = rand() & 0x3FFFFFFF; |
| |
534 if(!link->icq_UDPSeqNum2) |
| |
535 link->icq_UDPSeqNum2 = rand() & 0x7FFF;*/ |
| |
536 |
| |
537 icq_PacketAppend16(p, ICQ_UDP_VER); /* ver */ |
| |
538 icq_PacketAppend32(p, 0); /* zero */ |
| |
539 icq_PacketAppend32(p, link->icq_Uin); /* uin */ |
| |
540 icq_PacketAppend32(p, link->icq_UDPSession); /* session */ |
| |
541 icq_PacketAppend16(p, cmd); /* cmd */ |
| |
542 icq_PacketAppend16(p, link->icq_UDPSeqNum1++); /* seq1 */ |
| |
543 icq_PacketAppend16(p, link->icq_UDPSeqNum2++); /* seq2 */ |
| |
544 icq_PacketAppend32(p, 0); /* checkcode */ |
| |
545 |
| |
546 return p; |
| |
547 } |
| |
548 |
| |
549 icq_Packet *icq_UDPCreateStdSeqPacket(ICQLINK *link, WORD cmd, WORD seq) |
| |
550 { |
| |
551 icq_Packet *p = icq_PacketNew(); |
| |
552 |
| |
553 icq_PacketAppend16(p, ICQ_UDP_VER); /* ver */ |
| |
554 icq_PacketAppend32(p, 0); /* zero */ |
| |
555 icq_PacketAppend32(p, link->icq_Uin); /* uin */ |
| |
556 icq_PacketAppend32(p, link->icq_UDPSession); /* session */ |
| |
557 icq_PacketAppend16(p, cmd); /* cmd */ |
| |
558 icq_PacketAppend16(p, seq); /* seq1 */ |
| |
559 icq_PacketAppend16(p, 0); /* seq2 */ |
| |
560 icq_PacketAppend32(p, 0); /* checkcode */ |
| |
561 |
| |
562 return p; |
| |
563 } |