Expand description
Library for async communication with the Bird BGP server.
§Examples
use birdc::*;
// create the client
let client = Client::for_unix_socket("/run/bird/bird.ctl");
// we can either use raw protocol
async fn show_interfaces_raw(client: &Client) -> Result<()> {
let mut connection = client.connect().await?;
// we can either use raw protocol
let messages = connection.send_request("show interfaces").await?;
for message in &messages {
println!("received message: {:?}", message);
}
Ok(())
}
// or we can use structured exchange
async fn show_interfaces(client: &Client) -> Result<()> {
let mut connection = client.connect().await?;
// let's make a semantic call now
match connection.show_interfaces().await {
Ok(entries) => {
for e in &entries {
println!("received entry: {:?}", e);
}
}
Err(Error::ParseError(messages)) => {
// we can still go through the raw response
// even though semantic parsing failed
for msg in &messages {
println!("raw message: {:?}", msg);
}
}
Err(e) => {
return Err(e);
}
}
Ok(())
}
§Compatibility
This library has been tested only against Bird2
Structs§
- BgpInfo
- Details of BGP protocol related information for a ProtocolDetail.
- BgpSession
- BGP session related information, which show up only if the session is up
- Channel
- Protocol channel details
- Client
- A bird client instance. You need to create a Connection from this client, using Client::connect, to make requests.
- Connection
- An active connection, on which requests can be executed, and responses received.
- Interface
- A network interface, as seen by Bird
- Interface
Address - IP addresses assigned to an Interface
- Interface
Properties - Properties of an interface (flags, MTU) as seen by Bird
- Interface
Summary - Protocol
- Represents one of the BIRD protocol instances. Note that this isn’t the same as, say BGP, or OSPF. That is represented by the field Protocol::proto
- Protocol
Detail - Detailed information for a Protocol
- Route
Change Stats - Statistics related to number of route change events in import/export inside a Channel
- Route
Stats - Routing statistics for a Channel
- Show
Interfaces Message - A composite entry in the
show interfaces
command - Show
Protocol Details Message - A composite entry in the
show protocols all
command. Represents the details of a protocol instance. - Show
Status Message
Enums§
- BgpNeighbor
- BGP neighbor address information
- Error
- Interface
Type - Type of interface
- Message
- A single reply unit, as mentioned in Bird’s Documentation
- Proto
Specific Info - Contains routing protocol specific details, e.g. BGP etc.