pub struct VConn { /* private fields */ }Expand description
An OpenFlow virtual connection.
Implementations§
Source§impl VConn
impl VConn
Sourcepub async fn send_message(&mut self, msg: &Message) -> Result<()>
pub async fn send_message(&mut self, msg: &Message) -> Result<()>
Send a message.
Sourcepub async fn recv_message(&mut self) -> Result<Message>
pub async fn recv_message(&mut self) -> Result<Message>
Receive a message.
Sourcepub async fn send_flow(&mut self, flow: &Flow) -> Result<()>
pub async fn send_flow(&mut self, flow: &Flow) -> Result<()>
Send a flow modification to the switch.
This sends the FlowMod message asynchronously without waiting for
confirmation. Use send_flow_sync if you need to ensure the flow
was successfully installed.
Sourcepub async fn send_flow_sync(&mut self, flow: &Flow) -> Result<()>
pub async fn send_flow_sync(&mut self, flow: &Flow) -> Result<()>
Send a flow modification and wait for confirmation.
Sends the FlowMod followed by a barrier request, then waits for the barrier reply. If an error occurs (e.g., invalid flow), it will be returned.
This ensures the flow is installed (or rejected) before returning.
Sourcepub async fn dump_flows(&mut self) -> Result<Vec<FlowStatsEntry>>
pub async fn dump_flows(&mut self) -> Result<Vec<FlowStatsEntry>>
Dump all flows from the switch.
Returns all flow entries from all tables. Use dump_flows_filtered
for more specific queries.
Sourcepub async fn dump_flows_filtered(
&mut self,
request: FlowStatsRequest,
) -> Result<Vec<FlowStatsEntry>>
pub async fn dump_flows_filtered( &mut self, request: FlowStatsRequest, ) -> Result<Vec<FlowStatsEntry>>
Dump flows matching the given filter.
The request can filter by table ID, match fields, cookie, etc.
Sourcepub async fn recv_packet_in(&mut self) -> Result<PacketIn>
pub async fn recv_packet_in(&mut self) -> Result<PacketIn>
Wait for and receive a Packet-In message.
This blocks until a Packet-In message is received, handling echo requests and skipping other message types.
Sourcepub async fn try_recv_packet_in(&mut self) -> Result<Option<PacketIn>>
pub async fn try_recv_packet_in(&mut self) -> Result<Option<PacketIn>>
Try to receive a Packet-In message without blocking.
Returns Ok(Some(packet_in)) if a Packet-In is available,
Ok(None) if a different message was received (and handled),
or an error if something went wrong.
Note: This still blocks on the read itself; it just doesn’t loop waiting specifically for a Packet-In.
Sourcepub async fn monitor_flows(
&mut self,
request: FlowMonitorRequest,
) -> Result<Vec<FlowUpdate>>
pub async fn monitor_flows( &mut self, request: FlowMonitorRequest, ) -> Result<Vec<FlowUpdate>>
Register a flow monitor and receive the initial snapshot.
Sends the monitor request and collects the initial flow updates
(if NXFMF_INITIAL flag was set in the request). After this returns,
use recv_flow_updates() to receive ongoing updates.
Use a dedicated VConn for monitoring — the monitor produces a continuous stream that occupies the connection’s recv path.
Sourcepub async fn recv_flow_updates(&mut self) -> Result<Vec<FlowUpdate>>
pub async fn recv_flow_updates(&mut self) -> Result<Vec<FlowUpdate>>
Receive the next batch of flow monitor updates.
Blocks until flow update messages are received from OVS. Handles echo requests internally. Returns the parsed updates.
Call this in a loop after monitor_flows() to receive ongoing
flow change notifications.
Sourcepub async fn send_packet_out(&mut self, packet_out: &PacketOut) -> Result<()>
pub async fn send_packet_out(&mut self, packet_out: &PacketOut) -> Result<()>
Send a Packet-Out message.
This injects a packet into the switch’s datapath or releases a buffered packet with the specified actions.