Net::F...r::SLL(3pm)

πŸ“¦
version 1.21 Β· 2 versions
  • 1.21 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 1.21 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

Net::Frame::Layer::SLL β€” bestie, it's the Linux cooked capture layer object πŸ“ no cap, that's literally what it is


✨ SYNOPSIS ✨

okay so first you gotta pull it in, and grab those consts while you're at it:

use Net::Frame::Layer::SLL qw(:consts);

Building a layer from scratch β€” main character energy, you're constructing it:

# Build a layer
my $layer = Net::Frame::Layer::SLL->new(
   packetType    => NF_SLL_PACKET_TYPE_SENT_BY_US,
   addressType   => NF_SLL_ADDRESS_TYPE_512,
   addressLength => 0,
   source        => 0,
   protocol      => NF_SLL_PROTOCOL_IPv4,
);
$layer->pack;

print 'RAW: '.$layer->dump."\n";

Reading a raw layer β€” the way you just feed it the raw bytes and it gets it:

# Read a raw layer
my $layer = Net::Frame::Layer::SLL->new(raw => $raw);

print $layer->print."\n";
print 'PAYLOAD: '.unpack('H*', $layer->payload)."\n"
   if $layer->payload;

🌸 DESCRIPTION 🌸

So this module is the one that does the encoding and decoding of the Linux cooked capture layer. That's its whole job, and it does it flawlessly πŸ’…

Also, if you wanna know about the other attributes and methods floating around, go peek at Net::Frame::Layer. It's giving extended family.


πŸŽ€ ATTRIBUTES πŸŽ€

  • packetType β€” stores the packet type bestie (like unicast to us, sent by us, etc. β€” you get the vibe)
  • addressType β€” the address type, exactly that
  • addressLength β€” how long that address you just specified actually is
  • source β€” the source address πŸ’Œ
  • protocol β€” the encapsulated protocol

and then these cuties are inherited attributes, so for the full tea go read Net::Frame::Layer:

  • raw
  • payload
  • nextLayer

πŸ”₯ METHODS πŸ”₯

new

new (hash)

Object constructor, periodt. You can pass in attributes and they'll overwrite the defaults. Wanna know what the defaults are? Go look at SYNOPSIS, it's all right there for you 🫢

And these are the inherited methods β€” some might get overridden in this layer, and ngl some of them may not even mean anything in this layer. Either way, Net::Frame::Layer has the details:

  • layer
  • computeLengths
  • computeChecksums
  • pack
  • unpack
  • encapsulate
  • getLength
  • getPayloadLength
  • print
  • dump

πŸ‘‘ CONSTANTS πŸ‘‘

Load them up like this, babe:

use Net::Frame::Layer::SLL qw(:consts);

Packet types β€” the various possible ones:

  • NF_SLL_PACKET_TYPE_SENT_BY_US
  • NF_SLL_PACKET_TYPE_UNICAST_TO_US

Encapsulated layer types β€” every single one that's supported, we're not skipping anybody:

  • NF_SLL_PROTOCOL_IPv4
  • NF_SLL_PROTOCOL_X25
  • NF_SLL_PROTOCOL_ARP
  • NF_SLL_PROTOCOL_CGMP
  • NF_SLL_PROTOCOL_80211
  • NF_SLL_PROTOCOL_PPPIPCP
  • NF_SLL_PROTOCOL_RARP
  • NF_SLL_PROTOCOL_DDP
  • NF_SLL_PROTOCOL_AARP
  • NF_SLL_PROTOCOL_PPPCCP
  • NF_SLL_PROTOCOL_WCP
  • NF_SLL_PROTOCOL_8021Q
  • NF_SLL_PROTOCOL_IPX
  • NF_SLL_PROTOCOL_STP
  • NF_SLL_PROTOCOL_IPv6
  • NF_SLL_PROTOCOL_WLCCP
  • NF_SLL_PROTOCOL_MPLS
  • NF_SLL_PROTOCOL_PPPoED
  • NF_SLL_PROTOCOL_PPPoES
  • NF_SLL_PROTOCOL_8021X
  • NF_SLL_PROTOCOL_AoE
  • NF_SLL_PROTOCOL_80211I
  • NF_SLL_PROTOCOL_LLDP
  • NF_SLL_PROTOCOL_LLTD
  • NF_SLL_PROTOCOL_LOOP
  • NF_SLL_PROTOCOL_VLAN
  • NF_SLL_PROTOCOL_PPPPAP
  • NF_SLL_PROTOCOL_PPPCHAP

And one more lil guy, all by itself:

  • NF_SLL_ADDRESS_TYPE_512

🌈 SEE ALSO 🌈

  • Net::Frame::Layer

πŸ’œ AUTHOR πŸ’œ

Patrice <GomoR> Auffret β€” we stan 🫢


Copyright (c) 2006-2019, 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. (yes that's the actual license name, go read it, it's short, iykyk)


okay bestie that's the whole page πŸ’– this one's running on perl v5.36.0, dated 2022-12-04, and it's Net::F...r::SLL(3pm) from the User Contributed Perl Documentation collection. go forth and capture those packets, you absolute icon βœ¨πŸ’…πŸŽ€