qlibs:(ipv6)
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 thechar[16]IPv6 address and returns a compactified hexadecimal IPv6 address stringfe80::fefe.ip6_fmt_flatβ reads thechar[16]IPv6 address and returns all hexadecimal IPv6 address labels as stringfe80:0000:....:fefe.ip6_scanβ reads a compactified IPv6 address stringfe80::fefeand converts it to thechar[16]IPv6 address.ip6_scan_flatβ reads an uncompressed IPv6 address as a hexadecimal string and returns itschar[16]IPv6 address.ip6_scanbracketβ reads a compactified IPv6 address string enclosed in brackets[fe80::fefe], removes the brackets, and callsip6_scanon the result.ip6_ifscanβ reads the compactified IPv6 address string appended with theinterface_namefe80::fefe%eth0, returnsifname, and callsip6_scanfor the (stripped) IPv6 address.ip6_cidrβ reads the compactified CIDR IPv6 address stringfe80::fefe/64, determines the prefix as integerplen, and callsip6_scan. If no prefix is identified, it returns128.ip6_bytestringβ reads the IPv6 address given aschar[16]while returning a 0-terminated 'bytestring' representation1001001....up to the given prefix lengthplen.
Also, don't sleep on the macro:
ipv6_v4mappedβ reads the IPv6 addresses given aschar[16]and returns0in 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
- alpine 3.24: fehqlibs-doc 31-r0 Β· Public-Domain
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms