qlibs:(ipv6)

πŸ“¦ version 31, in alpine 3.24

qlibs:(ipv6) β€” IPv6 address evaluation and conversion πŸ’–

okay so bestie, welcome to the ipv6 page from the qlibs:(ipv6) manual β€” it's all IPv6 address evaluation and conversion, and it's giving tiny-header-file-with-big-main-character-energy. πŸ¦‹

✨ NAME ✨

ipv6 β€” IPv6 address evaluation and conversion

🌸 SYNOPSIS 🌸

#include "ip.h"

unsigned int ip6_fmt(char *s,char ip[16]);
unsigned int ip6_fmt_flat(char *s,char ip[16]);
unsigned int ip6_scan_flat(const char *s,char ip[16]);
unsigned int ip6_scan(const char *s,char ip[16]);
unsigned int ip6_scanbracket(const char *s,char ip[16]);
unsigned int ip6_ifscan(char *s,char ip[16],stralloc *ifname);
unsigned int ip6_cidr(char *s,char ip[16],unsigned long *plen);
unsigned int ip6_bytestring(stralloc *ip6string,char ip[16],int plen);

πŸŽ€ DESCRIPTION πŸŽ€

All of these cuties work with IPv6 addresses as char[16], and they're declared behind #include "ip.h". Here's the full rundown, no cap: πŸ’…

  • ip6_fmt β€” reads the char[16] IPv6 address and returns a compactified hexadecimal IPv6 address string fe80::fefe.
  • ip6_fmt_flat β€” reads the char[16] IPv6 address and returns all hexadecimal IPv6 address labels as string fe80:0000:....:fefe.
  • ip6_scan β€” reads a compactified IPv6 address string fe80::fefe and converts it to the char[16] IPv6 address.
  • ip6_scan_flat β€” reads an uncompressed IPv6 address as a hexadecimal string and returns its char[16] IPv6 address.
  • ip6_scanbracket β€” reads a compactified IPv6 address string enclosed in brackets [fe80::fefe], removes the brackets, and calls ip6_scan on the result.
  • ip6_ifscan β€” reads the compactified IPv6 address string appended with the interface_name fe80::fefe%eth0, returns ifname, and calls ip6_scan for the (stripped) IPv6 address.
  • ip6_cidr β€” reads the compactified CIDR IPv6 address string fe80::fefe/64, determines the prefix as integer plen, and calls ip6_scan. If no prefix is identified, it returns 128.
  • ip6_bytestring β€” reads the IPv6 address given as char[16] while returning a 0-terminated 'bytestring' representation 1001001.... up to the given prefix length plen.

Also, don't sleep on the macro:

  • ipv6_v4mapped β€” reads the IPv6 addresses given as char[16] and returns 0 in case the given IPv6 address is not a IPv4 mapped address.

πŸ’… RETURN CODES πŸ’…

The ip(6)* programs return the number of bytes processed. ip6_bytestring returns negative numbers on failure. So yeah, watch those negative numbers, bestie β€” failure is not the vibe. 😭

πŸ”₯ SEE ALSO πŸ”₯


byeee πŸ’– footer check: the source/version label is qlibs:(ipv6), and there's no separate date printed in the footer β€” that's the whole footer vibe. πŸŽ€βœ¨

πŸ“¦ where this page comes from