Net::BGP::Process - Class encapsulating BGP session multiplexing functionality use Net::BGP::Process; $bgp = Net::BGP::Process->new( Port => $port ); $bgp->add_peer($peer); $bgp->remove_peer($peer); $bgp->event_loop(); This module encapsulates the functionality necessary to multiplex multiple BGP peering sessions. While individual Net::BGP::Peer objects contain the state of each peering session, it is the Net::BGP::Process object which monitors each peer's transport-layer connection and timers and signals the peer whenever messages are available for processing or timers expire. A Net::BGP::Process object must be instantiated, even if a program only intends to establish a session with a single peer. new() - create a new Net::BGP::Process object $bgp = Net::BGP::Process->new( Port => $port, ListenAddr => '1.2.3.4' ); This is the constructor for Net::BGP::Process objects. It returns a reference to the newly created object. The following named parameters may be passed to the constructor.

Port
This parameter sets the TCP port the BGP process listens on. It may be omitted, in which case it defaults to the well-known BGP port TCP/179. If the program cannot run with root priviliges, it is necessary to set this parameter to a value greater than or equal to 1024. Note that some BGP implementations may not allow the specification of an alternate port and may be unable to establish a connection to the Net::BGP::Process.

ListenAddr
This parameter sets the IP address the BGP process listens on. Defaults to INADDR_ANY. add_peer() - add a new peer to the BGP process $bgp->add_peer($peer); Each Net::BGP::Peer object, which corresponds to a distinct peering session, must be registered with the Net::BGP::Process object via this method. It is typically called immediately after a new peer object is created to add the peer to the BGP process. The method accepts a single parameter, which is a reference to a Net::BGP::Peer object. remove_peer() - remove a peer from the BGP process $bgp->remove_peer($peer); This method should be called if a peer should no longer be managed by the BGP process, for example, if the session is broken or closed and will not be re-established. The method accepts a single parameter, which is a reference to a Net::BGP::Peer object which has previously been registered with the process object with the add_peer() method. event_loop() - start the process event loop $bgp->event_loop(); This method must called after all peers are instantiated and added to the BGP process and any other necessary initialization has occured. Once it is called, it takes over program control flow, and control will only return to user code when one of the event callback functions is invoked upon receipt of a BGP protocol message or a user established timer expires (see Net::BGP::Peer for details on how to establish timers and callback functions). The method takes no parameters. It will only return when there are no Net::BGP::Peer objects remaining under its management, which can only occur if they are explicitly removed with the remove_peer() method (perhaps called in one of the callback or timer functions). Net::BGP, Net::BGP::Peer, Net::BGP::Update, Net::BGP::Notification Stephen J. Scheck <code@neurosphere.com>