The RustBustersDrone is a software-defined drone designed to work in a distributed network simulation.
It was developed for the Advanced Programming course 2024 at the University of Trento.
It provides robust capabilities for packet handling, flood management and control commands.
These features are the one standardized for every single drone implementation.
- Packet Forwarding: Routes packets through a defined path, with validation of recipient and hop indices.
- Nack Management: Sends negative acknowledgments (Nack) based on routing outcomes or errors.
- Packet Drop Simulation: Implements a configurable Packet Drop Rate (PDR) to simulate real-world communication failures.
- Flood Request Handling: Processes and forwards
FloodRequestpackets to neighboring drones while preventing redundant processing of the same request. - Flood Response: Sends responses back to the initiator of the flood request with the path trace.
- Crash: Stops the drone's operations.
- Add Sender: Dynamically adds communication channels for new neighbors.
- Set Packet Drop Rate: Configures the PDR dynamically to test network resilience.
The drone optimizes routes by removing unnecessary hops for Nacks and FloodResponses.
- Route:
[1, 2, 3, 4, 5, 6] - Current drone:
2 - Received a
Nack/FloodResponsefrom drone1. - Neighbors of
2:1,3, and5.
- Start checking the route from the end.
- If a neighbor is found between the current drone (
2) and the analyzed node (6,5,...), skip intermediate nodes and connect directly to the neighbor. - If no neighbors are found, keep the original route.
This ensures efficient path analysis and reduced hops where possible.
So in our example (we're on drone 2):
- Analyze
6, not neighbor. - Analyze
5, neighbor and thus skip the edges2-3,3-4,4-5 - Attach
2to[5,6] - The whole route becomes
[1,2,5,6]
Code example for setting the optimized routing:
let mut drone = RustBustersDrone::new(...);
drone.set_optimized_routing(true); // enables optimized routing
drone.set_optimized_routing(false); // disables optimized routingThe hunt command allows a RustBustersDrone or hunter drone to eliminate a ghost drone
from the network via a request to the Simulation Controller.
This is how it works:
- The
RustBustersDronereceives aNack::Droppedpacket from another drone. - The
RustBustersDronesends a huntPacketto the simulation controller to eliminate the drone it received theNackfrom. - The Simulation Controller receives the packet, processes it and makes the following controls:
- If the network isn't partitioned after the drone removal and if the target is not a Rustbusters drone, then a
Crashcommand is sent to the drone. - Otherwise, the operation is aborted.
- If the network isn't partitioned after the drone removal and if the target is not a Rustbusters drone, then a
Code example for setting the hunt mode:
let mut drone = RustBustersDrone::new(...);
drone.set_hunt_mode(true); // enables hunt mode
drone.set_hunt_mode(false); // disables hunt modeThis feature of the drone uses the same Packet structure as the one specified in the protocol standard.
The only thing that changes is the encoding. The hunt Packet looks like this:
pub const PACKET_CONST: u8 = 169;
Packet {
pack_type: PacketType::MsgFragment(
Fragment {
fragment_index: 0,
total_n_fragments: 0,
length: PACKET_CONST,
data: [src_node_id, target_node_id, ...] // set data with the specified source and target drone ids
}
),
routing_header: SourceRoutingHeader { hop_index: 0, hops: vec![] },
session_id: 0,
}It is then put inside a PacketSent DroneEvent:
let hunt_node_event = DroneEvent::PacketSent(hunt_packet);And sent to the Simulation Controller:
self.controller_send.send(hunt_node_event)The following instructions are for the member that implements the Simulation Controller.
The Simulation Controller is asked to:
- Implement a handler for the hunt packet.
- Verify the network integrity on ghost drone removal.
- Send a
Crashcommand to the ghost drone.
A code example can look like this:
use drone::hunt::PACKET_CONST;
fn handle_drone_commands(packet: Packet) {
match &packet.pack_type {
PacketType::MsgFragment(fragment) => {
// Hunt Packet
if fragment.fragment_index == 0 && fragment.total_n_fragments == 0 && fragment.length == PACKET_CONST {
let target_node_id = fragment.data[1];
handle_hunt(simulation_controller, target_node_id);
}
}
_ => {}
}
}
fn handle_hunt(simulation_controller: &mut RustBustersSimulationController, target_drone_id: NodeId) -> Result<(), String> {
// Try to remove node
simulation_controller.graph.remove_node(target_drone_id);
// Verify graph integrity
if is_network_connected(simulation_controller) {
// Send crash command to the target_drone_id
println!("Network integrity is guaranteed. Proceeding with crash command.");
if let Ok(()) = simulation_controller.send_crash_command(target_drone_id) {
Ok(())
} else {
Err("Cannot send crash command to drone".to_string())
}
} else {
// Abort operation, reestablish previous topology by readding the removed drone and send error
// RESET the graph to the original state
Err("Cannot guarantee network integrity. Aborting hunt.".to_string())
}
}
fn is_network_connected(simulation_controller: &RustBustersSimulationController) -> bool {
// Verify graph integrity
unimplemented!() // Implement your own network integrity check
}Our magnificent drone allows to reproduce sounds based on the packets received by the drone:
- Start: When the drone
starts it reproduces the “YAHOO” Mario sound 🍄.

- Nack: Whenever the Rusbusters drone produces a
Nackthat is not aDroppedit plays the "Windows Error" sound 🪟.

- Hunt Mode: On
Nackreceipt the drone activates the ghost hunter mode and reproduces the “PIUPIUPIU” sound 🔫 (like Colt from Brawl Stars).

- Crash: Whenever the Rusbusters drone receives a
Crashcommand from the mighty Simulation Controller the drone plays the "Windows Shut Down" sound 🪟.

- Dropped: On packet
NackDroppedthe drone plays the original Marco Patrignani “QUACK” sound 🦆 and proceeds with the drop of the packet.

Code example for activating sounds:
In Cargo.toml:
[dependencies]
rustbusters-drone = { git = "...", features = ["sounds"] }In your code:
let mut drone = RustBustersDrone::new(...);
drone.enable_sound(); // enables soundsThe Rustbusters team provides a full customer support via a Telegram Bot. It's super easy to use and is accessible on the following username or from the QR code below:
@rustbusters_botQR code:
Don't hesitate if you have issues, our group is here to help.
Our drone also provides a whole bunch of strong unit and integration tests that cover almost 80% of the code.
However, if we consider only the features relevant to packet handling, flood management and control commands the coverage goes up to 90%.
Our drone provides comprehensive logging with levels: debug, info, warn, error, and trace for detailed runtime
monitoring and troubleshooting.
- Optimized Routing: Toggle for enabling route optimization.
- Hunt Mode: Toggle for enabling hunt mode.
- Sounds: Toggle for enabling sounds.
This drone is part of the RustBusters project and integrates seamlessly into the wg_2024 simulation framework for
distributed network experiments.



