Conversions
NAME
Net::BGP::Conversions - Convert between bytes and integer formats
SYNOPSIS
ues Net::BGP::Conversions;
my $val1 = nuint16(10, 20);
my $val2 = nuint32(10, 20, 30, 40);
my $buf1 = nuint16-buf8(1000);
my $buf2 = nuint32-buf8(1_000_000);
ROUTINES
nuint16
my $val1 = nuint16(10, 20);
my $val2 = nuint16(@array); # Must be a 2 element array
my $val2 = nuint16($buf); # Must be a buf8 that is 2 bytes long
Converts the byte values in the parameter to a 16 bit UInt, assuming network ordering (first byte is MSB).
nuint32
my $val1 = nuint32(10, 20, 30, 40);
my $val2 = nuint32(@array); # Must be a 4 element array
my $val2 = nuint32($buf); # Must be a buf8 that is 4 bytes long
Converts the byte values in the parameter to a 32 bit UInt, assuming network ordering (first byte is MSB).
nuint16-buf8
my $buf1 = nuint16-buf8(1000);
Returns a buf8
object containing two bytes representing the network byte
order value of the integer parameter.
nuint32-buf8
my $buf2 = nuint32-buf8(1_000_000);
Returns a buf8
object containing four bytes representing the network byte
order value of the integer parameter.
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.