Repository navigation
Expand file tree
/
Copy pathCargo.toml
More file actions
159 lines (126 loc) · 4.03 KB
/
Copy pathCargo.toml
File metadata and controls
159 lines (126 loc) · 4.03 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
[package]
name = "wirebit"
version = "0.0.1"
edition = "2024"
description = "Rust library simulating hardware communication interfaces (serial, CAN, ethernet) over shared memory, with bridges to real Linux interfaces"
license = "MIT"
readme = "README.md"
publish = false
include = [
"Cargo.toml",
"pyproject.toml",
"README.md",
"include/**/*.h",
"src/**/*.rs",
"examples/**/*.rs",
"tests/**/*.rs",
]
[lib]
path = "src/lib.rs"
crate-type = ["rlib", "cdylib"]
[features]
# Default turns on every Linux bridge + cross-process SHM. Use
# `--no-default-features` for a portable simulation-only build.
default = ["hardware"]
# Meta-feature: turns on every optional OS-primitive bridge + provisioning.
# Prefer the per-primitive features below when you know which ones you need.
hardware = ["shm-xproc", "pty", "tty", "socketcan", "tap", "tun", "provisioning"]
# Self-provisioning: create / tear down vcan / tap / tun interfaces
# from code via `sudo -n ip ...`. Requires a one-time sudoers rule
# (see `wirebit::provisioning::sudoers_snippet`) or the helper
# `scripts/setup-hardware.sh`. Does NOT require root for the calling
# process — sudo runs only the specific `ip` / `modprobe` commands.
provisioning = []
# Cross-process SHM rings (shm_open + mmap) and the eventfd handshake.
# Works on Linux and BSDs with tmpfs; the in-process simulation is
# always available without this feature.
shm-xproc = ["dep:nix"]
# Pseudo-terminal bridge (`/dev/pts/N`). No root required.
pty = ["dep:nix"]
# Real TTY bridge (`/dev/ttyUSB0`, `/dev/ttyACM0`, ...).
tty = ["dep:nix"]
# Linux SocketCAN bridge (`vcan0`, `can0`, ...). Needs `CAP_NET_ADMIN`
# to create interfaces but not to open existing ones.
socketcan = []
# Linux TAP (L2 ethernet) bridge. Needs `CAP_NET_ADMIN` to create;
# pre-created `tap0 user $USER` works without root.
tap = ["dep:nix"]
# Linux TUN (L3 IP) bridge. Same privilege story as TAP.
tun = ["dep:nix"]
# Tracing spans / events at every send / recv / link operation.
tracing = ["dep:tracing"]
# TOML / JSON config parsing for scenarios and topology (planned).
config = ["dep:serde", "dep:serde_json", "dep:toml"]
# Python bindings via pyo3 (abi3).
python = ["dep:pyo3"]
# Build a Python extension module (wheel). Enabled by maturin via
# pyproject.toml; do not set by hand for ordinary `cargo build`.
python-extension = ["python"]
[dependencies]
thiserror = "2.0"
libc = "0.2"
rand = "0.8"
bytes = "1"
bon = "3"
nix = { version = "0.29", optional = true, features = ["fs", "ioctl", "socket", "poll", "term", "event", "uio", "mman"] }
tracing = { version = "0.1", optional = true }
serde = { version = "1.0", features = ["derive"], optional = true }
serde_json = { version = "1.0", optional = true }
toml = { version = "0.8", optional = true }
pyo3 = { version = "0.23", optional = true, features = [
"abi3-py39",
"extension-module",
] }
[dev-dependencies]
tempfile = "3.10"
[[example]]
name = "bench_pty"
path = "examples/rust/bench_pty.rs"
[[example]]
name = "bench_shm"
path = "examples/rust/bench_shm.rs"
[[example]]
name = "can_bus_hub"
path = "examples/rust/can_bus_hub.rs"
[[example]]
name = "can_demo"
path = "examples/rust/can_demo.rs"
[[example]]
name = "can_node"
path = "examples/rust/can_node.rs"
[[example]]
name = "ethernet_demo"
path = "examples/rust/ethernet_demo.rs"
[[example]]
name = "frame_demo"
path = "examples/rust/frame_demo.rs"
[[example]]
name = "link_model_matrix"
path = "examples/rust/link_model_matrix.rs"
[[example]]
name = "link_simulation"
path = "examples/rust/link_simulation.rs"
[[example]]
name = "main"
path = "examples/rust/main.rs"
[[example]]
name = "pty_demo"
path = "examples/rust/pty_demo.rs"
[[example]]
name = "serial_demo"
path = "examples/rust/serial_demo.rs"
[[example]]
name = "shm_xproc"
path = "examples/rust/shm_xproc.rs"
[[example]]
name = "socketcan_demo"
path = "examples/rust/socketcan_demo.rs"
[[example]]
name = "tap_demo"
path = "examples/rust/tap_demo.rs"
[[example]]
name = "tty_demo"
path = "examples/rust/tty_demo.rs"
[[example]]
name = "tun_demo"
path = "examples/rust/tun_demo.rs"