~marionnet-drivers/marionnet/trunk

513 by Jean-Vincent Loddo
marionnet repository adapted to re-integrate the ocamlbricks one
1
(* This file is part of Marionnet, a virtual network laboratory
2
   Copyright (C) 2017  Jean-Vincent Loddo
3
   Copyright (C) 2017  Université Paris 13
4
5
   This program is free software: you can redistribute it and/or modify
6
   it under the terms of the GNU General Public License as published by
7
   the Free Software Foundation, either version 2 of the License, or
8
   (at your option) any later version.
9
10
   This program is distributed in the hope that it will be useful,
11
   but WITHOUT ANY WARRANTY; without even the implied warranty of
12
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
   GNU General Public License for more details.
14
15
   You should have received a copy of the GNU General Public License
16
   along with this program.  If not, see <http://www.gnu.org/licenses/>. *)
17
537 by Jean-Vincent Loddo
Minor changes to complete our code restructuration (Dune build system, ocaml>=4.13, lablgtk3). The Makefile has now the entry "install-final-as-root" that installs all the binaries by mean of the script "_build/make_install_as_root.sh" built on the fly then called with `sudo'.
18
(* --- *)
19
open Ocamlbricks
20
513 by Jean-Vincent Loddo
marionnet repository adapted to re-integrate the ocamlbricks one
21
(* Machine component related constants: *)
22
module Const :
23
  sig
24
    val port_no_default : int
25
    val port_no_min     : int
26
    val port_no_max     : int
27
    val memory_default  : int
28
    val memory_min      : int
29
    val memory_max      : int
30
    val initial_content_for_rcfiles : string
31
  end
32
33
(* The type of data returned by the dialog: *)
34
module Data : sig
35
  type t = {
36
    name               : string;
37
    label              : string;
38
    memory             : int;
39
    port_no            : int;
40
    distribution       : string;          (* epithet *)
41
    variant            : string option;
42
    kernel             : string;          (* epithet *)
43
    rc_config          : bool * string;   (* run commands (rc) file configuration *)
44
    console_no         : int;
45
    terminal           : string;
46
    old_name           : string;
47
    }
48
end (* Data *)
49
518 by Jean-Vincent Loddo
Relevant change in managing the hostfs directory for machines and routers. Now, this property is managed (creation, reading, renaming, removing) at the user-level instead of the simulation-level. All sub-directories have the name of their related machine or router. This should facilitate the transfer of files from the host file system to the guests file systems. Marionnet should provide a graphical module to help this transfer, which could be done with stopped or running machines.
50
module Make_menus :
513 by Jean-Vincent Loddo
marionnet repository adapted to re-integrate the ocamlbricks one
51
  functor
52
    (Params : sig
53
                val st      : State.globalState
54
                val packing : [ `menu_parent of Menu_factory.menu_parent | `toolbar of GButton.toolbar ]
518 by Jean-Vincent Loddo
Relevant change in managing the hostfs directory for machines and routers. Now, this property is managed (creation, reading, renaming, removing) at the user-level instead of the simulation-level. All sub-directories have the name of their related machine or router. This should facilitate the transfer of files from the host file system to the guests file systems. Marionnet should provide a graphical module to help this transfer, which could be done with stopped or running machines.
55
              end) ->
56
  sig
513 by Jean-Vincent Loddo
marionnet repository adapted to re-integrate the ocamlbricks one
57
    (* This functor produces a side effect on the GUI. No code has to be exported. *)
58
  end
59
60
module User_level_machine : sig
61
62
  class machine :
63
    network     : User_level.network ->
64
    name        : string ->
65
    ?label      : string ->
66
    ?memory     : int ->
67
    ?epithet    : [ `distrib ] Disk.epithet ->
68
    ?variant    : string ->
69
    ?kernel     : [ `kernel ] Disk.epithet ->
70
    ?rc_config  : bool * string ->
71
    ?console_no : int ->
72
    ?terminal   : string ->
73
    port_no     : int ->
74
    unit ->
519 by Jean-Vincent Loddo
Minor changes in simulation_level.mli
75
    object
76
      (* --- *)
77
      method id                              : int
78
      method name                            : string
79
      (* --- *)
80
      method get_name                        : string
81
      method set_name                        : string -> unit
82
      (* --- *)
83
      method get_label                       : string
84
      method set_label                       : string -> unit
85
      (* --- *)
86
      method get_memory                      : int
87
      method set_memory                      : int -> unit
88
      (* --- *)
89
      method get_port_no                     : int
90
      method set_port_no                     : int -> unit
91
      method polarity                        : User_level.polarity
92
      method ports_card                      : machine User_level.ports_card
93
      method port_prefix                     : string
94
      method port_no_min                     : int
95
      method port_no_max                     : int
96
      method user_port_offset                : int
97
      (* --- *)
98
      method get_epithet                     : [ `distrib ] Disk.epithet
99
      method set_epithet                     : [ `distrib ] Disk.epithet -> unit
100
      (* --- *)
101
      method get_filesystem_file_name        : Disk.realpath
102
      method get_filesystem_relay_script     : Disk.filename option
103
      (* --- *)
104
      method get_variant                     : [ `variant ] Disk.epithet option
105
      method set_variant                     : [ `variant ] Disk.epithet option -> unit
106
      method get_variant_as_string           : [ `variant ] Disk.epithet
107
      method get_variant_realpath            : Disk.realpath option
108
      (* --- *)
109
      method get_states_directory            : string
110
      method get_hostfs_directory            : ?name   :string (* self#get_name *) -> unit -> string
111
      (* --- *)
112
      method get_kernel                      : [ `kernel ] Disk.epithet
113
      method set_kernel                      : [ `kernel ] Disk.epithet -> unit
114
      (* --- *)
115
      method get_kernel_console_arguments    : string option
116
      method get_kernel_file_name            : Disk.realpath
117
      (* --- *)
118
      method get_rc_config                   : bool * string
119
      method set_rc_config                   : bool * string -> unit
120
      (* --- *)
121
      method get_terminal                    : string
122
      method set_terminal                    : string -> unit
123
      (* --- *)
124
      method get_console_no                  : int
125
      method set_console_no                  : int -> unit
513 by Jean-Vincent Loddo
marionnet repository adapted to re-integrate the ocamlbricks one
126
      (* --- *)
127
      val simulated_device                   : User_level.node_with_ports_card Simulation_level.device option ref
519 by Jean-Vincent Loddo
Minor changes in simulation_level.mli
128
      method make_simulated_device           : User_level.node_with_ports_card Simulation_level.device
129
      method simulated_device_state          : User_level.simulated_device_automaton_state
130
      method next_simulated_device_state     : User_level.simulated_device_automaton_state option
131
      method set_next_simulated_device_state : User_level.simulated_device_automaton_state option -> unit
132
      (* --- *)
513 by Jean-Vincent Loddo
marionnet repository adapted to re-integrate the ocamlbricks one
133
      val automaton_state                    : User_level.simulated_device_automaton_state ref
134
      val next_automaton_state               : User_level.simulated_device_automaton_state option ref
519 by Jean-Vincent Loddo
Minor changes in simulation_level.mli
135
      method automaton_state_as_string       : string
136
      (* --- *)
137
      method has_ledgrid                     : bool
138
      method has_hublet_processes            : bool
513 by Jean-Vincent Loddo
marionnet repository adapted to re-integrate the ocamlbricks one
139
      method get_hublet_process_of_port      : int -> Simulation_level.hublet_process
519 by Jean-Vincent Loddo
Minor changes in simulation_level.mli
140
      (* --- *)
513 by Jean-Vincent Loddo
marionnet repository adapted to re-integrate the ocamlbricks one
141
      method devkind                         : User_level.devkind
142
      method string_of_devkind               : string
143
      method string_of_simulated_device_state: string
519 by Jean-Vincent Loddo
Minor changes in simulation_level.mli
144
      (* --- *)
513 by Jean-Vincent Loddo
marionnet repository adapted to re-integrate the ocamlbricks one
145
      method can_startup                     : bool
146
      method startup                         : unit
147
      method startup_right_now               : unit
519 by Jean-Vincent Loddo
Minor changes in simulation_level.mli
148
      (* --- *)
149
      method can_suspend                     : bool
513 by Jean-Vincent Loddo
marionnet repository adapted to re-integrate the ocamlbricks one
150
      method suspend                         : unit
151
      method suspend_right_now               : unit
519 by Jean-Vincent Loddo
Minor changes in simulation_level.mli
152
      (* --- *)
153
      method can_resume                      : bool
513 by Jean-Vincent Loddo
marionnet repository adapted to re-integrate the ocamlbricks one
154
      method resume                          : unit
155
      method resume_right_now                : unit
519 by Jean-Vincent Loddo
Minor changes in simulation_level.mli
156
      (* --- *)
157
      method can_gracefully_shutdown         : bool
513 by Jean-Vincent Loddo
marionnet repository adapted to re-integrate the ocamlbricks one
158
      method gracefully_shutdown             : unit
159
      method gracefully_shutdown_right_now   : unit
519 by Jean-Vincent Loddo
Minor changes in simulation_level.mli
160
      method gracefully_restart              : unit
161
      (* --- *)
162
      method can_poweroff                    : bool
513 by Jean-Vincent Loddo
marionnet repository adapted to re-integrate the ocamlbricks one
163
      method poweroff                        : unit
164
      method poweroff_right_now              : unit
165
      (* --- *)
519 by Jean-Vincent Loddo
Minor changes in simulation_level.mli
166
      method add_my_history                  : unit
167
      method add_my_ifconfig                 : ?port_row_completions:Treeview_ifconfig.port_row_completions -> int -> unit
168
      method history_icon                    : Treeview.Row_item.Icon_prj_inj.a
169
      method ifconfig_device_type            : string
170
      method defects_device_type             : string
171
      method leds_relative_subdir            : string
172
      (* --- *)
173
      method dotImg                          : User_level.iconsize -> string
174
      method dotLabelForEdges                : string -> string
175
      method dotPortForEdges                 : string -> string
176
      method dotTrad                         : ?nodeoptions:string -> User_level.iconsize -> string
177
      method dot_fontsize_statement          : string
178
      method label_for_dot                   : string
179
      (* --- *)
180
      method create                          : unit
513 by Jean-Vincent Loddo
marionnet repository adapted to re-integrate the ocamlbricks one
181
      method create_cow_file_name_and_thunk_to_get_the_source : string * (unit -> Disk.realpath option)
519 by Jean-Vincent Loddo
Minor changes in simulation_level.mli
182
      method create_right_now                : unit
183
      (* --- *)
184
      method destroy                         : unit
185
      method destroy_my_history              : unit
186
      method destroy_my_ifconfig             : unit
187
      method destroy_my_simulated_device     : unit
188
      method destroy_right_now               : unit
189
      method add_destroy_callback            : unit Lazy.t -> unit
190
      (* --- *)
191
      method eval_forest_attribute           : Xforest.attribute -> unit
192
      method eval_forest_child               : Xforest.tree -> unit
193
      method from_tree                       : Xforest.node -> Xforest.forest -> unit
194
      method to_tree                         : Xforest.tree
195
      method to_forest                       : Xforest.forest
196
      (* --- *)
532 by Jean-Vincent Loddo
Major change (#3): code restructured in order to compile Marionnet by the Dune build system, with ocaml>=4.13 and lablgtk3. Step #3 (last major step)
197
      method logged_failwith                 : 'a 'b. ('a -> string, unit, string, string, string, string) format6 -> 'a -> 'b
519 by Jean-Vincent Loddo
Minor changes in simulation_level.mli
198
      method sprintf                         : ('a, unit, string, string) format4 -> 'a
199
      method show                            : string
532 by Jean-Vincent Loddo
Major change (#3): code restructured in order to compile Marionnet by the Dune build system, with ocaml>=4.13 and lablgtk3. Step #3 (last major step)
200
      method mrproper                        : Ocamlbricks.Thunk.lifo_unit_protected_container
519 by Jean-Vincent Loddo
Minor changes in simulation_level.mli
201
      (* --- *)
202
      method is_correct                      : bool
203
      method is_xnest_enabled                : bool
513 by Jean-Vincent Loddo
marionnet repository adapted to re-integrate the ocamlbricks one
204
      (* --- *)
518 by Jean-Vincent Loddo
Relevant change in managing the hostfs directory for machines and routers. Now, this property is managed (creation, reading, renaming, removing) at the user-level instead of the simulation-level. All sub-directories have the name of their related machine or router. This should facilitate the transfer of files from the host file system to the guests file systems. Marionnet should provide a graphical module to help this transfer, which could be done with stopped or running machines.
205
      method update_machine_with :
519 by Jean-Vincent Loddo
Minor changes in simulation_level.mli
206
        name:string -> label:string -> memory:int -> port_no:int -> kernel:[ `kernel ] Disk.epithet ->
207
        rc_config:bool * string ->  console_no:int -> terminal:string -> unit
208
      (* --- *)
209
      method update_virtual_machine_with     : name:string -> port_no:int -> [ `kernel ] Disk.epithet -> unit
210
      method update_with                     : name:string -> label:string -> port_no:int -> unit
513 by Jean-Vincent Loddo
marionnet repository adapted to re-integrate the ocamlbricks one
211
    end
518 by Jean-Vincent Loddo
Relevant change in managing the hostfs directory for machines and routers. Now, this property is managed (creation, reading, renaming, removing) at the user-level instead of the simulation-level. All sub-directories have the name of their related machine or router. This should facilitate the transfer of files from the host file system to the guests file systems. Marionnet should provide a graphical module to help this transfer, which could be done with stopped or running machines.
212
513 by Jean-Vincent Loddo
marionnet repository adapted to re-integrate the ocamlbricks one
213
end (* User_level_machine *)
214
215
216
module (*Machine.*)Simulation_level : sig
217
218
  class ['parent] machine :
219
    parent                    : 'parent ->
220
    filesystem_file_name      : string ->
221
    kernel_file_name          : string ->
222
    ?kernel_console_arguments : string ->
223
    ?filesystem_relay_script  : string ->
224
    ?rcfile_content           : string ->
519 by Jean-Vincent Loddo
Minor changes in simulation_level.mli
225
    get_the_cow_file_name_source : (unit -> string option) ->
513 by Jean-Vincent Loddo
marionnet repository adapted to re-integrate the ocamlbricks one
226
    cow_file_name             : string ->
227
    states_directory          : string ->
518 by Jean-Vincent Loddo
Relevant change in managing the hostfs directory for machines and routers. Now, this property is managed (creation, reading, renaming, removing) at the user-level instead of the simulation-level. All sub-directories have the name of their related machine or router. This should facilitate the transfer of files from the host file system to the guests file systems. Marionnet should provide a graphical module to help this transfer, which could be done with stopped or running machines.
228
    hostfs_directory          : string ->
513 by Jean-Vincent Loddo
marionnet repository adapted to re-integrate the ocamlbricks one
229
    ethernet_interface_no     : int ->
230
    ?memory                   : int ->
231
    ?umid                     : string ->
232
    ?xnest                    : bool ->
233
    ?console_no               : int ->
234
    id                        : int ->
235
    working_directory         : string ->
236
    unexpected_death_callback : (unit -> unit) ->
237
    unit ->
238
    object
239
      constraint 'parent =
240
        < get_name : string;
519 by Jean-Vincent Loddo
Minor changes in simulation_level.mli
241
          ports_card : < get_my_inward_defects_by_index  : int -> Simulation_level.defects_object;
242
                         get_my_outward_defects_by_index : int -> Simulation_level.defects_object;
513 by Jean-Vincent Loddo
marionnet repository adapted to re-integrate the ocamlbricks one
243
                          .. >;
244
          .. >
245
      method continue_processes : unit
246
      method destroy : unit
247
      method device_type : string
519 by Jean-Vincent Loddo
Minor changes in simulation_level.mli
248
      (* --- *)
513 by Jean-Vincent Loddo
marionnet repository adapted to re-integrate the ocamlbricks one
249
      method get_hublet_no : int
518 by Jean-Vincent Loddo
Relevant change in managing the hostfs directory for machines and routers. Now, this property is managed (creation, reading, renaming, removing) at the user-level instead of the simulation-level. All sub-directories have the name of their related machine or router. This should facilitate the transfer of files from the host file system to the guests file systems. Marionnet should provide a graphical module to help this transfer, which could be done with stopped or running machines.
250
      method get_hublet_process_list    : Simulation_level.hublet_process list
251
      method get_hublet_process_of_port : int -> Simulation_level.hublet_process
519 by Jean-Vincent Loddo
Minor changes in simulation_level.mli
252
      (* --- *)
253
      method ip_address_eth42 : string
254
      (* --- *)
255
      method spawn_processes : unit
256
      method stop_processes : unit
513 by Jean-Vincent Loddo
marionnet repository adapted to re-integrate the ocamlbricks one
257
      method gracefully_shutdown : unit
519 by Jean-Vincent Loddo
Minor changes in simulation_level.mli
258
      method terminate_processes : unit
513 by Jean-Vincent Loddo
marionnet repository adapted to re-integrate the ocamlbricks one
259
      method gracefully_terminate_processes : unit
519 by Jean-Vincent Loddo
Minor changes in simulation_level.mli
260
      (* --- *)
261
      method startup : unit
262
      method suspend : unit
513 by Jean-Vincent Loddo
marionnet repository adapted to re-integrate the ocamlbricks one
263
      method resume : unit
264
      method shutdown : unit
519 by Jean-Vincent Loddo
Minor changes in simulation_level.mli
265
      (* --- *)
266
      method execute_the_unexpected_death_callback : int -> string -> unit
513 by Jean-Vincent Loddo
marionnet repository adapted to re-integrate the ocamlbricks one
267
    end
518 by Jean-Vincent Loddo
Relevant change in managing the hostfs directory for machines and routers. Now, this property is managed (creation, reading, renaming, removing) at the user-level instead of the simulation-level. All sub-directories have the name of their related machine or router. This should facilitate the transfer of files from the host file system to the guests file systems. Marionnet should provide a graphical module to help this transfer, which could be done with stopped or running machines.
268
513 by Jean-Vincent Loddo
marionnet repository adapted to re-integrate the ocamlbricks one
269
end (* Machine.Simulation_level *)
270