-
Notifications
You must be signed in to change notification settings - Fork 1
/
robinet.init
58 lines (53 loc) · 1.79 KB
/
robinet.init
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
(* from OPAM. *)
let () =
try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH")
with Not_found -> ()
;;
(*
#require "findlib";;
#camlp4o;;
Toploop.use_silently
Format.err_formatter (Filename.concat (Findlib.package_directory "batteries") "battop.ml");;
*)
#require "bitstring";;
#require "bitstring.syntax";;
#require "batteries";;
#camlp4o;;
open Batteries;;
open Bitstring;;
open Tools;;
let colorize =
Format.set_tags true ;
Format.set_mark_tags false ;
let def_funs = Format.get_formatter_tag_functions () in
let colorize = function
| "addr" | "proto" | "port" | "seqnum" | "code" -> Format.printf "\027[1;35m"
| "time" -> Format.printf "\027[1;33m"
| "bits" | "flags" -> Format.printf "\027[1;34m"
| x -> def_funs.Format.print_open_tag x
and uncolorize = function
| "addr" | "time" | "proto" | "port" | "seqnum" | "code" | "bits" | "flags" -> Format.printf "\027[0m"
| x -> def_funs.Format.print_close_tag x in
Format.set_formatter_tag_functions { def_funs with
Format.print_open_tag = colorize ;
Format.print_close_tag = uncolorize
} ;;
#install_printer Tools.Payload.print;;
#install_printer Tools.print_bitstring;;
#install_printer Tcp.Port.print;;
#install_printer Tcp.SeqNum.print;;
#install_printer Tcp.Pdu.print_flags;;
#install_printer Udp.Port.print;;
#install_printer Arp.HwProto.print;;
#install_printer Arp.Op.print;;
#install_printer Arp.HwType.print;;
#install_printer Eth.Addr.print;;
#install_printer Ip.Proto.print;;
#install_printer Ip.Addr.print;;
#install_printer Ip.Cidr.print;;
#install_printer Dhcp.MsgType.print;;
#install_printer Dns.QType.print;;
#install_printer Pcap.Dlt.print;;
#install_printer Clock.Time.print;;
#install_printer Clock.Interval.print;;
#install_printer Icmp.MsgType.print;;