Connection
NAME
Net::BGP::Connection - BGP Server Connection Class
SYNOPSIS
use Net::BGP::Connection;
my $conn = Net::BGP::Connection.new(
:socket($socket),
:listener-channel($listener),
:user-supplier($user),
);
my $id = $conn.id;
$conn.command.send($msg);
DESCRIPTION
Maintains the connection information for an active (in the TCP-sense) BGP connection.
ATTRIBUTES
socket
The socket associated with this connection.
listener-channel
A channel used to send information back up to the listener (for instance, to remove a connection from the connection hash).
user-supplier
A supplier used to send information back up to the user (for instance, upon receipt of a BGP message.
command
A channel used to send BGP commands to the connection. See classes under
the Net::BGP::Command
namespace.
id
A unique ID number associated with this connection.
buffer
A buf8
buffer representing outstanding (unparsed) bytes.
inbound
True if the connection is an inbound connection.
remote-ip
The IP of the remote end of the connection.
remote-port
The port of the remote end of the connection.
METHODS
pop-bgp-message
my $bgp-msg = $conn.pop-bgp-message;
Takes input from the connection buffer ($.buffer
) and removes (if possible)
one message from the buffer. If a complete message is present, it returns
a Net::BGP::Message
.
It modifies the buffer when it removes the message.
This method also will throw BGP message errors if encountered.
send-bgp(Net::BGP::Message:D $msg -->Nil)
$conn.send-bgp($msg)
Sends a BGP message to the remote peer.
valid-marker
say "Valid marker received" if $conn.valid-marker;
Looks at the first 16 bytes of hte buffer to determine if a valid BGP marker is present (I.E. 16 bytes consisting of value 255). Returns a boolean true or false value.
close
Closes the connection, signalling controller. Note it doesn't signal anything else.
AUTHOR
Joelle Maslak <[email protected]>
COPYRIGHT AND LICENSE
Copyright Ā© 2018-2019 Joelle Maslak
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.