The next platform semi-dependant sublibrary of GNU LibC on my list is "inet", allowing you to open communication channels to computers elsewhere on the InterNET. The main platform-independant task of which is to resolve the destination, whether it's textually identified by IPv4, IPv6, hostname, or DNS addresses.
`inet_ntoa` applies the format string "%d.%d.%d.%d" to the given parsed IPv4 address. `inet_netof` & `inet_lnaof` are hueristics for extracting the mask from a sole IPv4 address.
`inet_network` parses IPv4 addresses into 4 bytes, with options for indicating numbers are written in base 8, 10, or 16.
`ether_ntohost` & `ether_hostton` wraps the "nss" sublibrary to resolve hosts identified by hostnames.
`ether_ntoa_r` applies the format string "%x:%x:%x:%x:%x:%x" to the given parsed IPv6 address.
`ether_line` & `ether_aton_r` parses an IPv6 address, only supporting base 16 numbers.
`rexec[_af]` (utilizing `ruserpass`) & the superceding `rcmd` implements protocols for running shell commands on a remote machine. `ruserpass` consolts common (non-specialized) environment variables for authentication parameters.
There's functions, with a preceding `__idna_name_classify_check, for resolving the IDNA encoding of domain names written in the broader Unicode character set, via a dynamically loaded library.
`__check_pf` indicates whether a IPv4 and/or IPv6 address was parsed.
There's functions converting connection "deadlines" to/from other formats used elsewhere.
There's functions for reading & writing (as per the IETF spec) the options in the extended IPv6 header provided from the kernel via `struct cmsg`. Including routing information for e.g. ping/traceroute.
`bindresvport` iterates over privileged ports to `bind` a socket on an open one.
To aid network management "nss" & "nscp" sublibraries are wrapped to implement "net groups".
`inet_makeaddr` merges a network address & host address into the space of a single structure, determining how far to shift the network address based on which "class" it is in before OR'ing the two together. This code can be overriden by platform specific code.
Fully platform-specific stubs include:
* `setsourcefilter` & `setipv4sourcefilter`
* `if_nametoindex`, `if_indextoname`, `if_freenameindex`, & `if_nameindex`
* `getifaddrs` & `freeifaddrs`
6/6 Fin for today!
I've just uploaded this thread to: https://adrian.geek.nz/gnu_docs/stdlib#internetworking-inet
Next I've got the "io" sublibrary on my list, which should be quick since it's almost entirely platform-dependant stubs. Then "login" followed up by a couple of junkdrawers. I should be able to finish going through all the sublibraries I colour coded orange this week!
More such writing at: https://adrian.geek.nz/docs
For people who care about, support, or build Free, Libre, and Open Source Software (FLOSS).