28 |
open DonkeyTypes |
open DonkeyTypes |
29 |
open DonkeyMftp |
open DonkeyMftp |
30 |
|
|
31 |
|
let emule_version b1 b2 b3 b4 b5 = |
32 |
|
let s = Printf.sprintf "%s" |
33 |
|
(string_of_int(int_of_string("0b" ^ |
34 |
|
(Misc.dec2bin (int_of_string b1) 8) ^ |
35 |
|
(Misc.dec2bin (int_of_string b2) 7) ^ |
36 |
|
(Misc.dec2bin (int_of_string b3) 7) ^ |
37 |
|
(Misc.dec2bin (int_of_string b4) 3) ^ |
38 |
|
(Misc.dec2bin (int_of_string b5) 7)))) |
39 |
|
in s |
40 |
|
|
41 |
(* TODO : update this |
(* TODO : update this |
42 |
I downgraded some of those to get better results : |
I downgraded some of those to get better results : |
43 |
We don't use emule udp extension, client_md4 in sourceexchange or complete sources in |
We don't use emule udp extension, client_md4 in sourceexchange or complete sources in |
44 |
file request *) |
file request *) |
45 |
let mldonkey_emule_proto = { |
let mldonkey_emule_proto = { |
46 |
emule_comments = 1; |
emule_comments = 1; |
47 |
emule_version = 171720704; |
emule_version = (int_of_string (emule_version "10" Autoconf.sub_version1 Autoconf.sub_version2 "0" "0")); |
48 |
|
(* first parameter means compatibleclient, MLDonkeys value is 10 *) |
49 |
|
emule_release = ""; |
50 |
emule_secident = 0; |
emule_secident = 0; |
51 |
emule_noviewshared = 0; |
emule_noviewshared = 0; |
52 |
emule_supportpreview = 0; |
emule_supportpreview = 0; |
156 |
} |
} |
157 |
|
|
158 |
let print t = |
let print t = |
159 |
lprintf_nl "CONNECT:"; |
lprintf "Connect (version %d) from [%s:%d] MD4: %s" |
160 |
lprintf_nl "version: %d" t.version; |
t.version |
161 |
lprintf_nl "MD4: %s" (Md4.to_string t.md4); |
(Ip.to_string t.ip) |
162 |
lprintf_nl "ip: %s" (Ip.to_string t.ip); |
t.port |
163 |
lprintf_nl "port: %d" t.port; |
(Md4.to_string t.md4); |
|
lprintf "tags: "; |
|
|
print_tags t.tags; |
|
|
lprintf_nl ""; |
|
164 |
(match t.server_info with |
(match t.server_info with |
165 |
None -> () |
None -> lprintf_nl "" |
166 |
| Some (ip, port) -> |
| Some (ip, port) -> |
167 |
lprintf_nl "ip_server: %s" (Ip.to_string ip); |
lprintf_nl " on server: %s:%d" (Ip.to_string ip) port); |
168 |
lprintf_nl "port_server: %d" port); |
lprintf "tags: "; |
169 |
String.iter (fun c -> lprintf "(%d)" (int_of_char c)) |
print_tags t.tags; |
170 |
t.left_bytes; |
if String.length t.left_bytes <> 0 then begin |
171 |
lprintf_nl "" |
lprintf " left bytes = "; |
172 |
|
String.iter (fun c -> lprintf "(%d)" (int_of_char c)) |
173 |
|
t.left_bytes end |
174 |
|
|
175 |
let write buf t = |
let write buf t = |
176 |
buf_int8 buf t.version; |
buf_int8 buf t.version; |
177 |
buf_md4 buf t.md4; |
buf_md4 buf t.md4; |
234 |
} |
} |
235 |
|
|
236 |
let print t = |
let print t = |
237 |
lprintf_nl "CONNECT REPLY:"; |
lprintf "Connect reply from [%s:%d] MD4: %s" |
238 |
lprintf_nl "MD4: %s" (Md4.to_string t.md4); |
(Ip.to_string t.ip) |
239 |
lprintf_nl "ip: %s" (Ip.to_string t.ip); |
t.port |
240 |
lprintf_nl "port: %d" t.port; |
(Md4.to_string t.md4); |
|
lprintf "tags: "; |
|
|
print_tags t.tags; |
|
|
lprintf_nl ""; |
|
241 |
(match t.server_info with |
(match t.server_info with |
242 |
None -> () |
None -> lprintf_nl "" |
243 |
| Some (ip, port) -> |
| Some (ip, port) -> |
244 |
lprintf_nl "ip_server: %s" (Ip.to_string ip); |
lprintf_nl " on server: %s:%d" (Ip.to_string ip) port); |
245 |
lprintf_nl "port_server: %d" port); |
lprintf "tags: "; |
246 |
String.iter (fun c -> lprintf "(%d)" (int_of_char c)) |
print_tags t.tags; |
247 |
t.left_bytes; |
if String.length t.left_bytes <> 0 then begin |
248 |
lprintf_nl "" |
lprintf " left bytes = "; |
249 |
|
String.iter (fun c -> lprintf "(%d)" (int_of_char c)) |
250 |
|
t.left_bytes end |
251 |
|
|
252 |
let write buf t = |
let write buf t = |
253 |
buf_md4 buf t.md4; |
buf_md4 buf t.md4; |