[icq-devel] Accepting / Refusing a P2P file transfert with ICQ (PEER_MSG_EXTENDED)



christophe.minguet (freesurf) c.minguet at freesurf.fr
Sun Jun 15 18:30:47 CEST 2003


Hello everybody, hope you're fine ! 

i wont lie ... i need a little help...

I'm currently implementing P2P file transfert for my icq clone. 
and i searched for weeks about a "little" problem ...

i gathered information from Rüdiger & mICQ wonderfull sites.

so, i try to be sent a file from ICQ2003a to my icq client....

my problem is with PEER_MSG_EXTENDED packets...
  
after first P2P packets exchanges,   
i recieved a (valid crypted) PEER_MSG_EXTENDED message of size 130 from
ICQ2003a :
which once decrypted look like this : 
-----------------------------------------------------------
02							Command
D3 72 F1 A3  					Check code
EE 07  						Command : normal message
0E 00  						Unknown
56 FF  						Sequence
00 00 00 00 00 00 00 00 00 00 00 00  		Unknown
1A 00  						Greeting (extended)
PEER_MSG
00 00  						Status of icq2003a
01 00  						Flag : urgent
01 00  						Message length
00  							Message null
terminated
29 00  						Command : file request
F0 2D 12 D9 30 91 D3 11 8D D7 00 10 4B 06 46 2E     ID  :File request/
granted/refused
00 00  						Unknown
04 00 00 00  					Length  of next field
46 69 6C 65  					Text : "File"
00 00 01 00 00 01 00 00 00 00 00 00 00 00 00  	unknown : file request
33 00 00 00  					Length of remaining data
15 00 00 00  					Length of next field
64 6F 20 79 6F 75 20 77 61 6E 74 20 6D 79 20 66 69 6C 65 20 3F  File
description :"do you want my file ?"
58 56  						Unused Port ?
BC 02  						a sequence ? 
0C 00  						length of next field
43 6F 6F 6C 42 6F 73 2E 64 6C 6C 00     	File name :
"CoolBos.dll"
00 E0 01 00  					File size : 120KB
56 58 00 00  					Unused Port ?
-----------------------------------------------------------

for now, i decide i don't want this file so i want to send a file
transfer deny with a message telling i don't want them ...

so my ICQ clone build this reponse : 
-----------------------------------------------------------
02							Command : 
00 00 00 00 					Check code (will be
filled after encryption)
DA 07 						Command : ack message
0E 00 						Unknown
56 FF 						Sequence
00 00 00 00 00 00 00 00 00 00 00 00 	Unknown
1A 00 						Greeting (extended)
PEER_MSG
01 00 						My status : refused
01 00 						Flag : urgent
01 00 						Message length
00 							Message null
terminated
32 00 						command : file request
granted/refused
F0 2D 12 D9 30 91 D3 11 8D D7 00 10 4B 06 46 2E   ID  :File request/
granted/refused
00 00 						Unknown
0D 00 00 00 					Length of next field
46 69 6C 65 20 54 72 61 6E 73 66 65 72 	Text : "File Transfert"
00 00 01 01 00 00 00 00 00 00 00 00 00 00 00    unknown : grant /
refusal
2F 00 00 00 					Length of remaining data
10 00 00 00 					Length of next field
49 20 77 61 6E 74 20 74 6F 20 63 61 6E 63 65 6C 	text : "I want
to cancel"
00 00 						port (refused , so 0 ? )
00 00 						sequence : 0 on
responses
0D 00 						Length of next field
43 6F 6F 6C 42 6F 73 2E 64 6C 6C 00 00 	File name : "CoolBos.dll"
00 E0 01 00 					File size : 120KB
00 00 00 00  					Unused Port ?
-----------------------------------------------------------

once encrypted, this 134 Bytes packet becomes :
02 90 F3 90 BC BB D1 A4   DB 39 29 AA DB 68 D6 AA 
DB 73 D6 AA DB 77 D6 B0   DB 21 D6 AB DB 60 D6 AA 
E9 72 26 87 C9 D9 30 91   D3 11 8D D7 00 10 4B 06 
46 2E 00 00 0D 00 00 00   46 69 6C 65 20 54 72 61 
6E 73 66 65 72 00 00 01   01 00 00 00 00 00 00 00 
00 00 00 00 2F 00 00 00   10 00 00 00 49 20 77 61 
6E 74 20 74 6F 20 63 61   6E 63 65 6C 00 00 00 00 
0D 00 43 6F 6F 6C 42 6F   73 2E 64 6C 6C 00 00 00 
E0 01 00 00 00 00 00  

i checked i was able to uncrypt it : validation was correct... so seems
this packet is correctly crypted.

but when i try to send this back from my ICQ clone to ICQ2003a (on same
port as i recieved previous P2P packets),
i've got an error telling the socket was closed. and ICQ2003 tells my
clone closed the connection ... and i have no message "I want to cancel"
on icq2003 :(

i also tried to send a packet telling i agree file transfert ...  such
as :
-----------------------------------------------------------
02							Command
85 49 E3 F9  					Check code (i encrypted
/ decrypted packet to have this trace)
DA 07  						Command : ack message
0E 00  						Unknown
5C FF  						Sequence (same as on
file request)
00 00 00 00 00 00 00 00 00 00 00 00  	Unkown
1A 00  						Greeting (extended)
PEER_MSG
00 00  						my status : online,
accepted
00 00  						flag : 	unkown , not
urgent ? could be 0x01 i think 
01 00 						next field length
00  							Message null
terminated
32 00  						Command : File
granted/refused
F0 2D 12 D9 30 91 D3 11 8D D7 00 10 4B 06 46 2E  	ID : file
request/granted/refused
00 00  						unknown
0D 00 00 00 					Length of next field
46 69 6C 65 20 54 72 61 6E 73 66 65 72 	Text : "File Transfert"   ( i
tried with "File" too)
00 00 01 01 00 00 00 00 00 00 00 00 00 00 00  	unknown : grant /
refusal
1F 00 00 00  					Length of remaining data
00 00 00 00  					length of message
(empty)
0D 33  						port
00 00  						Sequence ? 0 on
responses
0D 00  						length of next field
43 6F 6F 6C 42 6F 73 2E 64 6C 6C 00 00  	File name "CoolBos.dll"

							(i saw double 0
on micq site ... error maybe,
							shoudn't be a
problem in fact)
00 E0 01 00  					File size : 120KB
33 0D 00 00  					port
-----------------------------------------------------------

I had same disconnection problem ... did i made something wrong ? 
I'm sure i did :op

please please, i need your help or soon i'll have removed all hair from
my head :(
i stopped coding for weeks cause of this problem :(

Thank you much everybody, and have a good Sunday evening !

Chris





More information about the icq-devel mailing list