Net::I...ymbols(3pm)

πŸ’– NAME πŸ’–

Net::Interface::NetSymbols β€” AF_ PF_ IFxxx type symbols


✨ SYNOPSIS ✨

okay bestie, listen. this page is Net::Interface::NetSymbols, dropping out of the User Contributed Perl Documentation, section 3pm. it exists. it's real. but bestie β€” do not touch it πŸ’€

this module gets built for your specific architecture during the make process, by inst/netsymbols.pl. So do NOT edit this module. edit inst/netsymbols.pl instead. that's the whole assignment 🫢

and like… what even is this file? it contains symbols arrays only for use by Net::Interface. in all other respects it is NOT functional. no cap. it's literally documentation and data arrays for this specific architecture. that's it, that's the vibes, that's the entire personality 🌸

⚠️ NOTE: WARNING !! the usage is Net::Interface NOT Net::Interface::NetSymbols iykyk πŸ’…
use Net::Interface qw(

        Net::Interface::NetSymbols::NI_ENDVAL();
        Net::Interface::NetSymbols::NI_UNIQUE();
AF_UNSPEC AF_FILE AF_LOCAL AF_UNIX AF_INET AF_AX25 AF_IPX AF_APPLETALK AF_X25 AF_INET6 AF_ROSE AF_DECnet AF_PACKET AF_ROUTE AF_ASH AF_ECONET AF_MAX

PF_UNSPEC PF_FILE PF_LOCAL PF_UNIX PF_INET PF_AX25 PF_IPX PF_APPLETALK
PF_X25 PF_INET6 PF_ROSE PF_DECnet PF_PACKET PF_ROUTE PF_ASH PF_ECONET
PF_MAX

IFF_ALLMULTI IFF_AUTOMEDIA IFF_BROADCAST IFF_DEBUG IFF_DYNAMIC
IFF_LOOPBACK IFF_MASTER IFF_MULTICAST IFF_NOARP IFF_NOTRAILERS
IFF_POINTOPOINT IFF_PORTSEL IFF_PROMISC IFF_RUNNING IFF_SLAVE IFF_UP
IFHWADDRLEN IFNAMSIZ IF_NAMESIZE

IFF_ALLMULTI IFF_AUTOMEDIA IFF_BROADCAST IFF_DEBUG IFF_DYNAMIC
IFF_LOOPBACK IFF_MASTER IFF_MULTICAST IFF_NOARP IFF_NOTRAILERS
IFF_POINTOPOINT IFF_PORTSEL IFF_PROMISC IFF_RUNNING IFF_SLAVE IFF_UP

:all :afs :pfs :ifs :iffs :iftype :scope

);

πŸ¦‹ DESCRIPTION πŸ¦‹

every single AF_XXX and PF_XXX symbol that's available in your local sys/socket.h, plus the usual aliases for AF_LOCAL, i.e. (AF_FILE AF_UNIX PF_LOCAL PF_FILE PF_UNIX). she's thorough πŸ’…

also all of the IFxxxx and IN6_IF symbols in net/if.h, netinet/in.h, netinet/in_var.h and their includes. the whole friend group showed up πŸŽ€

symbols can be accessed for their numeric value or their string name. so you can do either, whichever hits different:

i.e.  if ($family == AF_INET)
          do something...

  or  print AF_INET
  will product the string "inet"

so like β€” print AF_INET and it hands you back the string "inet". iconic honestly. same energy for:

    printf("family is %s",AF_INET);
or  sprint("family is %s",AF_INET);

and if you want the numeric value of the SYMBOL, lowkey just say:

    print (0 + SYMBOL), "\n";

on systems supporting IPV6, these extra symbols are available β€” you can slap them on the address type to figure out the address attributes πŸ‘‘

  • IPV6_ADDR_ANY β€” unknown
  • IPV6_ADDR_UNICAST β€” unicast
  • IPV6_ADDR_MULTICAST β€” multicast
  • IPV6_ADDR_ANYCAST β€” anycast
  • IPV6_ADDR_LOOPBACK β€” loopback
  • IPV6_ADDR_LINKLOCAL β€” link-local
  • IPV6_ADDR_SITELOCAL β€” site-local
  • IPV6_ADDR_COMPATv4 β€” compat-v4
  • IPV6_ADDR_SCOPE_MASK β€” scope-mask
  • IPV6_ADDR_MAPPED β€” mapped
  • IPV6_ADDR_RESERVED β€” reserved
  • IPV6_ADDR_ULUA β€” uniq-lcl-unicast
  • IPV6_ADDR_6TO4 β€” 6to4
  • IPV6_ADDR_6BONE β€” 6bone
  • IPV6_ADDR_AGU β€” global-unicast
  • IPV6_ADDR_UNSPECIFIED β€” unspecified
  • IPV6_ADDR_SOLICITED_NODE β€” solicited-node
  • IPV6_ADDR_ISATAP β€” ISATAP
  • IPV6_ADDR_PRODUCTIVE β€” productive
  • IPV6_ADDR_6TO4_MICROSOFT β€” 6to4-ms
  • IPV6_ADDR_TEREDO β€” teredo
  • IPV6_ADDR_ORCHID β€” orchid
  • IPV6_ADDR_NON_ROUTE_DOC β€” non-routeable-doc
if ($type & IPV6_ADDR_xxxx) {
    print IPV6_ADDR_xxxx,"\n";
}

and these ones can be equated to the scope of the address. main character scope energy πŸ’œ

  • RFC2373_GLOBAL β€” global-scope
  • RFC2373_ORGLOCAL β€” org-local
  • RFC2373_SITELOCAL β€” site-local
  • RFC2373_LINKLOCAL β€” link-local
  • RFC2373_NODELOCAL β€” loopback
  • LINUX_COMPATv4 β€” lx-compat-v4
if ($scope eq RFC2373_xxxx) {
    print RFC2373_xxxx,"\n";
}

and now the import tags, because the way that qw() just works πŸ”₯

  • :all β€” import all symbols. yes, all of them. go crazy ✨
  • :afs β€” import all AF_XXX symbols
  • :pfs β€” import all PF_XXX symbols
  • :ifs β€” import all IFxxxx symbols
  • :iffs β€” import all IFF symbols
  • :iftype β€” import all IPV6 type symbols
  • :scope β€” import all IPV6 scope symbols

🌈 non EXPORT functions 🌈

these ones do not get exported, so call them fully qualified or they will simply not hear you 🫢

  • Net::Interface::NetSymbols::NI_ENDVAL(); β€” reports the highest symbol value +1 of the :all symbols above. used for testing. that's her whole job πŸ’…
  • Net::Interface::NetSymbols::NI_UNIQUE(); β€” returns a hash pointer to the AF_ or PF_ symbol values, mapped to their character strings as defined for this architecture. like a little name-tag situation for every number πŸŽ€

i.e.

       0       => 'PF_UNSPEC',
       1       => 'PF_LOCAL',
       2       => 'PF_INET',
       3       => 'PF_AX25',
       4       => 'PF_IPX',
       5       => 'PF_APPLETALK',
       9       => 'PF_X25',
       10      => 'PF_INET6',
       11      => 'PF_ROSE',
       12      => 'PF_DECnet',
       17      => 'PF_PACKET',
       18      => 'PF_ASH',
       19      => 'PF_ECONET',
       46      => 'PF_MAX',

πŸ‘‘ AUTHOR πŸ‘‘

Michael Robinton <michael@bizsystems.com>


2008-2009 Michael Robinton, all rights reserved.

this library is free software. you can distribute it and/or modify it under the same terms as Perl itself. slay, honestly πŸ¦‹


and that's the whole page bestie, no notes. this was Net::Interface::NetSymbols from the User Contributed Perl Documentation, perl v5.42.3, dated 2026-08-19. go build something cute, and remember: it's Net::Interface, never Net::Interface::NetSymbols. periodt πŸ’–βœ¨

πŸ“¦ where this page comes from