Probe
Probes are located in /src/probes/name{,.rs}
.
An example probe could look like this:
What | Description |
---|---|
struct DummyProbe | ... represents the struct of a probe and is initationed once at runtime. It thereby can hold state (e.g. packet counters). |
fn handle_packet(...) | ... get called one for every packet the kernel passed to IXpect. Keep in mind only packets matching the BPF expression will be passed to IXpect. |
source_addr: &MacAddr | ... represents the mac addrede from which the packet was revieced. |
packet: &EthernetPacket | ... contains the byte representation of the ethernet packet. Source-, destination MAC-address and ethernet type are already parsed into Rust types. See upstream documentation. Based on the ethernet type upper-layer packets can be parsed. See upstream documentation for a list on pre existing structs. |
events: &mut Vec<EventType> | ... is used to trigger events. A new EventType should likely be created. Just push and instance of an EventType into the vector. |