NetPacket(3)
π NetPacket π
okay so bestie, we're looking at NetPacket(3) β it lives in the User Contributed Perl Documentation section of the manual, and it is literally the mothership of a whole little family of packet modules. sit down, grab a boba, let's get into it π§β¨
β¨ VERSION β¨
version 1.8.0 β she's a 1.8.0 girly, periodt. π
πΈ SYNOPSIS πΈ
# NetPacket is a base class only
and that's it. that's the whole synopsis. she contains multitudes but she is, herself, a base class only. main character energy with zero lines π
π¦ DESCRIPTION π¦
NetPacket is the base class for a whole cluster of modules that do the decoding and encoding of network protocols. every single descendant module of NetPacket knows exactly how to encode and decode packets for whatever network protocol it implements. wanna know the deets for a specific protocol? go read that module's own docs, bestie β it's all protocol-specific up in there. π
okay and here's the tea, and it's important: there is NO inheritance in the NetPacket:: cluster beyond the fact that each protocol module is a NetPacket. why, you ask? because forcing inheritance relationships (like, say, between the IP, UDP and TCP protocols) was seen to be too restrictive β it would make tunneling and other unusual situations genuinely difficult. so they said "not today, Satan" and kept it flat. no cap. π«π³
π WRITING YOUR OWN NetPacket:: MODULE π
okay so this is the part where they invite you to the group project!! you are encouraged to write your own additional NetPacket:: modules and to improve the existing ones. got suggestions? got changes? contact the maintainer of the module in question, they wanna hear from you. π«Ά
the following sections are a list of suggestions and conventions for writing a NetPacket:: module. not rules, vibes.
π Naming Conventions π
when you're creating a module in the NetPacket:: namespace, it is suggested that you stick to a couple of conventions when naming packet contents. the goal here is a consistent namespace that makes NetPacket:: easier to use. (manifesting a clean namespace β¨)
content names are all lowercase, with underscores separating multiple words. and here are the recommended abbreviations:
- Word β Abbreviation
sourceβsrcdestinationβdestchecksumβcksumidentifierβidversionβverprotocolβproto
π₯ Required Methods π₯
encode(), decode(), strip()
that's the holy trinity right there. all three. no skipping π
π Required Fields π
every NetPacket:: object should have the following fields. like, every single one. it's giving non-negotiable.
_parentβ a link to the parentNetPacket::object in which thisNetPacket::object is encapsulated. this field is undefined if there is no parent object. (orphan energy, but make it a feature π)_frameβ a copy of the raw data of the packet. the raw. the unfiltered. the unedited footage πΈdataβ this field should contain the data encapsulated in the packet (i.e. any headers or trailers stripped off), orundefif the packet contains no data. and okay, note this: in this sense,datameans information not relevant to the particular protocol being decoded. for example? an ARP packet contains many header fields but no data. a UDP datagram, however, contains header fields and a payload. iykyk. π
π SEE ALSO π
Joel Knight has a patch for NetPacket for IPv6 support, available at http://www.packetmischief.ca/code/netpacket/. go get your IPv6 fix bestie π
π COPYRIGHT AND LICENSE π
Copyright (c) 2001 Tim Potter and Stephanie Wehner.
Copyright (c) 1995,1996,1997,1998,1999 ANU and CSIRO on behalf of the participants in the CRC for Advanced Computational Systems ('ACSys').
this module is free software. you can redistribute it and/or modify it under the terms of the Artistic License 2.0. π¨
this program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.
okay so real talk, that last bit matters: no warranty, no implied merchantability, no fitness for a particular purpose. she is free and she is as-is. π«
π AUTHORS π
- Tim Potter
<tpot@samba.org> - Stephanie Wehner
<atrak@itsx.com> - Yanick Champoux
<yanick@cpan.org>
and that's the whole page, bestie!! π this one was rendered by perl v5.42.0, dated 2026-02-05, and it lives in the NetPacket(3) slot of the manual. slay, go decode some packets responsibly πβ¨π¦
π¦ where this page comes from
- fedora 43: perl-NetPacket 1.8.0-1.fc43 Β· Artistic-2.0 AND (GPL-1.0-or-later OR Artistic-1.0-Perl)
- fedora 44: perl-NetPacket 1.8.0-1.fc44 Β· Artistic-2.0 AND (GPL-1.0-or-later OR Artistic-1.0-Perl)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms