Cargo.toml
[dependencies]
krusty_drone = { git = "https://github.com/Danylo37/krusty_drone.git"}The KrustyCrapDrone is a Rust-based drone implementation designed to manage communication and routing tasks in a simulated network. This implementation integrates with the wg_2024 library, utilizing various components like packet handling, flood routing, and drone command execution.
- Packet Handling: Processes multiple packet types, including acknowledgments, fragments, and flood requests.
- Flood Routing: Implements flood routing with response handling and neighbor communication.
- Command Processing: Handles drone commands like adding/removing senders, setting packet drop rates, and crashing.
- Error Handling: Sends acknowledgments (NACKs) for various routing errors.
- Simulation Integration: Communicates with a simulation controller via events like
PacketSentandPacketDropped.
The drone relies on the following external crates and modules:
crossbeam_channel: For asynchronous communication between components.rand: For generating random values, used in simulating packet drop rates.wg_2024library: Provides essential components such asPacket,DroneCommand,DroneEvent, and routing utilities.
id: Unique identifier for the drone.controller_send: Channel to send events to the simulation controller.controller_recv: Channel to receive commands from the controller.packet_recv: Channel to receive incoming packets.packet_send: Map of neighboring nodes and their respective senders.pdr: Packet Drop Rate, used for simulating packet losses.floods: Tracks flood IDs.crashing_behavior: Flag to simulate a crashing drone.
fn new(
id: NodeId,
controller_send: Sender<DroneEvent>,
controller_recv: Receiver<DroneCommand>,
packet_recv: Receiver<Packet>,
packet_send: HashMap<NodeId, Sender<Packet>>,
pdr: f32,
) -> SelfInitializes a new drone instance with the given parameters.
fn run(&mut self)Listens for incoming packets and controller commands, handling them accordingly.
handle_packet: Handles various packet types (e.g., NACK, ACK, fragments, flood requests/responses).
It's the part that handles the commands from the simulation controller.
handle_command: Processes commands like adding/removing senders, adjusting PDR, and simulating crashes.
-
handle_flood_request: Manages incoming flood requests, forwarding them to neighbors or generating responses. -
handle_flood_response: Forwards flood responses to the next hop.
send_event: Sends simulation events (e.g.PacketSent,PackedDropped) to the simulation controllerrequest_to_do_a_backflip: icing on the cake that makes our drone unique.
Telegram support:
- Mr. Krab: @lilloLeo
- Krusty Crap HeadChef: @NooXiii
- Krusty Technicians: @olzhkkk @chenlei2003
PS: Hopefully we will put our mails