Net::W...Layer3(3pm)

πŸ“¦
version 1.10 Β· 3 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

✨ NAME ✨

Net::Write::Layer3 β€” it's the object for a network layer (layer 3) descriptor, bestie πŸ’–

Okay so quick context before we dive in: this is <pink>Net::Write::Layer3</pink>, living in the User Contributed Perl Documentation under <lavender>Net::W...Layer3(3pm)</lavender>. She's a little niche, a little mysterious, but she does exactly one thing and she does it with main character energy πŸ‘‘


🌈 SYNOPSIS 🌈

Okay watch me do it, this is the whole vibe:

use Net::Write::Layer qw(:constants);
use Net::Write::Layer3;

my $desc = Net::Write::Layer3->new(
   dst      => '192.168.0.1',
   protocol => NW_IPPROTO_RAW,
   family   => NW_AF_INET,
);

$desc->open;
$desc->send('G'x666);
$desc->close;

Not me sending <yellow>'G'x666</yellow>... literally 666 G's. Iconic behavior, no notes πŸ’…


🌸 DESCRIPTION 🌸

So basically? This is the class for creating a layer 3 descriptor. That's it, that's the whole job. She's giving "I have one (1) purpose and I'm obsessed with it" πŸ¦‹


πŸŽ€ ATTRIBUTES πŸŽ€

  • dst β€” the target IPv4 or IPv6 address we're gonna be sending our frames to. Pick a good one bestie, this one matters πŸ’–
  • family β€” the address family. Head over to the Net::Write::Layer CONSTANTS section for the specifics, iykyk ✨
  • protocol β€” which transport layer protocol to use. Also a Net::Write::Layer CONSTANTS situation, check there πŸ’œ

πŸ‘‘ METHODS πŸ‘‘

  • new β€” the object constructor, the moment of creation, the birth of a legend. You MUST pass a valid dst attribute, like it is not optional, periodt. Here are the default values she comes with:
    • protocol: NW_IPPROTO_RAW
    • family: NW_AF_INET

Returns undef on error 😭

  • open β€” opens up the interface. Returns undef on error πŸ™ˆ
  • send (scalar) β€” sends raw data straight to the network. Just raw. Just data. Just network. πŸ”₯
  • close β€” closes the descriptor. We love a clean exit 🫢

πŸ’€ CAVEATS πŸ’€

Okay so here's the not-so-slay part, bestie, listen up because this is real:

Sending IPv6 frames does not work under BSD systems. They literally can't do IP_HDRINCL for IPv6. For now, only Linux supports this (at least, with a 2.6.x kernel) 🐧

And it does not work at all under Win32 systems. They can't send frames at layer 3 β€” or, as the original author humbly puts it, "or I don't know how to do that." Honestly? Respect the honesty πŸ™ˆ

Like, do not try to make this work on BSD or Win32 and then come crying to me. She said what she said πŸ’…

🧚 SEE ALSO 🧚

  • Net::Write::Layer β€” her older sibling, go say hi πŸ’–

⭐ AUTHOR ⭐

Patrice <GomoR> Auffret β€” an absolute legend, the architect, the moment πŸ‘‘


Copyright (c) 2006-2015, Patrice <GomoR> Auffret

You may distribute this module under the terms of the Artistic license. See the LICENSE.Artistic file in the source distribution archive πŸ“œ


And that's the whole page bestie!! This was Net::W...Layer3(3pm) from the User Contributed Perl Documentation, and it's giving perl v5.36.0, dated 2022-10-13. Slay, bye!! πŸ’…βœ¨πŸ’–

πŸ“¦ where this page comes from