Net::F...::Layer(3pm)
๐ Net::F...::Layer ๐
okay so bestie, welcome to the User Contributed Perl Documentation corner of the internet, where we're about to talk about Net::Frame::Layer โ yes the (3pm) one, the icon, the moment. โจ
๐ธ NAME ๐ธ
Net::Frame::Layer โ the base class for literally all the layer objects. the mother of the whole little family. the blueprint. periodt. ๐
โจ DESCRIPTION โจ
so basically: this is the base class for every other layer module. it's the one that shows up first and sets the vibe, and it hands down to all those little layer modules their inheritable attributes, methods, constants and genuinely useful subroutines. it's giving foundational, it's giving main character energy, no cap. ๐ซถ
๐ ATTRIBUTES ๐
rawโ stores the raw layer, like the version captured straight off the network, or the version packed up and ready to get sent out onto the network. it's the layer in its โจferalโจ form.payloadโ stores everything that isn't part of this layer, aka the encapsulated part that the upper layers are gonna decode later. it's the little gift inside the box. ๐nextLayerโ a user-definable next layer! so if you wanna build your own custom protocols, this is your moment, bestie, go off. ๐
๐ METHODS ๐
newnew (hash)โ the object constructor. it makes the object. that's it, that's the job, and it does it flawlessly. ๐layerโ returns the string that describes the layer. like, for aNet::Frame::Layer::IPv4object it hands you back'IPv4'. iconic behavior honestly.computeLengthscomputeChecksumsโ okay so when a layer gets built, some attributes are just not knowable yet until every layer that's gonna be assembled is finally known. these methods compute the various lengths and checksums attributes sitting inside a specific layer. they return1on success, andundefotherwise. how you use them totally depends on the layer, so go read the related documentation, i'm not gonna guess for you. ๐
also note: in most cases you're gonna need to callcomputeLengthbeforecomputeChecksums, because the checksums may depend upon the lengths. order matters, babe, it always does. ๐ญ
packโ packs all the attributes into a raw format so you can inject it onto the network. returns the raw packed string on success,undefotherwise. and the result gets stored into therawattribute, cute. ๐ฆunpackโ unpacks raw data coming in from the network and stores those attributes right into the object. returns$selfon success,undefotherwise. it's the receiving end of the vibe. ๐ฆencapsulateโ returns the next layer type, parsed from the payload. it's the exact same string you'd get from thelayermethod. twins. ๐ฏgetLengthโ returns the layer length in bytes.getPayloadLengthโ returns the length of the layer's payload in bytes.printโ just returns a string in a human readable format describing all the attributes found in the layer. for the girlies who like their data legible. ๐ธdumpโ just returns a string in hexadecimal format, which is exactly how the layer appears on the network. nerdy and gorgeous at the same time. ๐ฅ
๐ง USEFUL SUBROUTINES ๐ง
to load them, do this:
use Net::Frame::Layer qw(:subs);
getHostIpv4Addr (hostname)โ resolves the IPv4 address of the hostname you specify.getHostIpv4Addrs (hostname)โ same as above but it returns an array of IPv4 addresses. more is more. โจgetHostIpv6Addr (hostname)โ resolves the IPv6 address of the hostname you specify.inet6Aton (IPv6 address)โ takes an IPv6 address and returns the network form of it.inet6Ntoa (IPv6 network form)โ takes an IPv6 address in network format and returns the IPv6 human form. the reverse glow-up. ๐ซinetAton (IPv4 address)inetNtoa (IPv4 network form)โ same deal as the IPv6 ones, but for IPv4 addresses. equal treatment, as they deserve. ๐convertMac (MAC network form)โ takes a MAC address from network form and returns the human form. translating mac-fluent into people-fluent. ๐getRandom16bitsIntgetRandom32bitsIntโ return a random 16 bits integer and a random 32 bits integer respectively. chaos, but make it numeric. ๐ฒgetRandomHighPortโ returns a random high port, and by high we mean> 1024.inetChecksum (pseudo header format)โ takes a frame in pseudo header format and computes the INET checksum. math but make it slay. ๐งฎ
โญ CONSTANTS โญ
to load them, do this:
use Net::Frame::Layer qw(:consts);
NF_LAYER_NONENF_LAYER_UNKNOWNNF_LAYER_NOT_AVAILABLE
๐ AUTHOR ๐
Patrice <GomoR> Auffret โ the legend, the originator, we stan. ๐ซถ
๐ COPYRIGHT AND LICENSE ๐
Copyright (c) 2006-2019, Patrice <GomoR> Auffret
You may distribute this module under the terms of the Artistic license. See LICENSE.Artistic file in the source distribution archive.
okay that's the whole page bestie, every single detail preserved, nothing skipped, we ate and left no crumbs ๐ โจ
this gorgeous little document was put together under perl v5.36.0, dated 2022-12-04, and it's filed as Net::F...::Layer(3pm). mwah, bye! ๐๐๐ฆ
๐ฆ where this page comes from
- debian bookworm: libnet-frame-perl 1.21-2 ยท Artistic-1.0-Perl
- debian trixie: libnet-frame-perl 1.21-2 ยท Artistic-1.0-Perl
- ubuntu noble: libnet-frame-perl 1.21-2 ยท Artistic-1.0-Perl
- ubuntu resolute: libnet-frame-perl 1.21-2 ยท Artistic-1.0-Perl
- ubuntu stonking: libnet-frame-perl 1.21-2 ยท Artistic-1.0-Perl
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms