Module Net

module Net: sig .. end
Easily composable network library.

A net is a graph of devices (with position on a 2d plane), connected with cables, with additional notes, easily serializable.

Nets are stored on disk in a file nets/net_name, in a csv format for easy edition.

Nets are also available via myadmin http server:



val debug : bool
type hub = {
   hub_nb_ports : int;
}
type switch = {
   switch_nb_ports : int;
   switch_nb_macs : int;
}
type host = {
   host_gw : Eth.gw_addr;
   host_search_sfx : string;
   host_nameserver : Ip.Addr.t;
   host_mac : Eth.Addr.t;
   host_ip : Ip.Addr.t option;
}
type note = string 
type plug = 
| HubPort of string * int
| SwitchPort of string * int
| HostAdapter of string
type cable = {
   plugs : plug * plug;
}
val plug_print : 'a BatInnerIO.output -> plug -> unit
type elmt = 
| Hub of hub
| Switch of switch
| Host of host
| Note of note
type node = {
   elmt : elmt;
   mutable pos : float * float;
   mutable node_name : string;
}
type t = {
   name : string;
   nodes : node list;
   cables : cable list;
}
val make : string -> node list -> cable list -> t
val empty : string -> t
exception Cannot_parse of string * string
val hub_of_csv : string -> node
val switch_of_csv : string -> node
val host_of_csv : string -> node
val note_of_csv : string -> node
val node_of_csv : string -> string -> node
val cable_of_csv : string -> cable
val of_csv_file : BatIO.input -> string -> t
val of_csv_string : string -> string -> t
val csv_for_hosts : 'a BatInnerIO.output -> t -> unit
val csv_for_switches : 'a BatInnerIO.output -> t -> unit
val csv_for_hubs : 'a BatInnerIO.output -> t -> unit
val csv_for_notes : 'a BatInnerIO.output -> t -> unit
val csv_for_cables : 'a BatInnerIO.output -> t -> unit
val csv_for_node : 'a BatInnerIO.output -> node -> unit
val csv_for_cable : 'a BatInnerIO.output -> cable -> unit
val to_csv_file : 'a BatInnerIO.output -> t -> unit
val save : t -> unit
val load : string -> t
val instanciate : t ->
(string, Hub.Repeater.t) Batteries.Hashtbl.t *
(string, Hub.Switch.t) Batteries.Hashtbl.t *
(string, Host.host_trx) Batteries.Hashtbl.t *
(string, note) Batteries.Hashtbl.t