1
- /// This module describes initialization parameters for all libmicrovmi drivers
1
+ //! This module describes initialization parameters for all libmicrovmi drivers
2
+ //!
3
+ //! The [`DriverInitParams`](struct.DriverInitParams.html) is used to pass additional driver initialization parameters.
4
+ //! You might want to check it's documentation for examples on how to initialize your driver.
2
5
3
6
/// Xen initialization parameters
4
7
#[ derive( Debug , Clone , PartialEq ) ]
@@ -10,6 +13,46 @@ pub enum KVMInitParams {
10
13
UnixSocket { path : String } ,
11
14
}
12
15
16
+ /// Memflow connector parameters
17
+ ///
18
+ /// This enumeration reflects the possibilities to initialize Memflow
19
+ /// - default: will simply forward the string arguments to the connector
20
+ // TODO
21
+ // - [`qemu_procfs`](https://github.com/memflow/memflow-qemu-procfs)
22
+ // - [`kvm`](https://github.com/memflow/memflow-kvm)
23
+ // - [`pcileech`](https://github.com/memflow/memflow-pcileech)
24
+ // - [`coredump`](https://github.com/memflow/memflow-coredump)
25
+ #[ derive( Debug , Clone , PartialEq ) ]
26
+ pub enum MemflowConnectorParams {
27
+ // allow to pass an abritrary list of Strings as parameters
28
+ Default { args : Vec < String > } ,
29
+ // TODO
30
+ // // optional vm_name, otherwise will search for the first QEMU process
31
+ // QEMUProcFs {
32
+ // vm_name: Option<String>,
33
+ // },
34
+ // KVM {
35
+ // pid: u32,
36
+ // },
37
+ // // default value for device: "FPGA"
38
+ // PCILeech {
39
+ // device: Option<String>,
40
+ // memmap: Option<String>,
41
+ // },
42
+ // Coredump {
43
+ // filepath: String,
44
+ // },
45
+ }
46
+
47
+ /// Memflow initialization parameters
48
+ #[ derive( Debug , Default , Clone , PartialEq ) ]
49
+ pub struct MemflowInitParams {
50
+ /// connector name
51
+ pub connector_name : String ,
52
+ /// optional connector initialization parameters
53
+ pub connector_args : Option < MemflowConnectorParams > ,
54
+ }
55
+
13
56
/// VirtualBox initialization parameters
14
57
#[ derive( Debug , Clone , PartialEq ) ]
15
58
pub enum VBoxInitParams { }
@@ -25,10 +68,45 @@ pub struct CommonInitParams {
25
68
}
26
69
27
70
/// This struct is used to specify the initialization parameters for all drivers
71
+ ///
72
+ /// # Examples
73
+ ///
74
+ /// ```no_run
75
+ /// // Xen
76
+ /// // common.vm_name: mandatory
77
+ /// use microvmi::api::params::{DriverInitParams, CommonInitParams, KVMInitParams, MemflowInitParams};
78
+ /// let init_params = DriverInitParams {
79
+ /// common: Some(CommonInitParams { vm_name: String::from("windows10")}),
80
+ /// ..Default::default()
81
+ /// };
82
+ /// // KVM
83
+ /// // common.vm_name: mandatory
84
+ /// // kvm.unix_socket: mandatory
85
+ /// let init_params = DriverInitParams {
86
+ /// common: Some(CommonInitParams { vm_name: String::from("windows10")}),
87
+ /// kvm: Some(KVMInitParams::UnixSocket { path: String::from("/tmp/introspector")}),
88
+ /// ..Default::default()
89
+ /// };
90
+ /// // VirtualBox
91
+ /// // common.vm_name: mandatory
92
+ /// let init_params = DriverInitParams {
93
+ /// common: Some(CommonInitParams { vm_name: String::from("windows10")}),
94
+ /// ..Default::default()
95
+ /// };
96
+ /// // Memflow
97
+ /// // memflow.connector_name: mandatory
98
+ /// // memflow.connector_args: optional
99
+ /// let init_params = DriverInitParams {
100
+ /// memflow: Some(MemflowInitParams { connector_name: String::from("qemu_procfs"), ///
101
+ /// ..Default::default()}),
102
+ /// ..Default::default()
103
+ /// };
104
+ /// ```
28
105
#[ derive( Default , Debug , Clone , PartialEq ) ]
29
106
pub struct DriverInitParams {
30
107
pub common : Option < CommonInitParams > ,
31
108
pub xen : Option < XenInitParams > ,
32
109
pub kvm : Option < KVMInitParams > ,
110
+ pub memflow : Option < MemflowInitParams > ,
33
111
pub virtualbox : Option < VBoxInitParams > ,
34
112
}
0 commit comments