83 |
port = port; |
port = port; |
84 |
tags = tags; |
tags = tags; |
85 |
} |
} |
86 |
|
|
87 |
let print t = |
let print t = |
88 |
lprintf "CONNECT:\n"; |
lprintf_nl "CONNECT:"; |
89 |
lprintf "MD4: %s\n" (Md4.to_string t.md4); |
lprintf_nl "MD4: %s" (Md4.to_string t.md4); |
90 |
lprintf "ip: %s\n" (Ip.to_string t.ip); |
lprintf_nl "ip: %s" (Ip.to_string t.ip); |
91 |
lprintf "port: %d\n" t.port; |
lprintf_nl "port: %d" t.port; |
92 |
lprintf "tags: "; |
lprintf "tags: "; |
93 |
print_tags t.tags |
print_tags t.tags; |
94 |
|
lprintf_nl "" |
95 |
|
|
96 |
let bprint oc t = |
let bprint oc t = |
97 |
Printf.bprintf oc "CONNECT:\n"; |
Printf.bprintf oc "CONNECT:\n"; |
98 |
Printf.bprintf oc "%s\n" (Md4.to_string t.md4); |
Printf.bprintf oc "%s\n" (Md4.to_string t.md4); |
134 |
iter s 2 nchans |
iter s 2 nchans |
135 |
|
|
136 |
let print t = |
let print t = |
137 |
lprintf "CHANNELS:\n"; |
lprintf_nl "CHANNELS:"; |
138 |
List.iter (fun c -> |
List.iter (fun c -> |
139 |
lprintf " %s: %d\n" c.name c.number; |
lprintf_nl " %s: %d" c.name c.number; |
140 |
) t |
) t |
141 |
|
|
142 |
let bprint oc t = |
let bprint oc t = |
175 |
} |
} |
176 |
|
|
177 |
let print t = |
let print t = |
178 |
lprintf "SET_ID:\n%s\n" (if t.zlib then "Zlib" else ""); |
lprintf_nl "SET_ID:\n%s" (if t.zlib then "Zlib" else ""); |
179 |
lprintf "id: %s\n" (Ip.to_string t.ip); |
lprintf_nl "id: %s" (Ip.to_string t.ip); |
180 |
match t.port with |
match t.port with |
181 |
None -> () |
None -> () |
182 |
| Some port -> |
| Some port -> |
183 |
lprintf "Real Port: %d\n" port |
lprintf_nl "Real Port: %d" port |
184 |
|
|
185 |
let bprint oc t = |
let bprint oc t = |
186 |
Printf.bprintf oc "SET_ID: %s\n" (if t.zlib then "Zlib" else ""); |
Printf.bprintf oc "SET_ID: %s\n" (if t.zlib then "Zlib" else ""); |
200 |
let parse len s = () |
let parse len s = () |
201 |
|
|
202 |
let print t = |
let print t = |
203 |
lprintf "ACK_ID:\n" |
lprintf_nl "ACK_ID:" |
204 |
|
|
205 |
let bprint oc t = |
let bprint oc t = |
206 |
Printf.bprintf oc "ACK_ID\n" |
Printf.bprintf oc "ACK_ID\n" |
218 |
v |
v |
219 |
|
|
220 |
let print t = |
let print t = |
221 |
lprintf "MESSAGE:\n"; |
lprintf_nl "MESSAGE:"; |
222 |
lprintf "message = \"%s\"" (String.escaped t) |
lprintf_nl "message = \"%s\"" (String.escaped t) |
223 |
|
|
224 |
let bprint oc t = |
let bprint oc t = |
225 |
Printf.bprintf oc "MESSAGE:\n"; |
Printf.bprintf oc "MESSAGE:\n"; |
257 |
files |
files |
258 |
|
|
259 |
let print t = |
let print t = |
260 |
lprintf "SHARED:\n"; |
lprintf_nl "SHARED:"; |
261 |
List.iter (fun t -> |
List.iter (fun t -> |
262 |
lprintf "FILE:\n"; |
lprintf_nl "FILE:"; |
263 |
lprintf " MD4: %s\n" (Md4.to_string t.f_md4); |
lprintf_nl " MD4: %s" (Md4.to_string t.f_md4); |
264 |
lprintf " ip: %s\n" (Ip.to_string t.f_ip); |
lprintf_nl " ip: %s" (Ip.to_string t.f_ip); |
265 |
lprintf " port: %d\n" t.f_port; |
lprintf_nl " port: %d" t.f_port; |
266 |
lprintf " tags: "; |
lprintf " tags: "; |
267 |
print_tags t.f_tags; |
print_tags t.f_tags; |
268 |
lprint_newline ();) t |
lprintf_nl "";) t |
269 |
|
|
270 |
let bprint oc t = |
let bprint oc t = |
271 |
Printf.bprintf oc "SHARED:\n"; |
Printf.bprintf oc "SHARED:\n"; |
319 |
users, files |
users, files |
320 |
|
|
321 |
let print (users, files) = |
let print (users, files) = |
322 |
lprintf "INFO:\n"; |
lprintf_nl "INFO:"; |
323 |
lprintf "users: %d files: %d\n" users files |
lprintf_nl "users: %d files: %d" users files |
324 |
|
|
325 |
let bprint oc (users, files) = |
let bprint oc (users, files) = |
326 |
Printf.bprintf oc "INFO:\n"; |
Printf.bprintf oc "INFO:\n"; |
350 |
iter 0 |
iter 0 |
351 |
|
|
352 |
let print t = |
let print t = |
353 |
lprintf "SERVER LIST\n"; |
lprintf_nl "SERVER LIST"; |
354 |
List.iter (fun l -> |
List.iter (fun l -> |
355 |
lprintf " %s : %d\n" (Ip.to_string l.ip) l.port; |
lprintf_nl " %s : %d" (Ip.to_string l.ip) l.port; |
356 |
) t |
) t |
357 |
|
|
358 |
let bprint oc t = |
let bprint oc t = |
399 |
} |
} |
400 |
|
|
401 |
let print t = |
let print t = |
402 |
lprintf "SERVER INFO:\n"; |
lprintf_nl "SERVER INFO:"; |
403 |
lprintf "MD4: %s\n" (Md4.to_string t.md4); |
lprintf_nl "MD4: %s" (Md4.to_string t.md4); |
404 |
lprintf "ip: %s\n" (Ip.to_string t.ip); |
lprintf_nl "ip: %s" (Ip.to_string t.ip); |
405 |
lprintf "port: %d\n" t.port; |
lprintf_nl "port: %d" t.port; |
406 |
lprintf "tags: "; |
lprintf "tags: "; |
407 |
print_tags t.tags |
print_tags t.tags |
408 |
|
|
456 |
let parse len s = get_replies s 1 |
let parse len s = get_replies s 1 |
457 |
|
|
458 |
let print t = |
let print t = |
459 |
lprintf "FOUND:\n"; |
lprintf_nl "FOUND:"; |
460 |
List.iter (fun t -> |
List.iter (fun t -> |
461 |
lprintf "FILE:\n"; |
lprintf_nl "FILE:"; |
462 |
lprintf " MD4: %s\n" (Md4.to_string t.f_md4); |
lprintf_nl " MD4: %s" (Md4.to_string t.f_md4); |
463 |
lprintf " ip: %s\n" (Ip.to_string t.f_ip); |
lprintf_nl " ip: %s" (Ip.to_string t.f_ip); |
464 |
lprintf " port: %d\n" t.f_port; |
lprintf_nl " port: %d" t.f_port; |
465 |
lprintf " tags: "; |
lprintf " tags: "; |
466 |
print_tags t.f_tags; |
print_tags t.f_tags; |
467 |
lprint_newline ();) t |
lprintf_nl "") t |
468 |
|
|
469 |
let bprint oc t = |
let bprint oc t = |
470 |
Printf.bprintf oc "FOUND:\n"; |
Printf.bprintf oc "FOUND:\n"; |
505 |
let parse len s = () |
let parse len s = () |
506 |
|
|
507 |
let print t = |
let print t = |
508 |
lprintf "%s:\n" M.m |
lprintf_nl "%s:" M.m |
509 |
|
|
510 |
let write (buf: Buffer.t) (t: t) = unit |
let write (buf: Buffer.t) (t: t) = unit |
511 |
|
|
652 |
| QHasMaxVal (name, field) -> |
| QHasMaxVal (name, field) -> |
653 |
Printf.bprintf oc "Field[%s] < [%s]" (string_of_field name) (Int64.to_string field) |
Printf.bprintf oc "Field[%s] < [%s]" (string_of_field name) (Int64.to_string field) |
654 |
| QNone -> |
| QNone -> |
655 |
lprintf "print_query: QNone in query\n"; |
lprintf_nl "print_query: QNone in query"; |
656 |
() |
() |
657 |
|
|
658 |
|
|
715 |
buf_string buf name |
buf_string buf name |
716 |
|
|
717 |
| QNone -> |
| QNone -> |
718 |
lprintf "print_query: QNone in query\n"; |
lprintf_nl "print_query: QNone in query"; |
719 |
() |
() |
720 |
|
|
721 |
end |
end |
733 |
let name, pos = get_string s 2 in |
let name, pos = get_string s 2 in |
734 |
name |
name |
735 |
| _ -> |
| _ -> |
736 |
lprintf "QueryUsers: unknown tag %d\n" targ; |
lprintf_nl "QueryUsers: unknown tag %d" targ; |
737 |
raise Not_found |
raise Not_found |
738 |
|
|
739 |
let print t = |
let print t = |
740 |
lprintf "QUERY USERS [%s]\n" t |
lprintf_nl "QUERY USERS [%s]" t |
741 |
|
|
742 |
let bprint oc t = |
let bprint oc t = |
743 |
Printf.bprintf oc "QUERY USERS [%s]\n" t |
Printf.bprintf oc "QUERY USERS [%s]\n" t |
787 |
parse_clients s 5 nclients [] |
parse_clients s 5 nclients [] |
788 |
|
|
789 |
let print t = |
let print t = |
790 |
lprintf "QUERY USERS REPLY:\n"; |
lprintf_nl "QUERY USERS REPLY:"; |
791 |
List.iter (fun t -> |
List.iter (fun t -> |
792 |
lprintf "MD4: %s\n" (Md4.to_string t.md4); |
lprintf_nl "MD4: %s" (Md4.to_string t.md4); |
793 |
lprintf "ip: %s\n" (Ip.to_string t.ip); |
lprintf_nl "ip: %s" (Ip.to_string t.ip); |
794 |
lprintf "port: %d\n" t.port; |
lprintf_nl "port: %d" t.port; |
795 |
lprintf "tags: "; |
lprintf "tags: "; |
796 |
print_tags t.tags; lprint_newline ();) t |
print_tags t.tags; |
797 |
|
lprintf_nl "";) t |
798 |
|
|
799 |
let bprint oc t = |
let bprint oc t = |
800 |
Printf.bprintf oc "QUERY USERS REPLY:\n"; |
Printf.bprintf oc "QUERY USERS REPLY:\n"; |
823 |
get_md4 s 1 |
get_md4 s 1 |
824 |
|
|
825 |
let print t = |
let print t = |
826 |
lprintf "QUERY LOCATION OF %s" (Md4.to_string t) |
lprintf_nl "QUERY LOCATION OF %s" (Md4.to_string t) |
827 |
|
|
828 |
let bprint oc t = |
let bprint oc t = |
829 |
Printf.bprintf oc "QUERY LOCATION OF %s\n" (Md4.to_string t) |
Printf.bprintf oc "QUERY LOCATION OF %s\n" (Md4.to_string t) |
856 |
{ locs =locs; md4 = md4 } |
{ locs =locs; md4 = md4 } |
857 |
|
|
858 |
let print t = |
let print t = |
859 |
lprintf "LOCATION OF %s\n" (Md4.to_string t.md4); |
lprintf_nl "LOCATION OF %s" (Md4.to_string t.md4); |
860 |
List.iter (fun l -> |
List.iter (fun l -> |
861 |
lprintf " %s : %d %s\n" (Ip.to_string l.ip) l.port |
lprintf_nl " %s : %d %s" (Ip.to_string l.ip) l.port |
862 |
(if not (Ip.valid l.ip) then |
(if not (Ip.valid l.ip) then |
863 |
Printf.sprintf "(Firewalled %Ld)" (id_of_ip l.ip) |
Printf.sprintf "(Firewalled %Ld)" (id_of_ip l.ip) |
864 |
else ""); |
else ""); |
929 |
{ ip = ip; port = port; } |
{ ip = ip; port = port; } |
930 |
|
|
931 |
let print t = |
let print t = |
932 |
lprintf "IDENTIFICATION %s : %d\n" (Ip.to_string t.ip) t.port |
lprintf_nl "IDENTIFICATION %s : %d" (Ip.to_string t.ip) t.port |
933 |
|
|
934 |
let bprint oc t = |
let bprint oc t = |
935 |
Printf.bprintf oc "IDENTIFICATION %s : %d\n" (Ip.to_string t.ip) t.port |
Printf.bprintf oc "IDENTIFICATION %s : %d\n" (Ip.to_string t.ip) t.port |
953 |
{ ip = ip; port = port; } |
{ ip = ip; port = port; } |
954 |
|
|
955 |
let print t = |
let print t = |
956 |
lprintf "QUERY SERVERS %s : %d\n" (Ip.to_string t.ip) t.port |
lprintf_nl "QUERY SERVERS %s : %d" (Ip.to_string t.ip) t.port |
957 |
|
|
958 |
let bprint oc t = |
let bprint oc t = |
959 |
Printf.bprintf oc "QUERY SERVERS %s : %d\n" (Ip.to_string t.ip) t.port |
Printf.bprintf oc "QUERY SERVERS %s : %d\n" (Ip.to_string t.ip) t.port |
997 |
{ server_ip = Ip.null; server_port = 0; servers = servers } |
{ server_ip = Ip.null; server_port = 0; servers = servers } |
998 |
|
|
999 |
let print t = |
let print t = |
1000 |
lprintf "SERVERS QUERY REPLY %s : %d\n" ( |
lprintf_nl "SERVERS QUERY REPLY %s : %d" ( |
1001 |
Ip.to_string t.server_ip) t.server_port; |
Ip.to_string t.server_ip) t.server_port; |
1002 |
List.iter (fun s -> |
List.iter (fun s -> |
1003 |
lprintf " %s:%d\n" (Ip.to_string s.ip) s.port; |
lprintf_nl " %s:%d" (Ip.to_string s.ip) s.port; |
1004 |
) t.servers |
) t.servers |
1005 |
|
|
1006 |
let bprint oc t = |
let bprint oc t = |
1156 |
with |
with |
1157 |
e -> |
e -> |
1158 |
if !CommonOptions.verbose_unknown_messages then begin |
if !CommonOptions.verbose_unknown_messages then begin |
1159 |
lprintf "Unknown message From server: %s (magic %d)\n" |
lprintf_nl "Unknown message From server: %s (magic %d)" |
1160 |
(Printexc2.to_string e) magic; |
(Printexc2.to_string e) magic; |
1161 |
let tmp_file = Filename.temp_file "comp" "pak" in |
let tmp_file = Filename.temp_file "comp" "pak" in |
1162 |
File.from_string tmp_file s; |
File.from_string tmp_file s; |
1163 |
lprintf "Saved unknown packet %s\n" tmp_file; |
lprintf_nl "Saved unknown packet %s" tmp_file; |
|
|
|
1164 |
dump s; |
dump s; |
1165 |
lprint_newline (); |
lprintf_nl ""; |
1166 |
end; |
end; |
1167 |
UnknownReq s |
UnknownReq s |
1168 |
|
|
1173 |
| SetIDReq t -> SetID.print t |
| SetIDReq t -> SetID.print t |
1174 |
| AckIDReq t -> AckID.print t |
| AckIDReq t -> AckID.print t |
1175 |
| MessageReq t -> Message.print t |
| MessageReq t -> Message.print t |
1176 |
| BadProtocolVersionReq -> lprintf "BAD PROTOCOL VERSION" |
| BadProtocolVersionReq -> lprintf_nl "BAD PROTOCOL VERSION" |
1177 |
| ShareReq t -> Share.print t |
| ShareReq t -> Share.print t |
1178 |
| InfoReq t -> Info.print t |
| InfoReq t -> Info.print t |
1179 |
| ServerListReq t -> ServerList.print t |
| ServerListReq t -> ServerList.print t |
1193 |
| ChatRoomsReq t -> ChatRooms.print t |
| ChatRoomsReq t -> ChatRooms.print t |
1194 |
|
|
1195 |
| QueryMoreResultsReq -> |
| QueryMoreResultsReq -> |
1196 |
lprintf "QUERY MORE RESULTS\n"; |
lprintf_nl "QUERY MORE RESULTS"; |
1197 |
| Mldonkey_MldonkeyUserReplyReq -> |
| Mldonkey_MldonkeyUserReplyReq -> |
1198 |
lprintf "MLDONKEY USER\n"; |
lprintf_nl "MLDONKEY USER"; |
1199 |
| Mldonkey_SubscribeReq (num, lifetime, t) -> |
| Mldonkey_SubscribeReq (num, lifetime, t) -> |
1200 |
lprintf "MLDONKEY SUBSCRIPTION %d FOR %d SECONDS\n" num lifetime; |
lprintf_nl "MLDONKEY SUBSCRIPTION %d FOR %d SECONDS" num lifetime; |
1201 |
|
|
1202 |
Query.print t |
Query.print t |
1203 |
| Mldonkey_NotificationReq (num,t) -> |
| Mldonkey_NotificationReq (num,t) -> |
1204 |
lprintf "MLDONKEY NOTIFICATIONS TO %d\n" num; |
lprintf_nl "MLDONKEY NOTIFICATIONS TO %d" num; |
1205 |
QueryReply.print t |
QueryReply.print t |
1206 |
| Mldonkey_CloseSubscribeReq num -> |
| Mldonkey_CloseSubscribeReq num -> |
1207 |
lprintf "MLDONKEY CLOSE SUBSCRIPTION %d\n" num; |
lprintf_nl "MLDONKEY CLOSE SUBSCRIPTION %d" num; |
1208 |
| UnknownReq s -> |
| UnknownReq s -> |
1209 |
let len = String.length s in |
let len = String.length s in |
1210 |
lprintf "UnknownReq:\n"; |
lprintf_nl "UnknownReq:"; |
1211 |
lprintf "ascii: ["; |
lprintf "ascii: ["; |
1212 |
for i = 0 to len - 1 do |
for i = 0 to len - 1 do |
1213 |
let c = s.[i] in |
let c = s.[i] in |
1217 |
else |
else |
1218 |
lprintf "(%d)" n |
lprintf "(%d)" n |
1219 |
done; |
done; |
1220 |
lprintf "]\n"; |
lprintf_nl "]"; |
1221 |
lprintf "dec: ["; |
lprintf "dec: ["; |
1222 |
for i = 0 to len - 1 do |
for i = 0 to len - 1 do |
1223 |
let c = s.[i] in |
let c = s.[i] in |
1224 |
let n = int_of_char c in |
let n = int_of_char c in |
1225 |
lprintf "(%d)" n |
lprintf "(%d)" n |
1226 |
done; |
done; |
1227 |
lprintf "]\n"; |
lprintf_nl "]"; |
1228 |
end; |
end; |
1229 |
lprint_newline () |
lprintf_nl "" |
1230 |
|
|
1231 |
|
|
1232 |
let bprint oc t = |
let bprint oc t = |
1263 |
Printf.bprintf oc "MLDONKEY NOTIFICATIONS TO %d\n" num; |
Printf.bprintf oc "MLDONKEY NOTIFICATIONS TO %d\n" num; |
1264 |
QueryReply.bprint oc t |
QueryReply.bprint oc t |
1265 |
| Mldonkey_CloseSubscribeReq num -> |
| Mldonkey_CloseSubscribeReq num -> |
1266 |
lprintf "MLDONKEY CLOSE SUBSCRIPTION %d\n" num; |
lprintf_nl "MLDONKEY CLOSE SUBSCRIPTION %d" num; |
1267 |
|
|
1268 |
| UnknownReq s -> |
| UnknownReq s -> |
1269 |
(* let len = String.length s in*) |
(* let len = String.length s in*) |
1393 |
lprintf "[%s] <> [%s]\n" s (String.escaped ss); |
lprintf "[%s] <> [%s]\n" s (String.escaped ss); |
1394 |
assert (s = ss); |
assert (s = ss); |
1395 |
exit 2 |
exit 2 |
|
*) |
|
1396 |
|
*) |