pub struct BgpSessionParams {
    pub as_num: u32,
    pub hold_time: u16,
    pub peer_mode: BgpTransportMode,
    pub has_as32bit: bool,
    pub router_id: Ipv4Addr,
    pub caps: Vec<BgpCapability>,
    pub fuzzy_pathid: bool,
}
Expand description

BGP session parameters - AS, hold time, capabilities etc.

Fields§

§as_num: u32

Autonomous system number.

§hold_time: u16

Hold time in seconds.

§peer_mode: BgpTransportMode

IP transport mode.

§has_as32bit: bool

Flag that session has 32-bit AS numbers capability.

§router_id: Ipv4Addr

Router ID.

§caps: Vec<BgpCapability>

Capability set for this session.

§fuzzy_pathid: bool

Try to detect pathid

Implementations§

source§

impl BgpSessionParams

source

pub fn new( asnum: u32, holdtime: u16, peermode: BgpTransportMode, routerid: Ipv4Addr, cps: Vec<BgpCapability> ) -> BgpSessionParams

source

pub fn open_message(&self) -> BgpOpenMessage

Constructs BGP OPEN message from params.

source

pub fn check_caps(&mut self)

Check capability set and validates has_as32bit flag.

source

pub fn match_caps(&mut self, rcaps: &[BgpCapability])

Match capability set

source

pub fn find_addpath(&self, afi: u16, safi: u8) -> Option<&BgpCapAddPath>

Search for specified addpath capability.

source

pub fn check_addpath_send(&self, afi: u16, safi: u8) -> bool

Search for specified addpath send capability.

source

pub fn check_addpath_receive(&self, afi: u16, safi: u8) -> bool

Search for specified addpath receive capability.

source

pub fn check_capability(&self, cp: &BgpCapability) -> bool

Check for capability

source

pub fn remove_capability(&mut self, cp: &BgpCapability)

Remove capability

source

pub fn remove_capability_addpath(&mut self)

source

pub fn decode_message_head( &self, buf: &[u8] ) -> Result<(BgpMessageType, usize), BgpError>

Decode message head from buffer. Returns following message kind and length.

source

pub fn recv_message_head( &mut self, rdsrc: &mut impl Read ) -> Result<(BgpMessageType, usize), BgpError>

Receive message head from buffer. Returns following message kind and length.

source

pub fn prepare_message_buf( &self, buf: &mut [u8], messagetype: BgpMessageType, messagelen: usize ) -> Result<usize, BgpError>

Stores BGP message head (19 bytes) into the buffer.

source

pub fn send_message_buf( &mut self, wrdst: &mut impl Write, buf: &mut [u8], messagetype: BgpMessageType, messagelen: usize ) -> Result<(), BgpError>

Writes buffer with BGP message into the target.

Trait Implementations§

source§

impl Clone for BgpSessionParams

source§

fn clone(&self) -> BgpSessionParams

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for BgpSessionParams

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<&BgpOpenMessage> for BgpSessionParams

source§

fn from(bom: &BgpOpenMessage) -> BgpSessionParams

Converts to this type from the input type.
source§

impl From<&BmpMessagePeerHeader> for BgpSessionParams

source§

fn from(bmph: &BmpMessagePeerHeader) -> BgpSessionParams

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.