Crate birdc

Source
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
InterfaceAddress
IP addresses assigned to an Interface
InterfaceProperties
Properties of an interface (flags, MTU) as seen by Bird
InterfaceSummary
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
ProtocolDetail
Detailed information for a Protocol
RouteChangeStats
Statistics related to number of route change events in import/export inside a Channel
RouteStats
Routing statistics for a Channel
ShowInterfacesMessage
A composite entry in the show interfaces command
ShowProtocolDetailsMessage
A composite entry in the show protocols all command. Represents the details of a protocol instance.
ShowStatusMessage

Enums§

BgpNeighbor
BGP neighbor address information
Error
InterfaceType
Type of interface
Message
A single reply unit, as mentioned in Bird’s Documentation
ProtoSpecificInfo
Contains routing protocol specific details, e.g. BGP etc.

Type Aliases§

Result