AS-List
NAME
Net::BGP::AS-List - AS-List Handling Functionality
SYNOPSIS
use Net::BGP::AS-List;
my $aslist = IP::BGP::AS-List( :raw($raw), :asn32 );
ATTRIBUTES
asn32
If True
, parse the AS-List
using 4 byte ASNs. Otherwise, use 2 byte
ASNs.
raw
A buf8
containing the raw packed AS-Set or AS-Sequence.
METHODS
method check(-->Bool:D) { if $.raw !~~ 1..2 { die("AS type must be 1 or 2" } if $.raw.bytes ≠ 2 + self.asn-size * self.asn-count { die("Path segment wrong length"); } return True; }
method ordered(-->Bool:D) { return ($.raw[0] == 2) } method asn-size(-->Int:D) { return $!asn32 ?? 4 !! 2 } method asn-count(-->Int:D) { return $.raw[1] }
method asns(-->Array[Int:D]) {
check
Returns true if raw
processes correctly, otherwise throws an exception.
asn-size
Returns 4 if asn32
is set to True
, 2 otherwise.
asn-count
Returns the number of ASNs present in the packed raw structure.
path-length
Returns the number of ASNs present in the list, using RFC4271 semmantics. That is, the path length is 1 if this is an AS-SET (rather than an AS-SEQUENCE).
asns
Returns a list of the ASNs in this AS list. Takes an optional paraemter,
:elems
, which is the number of ASNs to return. If this is not supplied,
returns all ASNs in the list.
Str
Returns a string representation of the ASNs.
as-lists
Returns the AS-Sequence and AS-Sets in the packed binary buffer, as would be representated in an AS-Path BGP attribute.
from-str
Takes an AS Path string and converts it to an array of AS-List objects.
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 Artisitc License 2.0.